summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--LICENSE.GPL2339
-rw-r--r--LICENSE.GPL3674
-rw-r--r--LICENSE.GPL3-EXCEPT704
-rw-r--r--LICENSE.LGPL3165
-rw-r--r--config.tests/assimp/main.cpp26
-rw-r--r--examples/qt3d/anaglyph-rendering/StereoCamera.qml50
-rw-r--r--examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml99
-rw-r--r--examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro2
-rw-r--r--examples/qt3d/anaglyph-rendering/main.cpp76
-rw-r--r--examples/qt3d/anaglyph-rendering/main.qml53
-rw-r--r--examples/qt3d/assimp-cpp/assimp-cpp.pro11
-rw-r--r--examples/qt3d/assimp-cpp/main.cpp168
-rw-r--r--examples/qt3d/assimp/assimp.pro17
-rw-r--r--examples/qt3d/assimp/doc/src/assimp.qdoc32
-rw-r--r--examples/qt3d/assimp/main.cpp113
-rw-r--r--examples/qt3d/assimp/main.qml194
-rw-r--r--examples/qt3d/audio-visualizer-qml/BarEntity.qml1
-rw-r--r--examples/qt3d/audio-visualizer-qml/Visualizer.qml9
-rw-r--r--examples/qt3d/audio-visualizer-qml/main.cpp9
-rw-r--r--examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro6
-rw-r--r--examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc10
-rw-r--r--examples/qt3d/basicshapes-cpp/main.cpp119
-rw-r--r--examples/qt3d/basicshapes-cpp/scenemodifier.cpp135
-rw-r--r--examples/qt3d/basicshapes-cpp/scenemodifier.h68
-rw-r--r--examples/qt3d/bigmodel-qml/MyEntity.qml50
-rw-r--r--examples/qt3d/bigmodel-qml/bigmodel-qml.pro18
-rw-r--r--examples/qt3d/bigmodel-qml/doc/src/bigmodel-qml.qdoc32
-rw-r--r--examples/qt3d/bigmodel-qml/main.cpp63
-rw-r--r--examples/qt3d/bigmodel-qml/main.qml94
-rw-r--r--examples/qt3d/bigscene-cpp/bigscene-cpp.pro13
-rw-r--r--examples/qt3d/bigscene-cpp/doc/src/bigscene-cpp.qdoc32
-rw-r--r--examples/qt3d/bigscene-cpp/entity.cpp126
-rw-r--r--examples/qt3d/bigscene-cpp/entity.h97
-rw-r--r--examples/qt3d/bigscene-cpp/main.cpp132
-rw-r--r--examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.pro12
-rw-r--r--examples/qt3d/bigscene-instanced-qml/main.cpp62
-rw-r--r--examples/qt3d/bigscene-instanced-qml/main.qml105
-rw-r--r--examples/qt3d/clip-planes-qml/CappingMaterialEffect.qml79
-rw-r--r--examples/qt3d/clip-planes-qml/ClipCappingFrameGraph.qml131
-rw-r--r--examples/qt3d/clip-planes-qml/ClipMaterialEffect.qml86
-rw-r--r--examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml73
-rw-r--r--examples/qt3d/clip-planes-qml/ClippingPlanes.qml166
-rw-r--r--examples/qt3d/clip-planes-qml/PlaneVisualizationMaterial.qml120
-rw-r--r--examples/qt3d/clip-planes-qml/clip-planes-qml.pro11
-rw-r--r--examples/qt3d/clip-planes-qml/main.cpp61
-rw-r--r--examples/qt3d/clip-planes-qml/main.qml101
-rw-r--r--examples/qt3d/common/window.cpp78
-rw-r--r--examples/qt3d/common/window.h53
-rw-r--r--examples/qt3d/compute-particles/ComputeFrameGraph.qml87
-rw-r--r--examples/qt3d/compute-particles/ComputeMaterial.qml118
-rw-r--r--examples/qt3d/compute-particles/ParticlesScene.qml247
-rw-r--r--examples/qt3d/compute-particles/compute-particles.pro14
-rw-r--r--examples/qt3d/compute-particles/compute-particles.qrc11
-rw-r--r--examples/qt3d/compute-particles/main.cpp66
-rw-r--r--examples/qt3d/compute-particles/main.qml146
-rw-r--r--examples/qt3d/compute-particles/particles.comp41
-rw-r--r--examples/qt3d/compute-particles/particles.frag33
-rw-r--r--examples/qt3d/compute-particles/particles.vert27
-rw-r--r--examples/qt3d/controls/Logo.qml59
-rw-r--r--examples/qt3d/controls/Qt_logo.obj8099
-rw-r--r--examples/qt3d/controls/main.cpp56
-rw-r--r--examples/qt3d/controls/main.qml70
-rw-r--r--examples/qt3d/cpp_example/cpp_example.pro12
-rw-r--r--examples/qt3d/cpp_example/doc/src/cpp_example.qdoc32
-rw-r--r--examples/qt3d/cpp_example/main.cpp139
-rw-r--r--examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro8
-rw-r--r--examples/qt3d/custom-mesh-cpp/main.cpp254
-rw-r--r--examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro11
-rw-r--r--examples/qt3d/custom-mesh-qml/main.cpp62
-rw-r--r--examples/qt3d/custom-mesh-qml/main.qml230
-rw-r--r--examples/qt3d/cylinder-cpp/cylinder-cpp.pro9
-rw-r--r--examples/qt3d/cylinder-cpp/doc/src/cylinder-cpp.qdoc32
-rw-r--r--examples/qt3d/cylinder-cpp/main.cpp125
-rw-r--r--examples/qt3d/cylinder-qml/cylinder-qml.pro14
-rw-r--r--examples/qt3d/cylinder-qml/doc/src/cylinder-qml.qdoc32
-rw-r--r--examples/qt3d/cylinder-qml/main.cpp63
-rw-r--r--examples/qt3d/cylinder-qml/main.qml93
-rw-r--r--examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro2
-rw-r--r--examples/qt3d/deferred-renderer-cpp/deferredrenderer.cpp85
-rw-r--r--examples/qt3d/deferred-renderer-cpp/deferredrenderer.h71
-rw-r--r--examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc10
-rw-r--r--examples/qt3d/deferred-renderer-cpp/finaleffect.cpp64
-rw-r--r--examples/qt3d/deferred-renderer-cpp/finaleffect.h58
-rw-r--r--examples/qt3d/deferred-renderer-cpp/gbuffer.cpp99
-rw-r--r--examples/qt3d/deferred-renderer-cpp/gbuffer.h64
-rw-r--r--examples/qt3d/deferred-renderer-cpp/main.cpp195
-rw-r--r--examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp58
-rw-r--r--examples/qt3d/deferred-renderer-cpp/pointlightblock.h63
-rw-r--r--examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp64
-rw-r--r--examples/qt3d/deferred-renderer-cpp/sceneeffect.h58
-rw-r--r--examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml83
-rw-r--r--examples/qt3d/deferred-renderer-qml/FinalEffect.qml177
-rw-r--r--examples/qt3d/deferred-renderer-qml/GBuffer.qml122
-rw-r--r--examples/qt3d/deferred-renderer-qml/SceneEffect.qml142
-rw-r--r--examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.pro21
-rw-r--r--examples/qt3d/deferred-renderer-qml/doc/src/deferred-renderer-qml.qdoc32
-rw-r--r--examples/qt3d/deferred-renderer-qml/main.cpp63
-rw-r--r--examples/qt3d/deferred-renderer-qml/main.qml239
-rw-r--r--examples/qt3d/dynamicscene-cpp/boxentity.cpp106
-rw-r--r--examples/qt3d/dynamicscene-cpp/boxentity.h80
-rw-r--r--examples/qt3d/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc32
-rw-r--r--examples/qt3d/dynamicscene-cpp/dynamicscene-cpp.pro16
-rw-r--r--examples/qt3d/dynamicscene-cpp/examplescene.cpp89
-rw-r--r--examples/qt3d/dynamicscene-cpp/examplescene.h66
-rw-r--r--examples/qt3d/dynamicscene-cpp/forwardrenderer.cpp56
-rw-r--r--examples/qt3d/dynamicscene-cpp/forwardrenderer.h58
-rw-r--r--examples/qt3d/dynamicscene-cpp/main.cpp89
-rw-r--r--examples/qt3d/enabled-qml/doc/src/enabled-qml.qdoc32
-rw-r--r--examples/qt3d/enabled-qml/enabled-qml.pro12
-rw-r--r--examples/qt3d/enabled-qml/main.cpp62
-rw-r--r--examples/qt3d/enabled-qml/main.qml190
-rw-r--r--examples/qt3d/exampleresources/obj.qrc5
-rw-r--r--examples/qt3d/examples.pri4
-rw-r--r--examples/qt3d/gltf/Wine.qml59
-rw-r--r--examples/qt3d/gltf/doc/src/gltf.qdoc32
-rw-r--r--examples/qt3d/gltf/gltf.pro18
-rw-r--r--examples/qt3d/gltf/main.cpp73
-rw-r--r--examples/qt3d/gltf/main.qml85
-rw-r--r--examples/qt3d/gooch-qml/MyEntity.qml52
-rw-r--r--examples/qt3d/gooch-qml/gooch-qml.pro16
-rw-r--r--examples/qt3d/gooch-qml/main.cpp65
-rw-r--r--examples/qt3d/gooch-qml/main.qml72
-rw-r--r--examples/qt3d/instanced-arrays-qml/instancebuffer.cpp52
-rw-r--r--examples/qt3d/instanced-arrays-qml/instancebuffer.h54
-rw-r--r--examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro2
-rw-r--r--examples/qt3d/instanced-arrays-qml/main.cpp74
-rw-r--r--examples/qt3d/instanced-arrays-qml/main.qml76
-rw-r--r--examples/qt3d/keyboardinput-qml/SphereEntity.qml66
-rw-r--r--examples/qt3d/keyboardinput-qml/doc/src/keyboardinput-qml.qdoc32
-rw-r--r--examples/qt3d/keyboardinput-qml/keyboardinput-qml.pro15
-rw-r--r--examples/qt3d/keyboardinput-qml/main.cpp62
-rw-r--r--examples/qt3d/keyboardinput-qml/main.qml91
-rw-r--r--examples/qt3d/lights/PlaneEntity.qml55
-rw-r--r--examples/qt3d/lights/lights.pro2
-rw-r--r--examples/qt3d/lights/main.cpp73
-rw-r--r--examples/qt3d/lights/main.qml84
-rw-r--r--examples/qt3d/loader-qml/CuboidEntity.qml82
-rw-r--r--examples/qt3d/loader-qml/SphereEntity.qml74
-rw-r--r--examples/qt3d/loader-qml/doc/src/loader-qml.qdoc32
-rw-r--r--examples/qt3d/loader-qml/loader-qml.pro16
-rw-r--r--examples/qt3d/loader-qml/main.cpp62
-rw-r--r--examples/qt3d/loader-qml/main.qml131
-rw-r--r--examples/qt3d/materials-cpp/barrel.cpp52
-rw-r--r--examples/qt3d/materials-cpp/barrel.h60
-rw-r--r--examples/qt3d/materials-cpp/doc/src/materials-cpp.qdoc10
-rw-r--r--examples/qt3d/materials-cpp/houseplant.cpp56
-rw-r--r--examples/qt3d/materials-cpp/houseplant.h60
-rw-r--r--examples/qt3d/materials-cpp/main.cpp94
-rw-r--r--examples/qt3d/materials-cpp/materials-cpp.pro2
-rw-r--r--examples/qt3d/materials-cpp/planeentity.cpp60
-rw-r--r--examples/qt3d/materials-cpp/planeentity.h60
-rw-r--r--examples/qt3d/materials-cpp/renderableentity.cpp59
-rw-r--r--examples/qt3d/materials-cpp/renderableentity.h55
-rw-r--r--examples/qt3d/materials-cpp/rotatingtrefoilknot.cpp54
-rw-r--r--examples/qt3d/materials-cpp/rotatingtrefoilknot.h54
-rw-r--r--examples/qt3d/materials-cpp/trefoilknot.cpp50
-rw-r--r--examples/qt3d/materials-cpp/trefoilknot.h50
-rw-r--r--examples/qt3d/materials/Barrel.qml51
-rw-r--r--examples/qt3d/materials/BasicCamera.qml54
-rw-r--r--examples/qt3d/materials/Chest.qml55
-rw-r--r--examples/qt3d/materials/HousePlant.qml51
-rw-r--r--examples/qt3d/materials/PlaneEntity.qml55
-rw-r--r--examples/qt3d/materials/RenderableEntity.qml54
-rw-r--r--examples/qt3d/materials/SortedForwardRenderer.qml91
-rw-r--r--examples/qt3d/materials/TrefoilKnot.qml50
-rw-r--r--examples/qt3d/materials/doc/src/materials.qdoc10
-rw-r--r--examples/qt3d/materials/main.cpp75
-rw-r--r--examples/qt3d/materials/main.qml62
-rw-r--r--examples/qt3d/materials/materials.pro2
-rw-r--r--examples/qt3d/mouseinput-qml/main.cpp64
-rw-r--r--examples/qt3d/mouseinput-qml/main.qml113
-rw-r--r--examples/qt3d/mouseinput-qml/mouseinput-qml.pro13
-rw-r--r--examples/qt3d/multiviewport/QuadViewportFrameGraph.qml107
-rw-r--r--examples/qt3d/multiviewport/SimpleCamera.qml54
-rw-r--r--examples/qt3d/multiviewport/doc/src/multiviewport.qdoc10
-rw-r--r--examples/qt3d/multiviewport/main.cpp72
-rw-r--r--examples/qt3d/multiviewport/main.qml57
-rw-r--r--examples/qt3d/multiviewport/multiviewport.pro2
-rw-r--r--examples/qt3d/picking-qml/main.cpp66
-rw-r--r--examples/qt3d/picking-qml/main.qml155
-rw-r--r--examples/qt3d/picking-qml/picking-qml.pro13
-rw-r--r--examples/qt3d/picking-qml/picking-qml.qrc5
-rw-r--r--examples/qt3d/planets-qml/CloudEffectDS.qml90
-rw-r--r--examples/qt3d/planets-qml/FpsDisplay.qml52
-rw-r--r--examples/qt3d/planets-qml/InfoSheet.qml52
-rw-r--r--examples/qt3d/planets-qml/Planet.qml57
-rw-r--r--examples/qt3d/planets-qml/PlanetButton.qml52
-rw-r--r--examples/qt3d/planets-qml/PlanetEffectD.qml106
-rw-r--r--examples/qt3d/planets-qml/PlanetEffectDB.qml106
-rw-r--r--examples/qt3d/planets-qml/PlanetEffectDSB.qml91
-rw-r--r--examples/qt3d/planets-qml/PlanetFrameGraph.qml134
-rw-r--r--examples/qt3d/planets-qml/PlanetMaterial.qml52
-rw-r--r--examples/qt3d/planets-qml/PlanetShadowEffectD.qml112
-rw-r--r--examples/qt3d/planets-qml/PlanetsLight.qml52
-rw-r--r--examples/qt3d/planets-qml/PlanetsMain.qml54
-rw-r--r--examples/qt3d/planets-qml/Ring.qml52
-rw-r--r--examples/qt3d/planets-qml/SolarSystem.qml65
-rw-r--r--examples/qt3d/planets-qml/StyledSlider.qml52
-rw-r--r--examples/qt3d/planets-qml/doc/src/planets-qml.qdoc52
-rw-r--r--examples/qt3d/planets-qml/main.cpp57
-rw-r--r--examples/qt3d/planets-qml/planets.js52
-rw-r--r--examples/qt3d/plasma/main.cpp64
-rw-r--r--examples/qt3d/plasma/main.qml81
-rw-r--r--examples/qt3d/plasma/plasma.pro18
-rw-r--r--examples/qt3d/playground-qml/AdsEffect.qml96
-rw-r--r--examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml270
-rw-r--r--examples/qt3d/playground-qml/ComplexTechnique.qml229
-rw-r--r--examples/qt3d/playground-qml/DetailView.qml51
-rw-r--r--examples/qt3d/playground-qml/MainView.qml115
-rw-r--r--examples/qt3d/playground-qml/MyForwardRenderer.qml94
-rw-r--r--examples/qt3d/playground-qml/RenderableEntity.qml50
-rw-r--r--examples/qt3d/playground-qml/assets/ball.obj10149
-rw-r--r--examples/qt3d/playground-qml/assets/cube.obj20
-rw-r--r--examples/qt3d/playground-qml/assets/test_scene.dae319
-rw-r--r--examples/qt3d/playground-qml/doc/src/playground-qml.qdoc32
-rw-r--r--examples/qt3d/playground-qml/main.cpp62
-rw-r--r--examples/qt3d/playground-qml/main.qml78
-rw-r--r--examples/qt3d/playground-qml/playground-qml.pro29
-rw-r--r--examples/qt3d/playground-qml/playground-qml.qrc15
-rw-r--r--examples/qt3d/qgltf/Scene.qml52
-rw-r--r--examples/qt3d/qgltf/main.cpp50
-rw-r--r--examples/qt3d/qgltf/main.qml66
-rw-r--r--examples/qt3d/qt3d.pro38
-rw-r--r--examples/qt3d/scene3d-loader/AnimatedEntity.qml131
-rw-r--r--examples/qt3d/scene3d-loader/Scene.qml44
-rw-r--r--examples/qt3d/scene3d-loader/Scene2.qml101
-rw-r--r--examples/qt3d/scene3d-loader/main.cpp52
-rw-r--r--examples/qt3d/scene3d-loader/main.qml68
-rw-r--r--examples/qt3d/scene3d-loader/scene3d-loader.pro17
-rw-r--r--examples/qt3d/scene3d/AnimatedEntity.qml74
-rw-r--r--examples/qt3d/scene3d/doc/src/scene3d.qdoc10
-rw-r--r--examples/qt3d/scene3d/main.cpp54
-rw-r--r--examples/qt3d/scene3d/main.qml56
-rw-r--r--examples/qt3d/shadow-map-qml/AdsEffect.qml83
-rw-r--r--examples/qt3d/shadow-map-qml/AdsMaterial.qml54
-rw-r--r--examples/qt3d/shadow-map-qml/GroundPlane.qml55
-rw-r--r--examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml129
-rw-r--r--examples/qt3d/shadow-map-qml/ShadowMapLight.qml54
-rw-r--r--examples/qt3d/shadow-map-qml/Toyplane.qml50
-rw-r--r--examples/qt3d/shadow-map-qml/Trefoil.qml50
-rw-r--r--examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc16
-rw-r--r--examples/qt3d/shadow-map-qml/main.cpp70
-rw-r--r--examples/qt3d/shadow-map-qml/main.qml60
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/ads.frag2
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/ads.vert2
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/shadowmap.frag2
-rw-r--r--examples/qt3d/shadow-map-qml/shaders/shadowmap.vert2
-rw-r--r--examples/qt3d/shadow-map-qml/shadow-map-qml.pro2
-rw-r--r--examples/qt3d/simple-cpp/doc/src/simple-cpp.qdoc10
-rw-r--r--examples/qt3d/simple-cpp/main.cpp188
-rw-r--r--examples/qt3d/simple-cpp/orbittransformcontroller.cpp116
-rw-r--r--examples/qt3d/simple-cpp/orbittransformcontroller.h100
-rw-r--r--examples/qt3d/simple-cpp/simple-cpp.pro8
-rw-r--r--examples/qt3d/simple-qml/CameraController.qml96
-rw-r--r--examples/qt3d/simple-qml/doc/src/simple-qml.qdoc10
-rw-r--r--examples/qt3d/simple-qml/main.cpp72
-rw-r--r--examples/qt3d/simple-qml/main.qml60
-rw-r--r--examples/qt3d/simple-qml/simple-qml.pro2
-rw-r--r--examples/qt3d/simple-shaders-qml/main.cpp62
-rw-r--r--examples/qt3d/simple-shaders-qml/main.qml198
-rw-r--r--examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro16
-rw-r--r--examples/qt3d/skybox/Skybox.qml144
-rw-r--r--examples/qt3d/skybox/doc/src/skybox.qdoc32
-rw-r--r--examples/qt3d/skybox/main.cpp63
-rw-r--r--examples/qt3d/skybox/main.qml80
-rw-r--r--examples/qt3d/skybox/skybox.pro12
-rw-r--r--examples/qt3d/tessellation-modes/BasicCamera.qml51
-rw-r--r--examples/qt3d/tessellation-modes/TessellatedQuad.qml64
-rw-r--r--examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml101
-rw-r--r--examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml62
-rw-r--r--examples/qt3d/tessellation-modes/doc/src/tessellation-modes.qdoc32
-rw-r--r--examples/qt3d/tessellation-modes/main.cpp75
-rw-r--r--examples/qt3d/tessellation-modes/main.qml110
-rw-r--r--examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp95
-rw-r--r--examples/qt3d/tessellation-modes/tessellatedquadmesh.h50
-rw-r--r--examples/qt3d/tessellation-modes/tessellation-modes.pro23
-rw-r--r--examples/qt3d/torus-qml/doc/src/torus-qml.qdoc32
-rw-r--r--examples/qt3d/torus-qml/main.cpp62
-rw-r--r--examples/qt3d/torus-qml/main.qml69
-rw-r--r--examples/qt3d/torus-qml/torus-qml.pro14
-rw-r--r--examples/qt3d/torus-qml/torus-qml.qrc5
-rw-r--r--examples/qt3d/transforms-qml/RenderableEntity.qml58
-rw-r--r--examples/qt3d/transforms-qml/TemporaryCamera.qml67
-rw-r--r--examples/qt3d/transforms-qml/TrefoilKnot.qml62
-rw-r--r--examples/qt3d/transforms-qml/main.cpp65
-rw-r--r--examples/qt3d/transforms-qml/main.qml100
-rw-r--r--examples/qt3d/transforms-qml/transforms-qml.pro18
-rw-r--r--examples/qt3d/transparency-qml-scene3d/Scene.qml186
-rw-r--r--examples/qt3d/transparency-qml-scene3d/main.cpp47
-rw-r--r--examples/qt3d/transparency-qml-scene3d/main.qml53
-rw-r--r--examples/qt3d/transparency-qml-scene3d/transparency-qml-scene3d.pro10
-rw-r--r--examples/qt3d/transparency-qml/main.cpp61
-rw-r--r--examples/qt3d/transparency-qml/main.qml187
-rw-r--r--examples/qt3d/transparency-qml/transparency-qml.pro10
-rw-r--r--examples/qt3d/wave/Background.qml94
-rw-r--r--examples/qt3d/wave/BackgroundEffect.qml56
-rw-r--r--examples/qt3d/wave/BasicCamera.qml54
-rw-r--r--examples/qt3d/wave/Wave.qml57
-rw-r--r--examples/qt3d/wave/WaveEffect.qml70
-rw-r--r--examples/qt3d/wave/WaveForwardRenderer.qml85
-rw-r--r--examples/qt3d/wave/WaveMaterial.qml58
-rw-r--r--examples/qt3d/wave/doc/src/wave.qdoc10
-rw-r--r--examples/qt3d/wave/main.cpp74
-rw-r--r--examples/qt3d/wave/main.qml72
-rw-r--r--examples/qt3d/wave/wave.pro3
-rw-r--r--examples/qt3d/wireframe/BasicCamera.qml54
-rw-r--r--examples/qt3d/wireframe/TrefoilKnot.qml50
-rw-r--r--examples/qt3d/wireframe/WireframeEffect.qml65
-rw-r--r--examples/qt3d/wireframe/WireframeMaterial.qml60
-rw-r--r--examples/qt3d/wireframe/doc/src/wireframe.qdoc10
-rw-r--r--examples/qt3d/wireframe/main.cpp70
-rw-r--r--examples/qt3d/wireframe/main.qml62
-rw-r--r--examples/qt3d/wireframe/wireframe.pro2
-rw-r--r--src/3rdparty/assimp/code/BlenderTessellator.cpp2
-rw-r--r--src/3rdparty/assimp/code/FBXConverter.cpp2
-rw-r--r--src/3rdparty/patches/0005-assimp-Fix-build-FBXConverter.patch35
-rw-r--r--src/core/aspects/aspects.pri1
-rw-r--r--src/core/aspects/qabstractaspect.cpp288
-rw-r--r--src/core/aspects/qabstractaspect.h55
-rw-r--r--src/core/aspects/qabstractaspect_p.h38
-rw-r--r--src/core/aspects/qaspectengine.cpp262
-rw-r--r--src/core/aspects/qaspectengine.h40
-rw-r--r--src/core/aspects/qaspectengine_p.h33
-rw-r--r--src/core/aspects/qaspectfactory.cpp27
-rw-r--r--src/core/aspects/qaspectfactory_p.h25
-rw-r--r--src/core/aspects/qaspectmanager.cpp187
-rw-r--r--src/core/aspects/qaspectmanager_p.h42
-rw-r--r--src/core/aspects/qaspectthread.cpp31
-rw-r--r--src/core/aspects/qaspectthread_p.h26
-rw-r--r--src/core/changes/changes.pri57
-rw-r--r--src/core/changes/qcomponentaddedchange.cpp90
-rw-r--r--src/core/changes/qcomponentaddedchange.h74
-rw-r--r--src/core/changes/qcomponentaddedchange_p.h82
-rw-r--r--src/core/changes/qcomponentremovedchange.cpp90
-rw-r--r--src/core/changes/qcomponentremovedchange.h74
-rw-r--r--src/core/changes/qcomponentremovedchange_p.h82
-rw-r--r--src/core/changes/qdynamicpropertyupdatedchange.cpp110
-rw-r--r--src/core/changes/qdynamicpropertyupdatedchange.h74
-rw-r--r--src/core/changes/qdynamicpropertyupdatedchange_p.h82
-rw-r--r--src/core/changes/qnodecreatedchange.cpp115
-rw-r--r--src/core/changes/qnodecreatedchange.h91
-rw-r--r--src/core/changes/qnodecreatedchange_p.h77
-rw-r--r--src/core/changes/qnodedestroyedchange.cpp63
-rw-r--r--src/core/changes/qnodedestroyedchange.h68
-rw-r--r--src/core/changes/qnodedestroyedchange_p.h59
-rw-r--r--src/core/changes/qpropertynodeaddedchange.cpp104
-rw-r--r--src/core/changes/qpropertynodeaddedchange.h72
-rw-r--r--src/core/changes/qpropertynodeaddedchange_p.h78
-rw-r--r--src/core/changes/qpropertynoderemovedchange.cpp109
-rw-r--r--src/core/changes/qpropertynoderemovedchange.h73
-rw-r--r--src/core/changes/qpropertynoderemovedchange_p.h79
-rw-r--r--src/core/changes/qpropertyupdatedchange.cpp115
-rw-r--r--src/core/changes/qpropertyupdatedchange.h71
-rw-r--r--src/core/changes/qpropertyupdatedchange_p.h78
-rw-r--r--src/core/changes/qpropertyupdatedchangebase.cpp96
-rw-r--r--src/core/changes/qpropertyupdatedchangebase.h70
-rw-r--r--src/core/changes/qpropertyupdatedchangebase_p.h77
-rw-r--r--src/core/changes/qpropertyvalueaddedchange.cpp99
-rw-r--r--src/core/changes/qpropertyvalueaddedchange.h72
-rw-r--r--src/core/changes/qpropertyvalueaddedchange_p.h79
-rw-r--r--src/core/changes/qpropertyvalueaddedchangebase.cpp97
-rw-r--r--src/core/changes/qpropertyvalueaddedchangebase.h70
-rw-r--r--src/core/changes/qpropertyvalueaddedchangebase_p.h77
-rw-r--r--src/core/changes/qpropertyvalueremovedchange.cpp99
-rw-r--r--src/core/changes/qpropertyvalueremovedchange.h72
-rw-r--r--src/core/changes/qpropertyvalueremovedchange_p.h79
-rw-r--r--src/core/changes/qpropertyvalueremovedchangebase.cpp97
-rw-r--r--src/core/changes/qpropertyvalueremovedchangebase.h70
-rw-r--r--src/core/changes/qpropertyvalueremovedchangebase_p.h77
-rw-r--r--src/core/changes/qscenechange.cpp149
-rw-r--r--src/core/changes/qscenechange.h104
-rw-r--r--src/core/changes/qscenechange_p.h84
-rw-r--r--src/core/changes/qstaticpropertyupdatedchangebase.cpp111
-rw-r--r--src/core/changes/qstaticpropertyupdatedchangebase.h71
-rw-r--r--src/core/changes/qstaticpropertyupdatedchangebase_p.h81
-rw-r--r--src/core/changes/qstaticpropertyvalueaddedchangebase.cpp88
-rw-r--r--src/core/changes/qstaticpropertyvalueaddedchangebase.h71
-rw-r--r--src/core/changes/qstaticpropertyvalueaddedchangebase_p.h78
-rw-r--r--src/core/changes/qstaticpropertyvalueremovedchangebase.cpp88
-rw-r--r--src/core/changes/qstaticpropertyvalueremovedchangebase.h71
-rw-r--r--src/core/changes/qstaticpropertyvalueremovedchangebase_p.h78
-rw-r--r--src/core/changes/qtypedpropertyupdatechange_p.h81
-rw-r--r--src/core/core-components/core-components.pri11
-rw-r--r--src/core/core-components/qcamera.cpp482
-rw-r--r--src/core/core-components/qcamera.h169
-rw-r--r--src/core/core-components/qcamera_p.h89
-rw-r--r--src/core/core-components/qcameralens.cpp473
-rw-r--r--src/core/core-components/qcameralens.h137
-rw-r--r--src/core/core-components/qcameralens_p.h129
-rw-r--r--src/core/core.pri28
-rw-r--r--src/core/core.pro10
-rw-r--r--src/core/corelogging.cpp25
-rw-r--r--src/core/corelogging_p.h25
-rw-r--r--src/core/jobs/dependencyhandler.cpp27
-rw-r--r--src/core/jobs/dependencyhandler_p.h27
-rw-r--r--src/core/jobs/qabstractaspectjobmanager.cpp25
-rw-r--r--src/core/jobs/qabstractaspectjobmanager_p.h27
-rw-r--r--src/core/jobs/qaspectjob.cpp55
-rw-r--r--src/core/jobs/qaspectjob.h28
-rw-r--r--src/core/jobs/qaspectjob_p.h62
-rw-r--r--src/core/jobs/qaspectjobmanager.cpp37
-rw-r--r--src/core/jobs/qaspectjobmanager_p.h25
-rw-r--r--src/core/jobs/qaspectjobproviderinterface_p.h25
-rw-r--r--src/core/jobs/qthreadpooler.cpp116
-rw-r--r--src/core/jobs/qthreadpooler_p.h44
-rw-r--r--src/core/jobs/task.cpp50
-rw-r--r--src/core/jobs/task_p.h27
-rw-r--r--src/core/nodes/nodes.pri12
-rw-r--r--src/core/nodes/propertychangehandler.cpp80
-rw-r--r--src/core/nodes/propertychangehandler_p.h82
-rw-r--r--src/core/nodes/qabstractnodefactory.cpp51
-rw-r--r--src/core/nodes/qabstractnodefactory.h72
-rw-r--r--src/core/nodes/qabstractnodefactory_p.h87
-rw-r--r--src/core/nodes/qbackendnode.cpp188
-rw-r--r--src/core/nodes/qbackendnode.h73
-rw-r--r--src/core/nodes/qbackendnode_p.h36
-rw-r--r--src/core/nodes/qcomponent.cpp79
-rw-r--r--src/core/nodes/qcomponent.h39
-rw-r--r--src/core/nodes/qcomponent_p.h26
-rw-r--r--src/core/nodes/qdestructionidandtypecollector.cpp51
-rw-r--r--src/core/nodes/qdestructionidandtypecollector_p.h83
-rw-r--r--src/core/nodes/qentity.cpp131
-rw-r--r--src/core/nodes/qentity.h40
-rw-r--r--src/core/nodes/qentity_p.h34
-rw-r--r--src/core/nodes/qnode.cpp504
-rw-r--r--src/core/nodes/qnode.h106
-rw-r--r--src/core/nodes/qnode_p.h37
-rw-r--r--src/core/nodes/qnodecreatedchangegenerator.cpp52
-rw-r--r--src/core/nodes/qnodecreatedchangegenerator_p.h93
-rw-r--r--src/core/nodes/qnodeid.cpp102
-rw-r--r--src/core/nodes/qnodeid.h66
-rw-r--r--src/core/nodes/qnodevisitor.cpp29
-rw-r--r--src/core/nodes/qnodevisitor_p.h44
-rw-r--r--src/core/qbackendnodefactory.cpp25
-rw-r--r--src/core/qbackendnodefactory_p.h29
-rw-r--r--src/core/qbackendscenepropertychange.cpp103
-rw-r--r--src/core/qbackendscenepropertychange.h73
-rw-r--r--src/core/qbackendscenepropertychange_p.h75
-rw-r--r--src/core/qchangearbiter.cpp88
-rw-r--r--src/core/qchangearbiter_p.h29
-rw-r--r--src/core/qlockableobserverinterface.cpp25
-rw-r--r--src/core/qlockableobserverinterface_p.h25
-rw-r--r--src/core/qobservableinterface.cpp25
-rw-r--r--src/core/qobservableinterface_p.h25
-rw-r--r--src/core/qobserverinterface.cpp25
-rw-r--r--src/core/qobserverinterface_p.h25
-rw-r--r--src/core/qpostman.cpp47
-rw-r--r--src/core/qpostman_p.h26
-rw-r--r--src/core/qray3d.cpp373
-rw-r--r--src/core/qray3d.h108
-rw-r--r--src/core/qscene.cpp75
-rw-r--r--src/core/qscene_p.h43
-rw-r--r--src/core/qscenechange.cpp139
-rw-r--r--src/core/qscenechange.h106
-rw-r--r--src/core/qscenechange_p.h81
-rw-r--r--src/core/qsceneobserverinterface.cpp25
-rw-r--r--src/core/qsceneobserverinterface_p.h25
-rw-r--r--src/core/qscenepropertychange.cpp106
-rw-r--r--src/core/qscenepropertychange.h72
-rw-r--r--src/core/qscenepropertychange_p.h78
-rw-r--r--src/core/qscheduler.cpp33
-rw-r--r--src/core/qscheduler_p.h26
-rw-r--r--src/core/qt3dcore_global.h44
-rw-r--r--src/core/qt3dcore_global_p.h25
-rw-r--r--src/core/qtickclock.cpp25
-rw-r--r--src/core/qtickclock_p.h25
-rw-r--r--src/core/resources/qboundedcircularbuffer_p.h25
-rw-r--r--src/core/resources/qcircularbuffer_p.h43
-rw-r--r--src/core/resources/qframeallocator.cpp51
-rw-r--r--src/core/resources/qframeallocator_p.h25
-rw-r--r--src/core/resources/qframeallocator_p_p.h25
-rw-r--r--src/core/resources/qhandle_p.h31
-rw-r--r--src/core/resources/qhandlemanager_p.h65
-rw-r--r--src/core/resources/qresourcemanager.cpp25
-rw-r--r--src/core/resources/qresourcemanager_p.h224
-rw-r--r--src/core/services/nullservices_p.h26
-rw-r--r--src/core/services/qabstractframeadvanceservice.cpp25
-rw-r--r--src/core/services/qabstractframeadvanceservice_p.h25
-rw-r--r--src/core/services/qabstractframeadvanceservice_p_p.h25
-rw-r--r--src/core/services/qabstractserviceprovider_p.h25
-rw-r--r--src/core/services/qeventfilterservice.cpp116
-rw-r--r--src/core/services/qeventfilterservice_p.h25
-rw-r--r--src/core/services/qopenglinformationservice.cpp25
-rw-r--r--src/core/services/qopenglinformationservice_p.h25
-rw-r--r--src/core/services/qopenglinformationservice_p_p.h25
-rw-r--r--src/core/services/qservicelocator.cpp27
-rw-r--r--src/core/services/qservicelocator_p.h25
-rw-r--r--src/core/services/qsysteminformationservice.cpp25
-rw-r--r--src/core/services/qsysteminformationservice_p.h25
-rw-r--r--src/core/services/qsysteminformationservice_p_p.h25
-rw-r--r--src/core/services/qtickclockservice.cpp25
-rw-r--r--src/core/services/qtickclockservice_p.h25
-rw-r--r--src/core/transforms/qmath3d_p.h25
-rw-r--r--src/core/transforms/qtransform.cpp257
-rw-r--r--src/core/transforms/qtransform.h38
-rw-r--r--src/core/transforms/qtransform_p.h33
-rw-r--r--src/doc/qt3d.qdocconf2
-rw-r--r--src/doc/snippets/code/src_core_qcircularbuffer.cpp25
-rw-r--r--src/doc/src/externalresources.qdoc25
-rw-r--r--src/doc/src/qcircularbuffer.qdoc25
-rw-r--r--src/doc/src/qt3d-examples.qdoc10
-rw-r--r--src/doc/src/qt3d-index.qdoc27
-rw-r--r--src/doc/src/qt3d-module.qdoc25
-rw-r--r--src/doc/src/qt3d-overview.qdoc25
-rw-r--r--src/doc/src/qt3dinput-module.qdoc10
-rw-r--r--src/doc/src/qt3dlogic-module.qdoc10
-rw-r--r--src/doc/src/qt3drender-framegraph.qdoc51
-rw-r--r--src/doc/src/qt3drender-module.qdoc25
-rw-r--r--src/extras/defaults/defaults.pri47
-rw-r--r--src/extras/defaults/qdiffusemapmaterial.cpp316
-rw-r--r--src/extras/defaults/qdiffusemapmaterial.h100
-rw-r--r--src/extras/defaults/qdiffusemapmaterial_p.h111
-rw-r--r--src/extras/defaults/qdiffusespecularmapmaterial.cpp330
-rw-r--r--src/extras/defaults/qdiffusespecularmapmaterial.h99
-rw-r--r--src/extras/defaults/qdiffusespecularmapmaterial_p.h114
-rw-r--r--src/extras/defaults/qfirstpersoncameracontroller.cpp253
-rw-r--r--src/extras/defaults/qfirstpersoncameracontroller.h100
-rw-r--r--src/extras/defaults/qfirstpersoncameracontroller_p.h145
-rw-r--r--src/extras/defaults/qforwardrenderer.cpp197
-rw-r--r--src/extras/defaults/qforwardrenderer.h92
-rw-r--r--src/extras/defaults/qforwardrenderer_p.h92
-rw-r--r--src/extras/defaults/qgoochmaterial.cpp363
-rw-r--r--src/extras/defaults/qgoochmaterial.h105
-rw-r--r--src/extras/defaults/qgoochmaterial_p.h111
-rw-r--r--src/extras/defaults/qnormaldiffusemapalphamaterial.cpp186
-rw-r--r--src/extras/defaults/qnormaldiffusemapalphamaterial.h67
-rw-r--r--src/extras/defaults/qnormaldiffusemapalphamaterial_p.h87
-rw-r--r--src/extras/defaults/qnormaldiffusemapmaterial.cpp363
-rw-r--r--src/extras/defaults/qnormaldiffusemapmaterial.h107
-rw-r--r--src/extras/defaults/qnormaldiffusemapmaterial_p.h115
-rw-r--r--src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp379
-rw-r--r--src/extras/defaults/qnormaldiffusespecularmapmaterial.h101
-rw-r--r--src/extras/defaults/qnormaldiffusespecularmapmaterial_p.h116
-rw-r--r--src/extras/defaults/qorbitcameracontroller.cpp321
-rw-r--r--src/extras/defaults/qorbitcameracontroller.h91
-rw-r--r--src/extras/defaults/qorbitcameracontroller_p.h136
-rw-r--r--src/extras/defaults/qpervertexcolormaterial.cpp163
-rw-r--r--src/extras/defaults/qpervertexcolormaterial.h69
-rw-r--r--src/extras/defaults/qpervertexcolormaterial_p.h99
-rw-r--r--src/extras/defaults/qphongalphamaterial.cpp327
-rw-r--r--src/extras/defaults/qphongalphamaterial.h94
-rw-r--r--src/extras/defaults/qphongalphamaterial_p.h116
-rw-r--r--src/extras/defaults/qphongmaterial.cpp275
-rw-r--r--src/extras/defaults/qphongmaterial.h90
-rw-r--r--src/extras/defaults/qphongmaterial_p.h108
-rw-r--r--src/extras/defaults/qskyboxentity.cpp293
-rw-r--r--src/extras/defaults/qskyboxentity.h81
-rw-r--r--src/extras/defaults/qskyboxentity_p.h122
-rw-r--r--src/extras/defaults/qt3dwindow.cpp179
-rw-r--r--src/extras/defaults/qt3dwindow.h142
-rw-r--r--src/extras/extras.pro19
-rw-r--r--src/extras/extras.qrc43
-rw-r--r--src/extras/geometries/geometries.pri35
-rw-r--r--src/extras/geometries/qconegeometry.cpp590
-rw-r--r--src/extras/geometries/qconegeometry.h120
-rw-r--r--src/extras/geometries/qconegeometry_p.h97
-rw-r--r--src/extras/geometries/qconemesh.cpp148
-rw-r--r--src/extras/geometries/qconemesh.h108
-rw-r--r--src/extras/geometries/qcuboidgeometry.cpp826
-rw-r--r--src/extras/geometries/qcuboidgeometry.h122
-rw-r--r--src/extras/geometries/qcuboidgeometry_p.h100
-rw-r--r--src/extras/geometries/qcuboidmesh.cpp212
-rw-r--r--src/extras/geometries/qcuboidmesh.h108
-rw-r--r--src/extras/geometries/qcylindergeometry.cpp585
-rw-r--r--src/extras/geometries/qcylindergeometry.h109
-rw-r--r--src/extras/geometries/qcylindergeometry_p.h93
-rw-r--r--src/extras/geometries/qcylindermesh.cpp181
-rw-r--r--src/extras/geometries/qcylindermesh.h97
-rw-r--r--src/extras/geometries/qplanegeometry.cpp528
-rw-r--r--src/extras/geometries/qplanegeometry.h109
-rw-r--r--src/extras/geometries/qplanegeometry_p.h93
-rw-r--r--src/extras/geometries/qplanemesh.cpp146
-rw-r--r--src/extras/geometries/qplanemesh.h94
-rw-r--r--src/extras/geometries/qspheregeometry.cpp583
-rw-r--r--src/extras/geometries/qspheregeometry.h112
-rw-r--r--src/extras/geometries/qspheregeometry_p.h93
-rw-r--r--src/extras/geometries/qspheremesh.cpp169
-rw-r--r--src/extras/geometries/qspheremesh.h98
-rw-r--r--src/extras/geometries/qtorusgeometry.cpp510
-rw-r--r--src/extras/geometries/qtorusgeometry.h111
-rw-r--r--src/extras/geometries/qtorusgeometry_p.h93
-rw-r--r--src/extras/geometries/qtorusmesh.cpp174
-rw-r--r--src/extras/geometries/qtorusmesh.h96
-rw-r--r--src/extras/qt3dextras_global.h59
-rw-r--r--src/extras/shaders/es2/diffusemap.frag (renamed from src/render/shaders/es2/diffusemap.frag)0
-rw-r--r--src/extras/shaders/es2/diffusemap.vert (renamed from src/render/shaders/es2/diffusemap.vert)0
-rw-r--r--src/extras/shaders/es2/diffusespecularmap.frag (renamed from src/render/shaders/es2/diffusespecularmap.frag)0
-rw-r--r--src/extras/shaders/es2/gooch.frag (renamed from src/render/shaders/es2/gooch.frag)0
-rw-r--r--src/extras/shaders/es2/gooch.vert (renamed from src/render/shaders/es2/gooch.vert)0
-rw-r--r--src/extras/shaders/es2/light.inc.frag131
-rw-r--r--src/extras/shaders/es2/light.inc.frag100 (renamed from src/render/shaders/es2/light.inc.frag100)0
-rw-r--r--src/extras/shaders/es2/normaldiffusemap.frag (renamed from src/render/shaders/es2/normaldiffusemap.frag)0
-rw-r--r--src/extras/shaders/es2/normaldiffusemap.vert (renamed from src/render/shaders/es2/normaldiffusemap.vert)0
-rw-r--r--src/extras/shaders/es2/normaldiffusemapalpha.frag (renamed from src/render/shaders/es2/normaldiffusemapalpha.frag)0
-rw-r--r--src/extras/shaders/es2/normaldiffusespecularmap.frag (renamed from src/render/shaders/es2/normaldiffusespecularmap.frag)0
-rw-r--r--src/extras/shaders/es2/pervertexcolor.frag (renamed from src/render/shaders/es2/pervertexcolor.frag)0
-rw-r--r--src/extras/shaders/es2/pervertexcolor.vert (renamed from src/render/shaders/es2/pervertexcolor.vert)0
-rw-r--r--src/extras/shaders/es2/phong.frag20
-rw-r--r--src/extras/shaders/es2/phong.vert17
-rw-r--r--src/extras/shaders/es2/phongalpha.frag (renamed from src/render/shaders/es2/phongalpha.frag)0
-rw-r--r--src/extras/shaders/es2/skybox.frag (renamed from src/render/shaders/es2/skybox.frag)0
-rw-r--r--src/extras/shaders/es2/skybox.vert (renamed from src/render/shaders/es2/skybox.vert)0
-rw-r--r--src/extras/shaders/es2/unlittexture.frag (renamed from src/render/shaders/es2/unlittexture.frag)0
-rw-r--r--src/extras/shaders/es2/unlittexture.vert (renamed from src/render/shaders/es2/unlittexture.vert)0
-rw-r--r--src/extras/shaders/gl3/diffusemap.frag (renamed from src/render/shaders/gl3/diffusemap.frag)0
-rw-r--r--src/extras/shaders/gl3/diffusemap.vert (renamed from src/render/shaders/gl3/diffusemap.vert)0
-rw-r--r--src/extras/shaders/gl3/diffusespecularmap.frag (renamed from src/render/shaders/gl3/diffusespecularmap.frag)0
-rw-r--r--src/extras/shaders/gl3/gooch.frag (renamed from src/render/shaders/gl3/gooch.frag)0
-rw-r--r--src/extras/shaders/gl3/gooch.vert (renamed from src/render/shaders/gl3/gooch.vert)0
-rw-r--r--src/extras/shaders/gl3/light.inc.frag139
-rw-r--r--src/extras/shaders/gl3/normaldiffusemap.frag (renamed from src/render/shaders/gl3/normaldiffusemap.frag)0
-rw-r--r--src/extras/shaders/gl3/normaldiffusemap.vert (renamed from src/render/shaders/gl3/normaldiffusemap.vert)0
-rw-r--r--src/extras/shaders/gl3/normaldiffusemapalpha.frag (renamed from src/render/shaders/gl3/normaldiffusemapalpha.frag)0
-rw-r--r--src/extras/shaders/gl3/normaldiffusespecularmap.frag (renamed from src/render/shaders/gl3/normaldiffusespecularmap.frag)0
-rw-r--r--src/extras/shaders/gl3/pervertexcolor.frag (renamed from src/render/shaders/gl3/pervertexcolor.frag)0
-rw-r--r--src/extras/shaders/gl3/pervertexcolor.vert (renamed from src/render/shaders/gl3/pervertexcolor.vert)0
-rw-r--r--src/extras/shaders/gl3/phong.frag22
-rw-r--r--src/extras/shaders/gl3/phong.vert19
-rw-r--r--src/extras/shaders/gl3/phongalpha.frag (renamed from src/render/shaders/gl3/phongalpha.frag)0
-rw-r--r--src/extras/shaders/gl3/skybox.frag (renamed from src/render/shaders/gl3/skybox.frag)0
-rw-r--r--src/extras/shaders/gl3/skybox.vert (renamed from src/render/shaders/gl3/skybox.vert)0
-rw-r--r--src/extras/shaders/gl3/unlittexture.frag (renamed from src/render/shaders/gl3/unlittexture.frag)0
-rw-r--r--src/extras/shaders/gl3/unlittexture.vert (renamed from src/render/shaders/gl3/unlittexture.vert)0
-rw-r--r--src/input/backend/abstractaxisinput.cpp85
-rw-r--r--src/input/backend/abstractaxisinput_p.h84
-rw-r--r--src/input/backend/action.cpp89
-rw-r--r--src/input/backend/action_p.h32
-rw-r--r--src/input/backend/actioninput.cpp70
-rw-r--r--src/input/backend/actioninput_p.h34
-rw-r--r--src/input/backend/analogaxisinput.cpp87
-rw-r--r--src/input/backend/analogaxisinput_p.h83
-rw-r--r--src/input/backend/assignkeyboardfocusjob.cpp46
-rw-r--r--src/input/backend/assignkeyboardfocusjob_p.h29
-rw-r--r--src/input/backend/axis.cpp89
-rw-r--r--src/input/backend/axis_p.h32
-rw-r--r--src/input/backend/axisactionhandler.cpp136
-rw-r--r--src/input/backend/axisactionhandler_p.h101
-rw-r--r--src/input/backend/axisactionpayload_p.h126
-rw-r--r--src/input/backend/axisinput.cpp114
-rw-r--r--src/input/backend/axisinput_p.h88
-rw-r--r--src/input/backend/axissetting.cpp64
-rw-r--r--src/input/backend/axissetting_p.h37
-rw-r--r--src/input/backend/backend.pri49
-rw-r--r--src/input/backend/buttonaxisinput.cpp121
-rw-r--r--src/input/backend/buttonaxisinput_p.h102
-rw-r--r--src/input/backend/cameracontroller.cpp365
-rw-r--r--src/input/backend/cameracontroller_p.h175
-rw-r--r--src/input/backend/eventsourcesetterhelper.cpp91
-rw-r--r--src/input/backend/eventsourcesetterhelper_p.h98
-rw-r--r--src/input/backend/genericdevicebackendnode.cpp126
-rw-r--r--src/input/backend/genericdevicebackendnode_p.h105
-rw-r--r--src/input/backend/handle_types_p.h51
-rw-r--r--src/input/backend/inputbackendnodefunctor_p.h37
-rw-r--r--src/input/backend/inputchord.cpp140
-rw-r--r--src/input/backend/inputchord_p.h92
-rw-r--r--src/input/backend/inputhandler.cpp193
-rw-r--r--src/input/backend/inputhandler_p.h106
-rw-r--r--src/input/backend/inputmanagers_p.h119
-rw-r--r--src/input/backend/inputsequence.cpp165
-rw-r--r--src/input/backend/inputsequence_p.h97
-rw-r--r--src/input/backend/inputsettings.cpp114
-rw-r--r--src/input/backend/inputsettings_p.h99
-rw-r--r--src/input/backend/keyboardcontroller.cpp480
-rw-r--r--src/input/backend/keyboardcontroller_p.h289
-rw-r--r--src/input/backend/keyboarddevice.cpp476
-rw-r--r--src/input/backend/keyboarddevice_p.h290
-rw-r--r--src/input/backend/keyboardeventfilter.cpp25
-rw-r--r--src/input/backend/keyboardeventfilter_p.h25
-rw-r--r--src/input/backend/keyboardhandler.cpp173
-rw-r--r--src/input/backend/keyboardhandler_p.h107
-rw-r--r--src/input/backend/keyboardinput.cpp174
-rw-r--r--src/input/backend/keyboardinput_p.h105
-rw-r--r--src/input/backend/keyboardmousedeviceintegration.cpp91
-rw-r--r--src/input/backend/keyboardmousedeviceintegration_p.h85
-rw-r--r--src/input/backend/keyboardmousegenericdeviceintegration.cpp101
-rw-r--r--src/input/backend/keyboardmousegenericdeviceintegration_p.h89
-rw-r--r--src/input/backend/keyeventdispatcherjob.cpp37
-rw-r--r--src/input/backend/keyeventdispatcherjob_p.h29
-rw-r--r--src/input/backend/logicaldevice.cpp94
-rw-r--r--src/input/backend/logicaldevice_p.h39
-rw-r--r--src/input/backend/mousecontroller.cpp174
-rw-r--r--src/input/backend/mousecontroller_p.h131
-rw-r--r--src/input/backend/mousedevice.cpp177
-rw-r--r--src/input/backend/mousedevice_p.h135
-rw-r--r--src/input/backend/mouseeventdispatcherjob.cpp45
-rw-r--r--src/input/backend/mouseeventdispatcherjob_p.h32
-rw-r--r--src/input/backend/mouseeventfilter.cpp39
-rw-r--r--src/input/backend/mouseeventfilter_p.h25
-rw-r--r--src/input/backend/mousehandler.cpp156
-rw-r--r--src/input/backend/mousehandler_p.h104
-rw-r--r--src/input/backend/mouseinput.cpp156
-rw-r--r--src/input/backend/mouseinput_p.h103
-rw-r--r--src/input/backend/movingaverage.cpp25
-rw-r--r--src/input/backend/movingaverage_p.h25
-rw-r--r--src/input/backend/qabstractphysicaldevicebackendnode.cpp117
-rw-r--r--src/input/backend/qabstractphysicaldevicebackendnode.h78
-rw-r--r--src/input/backend/qabstractphysicaldevicebackendnode_p.h83
-rw-r--r--src/input/backend/qabstractphysicaldevicebackendnode_p_p.h110
-rw-r--r--src/input/backend/updateaxisactionjob.cpp183
-rw-r--r--src/input/backend/updateaxisactionjob_p.h35
-rw-r--r--src/input/backend/updatehandlerjob.cpp155
-rw-r--r--src/input/backend/updatehandlerjob_p.h88
-rw-r--r--src/input/frontend/frontend.pri73
-rw-r--r--src/input/frontend/qabstractactioninput.cpp82
-rw-r--r--src/input/frontend/qabstractactioninput.h65
-rw-r--r--src/input/frontend/qabstractactioninput_p.h68
-rw-r--r--src/input/frontend/qabstractaxisinput.cpp96
-rw-r--r--src/input/frontend/qabstractaxisinput.h80
-rw-r--r--src/input/frontend/qabstractaxisinput_p.h85
-rw-r--r--src/input/frontend/qabstractphysicaldevice.cpp188
-rw-r--r--src/input/frontend/qabstractphysicaldevice.h43
-rw-r--r--src/input/frontend/qabstractphysicaldevice_p.h33
-rw-r--r--src/input/frontend/qaction.cpp155
-rw-r--r--src/input/frontend/qaction.h51
-rw-r--r--src/input/frontend/qaction_p.h96
-rw-r--r--src/input/frontend/qactioninput.cpp170
-rw-r--r--src/input/frontend/qactioninput.h45
-rw-r--r--src/input/frontend/qactioninput_p.h87
-rw-r--r--src/input/frontend/qanalogaxisinput.cpp103
-rw-r--r--src/input/frontend/qanalogaxisinput.h78
-rw-r--r--src/input/frontend/qanalogaxisinput_p.h81
-rw-r--r--src/input/frontend/qaxis.cpp103
-rw-r--r--src/input/frontend/qaxis.h48
-rw-r--r--src/input/frontend/qaxis_p.h94
-rw-r--r--src/input/frontend/qaxisactionhandler.cpp135
-rw-r--r--src/input/frontend/qaxisactionhandler.h85
-rw-r--r--src/input/frontend/qaxisactionhandler_p.h73
-rw-r--r--src/input/frontend/qaxisinput.cpp163
-rw-r--r--src/input/frontend/qaxisinput.h92
-rw-r--r--src/input/frontend/qaxissetting.cpp86
-rw-r--r--src/input/frontend/qaxissetting.h48
-rw-r--r--src/input/frontend/qaxissetting_p.h88
-rw-r--r--src/input/frontend/qbuttonaxisinput.cpp151
-rw-r--r--src/input/frontend/qbuttonaxisinput.h93
-rw-r--r--src/input/frontend/qbuttonaxisinput_p.h89
-rw-r--r--src/input/frontend/qgamepadinput.cpp106
-rw-r--r--src/input/frontend/qgamepadinput_p.h79
-rw-r--r--src/input/frontend/qgenericinputdevice.cpp100
-rw-r--r--src/input/frontend/qgenericinputdevice_p.h83
-rw-r--r--src/input/frontend/qinputaspect.cpp208
-rw-r--r--src/input/frontend/qinputaspect.h47
-rw-r--r--src/input/frontend/qinputaspect_p.h32
-rw-r--r--src/input/frontend/qinputchord.cpp215
-rw-r--r--src/input/frontend/qinputchord.h84
-rw-r--r--src/input/frontend/qinputchord_p.h87
-rw-r--r--src/input/frontend/qinputdeviceintegration.cpp31
-rw-r--r--src/input/frontend/qinputdeviceintegration.h97
-rw-r--r--src/input/frontend/qinputdeviceintegration_p.h75
-rw-r--r--src/input/frontend/qinputdeviceintegration_p_p.h78
-rw-r--r--src/input/frontend/qinputdeviceintegrationfactory.cpp37
-rw-r--r--src/input/frontend/qinputdeviceintegrationfactory_p.h25
-rw-r--r--src/input/frontend/qinputdeviceplugin.cpp29
-rw-r--r--src/input/frontend/qinputdeviceplugin.h68
-rw-r--r--src/input/frontend/qinputdeviceplugin_p.h82
-rw-r--r--src/input/frontend/qinputsequence.cpp262
-rw-r--r--src/input/frontend/qinputsequence.h88
-rw-r--r--src/input/frontend/qinputsequence_p.h89
-rw-r--r--src/input/frontend/qinputsettings.cpp93
-rw-r--r--src/input/frontend/qinputsettings.h77
-rw-r--r--src/input/frontend/qinputsettings_p.h78
-rw-r--r--src/input/frontend/qkeyboardcontroller.cpp296
-rw-r--r--src/input/frontend/qkeyboardcontroller.h85
-rw-r--r--src/input/frontend/qkeyboardcontroller_p.h77
-rw-r--r--src/input/frontend/qkeyboarddevice.cpp298
-rw-r--r--src/input/frontend/qkeyboarddevice.h88
-rw-r--r--src/input/frontend/qkeyboarddevice_p.h81
-rw-r--r--src/input/frontend/qkeyboardhandler.cpp420
-rw-r--r--src/input/frontend/qkeyboardhandler.h130
-rw-r--r--src/input/frontend/qkeyboardhandler_p.h86
-rw-r--r--src/input/frontend/qkeyboardinput.cpp410
-rw-r--r--src/input/frontend/qkeyboardinput.h130
-rw-r--r--src/input/frontend/qkeyboardinput_p.h74
-rw-r--r--src/input/frontend/qkeyevent.cpp32
-rw-r--r--src/input/frontend/qkeyevent.h30
-rw-r--r--src/input/frontend/qlogicaldevice.cpp205
-rw-r--r--src/input/frontend/qlogicaldevice.h36
-rw-r--r--src/input/frontend/qlogicaldevice_p.h85
-rw-r--r--src/input/frontend/qmousecontroller.cpp170
-rw-r--r--src/input/frontend/qmousecontroller.h102
-rw-r--r--src/input/frontend/qmousecontroller_p.h74
-rw-r--r--src/input/frontend/qmousedevice.cpp154
-rw-r--r--src/input/frontend/qmousedevice.h98
-rw-r--r--src/input/frontend/qmousedevice_p.h82
-rw-r--r--src/input/frontend/qmouseevent.cpp41
-rw-r--r--src/input/frontend/qmouseevent.h33
-rw-r--r--src/input/frontend/qmousehandler.cpp200
-rw-r--r--src/input/frontend/qmousehandler.h100
-rw-r--r--src/input/frontend/qmousehandler_p.h87
-rw-r--r--src/input/frontend/qmouseinput.cpp206
-rw-r--r--src/input/frontend/qmouseinput.h100
-rw-r--r--src/input/frontend/qmouseinput_p.h76
-rw-r--r--src/input/frontend/qphysicaldevicecreatedchange.cpp72
-rw-r--r--src/input/frontend/qphysicaldevicecreatedchange.h84
-rw-r--r--src/input/frontend/qphysicaldevicecreatedchange_p.h71
-rw-r--r--src/input/input.pro7
-rw-r--r--src/input/qt3dinput_global.h27
-rw-r--r--src/input/qt3dinput_global_p.h25
-rw-r--r--src/logic/callbackjob.cpp27
-rw-r--r--src/logic/callbackjob_p.h25
-rw-r--r--src/logic/executor.cpp39
-rw-r--r--src/logic/executor_p.h25
-rw-r--r--src/logic/handle_types_p.h25
-rw-r--r--src/logic/handler.cpp45
-rw-r--r--src/logic/handler_p.h37
-rw-r--r--src/logic/logic.pri6
-rw-r--r--src/logic/logic.pro3
-rw-r--r--src/logic/manager.cpp31
-rw-r--r--src/logic/manager_p.h27
-rw-r--r--src/logic/managers_p.h25
-rw-r--r--src/logic/qframeaction.cpp111
-rw-r--r--src/logic/qframeaction.h82
-rw-r--r--src/logic/qframeaction_p.h74
-rw-r--r--src/logic/qlogicaspect.cpp69
-rw-r--r--src/logic/qlogicaspect.h39
-rw-r--r--src/logic/qlogicaspect_p.h28
-rw-r--r--src/logic/qlogiccomponent.cpp107
-rw-r--r--src/logic/qlogiccomponent.h81
-rw-r--r--src/logic/qlogiccomponent_p.h71
-rw-r--r--src/logic/qt3dlogic_global.h27
-rw-r--r--src/plugins/sceneparsers/assimp/assimp.pro16
-rw-r--r--src/plugins/sceneparsers/assimp/assimphelpers.cpp29
-rw-r--r--src/plugins/sceneparsers/assimp/assimphelpers.h25
-rw-r--r--src/plugins/sceneparsers/assimp/assimpio.cpp984
-rw-r--r--src/plugins/sceneparsers/assimp/assimpio.h154
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser.cpp930
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser.h151
-rw-r--r--src/plugins/sceneparsers/assimp/main.cpp39
-rw-r--r--src/plugins/sceneparsers/gltf/gltf.pro14
-rw-r--r--src/plugins/sceneparsers/gltf/gltfio.cpp1598
-rw-r--r--src/plugins/sceneparsers/gltf/gltfio.h211
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser.cpp1562
-rw-r--r--src/plugins/sceneparsers/gltf/gltfparser.h209
-rw-r--r--src/plugins/sceneparsers/gltf/main.cpp39
-rw-r--r--src/quick3d/imports/core/importscore.pro4
-rw-r--r--src/quick3d/imports/core/plugins.qmltypes135
-rw-r--r--src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp33
-rw-r--r--src/quick3d/imports/core/qt3dquick3dcoreplugin.h33
-rw-r--r--src/quick3d/imports/extras/defaults/defaults.pri22
-rw-r--r--src/quick3d/imports/extras/defaults/qml/DiffuseMapMaterial.qml132
-rw-r--r--src/quick3d/imports/extras/defaults/qml/DiffuseSpecularMapMaterial.qml145
-rw-r--r--src/quick3d/imports/extras/defaults/qml/FirstPersonCameraController.qml190
-rw-r--r--src/quick3d/imports/extras/defaults/qml/ForwardRenderer.qml74
-rw-r--r--src/quick3d/imports/extras/defaults/qml/GoochMaterial.qml128
-rw-r--r--src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml150
-rw-r--r--src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml148
-rw-r--r--src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml161
-rw-r--r--src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml235
-rw-r--r--src/quick3d/imports/extras/defaults/qml/PerVertexColorMaterial.qml111
-rw-r--r--src/quick3d/imports/extras/defaults/qml/PhongAlphaMaterial.qml149
-rw-r--r--src/quick3d/imports/extras/defaults/qml/PhongMaterial.qml123
-rw-r--r--src/quick3d/imports/extras/defaults/qml/SkyboxEntity.qml157
-rw-r--r--src/quick3d/imports/extras/defaults/qml/TextureMaterial.qml125
-rw-r--r--src/quick3d/imports/extras/importsextras.pro45
-rw-r--r--src/quick3d/imports/extras/plugins.qmltypes1124
-rw-r--r--src/quick3d/imports/extras/qmldir4
-rw-r--r--src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp109
-rw-r--r--src/quick3d/imports/extras/qt3dquick3dextrasplugin.h67
-rw-r--r--src/quick3d/imports/input/importsinput.pro6
-rw-r--r--src/quick3d/imports/input/plugins.qmltypes675
-rw-r--r--src/quick3d/imports/input/qt3dquick3dinputplugin.cpp68
-rw-r--r--src/quick3d/imports/input/qt3dquick3dinputplugin.h33
-rw-r--r--src/quick3d/imports/logic/importslogic.pro4
-rw-r--r--src/quick3d/imports/logic/plugins.qmltypes56
-rw-r--r--src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp29
-rw-r--r--src/quick3d/imports/logic/qt3dquick3dlogicplugin.h33
-rw-r--r--src/quick3d/imports/render/defaults/defaults.pri19
-rw-r--r--src/quick3d/imports/render/defaults/qml/DiffuseMapMaterial.qml120
-rw-r--r--src/quick3d/imports/render/defaults/qml/DiffuseSpecularMapMaterial.qml132
-rw-r--r--src/quick3d/imports/render/defaults/qml/ForwardRenderer.qml66
-rw-r--r--src/quick3d/imports/render/defaults/qml/GoochMaterial.qml115
-rw-r--r--src/quick3d/imports/render/defaults/qml/NormalDiffuseMapAlphaMaterial.qml138
-rw-r--r--src/quick3d/imports/render/defaults/qml/NormalDiffuseMapMaterial.qml135
-rw-r--r--src/quick3d/imports/render/defaults/qml/NormalDiffuseSpecularMapMaterial.qml148
-rw-r--r--src/quick3d/imports/render/defaults/qml/PerVertexColorMaterial.qml98
-rw-r--r--src/quick3d/imports/render/defaults/qml/PhongAlphaMaterial.qml137
-rw-r--r--src/quick3d/imports/render/defaults/qml/PhongMaterial.qml111
-rw-r--r--src/quick3d/imports/render/defaults/qml/SkyboxEntity.qml144
-rw-r--r--src/quick3d/imports/render/defaults/qml/TextureMaterial.qml112
-rw-r--r--src/quick3d/imports/render/importsrender.pro31
-rw-r--r--src/quick3d/imports/render/plugins.qmltypes1897
-rw-r--r--src/quick3d/imports/render/qt3dquick3drenderplugin.cpp193
-rw-r--r--src/quick3d/imports/render/qt3dquick3drenderplugin.h33
-rw-r--r--src/quick3d/imports/scene3d/importsscene3d.pro20
-rw-r--r--src/quick3d/imports/scene3d/plugins.qmltypes50
-rw-r--r--src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp25
-rw-r--r--src/quick3d/imports/scene3d/qtquickscene3dplugin.h33
-rw-r--r--src/quick3d/imports/scene3d/scene3dcleaner.cpp75
-rw-r--r--src/quick3d/imports/scene3d/scene3dcleaner_p.h82
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem.cpp744
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem_p.h49
-rw-r--r--src/quick3d/imports/scene3d/scene3dlogging.cpp25
-rw-r--r--src/quick3d/imports/scene3d/scene3dlogging_p.h25
-rw-r--r--src/quick3d/imports/scene3d/scene3drenderer.cpp304
-rw-r--r--src/quick3d/imports/scene3d/scene3drenderer_p.h116
-rw-r--r--src/quick3d/imports/scene3d/scene3dsgmaterial.cpp68
-rw-r--r--src/quick3d/imports/scene3d/scene3dsgmaterial_p.h86
-rw-r--r--src/quick3d/imports/scene3d/scene3dsgmaterialshader.cpp172
-rw-r--r--src/quick3d/imports/scene3d/scene3dsgmaterialshader_p.h82
-rw-r--r--src/quick3d/imports/scene3d/scene3dsgnode.cpp89
-rw-r--r--src/quick3d/imports/scene3d/scene3dsgnode_p.h92
-rw-r--r--src/quick3d/quick3d/items/items.pri2
-rw-r--r--src/quick3d/quick3d/items/quick3dconfiguration.cpp101
-rw-r--r--src/quick3d/quick3d/items/quick3dconfiguration_p.h87
-rw-r--r--src/quick3d/quick3d/items/quick3dentity.cpp31
-rw-r--r--src/quick3d/quick3d/items/quick3dentity_p.h25
-rw-r--r--src/quick3d/quick3d/items/quick3dentityloader.cpp73
-rw-r--r--src/quick3d/quick3d/items/quick3dentityloader_p.h30
-rw-r--r--src/quick3d/quick3d/items/quick3dentityloader_p_p.h25
-rw-r--r--src/quick3d/quick3d/items/quick3dnode.cpp31
-rw-r--r--src/quick3d/quick3d/items/quick3dnode_p.h25
-rw-r--r--src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp67
-rw-r--r--src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h30
-rw-r--r--src/quick3d/quick3d/qqmlaspectengine.cpp60
-rw-r--r--src/quick3d/quick3d/qqmlaspectengine.h29
-rw-r--r--src/quick3d/quick3d/qqmlaspectengine_p.h25
-rw-r--r--src/quick3d/quick3d/qquaternionanimation.cpp27
-rw-r--r--src/quick3d/quick3d/qquaternionanimation_p.h27
-rw-r--r--src/quick3d/quick3d/qt3dquick_global.cpp55
-rw-r--r--src/quick3d/quick3d/qt3dquick_global.h27
-rw-r--r--src/quick3d/quick3d/qt3dquick_global_p.h25
-rw-r--r--src/quick3d/quick3d/qt3dquicknodefactory.cpp31
-rw-r--r--src/quick3d/quick3d/qt3dquicknodefactory_p.h33
-rw-r--r--src/quick3d/quick3d/qt3dquickvaluetypes.cpp27
-rw-r--r--src/quick3d/quick3d/qt3dquickvaluetypes_p.h27
-rw-r--r--src/quick3d/quick3d/quick3d.pro3
-rw-r--r--src/quick3d/quick3dextras/qt3dquickextras_global.h59
-rw-r--r--src/quick3d/quick3dextras/qt3dquickwindow.cpp254
-rw-r--r--src/quick3d/quick3dextras/qt3dquickwindow.h140
-rw-r--r--src/quick3d/quick3dextras/quick3dextras.pro29
-rw-r--r--src/quick3d/quick3dinput/items/items.pri8
-rw-r--r--src/quick3d/quick3dinput/items/quick3daction.cpp40
-rw-r--r--src/quick3d/quick3dinput/items/quick3daction_p.h42
-rw-r--r--src/quick3d/quick3dinput/items/quick3daxis.cpp40
-rw-r--r--src/quick3d/quick3dinput/items/quick3daxis_p.h42
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputchord.cpp92
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputchord_p.h88
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputsequence.cpp93
-rw-r--r--src/quick3d/quick3dinput/items/quick3dinputsequence_p.h88
-rw-r--r--src/quick3d/quick3dinput/items/quick3dlogicaldevice.cpp31
-rw-r--r--src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h27
-rw-r--r--src/quick3d/quick3dinput/items/quick3dphysicaldevice.cpp28
-rw-r--r--src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h25
-rw-r--r--src/quick3d/quick3dinput/qt3dquickinput_global.cpp25
-rw-r--r--src/quick3d/quick3dinput/qt3dquickinput_global.h27
-rw-r--r--src/quick3d/quick3dinput/qt3dquickinput_global_p.h25
-rw-r--r--src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp29
-rw-r--r--src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h31
-rw-r--r--src/quick3d/quick3dinput/quick3dinput.pro3
-rw-r--r--src/quick3d/quick3drender/items/items.pri12
-rw-r--r--src/quick3d/quick3drender/items/quick3dbuffer.cpp33
-rw-r--r--src/quick3d/quick3drender/items/quick3dbuffer_p.h27
-rw-r--r--src/quick3d/quick3drender/items/quick3deffect.cpp33
-rw-r--r--src/quick3d/quick3drender/items/quick3deffect_p.h25
-rw-r--r--src/quick3d/quick3drender/items/quick3dgeometry.cpp42
-rw-r--r--src/quick3d/quick3drender/items/quick3dgeometry_p.h39
-rw-r--r--src/quick3d/quick3drender/items/quick3dlayerfilter.cpp107
-rw-r--r--src/quick3d/quick3drender/items/quick3dlayerfilter_p.h90
-rw-r--r--src/quick3d/quick3drender/items/quick3dmaterial.cpp29
-rw-r--r--src/quick3d/quick3drender/items/quick3dmaterial_p.h25
-rw-r--r--src/quick3d/quick3drender/items/quick3dparameter.cpp25
-rw-r--r--src/quick3d/quick3drender/items/quick3dparameter_p.h26
-rw-r--r--src/quick3d/quick3drender/items/quick3dparameter_p_p.h25
-rw-r--r--src/quick3d/quick3drender/items/quick3drenderpass.cpp99
-rw-r--r--src/quick3d/quick3drender/items/quick3drenderpass_p.h46
-rw-r--r--src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp51
-rw-r--r--src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h39
-rw-r--r--src/quick3d/quick3drender/items/quick3drendertarget.cpp95
-rw-r--r--src/quick3d/quick3drender/items/quick3drendertarget_p.h85
-rw-r--r--src/quick3d/quick3drender/items/quick3drendertargetoutput.cpp99
-rw-r--r--src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h88
-rw-r--r--src/quick3d/quick3drender/items/quick3drendertargetselector.cpp38
-rw-r--r--src/quick3d/quick3drender/items/quick3drendertargetselector_p.h27
-rw-r--r--src/quick3d/quick3drender/items/quick3dscene.cpp25
-rw-r--r--src/quick3d/quick3drender/items/quick3dscene_p.h29
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdata.cpp28
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdata_p.h28
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp49
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h32
-rw-r--r--src/quick3d/quick3drender/items/quick3dsortmethod.cpp95
-rw-r--r--src/quick3d/quick3drender/items/quick3dsortmethod_p.h86
-rw-r--r--src/quick3d/quick3drender/items/quick3dstateset.cpp28
-rw-r--r--src/quick3d/quick3drender/items/quick3dstateset_p.h29
-rw-r--r--src/quick3d/quick3drender/items/quick3dtechnique.cpp70
-rw-r--r--src/quick3d/quick3drender/items/quick3dtechnique_p.h37
-rw-r--r--src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp51
-rw-r--r--src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h39
-rw-r--r--src/quick3d/quick3drender/items/quick3dtexture.cpp34
-rw-r--r--src/quick3d/quick3drender/items/quick3dtexture_p.h27
-rw-r--r--src/quick3d/quick3drender/items/quick3dviewport.cpp25
-rw-r--r--src/quick3d/quick3drender/items/quick3dviewport_p.h25
-rw-r--r--src/quick3d/quick3drender/qt3dquickrender_global.cpp27
-rw-r--r--src/quick3d/quick3drender/qt3dquickrender_global.h27
-rw-r--r--src/quick3d/quick3drender/qt3dquickrender_global_p.h27
-rw-r--r--src/quick3d/quick3drender/qt3dquickrendernodefactory.cpp31
-rw-r--r--src/quick3d/quick3drender/qt3dquickrendernodefactory_p.h33
-rw-r--r--src/quick3d/quick3drender/quick3drender.pro3
-rw-r--r--src/render/backend/abstractrenderer_p.h56
-rw-r--r--src/render/backend/attachmentpack.cpp78
-rw-r--r--src/render/backend/attachmentpack_p.h54
-rw-r--r--src/render/backend/backendnode.cpp73
-rw-r--r--src/render/backend/backendnode_p.h83
-rw-r--r--src/render/backend/boundingvolumedebug.cpp50
-rw-r--r--src/render/backend/boundingvolumedebug_p.h33
-rw-r--r--src/render/backend/cameralens.cpp55
-rw-r--r--src/render/backend/cameralens_p.h40
-rw-r--r--src/render/backend/computecommand.cpp103
-rw-r--r--src/render/backend/computecommand_p.h88
-rw-r--r--src/render/backend/entity.cpp260
-rw-r--r--src/render/backend/entity_p.h93
-rw-r--r--src/render/backend/handle_types_p.h45
-rw-r--r--src/render/backend/layer.cpp55
-rw-r--r--src/render/backend/layer_p.h39
-rw-r--r--src/render/backend/managers.cpp76
-rw-r--r--src/render/backend/managers_p.h102
-rw-r--r--src/render/backend/nodefunctor_p.h46
-rw-r--r--src/render/backend/nodemanagers.cpp72
-rw-r--r--src/render/backend/nodemanagers_p.h97
-rw-r--r--src/render/backend/openglvertexarrayobject_p.h44
-rw-r--r--src/render/backend/parameterpack.cpp31
-rw-r--r--src/render/backend/parameterpack_p.h38
-rw-r--r--src/render/backend/platformsurfacefilter.cpp133
-rw-r--r--src/render/backend/platformsurfacefilter_p.h62
-rw-r--r--src/render/backend/qgraphicsutils_p.h27
-rw-r--r--src/render/backend/quniformvalue.cpp103
-rw-r--r--src/render/backend/quniformvalue_p.h187
-rw-r--r--src/render/backend/render-backend.pri25
-rw-r--r--src/render/backend/renderattachment.cpp130
-rw-r--r--src/render/backend/renderattachment_p.h93
-rw-r--r--src/render/backend/rendercommand.cpp36
-rw-r--r--src/render/backend/rendercommand_p.h39
-rw-r--r--src/render/backend/renderconfiguration.cpp25
-rw-r--r--src/render/backend/renderconfiguration_p.h25
-rw-r--r--src/render/backend/renderer.cpp952
-rw-r--r--src/render/backend/renderer_p.h89
-rw-r--r--src/render/backend/renderqueue.cpp43
-rw-r--r--src/render/backend/renderqueue_p.h28
-rw-r--r--src/render/backend/rendersettings.cpp131
-rw-r--r--src/render/backend/rendersettings_p.h104
-rw-r--r--src/render/backend/rendertarget.cpp87
-rw-r--r--src/render/backend/rendertarget_p.h44
-rw-r--r--src/render/backend/rendertargetoutput.cpp132
-rw-r--r--src/render/backend/rendertargetoutput_p.h94
-rw-r--r--src/render/backend/renderthread.cpp31
-rw-r--r--src/render/backend/renderthread_p.h26
-rw-r--r--src/render/backend/renderview.cpp893
-rw-r--r--src/render/backend/renderview_p.h199
-rw-r--r--src/render/backend/shadervariables_p.h64
-rw-r--r--src/render/backend/stringtoint.cpp122
-rw-r--r--src/render/backend/stringtoint_p.h83
-rw-r--r--src/render/backend/transform.cpp52
-rw-r--r--src/render/backend/transform_p.h36
-rw-r--r--src/render/backend/triangleboundingvolume.cpp35
-rw-r--r--src/render/backend/triangleboundingvolume_p.h31
-rw-r--r--src/render/backend/trianglesextractor.cpp474
-rw-r--r--src/render/backend/trianglesextractor_p.h38
-rw-r--r--src/render/backend/trianglesvisitor.cpp536
-rw-r--r--src/render/backend/trianglesvisitor_p.h94
-rw-r--r--src/render/defaults/defaults.pri39
-rw-r--r--src/render/defaults/qdiffusemapmaterial.cpp300
-rw-r--r--src/render/defaults/qdiffusemapmaterial.h91
-rw-r--r--src/render/defaults/qdiffusemapmaterial_p.h103
-rw-r--r--src/render/defaults/qdiffusespecularmapmaterial.cpp315
-rw-r--r--src/render/defaults/qdiffusespecularmapmaterial.h91
-rw-r--r--src/render/defaults/qdiffusespecularmapmaterial_p.h105
-rw-r--r--src/render/defaults/qforwardrenderer.cpp176
-rw-r--r--src/render/defaults/qforwardrenderer.h82
-rw-r--r--src/render/defaults/qforwardrenderer_p.h83
-rw-r--r--src/render/defaults/qgoochmaterial.cpp346
-rw-r--r--src/render/defaults/qgoochmaterial.h99
-rw-r--r--src/render/defaults/qgoochmaterial_p.h102
-rw-r--r--src/render/defaults/qnormaldiffusemapalphamaterial.cpp159
-rw-r--r--src/render/defaults/qnormaldiffusemapalphamaterial.h63
-rw-r--r--src/render/defaults/qnormaldiffusemapalphamaterial_p.h80
-rw-r--r--src/render/defaults/qnormaldiffusemapmaterial.cpp348
-rw-r--r--src/render/defaults/qnormaldiffusemapmaterial.h98
-rw-r--r--src/render/defaults/qnormaldiffusemapmaterial_p.h107
-rw-r--r--src/render/defaults/qnormaldiffusespecularmapmaterial.cpp363
-rw-r--r--src/render/defaults/qnormaldiffusespecularmapmaterial.h97
-rw-r--r--src/render/defaults/qnormaldiffusespecularmapmaterial_p.h108
-rw-r--r--src/render/defaults/qpervertexcolormaterial.cpp147
-rw-r--r--src/render/defaults/qpervertexcolormaterial.h65
-rw-r--r--src/render/defaults/qpervertexcolormaterial_p.h91
-rw-r--r--src/render/defaults/qphongalphamaterial.cpp312
-rw-r--r--src/render/defaults/qphongalphamaterial.h90
-rw-r--r--src/render/defaults/qphongalphamaterial_p.h108
-rw-r--r--src/render/defaults/qphongmaterial.cpp259
-rw-r--r--src/render/defaults/qphongmaterial.h86
-rw-r--r--src/render/defaults/qphongmaterial_p.h100
-rw-r--r--src/render/defaults/qskyboxentity.cpp279
-rw-r--r--src/render/defaults/qskyboxentity.h78
-rw-r--r--src/render/defaults/qskyboxentity_p.h112
-rw-r--r--src/render/framegraph/cameraselectornode.cpp46
-rw-r--r--src/render/framegraph/cameraselectornode_p.h30
-rw-r--r--src/render/framegraph/clearbuffer.cpp79
-rw-r--r--src/render/framegraph/clearbuffer_p.h81
-rw-r--r--src/render/framegraph/clearbuffers.cpp136
-rw-r--r--src/render/framegraph/clearbuffers_p.h106
-rw-r--r--src/render/framegraph/dispatchcompute.cpp48
-rw-r--r--src/render/framegraph/dispatchcompute_p.h31
-rw-r--r--src/render/framegraph/framegraph.pri54
-rw-r--r--src/render/framegraph/framegraphnode.cpp136
-rw-r--r--src/render/framegraph/framegraphnode_p.h120
-rw-r--r--src/render/framegraph/framegraphsubtreeselector.cpp70
-rw-r--r--src/render/framegraph/framegraphsubtreeselector_p.h76
-rw-r--r--src/render/framegraph/framegraphvisitor.cpp36
-rw-r--r--src/render/framegraph/framegraphvisitor_p.h25
-rw-r--r--src/render/framegraph/frustumculling.cpp48
-rw-r--r--src/render/framegraph/frustumculling_p.h30
-rw-r--r--src/render/framegraph/layerfilternode.cpp73
-rw-r--r--src/render/framegraph/layerfilternode_p.h34
-rw-r--r--src/render/framegraph/lighting.cpp77
-rw-r--r--src/render/framegraph/lighting_p.h76
-rw-r--r--src/render/framegraph/nodraw.cpp50
-rw-r--r--src/render/framegraph/nodraw_p.h30
-rw-r--r--src/render/framegraph/qcameraselector.cpp51
-rw-r--r--src/render/framegraph/qcameraselector.h32
-rw-r--r--src/render/framegraph/qcameraselector_p.h29
-rw-r--r--src/render/framegraph/qclearbuffer.cpp92
-rw-r--r--src/render/framegraph/qclearbuffer.h89
-rw-r--r--src/render/framegraph/qclearbuffer_p.h71
-rw-r--r--src/render/framegraph/qclearbuffers.cpp171
-rw-r--r--src/render/framegraph/qclearbuffers.h112
-rw-r--r--src/render/framegraph/qclearbuffers_p.h87
-rw-r--r--src/render/framegraph/qdispatchcompute.cpp58
-rw-r--r--src/render/framegraph/qdispatchcompute.h34
-rw-r--r--src/render/framegraph/qdispatchcompute_p.h83
-rw-r--r--src/render/framegraph/qframegraph.cpp143
-rw-r--r--src/render/framegraph/qframegraph.h83
-rw-r--r--src/render/framegraph/qframegraph_p.h75
-rw-r--r--src/render/framegraph/qframegraphnode.cpp60
-rw-r--r--src/render/framegraph/qframegraphnode.h38
-rw-r--r--src/render/framegraph/qframegraphnode_p.h26
-rw-r--r--src/render/framegraph/qframegraphselector.cpp100
-rw-r--r--src/render/framegraph/qframegraphselector.h82
-rw-r--r--src/render/framegraph/qframegraphselector_p.h76
-rw-r--r--src/render/framegraph/qfrustumculling.cpp27
-rw-r--r--src/render/framegraph/qfrustumculling.h30
-rw-r--r--src/render/framegraph/qlayerfilter.cpp92
-rw-r--r--src/render/framegraph/qlayerfilter.h44
-rw-r--r--src/render/framegraph/qlayerfilter_p.h33
-rw-r--r--src/render/framegraph/qlighting.cpp70
-rw-r--r--src/render/framegraph/qlighting.h69
-rw-r--r--src/render/framegraph/qlighting_p.h69
-rw-r--r--src/render/framegraph/qnodraw.cpp27
-rw-r--r--src/render/framegraph/qnodraw.h30
-rw-r--r--src/render/framegraph/qrenderpassfilter.cpp108
-rw-r--r--src/render/framegraph/qrenderpassfilter.h46
-rw-r--r--src/render/framegraph/qrenderpassfilter_p.h35
-rw-r--r--src/render/framegraph/qrenderstateset.cpp149
-rw-r--r--src/render/framegraph/qrenderstateset.h76
-rw-r--r--src/render/framegraph/qrenderstateset_p.h82
-rw-r--r--src/render/framegraph/qrendersurfaceselector.cpp244
-rw-r--r--src/render/framegraph/qrendersurfaceselector.h89
-rw-r--r--src/render/framegraph/qrendersurfaceselector_p.h87
-rw-r--r--src/render/framegraph/qrendertargetselector.cpp72
-rw-r--r--src/render/framegraph/qrendertargetselector.h40
-rw-r--r--src/render/framegraph/qrendertargetselector_p.h33
-rw-r--r--src/render/framegraph/qsortcriterion.cpp39
-rw-r--r--src/render/framegraph/qsortcriterion.h28
-rw-r--r--src/render/framegraph/qsortcriterion_p.h71
-rw-r--r--src/render/framegraph/qsortmethod.cpp116
-rw-r--r--src/render/framegraph/qsortmethod.h74
-rw-r--r--src/render/framegraph/qsortmethod_p.h72
-rw-r--r--src/render/framegraph/qsortpolicy.cpp140
-rw-r--r--src/render/framegraph/qsortpolicy.h91
-rw-r--r--src/render/framegraph/qsortpolicy_p.h80
-rw-r--r--src/render/framegraph/qstateset.cpp149
-rw-r--r--src/render/framegraph/qstateset.h74
-rw-r--r--src/render/framegraph/qstateset_p.h74
-rw-r--r--src/render/framegraph/qtechniquefilter.cpp110
-rw-r--r--src/render/framegraph/qtechniquefilter.h42
-rw-r--r--src/render/framegraph/qtechniquefilter_p.h38
-rw-r--r--src/render/framegraph/qviewport.cpp67
-rw-r--r--src/render/framegraph/qviewport.h44
-rw-r--r--src/render/framegraph/qviewport_p.h32
-rw-r--r--src/render/framegraph/renderpassfilternode.cpp92
-rw-r--r--src/render/framegraph/renderpassfilternode_p.h43
-rw-r--r--src/render/framegraph/rendersurfaceselector.cpp129
-rw-r--r--src/render/framegraph/rendersurfaceselector_p.h93
-rw-r--r--src/render/framegraph/rendertargetselectornode.cpp65
-rw-r--r--src/render/framegraph/rendertargetselectornode_p.h35
-rw-r--r--src/render/framegraph/sortcriterion.cpp35
-rw-r--r--src/render/framegraph/sortcriterion_p.h84
-rw-r--r--src/render/framegraph/sortmethod.cpp86
-rw-r--r--src/render/framegraph/sortmethod_p.h80
-rw-r--r--src/render/framegraph/sortpolicy.cpp87
-rw-r--r--src/render/framegraph/sortpolicy_p.h84
-rw-r--r--src/render/framegraph/statesetnode.cpp85
-rw-r--r--src/render/framegraph/statesetnode_p.h38
-rw-r--r--src/render/framegraph/techniquefilternode.cpp94
-rw-r--r--src/render/framegraph/techniquefilternode_p.h40
-rw-r--r--src/render/framegraph/viewportnode.cpp72
-rw-r--r--src/render/framegraph/viewportnode_p.h32
-rw-r--r--src/render/frontend/qabstractfunctor.cpp25
-rw-r--r--src/render/frontend/qabstractfunctor.h37
-rw-r--r--src/render/frontend/qboundingvolumedebug.cpp67
-rw-r--r--src/render/frontend/qboundingvolumedebug.h80
-rw-r--r--src/render/frontend/qboundingvolumedebug_p.h98
-rw-r--r--src/render/frontend/qcamera.cpp500
-rw-r--r--src/render/frontend/qcamera.h176
-rw-r--r--src/render/frontend/qcamera_p.h92
-rw-r--r--src/render/frontend/qcameralens.cpp498
-rw-r--r--src/render/frontend/qcameralens.h141
-rw-r--r--src/render/frontend/qcameralens_p.h139
-rw-r--r--src/render/frontend/qcomputecommand.cpp123
-rw-r--r--src/render/frontend/qcomputecommand.h86
-rw-r--r--src/render/frontend/qcomputecommand_p.h81
-rw-r--r--src/render/frontend/qitemmodelbuffer.cpp59
-rw-r--r--src/render/frontend/qitemmodelbuffer.h105
-rw-r--r--src/render/frontend/qitemmodelbuffer_p.h119
-rw-r--r--src/render/frontend/qlayer.cpp63
-rw-r--r--src/render/frontend/qlayer.h40
-rw-r--r--src/render/frontend/qlayer_p.h26
-rw-r--r--src/render/frontend/qpickingsettings.cpp103
-rw-r--r--src/render/frontend/qpickingsettings.h94
-rw-r--r--src/render/frontend/qpickingsettings_p.h74
-rw-r--r--src/render/frontend/qrenderaspect.cpp385
-rw-r--r--src/render/frontend/qrenderaspect.h43
-rw-r--r--src/render/frontend/qrenderaspect_p.h46
-rw-r--r--src/render/frontend/qrenderattachment.cpp175
-rw-r--r--src/render/frontend/qrenderattachment.h135
-rw-r--r--src/render/frontend/qrenderattachment_p.h79
-rw-r--r--src/render/frontend/qrendersettings.cpp145
-rw-r--r--src/render/frontend/qrendersettings.h99
-rw-r--r--src/render/frontend/qrendersettings_p.h91
-rw-r--r--src/render/frontend/qrendertarget.cpp81
-rw-r--r--src/render/frontend/qrendertarget.h40
-rw-r--r--src/render/frontend/qrendertarget_p.h34
-rw-r--r--src/render/frontend/qrendertargetoutput.cpp169
-rw-r--r--src/render/frontend/qrendertargetoutput.h124
-rw-r--r--src/render/frontend/qrendertargetoutput_p.h90
-rw-r--r--src/render/frontend/qwindow.cpp184
-rw-r--r--src/render/frontend/qwindow.h84
-rw-r--r--src/render/frontend/qwindow_p.h87
-rw-r--r--src/render/frontend/render-frontend.pri31
-rw-r--r--src/render/frontend/sphere.cpp35
-rw-r--r--src/render/frontend/sphere_p.h33
-rw-r--r--src/render/geometry/attribute.cpp94
-rw-r--r--src/render/geometry/attribute_p.h46
-rw-r--r--src/render/geometry/buffer.cpp105
-rw-r--r--src/render/geometry/buffer_p.h53
-rw-r--r--src/render/geometry/buffermanager.cpp27
-rw-r--r--src/render/geometry/buffermanager_p.h29
-rw-r--r--src/render/geometry/geometry.cpp89
-rw-r--r--src/render/geometry/geometry.pri43
-rw-r--r--src/render/geometry/geometry_p.h34
-rw-r--r--src/render/geometry/geometryrenderer.cpp207
-rw-r--r--src/render/geometry/geometryrenderer_p.h75
-rw-r--r--src/render/geometry/geometryrenderermanager.cpp27
-rw-r--r--src/render/geometry/geometryrenderermanager_p.h29
-rw-r--r--src/render/geometry/qabstractattribute.cpp397
-rw-r--r--src/render/geometry/qabstractattribute.h142
-rw-r--r--src/render/geometry/qabstractattribute_p.h84
-rw-r--r--src/render/geometry/qabstractbuffer.cpp130
-rw-r--r--src/render/geometry/qabstractbuffer.h75
-rw-r--r--src/render/geometry/qabstractbuffer_p.h75
-rw-r--r--src/render/geometry/qattribute.cpp461
-rw-r--r--src/render/geometry/qattribute.h109
-rw-r--r--src/render/geometry/qattribute_p.h60
-rw-r--r--src/render/geometry/qboundingvolumespecifier.cpp106
-rw-r--r--src/render/geometry/qboundingvolumespecifier.h73
-rw-r--r--src/render/geometry/qbuffer.cpp137
-rw-r--r--src/render/geometry/qbuffer.h59
-rw-r--r--src/render/geometry/qbuffer_p.h49
-rw-r--r--src/render/geometry/qbufferdatagenerator.h68
-rw-r--r--src/render/geometry/qbufferfunctor.h65
-rw-r--r--src/render/geometry/qcuboidgeometry.cpp822
-rw-r--r--src/render/geometry/qcuboidgeometry.h113
-rw-r--r--src/render/geometry/qcuboidgeometry_p.h93
-rw-r--r--src/render/geometry/qcuboidmesh.cpp212
-rw-r--r--src/render/geometry/qcuboidmesh.h105
-rw-r--r--src/render/geometry/qcylindergeometry.cpp592
-rw-r--r--src/render/geometry/qcylindergeometry.h102
-rw-r--r--src/render/geometry/qcylindergeometry_p.h86
-rw-r--r--src/render/geometry/qcylindermesh.cpp179
-rw-r--r--src/render/geometry/qcylindermesh.h94
-rw-r--r--src/render/geometry/qgeometry.cpp152
-rw-r--r--src/render/geometry/qgeometry.h55
-rw-r--r--src/render/geometry/qgeometry_p.h48
-rw-r--r--src/render/geometry/qgeometryfactory.h70
-rw-r--r--src/render/geometry/qgeometryfunctor.h67
-rw-r--r--src/render/geometry/qgeometryrenderer.cpp246
-rw-r--r--src/render/geometry/qgeometryrenderer.h88
-rw-r--r--src/render/geometry/qgeometryrenderer_p.h62
-rw-r--r--src/render/geometry/qmesh.cpp74
-rw-r--r--src/render/geometry/qmesh.h37
-rw-r--r--src/render/geometry/qmesh_p.h27
-rw-r--r--src/render/geometry/qplanegeometry.cpp524
-rw-r--r--src/render/geometry/qplanegeometry.h100
-rw-r--r--src/render/geometry/qplanegeometry_p.h86
-rw-r--r--src/render/geometry/qplanemesh.cpp146
-rw-r--r--src/render/geometry/qplanemesh.h91
-rw-r--r--src/render/geometry/qspheregeometry.cpp579
-rw-r--r--src/render/geometry/qspheregeometry.h103
-rw-r--r--src/render/geometry/qspheregeometry_p.h86
-rw-r--r--src/render/geometry/qspheremesh.cpp169
-rw-r--r--src/render/geometry/qspheremesh.h95
-rw-r--r--src/render/geometry/qtorusgeometry.cpp506
-rw-r--r--src/render/geometry/qtorusgeometry.h103
-rw-r--r--src/render/geometry/qtorusgeometry_p.h85
-rw-r--r--src/render/geometry/qtorusmesh.cpp174
-rw-r--r--src/render/geometry/qtorusmesh.h93
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp631
-rw-r--r--src/render/graphicshelpers/graphicscontext_p.h97
-rw-r--r--src/render/graphicshelpers/graphicshelperes2.cpp140
-rw-r--r--src/render/graphicshelpers/graphicshelperes2_p.h44
-rw-r--r--src/render/graphicshelpers/graphicshelpergl2.cpp163
-rw-r--r--src/render/graphicshelpers/graphicshelpergl2_p.h42
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3.cpp163
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3.cpp165
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_3_p.h42
-rw-r--r--src/render/graphicshelpers/graphicshelpergl3_p.h42
-rw-r--r--src/render/graphicshelpers/graphicshelpergl4.cpp210
-rw-r--r--src/render/graphicshelpers/graphicshelpergl4_p.h42
-rw-r--r--src/render/graphicshelpers/graphicshelperinterface_p.h49
-rw-r--r--src/render/graphicshelpers/graphicshelpers.pri2
-rw-r--r--src/render/io/glbuffer.cpp153
-rw-r--r--src/render/io/glbuffer_p.h107
-rw-r--r--src/render/io/io.pri20
-rw-r--r--src/render/io/objloader.cpp184
-rw-r--r--src/render/io/objloader_p.h30
-rw-r--r--src/render/io/qabstractsceneloader.cpp108
-rw-r--r--src/render/io/qabstractsceneloader.h91
-rw-r--r--src/render/io/qabstractsceneloader_p.h75
-rw-r--r--src/render/io/qabstractsceneparser.cpp85
-rw-r--r--src/render/io/qabstractsceneparser.h100
-rw-r--r--src/render/io/qaxisalignedboundingbox.cpp25
-rw-r--r--src/render/io/qaxisalignedboundingbox_p.h25
-rw-r--r--src/render/io/qsceneiofactory.cpp96
-rw-r--r--src/render/io/qsceneiofactory_p.h74
-rw-r--r--src/render/io/qsceneiohandler.cpp88
-rw-r--r--src/render/io/qsceneiohandler_p.h114
-rw-r--r--src/render/io/qsceneioplugin.cpp66
-rw-r--r--src/render/io/qsceneioplugin_p.h82
-rw-r--r--src/render/io/qsceneloader.cpp127
-rw-r--r--src/render/io/qsceneloader.h63
-rw-r--r--src/render/io/qsceneloader_p.h84
-rw-r--r--src/render/io/qsceneparserfactory.cpp93
-rw-r--r--src/render/io/qsceneparserfactory_p.h71
-rw-r--r--src/render/io/qsceneparserplugin.cpp63
-rw-r--r--src/render/io/qsceneparserplugin.h68
-rw-r--r--src/render/io/qurlhelper.cpp27
-rw-r--r--src/render/io/qurlhelper_p.h27
-rw-r--r--src/render/io/scene.cpp90
-rw-r--r--src/render/io/scene_p.h45
-rw-r--r--src/render/io/scenemanager.cpp39
-rw-r--r--src/render/io/scenemanager_p.h31
-rw-r--r--src/render/io/uniformbuffer.cpp105
-rw-r--r--src/render/io/uniformbuffer_p.h93
-rw-r--r--src/render/jobs/calcboundingvolumejob.cpp51
-rw-r--r--src/render/jobs/calcboundingvolumejob_p.h27
-rw-r--r--src/render/jobs/calcgeometrytrianglevolumes.cpp29
-rw-r--r--src/render/jobs/calcgeometrytrianglevolumes_p.h25
-rw-r--r--src/render/jobs/framecleanupjob.cpp34
-rw-r--r--src/render/jobs/framecleanupjob_p.h25
-rw-r--r--src/render/jobs/framepreparationjob.cpp54
-rw-r--r--src/render/jobs/framepreparationjob_p.h25
-rw-r--r--src/render/jobs/job_common_p.h102
-rw-r--r--src/render/jobs/jobs.pri3
-rw-r--r--src/render/jobs/loadbufferjob.cpp29
-rw-r--r--src/render/jobs/loadbufferjob_p.h25
-rw-r--r--src/render/jobs/loadgeometryjob.cpp29
-rw-r--r--src/render/jobs/loadgeometryjob_p.h25
-rw-r--r--src/render/jobs/loadscenejob.cpp59
-rw-r--r--src/render/jobs/loadscenejob_p.h33
-rw-r--r--src/render/jobs/loadtexturedatajob.cpp149
-rw-r--r--src/render/jobs/loadtexturedatajob_p.h27
-rw-r--r--src/render/jobs/pickboundingvolumejob.cpp588
-rw-r--r--src/render/jobs/pickboundingvolumejob_p.h59
-rw-r--r--src/render/jobs/renderviewjob.cpp84
-rw-r--r--src/render/jobs/renderviewjob_p.h34
-rw-r--r--src/render/jobs/renderviewjobutils.cpp192
-rw-r--r--src/render/jobs/renderviewjobutils_p.h70
-rw-r--r--src/render/jobs/updateboundingvolumejob.cpp36
-rw-r--r--src/render/jobs/updateboundingvolumejob_p.h25
-rw-r--r--src/render/jobs/updateworldtransformjob.cpp37
-rw-r--r--src/render/jobs/updateworldtransformjob_p.h25
-rw-r--r--src/render/lights/light.cpp59
-rw-r--r--src/render/lights/light_p.h47
-rw-r--r--src/render/lights/lights.pri6
-rw-r--r--src/render/lights/qabstractlight.cpp142
-rw-r--r--src/render/lights/qabstractlight.h96
-rw-r--r--src/render/lights/qabstractlight_p.h83
-rw-r--r--src/render/lights/qdirectionallight.cpp59
-rw-r--r--src/render/lights/qdirectionallight.h44
-rw-r--r--src/render/lights/qdirectionallight_p.h30
-rw-r--r--src/render/lights/qlight.cpp151
-rw-r--r--src/render/lights/qlight.h97
-rw-r--r--src/render/lights/qlight_p.h74
-rw-r--r--src/render/lights/qpointlight.cpp77
-rw-r--r--src/render/lights/qpointlight.h52
-rw-r--r--src/render/lights/qpointlight_p.h33
-rw-r--r--src/render/lights/qspotlight.cpp131
-rw-r--r--src/render/lights/qspotlight.h58
-rw-r--r--src/render/lights/qspotlight_p.h33
-rw-r--r--src/render/materialsystem/annotation.cpp104
-rw-r--r--src/render/materialsystem/annotation_p.h89
-rw-r--r--src/render/materialsystem/effect.cpp87
-rw-r--r--src/render/materialsystem/effect_p.h42
-rw-r--r--src/render/materialsystem/filterkey.cpp118
-rw-r--r--src/render/materialsystem/filterkey_p.h91
-rw-r--r--src/render/materialsystem/material.cpp83
-rw-r--r--src/render/materialsystem/material_p.h36
-rw-r--r--src/render/materialsystem/materialsystem.pri18
-rw-r--r--src/render/materialsystem/parameter.cpp86
-rw-r--r--src/render/materialsystem/parameter_p.h40
-rw-r--r--src/render/materialsystem/parametermapping.cpp85
-rw-r--r--src/render/materialsystem/parametermapping_p.h85
-rw-r--r--src/render/materialsystem/qannotation.cpp142
-rw-r--r--src/render/materialsystem/qannotation.h82
-rw-r--r--src/render/materialsystem/qannotation_p.h72
-rw-r--r--src/render/materialsystem/qeffect.cpp87
-rw-r--r--src/render/materialsystem/qeffect.h43
-rw-r--r--src/render/materialsystem/qeffect_p.h35
-rw-r--r--src/render/materialsystem/qfilterkey.cpp144
-rw-r--r--src/render/materialsystem/qfilterkey.h82
-rw-r--r--src/render/materialsystem/qfilterkey_p.h81
-rw-r--r--src/render/materialsystem/qgraphicsapifilter.cpp143
-rw-r--r--src/render/materialsystem/qgraphicsapifilter.h46
-rw-r--r--src/render/materialsystem/qgraphicsapifilter_p.h96
-rw-r--r--src/render/materialsystem/qmaterial.cpp73
-rw-r--r--src/render/materialsystem/qmaterial.h41
-rw-r--r--src/render/materialsystem/qmaterial_p.h38
-rw-r--r--src/render/materialsystem/qparameter.cpp83
-rw-r--r--src/render/materialsystem/qparameter.h43
-rw-r--r--src/render/materialsystem/qparameter_p.h33
-rw-r--r--src/render/materialsystem/qparametermapping.cpp200
-rw-r--r--src/render/materialsystem/qparametermapping.h98
-rw-r--r--src/render/materialsystem/qparametermapping_p.h74
-rw-r--r--src/render/materialsystem/qrenderpass.cpp196
-rw-r--r--src/render/materialsystem/qrenderpass.h59
-rw-r--r--src/render/materialsystem/qrenderpass_p.h55
-rw-r--r--src/render/materialsystem/qshaderdata.cpp87
-rw-r--r--src/render/materialsystem/qshaderdata.h46
-rw-r--r--src/render/materialsystem/qshaderdata_p.h42
-rw-r--r--src/render/materialsystem/qshaderprogram.cpp60
-rw-r--r--src/render/materialsystem/qshaderprogram.h32
-rw-r--r--src/render/materialsystem/qshaderprogram_p.h35
-rw-r--r--src/render/materialsystem/qtechnique.cpp143
-rw-r--r--src/render/materialsystem/qtechnique.h50
-rw-r--r--src/render/materialsystem/qtechnique_p.h43
-rw-r--r--src/render/materialsystem/renderpass.cpp160
-rw-r--r--src/render/materialsystem/renderpass_p.h58
-rw-r--r--src/render/materialsystem/shader.cpp206
-rw-r--r--src/render/materialsystem/shader_p.h87
-rw-r--r--src/render/materialsystem/shaderdata.cpp234
-rw-r--r--src/render/materialsystem/shaderdata_p.h59
-rw-r--r--src/render/materialsystem/technique.cpp148
-rw-r--r--src/render/materialsystem/technique_p.h63
-rw-r--r--src/render/picking/objectpicker.cpp114
-rw-r--r--src/render/picking/objectpicker_p.h48
-rw-r--r--src/render/picking/pickeventfilter.cpp28
-rw-r--r--src/render/picking/pickeventfilter_p.h27
-rw-r--r--src/render/picking/picking.pri6
-rw-r--r--src/render/picking/qobjectpicker.cpp193
-rw-r--r--src/render/picking/qobjectpicker.h48
-rw-r--r--src/render/picking/qobjectpicker_p.h110
-rw-r--r--src/render/picking/qpickevent.cpp76
-rw-r--r--src/render/picking/qpickevent.h46
-rw-r--r--src/render/picking/qpickevent_p.h77
-rw-r--r--src/render/picking/qpicktriangleevent.cpp117
-rw-r--r--src/render/picking/qpicktriangleevent.h77
-rw-r--r--src/render/qt3drender_global.h27
-rw-r--r--src/render/qt3drender_global_p.h25
-rw-r--r--src/render/raycasting/qabstractcollisionqueryservice.cpp29
-rw-r--r--src/render/raycasting/qabstractcollisionqueryservice_p.h37
-rw-r--r--src/render/raycasting/qboundingsphere.cpp25
-rw-r--r--src/render/raycasting/qboundingsphere_p.h25
-rw-r--r--src/render/raycasting/qboundingvolume.cpp25
-rw-r--r--src/render/raycasting/qboundingvolume_p.h33
-rw-r--r--src/render/raycasting/qboundingvolumeprovider.cpp25
-rw-r--r--src/render/raycasting/qboundingvolumeprovider_p.h25
-rw-r--r--src/render/raycasting/qcollisionqueryresult.cpp42
-rw-r--r--src/render/raycasting/qcollisionqueryresult_p.h73
-rw-r--r--src/render/raycasting/qray3d.cpp376
-rw-r--r--src/render/raycasting/qray3d_p.h123
-rw-r--r--src/render/raycasting/qraycastingservice.cpp66
-rw-r--r--src/render/raycasting/qraycastingservice_p.h37
-rw-r--r--src/render/raycasting/raycasting.pri2
-rw-r--r--src/render/render.pro7
-rw-r--r--src/render/render.qrc35
-rw-r--r--src/render/renderlogging.cpp25
-rw-r--r--src/render/renderlogging_p.h25
-rw-r--r--src/render/renderstates/genericstate_p.h256
-rw-r--r--src/render/renderstates/qalphacoverage.cpp31
-rw-r--r--src/render/renderstates/qalphacoverage.h30
-rw-r--r--src/render/renderstates/qalphatest.cpp91
-rw-r--r--src/render/renderstates/qalphatest.h54
-rw-r--r--src/render/renderstates/qalphatest_p.h83
-rw-r--r--src/render/renderstates/qblendequation.cpp74
-rw-r--r--src/render/renderstates/qblendequation.h52
-rw-r--r--src/render/renderstates/qblendequation_p.h80
-rw-r--r--src/render/renderstates/qblendequationarguments.cpp288
-rw-r--r--src/render/renderstates/qblendequationarguments.h127
-rw-r--r--src/render/renderstates/qblendequationarguments_p.h93
-rw-r--r--src/render/renderstates/qblendstate.cpp265
-rw-r--r--src/render/renderstates/qblendstate.h123
-rw-r--r--src/render/renderstates/qclipplane.cpp95
-rw-r--r--src/render/renderstates/qclipplane.h49
-rw-r--r--src/render/renderstates/qclipplane_p.h84
-rw-r--r--src/render/renderstates/qcolormask.cpp117
-rw-r--r--src/render/renderstates/qcolormask.h64
-rw-r--r--src/render/renderstates/qcolormask_p.h88
-rw-r--r--src/render/renderstates/qcullface.cpp63
-rw-r--r--src/render/renderstates/qcullface.h35
-rw-r--r--src/render/renderstates/qcullface_p.h80
-rw-r--r--src/render/renderstates/qdepthmask.cpp94
-rw-r--r--src/render/renderstates/qdepthmask.h77
-rw-r--r--src/render/renderstates/qdepthtest.cpp77
-rw-r--r--src/render/renderstates/qdepthtest.h46
-rw-r--r--src/render/renderstates/qdepthtest_p.h80
-rw-r--r--src/render/renderstates/qdithering.cpp33
-rw-r--r--src/render/renderstates/qdithering.h30
-rw-r--r--src/render/renderstates/qfrontface.cpp67
-rw-r--r--src/render/renderstates/qfrontface.h46
-rw-r--r--src/render/renderstates/qfrontface_p.h80
-rw-r--r--src/render/renderstates/qmultisampleantialiasing.cpp73
-rw-r--r--src/render/renderstates/qmultisampleantialiasing.h67
-rw-r--r--src/render/renderstates/qnodepthmask.cpp73
-rw-r--r--src/render/renderstates/qnodepthmask.h67
-rw-r--r--src/render/renderstates/qpointsize.cpp78
-rw-r--r--src/render/renderstates/qpointsize.h47
-rw-r--r--src/render/renderstates/qpointsize_p.h83
-rw-r--r--src/render/renderstates/qpolygonoffset.cpp82
-rw-r--r--src/render/renderstates/qpolygonoffset.h48
-rw-r--r--src/render/renderstates/qpolygonoffset_p.h84
-rw-r--r--src/render/renderstates/qrenderstate.cpp54
-rw-r--r--src/render/renderstates/qrenderstate.h55
-rw-r--r--src/render/renderstates/qrenderstate_p.h60
-rw-r--r--src/render/renderstates/qrenderstatecreatedchange.cpp69
-rw-r--r--src/render/renderstates/qrenderstatecreatedchange_p.h94
-rw-r--r--src/render/renderstates/qscissortest.cpp76
-rw-r--r--src/render/renderstates/qscissortest.h34
-rw-r--r--src/render/renderstates/qscissortest_p.h89
-rw-r--r--src/render/renderstates/qseamlesscubemap.cpp73
-rw-r--r--src/render/renderstates/qseamlesscubemap.h67
-rw-r--r--src/render/renderstates/qstencilmask.cpp79
-rw-r--r--src/render/renderstates/qstencilmask.h48
-rw-r--r--src/render/renderstates/qstencilmask_p.h81
-rw-r--r--src/render/renderstates/qstencilop.cpp95
-rw-r--r--src/render/renderstates/qstencilop.h74
-rw-r--r--src/render/renderstates/qstenciloperation.cpp89
-rw-r--r--src/render/renderstates/qstenciloperation.h74
-rw-r--r--src/render/renderstates/qstenciloperation_p.h83
-rw-r--r--src/render/renderstates/qstenciloperationarguments.cpp109
-rw-r--r--src/render/renderstates/qstenciloperationarguments.h113
-rw-r--r--src/render/renderstates/qstenciloperationarguments_p.h89
-rw-r--r--src/render/renderstates/qstencilopseparate.cpp125
-rw-r--r--src/render/renderstates/qstencilopseparate.h110
-rw-r--r--src/render/renderstates/qstenciltest.cpp79
-rw-r--r--src/render/renderstates/qstenciltest.h45
-rw-r--r--src/render/renderstates/qstenciltest_p.h85
-rw-r--r--src/render/renderstates/qstenciltestarguments.cpp109
-rw-r--r--src/render/renderstates/qstenciltestarguments.h114
-rw-r--r--src/render/renderstates/qstenciltestarguments_p.h89
-rw-r--r--src/render/renderstates/qstenciltestseparate.cpp126
-rw-r--r--src/render/renderstates/qstenciltestseparate.h111
-rw-r--r--src/render/renderstates/renderstatecollection.cpp96
-rw-r--r--src/render/renderstates/renderstatecollection_p.h94
-rw-r--r--src/render/renderstates/renderstatenode.cpp92
-rw-r--r--src/render/renderstates/renderstatenode_p.h85
-rw-r--r--src/render/renderstates/renderstates.cpp281
-rw-r--r--src/render/renderstates/renderstates.pri52
-rw-r--r--src/render/renderstates/renderstates_p.h260
-rw-r--r--src/render/renderstates/renderstateset.cpp335
-rw-r--r--src/render/renderstates/renderstateset_p.h35
-rw-r--r--src/render/services/vsyncframeadvanceservice.cpp28
-rw-r--r--src/render/services/vsyncframeadvanceservice_p.h25
-rw-r--r--src/render/shaders/es2/light.inc.frag131
-rw-r--r--src/render/shaders/gl3/light.inc.frag131
-rw-r--r--src/render/texture/qabstracttexture.cpp509
-rw-r--r--src/render/texture/qabstracttexture.h344
-rw-r--r--src/render/texture/qabstracttexture_p.h116
-rw-r--r--src/render/texture/qabstracttextureimage.cpp112
-rw-r--r--src/render/texture/qabstracttextureimage.h71
-rw-r--r--src/render/texture/qabstracttextureimage_p.h48
-rw-r--r--src/render/texture/qabstracttextureprovider.cpp530
-rw-r--r--src/render/texture/qabstracttextureprovider.h339
-rw-r--r--src/render/texture/qabstracttextureprovider_p.h91
-rw-r--r--src/render/texture/qtexture.cpp312
-rw-r--r--src/render/texture/qtexture.h146
-rw-r--r--src/render/texture/qtexturedata.cpp206
-rw-r--r--src/render/texture/qtexturedata.h106
-rw-r--r--src/render/texture/qtexturedata_p.h78
-rw-r--r--src/render/texture/qtextureimage.cpp130
-rw-r--r--src/render/texture/qtextureimage.h45
-rw-r--r--src/render/texture/qtextureimage_p.h129
-rw-r--r--src/render/texture/qtextureimagedata.cpp802
-rw-r--r--src/render/texture/qtextureimagedata.h107
-rw-r--r--src/render/texture/qtextureimagedata_p.h102
-rw-r--r--src/render/texture/qtextureproviders.cpp258
-rw-r--r--src/render/texture/qtextureproviders.h138
-rw-r--r--src/render/texture/qtexturewrapmode.cpp165
-rw-r--r--src/render/texture/qtexturewrapmode.h94
-rw-r--r--src/render/texture/qwrapmode.cpp157
-rw-r--r--src/render/texture/qwrapmode.h90
-rw-r--r--src/render/texture/texture.cpp373
-rw-r--r--src/render/texture/texture.pri19
-rw-r--r--src/render/texture/texture_p.h93
-rw-r--r--src/render/texture/texturedatamanager.cpp41
-rw-r--r--src/render/texture/texturedatamanager_p.h45
-rw-r--r--src/render/texture/textureimage.cpp132
-rw-r--r--src/render/texture/textureimage_p.h72
-rw-r--r--src/src.pro25
-rw-r--r--sync.profile2
-rw-r--r--tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp60
-rw-r--r--tests/auto/core/arrayresourcesmanager/preallocatedarraypolicy/tst_preallocatedarraypolicy.cpp60
-rw-r--r--tests/auto/core/cloning/cloning.pro8
-rw-r--r--tests/auto/core/cloning/tst_cloning.cpp156
-rw-r--r--tests/auto/core/common/common.pri9
-rw-r--r--tests/auto/core/common/qbackendnodetester.cpp62
-rw-r--r--tests/auto/core/common/qbackendnodetester.h64
-rw-r--r--tests/auto/core/core.pro8
-rw-r--r--tests/auto/core/handle/tst_handle.cpp26
-rw-r--r--tests/auto/core/handlemanager/tst_handlemanager.cpp28
-rw-r--r--tests/auto/core/nodes/tst_nodes.cpp442
-rw-r--r--tests/auto/core/qaspectengine/tst_qaspectengine.cpp135
-rw-r--r--tests/auto/core/qaspectfactory/tst_qaspectfactory.cpp40
-rw-r--r--tests/auto/core/qaspectjob/tst_qaspectjob.cpp26
-rw-r--r--tests/auto/core/qboundedcircularbuffer/tst_qboundedcircularbuffer.cpp26
-rw-r--r--tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp154
-rw-r--r--tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp26
-rw-r--r--tests/auto/core/qentity/tst_qentity.cpp118
-rw-r--r--tests/auto/core/qframeallocator/tst_qframeallocator.cpp70
-rw-r--r--tests/auto/core/qray3d/qray3d.pro8
-rw-r--r--tests/auto/core/qray3d/tst_qray3d.cpp546
-rw-r--r--tests/auto/core/qscene/tst_qscene.cpp54
-rw-r--r--tests/auto/core/qservicelocator/tst_qservicelocator.cpp34
-rw-r--r--tests/auto/core/qtransform/tst_qtransform.cpp82
-rw-r--r--tests/auto/core/threadpooler/tst_threadpooler.cpp28
-rw-r--r--tests/auto/input/abstractaxisinput/abstractaxisinput.pro12
-rw-r--r--tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp146
-rw-r--r--tests/auto/input/action/action.pro3
-rw-r--r--tests/auto/input/action/tst_action.cpp121
-rw-r--r--tests/auto/input/analogaxisinput/analogaxisinput.pro12
-rw-r--r--tests/auto/input/analogaxisinput/tst_analogaxisinput.cpp130
-rw-r--r--tests/auto/input/axis/axis.pro3
-rw-r--r--tests/auto/input/axis/tst_axis.cpp124
-rw-r--r--tests/auto/input/axisinput/axisinput.pro11
-rw-r--r--tests/auto/input/axisinput/tst_axisinput.cpp178
-rw-r--r--tests/auto/input/buttonaxisinput/buttonaxisinput.pro12
-rw-r--r--tests/auto/input/buttonaxisinput/tst_buttonaxisinput.cpp279
-rw-r--r--tests/auto/input/commons/testdevice.h42
-rw-r--r--tests/auto/input/input.pro8
-rw-r--r--tests/auto/input/qabstractaxisinput/qabstractaxisinput.pro12
-rw-r--r--tests/auto/input/qabstractaxisinput/tst_qabstractaxisinput.cpp89
-rw-r--r--tests/auto/input/qaction/tst_qaction.cpp112
-rw-r--r--tests/auto/input/qactioninput/tst_qactioninput.cpp92
-rw-r--r--tests/auto/input/qanalogaxisinput/qanalogaxisinput.pro12
-rw-r--r--tests/auto/input/qanalogaxisinput/tst_qanalogaxisinput.cpp131
-rw-r--r--tests/auto/input/qaxis/tst_qaxis.cpp121
-rw-r--r--tests/auto/input/qaxisinput/qaxisinput.pro12
-rw-r--r--tests/auto/input/qaxisinput/tst_qaxisinput.cpp179
-rw-r--r--tests/auto/input/qbuttonaxisinput/qbuttonaxisinput.pro12
-rw-r--r--tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp182
-rw-r--r--tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp126
-rw-r--r--tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h36
-rw-r--r--tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp26
-rw-r--r--tests/auto/render/attribute/attribute.pro1
-rw-r--r--tests/auto/render/attribute/tst_attribute.cpp108
-rw-r--r--tests/auto/render/boundingvolumedebug/tst_boundingvolumedebug.cpp46
-rw-r--r--tests/auto/render/buffer/buffer.pro1
-rw-r--r--tests/auto/render/buffer/tst_buffer.cpp88
-rw-r--r--tests/auto/render/commons/commons.pri8
-rw-r--r--tests/auto/render/commons/testpostmanarbiter.cpp30
-rw-r--r--tests/auto/render/commons/testpostmanarbiter.h30
-rw-r--r--tests/auto/render/commons/testrenderer.cpp63
-rw-r--r--tests/auto/render/commons/testrenderer.h83
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc1-dx10.ddsbin0 -> 332 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips-dx10.ddsbin0 -> 276 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips.ddsbin0 -> 256 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc1.ddsbin0 -> 312 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc3-dx10.ddsbin0 -> 516 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips-dx10.ddsbin0 -> 404 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips.ddsbin0 -> 384 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc3.ddsbin0 -> 496 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-lumi-nomips.ddsbin0 -> 384 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-lumi.ddsbin0 -> 469 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-rgb-nomips.ddsbin0 -> 1152 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-rgb.ddsbin0 -> 1492 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc1-dx10.ddsbin0 -> 1252 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips-dx10.ddsbin0 -> 916 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips.ddsbin0 -> 896 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc1.ddsbin0 -> 1232 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc3-dx10.ddsbin0 -> 2356 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips-dx10.ddsbin0 -> 1684 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips.ddsbin0 -> 1664 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc3.ddsbin0 -> 2336 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-lumi-nomips.ddsbin0 -> 1664 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-lumi.ddsbin0 -> 2174 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-rgb-nomips.ddsbin0 -> 6272 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-rgb.ddsbin0 -> 8312 bytes
-rw-r--r--tests/auto/render/ddstextures/ddstextures.pro37
-rw-r--r--tests/auto/render/ddstextures/tst_ddstextures.cpp93
-rw-r--r--tests/auto/render/entity/entity.pro2
-rw-r--r--tests/auto/render/entity/tst_entity.cpp100
-rw-r--r--tests/auto/render/framegraphnode/tst_framegraphnode.cpp124
-rw-r--r--tests/auto/render/geometry/geometry.pro3
-rw-r--r--tests/auto/render/geometry/tst_geometry.cpp94
-rw-r--r--tests/auto/render/geometryrenderer/geometryrenderer.pro4
-rw-r--r--tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp221
-rw-r--r--tests/auto/render/material/material.pro4
-rw-r--r--tests/auto/render/material/tst_material.cpp68
-rw-r--r--tests/auto/render/meshfunctors/tst_meshfunctors.cpp42
-rw-r--r--tests/auto/render/objectpicker/objectpicker.pro1
-rw-r--r--tests/auto/render/objectpicker/tst_objectpicker.cpp72
-rw-r--r--tests/auto/render/picking/picking.pro2
-rw-r--r--tests/auto/render/picking/tst_picking.cpp74
-rw-r--r--tests/auto/render/qabstractlight/qabstractlight.pro11
-rw-r--r--tests/auto/render/qabstractlight/tst_qabstractlight.cpp289
-rw-r--r--tests/auto/render/qattribute/tst_qattribute.cpp137
-rw-r--r--tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp71
-rw-r--r--tests/auto/render/qbuffer/tst_qbuffer.cpp113
-rw-r--r--tests/auto/render/qcameraselector/tst_qcameraselector.cpp81
-rw-r--r--tests/auto/render/qclearbuffer/qclearbuffer.pro11
-rw-r--r--tests/auto/render/qclearbuffer/tst_qclearbuffer.cpp152
-rw-r--r--tests/auto/render/qclearbuffers/qclearbuffers.pro11
-rw-r--r--tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp143
-rw-r--r--tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro2
-rw-r--r--tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp146
-rw-r--r--tests/auto/render/qframegraph/qframegraph.pro10
-rw-r--r--tests/auto/render/qframegraph/tst_qframegraph.cpp192
-rw-r--r--tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp78
-rw-r--r--tests/auto/render/qgeometry/tst_qgeometry.cpp137
-rw-r--r--tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp238
-rw-r--r--tests/auto/render/qgraphicsutils/tst_qgraphicsutils.cpp26
-rw-r--r--tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp140
-rw-r--r--tests/auto/render/qlight/qlight.pro11
-rw-r--r--tests/auto/render/qlight/tst_qlight.cpp260
-rw-r--r--tests/auto/render/qmaterial/qmaterial.pro2
-rw-r--r--tests/auto/render/qmaterial/tst_qmaterial.cpp223
-rw-r--r--tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp98
-rw-r--r--tests/auto/render/qray3d/qray3d.pro8
-rw-r--r--tests/auto/render/qray3d/tst_qray3d.cpp538
-rw-r--r--tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp198
-rw-r--r--tests/auto/render/qrenderstateset/qrenderstateset.pro10
-rw-r--r--tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp176
-rw-r--r--tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp120
-rw-r--r--tests/auto/render/qsortcriterion/qsortcriterion.pro11
-rw-r--r--tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp72
-rw-r--r--tests/auto/render/qsortmethod/qsortmethod.pro10
-rw-r--r--tests/auto/render/qsortmethod/tst_qsortmethod.cpp170
-rw-r--r--tests/auto/render/qsortpolicy/qsortpolicy.pro10
-rw-r--r--tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp149
-rw-r--r--tests/auto/render/qstateset/qstateset.pro10
-rw-r--r--tests/auto/render/qstateset/tst_qstateset.cpp198
-rw-r--r--tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp195
-rw-r--r--tests/auto/render/qtextureimagedata/qtextureimagedata.pro10
-rw-r--r--tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp89
-rw-r--r--tests/auto/render/qviewport/tst_qviewport.cpp131
-rw-r--r--tests/auto/render/raycasting/tst_raycasting.cpp50
-rw-r--r--tests/auto/render/render.pro19
-rw-r--r--tests/auto/render/renderpass/renderpass.pro3
-rw-r--r--tests/auto/render/renderpass/tst_renderpass.cpp291
-rw-r--r--tests/auto/render/renderqueue/tst_renderqueue.cpp28
-rw-r--r--tests/auto/render/renderviews/tst_renderviews.cpp32
-rw-r--r--tests/auto/render/renderviewutils/renderviewutils.pro3
-rw-r--r--tests/auto/render/renderviewutils/tst_renderviewutils.cpp161
-rw-r--r--tests/auto/render/shader/shader.pro2
-rw-r--r--tests/auto/render/shader/tst_shader.cpp33
-rw-r--r--tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp52
-rw-r--r--tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp62
-rw-r--r--tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp26
-rw-r--r--tests/auto/shared/util.cpp28
-rw-r--r--tests/auto/shared/util.h28
-rw-r--r--tests/benchmarks/Qt3DBench/GroundPlane.qml26
-rw-r--r--tests/benchmarks/Qt3DBench/Light.qml28
-rw-r--r--tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml38
-rw-r--r--tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml28
-rw-r--r--tests/benchmarks/Qt3DBench/ShadowEffect.qml32
-rw-r--r--tests/benchmarks/Qt3DBench/ShadowMaterial.qml26
-rw-r--r--tests/benchmarks/Qt3DBench/SphereElement.qml28
-rw-r--r--tests/benchmarks/Qt3DBench/SphereView.qml28
-rw-r--r--tests/benchmarks/Qt3DBench/main.cpp28
-rw-r--r--tests/benchmarks/Qt3DBench/shaders/ads.frag2
-rw-r--r--tests/benchmarks/Qt3DBench/shaders/ads.vert2
-rw-r--r--tests/benchmarks/Qt3DBench/shaders/shadowmap.frag2
-rw-r--r--tests/benchmarks/Qt3DBench/shaders/shadowmap.vert2
-rw-r--r--tests/benchmarks/core/qcircularbuffer/tst_bench_qcircularbuffer.cpp26
-rw-r--r--tests/benchmarks/core/qframeallocator/tst_bench_qframeallocator.cpp26
-rw-r--r--tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp26
-rw-r--r--tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp26
-rw-r--r--tests/benchmarks/render/jobs/jobs.pro2
-rw-r--r--tests/benchmarks/render/jobs/tst_bench_jobs.cpp85
-rw-r--r--tests/manual/assimp-cpp/assimp-cpp.pro11
-rw-r--r--tests/manual/assimp-cpp/main.cpp165
-rw-r--r--tests/manual/assimp/assimp.pro17
-rw-r--r--tests/manual/assimp/assimp.qrc (renamed from examples/qt3d/assimp/assimp.qrc)0
-rw-r--r--tests/manual/assimp/doc/src/assimp.qdoc32
-rw-r--r--tests/manual/assimp/main.cpp117
-rw-r--r--tests/manual/assimp/main.qml214
-rw-r--r--tests/manual/bigmodel-qml/MyEntity.qml70
-rw-r--r--tests/manual/bigmodel-qml/bigmodel-qml.pro18
-rw-r--r--tests/manual/bigmodel-qml/bigmodel-qml.qrc (renamed from examples/qt3d/bigmodel-qml/bigmodel-qml.qrc)0
-rw-r--r--tests/manual/bigmodel-qml/doc/src/bigmodel-qml.qdoc32
-rw-r--r--tests/manual/bigmodel-qml/main.cpp64
-rw-r--r--tests/manual/bigmodel-qml/main.qml120
-rw-r--r--tests/manual/bigscene-cpp/bigscene-cpp.pro13
-rw-r--r--tests/manual/bigscene-cpp/doc/src/bigscene-cpp.qdoc32
-rw-r--r--tests/manual/bigscene-cpp/entity.cpp140
-rw-r--r--tests/manual/bigscene-cpp/entity.h111
-rw-r--r--tests/manual/bigscene-cpp/main.cpp133
-rw-r--r--tests/manual/bigscene-instanced-qml/bigscene-instanced-qml.pro12
-rw-r--r--tests/manual/bigscene-instanced-qml/bigscene-instanced-qml.qrc (renamed from examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.qrc)0
-rw-r--r--tests/manual/bigscene-instanced-qml/instanced.frag (renamed from examples/qt3d/bigscene-instanced-qml/instanced.frag)0
-rw-r--r--tests/manual/bigscene-instanced-qml/instanced.vert (renamed from examples/qt3d/bigscene-instanced-qml/instanced.vert)0
-rw-r--r--tests/manual/bigscene-instanced-qml/main.cpp63
-rw-r--r--tests/manual/bigscene-instanced-qml/main.qml128
-rw-r--r--tests/manual/clip-planes-qml/CappingMaterialEffect.qml93
-rw-r--r--tests/manual/clip-planes-qml/ClipCappingFrameGraph.qml157
-rw-r--r--tests/manual/clip-planes-qml/ClipMaterialEffect.qml100
-rw-r--r--tests/manual/clip-planes-qml/ClipPlaneEntity.qml85
-rw-r--r--tests/manual/clip-planes-qml/ClippingPlanes.qml183
-rw-r--r--tests/manual/clip-planes-qml/PlaneVisualizationMaterial.qml134
-rw-r--r--tests/manual/clip-planes-qml/capping.frag (renamed from examples/qt3d/clip-planes-qml/capping.frag)0
-rw-r--r--tests/manual/clip-planes-qml/capping.geom (renamed from examples/qt3d/clip-planes-qml/capping.geom)0
-rw-r--r--tests/manual/clip-planes-qml/capping.vert (renamed from examples/qt3d/clip-planes-qml/capping.vert)0
-rw-r--r--tests/manual/clip-planes-qml/clip-planes-qml.pro11
-rw-r--r--tests/manual/clip-planes-qml/clip-planes-qml.qrc (renamed from examples/qt3d/clip-planes-qml/clip-planes-qml.qrc)0
-rw-r--r--tests/manual/clip-planes-qml/main.cpp63
-rw-r--r--tests/manual/clip-planes-qml/main.qml120
-rw-r--r--tests/manual/clip-planes-qml/passthrough.frag (renamed from examples/qt3d/clip-planes-qml/passthrough.frag)0
-rw-r--r--tests/manual/clip-planes-qml/phong-clip.frag (renamed from examples/qt3d/clip-planes-qml/phong-clip.frag)0
-rw-r--r--tests/manual/clip-planes-qml/phong-clip.vert (renamed from examples/qt3d/clip-planes-qml/phong-clip.vert)0
-rw-r--r--tests/manual/component-changes/component-changes.pro9
-rw-r--r--tests/manual/component-changes/doc/src/component-changes.qdoc32
-rw-r--r--tests/manual/component-changes/main.cpp161
-rw-r--r--tests/manual/custom-mesh-cpp/custom-mesh-cpp.pro8
-rw-r--r--tests/manual/custom-mesh-cpp/main.cpp253
-rw-r--r--tests/manual/custom-mesh-qml/custom-mesh-qml.pro11
-rw-r--r--tests/manual/custom-mesh-qml/custom-mesh-qml.qrc (renamed from examples/qt3d/custom-mesh-qml/custom-mesh-qml.qrc)0
-rw-r--r--tests/manual/custom-mesh-qml/main.cpp63
-rw-r--r--tests/manual/custom-mesh-qml/main.qml246
-rw-r--r--tests/manual/cylinder-cpp/cylinder-cpp.pro9
-rw-r--r--tests/manual/cylinder-cpp/doc/src/cylinder-cpp.qdoc32
-rw-r--r--tests/manual/cylinder-cpp/main.cpp120
-rw-r--r--tests/manual/cylinder-qml/cylinder-qml.pro14
-rw-r--r--tests/manual/cylinder-qml/cylinder-qml.qrc (renamed from examples/qt3d/cylinder-qml/cylinder-qml.qrc)0
-rw-r--r--tests/manual/cylinder-qml/doc/src/cylinder-qml.qdoc32
-rw-r--r--tests/manual/cylinder-qml/main.cpp63
-rw-r--r--tests/manual/cylinder-qml/main.qml110
-rw-r--r--tests/manual/deferred-renderer-cpp/deferred-renderer-cpp.pro33
-rw-r--r--tests/manual/deferred-renderer-cpp/deferred-renderer-cpp.qrc12
-rw-r--r--tests/manual/deferred-renderer-cpp/deferredrenderer.cpp100
-rw-r--r--tests/manual/deferred-renderer-cpp/deferredrenderer.h87
-rw-r--r--tests/manual/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc32
-rw-r--r--tests/manual/deferred-renderer-cpp/final_gl2.frag36
-rw-r--r--tests/manual/deferred-renderer-cpp/final_gl2.vert9
-rw-r--r--tests/manual/deferred-renderer-cpp/final_gl3.frag37
-rw-r--r--tests/manual/deferred-renderer-cpp/final_gl3.vert9
-rw-r--r--tests/manual/deferred-renderer-cpp/finaleffect.cpp101
-rw-r--r--tests/manual/deferred-renderer-cpp/finaleffect.h74
-rw-r--r--tests/manual/deferred-renderer-cpp/gbuffer.cpp106
-rw-r--r--tests/manual/deferred-renderer-cpp/gbuffer.h81
-rw-r--r--tests/manual/deferred-renderer-cpp/geometry_gl2.frag12
-rw-r--r--tests/manual/deferred-renderer-cpp/geometry_gl2.vert21
-rw-r--r--tests/manual/deferred-renderer-cpp/geometry_gl3.frag16
-rw-r--r--tests/manual/deferred-renderer-cpp/geometry_gl3.vert21
-rw-r--r--tests/manual/deferred-renderer-cpp/main.cpp199
-rw-r--r--tests/manual/deferred-renderer-cpp/pointlightblock.cpp73
-rw-r--r--tests/manual/deferred-renderer-cpp/pointlightblock.h75
-rw-r--r--tests/manual/deferred-renderer-cpp/sceneeffect.cpp103
-rw-r--r--tests/manual/deferred-renderer-cpp/sceneeffect.h72
-rw-r--r--tests/manual/deferred-renderer-qml/DeferredRenderer.qml103
-rw-r--r--tests/manual/deferred-renderer-qml/FinalEffect.qml191
-rw-r--r--tests/manual/deferred-renderer-qml/GBuffer.qml136
-rw-r--r--tests/manual/deferred-renderer-qml/SceneEffect.qml156
-rw-r--r--tests/manual/deferred-renderer-qml/deferred-renderer-qml.pro21
-rw-r--r--tests/manual/deferred-renderer-qml/deferred-renderer-qml.qrc (renamed from examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.qrc)0
-rw-r--r--tests/manual/deferred-renderer-qml/doc/src/deferred-renderer-qml.qdoc32
-rw-r--r--tests/manual/deferred-renderer-qml/main.cpp63
-rw-r--r--tests/manual/deferred-renderer-qml/main.qml253
-rw-r--r--tests/manual/dynamicscene-cpp/boxentity.cpp120
-rw-r--r--tests/manual/dynamicscene-cpp/boxentity.h94
-rw-r--r--tests/manual/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc32
-rw-r--r--tests/manual/dynamicscene-cpp/dynamicscene-cpp.pro14
-rw-r--r--tests/manual/dynamicscene-cpp/examplescene.cpp96
-rw-r--r--tests/manual/dynamicscene-cpp/examplescene.h80
-rw-r--r--tests/manual/dynamicscene-cpp/main.cpp88
-rw-r--r--tests/manual/enabled-qml/doc/src/enabled-qml.qdoc32
-rw-r--r--tests/manual/enabled-qml/enabled-qml.pro12
-rw-r--r--tests/manual/enabled-qml/enabled-qml.qrc (renamed from examples/qt3d/enabled-qml/enabled-qml.qrc)0
-rw-r--r--tests/manual/enabled-qml/main.cpp63
-rw-r--r--tests/manual/enabled-qml/main.qml208
-rw-r--r--tests/manual/gltf/Wine.qml73
-rw-r--r--tests/manual/gltf/doc/src/gltf.qdoc32
-rw-r--r--tests/manual/gltf/gltf.pro18
-rw-r--r--tests/manual/gltf/gltf_example.qrc (renamed from examples/qt3d/gltf/gltf_example.qrc)0
-rw-r--r--tests/manual/gltf/main.cpp72
-rw-r--r--tests/manual/gltf/main.qml96
-rw-r--r--tests/manual/gooch-qml/MyEntity.qml67
-rw-r--r--tests/manual/gooch-qml/gooch-qml.pro16
-rw-r--r--tests/manual/gooch-qml/gooch-qml.qrc (renamed from examples/qt3d/gooch-qml/gooch-qml.qrc)0
-rw-r--r--tests/manual/gooch-qml/main.cpp67
-rw-r--r--tests/manual/gooch-qml/main.qml94
-rw-r--r--tests/manual/keyboardinput-qml/SphereEntity.qml81
-rw-r--r--tests/manual/keyboardinput-qml/doc/src/keyboardinput-qml.qdoc32
-rw-r--r--tests/manual/keyboardinput-qml/keyboardinput-qml.pro15
-rw-r--r--tests/manual/keyboardinput-qml/keyboardinput-qml.qrc (renamed from examples/qt3d/keyboardinput-qml/keyboardinput-qml.qrc)0
-rw-r--r--tests/manual/keyboardinput-qml/main.cpp63
-rw-r--r--tests/manual/keyboardinput-qml/main.qml110
-rw-r--r--tests/manual/loader-qml/CuboidEntity.qml97
-rw-r--r--tests/manual/loader-qml/SphereEntity.qml89
-rw-r--r--tests/manual/loader-qml/doc/src/loader-qml.qdoc32
-rw-r--r--tests/manual/loader-qml/loader-qml.pro16
-rw-r--r--tests/manual/loader-qml/loader-qml.qrc (renamed from examples/qt3d/loader-qml/loader-qml.qrc)0
-rw-r--r--tests/manual/loader-qml/main.cpp63
-rw-r--r--tests/manual/loader-qml/main.qml147
-rw-r--r--tests/manual/manual.pri3
-rw-r--r--tests/manual/manual.pro33
-rw-r--r--tests/manual/mouseinput-qml/main.cpp63
-rw-r--r--tests/manual/mouseinput-qml/main.qml130
-rw-r--r--tests/manual/mouseinput-qml/mouseinput-qml.pro13
-rw-r--r--tests/manual/mouseinput-qml/mouseinput-qml.qrc (renamed from examples/qt3d/mouseinput-qml/mouseinput-qml.qrc)0
-rw-r--r--tests/manual/picking-qml/PickableEntity.qml94
-rw-r--r--tests/manual/picking-qml/main.cpp67
-rw-r--r--tests/manual/picking-qml/main.qml218
-rw-r--r--tests/manual/picking-qml/picking-qml.pro13
-rw-r--r--tests/manual/picking-qml/picking-qml.qrc6
-rw-r--r--tests/manual/plasma/main.cpp68
-rw-r--r--tests/manual/plasma/main.qml98
-rw-r--r--tests/manual/plasma/plasma.frag (renamed from examples/qt3d/plasma/plasma.frag)0
-rw-r--r--tests/manual/plasma/plasma.pro18
-rw-r--r--tests/manual/plasma/plasma.qrc (renamed from examples/qt3d/plasma/plasma.qrc)0
-rw-r--r--tests/manual/plasma/plasma.vert (renamed from examples/qt3d/plasma/plasma.vert)0
-rw-r--r--tests/manual/scene3d-loader/AnimatedEntity.qml137
-rw-r--r--tests/manual/scene3d-loader/Scene.qml58
-rw-r--r--tests/manual/scene3d-loader/Scene2.qml112
-rw-r--r--tests/manual/scene3d-loader/main.cpp66
-rw-r--r--tests/manual/scene3d-loader/main.qml82
-rw-r--r--tests/manual/scene3d-loader/scene3d-loader.pro17
-rw-r--r--tests/manual/scene3d-loader/scene3d-loader.qrc (renamed from examples/qt3d/scene3d-loader/scene3d-loader.qrc)0
-rw-r--r--tests/manual/simple-shaders-qml/main.cpp63
-rw-r--r--tests/manual/simple-shaders-qml/main.qml214
-rw-r--r--tests/manual/simple-shaders-qml/simple-shader.frag (renamed from examples/qt3d/simple-shaders-qml/simple-shader.frag)0
-rw-r--r--tests/manual/simple-shaders-qml/simple-shader.vert (renamed from examples/qt3d/simple-shaders-qml/simple-shader.vert)0
-rw-r--r--tests/manual/simple-shaders-qml/simple-shaders-qml.pro16
-rw-r--r--tests/manual/simple-shaders-qml/simple-shaders-qml.qrc (renamed from examples/qt3d/simple-shaders-qml/simple-shaders-qml.qrc)0
-rw-r--r--tests/manual/skybox/Skybox.qml159
-rw-r--r--tests/manual/skybox/doc/src/skybox.qdoc32
-rw-r--r--tests/manual/skybox/main.cpp61
-rw-r--r--tests/manual/skybox/main.qml98
-rw-r--r--tests/manual/skybox/skybox.pro12
-rw-r--r--tests/manual/skybox/skybox.qrc (renamed from examples/qt3d/skybox/skybox.qrc)0
-rw-r--r--tests/manual/tessellation-modes/BasicCamera.qml65
-rw-r--r--tests/manual/tessellation-modes/TessellatedQuad.qml78
-rw-r--r--tests/manual/tessellation-modes/TessellatedWireframeEffect.qml103
-rw-r--r--tests/manual/tessellation-modes/TessellatedWireframeMaterial.qml76
-rw-r--r--tests/manual/tessellation-modes/doc/src/tessellation-modes.qdoc32
-rw-r--r--tests/manual/tessellation-modes/main.cpp78
-rw-r--r--tests/manual/tessellation-modes/main.qml126
-rw-r--r--tests/manual/tessellation-modes/shaders/flat.frag (renamed from examples/qt3d/tessellation-modes/shaders/flat.frag)0
-rw-r--r--tests/manual/tessellation-modes/shaders/isolines.tcs (renamed from examples/qt3d/tessellation-modes/shaders/isolines.tcs)0
-rw-r--r--tests/manual/tessellation-modes/shaders/isolines.tes (renamed from examples/qt3d/tessellation-modes/shaders/isolines.tes)0
-rw-r--r--tests/manual/tessellation-modes/shaders/passthru.vert (renamed from examples/qt3d/tessellation-modes/shaders/passthru.vert)0
-rw-r--r--tests/manual/tessellation-modes/shaders/phongwireframe.frag (renamed from examples/qt3d/tessellation-modes/shaders/phongwireframe.frag)0
-rw-r--r--tests/manual/tessellation-modes/shaders/quads.tcs (renamed from examples/qt3d/tessellation-modes/shaders/quads.tcs)0
-rw-r--r--tests/manual/tessellation-modes/shaders/quads.tes (renamed from examples/qt3d/tessellation-modes/shaders/quads.tes)0
-rw-r--r--tests/manual/tessellation-modes/shaders/robustwireframe.geom (renamed from examples/qt3d/tessellation-modes/shaders/robustwireframe.geom)0
-rw-r--r--tests/manual/tessellation-modes/shaders/triangles.tcs (renamed from examples/qt3d/tessellation-modes/shaders/triangles.tcs)0
-rw-r--r--tests/manual/tessellation-modes/shaders/triangles.tes (renamed from examples/qt3d/tessellation-modes/shaders/triangles.tes)0
-rw-r--r--tests/manual/tessellation-modes/tessellatedquadmesh.cpp104
-rw-r--r--tests/manual/tessellation-modes/tessellatedquadmesh.h63
-rw-r--r--tests/manual/tessellation-modes/tessellation-modes.pro23
-rw-r--r--tests/manual/tessellation-modes/tessellation-modes.qrc (renamed from examples/qt3d/tessellation-modes/tessellation-modes.qrc)0
-rw-r--r--tests/manual/transforms-qml/RenderableEntity.qml72
-rw-r--r--tests/manual/transforms-qml/TemporaryCamera.qml81
-rw-r--r--tests/manual/transforms-qml/TrefoilKnot.qml76
-rw-r--r--tests/manual/transforms-qml/main.cpp67
-rw-r--r--tests/manual/transforms-qml/main.qml115
-rw-r--r--tests/manual/transforms-qml/transforms-qml.pro18
-rw-r--r--tests/manual/transforms-qml/transforms-qml.qrc (renamed from examples/qt3d/transforms-qml/transforms-qml.qrc)0
-rw-r--r--tests/manual/transparency-qml-scene3d/Scene.qml206
-rw-r--r--tests/manual/transparency-qml-scene3d/main.cpp61
-rw-r--r--tests/manual/transparency-qml-scene3d/main.qml67
-rw-r--r--tests/manual/transparency-qml-scene3d/phongalpha.frag (renamed from examples/qt3d/transparency-qml-scene3d/phongalpha.frag)0
-rw-r--r--tests/manual/transparency-qml-scene3d/phongalpha.vert (renamed from examples/qt3d/transparency-qml-scene3d/phongalpha.vert)0
-rw-r--r--tests/manual/transparency-qml-scene3d/transparency-qml-scene3d.pro10
-rw-r--r--tests/manual/transparency-qml-scene3d/transparency-qml-scene3d.qrc (renamed from examples/qt3d/transparency-qml-scene3d/transparency-qml-scene3d.qrc)0
-rw-r--r--tests/manual/transparency-qml/main.cpp63
-rw-r--r--tests/manual/transparency-qml/main.qml220
-rw-r--r--tests/manual/transparency-qml/phongalpha.frag (renamed from examples/qt3d/transparency-qml/phongalpha.frag)0
-rw-r--r--tests/manual/transparency-qml/phongalpha.vert (renamed from examples/qt3d/transparency-qml/phongalpha.vert)0
-rw-r--r--tests/manual/transparency-qml/transparency-qml.pro10
-rw-r--r--tests/manual/transparency-qml/transparency-qml.qrc (renamed from examples/qt3d/transparency-qml/transparency-qml.qrc)0
-rw-r--r--tests/tests.pro4
-rw-r--r--tools/qgltf/qgltf.cpp64
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h1
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h1
-rw-r--r--tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json2
-rw-r--r--usecases/CleanQmlDream.qml26
-rw-r--r--usecases/ExternallyReferencedFrameGraphConfiguration.qml26
-rw-r--r--usecases/InlineFrameGraphConfiguration.qml26
-rw-r--r--usecases/OwnershipCompose.qml26
-rw-r--r--usecases/ReferencedFrameGraphConfiguration.qml26
-rw-r--r--usecases/SampleFrameGraphConfiguration.qml26
1997 files changed, 106349 insertions, 86545 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 21c63db35..4ef70163b 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,3 @@
load(qt_build_config)
-MODULE_VERSION = 5.6.2
+MODULE_VERSION = 5.7.0
diff --git a/LICENSE.GPL2 b/LICENSE.GPL2
new file mode 100644
index 000000000..d159169d1
--- /dev/null
+++ b/LICENSE.GPL2
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/LICENSE.GPL3 b/LICENSE.GPL3
new file mode 100644
index 000000000..94a9ed024
--- /dev/null
+++ b/LICENSE.GPL3
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/LICENSE.GPL3-EXCEPT b/LICENSE.GPL3-EXCEPT
new file mode 100644
index 000000000..b1cb1bec7
--- /dev/null
+++ b/LICENSE.GPL3-EXCEPT
@@ -0,0 +1,704 @@
+This is the GNU General Public License version 3, annotated with The
+Qt Company GPL Exception 1.0:
+
+-------------------------------------------------------------------------
+
+The Qt Company GPL Exception 1.0
+
+Exception 1:
+
+As a special exception you may create a larger work which contains the
+output of this application and distribute that work under terms of your
+choice, so long as the work is not otherwise derived from or based on
+this application and so long as the work does not in itself generate
+output that contains the output from this application in its original
+or modified form.
+
+Exception 2:
+
+As a special exception, you have permission to combine this application
+with Plugins licensed under the terms of your choice, to produce an
+executable, and to copy and distribute the resulting executable under
+the terms of your choice. However, the executable must be accompanied
+by a prominent notice offering all users of the executable the entire
+source code to this application, excluding the source code of the
+independent modules, but including any changes you have made to this
+application, under the terms of this license.
+
+
+-------------------------------------------------------------------------
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/LICENSE.LGPL3 b/LICENSE.LGPL3
new file mode 100644
index 000000000..65c5ca88a
--- /dev/null
+++ b/LICENSE.LGPL3
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/config.tests/assimp/main.cpp b/config.tests/assimp/main.cpp
index a502c009c..d367b0cd8 100644
--- a/config.tests/assimp/main.cpp
+++ b/config.tests/assimp/main.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/anaglyph-rendering/StereoCamera.qml b/examples/qt3d/anaglyph-rendering/StereoCamera.qml
index 9d2df1d0a..c8db4c0a9 100644
--- a/examples/qt3d/anaglyph-rendering/StereoCamera.qml
+++ b/examples/qt3d/anaglyph-rendering/StereoCamera.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml b/examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml
index 1d6a5a222..ebe4bbadd 100644
--- a/examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml
+++ b/examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -41,36 +55,41 @@ Viewport {
property alias leftCamera: leftCameraSelector.camera
property alias rightCamera: rightCameraSelector.camera
+ property alias window: surfaceSelector.surface
- // ColorMask is reset by default
- // By default reset to the default if not specified
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
- NoDraw {} // We just want to clear the buffers
- }
+ RenderSurfaceSelector {
+ id: surfaceSelector
- // Draw with left eye
- CameraSelector {
- id: leftCameraSelector
- StateSet {
- renderStates: [
- ColorMask { red: true; green: false; blue: false; alpha: false },
- DepthTest { func: DepthTest.Less }
- ]
+ // ColorMask is reset by default
+ // By default reset to the default if not specified
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
+ NoDraw {} // We just want to clear the buffers
}
- }
- // Draw with right eye
- ClearBuffer {
- buffers: ClearBuffer.DepthBuffer
+ // Draw with left eye
CameraSelector {
- id: rightCameraSelector
- StateSet {
+ id: leftCameraSelector
+ RenderStateSet {
renderStates: [
- ColorMask { red: false; green: true; blue: true; alpha: false },
- DepthTest { func: DepthTest.Less }
+ ColorMask { redMasked: true; greenMasked: false; blueMasked: false; alphaMasked: false },
+ DepthTest { depthFunction: DepthTest.Less }
]
}
}
+
+ // Draw with right eye
+ ClearBuffers {
+ buffers: ClearBuffers.DepthBuffer
+ CameraSelector {
+ id: rightCameraSelector
+ RenderStateSet {
+ renderStates: [
+ ColorMask { redMasked: false; greenMasked: true; blueMasked: true; alphaMasked: false },
+ DepthTest { depthFunction: DepthTest.Less }
+ ]
+ }
+ }
+ }
}
}
diff --git a/examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro b/examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro
index 436b6dc35..c49f8374d 100644
--- a/examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro
+++ b/examples/qt3d/anaglyph-rendering/anaglyph-rendering.pro
@@ -4,7 +4,7 @@
SOURCE += main.cpp
-QT += qml quick 3dcore 3drender 3dinput 3dquick
+QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras 3dquickextras
OTHER_FILES += *.qml
diff --git a/examples/qt3d/anaglyph-rendering/main.cpp b/examples/qt3d/anaglyph-rendering/main.cpp
index c9843e10c..dfda2f05d 100644
--- a/examples/qt3d/anaglyph-rendering/main.cpp
+++ b/examples/qt3d/anaglyph-rendering/main.cpp
@@ -1,62 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <Qt3DQuick/QQmlAspectEngine>
-
#include <QGuiApplication>
-#include <QtQml>
+#include <QQmlEngine>
+#include <QQmlContext>
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
- engine.setSource(QUrl("qrc:/main.qml"));
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/anaglyph-rendering/main.qml b/examples/qt3d/anaglyph-rendering/main.qml
index cb852a675..3510850a2 100644
--- a/examples/qt3d/anaglyph-rendering/main.qml
+++ b/examples/qt3d/anaglyph-rendering/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,11 +51,12 @@
import QtQuick 2.4 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
- components: FrameGraph {
+ components: RenderSettings {
StereoFrameGraph {
id: stereoFrameGraph
leftCamera: stereoCamera.leftCamera
diff --git a/examples/qt3d/assimp-cpp/assimp-cpp.pro b/examples/qt3d/assimp-cpp/assimp-cpp.pro
deleted file mode 100644
index f8b8ba7f2..000000000
--- a/examples/qt3d/assimp-cpp/assimp-cpp.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-android|ios|winrt {
- warning( "This example is not supported for android, ios, or winrt." )
-}
-
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += widgets 3dcore 3drender 3dinput
-
-SOURCES += main.cpp
diff --git a/examples/qt3d/assimp-cpp/main.cpp b/examples/qt3d/assimp-cpp/main.cpp
deleted file mode 100644
index bd077568b..000000000
--- a/examples/qt3d/assimp-cpp/main.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QFileDialog>
-#include <QApplication>
-
-#include <window.h>
-#include <Qt3DCore/QCamera>
-#include <Qt3DCore/QEntity>
-#include <Qt3DCore/QAspectEngine>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QSceneLoader>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QForwardRenderer>
-
-class SceneWalker : public QObject
-{
-public:
- SceneWalker(Qt3DRender::QSceneLoader *loader) : m_loader(loader) { }
-
- void onStatusChanged();
-
-private:
- void walkEntity(Qt3DCore::QEntity *e, int depth = 0);
-
- Qt3DRender::QSceneLoader *m_loader;
-};
-
-void SceneWalker::onStatusChanged()
-{
- qDebug() << "Status changed:" << m_loader->status();
- if (m_loader->status() != Qt3DRender::QSceneLoader::Loaded)
- return;
-
- // The QSceneLoader instance is a component of an entity. The loaded scene
- // tree is added under this entity.
- QVector<Qt3DCore::QEntity *> entities = m_loader->entities();
-
- // Technically there could be multiple entities referencing the scene loader
- // but sharing is discouraged, and in our case there will be one anyhow.
- if (entities.isEmpty())
- return;
- Qt3DCore::QEntity *root = entities[0];
- // Print the tree.
- walkEntity(root);
-
- // To access a given node (like a named mesh in the scene), use QObject::findChild().
- // The scene structure and names always depend on the asset.
- Qt3DCore::QEntity *e = root->findChild<Qt3DCore::QEntity *>(QStringLiteral("PlanePropeller_mesh")); // toyplane.obj
- if (e)
- qDebug() << "Found propeller node" << e << "with components" << e->components();
-}
-
-void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth)
-{
- Qt3DCore::QNodeList nodes = e->childrenNodes();
- for (int i = 0; i < nodes.count(); ++i) {
- Qt3DCore::QNode *node = nodes[i];
- Qt3DCore::QEntity *entity = qobject_cast<Qt3DCore::QEntity *>(node);
- if (entity) {
- QString indent;
- indent.fill(' ', depth * 2);
- qDebug().noquote() << indent << "Entity:" << entity << "Components:" << entity->components();
- walkEntity(entity, depth + 1);
- }
- }
-}
-
-int main(int ac, char **av)
-{
- QApplication app(ac, av);
-
- Window view;
-
- Qt3DCore::QAspectEngine engine;
- Qt3DInput::QInputAspect *inputAspect = new Qt3DInput::QInputAspect();
- engine.registerAspect(new Qt3DRender::QRenderAspect());
- engine.registerAspect(inputAspect);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.setData(data);
-
- // Root entity
- Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity();
-
- // Scene Camera
- Qt3DCore::QCamera *basicCamera = new Qt3DCore::QCamera(sceneRoot);
- basicCamera->setProjectionType(Qt3DCore::QCameraLens::PerspectiveProjection);
- basicCamera->setAspectRatio(view.width() / view.height());
- basicCamera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
- basicCamera->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f));
- basicCamera->setPosition(QVector3D(0.0f, 3.5f, 25.0f));
- basicCamera->setNearPlane(0.001f);
- basicCamera->setFarPlane(10000.0f);
- // For camera controls
- inputAspect->setCamera(basicCamera);
-
- // Forward Renderer FrameGraph
- Qt3DRender::QFrameGraph *frameGraphComponent = new Qt3DRender::QFrameGraph(sceneRoot);
- Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
- forwardRenderer->setCamera(basicCamera);
- forwardRenderer->setClearColor(Qt::black);
- frameGraphComponent->setActiveFrameGraph(forwardRenderer);
- sceneRoot->addComponent(frameGraphComponent);
-
- // Scene loader
- Qt3DCore::QEntity *sceneLoaderEntity = new Qt3DCore::QEntity(sceneRoot);
- Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader(sceneLoaderEntity);
- SceneWalker sceneWalker(sceneLoader);
- QObject::connect(sceneLoader, &Qt3DRender::QSceneLoader::statusChanged, &sceneWalker, &SceneWalker::onStatusChanged);
- sceneLoaderEntity->addComponent(sceneLoader);
-
- QStringList args = QCoreApplication::arguments();
- QUrl sourceFileName;
- if (args.count() <= 1) {
- QWidget *container = new QWidget();
- QFileDialog dialog;
- dialog.setFileMode(QFileDialog::AnyFile);
- sourceFileName = dialog.getOpenFileUrl(container, QStringLiteral("Open a scene file"));
- } else {
- sourceFileName = QUrl::fromLocalFile(args[1]);
- }
-
- if (sourceFileName.isEmpty())
- return 0;
-
- sceneLoader->setSource(sourceFileName);
-
- engine.setRootEntity(sceneRoot);
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/assimp/assimp.pro b/examples/qt3d/assimp/assimp.pro
deleted file mode 100644
index 02eac7dc9..000000000
--- a/examples/qt3d/assimp/assimp.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-SOURCE += main.cpp
-
-QT += qml quick 3dcore 3drender 3dinput 3dquick
-
-OTHER_FILES += main.qml
-
-SOURCES += \
- main.cpp
-
-RESOURCES += \
- assimp.qrc \
- ../exampleresources/test_scene.qrc \
- ../exampleresources/chest.qrc
diff --git a/examples/qt3d/assimp/doc/src/assimp.qdoc b/examples/qt3d/assimp/doc/src/assimp.qdoc
deleted file mode 100644
index c3ab093a1..000000000
--- a/examples/qt3d/assimp/doc/src/assimp.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example assimp
- \title Qt 3D: assimp Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/assimp/main.cpp b/examples/qt3d/assimp/main.cpp
deleted file mode 100644
index 1b59163f2..000000000
--- a/examples/qt3d/assimp/main.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QSceneLoader>
-#include <Qt3DCore/QEntity>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <qqml.h>
-
-class SceneHelper : public QObject
-{
- Q_OBJECT
-
-public:
- Q_INVOKABLE QObject *findEntity(Qt3DRender::QSceneLoader *loader, const QString &name);
- Q_INVOKABLE QObject *findComponent(Qt3DCore::QEntity *entity, const QString &componentMetatype);
- Q_INVOKABLE void addListEntry(const QVariant &list, QObject *entry);
-};
-
-QObject *SceneHelper::findEntity(Qt3DRender::QSceneLoader *loader, const QString &name)
-{
- // The QSceneLoader instance is a component of an entity. The loaded scene
- // tree is added under this entity.
- QVector<Qt3DCore::QEntity *> entities = loader->entities();
-
- if (entities.isEmpty())
- return 0;
-
- // Technically there could be multiple entities referencing the scene loader
- // but sharing is discouraged, and in our case there will be one anyhow.
- Qt3DCore::QEntity *root = entities[0];
-
- // The scene structure and names always depend on the asset.
- return root->findChild<Qt3DCore::QEntity *>(name);
-}
-
-QObject *SceneHelper::findComponent(Qt3DCore::QEntity *entity, const QString &componentMetatype)
-{
- Q_ASSERT(entity);
- Qt3DCore::QComponentList components = entity->components();
- Q_FOREACH (Qt3DCore::QComponent *component, components) {
- qDebug() << component->metaObject()->className();
- if (component->metaObject()->className() == componentMetatype) {
- return component;
- }
- }
- return Q_NULLPTR;
-}
-
-void SceneHelper::addListEntry(const QVariant &list, QObject *entry)
-{
- QQmlListReference ref = list.value<QQmlListReference>();
- ref.append(entry);
-}
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- qmlRegisterType<SceneHelper>("Qt3D.Examples", 2, 0, "SceneHelper");
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/examples/qt3d/assimp/main.qml b/examples/qt3d/assimp/main.qml
deleted file mode 100644
index 02a3aca2a..000000000
--- a/examples/qt3d/assimp/main.qml
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0 as Quick
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import Qt3D.Examples 2.0
-
-Entity
-{
- components: FrameGraph {
- activeFrameGraph: ForwardRenderer {
- clearColor: Qt.rgba(0, 0.5, 1, 1)
- camera: camera
- }
- }
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- // test_scene.dae contains three named nodes. Once the asynchronous loading of the
- // scene completes, we look up some of them.
- SceneHelper {
- id: sceneHelper
- }
-
- Quick.Component {
- id: animParamComp
- Quick.SequentialAnimation {
- id: seqAnim
- loops: Quick.Animation.Infinite
- property variant target: null
- Quick.ColorAnimation {
- target: seqAnim.target
- property: "value"
- from: Qt.rgba(0, 0, 0, 1)
- to: Qt.rgba(1, 1, 1, 1)
- duration: 2000
- }
- Quick.ColorAnimation {
- target: seqAnim.target
- property: "value"
- from: Qt.rgba(1, 1, 1, 1)
- to: Qt.rgba(0, 0, 0, 1)
- duration: 1000
- }
- }
- }
-
- Quick.Component {
- id: animRotComp
- Quick.QtObject {
- id: rotationData
- property real userAngle: 0.0
- property vector3d axis: Qt.vector3d(0, 0, 1)
- Quick.NumberAnimation on userAngle {
- from: 0
- to: 360
- duration: 5000
- loops: Quick.Animation.Infinite
- }
- }
- }
-
- Entity {
- components: [
- Transform {
- matrix: {
- var m = Qt.matrix4x4();
- m.rotate(90, Qt.vector3d(0, 1, 0));
- return m;
- }
- },
- SceneLoader {
- id: sceneLoader
- source: "qrc:/assets/test_scene.dae"
- onStatusChanged: {
- console.log("SceneLoader status: " + status);
- if (status == SceneLoader.Loaded) {
- console.log("Scene is ready");
-
- // Now find the torus and animate one of the material effect's parameters.
- var e = sceneHelper.findEntity(sceneLoader, "Torus");
- console.log("Found entity: " + e + " its components are:");
- for (var i = 0; i < e.components.length; ++i) {
- console.log(" " + e.components[i]);
- if (e.components[i].effect !== undefined) {
- var p = e.components[i].effect.parameters;
- for (var j = 0; j < p.length; ++j) {
- if (p[j].name === "kd") {
- var anim = animParamComp.createObject(p[j]);
- anim.target = p[j];
- anim.running = true;
- break;
- }
- }
-
- }
- }
-
- // Add an animated rotation transform to make Suzanne orbit around.
- e = sceneHelper.findEntity(sceneLoader, "Suzanne");
- var t = sceneHelper.findComponent(e, "Qt3DCore::QTransform");
- if (!t)
- return;
-
- // Add object with animation data as a child
- var suzanneAnim = animRotComp.createObject(t);
-
- // Query the existing transformation. We will use parts of this in
- // the replacement animation
- var origTranslation = t.translation;
- var origRotation = t.rotation;
- var origScale = t.scale;
- console.log("origTranslation = " + origTranslation);
- console.log("origRotation = " + origRotation);
- console.log("origScale = " + origScale);
-
- // Make a deep copy of the original translation. This will not be updated when the
- // transformation's translation property gets updated due to the animation.
- var constantTranslation = Qt.vector3d(origTranslation.x, origTranslation.y, origTranslation.z);
-
- t.matrix = Qt.binding(function() {
- var m = Qt.matrix4x4();
- m.rotate(suzanneAnim.userAngle, suzanneAnim.axis);
- m.translate(constantTranslation);
- m.rotate(90, Qt.vector3d(1, 0, 0));
- m.scale(origScale);
- return m;
- })
- }
- }
- }
- ]
- }
-
- Entity {
- components: [
- Transform {
- scale: 0.2
- translation: Qt.vector3d(0.0, -15.0, 0.0)
- },
- SceneLoader {
- source: "qrc:/assets/chest/Chest.obj"
- }
- ]
- }
-}
diff --git a/examples/qt3d/audio-visualizer-qml/BarEntity.qml b/examples/qt3d/audio-visualizer-qml/BarEntity.qml
index b9c8857ae..084549f10 100644
--- a/examples/qt3d/audio-visualizer-qml/BarEntity.qml
+++ b/examples/qt3d/audio-visualizer-qml/BarEntity.qml
@@ -36,6 +36,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
import QtQuick 2.4 as QQ2
Entity {
diff --git a/examples/qt3d/audio-visualizer-qml/Visualizer.qml b/examples/qt3d/audio-visualizer-qml/Visualizer.qml
index 26bb48fc9..562d8c184 100644
--- a/examples/qt3d/audio-visualizer-qml/Visualizer.qml
+++ b/examples/qt3d/audio-visualizer-qml/Visualizer.qml
@@ -36,6 +36,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
import QtQuick 2.2 as QQ2
Entity {
@@ -121,20 +122,16 @@ Entity {
}
//![0]
- Configuration {
- controlledCamera: camera
- }
-
Entity {
components: [
DirectionalLight {
intensity: 0.9
- direction: Qt.vector3d(0, 0.6, -1)
+ worldDirection: Qt.vector3d(0, 0.6, -1)
}
]
}
- FrameGraph {
+ RenderSettings {
id: external_forward_renderer
activeFrameGraph: ForwardRenderer {
camera: camera
diff --git a/examples/qt3d/audio-visualizer-qml/main.cpp b/examples/qt3d/audio-visualizer-qml/main.cpp
index 969be0a58..75f65610f 100644
--- a/examples/qt3d/audio-visualizer-qml/main.cpp
+++ b/examples/qt3d/audio-visualizer-qml/main.cpp
@@ -39,7 +39,6 @@
#include <QtGui/QOpenGLContext>
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickItem>
-#include <Qt3DQuick/QQmlAspectEngine>
#include <QtQml/QQmlContext>
int main(int argc, char* argv[])
@@ -58,14 +57,6 @@ int main(int argc, char* argv[])
view.setFormat(format);
view.create();
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.qmlEngine()->rootContext()->setContextProperty("_view", &view);
-
TouchSettings touchSettings;
view.rootContext()->setContextProperty("touchSettings", &touchSettings);
diff --git a/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro b/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro
index da83571fb..15eef0271 100644
--- a/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro
+++ b/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro
@@ -1,12 +1,12 @@
-android|ios|winrt {
- warning( "This example is not supported for android, ios, or winrt." )
+android|ios|tvos|winrt {
+ warning( "This example is not supported for android, ios, tvos, or winrt." )
}
!include( ../examples.pri ) {
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput
+QT += 3dcore 3drender 3dinput 3dextras
QT += widgets
SOURCES += main.cpp \
diff --git a/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc b/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc
index 68b817553..5b1c572ef 100644
--- a/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc
+++ b/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/basicshapes-cpp/main.cpp b/examples/qt3d/basicshapes-cpp/main.cpp
index 7b6bc6f9f..301aabb66 100644
--- a/examples/qt3d/basicshapes-cpp/main.cpp
+++ b/examples/qt3d/basicshapes-cpp/main.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -38,10 +52,9 @@
#include <QGuiApplication>
-#include <window.h>
-#include <Qt3DCore/qcamera.h>
+#include <Qt3DRender/qcamera.h>
#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qcameralens.h>
+#include <Qt3DRender/qcameralens.h>
#include <QtWidgets/QApplication>
#include <QtWidgets/QWidget>
@@ -52,7 +65,7 @@
#include <Qt3DInput/QInputAspect>
-#include <Qt3DRender/qtorusmesh.h>
+#include <Qt3DExtras/qtorusmesh.h>
#include <Qt3DRender/qmesh.h>
#include <Qt3DRender/qtechnique.h>
#include <Qt3DRender/qmaterial.h>
@@ -65,13 +78,16 @@
#include <Qt3DCore/qaspectengine.h>
#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DRender/qframegraph.h>
-#include <Qt3DRender/qforwardrenderer.h>
+#include <Qt3DExtras/qforwardrenderer.h>
+
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qfirstpersoncameracontroller.h>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
- Window *view = new Window();
+ Qt3DExtras::Qt3DWindow *view = new Qt3DExtras::Qt3DWindow();
+ view->defaultFramegraph()->setClearColor(QColor(QRgb(0x4d4d4f)));
QWidget *container = QWidget::createWindowContainer(view);
QSize screenSize = view->screen()->size();
container->setMinimumSize(QSize(200, 100));
@@ -86,55 +102,45 @@ int main(int argc, char **argv)
widget->setWindowTitle(QStringLiteral("Basic shapes"));
- Qt3DCore::QAspectEngine engine;
- engine.registerAspect(new Qt3DRender::QRenderAspect());
Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- engine.registerAspect(input);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(view));
- engine.setData(data);
+ view->registerAspect(input);
// Root entity
Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
// Camera
- Qt3DCore::QCamera *cameraEntity = new Qt3DCore::QCamera(rootEntity);
- cameraEntity->setObjectName(QStringLiteral("cameraEntity"));
+ Qt3DRender::QCamera *cameraEntity = view->camera();
cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
- cameraEntity->setPosition(QVector3D(0, 0, -20.0f));
+ cameraEntity->setPosition(QVector3D(0, 0, 20.0f));
cameraEntity->setUpVector(QVector3D(0, 1, 0));
cameraEntity->setViewCenter(QVector3D(0, 0, 0));
- input->setCamera(cameraEntity);
-
- // FrameGraph
- Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph();
- Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
- forwardRenderer->setCamera(cameraEntity);
- forwardRenderer->setClearColor(QColor(QRgb(0x4d4d4f)));
- frameGraph->setActiveFrameGraph(forwardRenderer);
-
- // Setting the FrameGraph
- rootEntity->addComponent(frameGraph);
+ // For camera controls
+ Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(rootEntity);
+ camController->setCamera(cameraEntity);
// Scenemodifier
SceneModifier *modifier = new SceneModifier(rootEntity);
// Set root object of the scene
- engine.setRootEntity(rootEntity);
+ view->setRootEntity(rootEntity);
// Create control widgets
QCommandLinkButton *info = new QCommandLinkButton();
info->setText(QStringLiteral("Qt3D ready-made meshes"));
- info->setDescription(QStringLiteral("Qt3D provides several ready-made meshes, like torus, cylinder, cube and sphere."));
+ info->setDescription(QString::fromLatin1("Qt3D provides several ready-made meshes, like torus, cylinder, cone, "
+ "cube, plane and sphere."));
info->setIconSize(QSize(0,0));
QCheckBox *torusCB = new QCheckBox(widget);
torusCB->setChecked(true);
torusCB->setText(QStringLiteral("Torus"));
+ QCheckBox *coneCB = new QCheckBox(widget);
+ coneCB->setChecked(true);
+ coneCB->setText(QStringLiteral("Cone"));
+
QCheckBox *cylinderCB = new QCheckBox(widget);
cylinderCB->setChecked(true);
cylinderCB->setText(QStringLiteral("Cylinder"));
@@ -143,38 +149,45 @@ int main(int argc, char **argv)
cuboidCB->setChecked(true);
cuboidCB->setText(QStringLiteral("Cuboid"));
+ QCheckBox *planeCB = new QCheckBox(widget);
+ planeCB->setChecked(true);
+ planeCB->setText(QStringLiteral("Plane"));
+
QCheckBox *sphereCB = new QCheckBox(widget);
sphereCB->setChecked(true);
sphereCB->setText(QStringLiteral("Sphere"));
vLayout->addWidget(info);
vLayout->addWidget(torusCB);
+ vLayout->addWidget(coneCB);
vLayout->addWidget(cylinderCB);
vLayout->addWidget(cuboidCB);
+ vLayout->addWidget(planeCB);
vLayout->addWidget(sphereCB);
QObject::connect(torusCB, &QCheckBox::stateChanged,
modifier, &SceneModifier::enableTorus);
+ QObject::connect(coneCB, &QCheckBox::stateChanged,
+ modifier, &SceneModifier::enableCone);
QObject::connect(cylinderCB, &QCheckBox::stateChanged,
modifier, &SceneModifier::enableCylinder);
QObject::connect(cuboidCB, &QCheckBox::stateChanged,
modifier, &SceneModifier::enableCuboid);
+ QObject::connect(planeCB, &QCheckBox::stateChanged,
+ modifier, &SceneModifier::enablePlane);
QObject::connect(sphereCB, &QCheckBox::stateChanged,
modifier, &SceneModifier::enableSphere);
torusCB->setChecked(true);
+ coneCB->setChecked(true);
cylinderCB->setChecked(true);
cuboidCB->setChecked(true);
+ planeCB->setChecked(true);
sphereCB->setChecked(true);
// Show window
widget->show();
widget->resize(1200, 800);
- // Update the aspect ratio
- QSize widgetSize = container->size();
- float aspectRatio = float(widgetSize.width()) / float(widgetSize.height());
- cameraEntity->lens()->setPerspectiveProjection(45.0f, aspectRatio, 0.1f, 1000.0f);
-
return app.exec();
}
diff --git a/examples/qt3d/basicshapes-cpp/scenemodifier.cpp b/examples/qt3d/basicshapes-cpp/scenemodifier.cpp
index 48977fc0b..cadfa517e 100644
--- a/examples/qt3d/basicshapes-cpp/scenemodifier.cpp
+++ b/examples/qt3d/basicshapes-cpp/scenemodifier.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -44,7 +58,7 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity)
// Torus shape data
//! [0]
- m_torus = new Qt3DRender::QTorusMesh();
+ m_torus = new Qt3DExtras::QTorusMesh();
m_torus->setRadius(1.0f);
m_torus->setMinorRadius(0.4f);
m_torus->setRings(100);
@@ -56,11 +70,11 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity)
Qt3DCore::QTransform *torusTransform = new Qt3DCore::QTransform();
torusTransform->setScale(2.0f);
torusTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(0.0f, 1.0f, 0.0f), 25.0f));
- torusTransform->setTranslation(QVector3D(4.0f, 4.0f, 0.0f));
+ torusTransform->setTranslation(QVector3D(5.0f, 4.0f, 0.0f));
//! [1]
//! [2]
- Qt3DRender::QPhongMaterial *torusMaterial = new Qt3DRender::QPhongMaterial();
+ Qt3DExtras::QPhongMaterial *torusMaterial = new Qt3DExtras::QPhongMaterial();
torusMaterial->setDiffuse(QColor(QRgb(0xbeb32b)));
//! [2]
@@ -72,8 +86,31 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity)
m_torusEntity->addComponent(torusTransform);
//! [3]
+ // Cone shape data
+ Qt3DExtras::QConeMesh *cone = new Qt3DExtras::QConeMesh();
+ cone->setTopRadius(0.5);
+ cone->setBottomRadius(1);
+ cone->setLength(3);
+ cone->setRings(50);
+ cone->setSlices(20);
+
+ // ConeMesh Transform
+ Qt3DCore::QTransform *coneTransform = new Qt3DCore::QTransform();
+ coneTransform->setScale(1.5f);
+ coneTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1.0f, 0.0f, 0.0f), 45.0f));
+ coneTransform->setTranslation(QVector3D(0.0f, 4.0f, -1.5));
+
+ Qt3DExtras::QPhongMaterial *coneMaterial = new Qt3DExtras::QPhongMaterial();
+ coneMaterial->setDiffuse(QColor(QRgb(0x928327)));
+
+ // Cone
+ m_coneEntity = new Qt3DCore::QEntity(m_rootEntity);
+ m_coneEntity->addComponent(cone);
+ m_coneEntity->addComponent(coneMaterial);
+ m_coneEntity->addComponent(coneTransform);
+
// Cylinder shape data
- Qt3DRender::QCylinderMesh *cylinder = new Qt3DRender::QCylinderMesh();
+ Qt3DExtras::QCylinderMesh *cylinder = new Qt3DExtras::QCylinderMesh();
cylinder->setRadius(1);
cylinder->setLength(3);
cylinder->setRings(100);
@@ -83,9 +120,9 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity)
Qt3DCore::QTransform *cylinderTransform = new Qt3DCore::QTransform();
cylinderTransform->setScale(1.5f);
cylinderTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1.0f, 0.0f, 0.0f), 45.0f));
- cylinderTransform->setTranslation(QVector3D(-4.0f, 4.0f, -1.5));
+ cylinderTransform->setTranslation(QVector3D(-5.0f, 4.0f, -1.5));
- Qt3DRender::QPhongMaterial *cylinderMaterial = new Qt3DRender::QPhongMaterial();
+ Qt3DExtras::QPhongMaterial *cylinderMaterial = new Qt3DExtras::QPhongMaterial();
cylinderMaterial->setDiffuse(QColor(QRgb(0x928327)));
// Cylinder
@@ -95,14 +132,14 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity)
m_cylinderEntity->addComponent(cylinderTransform);
// Cuboid shape data
- Qt3DRender::QCuboidMesh *cuboid = new Qt3DRender::QCuboidMesh();
+ Qt3DExtras::QCuboidMesh *cuboid = new Qt3DExtras::QCuboidMesh();
// CuboidMesh Transform
Qt3DCore::QTransform *cuboidTransform = new Qt3DCore::QTransform();
cuboidTransform->setScale(4.0f);
- cuboidTransform->setTranslation(QVector3D(4.0f, -4.0f, 0.0f));
+ cuboidTransform->setTranslation(QVector3D(5.0f, -4.0f, 0.0f));
- Qt3DRender::QPhongMaterial *cuboidMaterial = new Qt3DRender::QPhongMaterial();
+ Qt3DExtras::QPhongMaterial *cuboidMaterial = new Qt3DExtras::QPhongMaterial();
cuboidMaterial->setDiffuse(QColor(QRgb(0x665423)));
//Cuboid
@@ -111,8 +148,28 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity)
m_cuboidEntity->addComponent(cuboidMaterial);
m_cuboidEntity->addComponent(cuboidTransform);
+ // Plane shape data
+ Qt3DExtras::QPlaneMesh *planeMesh = new Qt3DExtras::QPlaneMesh();
+ planeMesh->setWidth(2);
+ planeMesh->setHeight(2);
+
+ // Plane mesh transform
+ Qt3DCore::QTransform *planeTransform = new Qt3DCore::QTransform();
+ planeTransform->setScale(1.3f);
+ planeTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1.0f, 0.0f, 0.0f), 45.0f));
+ planeTransform->setTranslation(QVector3D(0.0f, -4.0f, 0.0f));
+
+ Qt3DExtras::QPhongMaterial *planeMaterial = new Qt3DExtras::QPhongMaterial();
+ planeMaterial->setDiffuse(QColor(QRgb(0xa69929)));
+
+ // Plane
+ m_planeEntity = new Qt3DCore::QEntity(m_rootEntity);
+ m_planeEntity->addComponent(planeMesh);
+ m_planeEntity->addComponent(planeMaterial);
+ m_planeEntity->addComponent(planeTransform);
+
// Sphere shape data
- Qt3DRender::QSphereMesh *sphereMesh = new Qt3DRender::QSphereMesh();
+ Qt3DExtras::QSphereMesh *sphereMesh = new Qt3DExtras::QSphereMesh();
sphereMesh->setRings(20);
sphereMesh->setSlices(20);
sphereMesh->setRadius(2);
@@ -121,9 +178,9 @@ SceneModifier::SceneModifier(Qt3DCore::QEntity *rootEntity)
Qt3DCore::QTransform *sphereTransform = new Qt3DCore::QTransform();
sphereTransform->setScale(1.3f);
- sphereTransform->setTranslation(QVector3D(-4.0f, -4.0f, 0.0f));
+ sphereTransform->setTranslation(QVector3D(-5.0f, -4.0f, 0.0f));
- Qt3DRender::QPhongMaterial *sphereMaterial = new Qt3DRender::QPhongMaterial();
+ Qt3DExtras::QPhongMaterial *sphereMaterial = new Qt3DExtras::QPhongMaterial();
sphereMaterial->setDiffuse(QColor(QRgb(0xa69929)));
// Sphere
@@ -140,21 +197,31 @@ SceneModifier::~SceneModifier()
//! [4]
void SceneModifier::enableTorus(bool enabled)
{
- m_torusEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR);
+ m_torusEntity->setParent(enabled ? m_rootEntity : nullptr);
}
//! [4]
+void SceneModifier::enableCone(bool enabled)
+{
+ m_coneEntity->setParent(enabled ? m_rootEntity : nullptr);
+}
+
void SceneModifier::enableCylinder(bool enabled)
{
- m_cylinderEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR);
+ m_cylinderEntity->setParent(enabled ? m_rootEntity : nullptr);
}
void SceneModifier::enableCuboid(bool enabled)
{
- m_cuboidEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR);
+ m_cuboidEntity->setParent(enabled ? m_rootEntity : nullptr);
+}
+
+void SceneModifier::enablePlane(bool enabled)
+{
+ m_planeEntity->setParent(enabled ? m_rootEntity : nullptr);
}
void SceneModifier::enableSphere(bool enabled)
{
- m_sphereEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR);
+ m_sphereEntity->setParent(enabled ? m_rootEntity : nullptr);
}
diff --git a/examples/qt3d/basicshapes-cpp/scenemodifier.h b/examples/qt3d/basicshapes-cpp/scenemodifier.h
index 7ef8dd198..2d33ec95e 100644
--- a/examples/qt3d/basicshapes-cpp/scenemodifier.h
+++ b/examples/qt3d/basicshapes-cpp/scenemodifier.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -42,11 +56,13 @@
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/qtransform.h>
-#include <Qt3DRender/QTorusMesh>
-#include <Qt3DRender/QCylinderMesh>
-#include <Qt3DRender/QCuboidMesh>
-#include <Qt3DRender/QSphereMesh>
-#include <Qt3DRender/QPhongMaterial>
+#include <Qt3DExtras/QTorusMesh>
+#include <Qt3DExtras/QConeMesh>
+#include <Qt3DExtras/QCylinderMesh>
+#include <Qt3DExtras/QCuboidMesh>
+#include <Qt3DExtras/QPlaneMesh>
+#include <Qt3DExtras/QSphereMesh>
+#include <Qt3DExtras/QPhongMaterial>
class SceneModifier : public QObject
{
@@ -58,16 +74,20 @@ public:
public slots:
void enableTorus(bool enabled);
+ void enableCone(bool enabled);
void enableCylinder(bool enabled);
void enableCuboid(bool enabled);
+ void enablePlane(bool enabled);
void enableSphere(bool enabled);
private:
Qt3DCore::QEntity *m_rootEntity;
- Qt3DRender::QTorusMesh *m_torus;
+ Qt3DExtras::QTorusMesh *m_torus;
+ Qt3DCore::QEntity *m_coneEntity;
Qt3DCore::QEntity *m_cylinderEntity;
Qt3DCore::QEntity *m_torusEntity;
Qt3DCore::QEntity *m_cuboidEntity;
+ Qt3DCore::QEntity *m_planeEntity;
Qt3DCore::QEntity *m_sphereEntity;
};
diff --git a/examples/qt3d/bigmodel-qml/MyEntity.qml b/examples/qt3d/bigmodel-qml/MyEntity.qml
deleted file mode 100644
index df0dbd13d..000000000
--- a/examples/qt3d/bigmodel-qml/MyEntity.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
- property alias position: transform.translation
- property alias diffuse: material.diffuse
-
- components: [
- Transform { id: transform },
- SphereMesh { radius: 2 },
- PhongMaterial { id: material }
- ]
-}
diff --git a/examples/qt3d/bigmodel-qml/bigmodel-qml.pro b/examples/qt3d/bigmodel-qml/bigmodel-qml.pro
deleted file mode 100644
index d183530e5..000000000
--- a/examples/qt3d/bigmodel-qml/bigmodel-qml.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- MyEntity.qml
-
-RESOURCES += \
- bigmodel-qml.qrc
-
-DISTFILES += \
- MyEntity.qml
diff --git a/examples/qt3d/bigmodel-qml/doc/src/bigmodel-qml.qdoc b/examples/qt3d/bigmodel-qml/doc/src/bigmodel-qml.qdoc
deleted file mode 100644
index d7061bd74..000000000
--- a/examples/qt3d/bigmodel-qml/doc/src/bigmodel-qml.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example bigmodel-qml
- \title Qt 3D: Big Model QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/bigmodel-qml/main.cpp b/examples/qt3d/bigmodel-qml/main.cpp
deleted file mode 100644
index 0d944c883..000000000
--- a/examples/qt3d/bigmodel-qml/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-#include <iostream>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/bigmodel-qml/main.qml b/examples/qt3d/bigmodel-qml/main.qml
deleted file mode 100644
index 56081055e..000000000
--- a/examples/qt3d/bigmodel-qml/main.qml
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import QtQuick 2.2 as QQ2
-
-Entity {
- id: sceneRoot
-
- Configuration { controlledCamera: mainCamera }
-
- components: [
- FrameGraph { activeFrameGraph: ForwardRenderer { camera: mainCamera } }
- ]
-
- Camera {
- id: mainCamera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 22.5
- aspectRatio: 16 / 9
- nearPlane: 0.01
- farPlane: 1000.0
- position: Qt.vector3d( 0.0, 25.0, 40.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- }
-
- QQ2.ListModel {
- id: entityModel
- QQ2.ListElement { emptyRole: 0 }
- }
-
- NodeInstantiator {
- id: collection
- property int _count: 0
- property real spacing: 5
- property int cols: 8
- property int _rows: count / cols
-
- model: entityModel
- delegate: MyEntity {
- id: myEntity
- property real _lightness: 0.2 + 0.7 / collection._rows * Math.floor(index / collection.cols)
- property real _hue: (index % collection.cols) / collection.cols
- position: Qt.vector3d(collection.spacing * (index % collection.cols - 0.5 * (collection.cols - 1)),
- 0.0,
- collection.spacing * (Math.floor(index / collection.cols) - 0.5 * collection._rows));
- diffuse: Qt.hsla( _hue, 0.5, _lightness, 1.0 )
- }
- }
-
- QQ2.Timer {
- interval: 1000
- repeat: true
- running: true
- onTriggered: {
- entityModel.append({});
- }
- }
-}
diff --git a/examples/qt3d/bigscene-cpp/bigscene-cpp.pro b/examples/qt3d/bigscene-cpp/bigscene-cpp.pro
deleted file mode 100644
index 5dcaf3d0f..000000000
--- a/examples/qt3d/bigscene-cpp/bigscene-cpp.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput
-
-SOURCES += \
- main.cpp \
- entity.cpp
-
-HEADERS += \
- entity.h
-
diff --git a/examples/qt3d/bigscene-cpp/doc/src/bigscene-cpp.qdoc b/examples/qt3d/bigscene-cpp/doc/src/bigscene-cpp.qdoc
deleted file mode 100644
index 39a3d370d..000000000
--- a/examples/qt3d/bigscene-cpp/doc/src/bigscene-cpp.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example bigscene-cpp
- \title Qt 3D: Big Scene C++ Example
- \ingroup qt3d-examples-cpp
-*/
diff --git a/examples/qt3d/bigscene-cpp/entity.cpp b/examples/qt3d/bigscene-cpp/entity.cpp
deleted file mode 100644
index 7a13a6fb7..000000000
--- a/examples/qt3d/bigscene-cpp/entity.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "entity.h"
-
-#include <Qt3DRender/QCylinderMesh>
-#include <Qt3DRender/QPhongMaterial>
-#include <Qt3DCore/QTransform>
-#include <QMatrix4x4>
-
-Entity::Entity(Qt3DCore::QNode *parent)
- : QEntity(parent)
- , m_transform(new Qt3DCore::QTransform())
- , m_mesh(new Qt3DRender::QCylinderMesh())
- , m_material(new Qt3DRender::QPhongMaterial())
-{
- m_mesh->setRings(50.0f);
- m_mesh->setSlices(30.0f);
- m_mesh->setRadius(2.5f);
- m_mesh->setLength(5.0f);
-
- addComponent(m_mesh);
- addComponent(m_transform);
- addComponent(m_material);
-}
-
-void Entity::updateTransform()
-{
- QMatrix4x4 m;
- m.translate(m_position);
- m.rotate(m_phi, QVector3D(1.0f, 0.0f, 0.0f));
- m.rotate(m_theta, QVector3D(0.0f, 0.0f, 1.0f));
- m_transform->setMatrix(m);
-}
-
-float Entity::theta() const
-{
- return m_theta;
-}
-
-float Entity::phi() const
-{
- return m_phi;
-}
-
-QVector3D Entity::position() const
-{
- return m_position;
-}
-
-QColor Entity::diffuseColor() const
-{
- return m_material->diffuse();
-}
-
-void Entity::setTheta(float theta)
-{
- if (m_theta == theta)
- return;
-
- m_theta = theta;
- emit thetaChanged(theta);
- updateTransform();
-}
-
-void Entity::setPhi(float phi)
-{
- if (m_phi == phi)
- return;
-
- m_phi = phi;
- emit phiChanged(phi);
- updateTransform();
-}
-
-void Entity::setPosition(QVector3D position)
-{
- if (m_position == position)
- return;
-
- m_position = position;
- emit positionChanged(position);
- updateTransform();
-}
-
-void Entity::setDiffuseColor(QColor diffuseColor)
-{
- if (m_material->diffuse() == diffuseColor)
- return;
-
- m_material->setDiffuse(diffuseColor);
- emit diffuseColorChanged(diffuseColor);
-}
diff --git a/examples/qt3d/bigscene-cpp/entity.h b/examples/qt3d/bigscene-cpp/entity.h
deleted file mode 100644
index 932190324..000000000
--- a/examples/qt3d/bigscene-cpp/entity.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ENTITY_H
-#define ENTITY_H
-
-#include <Qt3DCore/QEntity>
-#include <QtGui/QColor>
-#include <QtGui/QVector3D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-class QTransform;
-}
-
-namespace Qt3DRender {
-class QCylinderMesh;
-class QPhongMaterial;
-}
-
-QT_END_NAMESPACE
-
-class Entity : public Qt3DCore::QEntity
-{
- Q_OBJECT
- Q_PROPERTY(float theta READ theta WRITE setTheta NOTIFY thetaChanged)
- Q_PROPERTY(float phi READ phi WRITE setPhi NOTIFY phiChanged)
- Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
- Q_PROPERTY(QColor diffuseColor READ diffuseColor WRITE setDiffuseColor NOTIFY diffuseColorChanged)
-
-public:
- Entity(Qt3DCore::QNode *parent = 0);
-
- float theta() const;
- float phi() const;
- QVector3D position() const;
- QColor diffuseColor() const;
-
-public slots:
- void setTheta(float theta);
- void setPhi(float phi);
- void setPosition(QVector3D position);
- void setDiffuseColor(QColor diffuseColor);
-
-signals:
- void thetaChanged(float theta);
- void phiChanged(float phi);
- void positionChanged(QVector3D position);
- void diffuseColorChanged(QColor diffuseColor);
-
-private:
- void updateTransform();
-
-private:
- Qt3DCore::QTransform *m_transform;
- Qt3DRender::QCylinderMesh *m_mesh;
- Qt3DRender::QPhongMaterial *m_material;
- float m_theta;
- float m_phi;
- QVector3D m_position;
-};
-
-#endif // ENTITY_H
diff --git a/examples/qt3d/bigscene-cpp/main.cpp b/examples/qt3d/bigscene-cpp/main.cpp
deleted file mode 100644
index 6d3405ec0..000000000
--- a/examples/qt3d/bigscene-cpp/main.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "entity.h"
-
-#include <QGuiApplication>
-#include <window.h>
-
-#include <QPropertyAnimation>
-#include <QUrl>
-#include <QTimer>
-#include <Qt3DCore/QEntity>
-#include <Qt3DCore/QCamera>
-#include <Qt3DCore/QTransform>
-#include <Qt3DCore/qaspectengine.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DRender/QParameter>
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QCylinderMesh>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QCameraSelector>
-#include <Qt3DRender/QPhongMaterial>
-#include <Qt3DRender/QForwardRenderer>
-#include <qmath.h>
-
-using namespace Qt3DCore;
-using namespace Qt3DRender;
-
-int main(int ac, char **av)
-{
- QGuiApplication app(ac, av);
-
- Window view;
- Qt3DCore::QAspectEngine engine;
- engine.registerAspect(new Qt3DRender::QRenderAspect());
- Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- engine.registerAspect(input);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.setData(data);
- QEntity *root = new QEntity();
-
- // Camera
- QCamera *cameraEntity = new QCamera(root);
- cameraEntity->setObjectName(QStringLiteral("cameraEntity"));
- cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
- cameraEntity->setPosition(QVector3D(0, -250.0f, -50.0f));
- cameraEntity->setUpVector(QVector3D(0, 1, 0));
- cameraEntity->setViewCenter(QVector3D(0, 0, 0));
- input->setCamera(cameraEntity);
-
- // FrameGraph
- QFrameGraph *frameGraph = new QFrameGraph();
- QForwardRenderer *forwardRenderer = new QForwardRenderer();
- forwardRenderer->setCamera(cameraEntity);
- forwardRenderer->setClearColor(Qt::black);
- frameGraph->setActiveFrameGraph(forwardRenderer);
- root->addComponent(frameGraph);
-
- const float radius = 100.0f;
- const int max = 1000;
- const float det = 1.0f / max;
-
- // Scene
- for (int i = 0; i < max; i++) {
- Entity *e = new Entity();
- const float angle = M_PI * 2.0f * i * det * 10.;
-
- e->setDiffuseColor(QColor(qFabs(qCos(angle)) * 255, 204, 75));
- e->setPosition(QVector3D(radius * qCos(angle), 200.* i * det, radius * qSin(angle)));
- e->setTheta(30.0f * i);
- e->setPhi(45.0f * i);
-
- QPropertyAnimation *animX = new QPropertyAnimation(e, QByteArrayLiteral("theta"));
- animX->setDuration(2400 * (i + 1));
- animX->setStartValue(QVariant::fromValue(i * 30.0f));
- animX->setEndValue(QVariant::fromValue((i + 1) * 390.0f));
- animX->setLoopCount(-1);
- animX->start();
-
- QPropertyAnimation *animZ = new QPropertyAnimation(e, QByteArrayLiteral("phi"));
- animZ->setDuration(2400 * (i + 1));
- animZ->setStartValue(QVariant::fromValue(i * 20.0f));
- animZ->setEndValue(QVariant::fromValue((i + 1) * 380.0f));
- animZ->setLoopCount(-1);
- animZ->start();
-
- e->setParent(root);
- }
-
- engine.setRootEntity(root);
- view.show();
-
- if (app.arguments().contains(("--bench")))
- QTimer::singleShot(25 * 1000, &app, &QCoreApplication::quit);
-
- return app.exec();
-}
diff --git a/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.pro b/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.pro
deleted file mode 100644
index 78c0e6927..000000000
--- a/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += qml quick 3dcore 3drender 3dinput 3dquick
-
-SOURCES += \
- main.cpp
-
-
-RESOURCES += \
- bigscene-instanced-qml.qrc
diff --git a/examples/qt3d/bigscene-instanced-qml/main.cpp b/examples/qt3d/bigscene-instanced-qml/main.cpp
deleted file mode 100644
index 1a538e49d..000000000
--- a/examples/qt3d/bigscene-instanced-qml/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/bigscene-instanced-qml/main.qml b/examples/qt3d/bigscene-instanced-qml/main.qml
deleted file mode 100644
index 699e8d305..000000000
--- a/examples/qt3d/bigscene-instanced-qml/main.qml
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import QtQuick 2.2 as QQ2
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d(0.0, -250.0, -50.0)
- upVector: Qt.vector3d(0.0, 1.0, 0.0)
- viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- components: [
- FrameGraph {
- activeFrameGraph: ForwardRenderer {
- clearColor: Qt.rgba(0, 0.5, 1, 1)
- camera: camera
- }
- }
- ]
-
- property real timeValue: 5
-
- Material {
- id: instancedPhongMaterial
- effect: Effect {
- techniques: Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- minorVersion: 2
- majorVersion: 3
- }
- renderPasses: RenderPass {
- shaderProgram: ShaderProgram {
- vertexShaderCode: loadSource("qrc:/instanced.vert")
- fragmentShaderCode: loadSource("qrc:/instanced.frag")
- }
- }
- }
- }
- parameters: Parameter { name: "instanceCount"; value: cylinderMeshInstanced.instanceCount }
- }
-
- CylinderMesh {
- id: cylinderMeshInstanced
- instanceCount: 2000
- rings: 50
- slices: 30
- radius: 2.5
- length: 5.0
- }
-
- Entity {
- id: torusEntity
- components: [ cylinderMeshInstanced, instancedPhongMaterial ]
- }
-}
diff --git a/examples/qt3d/clip-planes-qml/CappingMaterialEffect.qml b/examples/qt3d/clip-planes-qml/CappingMaterialEffect.qml
deleted file mode 100644
index 0be92543e..000000000
--- a/examples/qt3d/clip-planes-qml/CappingMaterialEffect.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Effect {
-
- property ShaderData sectionsData;
-
- parameters: [
- Parameter { name: "ka"; value: "black" },
- Parameter { name: "kd"; value: "blue" },
- Parameter { name: "ks"; value: "white" },
- Parameter { name: "shininess"; value: 100 },
- Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
- Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) },
- Parameter { name: "sectionsData"; value: sectionsData }
- ]
-
- techniques: [
- Technique {
-
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 3
- minorVersion: 2
- }
-
- renderPasses: [
- // Capping pass: generate planes given clipping plane equations
- // to be rendered with the phong material
- RenderPass {
- annotations: Annotation { name: "pass"; value: "capping" }
- shaderProgram: ShaderProgram {
- vertexShaderCode: loadSource("qrc:/capping.vert")
- geometryShaderCode: loadSource("qrc:/capping.geom")
- fragmentShaderCode: loadSource("qrc:/capping.frag")
- }
- }
- ]
- }
- ]
-}
-
diff --git a/examples/qt3d/clip-planes-qml/ClipCappingFrameGraph.qml b/examples/qt3d/clip-planes-qml/ClipCappingFrameGraph.qml
deleted file mode 100644
index 3fdc226a1..000000000
--- a/examples/qt3d/clip-planes-qml/ClipCappingFrameGraph.qml
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Viewport {
- property alias camera: cameraSelector.camera
-
- CameraSelector {
- id: cameraSelector
-
- StateSet {
- // Enable 3 clipping planes
- renderStates: [
- ClipPlane { plane: 0 },
- ClipPlane { plane: 1 },
- ClipPlane { plane: 2 },
- DepthTest { func: DepthTest.LessOrEqual }
- ]
-
- // Branch 1
- LayerFilter {
- // Render entities with their regular material
- // Fills depth buffer for entities that are clipped
- layers: ["content", "visualization"]
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
- RenderPassFilter {
- includes: Annotation { name: "pass"; value: "material" }
- }
- }
- }
-
- // Branch 2
- ClearBuffer {
- // Enable and fill Stencil to later generate caps
- buffers: ClearBuffer.StencilBuffer
- StateSet {
- // Disable depth culling
- // Incr for back faces
- // Decr for front faces
- // No need to output color values
- renderStates: [
- StencilTest {
- front {
- func: StencilTestSeparate.Always
- ref: 0; mask: 0
- }
- back {
- func: StencilTestSeparate.Always
- ref: 0; mask: 0
- }
- },
- StencilOp {
- front.stencilDepthPass: StencilOpSeparate.Decr
- back.stencilDepthPass: StencilOpSeparate.Incr
- },
- ColorMask { red: false; green: false; blue: false; alpha: false }
- ]
-
- LayerFilter {
- layers: "content"
- RenderPassFilter {
- includes: Annotation { name: "pass"; value: "stencilFill"; }
- }
- }
- }
- }
- }
-
- // Branch 3
- StateSet {
- // Draw caps using stencil buffer
- LayerFilter {
- layers: "caps"
- RenderPassFilter {
- includes: Annotation { name: "pass"; value: "capping"; }
- }
- }
-
- // Draw back faces - front faces -> caps
- renderStates: [
- StencilTest {
- front {
- func: StencilTestSeparate.NotEqual
- ref: 0; mask: ~0
- }
- back {
- func: StencilTestSeparate.NotEqual
- ref: 0; mask: ~0
- }
- }
- ]
- }
- }
-}
-
diff --git a/examples/qt3d/clip-planes-qml/ClipMaterialEffect.qml b/examples/qt3d/clip-planes-qml/ClipMaterialEffect.qml
deleted file mode 100644
index 36305b4d2..000000000
--- a/examples/qt3d/clip-planes-qml/ClipMaterialEffect.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Effect {
-
- property ShaderData sectionsData;
-
- parameters: [
- Parameter { name: "ka"; value: "black" },
- Parameter { name: "kd"; value: "blue" },
- Parameter { name: "ks"; value: "white" },
- Parameter { name: "shininess"; value: 100 },
- Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
- Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) },
- Parameter { name: "sectionsData"; value: sectionsData }
- ]
-
- techniques: [
- Technique {
-
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 3
- minorVersion: 2
- }
-
- renderPasses: [
-
- // Draw mesh with PhongMaterial and additional clipping planes
- RenderPass {
- annotations: Annotation { name: "pass"; value: "material" }
- shaderProgram: ShaderProgram {
- vertexShaderCode: loadSource("qrc:/phong-clip.vert")
- fragmentShaderCode: loadSource("qrc:/phong-clip.frag")
- }
- },
-
- // Basic stencil fill pass
- RenderPass {
- annotations: Annotation { name: "pass"; value: "stencilFill" }
- shaderProgram: ShaderProgram {
- vertexShaderCode: loadSource("qrc:/phong-clip.vert")
- fragmentShaderCode: loadSource("qrc:/passthrough.frag")
- }
- }
- ]
- }
- ]
-}
-
diff --git a/examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml b/examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml
deleted file mode 100644
index f7f963c7b..000000000
--- a/examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
- property Material visualMaterial;
- property real rotateAngle: 0.0
- property vector3d rotateAxis: Qt.vector3d(1.0, 0.0, 0.0)
- property vector3d center;
- property vector3d normal;
- readonly property vector4d equation: Qt.vector4d(normal.x,
- normal.y,
- normal.z,
- -(normal.x * center.x +
- normal.y * center.y +
- normal.z * center.z))
-
- PlaneMesh {
- id: mesh
- width: 20.0
- height: 20.0
- meshResolution: Qt.size(2, 2)
- }
-
- Transform {
- id: transform
- translation: root.center
- rotation: fromAxisAndAngle(root.rotateAxis, root.rotateAngle)
- }
-
- property Layer layer: Layer {
- names: "visualization"
- }
-
- components: [visualMaterial, mesh, transform, layer]
-}
-
diff --git a/examples/qt3d/clip-planes-qml/ClippingPlanes.qml b/examples/qt3d/clip-planes-qml/ClippingPlanes.qml
deleted file mode 100644
index 15ab76110..000000000
--- a/examples/qt3d/clip-planes-qml/ClippingPlanes.qml
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.4 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
- property ShaderData sectionData: ShaderData {
- property real sectionsCount: 3
- property ShaderDataArray sections: ShaderDataArray {
- ShaderData {
- property vector4d equation: clipPlane0.equation
- property vector3d center: clipPlane0.center
- }
- ShaderData {
- property vector4d equation: clipPlane1.equation
- property vector3d center: clipPlane1.center
- }
- ShaderData {
- property vector4d equation: clipPlane2.equation
- property vector3d center: clipPlane2.center
- }
- }
- }
-
- Entity {
- property Layer layer: Layer {
- names: "caps"
- }
-
- property Material cappingMaterial: Material {
- effect: CappingMaterialEffect {
- sectionsData: root.sectionData
- }
- }
-
- property PlaneMesh mesh: PlaneMesh {
- width: 20.0
- height: 20.0
- meshResolution: Qt.size(2, 2)
- }
-
- components: [cappingMaterial, mesh, layer]
- }
-
- PlaneVisualizationMaterial {
- id: clipPlanesMaterial
- alpha: 0.5
- }
-
- // XZ
- ClipPlaneEntity {
- id: clipPlane0
- visualMaterial: clipPlanesMaterial
- center: Qt.vector3d(0, -10, 0)
- normal: Qt.vector3d(0, -1.0, 0)
- }
- // XY
- ClipPlaneEntity {
- id: clipPlane1
- visualMaterial: clipPlanesMaterial
- center: Qt.vector3d(0, 0, 10)
- normal: Qt.vector3d(0, 0, -1.0)
- rotateAxis: Qt.vector3d(1.0, 0.0, 0.0)
- rotateAngle: 90
- }
-
- // YZ
- ClipPlaneEntity {
- id: clipPlane2
- visualMaterial: clipPlanesMaterial
- center: Qt.vector3d(-10, 0, 0)
- normal: Qt.vector3d(1.0, 0, 0)
- rotateAxis: Qt.vector3d(0.0, 0.0, 1.0)
- rotateAngle: -90
- }
-
- QQ2.SequentialAnimation {
- running: true
- loops: QQ2.Animation.Infinite
- QQ2.NumberAnimation {
- target: clipPlane0
- property: "center.y"
- from: 10
- to: 0
- duration: 2000
- easing.type: QQ2.Easing.InOutQuart
- }
-
- QQ2.NumberAnimation {
- target: clipPlane1
- property: "center.z"
- from: 10
- to: 0
- duration: 2000
- easing.type: QQ2.Easing.InOutQuart
- }
- QQ2.NumberAnimation {
- target: clipPlane2
- property: "center.x"
- from: -10
- to: 0
- duration: 4000
- easing.type: QQ2.Easing.InOutQuart
- }
- QQ2.NumberAnimation {
- target: clipPlane1
- property: "center.z"
- from: 0
- to: 10
- duration: 4000
- easing.type: QQ2.Easing.InOutQuint
- }
- QQ2.NumberAnimation {
- target: clipPlane0
- property: "center.y"
- from: 0
- to: 10
- duration: 2000
- easing.type: QQ2.Easing.InOutQuint
- }
- QQ2.NumberAnimation {
- target: clipPlane2
- property: "center.x"
- from: 0
- to: -10
- duration: 2000
- easing.type: QQ2.Easing.InOutQuint
- }
- }
-}
diff --git a/examples/qt3d/clip-planes-qml/PlaneVisualizationMaterial.qml b/examples/qt3d/clip-planes-qml/PlaneVisualizationMaterial.qml
deleted file mode 100644
index 2694a8999..000000000
--- a/examples/qt3d/clip-planes-qml/PlaneVisualizationMaterial.qml
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id:root
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
- property color specular: Qt.rgba( 0.95, 0.95, 0.95, 1.0 )
- property real shininess: 150.0
- property real alpha: 0.5
-
-
- ShaderProgram {
- id: gl3PhongAlphaShader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/phongalpha.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/phongalpha.frag")
- }
-
- ShaderProgram {
- id: gl2es2PhongAlphaShader
- vertexShaderCode: loadSource("qrc:/shaders/es2/phongalpha.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/phongalpha.frag")
- }
-
- effect: Effect {
-
- parameters: [
- Parameter { name: "alpha"; value: root.alpha },
- Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
- Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
- Parameter { name: "shininess"; value: root.shininess },
- Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
- Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) }
- ]
-
- techniques: [
- // GL 3 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass {
- shaderProgram: gl3PhongAlphaShader
- renderStates: [
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- },
- BlendEquation {mode: BlendEquation.FuncAdd}
- ]
- annotations: Annotation { name: "pass"; value: "material" }
- }
- },
-
- // GL 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2PhongAlphaShader
- renderStates: [
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- },
- BlendEquation {mode: BlendEquation.FuncAdd}
- ]
- annotations: Annotation { name: "pass"; value: "material" }
- }
- }
- ]
- }
-}
-
diff --git a/examples/qt3d/clip-planes-qml/clip-planes-qml.pro b/examples/qt3d/clip-planes-qml/clip-planes-qml.pro
deleted file mode 100644
index 5ecc28ca7..000000000
--- a/examples/qt3d/clip-planes-qml/clip-planes-qml.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += qml quick 3dcore 3drender 3dinput 3dquick
-
-SOURCES += main.cpp
-
-RESOURCES += \
- clip-planes-qml.qrc \
- ../exampleresources/obj.qrc
diff --git a/examples/qt3d/clip-planes-qml/main.cpp b/examples/qt3d/clip-planes-qml/main.cpp
deleted file mode 100644
index 3ee54692b..000000000
--- a/examples/qt3d/clip-planes-qml/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/clip-planes-qml/main.qml b/examples/qt3d/clip-planes-qml/main.qml
deleted file mode 100644
index b7bcd5adb..000000000
--- a/examples/qt3d/clip-planes-qml/main.qml
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.4 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 800/600
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, 40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration { controlledCamera: camera }
-
- components: FrameGraph {
- ClipCappingFrameGraph {
- camera: camera;
- clearColor: Qt.rgba(0.0, 0.5, 1, 1)
- }
- }
-
- ClipMaterialEffect {
- id: clipMaterialEffect
- sectionsData: clippingPlanes.sectionData
- }
-
- ClippingPlanes {
- id: clippingPlanes
- }
-
- // Entity being clipped
- Entity {
-
- property Material material: Material {
- effect: clipMaterialEffect
- parameters: [
- Parameter { name: "ka"; value: "black" },
- Parameter { name: "kd"; value: "blue" },
- Parameter { name: "ks"; value: "white" }
- ]
- }
-
- property Mesh mesh: Mesh {
- source: "assets/obj/trefoil.obj"
- }
-
- property Transform transform: Transform {
- translation: Qt.vector3d( 0.0, 0.0, 0.0 )
- scale: 3
- }
-
- property Layer layer: Layer {
- names: "content"
- }
-
- components: [material, transform, mesh, layer]
- }
-}
diff --git a/examples/qt3d/common/window.cpp b/examples/qt3d/common/window.cpp
deleted file mode 100644
index bb28f23ab..000000000
--- a/examples/qt3d/common/window.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "window.h"
-
-#include <QKeyEvent>
-#include <QGuiApplication>
-#include <QOpenGLContext>
-
-Window::Window(QScreen *screen)
- : QWindow(screen)
-
-{
- setSurfaceType(QSurface::OpenGLSurface);
-
- resize(1024, 768);
-
- QSurfaceFormat format;
- if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
- format.setVersion(4, 3);
- format.setProfile(QSurfaceFormat::CoreProfile);
- }
- format.setDepthBufferSize( 24 );
- format.setSamples( 4 );
- format.setStencilBufferSize(8);
- setFormat(format);
- create();
-}
-
-Window::~Window()
-{
-}
-
-void Window::keyPressEvent( QKeyEvent* e )
-{
- switch ( e->key() )
- {
- case Qt::Key_Escape:
- QGuiApplication::quit();
- break;
-
- default:
- QWindow::keyPressEvent( e );
- }
-}
diff --git a/examples/qt3d/common/window.h b/examples/qt3d/common/window.h
deleted file mode 100644
index 7c6e3606e..000000000
--- a/examples/qt3d/common/window.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WINDOW_H
-#define WINDOW_H
-
-#include <QWindow>
-
-class Window : public QWindow
-{
- Q_OBJECT
-public:
- explicit Window(QScreen *screen = 0);
- ~Window();
-
-protected:
- virtual void keyPressEvent(QKeyEvent *e);
-};
-
-#endif // QT3D_WINDOW_H
diff --git a/examples/qt3d/compute-particles/ComputeFrameGraph.qml b/examples/qt3d/compute-particles/ComputeFrameGraph.qml
new file mode 100644
index 000000000..9a84f246f
--- /dev/null
+++ b/examples/qt3d/compute-particles/ComputeFrameGraph.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Viewport {
+ property alias camera: selector.camera
+
+ RenderSurfaceSelector {
+ id: surfaceSelector
+
+ // Clear Buffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
+ NoDraw {}
+ }
+
+ // Compute Pass
+ DispatchCompute {
+ workGroupX: 1024; workGroupY: 1; workGroupZ: 1
+ TechniqueFilter {
+ matchAll: [
+ FilterKey { name: "type"; value: "compute"}
+ ]
+ }
+ }
+
+ // Draw particles from buffer computed in the Compute Pass
+ CameraSelector {
+ id: selector
+ TechniqueFilter {
+ matchAll: [
+ FilterKey { name: "type"; value: "draw"}
+ ]
+ }
+ }
+ }
+}
+
diff --git a/examples/qt3d/compute-particles/ComputeMaterial.qml b/examples/qt3d/compute-particles/ComputeMaterial.qml
new file mode 100644
index 000000000..3f09fc9ef
--- /dev/null
+++ b/examples/qt3d/compute-particles/ComputeMaterial.qml
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ property Buffer dataBuffer;
+ property real particleStep: 0.4
+ property real finalCollisionFactor: 0.2
+
+ parameters: [
+ Parameter { name: "particleStep"; value: particleStep },
+ Parameter { name: "finalCollisionFactor"; value: finalCollisionFactor }
+ ]
+
+ ShaderProgram {
+ id: computeShader
+ computeShaderCode: loadSource("qrc:/particles.comp")
+ }
+
+ ShaderProgram {
+ id: drawShader
+ vertexShaderCode: loadSource("qrc:/particles.vert")
+ fragmentShaderCode: loadSource("qrc:/particles.frag")
+ }
+
+ effect: Effect {
+ techniques: [
+ Technique {
+ renderPasses: [
+ RenderPass {
+ shaderProgram: computeShader
+ // We set the buffer as the parameter data
+ parameters: [
+ Parameter { name: "Particles"; value: dataBuffer }
+ ]
+ }
+ ]
+ filterKeys: [
+ FilterKey { name: "type"; value: "compute" }
+ ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 4
+ minorVersion: 3
+ }
+ },
+ Technique {
+ renderPasses: [
+ RenderPass {
+ shaderProgram: drawShader
+ // We assume the mesh to be drawn will also receive
+ // Vertex buffers attributes that will be used to position and color
+ }
+ ]
+ filterKeys: [
+ FilterKey { name: "type"; value: "draw" }
+ ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 4
+ minorVersion: 3
+ }
+ }
+ ] // techniques
+ }
+}
+
diff --git a/examples/qt3d/compute-particles/ParticlesScene.qml b/examples/qt3d/compute-particles/ParticlesScene.qml
new file mode 100644
index 000000000..cbb21f266
--- /dev/null
+++ b/examples/qt3d/compute-particles/ParticlesScene.qml
@@ -0,0 +1,247 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ property alias particleStep: computeMaterial.particleStep
+ property alias finalCollisionFactor: computeMaterial.finalCollisionFactor
+
+ readonly property int _SPHERE: 0
+ readonly property int _CUBE: 1
+ readonly property int _CYLINDER: 2
+ readonly property int _TORUS: 3
+
+ property int particlesShape: _SPHERE
+
+ signal reset()
+
+ components: [
+ RenderSettings {
+ ComputeFrameGraph {
+ camera: sceneCamera
+ }
+ // explicitly set RenderingPolicy to AlwaysRender, as changes in the
+ // scene won't be reflected in actual Qt scene-graph changes (due to
+ // GPU compute calls)
+ renderPolicy: RenderSettings.Always
+ }
+ ]
+
+ FirstPersonCameraController { camera: sceneCamera }
+
+ Camera {
+ id: sceneCamera
+ projectionType: CameraLens.PerspectiveProjection
+ viewCenter: Qt.vector3d(0, 0, 0)
+ position: Qt.vector3d(0, 0, -800)
+ nearPlane: 0.1
+ farPlane: 1000
+ fieldOfView: 25
+ aspectRatio: 1.33
+ }
+
+ property int particlesCount: 50 * 1024
+ readonly property int floatSize: 4
+
+ function buildParticlesBuffer() {
+ var bufferData = new Float32Array(particlesCount * 4 * 3);
+ var factor = 500.0;
+ for (var i = 0; i < particlesCount; ++i) {
+ var positionIdx = i * 12;
+ var velocityIdx = i * 12 + 4;
+ var colorIdx = i * 12 + 8;
+
+ for (var j = 0; j < 3; ++j) {
+ bufferData[positionIdx + j] = (Math.random() - 0.5) * factor;
+ bufferData[velocityIdx + j] = Math.random() * 2.0;
+ bufferData[colorIdx + j] = 0.75 + Math.sin(((i / 1024.0) + j * 0.333) * 6.0) * 0.25;
+ }
+
+ bufferData[positionIdx + 3] = 1.0;
+ bufferData[velocityIdx + 3] = 0.0;
+ bufferData[colorIdx + 3] = 1.0;
+ }
+ return bufferData
+ }
+
+ Buffer {
+ id: particleBuffer
+ type: Buffer.VertexBuffer
+ // struct ParticleData
+ // {
+ // vec3 position; // Aligned to 4 floats
+ // vec3 velocity; // Aligned to 4 floats
+ // vec3 color; // Aligned to 4 floats
+ // };
+ data: buildParticlesBuffer()
+ }
+
+ onReset : {
+ particleBuffer.data = buildParticlesBuffer()
+ }
+
+ Attribute {
+ id: particlePositionDataAttribute
+ name: "particlePosition"
+ attributeType: Attribute.VertexAttribute
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
+ divisor: 1
+ byteStride: 12 * floatSize
+ buffer: particleBuffer
+ }
+
+ Attribute {
+ id: particleColorDataAttribute
+ name: "particleColor"
+ attributeType: Attribute.VertexAttribute
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
+ divisor: 1
+ byteOffset: 8 * floatSize
+ byteStride: 12 * floatSize
+ buffer: particleBuffer
+ }
+
+ ComputeMaterial {
+ id: computeMaterial
+ dataBuffer: particleBuffer
+ }
+
+ Entity {
+ id: particleComputeEntity
+ readonly property ComputeCommand particlesComputeJob: ComputeCommand {}
+ components: [
+ particlesComputeJob,
+ computeMaterial
+ ]
+ }
+
+ SphereGeometry {
+ id: sphereGeometry
+ rings: 10
+ slices: 10
+ radius: 1
+ // Additional Attributes
+ attributes: [
+ particlePositionDataAttribute,
+ particleColorDataAttribute
+ ]
+ }
+
+ CuboidGeometry {
+ id: cubeGeometry
+ yzMeshResolution: Qt.size(2, 2)
+ xzMeshResolution: Qt.size(2, 2)
+ xyMeshResolution: Qt.size(2, 2)
+ // Additional Attributes
+ attributes: [
+ particlePositionDataAttribute,
+ particleColorDataAttribute
+ ]
+ }
+
+ CylinderGeometry {
+ id: cylinderGeometry
+ rings: 10
+ slices: 10
+ radius: 1
+ length: 1.5
+ // Additional Attributes
+ attributes: [
+ particlePositionDataAttribute,
+ particleColorDataAttribute
+ ]
+ }
+
+ TorusGeometry {
+ id: torusGeometry
+ rings: 10
+ slices: 10
+ radius: 1
+ minorRadius: 0.5
+ // Additional Attributes
+ attributes: [
+ particlePositionDataAttribute,
+ particleColorDataAttribute
+ ]
+ }
+
+ Entity {
+ id: particleRenderEntity
+ readonly property GeometryRenderer particlesRenderer: GeometryRenderer {
+ instanceCount: particlesCount
+ indexOffset: 0
+ firstInstance: 0
+ primitiveType: GeometryRenderer.Triangles
+ geometry: {
+ switch (particlesShape) {
+ case _SPHERE:
+ return sphereGeometry;
+ case _CUBE:
+ return cubeGeometry;
+ case _CYLINDER:
+ return cylinderGeometry;
+ case _TORUS:
+ return torusGeometry;
+ }
+ }
+ }
+
+ components: [
+ particlesRenderer,
+ computeMaterial
+ ]
+ }
+}
+
diff --git a/examples/qt3d/compute-particles/compute-particles.pro b/examples/qt3d/compute-particles/compute-particles.pro
new file mode 100644
index 000000000..c25cc0c30
--- /dev/null
+++ b/examples/qt3d/compute-particles/compute-particles.pro
@@ -0,0 +1,14 @@
+!include( ../examples.pri ) {
+ error( "Couldn't find the examples.pri file!" )
+}
+
+QT += 3dcore 3drender 3dquick 3dinput quick qml
+
+HEADERS += \
+
+
+RESOURCES += \
+ compute-particles.qrc
+
+SOURCES += \
+ main.cpp
diff --git a/examples/qt3d/compute-particles/compute-particles.qrc b/examples/qt3d/compute-particles/compute-particles.qrc
new file mode 100644
index 000000000..0f94fddd5
--- /dev/null
+++ b/examples/qt3d/compute-particles/compute-particles.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>ComputeFrameGraph.qml</file>
+ <file>ComputeMaterial.qml</file>
+ <file>particles.frag</file>
+ <file>particles.vert</file>
+ <file>ParticlesScene.qml</file>
+ <file>particles.comp</file>
+ </qresource>
+</RCC>
diff --git a/examples/qt3d/compute-particles/main.cpp b/examples/qt3d/compute-particles/main.cpp
new file mode 100644
index 000000000..66cd82ff9
--- /dev/null
+++ b/examples/qt3d/compute-particles/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQuickView>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QQuickView view;
+
+ view.resize(500, 500);
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/examples/qt3d/compute-particles/main.qml b/examples/qt3d/compute-particles/main.qml
new file mode 100644
index 000000000..de5666fad
--- /dev/null
+++ b/examples/qt3d/compute-particles/main.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Scene3D 2.0
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.1
+
+Item {
+
+ Scene3D {
+ anchors.fill: parent
+ aspects: "input"
+ ParticlesScene {
+ id: scene
+ particleStep: stepSlider.value
+ finalCollisionFactor: collisionSlider.value
+ }
+ }
+
+ ColumnLayout {
+ id: colorLayout
+ anchors.left: parent.left
+ anchors.leftMargin: 35
+ anchors.right: parent.right
+ anchors.rightMargin: 35
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 35
+ spacing: 15
+
+ RowLayout {
+ Text {
+ text: "Particles Step:"
+ color: "white"
+ }
+ Slider {
+ height: 35
+ id: stepSlider
+ Layout.fillWidth: true
+ minimumValue: 0.0
+ maximumValue: 2
+ value: 0.4
+ }
+ }
+ RowLayout {
+ Text {
+ text: "Particles Collision:"
+ color: "white"
+ }
+ Slider {
+ height: 35
+ id: collisionSlider
+ Layout.fillWidth: true
+ minimumValue: 0.0
+ maximumValue: 2
+ value: 0.2
+ }
+ }
+ RowLayout {
+ Button {
+ text: "Reset Particles"
+ onClicked: scene.reset()
+ }
+ }
+ RowLayout {
+ Text {
+ text: "Particles Shape:"
+ color: "white"
+ }
+ ExclusiveGroup {
+ id: particlesTypeGroup
+ }
+ CheckBox {
+ text: "Sphere"
+ checked: true
+ exclusiveGroup: particlesTypeGroup
+ onClicked: scene.particlesShape = scene._SPHERE
+ }
+ CheckBox
+ { text: "Cube"
+ checked: false
+ exclusiveGroup: particlesTypeGroup
+ onClicked: scene.particlesShape = scene._CUBE
+ }
+ CheckBox {
+ text: "Cylinder"
+ checked: false
+ exclusiveGroup: particlesTypeGroup
+ onClicked: scene.particlesShape = scene._CYLINDER
+ }
+ CheckBox {
+ text: "Torus"
+ checked: false
+ exclusiveGroup: particlesTypeGroup
+ onClicked: scene.particlesShape = scene._TORUS
+ }
+ }
+ }
+}
diff --git a/examples/qt3d/compute-particles/particles.comp b/examples/qt3d/compute-particles/particles.comp
new file mode 100644
index 000000000..7feaf5fdd
--- /dev/null
+++ b/examples/qt3d/compute-particles/particles.comp
@@ -0,0 +1,41 @@
+#version 430 core
+
+uniform float particleStep;
+uniform float finalCollisionFactor;
+
+layout (local_size_x = 1024) in;
+
+struct ParticleData
+{
+ vec3 position;
+ vec3 direction;
+ vec3 color;
+};
+
+// Particles from previouse frame
+layout (std430, binding = 0) coherent buffer Particles
+{
+ ParticleData particles[];
+} data;
+
+void main(void)
+{
+ uint globalId = gl_GlobalInvocationID.x;
+
+ // Retrieve current particle from previous frame
+ ParticleData currentParticle = data.particles[globalId];
+
+ // New position = old position + distance traveled over step duration
+ currentParticle.position = currentParticle.position + currentParticle.direction * particleStep;
+
+ // Make acceleration more or less point toward the center of the scene
+ vec3 acceleration = normalize(vec3(0.0) - currentParticle.position) * finalCollisionFactor;
+
+ // New velocity = old velocity + acceleration over step duration
+ currentParticle.direction = currentParticle.direction + acceleration * particleStep;
+
+
+
+ // Save updated particle
+ data.particles[globalId] = currentParticle;
+}
diff --git a/examples/qt3d/compute-particles/particles.frag b/examples/qt3d/compute-particles/particles.frag
new file mode 100644
index 000000000..3f11b9868
--- /dev/null
+++ b/examples/qt3d/compute-particles/particles.frag
@@ -0,0 +1,33 @@
+#version 430 core
+
+out vec4 color;
+
+in VertexBlock
+{
+ flat vec3 color;
+ vec3 pos;
+ vec3 normal;
+} frag_in;
+
+const vec4 lightPosition = vec4(0.0, 0.0, 0.0, 0.0);
+const vec3 lightIntensity = vec3(1.0, 1.0, 1.0);
+const vec3 ka = vec3(0.1, 0.1, 0.1);
+const vec3 ks = vec3(0.8, 0.8, 0.8);
+const float shininess = 50.0;
+
+vec3 ads()
+{
+ vec3 n = normalize( frag_in.normal);
+ vec3 s = normalize( vec3(lightPosition) - frag_in.pos );
+ vec3 v = normalize( -frag_in.pos );
+ vec3 h = normalize( v + s );
+ return lightIntensity * (ka +
+ frag_in.color * max( dot(s, frag_in.normal ), 0.0 ) +
+ ks * pow( max( dot( h, n ), 0.0 ), shininess ) );
+}
+
+
+void main(void)
+{
+ color = vec4(ads(), 1.0);
+}
diff --git a/examples/qt3d/compute-particles/particles.vert b/examples/qt3d/compute-particles/particles.vert
new file mode 100644
index 000000000..5f2da2a00
--- /dev/null
+++ b/examples/qt3d/compute-particles/particles.vert
@@ -0,0 +1,27 @@
+#version 430 core
+
+in vec3 vertexPosition;
+in vec3 vertexNormal;
+
+in vec3 particlePosition;
+in vec3 particleColor;
+
+out VertexBlock
+{
+ flat vec3 color;
+ vec3 pos;
+ vec3 normal;
+} v_out;
+
+uniform mat4 mvp;
+uniform mat3 modelViewNormal;
+uniform mat4 modelView;
+
+void main(void)
+{
+ vec4 pos = vec4(vertexPosition.xyz, 1.0) + vec4(particlePosition, 0.0);
+ gl_Position = mvp * pos;
+ v_out.pos = vec4(modelView * pos).xyz;
+ v_out.normal = normalize(modelViewNormal * vertexNormal);
+ v_out.color = mix(particleColor * 0.2, particleColor, smoothstep(0.5, 0.8, abs(v_out.normal).z));
+}
diff --git a/examples/qt3d/controls/Logo.qml b/examples/qt3d/controls/Logo.qml
index dbf9d3415..a686e29bd 100644
--- a/examples/qt3d/controls/Logo.qml
+++ b/examples/qt3d/controls/Logo.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,6 +51,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
import QtQuick 2.0
+import Qt3D.Extras 2.0
Entity {
id: sceneRoot
@@ -53,12 +68,8 @@ Entity {
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
- Configuration {
- controlledCamera: camera
- }
-
components: [
- FrameGraph {
+ RenderSettings {
activeFrameGraph: ForwardRenderer {
camera: camera
clearColor: "white"
diff --git a/examples/qt3d/controls/Qt_logo.obj b/examples/qt3d/controls/Qt_logo.obj
index 064d9653c..71f566661 100644
--- a/examples/qt3d/controls/Qt_logo.obj
+++ b/examples/qt3d/controls/Qt_logo.obj
@@ -1,4044 +1,4071 @@
-# Blender v2.73 (sub 0) OBJ File: 'Qt_Logo_cutout2.blend'
+# Blender v2.76 (sub 0) OBJ File: 'Qt_Logo_cutout2.blend'
# www.blender.org
-mtllib Qt_Logo_cutout3.mtl
-o Curve.003_path34
-v 0.138516 0.000000 1.118892
-v 0.141317 0.000000 1.119183
-v 0.144144 0.000000 1.119445
-v 0.146999 0.000000 1.119678
-v 0.149884 0.000000 1.119884
-v 0.152797 0.000000 1.120063
-v 0.155742 0.000000 1.120215
-v 0.158718 0.000000 1.120341
-v 0.161726 0.000000 1.120443
-v 0.164767 0.000000 1.120521
-v 0.167842 0.000000 1.120576
-v 0.170952 0.000000 1.120608
-v 0.174098 0.000000 1.120619
-v 0.178149 0.000000 1.120551
-v 0.182248 0.000000 1.120363
-v 0.186394 0.000000 1.120079
-v 0.190587 0.000000 1.119724
-v 0.194828 0.000000 1.119320
-v 0.199116 0.000000 1.118892
-v 0.203452 0.000000 1.118464
-v 0.207836 0.000000 1.118061
-v 0.212268 0.000000 1.117705
-v 0.216748 0.000000 1.117421
-v 0.221277 0.000000 1.117233
-v 0.225853 0.000000 1.117165
-v 0.224591 0.000000 1.117165
-v 0.221022 0.000000 1.117165
-v 0.215477 0.000000 1.117165
-v 0.208284 0.000000 1.117165
-v 0.199774 0.000000 1.117165
-v 0.190275 0.000000 1.117165
-v 0.180118 0.000000 1.117165
-v 0.169632 0.000000 1.117165
-v 0.159145 0.000000 1.117165
-v 0.148988 0.000000 1.117165
-v 0.139489 0.000000 1.117165
-v 0.130979 0.000000 1.117165
-v 0.131158 0.000000 1.117179
-v 0.131333 0.000000 1.117217
-v 0.131506 0.000000 1.117275
-v 0.131677 0.000000 1.117349
-v 0.131847 0.000000 1.117434
-v 0.132015 0.000000 1.117526
-v 0.132185 0.000000 1.117621
-v 0.132354 0.000000 1.117714
-v 0.132525 0.000000 1.117801
-v 0.132698 0.000000 1.117877
-v 0.132873 0.000000 1.117939
-v 0.133052 0.000000 1.117981
-v 0.133501 0.000000 1.118049
-v 0.133954 0.000000 1.118123
-v 0.134409 0.000000 1.118203
-v 0.134866 0.000000 1.118287
-v 0.135325 0.000000 1.118374
-v 0.135784 0.000000 1.118460
-v 0.136243 0.000000 1.118546
-v 0.136702 0.000000 1.118628
-v 0.137159 0.000000 1.118706
-v 0.137614 0.000000 1.118777
-v 0.138067 0.000000 1.118839
-vn 0.000000 1.000000 0.000000
-usemtl SVGMat.004
-s off
-f 38//1 36//1 37//1
-f 38//1 35//1 36//1
-f 38//1 34//1 35//1
-f 38//1 33//1 34//1
-f 38//1 32//1 33//1
-f 38//1 31//1 32//1
-f 38//1 30//1 31//1
-f 38//1 29//1 30//1
-f 38//1 28//1 29//1
-f 38//1 27//1 28//1
-f 38//1 26//1 27//1
-f 38//1 25//1 26//1
-f 38//1 24//1 25//1
-f 39//1 24//1 38//1
-f 40//1 24//1 39//1
-f 40//1 23//1 24//1
-f 41//1 23//1 40//1
-f 42//1 23//1 41//1
-f 42//1 22//1 23//1
-f 43//1 22//1 42//1
-f 44//1 22//1 43//1
-f 45//1 22//1 44//1
-f 45//1 21//1 22//1
-f 46//1 21//1 45//1
-f 47//1 21//1 46//1
-f 48//1 21//1 47//1
-f 49//1 21//1 48//1
-f 50//1 21//1 49//1
-f 51//1 21//1 50//1
-f 51//1 20//1 21//1
-f 52//1 20//1 51//1
-f 53//1 20//1 52//1
-f 54//1 20//1 53//1
-f 55//1 20//1 54//1
-f 56//1 20//1 55//1
-f 56//1 19//1 20//1
-f 57//1 19//1 56//1
-f 58//1 19//1 57//1
-f 59//1 19//1 58//1
-f 60//1 19//1 59//1
-f 1//1 19//1 60//1
-f 2//1 19//1 1//1
-f 2//1 18//1 19//1
-f 3//1 18//1 2//1
-f 3//1 17//1 18//1
-f 4//1 17//1 3//1
-f 5//1 17//1 4//1
-f 5//1 16//1 17//1
-f 6//1 16//1 5//1
-f 7//1 16//1 6//1
-f 7//1 15//1 16//1
-f 8//1 15//1 7//1
-f 9//1 15//1 8//1
-f 9//1 14//1 15//1
-f 10//1 14//1 9//1
-f 11//1 14//1 10//1
-f 11//1 13//1 14//1
-f 12//1 13//1 11//1
+mtllib Qt_logo.mtl
o Curve.001_Mesh
-v 1.604945 -0.182387 1.374372
-v 1.624641 -0.182387 1.318420
-v 1.624641 0.182387 1.318420
-v 1.604945 0.182387 1.374372
-v 1.580433 -0.182387 1.427071
-v 1.580433 0.182387 1.427071
-v -0.847648 -0.182387 0.720939
-v -0.822076 -0.182387 0.768036
-v -0.794690 -0.182387 0.811855
-v -0.765502 -0.182387 0.852402
-v -0.734525 -0.182387 0.889683
-v -0.701772 -0.182387 0.923703
-v -0.667254 -0.182387 0.954468
-v -0.630985 -0.182387 0.981984
-v -0.592977 -0.182387 1.006257
-v -0.553243 -0.182387 1.027292
-v -0.511795 -0.182387 1.045095
-v -0.468646 -0.182387 1.059673
-v -0.423807 -0.182387 1.071030
-v -0.413388 -0.182387 1.117919
-v -0.402043 -0.182387 1.162206
-v -0.389771 -0.182387 1.203891
-v -0.376574 -0.182387 1.242972
-v -0.362454 -0.182387 1.279447
-v -0.347411 -0.182387 1.313315
-v -0.331446 -0.182387 1.344574
-v -0.314560 -0.182387 1.373223
-v -0.296754 -0.182387 1.399261
-v -0.278030 -0.182387 1.422685
-v -0.258387 -0.182387 1.443494
-v -0.237828 -0.182387 1.461687
-v -0.221488 -0.182387 1.473931
-v -0.204283 -0.182387 1.485104
-v -0.186216 -0.182387 1.495208
-v -0.167291 -0.182387 1.504244
-v -0.147509 -0.182387 1.512212
-v -0.126874 -0.182387 1.519115
-v -0.105388 -0.182387 1.524953
-v -0.083055 -0.182387 1.529726
-v -0.059876 -0.182387 1.533437
-v -0.035856 -0.182387 1.536087
-v -0.010996 -0.182387 1.537676
-v 0.014699 -0.182387 1.538205
-v 1.304468 -0.182387 1.652686
-v -1.543393 -0.182387 2.132013
-v -1.543393 -0.182387 1.802300
-v -1.543393 -0.182387 1.434298
-v -1.543393 -0.182387 1.040770
-v -1.543393 -0.182387 0.634479
-v -1.543393 -0.182387 0.228187
-v -1.543393 -0.182387 -0.165341
-v -1.543393 -0.182387 -0.533343
-v -1.543393 -0.182387 -0.863055
-v -1.543393 -0.182387 -1.141716
-v -1.543393 -0.182387 -1.356561
-v -1.543393 -0.182387 -1.494827
-v -1.543393 -0.182387 -1.543752
-v -1.538053 -0.182387 -1.625037
-v -1.522528 -0.182387 -1.701349
-v -1.497558 -0.182387 -1.772077
-v -1.463884 -0.182387 -1.836608
-v -1.422248 -0.182387 -1.894331
-v -1.373390 -0.182387 -1.944634
-v -1.318050 -0.182387 -1.986905
-v -1.256971 -0.182387 -2.020532
-v -1.190891 -0.182387 -2.044903
-v -1.120553 -0.182387 -2.059406
-v -1.046697 -0.182387 -2.063429
-v -0.970064 -0.182387 -2.056361
-v -0.935175 -0.182387 -2.050632
-v -0.836574 -0.182387 -2.034443
-v -0.043291 -0.182387 -1.245338
-v -0.096284 -0.182387 -1.261074
-v -0.151985 -0.182387 -1.273272
-v -0.210411 -0.182387 -1.281925
-v -0.219049 -0.182387 -1.282895
-v -0.227645 -0.182387 -1.283780
-v -0.236197 -0.182387 -1.284580
-v -0.244706 -0.182387 -1.285296
-v -0.253173 -0.182387 -1.285927
-v -0.261597 -0.182387 -1.286474
-v -0.269979 -0.182387 -1.286936
-v -0.278318 -0.182387 -1.287314
-v -0.286614 -0.182387 -1.287608
-v -0.294869 -0.182387 -1.287817
-v -0.303082 -0.182387 -1.287943
-v -0.311252 -0.182387 -1.287985
-v -0.361180 -0.182387 -1.286331
-v -0.409360 -0.182387 -1.281363
-v -0.455776 -0.182387 -1.273071
-v -0.500415 -0.182387 -1.261445
-v -0.543260 -0.182387 -1.246475
-v -0.584298 -0.182387 -1.228152
-v -0.623514 -0.182387 -1.206466
-v -0.660894 -0.182387 -1.181408
-v -0.696421 -0.182387 -1.152968
-v -0.730083 -0.182387 -1.121135
-v -0.761863 -0.182387 -1.085901
-v -0.791747 -0.182387 -1.047255
-v -0.824643 -0.182387 -0.997153
-v -0.854719 -0.182387 -0.942465
-v -0.881969 -0.182387 -0.883201
-v -0.906384 -0.182387 -0.819374
-v -0.927957 -0.182387 -0.750994
-v -0.946680 -0.182387 -0.678073
-v -0.962543 -0.182387 -0.600624
-v -0.975540 -0.182387 -0.518656
-v -0.985663 -0.182387 -0.432183
-v -0.992904 -0.182387 -0.341214
-v -0.997254 -0.182387 -0.245763
-v -0.998706 -0.182387 -0.145841
-v -0.997645 -0.182387 -0.052952
-v -0.994467 -0.182387 0.036208
-v -0.989178 -0.182387 0.121631
-v -0.981784 -0.182387 0.203307
-v -0.972293 -0.182387 0.281231
-v -0.960710 -0.182387 0.355393
-v -0.947042 -0.182387 0.425786
-v -0.931295 -0.182387 0.492402
-v -0.913475 -0.182387 0.555233
-v -0.893590 -0.182387 0.614272
-v -0.871646 -0.182387 0.669510
-v -0.016169 -0.182387 1.061018
-v -0.020694 -0.182387 1.039381
-v 0.021314 -0.182387 1.023258
-v 0.061404 -0.182387 1.004298
-v 0.099588 -0.182387 0.982504
-v 0.135875 -0.182387 0.957879
-v 0.170275 -0.182387 0.930427
-v 0.202799 -0.182387 0.900153
-v 0.233457 -0.182387 0.867059
-v 0.262260 -0.182387 0.831150
-v 0.289217 -0.182387 0.792428
-v 0.314338 -0.182387 0.750899
-v 0.337635 -0.182387 0.706565
-v 0.359117 -0.182387 0.659430
-v 0.378490 -0.182387 0.610163
-v 0.396163 -0.182387 0.558060
-v 0.412138 -0.182387 0.503110
-v 0.426419 -0.182387 0.445305
-v 0.439008 -0.182387 0.384638
-v 0.449909 -0.182387 0.321098
-v 0.459124 -0.182387 0.254677
-v 0.466657 -0.182387 0.185367
-v 0.472510 -0.182387 0.113159
-v 0.476688 -0.182387 0.038043
-v 0.479192 -0.182387 -0.039988
-v 0.480026 -0.182387 -0.120943
-v 0.478892 -0.182387 -0.209136
-v 0.475486 -0.182387 -0.293762
-v 0.469801 -0.182387 -0.374832
-v 0.461829 -0.182387 -0.452356
-v 0.451565 -0.182387 -0.526344
-v 0.438999 -0.182387 -0.596807
-v 0.424126 -0.182387 -0.663755
-v 0.406938 -0.182387 -0.727197
-v 0.387429 -0.182387 -0.787144
-v 0.365590 -0.182387 -0.843607
-v 0.341416 -0.182387 -0.896596
-v 0.314899 -0.182387 -0.946121
-v 0.285433 -0.182387 -0.993262
-v 0.253428 -0.182387 -1.036951
-v 0.218864 -0.182387 -1.077179
-v 0.181722 -0.182387 -1.113937
-v 0.141985 -0.182387 -1.147215
-v 0.099634 -0.182387 -1.177004
-v 0.054650 -0.182387 -1.203293
-v 0.007014 -0.182387 -1.226074
-v -0.683363 -0.182387 -2.009288
-v -0.484644 -0.182387 -1.976661
-v -0.249518 -0.182387 -1.938057
-v 0.012913 -0.182387 -1.894969
-v 0.293547 -0.182387 -1.848894
-v 0.583283 -0.182387 -1.801322
-v 0.873018 -0.182387 -1.753752
-v 1.153652 -0.182387 -1.707676
-v 1.416083 -0.182387 -1.664589
-v 1.651209 -0.182387 -1.625984
-v 1.651209 -0.182387 -1.378124
-v 1.651209 -0.182387 -1.101481
-v 1.290285 -0.182387 0.655661
-v 1.290285 -0.182387 0.632343
-v 1.290285 -0.182387 0.611451
-v 1.276783 -0.182387 0.618072
-v 1.263028 -0.182387 0.624200
-v 1.249080 -0.182387 0.629828
-v 1.235000 -0.182387 0.634956
-v 1.220848 -0.182387 0.639580
-v 1.206685 -0.182387 0.643697
-v 1.192572 -0.182387 0.647303
-v 1.178569 -0.182387 0.650396
-v 1.164738 -0.182387 0.652973
-v 1.151138 -0.182387 0.655030
-v 1.137830 -0.182387 0.656565
-v 1.124875 -0.182387 0.657574
-v 1.124058 -0.182387 0.657620
-v 1.123296 -0.182387 0.657663
-v 1.122580 -0.182387 0.657703
-v 1.121898 -0.182387 0.657740
-v 1.121240 -0.182387 0.657773
-v 1.120596 -0.182387 0.657802
-v 1.119957 -0.182387 0.657828
-v 1.119311 -0.182387 0.657849
-v 1.118648 -0.182387 0.657866
-v 1.117959 -0.182387 0.657879
-v 1.117232 -0.182387 0.657886
-v 1.116459 -0.182387 0.657889
-v 1.108379 -0.182387 0.657669
-v 1.100785 -0.182387 0.657008
-v 1.093652 -0.182387 0.655907
-v 1.086952 -0.182387 0.654363
-v 1.080662 -0.182387 0.652376
-v 1.074757 -0.182387 0.649945
-v 1.069211 -0.182387 0.647069
-v 1.063999 -0.182387 0.643748
-v 1.059095 -0.182387 0.639980
-v 1.054475 -0.182387 0.635764
-v 1.050114 -0.182387 0.631101
-v 1.045986 -0.182387 0.625988
-v 1.041773 -0.182387 0.619568
-v 1.038066 -0.182387 0.611957
-v 1.034837 -0.182387 0.603155
-v 1.032062 -0.182387 0.593160
-v 1.029713 -0.182387 0.581973
-v 1.027764 -0.182387 0.569593
-v 1.026187 -0.182387 0.556018
-v 1.024956 -0.182387 0.541250
-v 1.024046 -0.182387 0.525286
-v 1.023428 -0.182387 0.508127
-v 1.023077 -0.182387 0.489772
-v 1.022966 -0.182387 0.470221
-v 1.022966 -0.182387 0.457888
-v 1.022966 -0.182387 0.423033
-v 1.022966 -0.182387 0.368875
-v 1.022966 -0.182387 0.298629
-v 1.022966 -0.182387 0.215515
-v 1.022966 -0.182387 0.122748
-v 1.022966 -0.182387 0.023547
-v 1.022966 -0.182387 -0.078872
-v 1.022966 -0.182387 -0.181290
-v 1.022966 -0.182387 -0.280492
-v 1.022966 -0.182387 -0.373259
-v 1.022966 -0.182387 -0.456373
-v 1.263622 -0.182387 -0.444411
-v 1.263622 -0.182387 -0.697952
-v 1.022966 -0.182387 -0.716351
-v 1.022966 -0.182387 -1.120478
-v 0.788843 -0.182387 -1.145252
-v 0.693403 -0.182387 -0.739209
-v 0.541780 -0.182387 -0.750073
-v 0.541780 -0.182387 -0.478384
-v 0.648683 -0.182387 -0.472763
-v 0.648683 -0.182387 0.554368
-v 0.649385 -0.182387 0.587227
-v 0.651461 -0.182387 0.618561
-v 0.654864 -0.182387 0.648369
-v 0.659545 -0.182387 0.676652
-v 0.665458 -0.182387 0.703407
-v 0.672554 -0.182387 0.728633
-v 0.680787 -0.182387 0.752329
-v 0.690109 -0.182387 0.774494
-v 0.700473 -0.182387 0.795126
-v 0.711830 -0.182387 0.814225
-v 0.724135 -0.182387 0.831789
-v 0.737338 -0.182387 0.847817
-v 0.749557 -0.182387 0.860433
-v 0.762797 -0.182387 0.871939
-v 0.777034 -0.182387 0.882338
-v 0.792240 -0.182387 0.891632
-v 0.808392 -0.182387 0.899824
-v 0.825461 -0.182387 0.906916
-v 0.843423 -0.182387 0.912910
-v 0.862251 -0.182387 0.917809
-v 0.881920 -0.182387 0.921615
-v 0.902404 -0.182387 0.924331
-v 0.923676 -0.182387 0.925959
-v 0.945710 -0.182387 0.926501
-v 1.651209 -0.182387 0.996532
-v 1.651209 -0.182387 1.100473
-v 1.651209 -0.182387 1.137252
-v 1.648136 -0.182387 1.199239
-v 1.639159 -0.182387 1.259835
-v 1.551467 -0.182387 1.475895
-v 1.518411 -0.182387 1.520223
-v 1.481627 -0.182387 1.559434
-v 1.441478 -0.182387 1.592906
-v 1.398327 -0.182387 1.620021
-v 1.352536 -0.182387 1.640154
-v 0.022624 -0.182387 1.538157
-v 0.030633 -0.182387 1.538012
-v 0.038723 -0.182387 1.537771
-v 0.046893 -0.182387 1.537434
-v 0.055141 -0.182387 1.537002
-v 0.063467 -0.182387 1.536474
-v 0.071868 -0.182387 1.535852
-v 0.080342 -0.182387 1.535135
-v 0.088889 -0.182387 1.534324
-v 0.097506 -0.182387 1.533419
-v 0.106191 -0.182387 1.532421
-v 0.114944 -0.182387 1.531329
-v 0.116533 -0.182387 1.531121
-v 0.121026 -0.182387 1.530532
-v 0.128007 -0.182387 1.529619
-v 0.137061 -0.182387 1.528433
-v 0.147774 -0.182387 1.527030
-v 0.159731 -0.182387 1.525465
-v 0.172517 -0.182387 1.523791
-v 0.185719 -0.182387 1.522063
-v 0.198920 -0.182387 1.520334
-v 0.211706 -0.182387 1.518660
-v 0.223663 -0.182387 1.517095
-v 0.234377 -0.182387 1.515692
-v 0.234377 -0.182387 1.253171
-v 0.228073 -0.182387 1.253593
-v 0.222476 -0.182387 1.253840
-v 0.217488 -0.182387 1.253938
-v 0.213012 -0.182387 1.253913
-v 0.208952 -0.182387 1.253793
-v 0.205209 -0.182387 1.253603
-v 0.201688 -0.182387 1.253370
-v 0.198291 -0.182387 1.253120
-v 0.194921 -0.182387 1.252880
-v 0.191482 -0.182387 1.252676
-v 0.187874 -0.182387 1.252534
-v 0.184003 -0.182387 1.252481
-v 0.183991 -0.182387 1.252481
-v 0.183957 -0.182387 1.252481
-v 0.183904 -0.182387 1.252481
-v 0.183835 -0.182387 1.252481
-v 0.183753 -0.182387 1.252481
-v 0.183662 -0.182387 1.252481
-v 0.183564 -0.182387 1.252481
-v 0.183463 -0.182387 1.252481
-v 0.183363 -0.182387 1.252481
-v 0.183265 -0.182387 1.252481
-v 0.183174 -0.182387 1.252481
-v 0.183092 -0.182387 1.252481
-v 0.179940 -0.182387 1.252501
-v 0.176810 -0.182387 1.252554
-v 0.173706 -0.182387 1.252628
-v 0.170627 -0.182387 1.252712
-v 0.167575 -0.182387 1.252794
-v 0.164552 -0.182387 1.252862
-v 0.161558 -0.182387 1.252904
-v 0.158594 -0.182387 1.252909
-v 0.155663 -0.182387 1.252865
-v 0.152764 -0.182387 1.252761
-v 0.149900 -0.182387 1.252584
-v 0.147071 -0.182387 1.252324
-v 0.146610 -0.182387 1.252296
-v 0.146139 -0.182387 1.252301
-v 0.145661 -0.182387 1.252334
-v 0.145176 -0.182387 1.252385
-v 0.144688 -0.182387 1.252450
-v 0.144198 -0.182387 1.252520
-v 0.143707 -0.182387 1.252589
-v 0.143219 -0.182387 1.252649
-v 0.142734 -0.182387 1.252694
-v 0.142256 -0.182387 1.252718
-v 0.141785 -0.182387 1.252711
-v 0.141324 -0.182387 1.252669
-v 0.141137 -0.182387 1.252646
-v 0.140954 -0.182387 1.252639
-v 0.140774 -0.182387 1.252644
-v 0.140597 -0.182387 1.252657
-v 0.140422 -0.182387 1.252678
-v 0.140248 -0.182387 1.252701
-v 0.140076 -0.182387 1.252724
-v 0.139905 -0.182387 1.252744
-v 0.139734 -0.182387 1.252757
-v 0.139563 -0.182387 1.252762
-v 0.139392 -0.182387 1.252755
-v 0.139220 -0.182387 1.252732
-v 0.130740 -0.182387 1.251386
-v 0.122558 -0.182387 1.249797
-v 0.114677 -0.182387 1.247959
-v 0.107101 -0.182387 1.245871
-v 0.099831 -0.182387 1.243528
-v 0.092870 -0.182387 1.240926
-v 0.086222 -0.182387 1.238063
-v 0.079888 -0.182387 1.234935
-v 0.073872 -0.182387 1.231538
-v 0.068176 -0.182387 1.227869
-v 0.062803 -0.182387 1.223925
-v 0.057755 -0.182387 1.219701
-v 0.049214 -0.182387 1.211217
-v 0.041036 -0.182387 1.201556
-v 0.033220 -0.182387 1.190714
-v 0.025769 -0.182387 1.178687
-v 0.018682 -0.182387 1.165471
-v 0.011959 -0.182387 1.151064
-v 0.005602 -0.182387 1.135461
-v -0.000390 -0.182387 1.118659
-v -0.006016 -0.182387 1.100653
-v -0.011276 -0.182387 1.081441
-v 1.639159 0.182387 1.259835
-v -0.016169 0.182387 1.061018
-v -0.011276 0.182387 1.081441
-v -0.006016 0.182387 1.100653
-v -0.000390 0.182387 1.118659
-v 0.005602 0.182387 1.135461
-v 0.011959 0.182387 1.151064
-v 0.018682 0.182387 1.165471
-v 0.025769 0.182387 1.178687
-v 0.033220 0.182387 1.190714
-v 0.041036 0.182387 1.201556
-v 0.049214 0.182387 1.211217
-v 0.057755 0.182387 1.219701
-v 0.062803 0.182387 1.223925
-v 0.068176 0.182387 1.227869
-v 0.073872 0.182387 1.231538
-v 0.079888 0.182387 1.234935
-v 0.086222 0.182387 1.238063
-v 0.092870 0.182387 1.240926
-v 0.099831 0.182387 1.243528
-v 0.107101 0.182387 1.245871
-v 0.114677 0.182387 1.247959
-v 0.122558 0.182387 1.249797
-v 0.130740 0.182387 1.251386
-v 0.139220 0.182387 1.252732
-v 0.139392 0.182387 1.252755
-v 0.139563 0.182387 1.252762
-v 0.139734 0.182387 1.252757
-v 0.139905 0.182387 1.252744
-v 0.140076 0.182387 1.252724
-v 0.140248 0.182387 1.252701
-v 0.140422 0.182387 1.252678
-v 0.140597 0.182387 1.252657
-v 0.140774 0.182387 1.252644
-v 0.140954 0.182387 1.252639
-v 0.141137 0.182387 1.252646
-v 0.141324 0.182387 1.252669
-v 0.141785 0.182387 1.252711
-v 0.142256 0.182387 1.252718
-v 0.142734 0.182387 1.252694
-v 0.143219 0.182387 1.252649
-v 0.143707 0.182387 1.252589
-v 0.144198 0.182387 1.252520
-v 0.144688 0.182387 1.252450
-v 0.145176 0.182387 1.252385
-v 0.145661 0.182387 1.252334
-v 0.146139 0.182387 1.252301
-v 0.146610 0.182387 1.252296
-v 0.147071 0.182387 1.252324
-v 0.149900 0.182387 1.252584
-v 0.152764 0.182387 1.252761
-v 0.155663 0.182387 1.252865
-v 0.158594 0.182387 1.252909
-v 0.161558 0.182387 1.252904
-v 0.164552 0.182387 1.252862
-v 0.167575 0.182387 1.252794
-v 0.170627 0.182387 1.252712
-v 0.173706 0.182387 1.252628
-v 0.176810 0.182387 1.252554
-v 0.179940 0.182387 1.252501
-v 0.183092 0.182387 1.252481
-v 0.183174 0.182387 1.252481
-v 0.183265 0.182387 1.252481
-v 0.183363 0.182387 1.252481
-v 0.183463 0.182387 1.252481
-v 0.183564 0.182387 1.252481
-v 0.183662 0.182387 1.252481
-v 0.183753 0.182387 1.252481
-v 0.183835 0.182387 1.252481
-v 0.183904 0.182387 1.252481
-v 0.183957 0.182387 1.252481
-v 0.183991 0.182387 1.252481
-v 0.184003 0.182387 1.252481
-v 0.187874 0.182387 1.252534
-v 0.191482 0.182387 1.252676
-v 0.194921 0.182387 1.252880
-v 0.198291 0.182387 1.253120
-v 0.201688 0.182387 1.253370
-v 0.205209 0.182387 1.253603
-v 0.208952 0.182387 1.253793
-v 0.213012 0.182387 1.253913
-v 0.217488 0.182387 1.253938
-v 0.222476 0.182387 1.253840
-v 0.228073 0.182387 1.253593
-v 0.234377 0.182387 1.253171
-v 0.234377 0.182387 1.515692
-v 0.223663 0.182387 1.517095
-v 0.211706 0.182387 1.518660
-v 0.198920 0.182387 1.520334
-v 0.185719 0.182387 1.522063
-v 0.172517 0.182387 1.523791
-v 0.159731 0.182387 1.525465
-v 0.147774 0.182387 1.527030
-v 0.137061 0.182387 1.528433
-v 0.128007 0.182387 1.529619
-v 0.121026 0.182387 1.530532
-v 0.116533 0.182387 1.531121
-v 0.114944 0.182387 1.531329
-v 0.106191 0.182387 1.532421
-v 0.097506 0.182387 1.533419
-v 0.088889 0.182387 1.534324
-v 0.080342 0.182387 1.535135
-v 0.071868 0.182387 1.535852
-v 0.063467 0.182387 1.536474
-v 0.055141 0.182387 1.537002
-v 0.046893 0.182387 1.537434
-v 0.038723 0.182387 1.537771
-v 0.030633 0.182387 1.538012
-v 0.022624 0.182387 1.538157
-v 0.014699 0.182387 1.538205
-v 1.304468 0.182387 1.652686
-v 1.352536 0.182387 1.640154
-v 1.398327 0.182387 1.620021
-v 1.441478 0.182387 1.592906
-v 1.481627 0.182387 1.559434
-v 1.518411 0.182387 1.520223
-v 1.551467 0.182387 1.475895
-v 1.648136 0.182387 1.199239
-v 1.651209 0.182387 1.137252
-v 1.651209 0.182387 1.100473
-v 1.651209 0.182387 0.996532
-v 0.945710 0.182387 0.926501
-v 0.923676 0.182387 0.925959
-v 0.902404 0.182387 0.924331
-v 0.881920 0.182387 0.921615
-v 0.862251 0.182387 0.917809
-v 0.843423 0.182387 0.912910
-v 0.825461 0.182387 0.906916
-v 0.808392 0.182387 0.899824
-v 0.792240 0.182387 0.891632
-v 0.777034 0.182387 0.882338
-v 0.762797 0.182387 0.871939
-v 0.749557 0.182387 0.860433
-v 0.737338 0.182387 0.847817
-v 0.724135 0.182387 0.831789
-v 0.711830 0.182387 0.814225
-v 0.700473 0.182387 0.795126
-v 0.690109 0.182387 0.774494
-v 0.680787 0.182387 0.752329
-v 0.672554 0.182387 0.728633
-v 0.665458 0.182387 0.703407
-v 0.659545 0.182387 0.676652
-v 0.654864 0.182387 0.648369
-v 0.651461 0.182387 0.618561
-v 0.649385 0.182387 0.587227
-v 0.648683 0.182387 0.554368
-v 0.648683 0.182387 -0.472763
-v 0.541780 0.182387 -0.478384
-v 0.541780 0.182387 -0.750073
-v 0.693403 0.182387 -0.739209
-v 0.788843 0.182387 -1.145252
-v 1.022966 0.182387 -1.120478
-v 1.022966 0.182387 -0.716351
-v 1.263622 0.182387 -0.697952
-v 1.263622 0.182387 -0.444411
-v 1.022966 0.182387 -0.456373
-v 1.022966 0.182387 -0.373259
-v 1.022966 0.182387 -0.280492
-v 1.022966 0.182387 -0.181290
-v 1.022966 0.182387 -0.078872
-v 1.022966 0.182387 0.023547
-v 1.022966 0.182387 0.122748
-v 1.022966 0.182387 0.215515
-v 1.022966 0.182387 0.298629
-v 1.022966 0.182387 0.368875
-v 1.022966 0.182387 0.423033
-v 1.022966 0.182387 0.457888
-v 1.022966 0.182387 0.470221
-v 1.023077 0.182387 0.489772
-v 1.023428 0.182387 0.508127
-v 1.024046 0.182387 0.525286
-v 1.024956 0.182387 0.541250
-v 1.026187 0.182387 0.556018
-v 1.027764 0.182387 0.569593
-v 1.029713 0.182387 0.581973
-v 1.032062 0.182387 0.593160
-v 1.034837 0.182387 0.603155
-v 1.038066 0.182387 0.611957
-v 1.041773 0.182387 0.619568
-v 1.045986 0.182387 0.625988
-v 1.050114 0.182387 0.631101
-v 1.054475 0.182387 0.635764
-v 1.059095 0.182387 0.639980
-v 1.063999 0.182387 0.643748
-v 1.069211 0.182387 0.647069
-v 1.074757 0.182387 0.649945
-v 1.080662 0.182387 0.652376
-v 1.086952 0.182387 0.654363
-v 1.093652 0.182387 0.655907
-v 1.100785 0.182387 0.657008
-v 1.108379 0.182387 0.657669
-v 1.116459 0.182387 0.657889
-v 1.117232 0.182387 0.657886
-v 1.117959 0.182387 0.657879
-v 1.118648 0.182387 0.657866
-v 1.119311 0.182387 0.657849
-v 1.119957 0.182387 0.657828
-v 1.120596 0.182387 0.657802
-v 1.121240 0.182387 0.657773
-v 1.121898 0.182387 0.657740
-v 1.122580 0.182387 0.657703
-v 1.123296 0.182387 0.657663
-v 1.124058 0.182387 0.657620
-v 1.124875 0.182387 0.657574
-v 1.137830 0.182387 0.656565
-v 1.151138 0.182387 0.655030
-v 1.164738 0.182387 0.652973
-v 1.178569 0.182387 0.650396
-v 1.192572 0.182387 0.647303
-v 1.206685 0.182387 0.643697
-v 1.220848 0.182387 0.639580
-v 1.235000 0.182387 0.634956
-v 1.249080 0.182387 0.629828
-v 1.263028 0.182387 0.624200
-v 1.276783 0.182387 0.618072
-v 1.290285 0.182387 0.611451
-v 1.290285 0.182387 0.632343
-v 1.290285 0.182387 0.655661
-v 1.651209 0.182387 -1.101481
-v 1.651209 0.182387 -1.378124
-v 1.651209 0.182387 -1.625984
-v 1.416083 0.182387 -1.664589
-v 1.153652 0.182387 -1.707676
-v 0.873018 0.182387 -1.753752
-v 0.583283 0.182387 -1.801322
-v 0.293547 0.182387 -1.848894
-v 0.012913 0.182387 -1.894969
-v -0.249518 0.182387 -1.938057
-v -0.484644 0.182387 -1.976661
-v -0.683363 0.182387 -2.009288
-v -0.836574 0.182387 -2.034443
-v 0.007014 0.182387 -1.226074
-v 0.054650 0.182387 -1.203293
-v 0.099634 0.182387 -1.177004
-v 0.141985 0.182387 -1.147215
-v 0.181722 0.182387 -1.113937
-v 0.218864 0.182387 -1.077179
-v 0.253428 0.182387 -1.036951
-v 0.285433 0.182387 -0.993262
-v 0.314899 0.182387 -0.946121
-v 0.341416 0.182387 -0.896596
-v 0.365590 0.182387 -0.843607
-v 0.387429 0.182387 -0.787144
-v 0.406938 0.182387 -0.727197
-v 0.424126 0.182387 -0.663755
-v 0.438999 0.182387 -0.596807
-v 0.451565 0.182387 -0.526344
-v 0.461829 0.182387 -0.452356
-v 0.469801 0.182387 -0.374832
-v 0.475486 0.182387 -0.293762
-v 0.478892 0.182387 -0.209136
-v 0.480026 0.182387 -0.120943
-v 0.479192 0.182387 -0.039988
-v 0.476688 0.182387 0.038043
-v 0.472510 0.182387 0.113159
-v 0.466657 0.182387 0.185367
-v 0.459124 0.182387 0.254677
-v 0.449909 0.182387 0.321098
-v 0.439008 0.182387 0.384638
-v 0.426419 0.182387 0.445305
-v 0.412138 0.182387 0.503110
-v 0.396163 0.182387 0.558060
-v 0.378490 0.182387 0.610163
-v 0.359117 0.182387 0.659430
-v 0.337635 0.182387 0.706565
-v 0.314338 0.182387 0.750899
-v 0.289217 0.182387 0.792428
-v 0.262260 0.182387 0.831150
-v 0.233457 0.182387 0.867059
-v 0.202799 0.182387 0.900153
-v 0.170275 0.182387 0.930427
-v 0.135875 0.182387 0.957879
-v 0.099588 0.182387 0.982504
-v 0.061404 0.182387 1.004298
-v 0.021314 0.182387 1.023258
-v -0.020694 0.182387 1.039381
-v -0.847648 0.182387 0.720939
-v -0.871646 0.182387 0.669510
-v -0.893590 0.182387 0.614272
-v -0.913475 0.182387 0.555233
-v -0.931295 0.182387 0.492402
-v -0.947042 0.182387 0.425786
-v -0.960710 0.182387 0.355393
-v -0.972293 0.182387 0.281231
-v -0.981784 0.182387 0.203307
-v -0.989178 0.182387 0.121631
-v -0.994467 0.182387 0.036208
-v -0.997645 0.182387 -0.052952
-v -0.998706 0.182387 -0.145841
-v -0.997254 0.182387 -0.245763
-v -0.992904 0.182387 -0.341214
-v -0.985663 0.182387 -0.432183
-v -0.975540 0.182387 -0.518656
-v -0.962543 0.182387 -0.600624
-v -0.946680 0.182387 -0.678073
-v -0.927957 0.182387 -0.750994
-v -0.906384 0.182387 -0.819374
-v -0.881969 0.182387 -0.883201
-v -0.854719 0.182387 -0.942465
-v -0.824643 0.182387 -0.997153
-v -0.791747 0.182387 -1.047255
-v -0.761863 0.182387 -1.085901
-v -0.730083 0.182387 -1.121135
-v -0.696421 0.182387 -1.152968
-v -0.660894 0.182387 -1.181408
-v -0.623514 0.182387 -1.206466
-v -0.584298 0.182387 -1.228152
-v -0.543260 0.182387 -1.246475
-v -0.500415 0.182387 -1.261445
-v -0.455776 0.182387 -1.273071
-v -0.409360 0.182387 -1.281363
-v -0.361180 0.182387 -1.286331
-v -0.311252 0.182387 -1.287985
-v -0.303082 0.182387 -1.287943
-v -0.294869 0.182387 -1.287817
-v -0.286614 0.182387 -1.287608
-v -0.278318 0.182387 -1.287314
-v -0.269979 0.182387 -1.286936
-v -0.261597 0.182387 -1.286474
-v -0.253173 0.182387 -1.285927
-v -0.244706 0.182387 -1.285296
-v -0.236197 0.182387 -1.284580
-v -0.227645 0.182387 -1.283780
-v -0.219049 0.182387 -1.282895
-v -0.210411 0.182387 -1.281925
-v -0.151985 0.182387 -1.273272
-v -0.096284 0.182387 -1.261074
-v -0.043291 0.182387 -1.245338
-v -0.935175 0.182387 -2.050632
-v -0.970064 0.182387 -2.056361
-v -1.046697 0.182387 -2.063429
-v -1.120553 0.182387 -2.059406
-v -1.190891 0.182387 -2.044903
-v -1.256971 0.182387 -2.020532
-v -1.318050 0.182387 -1.986905
-v -1.373390 0.182387 -1.944634
-v -1.422248 0.182387 -1.894331
-v -1.463884 0.182387 -1.836608
-v -1.497558 0.182387 -1.772077
-v -1.522528 0.182387 -1.701349
-v -1.538053 0.182387 -1.625037
-v -1.543393 0.182387 -1.543752
-v -1.543393 0.182387 -1.494827
-v -1.543393 0.182387 -1.356561
-v -1.543393 0.182387 -1.141716
-v -1.543393 0.182387 -0.863055
-v -1.543393 0.182387 -0.533343
-v -1.543393 0.182387 -0.165341
-v -1.543393 0.182387 0.228187
-v -1.543393 0.182387 0.634479
-v -1.543393 0.182387 1.040770
-v -1.543393 0.182387 1.434298
-v -1.543393 0.182387 1.802300
-v -1.543393 0.182387 2.132013
-v -0.010996 0.182387 1.537676
-v -0.035856 0.182387 1.536087
-v -0.059876 0.182387 1.533437
-v -0.083055 0.182387 1.529726
-v -0.105388 0.182387 1.524953
-v -0.126874 0.182387 1.519115
-v -0.147509 0.182387 1.512212
-v -0.167291 0.182387 1.504244
-v -0.186216 0.182387 1.495208
-v -0.204283 0.182387 1.485104
-v -0.221488 0.182387 1.473931
-v -0.237828 0.182387 1.461687
-v -0.258387 0.182387 1.443494
-v -0.278030 0.182387 1.422685
-v -0.296754 0.182387 1.399261
-v -0.314560 0.182387 1.373223
-v -0.331446 0.182387 1.344574
-v -0.347411 0.182387 1.313315
-v -0.362454 0.182387 1.279447
-v -0.376574 0.182387 1.242972
-v -0.389771 0.182387 1.203891
-v -0.402043 0.182387 1.162206
-v -0.413388 0.182387 1.117919
-v -0.423807 0.182387 1.071030
-v -0.468646 0.182387 1.059673
-v -0.511795 0.182387 1.045095
-v -0.553243 0.182387 1.027292
-v -0.592977 0.182387 1.006257
-v -0.630985 0.182387 0.981984
-v -0.667254 0.182387 0.954468
-v -0.701772 0.182387 0.923703
-v -0.734525 0.182387 0.889683
-v -0.765502 0.182387 0.852402
-v -0.794690 0.182387 0.811855
-v -0.822076 0.182387 0.768036
-v 0.973284 -0.182387 0.925691
-v 0.976827 -0.182387 0.925481
-v 0.980386 -0.182387 0.925247
-v 0.983958 -0.182387 0.924990
-v 0.987542 -0.182387 0.924711
-v 1.012237 -0.182387 0.922225
-v 1.036888 -0.182387 0.918973
-v 1.061538 -0.182387 0.914956
-v 1.086227 -0.182387 0.910174
-v 1.111001 -0.182387 0.904626
-v 1.135899 -0.182387 0.898313
-v 1.160964 -0.182387 0.891235
-v 1.186239 -0.182387 0.883391
-v 1.211767 -0.182387 0.874782
-v 1.237589 -0.182387 0.865408
-v 1.263747 -0.182387 0.855268
-v 1.290285 -0.182387 0.844363
-v 1.290285 -0.182387 0.841263
-v 1.290285 -0.182387 0.832502
-v 1.290285 -0.182387 0.818888
-v 1.290285 -0.182387 0.801231
-v 1.290285 -0.182387 0.780339
-v 1.290285 -0.182387 0.757021
-v 1.290285 -0.182387 0.732085
-v 1.290285 -0.182387 0.706341
-v 1.290285 -0.182387 0.680596
-v 1.651209 -0.182387 -0.805648
-v 1.651209 -0.182387 -0.500221
-v 1.651209 -0.182387 -0.194794
-v 1.651209 -0.182387 0.101039
-v 1.651209 -0.182387 0.377682
-v 1.651209 -0.182387 0.625542
-v 1.651209 -0.182387 0.835023
-v 0.949063 -0.182387 0.926488
-v 0.952447 -0.182387 0.926449
-v 0.955859 -0.182387 0.926385
-v 0.959298 -0.182387 0.926295
-v 0.962762 -0.182387 0.926181
-v 0.966249 -0.182387 0.926042
-v 0.969757 -0.182387 0.925878
-v 1.651209 0.182387 -0.805648
-v 1.651209 0.182387 -0.500221
-v 1.651209 0.182387 -0.194794
-v 1.651209 0.182387 0.101039
-v 1.651209 0.182387 0.377682
-v 1.651209 0.182387 0.625542
-v 1.651209 0.182387 0.835023
-v 0.973284 0.182387 0.925691
-v 0.969757 0.182387 0.925878
-v 0.966249 0.182387 0.926042
-v 0.962762 0.182387 0.926181
-v 0.959298 0.182387 0.926295
-v 0.955859 0.182387 0.926385
-v 0.952447 0.182387 0.926449
-v 0.949063 0.182387 0.926488
-v 1.290285 0.182387 0.680596
-v 1.290285 0.182387 0.706341
-v 1.290285 0.182387 0.732085
-v 1.290285 0.182387 0.757021
-v 1.290285 0.182387 0.780339
-v 1.290285 0.182387 0.801231
-v 1.290285 0.182387 0.818888
-v 1.290285 0.182387 0.832502
-v 1.290285 0.182387 0.841263
-v 1.290285 0.182387 0.844363
-v 1.263747 0.182387 0.855268
-v 1.237589 0.182387 0.865408
-v 1.211767 0.182387 0.874782
-v 1.186239 0.182387 0.883391
-v 1.160964 0.182387 0.891235
-v 1.135899 0.182387 0.898313
-v 1.111001 0.182387 0.904626
-v 1.086227 0.182387 0.910174
-v 1.061538 0.182387 0.914956
-v 1.036888 0.182387 0.918973
-v 1.012237 0.182387 0.922225
-v 0.987542 0.182387 0.924711
-v 0.983958 0.182387 0.924990
-v 0.980386 0.182387 0.925247
-v 0.976827 0.182387 0.925481
-v -0.420633 -0.182387 0.609377
-v -0.432883 -0.182387 0.577418
-v -0.444850 -0.182387 0.540341
-v -0.455769 -0.182387 0.499161
-v -0.465641 -0.182387 0.453883
-v -0.474468 -0.182387 0.404507
-v -0.482251 -0.182387 0.351039
-v -0.488992 -0.182387 0.293479
-v -0.494692 -0.182387 0.231832
-v -0.499352 -0.182387 0.166100
-v -0.502975 -0.182387 0.096287
-v -0.505560 -0.182387 0.022395
-v -0.507111 -0.182387 -0.055574
-v -0.507627 -0.182387 -0.137615
-v -0.507096 -0.182387 -0.222158
-v -0.505505 -0.182387 -0.301775
-v -0.502855 -0.182387 -0.376463
-v -0.499150 -0.182387 -0.446221
-v -0.494391 -0.182387 -0.511044
-v -0.488580 -0.182387 -0.570931
-v -0.481720 -0.182387 -0.625878
-v -0.473812 -0.182387 -0.675884
-v -0.464860 -0.182387 -0.720945
-v -0.454864 -0.182387 -0.761058
-v -0.443828 -0.182387 -0.796221
-v -0.431753 -0.182387 -0.826431
-v -0.419682 -0.182387 -0.850800
-v -0.406773 -0.182387 -0.873046
-v -0.393025 -0.182387 -0.893167
-v -0.378438 -0.182387 -0.911165
-v -0.363012 -0.182387 -0.927042
-v -0.346747 -0.182387 -0.940799
-v -0.329644 -0.182387 -0.952436
-v -0.311702 -0.182387 -0.961955
-v -0.292921 -0.182387 -0.969356
-v -0.273302 -0.182387 -0.974642
-v -0.252844 -0.182387 -0.977813
-v -0.231547 -0.182387 -0.978869
-v -0.229829 -0.182387 -0.978862
-v -0.228101 -0.182387 -0.978840
-v -0.226363 -0.182387 -0.978804
-v -0.224615 -0.182387 -0.978755
-v -0.222860 -0.182387 -0.978691
-v -0.221097 -0.182387 -0.978614
-v -0.219327 -0.182387 -0.978523
-v -0.217552 -0.182387 -0.978418
-v -0.215772 -0.182387 -0.978299
-v -0.213988 -0.182387 -0.978168
-v -0.212200 -0.182387 -0.978023
-v -0.210411 -0.182387 -0.977865
-v -0.187470 -0.182387 -0.974624
-v -0.165518 -0.182387 -0.969019
-v -0.144552 -0.182387 -0.961056
-v -0.124571 -0.182387 -0.950738
-v -0.105573 -0.182387 -0.938070
-v -0.087555 -0.182387 -0.923059
-v -0.070516 -0.182387 -0.905708
-v -0.054454 -0.182387 -0.886023
-v -0.039367 -0.182387 -0.864009
-v -0.025253 -0.182387 -0.839671
-v -0.012110 -0.182387 -0.813014
-v 0.000065 -0.182387 -0.784043
-v 0.011252 -0.182387 -0.752004
-v 0.021450 -0.182387 -0.715855
-v 0.030663 -0.182387 -0.675595
-v 0.038893 -0.182387 -0.631220
-v 0.046143 -0.182387 -0.582729
-v 0.052417 -0.182387 -0.530117
-v 0.057717 -0.182387 -0.473383
-v 0.062046 -0.182387 -0.412525
-v 0.065408 -0.182387 -0.347538
-v 0.067806 -0.182387 -0.278422
-v 0.069243 -0.182387 -0.205172
-v 0.069721 -0.182387 -0.127787
-v 0.069238 -0.182387 -0.041715
-v 0.067786 -0.182387 0.039494
-v 0.065364 -0.182387 0.115843
-v 0.061970 -0.182387 0.187334
-v 0.057600 -0.182387 0.253967
-v 0.052252 -0.182387 0.315745
-v 0.045924 -0.182387 0.372668
-v 0.038614 -0.182387 0.424741
-v 0.030318 -0.182387 0.471963
-v 0.021036 -0.182387 0.514336
-v 0.010764 -0.182387 0.551863
-v -0.000501 -0.182387 0.584545
-v -0.012809 -0.182387 0.613863
-v -0.026056 -0.182387 0.640763
-v -0.040242 -0.182387 0.665243
-v -0.055369 -0.182387 0.687302
-v -0.071438 -0.182387 0.706941
-v -0.088450 -0.182387 0.724158
-v -0.106407 -0.182387 0.738952
-v -0.125311 -0.182387 0.751321
-v -0.145162 -0.182387 0.761267
-v -0.165961 -0.182387 0.768786
-v -0.187710 -0.182387 0.773880
-v -0.210411 -0.182387 0.776546
-v -0.211446 -0.182387 0.776607
-v -0.212477 -0.182387 0.776665
-v -0.213505 -0.182387 0.776720
-v -0.214531 -0.182387 0.776771
-v -0.215555 -0.182387 0.776818
-v -0.216578 -0.182387 0.776860
-v -0.217601 -0.182387 0.776896
-v -0.218623 -0.182387 0.776927
-v -0.219646 -0.182387 0.776952
-v -0.220669 -0.182387 0.776970
-v -0.221695 -0.182387 0.776981
-v -0.222722 -0.182387 0.776985
-v -0.245400 -0.182387 0.775607
-v -0.267158 -0.182387 0.771469
-v -0.287989 -0.182387 0.764568
-v -0.307887 -0.182387 0.754899
-v -0.326849 -0.182387 0.742459
-v -0.344867 -0.182387 0.727242
-v -0.361938 -0.182387 0.709246
-v -0.378055 -0.182387 0.688465
-v -0.393214 -0.182387 0.664896
-v -0.407408 -0.182387 0.638535
-v -0.474468 0.182387 0.404507
-v -0.465641 0.182387 0.453883
-v -0.455769 0.182387 0.499161
-v -0.444850 0.182387 0.540341
-v -0.432883 0.182387 0.577418
-v -0.420633 0.182387 0.609377
-v -0.407408 0.182387 0.638535
-v -0.393214 0.182387 0.664896
-v -0.378055 0.182387 0.688465
-v -0.361938 0.182387 0.709246
-v -0.344867 0.182387 0.727242
-v -0.326849 0.182387 0.742459
-v -0.307887 0.182387 0.754899
-v -0.287989 0.182387 0.764568
-v -0.267158 0.182387 0.771469
-v -0.245400 0.182387 0.775607
-v -0.222722 0.182387 0.776985
-v -0.221695 0.182387 0.776981
-v -0.220669 0.182387 0.776970
-v -0.219646 0.182387 0.776952
-v -0.218623 0.182387 0.776927
-v -0.217601 0.182387 0.776896
-v -0.216578 0.182387 0.776860
-v -0.215555 0.182387 0.776818
-v -0.214531 0.182387 0.776771
-v -0.213505 0.182387 0.776720
-v -0.212477 0.182387 0.776665
-v -0.211446 0.182387 0.776607
-v -0.210411 0.182387 0.776546
-v -0.187710 0.182387 0.773880
-v -0.165961 0.182387 0.768786
-v -0.145162 0.182387 0.761267
-v -0.125311 0.182387 0.751321
-v -0.106407 0.182387 0.738952
-v -0.088450 0.182387 0.724158
-v -0.071438 0.182387 0.706941
-v -0.055369 0.182387 0.687302
-v -0.040242 0.182387 0.665243
-v -0.026056 0.182387 0.640763
-v -0.012809 0.182387 0.613863
-v -0.000501 0.182387 0.584545
-v 0.010764 0.182387 0.551863
-v 0.021036 0.182387 0.514336
-v 0.030318 0.182387 0.471963
-v 0.038614 0.182387 0.424741
-v 0.045924 0.182387 0.372668
-v 0.052252 0.182387 0.315745
-v 0.057600 0.182387 0.253967
-v 0.061970 0.182387 0.187334
-v 0.065364 0.182387 0.115843
-v 0.067786 0.182387 0.039494
-v 0.069238 0.182387 -0.041715
-v 0.069721 0.182387 -0.127787
-v 0.069243 0.182387 -0.205172
-v 0.067806 0.182387 -0.278422
-v 0.065408 0.182387 -0.347538
-v 0.062046 0.182387 -0.412525
-v 0.057717 0.182387 -0.473383
-v 0.052417 0.182387 -0.530117
-v 0.046143 0.182387 -0.582729
-v 0.038893 0.182387 -0.631220
-v 0.030663 0.182387 -0.675595
-v 0.021450 0.182387 -0.715855
-v 0.011252 0.182387 -0.752004
-v 0.000065 0.182387 -0.784043
-v -0.012110 0.182387 -0.813014
-v -0.025253 0.182387 -0.839671
-v -0.039367 0.182387 -0.864009
-v -0.054454 0.182387 -0.886023
-v -0.070516 0.182387 -0.905708
-v -0.087555 0.182387 -0.923059
-v -0.105573 0.182387 -0.938070
-v -0.124571 0.182387 -0.950738
-v -0.144552 0.182387 -0.961056
-v -0.165518 0.182387 -0.969019
-v -0.187470 0.182387 -0.974624
-v -0.210411 0.182387 -0.977865
-v -0.212200 0.182387 -0.978023
-v -0.213988 0.182387 -0.978168
-v -0.215772 0.182387 -0.978299
-v -0.217552 0.182387 -0.978418
-v -0.219327 0.182387 -0.978523
-v -0.221097 0.182387 -0.978614
-v -0.222860 0.182387 -0.978691
-v -0.224615 0.182387 -0.978755
-v -0.226363 0.182387 -0.978804
-v -0.228101 0.182387 -0.978840
-v -0.229829 0.182387 -0.978862
-v -0.231547 0.182387 -0.978869
-v -0.252844 0.182387 -0.977813
-v -0.273302 0.182387 -0.974642
-v -0.292921 0.182387 -0.969356
-v -0.311702 0.182387 -0.961955
-v -0.329644 0.182387 -0.952436
-v -0.346747 0.182387 -0.940799
-v -0.363012 0.182387 -0.927042
-v -0.378438 0.182387 -0.911165
-v -0.393025 0.182387 -0.893167
-v -0.406773 0.182387 -0.873046
-v -0.419682 0.182387 -0.850800
-v -0.431753 0.182387 -0.826431
-v -0.443828 0.182387 -0.796221
-v -0.454864 0.182387 -0.761058
-v -0.464860 0.182387 -0.720945
-v -0.473812 0.182387 -0.675884
-v -0.481720 0.182387 -0.625878
-v -0.488580 0.182387 -0.570931
-v -0.494391 0.182387 -0.511044
-v -0.499150 0.182387 -0.446221
-v -0.502855 0.182387 -0.376463
-v -0.505505 0.182387 -0.301775
-v -0.507096 0.182387 -0.222158
-v -0.507627 0.182387 -0.137615
-v -0.507111 0.182387 -0.055574
-v -0.505560 0.182387 0.022395
-v -0.502975 0.182387 0.096287
-v -0.499352 0.182387 0.166100
-v -0.494692 0.182387 0.231832
-v -0.488992 0.182387 0.293479
-v -0.482251 0.182387 0.351039
-vn 0.943300 0.000000 0.332000
-vn 0.906700 0.000000 0.421700
-vn 0.000000 -1.000000 0.000000
-vn 0.970600 0.000000 0.240500
-vn 0.000000 1.000000 0.000000
-vn 0.860000 0.000000 0.510200
-vn 0.050400 0.000000 0.998700
-vn 0.045800 0.000000 0.999000
-vn 0.040200 0.000000 0.999200
-vn 0.032900 0.000000 0.999500
-vn 0.025500 0.000000 0.999700
-vn 0.018000 0.000000 0.999800
-vn 0.010500 0.000000 0.999900
-vn 0.003200 0.000000 1.000000
-vn -0.027200 0.000000 0.999600
-vn -0.086600 0.000000 0.996200
-vn -0.152600 0.000000 0.988300
-vn -0.224600 0.000000 0.974500
-vn -0.301200 0.000000 0.953500
-vn -0.380600 0.000000 0.924700
-vn -0.460300 0.000000 0.887700
-vn -0.537400 0.000000 0.843300
-vn -0.609300 0.000000 0.792900
-vn -0.674000 0.000000 0.738700
-vn -0.730400 0.000000 0.683000
-vn -0.778100 0.000000 0.628200
-vn -0.836000 0.000000 0.548700
-vn -0.899000 0.000000 0.437900
-vn -0.938900 0.000000 0.344300
-vn -0.963500 0.000000 0.267600
-vn -0.978700 0.000000 0.205500
-vn -0.987800 0.000000 0.155500
-vn -0.993300 0.000000 0.115400
-vn -0.996500 0.000000 0.083000
-vn -0.998400 0.000000 0.057000
-vn -0.999400 0.000000 0.036000
-vn -0.999800 0.000000 0.019100
-vn -1.000000 0.000000 0.005700
+v 1.624641 -1.318420 -0.182387
+v 1.624641 -1.318420 0.182387
+v 1.604945 -1.374372 0.182387
+v 1.604945 -1.374372 -0.182387
+v 1.580433 -1.427071 0.182387
+v -0.981784 -0.203307 -0.182387
+v -0.972293 -0.281231 -0.182387
+v -1.543393 -0.228187 -0.182387
+v 0.724135 -0.831789 -0.182387
+v 0.262260 -0.831150 -0.182387
+v 0.711830 -0.814225 -0.182387
+v 1.639159 -1.259835 -0.182387
+v 1.639159 -1.259835 0.182387
+v 1.304468 -1.652686 0.182386
+v 1.551467 -1.475895 0.182387
+v 0.945710 -0.926501 0.182387
+v -1.543393 0.165341 0.182387
+v -0.997645 0.052952 0.182387
+v -0.998706 0.145841 0.182387
+v 1.580433 -1.427071 -0.182387
+v 1.121240 -0.657773 -0.182387
+v 1.121898 -0.657740 -0.182387
+v 1.121898 -0.657740 0.182387
+v 1.120596 -0.657802 -0.182387
+v 1.121240 -0.657773 0.182387
+v 1.119957 -0.657828 -0.182387
+v 1.120596 -0.657802 0.182387
+v 1.119311 -0.657849 -0.182387
+v 1.119957 -0.657828 0.182387
+v 1.118648 -0.657866 -0.182387
+v 1.119311 -0.657849 0.182387
+v 1.117959 -0.657879 -0.182387
+v 1.118648 -0.657866 0.182387
+v 1.117232 -0.657886 -0.182387
+v 1.117959 -0.657879 0.182387
+v 1.116459 -0.657889 -0.182387
+v 1.117232 -0.657886 0.182387
+v 1.108379 -0.657669 -0.182387
+v 1.116459 -0.657889 0.182387
+v 1.100785 -0.657008 -0.182387
+v 1.108379 -0.657669 0.182387
+v 1.093652 -0.655907 -0.182387
+v 1.100785 -0.657008 0.182387
+v 1.086952 -0.654363 -0.182387
+v 1.093652 -0.655907 0.182387
+v 1.080662 -0.652376 -0.182387
+v 1.086952 -0.654363 0.182387
+v 1.074757 -0.649945 -0.182387
+v 1.080662 -0.652376 0.182387
+v 1.069211 -0.647069 -0.182387
+v 1.074757 -0.649945 0.182387
+v 1.063999 -0.643748 -0.182387
+v 1.069211 -0.647069 0.182387
+v 1.059095 -0.639980 -0.182387
+v 1.063999 -0.643748 0.182387
+v 1.054475 -0.635764 -0.182387
+v 1.059095 -0.639980 0.182387
+v 1.050114 -0.631101 -0.182387
+v 1.054475 -0.635764 0.182387
+v 1.045986 -0.625988 -0.182387
+v 1.050114 -0.631101 0.182387
+v 1.041773 -0.619568 -0.182387
+v 1.045986 -0.625988 0.182387
+v 1.038066 -0.611957 -0.182387
+v 1.041773 -0.619568 0.182387
+v 1.034837 -0.603155 -0.182387
+v 1.038066 -0.611957 0.182387
+v 1.032062 -0.593160 -0.182387
+v 1.034837 -0.603155 0.182387
+v 1.029713 -0.581973 -0.182387
+v 1.032062 -0.593160 0.182387
+v 1.027764 -0.569593 -0.182387
+v 1.029713 -0.581973 0.182387
+v 1.026187 -0.556018 -0.182387
+v 1.027764 -0.569593 0.182387
+v 1.024956 -0.541250 -0.182387
+v 1.026187 -0.556018 0.182387
+v 1.024046 -0.525286 -0.182387
+v 1.024956 -0.541250 0.182387
+v 1.023428 -0.508127 -0.182387
+v 1.024046 -0.525286 0.182387
+v 1.023077 -0.489772 -0.182387
+v 1.023428 -0.508127 0.182387
+v 1.022966 -0.470221 -0.182387
+v 1.023077 -0.489772 0.182387
+v 1.022966 -0.457888 -0.182387
+v 1.022966 -0.470221 0.182387
+v 1.022966 -0.423033 -0.182387
+v 1.022966 -0.457888 0.182387
+v 1.022966 -0.368875 -0.182387
+v 1.022966 -0.423033 0.182387
+v 1.022966 -0.298629 -0.182387
+v 1.022966 -0.368875 0.182387
+v 1.022966 -0.215515 -0.182387
+v 1.022966 -0.298629 0.182387
+v 1.022966 -0.122748 -0.182387
+v 1.022966 -0.215515 0.182387
+v 1.022966 -0.023547 -0.182387
+v 1.022966 -0.122748 0.182387
+v 1.022966 0.078872 -0.182387
+v 1.022966 -0.023547 0.182387
+v 1.022966 0.181290 -0.182387
+v 1.022966 0.078872 0.182387
+v 1.022966 0.280492 -0.182387
+v 1.022966 0.181290 0.182387
+v 1.022966 0.373259 -0.182387
+v 1.022966 0.280492 0.182387
+v 1.022966 0.456373 -0.182387
+v 1.022966 0.373259 0.182387
+v 1.263622 0.444411 -0.182387
+v 1.022966 0.456373 0.182387
+v 1.263622 0.697952 -0.182387
+v 1.263622 0.444411 0.182387
+v 1.022966 0.716351 -0.182387
+v 1.263622 0.697952 0.182387
+v 1.022966 1.120478 -0.182387
+v 1.022966 0.716351 0.182387
+v 0.788843 1.145252 -0.182387
+v 1.022966 1.120478 0.182387
+v 0.693403 0.739209 -0.182387
+v 0.788843 1.145252 0.182387
+v 0.541780 0.750073 -0.182387
+v 0.693403 0.739209 0.182387
+v 0.541780 0.478384 -0.182387
+v 0.541780 0.750073 0.182387
+v 0.648683 0.472763 -0.182387
+v 0.541780 0.478384 0.182387
+v 0.648683 -0.554368 -0.182387
+v 0.648683 0.472763 0.182387
+v 0.649385 -0.587227 -0.182387
+v 0.648683 -0.554368 0.182387
+v 0.651461 -0.618561 -0.182387
+v 0.649385 -0.587227 0.182387
+v 0.654864 -0.648369 -0.182387
+v 0.651461 -0.618561 0.182387
+v 0.659545 -0.676652 -0.182387
+v 0.654864 -0.648369 0.182387
+v 0.665458 -0.703407 -0.182387
+v 0.659545 -0.676652 0.182387
+v 0.672554 -0.728633 -0.182387
+v 0.665458 -0.703407 0.182387
+v 0.680787 -0.752329 -0.182387
+v 0.672554 -0.728633 0.182387
+v 0.690109 -0.774494 -0.182387
+v 0.680787 -0.752329 0.182387
+v 0.700473 -0.795126 -0.182387
+v 0.690109 -0.774494 0.182387
+v 0.700473 -0.795126 0.182387
+v 0.711830 -0.814225 0.182387
+v 0.737338 -0.847817 -0.182387
+v 0.724135 -0.831789 0.182387
+v 0.749557 -0.860433 -0.182387
+v 0.737338 -0.847817 0.182387
+v 0.762797 -0.871939 -0.182387
+v 0.749557 -0.860433 0.182387
+v 0.777034 -0.882338 -0.182387
+v 0.762797 -0.871939 0.182387
+v 0.792240 -0.891632 -0.182387
+v 0.777034 -0.882338 0.182387
+v 0.808392 -0.899824 -0.182387
+v 0.792240 -0.891632 0.182387
+v 0.825461 -0.906916 -0.182387
+v 0.808392 -0.899824 0.182387
+v 0.843423 -0.912910 -0.182387
+v 0.825461 -0.906916 0.182387
+v 0.862251 -0.917809 -0.182387
+v 0.843423 -0.912910 0.182387
+v 0.881920 -0.921615 -0.182387
+v 0.862251 -0.917809 0.182387
+v 0.902404 -0.924331 -0.182387
+v 0.881920 -0.921615 0.182387
+v 0.923676 -0.925959 -0.182387
+v 0.902404 -0.924331 0.182387
+v 0.945710 -0.926501 -0.182387
+v 0.923676 -0.925959 0.182387
+v 1.211767 -0.874782 -0.182387
+v 1.237589 -0.865408 -0.182387
+v 1.651209 -0.996532 -0.182387
+v 1.651209 0.500221 -0.182387
+v 1.651209 0.805648 0.182387
+v 1.651209 0.500221 0.182387
+v 1.651209 -1.100473 -0.182387
+v 1.651209 -1.100473 0.182387
+v 1.651209 -1.137252 0.182387
+v 1.651209 -1.137252 -0.182387
+v 1.648136 -1.199239 0.182387
+v 1.648136 -1.199239 -0.182387
+v 1.551467 -1.475895 -0.182387
+v 1.518411 -1.520223 0.182387
+v 1.518411 -1.520223 -0.182387
+v 1.481627 -1.559434 0.182386
+v 1.481627 -1.559434 -0.182388
+v 1.441478 -1.592906 0.182386
+v 1.441478 -1.592906 -0.182388
+v 1.398327 -1.620021 0.182386
+v 1.398327 -1.620021 -0.182388
+v 1.352536 -1.640154 0.182386
+v 1.352536 -1.640154 -0.182388
+v 1.304468 -1.652686 -0.182388
+v -1.543393 -2.132013 0.182386
+v -1.543393 -0.634479 -0.182387
+v -1.543393 -1.040770 -0.182387
+v -1.543393 -1.040770 0.182387
+v -1.543393 1.494827 -0.182387
+v -1.543393 1.494827 0.182387
+v -1.543393 1.543752 0.182388
+v -1.543393 1.543752 -0.182386
+v -1.538053 1.625037 0.182388
+v -1.538053 1.625037 -0.182386
+v -1.522528 1.701349 0.182388
+v -1.522528 1.701349 -0.182386
+v -1.497558 1.772077 0.182388
+v -1.497558 1.772077 -0.182386
+v -1.463884 1.836608 0.182388
+v -1.463884 1.836608 -0.182386
+v -1.422248 1.894331 0.182388
+v -1.422248 1.894331 -0.182386
+v -1.373390 1.944634 0.182388
+v -1.373390 1.944634 -0.182386
+v -1.318050 1.986905 0.182388
+v -1.318050 1.986905 -0.182386
+v -1.256971 2.020532 0.182388
+v -1.256971 2.020532 -0.182386
+v -1.190891 2.044903 0.182388
+v -1.190891 2.044903 -0.182386
+v -1.120553 2.059406 0.182388
+v -1.120553 2.059406 -0.182386
+v -1.046697 2.063429 0.182388
+v -1.046697 2.063429 -0.182386
+v -0.970064 2.056361 0.182388
+v -0.970064 2.056361 -0.182386
+v -0.935175 2.050632 0.182388
+v -0.935175 2.050632 -0.182386
+v -0.836574 2.034443 0.182388
+v 0.873018 1.753752 -0.182386
+v 0.583283 1.801322 -0.182386
+v 0.583283 1.801322 0.182388
+v 1.290285 -0.632343 -0.182387
+v 1.290285 -0.655661 -0.182387
+v 1.290285 -0.655661 0.182387
+v 1.290285 -0.611451 -0.182387
+v 1.290285 -0.632343 0.182387
+v 1.276783 -0.618072 -0.182387
+v 1.290285 -0.611451 0.182387
+v 1.263028 -0.624200 -0.182387
+v 1.276783 -0.618072 0.182387
+v 1.249080 -0.629828 -0.182387
+v 1.263028 -0.624200 0.182387
+v 1.235000 -0.634956 -0.182387
+v 1.249080 -0.629828 0.182387
+v 1.220848 -0.639580 -0.182387
+v 1.235000 -0.634956 0.182387
+v 1.206685 -0.643697 -0.182387
+v 1.220848 -0.639580 0.182387
+v 1.192572 -0.647303 -0.182387
+v 1.206685 -0.643697 0.182387
+v 1.178569 -0.650396 -0.182387
+v 1.192572 -0.647303 0.182387
+v 1.164738 -0.652973 -0.182387
+v 1.178569 -0.650396 0.182387
+v 1.151138 -0.655030 -0.182387
+v 1.164738 -0.652973 0.182387
+v 1.137830 -0.656565 -0.182387
+v 1.151138 -0.655030 0.182387
+v 1.124875 -0.657574 -0.182387
+v 1.137830 -0.656565 0.182387
+v 1.124058 -0.657620 -0.182387
+v 1.124875 -0.657574 0.182387
+v 1.123296 -0.657663 -0.182387
+v 1.124058 -0.657620 0.182387
+v 1.122580 -0.657703 -0.182387
+v 1.123296 -0.657663 0.182387
+v 1.122580 -0.657703 0.182387
+v 1.651209 -0.996532 0.182387
+v 1.651209 -0.835023 0.182387
+v 1.290285 -0.844363 0.182387
+v 0.949063 -0.926488 -0.182387
+v 0.973284 -0.925691 -0.182387
+v 0.969757 -0.925878 -0.182387
+v 0.969757 -0.925878 0.182387
+v 0.976827 -0.925481 -0.182387
+v 0.973284 -0.925691 0.182387
+v 0.980386 -0.925247 -0.182387
+v 0.976827 -0.925481 0.182387
+v 0.983958 -0.924990 -0.182387
+v 0.980386 -0.925247 0.182387
+v 0.987542 -0.924711 -0.182387
+v 0.983958 -0.924990 0.182387
+v 1.012237 -0.922225 -0.182387
+v 0.987542 -0.924711 0.182387
+v 1.036888 -0.918973 -0.182387
+v 1.012237 -0.922225 0.182387
+v 1.061538 -0.914956 -0.182387
+v 1.036888 -0.918973 0.182387
+v 1.086227 -0.910174 -0.182387
+v 1.061538 -0.914956 0.182387
+v 1.111001 -0.904626 -0.182387
+v 1.086227 -0.910174 0.182387
+v 1.135899 -0.898313 -0.182387
+v 1.111001 -0.904626 0.182387
+v 1.160964 -0.891235 -0.182387
+v 1.135899 -0.898313 0.182387
+v 1.186239 -0.883391 -0.182387
+v 1.160964 -0.891235 0.182387
+v 1.186239 -0.883391 0.182387
+v 1.211767 -0.874782 0.182387
+v 1.263747 -0.855268 -0.182387
+v 1.237589 -0.865408 0.182387
+v 1.290285 -0.844363 -0.182387
+v 1.263747 -0.855268 0.182387
+v 1.290285 -0.841263 -0.182387
+v 1.290285 -0.832502 -0.182387
+v 1.290285 -0.841263 0.182387
+v 1.290285 -0.818888 -0.182387
+v 1.290285 -0.832502 0.182387
+v 1.290285 -0.801231 -0.182387
+v 1.290285 -0.818888 0.182387
+v 1.290285 -0.780339 -0.182387
+v 1.290285 -0.801231 0.182387
+v 1.290285 -0.757021 -0.182387
+v 1.290285 -0.780339 0.182387
+v 1.290285 -0.732085 -0.182387
+v 1.290285 -0.757021 0.182387
+v 1.290285 -0.706341 -0.182387
+v 1.290285 -0.732085 0.182387
+v 1.290285 -0.680596 -0.182387
+v 1.290285 -0.706341 0.182387
+v 1.290285 -0.680596 0.182387
+v 0.952447 -0.926449 -0.182387
+v 0.949063 -0.926488 0.182387
+v 0.955859 -0.926385 -0.182387
+v 0.952447 -0.926449 0.182387
+v 0.959298 -0.926295 -0.182387
+v 0.955859 -0.926385 0.182387
+v 0.962762 -0.926181 -0.182387
+v 0.959298 -0.926295 0.182387
+v 0.966249 -0.926042 -0.182387
+v 0.962762 -0.926181 0.182387
+v 0.966249 -0.926042 0.182387
+v 0.426419 -0.445305 -0.182387
+v 0.412138 -0.503110 -0.182387
+v 0.412138 -0.503110 0.182387
+v 0.439008 -0.384638 -0.182387
+v 0.426419 -0.445305 0.182387
+v 0.396163 -0.558060 -0.182387
+v 0.396163 -0.558060 0.182387
+v 0.449909 -0.321098 -0.182387
+v 0.439008 -0.384638 0.182387
+v 0.378490 -0.610163 -0.182387
+v 0.378490 -0.610163 0.182387
+v 0.459124 -0.254677 -0.182387
+v 0.449909 -0.321098 0.182387
+v 0.359117 -0.659430 -0.182387
+v 0.359117 -0.659430 0.182387
+v 0.466657 -0.185367 -0.182387
+v 0.459124 -0.254677 0.182387
+v 0.337635 -0.706565 -0.182387
+v 0.337635 -0.706565 0.182387
+v 0.472510 -0.113159 -0.182387
+v 0.466657 -0.185367 0.182387
+v 0.314338 -0.750899 -0.182387
+v 0.314338 -0.750899 0.182387
+v 0.476688 -0.038043 -0.182387
+v 0.472510 -0.113159 0.182387
+v 0.289217 -0.792428 -0.182387
+v 0.289217 -0.792428 0.182387
+v 0.479192 0.039988 -0.182387
+v 0.476688 -0.038043 0.182387
+v 0.262260 -0.831150 0.182387
+v 0.480026 0.120943 -0.182387
+v 0.479192 0.039988 0.182387
+v 0.233457 -0.867059 -0.182387
+v 0.233457 -0.867059 0.182387
+v 0.478892 0.209136 -0.182387
+v 0.480026 0.120943 0.182387
+v 0.202799 -0.900153 -0.182387
+v 0.202799 -0.900153 0.182387
+v 0.475486 0.293762 -0.182387
+v 0.478892 0.209136 0.182387
+v 0.170275 -0.930427 -0.182387
+v 0.170275 -0.930427 0.182387
+v 0.469801 0.374832 -0.182387
+v 0.475486 0.293762 0.182387
+v 0.135875 -0.957879 -0.182387
+v 0.135875 -0.957879 0.182387
+v 0.461829 0.452356 -0.182387
+v 0.469801 0.374832 0.182387
+v 0.099588 -0.982504 -0.182387
+v 0.099588 -0.982504 0.182387
+v 0.451565 0.526344 -0.182387
+v 0.461829 0.452356 0.182387
+v 0.061404 -1.004298 -0.182387
+v 0.061404 -1.004298 0.182387
+v 0.438999 0.596807 -0.182387
+v 0.451565 0.526344 0.182387
+v 0.021314 -1.023258 -0.182387
+v 0.021314 -1.023258 0.182387
+v 0.424126 0.663755 -0.182387
+v 0.438999 0.596807 0.182387
+v -0.020694 -1.039381 -0.182387
+v -0.020694 -1.039381 0.182387
+v 0.406938 0.727197 -0.182387
+v 0.424126 0.663755 0.182387
+v -0.016169 -1.061018 -0.182387
+v -0.016169 -1.061018 0.182387
+v 0.387429 0.787144 -0.182387
+v 0.406938 0.727197 0.182387
+v -0.011276 -1.081441 -0.182387
+v -0.011276 -1.081441 0.182387
+v 0.365590 0.843607 -0.182387
+v 0.387429 0.787144 0.182387
+v -0.006016 -1.100653 -0.182387
+v -0.006016 -1.100653 0.182387
+v 0.341416 0.896596 -0.182387
+v 0.365590 0.843607 0.182387
+v -0.000390 -1.118659 -0.182387
+v -0.000390 -1.118659 0.182387
+v 0.314899 0.946121 -0.182387
+v 0.341416 0.896596 0.182387
+v 0.005602 -1.135461 -0.182387
+v 0.005602 -1.135461 0.182387
+v 0.285433 0.993262 -0.182387
+v 0.314899 0.946121 0.182387
+v 0.011959 -1.151064 -0.182387
+v 0.011959 -1.151064 0.182387
+v 0.253428 1.036951 -0.182387
+v 0.285433 0.993262 0.182387
+v 0.018682 -1.165471 -0.182387
+v 0.018682 -1.165471 0.182387
+v 0.218864 1.077179 -0.182387
+v 0.253428 1.036951 0.182387
+v 0.025769 -1.178687 -0.182387
+v 0.025769 -1.178687 0.182387
+v 0.181722 1.113937 -0.182387
+v 0.218864 1.077179 0.182387
+v 0.033220 -1.190714 -0.182387
+v 0.033220 -1.190714 0.182387
+v 0.141985 1.147215 -0.182387
+v 0.181722 1.113937 0.182387
+v 0.041036 -1.201556 -0.182387
+v 0.041036 -1.201556 0.182387
+v 0.099634 1.177004 -0.182387
+v 0.141985 1.147215 0.182387
+v 0.049214 -1.211217 -0.182387
+v 0.049214 -1.211217 0.182387
+v 0.054650 1.203293 -0.182387
+v 0.099634 1.177004 0.182387
+v 0.057755 -1.219701 -0.182387
+v 0.057755 -1.219701 0.182387
+v 0.007014 1.226074 -0.182387
+v 0.054650 1.203293 0.182387
+v 0.062803 -1.223925 -0.182387
+v 0.062803 -1.223925 0.182387
+v -0.043291 1.245338 -0.182387
+v 0.007014 1.226074 0.182387
+v 0.068176 -1.227869 -0.182387
+v 0.068176 -1.227869 0.182387
+v -0.096284 1.261074 -0.182387
+v -0.043291 1.245338 0.182387
+v 0.073872 -1.231538 -0.182387
+v 0.073872 -1.231538 0.182387
+v -0.151985 1.273272 -0.182387
+v -0.096284 1.261074 0.182387
+v 0.079888 -1.234935 -0.182387
+v 0.079888 -1.234935 0.182387
+v -0.210411 1.281925 -0.182387
+v -0.151985 1.273272 0.182387
+v 0.086222 -1.238063 -0.182387
+v 0.086222 -1.238063 0.182387
+v -0.219049 1.282895 -0.182387
+v -0.210411 1.281925 0.182387
+v 0.092870 -1.240926 -0.182387
+v 0.092870 -1.240926 0.182387
+v -0.227645 1.283780 -0.182387
+v -0.219049 1.282895 0.182387
+v 0.099831 -1.243528 -0.182387
+v 0.099831 -1.243528 0.182387
+v -0.236197 1.284580 -0.182387
+v -0.227645 1.283780 0.182387
+v 0.107101 -1.245871 -0.182387
+v 0.107101 -1.245871 0.182387
+v -0.244706 1.285296 -0.182387
+v -0.236197 1.284580 0.182387
+v 0.114677 -1.247959 -0.182387
+v 0.114677 -1.247959 0.182387
+v -0.253173 1.285927 -0.182387
+v -0.244706 1.285296 0.182387
+v 0.122558 -1.249797 -0.182387
+v 0.122558 -1.249797 0.182387
+v -0.261597 1.286474 -0.182387
+v -0.253173 1.285927 0.182387
+v 0.130740 -1.251386 -0.182387
+v 0.130740 -1.251386 0.182387
+v -0.269979 1.286936 -0.182387
+v -0.261597 1.286474 0.182387
+v 0.139220 -1.252732 -0.182387
+v 0.139220 -1.252732 0.182387
+v -0.278318 1.287314 -0.182387
+v -0.269979 1.286936 0.182387
+v 0.139392 -1.252755 -0.182387
+v 0.139392 -1.252755 0.182387
+v -0.286614 1.287608 -0.182387
+v -0.278318 1.287314 0.182387
+v 0.139563 -1.252762 -0.182387
+v 0.139563 -1.252762 0.182387
+v -0.294869 1.287817 -0.182387
+v -0.286614 1.287608 0.182387
+v 0.139734 -1.252757 -0.182387
+v 0.139734 -1.252757 0.182387
+v -0.303082 1.287943 -0.182387
+v -0.294869 1.287817 0.182387
+v 0.139905 -1.252744 -0.182387
+v 0.139905 -1.252744 0.182387
+v -0.311252 1.287985 -0.182387
+v -0.303082 1.287943 0.182387
+v 0.140076 -1.252724 -0.182387
+v 0.140076 -1.252724 0.182387
+v -0.361180 1.286331 -0.182387
+v -0.311252 1.287985 0.182387
+v 0.140248 -1.252701 -0.182387
+v 0.140248 -1.252701 0.182387
+v -0.409360 1.281363 -0.182387
+v -0.361180 1.286331 0.182387
+v 0.140422 -1.252678 -0.182387
+v 0.140422 -1.252678 0.182387
+v -0.455776 1.273071 -0.182387
+v -0.409360 1.281363 0.182387
+v 0.140597 -1.252657 -0.182387
+v 0.140597 -1.252657 0.182387
+v -0.500415 1.261445 -0.182387
+v -0.455776 1.273071 0.182387
+v 0.140774 -1.252644 -0.182387
+v 0.140774 -1.252644 0.182387
+v -0.543260 1.246475 -0.182387
+v -0.500415 1.261445 0.182387
+v 0.140954 -1.252639 -0.182387
+v 0.140954 -1.252639 0.182387
+v -0.584298 1.228152 -0.182387
+v -0.543260 1.246475 0.182387
+v 0.141137 -1.252646 -0.182387
+v 0.141137 -1.252646 0.182387
+v -0.623514 1.206466 -0.182387
+v -0.584298 1.228152 0.182387
+v 0.141324 -1.252669 -0.182387
+v 0.141324 -1.252669 0.182387
+v -0.660894 1.181408 -0.182387
+v -0.623514 1.206466 0.182387
+v 0.141785 -1.252711 -0.182387
+v 0.141785 -1.252711 0.182387
+v -0.696421 1.152968 -0.182387
+v -0.660894 1.181408 0.182387
+v 0.142256 -1.252718 -0.182387
+v 0.142256 -1.252718 0.182387
+v -0.730083 1.121135 -0.182387
+v -0.696421 1.152968 0.182387
+v 0.142734 -1.252694 -0.182387
+v 0.142734 -1.252694 0.182387
+v -0.761863 1.085901 -0.182387
+v -0.730083 1.121135 0.182387
+v 0.143219 -1.252649 -0.182387
+v 0.143219 -1.252649 0.182387
+v -0.791747 1.047255 -0.182387
+v -0.761863 1.085901 0.182387
+v 0.143707 -1.252589 -0.182387
+v 0.143707 -1.252589 0.182387
+v -0.824643 0.997153 -0.182387
+v -0.791747 1.047255 0.182387
+v 0.144198 -1.252520 -0.182387
+v 0.144198 -1.252520 0.182387
+v -0.854719 0.942465 -0.182387
+v -0.824643 0.997153 0.182387
+v 0.144688 -1.252450 -0.182387
+v 0.144688 -1.252450 0.182387
+v -0.881969 0.883201 -0.182387
+v -0.854719 0.942465 0.182387
+v 0.145176 -1.252385 -0.182387
+v 0.145176 -1.252385 0.182387
+v -0.906384 0.819374 -0.182387
+v -0.881969 0.883201 0.182387
+v 0.145661 -1.252334 -0.182387
+v 0.145661 -1.252334 0.182387
+v -0.927957 0.750994 -0.182387
+v -0.906384 0.819374 0.182387
+v 0.146139 -1.252301 -0.182387
+v 0.146139 -1.252301 0.182387
+v -0.946680 0.678073 -0.182387
+v -0.927957 0.750994 0.182387
+v 0.146610 -1.252296 -0.182387
+v 0.146610 -1.252296 0.182387
+v -0.962543 0.600624 -0.182387
+v -0.946680 0.678073 0.182387
+v 0.147071 -1.252324 -0.182387
+v 0.147071 -1.252324 0.182387
+v -0.975540 0.518656 -0.182387
+v -0.962543 0.600624 0.182387
+v 0.149900 -1.252584 -0.182387
+v 0.149900 -1.252584 0.182387
+v -0.985663 0.432183 -0.182387
+v -0.975540 0.518656 0.182387
+v 0.152764 -1.252761 -0.182387
+v 0.152764 -1.252761 0.182387
+v -0.992904 0.341214 -0.182387
+v -0.985663 0.432183 0.182387
+v 0.155663 -1.252865 -0.182387
+v 0.155663 -1.252865 0.182387
+v -0.997254 0.245763 -0.182387
+v -0.992904 0.341214 0.182387
+v 0.158594 -1.252909 -0.182387
+v 0.158594 -1.252909 0.182387
+v -0.998706 0.145841 -0.182387
+v -0.997254 0.245763 0.182387
+v 0.161558 -1.252904 -0.182387
+v 0.161558 -1.252904 0.182387
+v -0.997645 0.052952 -0.182387
+v 0.164552 -1.252862 -0.182387
+v 0.164552 -1.252862 0.182387
+v -0.994467 -0.036208 -0.182387
+v 0.167575 -1.252794 -0.182387
+v 0.167575 -1.252794 0.182387
+v -0.989178 -0.121631 -0.182387
+v -0.994467 -0.036208 0.182387
+v 0.170627 -1.252712 -0.182387
+v 0.170627 -1.252712 0.182387
+v -0.989178 -0.121631 0.182387
+v 0.173706 -1.252628 -0.182387
+v 0.173706 -1.252628 0.182387
+v -0.981784 -0.203307 0.182387
+v 0.176810 -1.252554 -0.182387
+v 0.176810 -1.252554 0.182387
+v -0.960710 -0.355393 -0.182387
+v -0.972293 -0.281231 0.182387
+v 0.179940 -1.252501 -0.182387
+v 0.179940 -1.252501 0.182387
+v -0.947042 -0.425786 -0.182387
+v -0.960710 -0.355393 0.182387
+v 0.183092 -1.252481 -0.182387
+v 0.183092 -1.252481 0.182387
+v -0.931295 -0.492402 -0.182387
+v -0.947042 -0.425786 0.182387
+v 0.183174 -1.252481 -0.182387
+v 0.183174 -1.252481 0.182387
+v -0.913475 -0.555233 -0.182387
+v -0.931295 -0.492402 0.182387
+v 0.183265 -1.252481 -0.182387
+v 0.183265 -1.252481 0.182387
+v -0.893590 -0.614272 -0.182387
+v -0.913475 -0.555233 0.182387
+v 0.183363 -1.252481 -0.182387
+v 0.183363 -1.252481 0.182387
+v -0.871646 -0.669510 -0.182387
+v -0.893590 -0.614272 0.182387
+v 0.183463 -1.252481 -0.182387
+v 0.183463 -1.252481 0.182387
+v -0.847648 -0.720939 -0.182387
+v -0.871646 -0.669510 0.182387
+v 0.183564 -1.252481 -0.182387
+v 0.183564 -1.252481 0.182387
+v -0.822076 -0.768036 -0.182387
+v -0.847648 -0.720939 0.182387
+v 0.183662 -1.252481 -0.182387
+v 0.183662 -1.252481 0.182387
+v -0.794690 -0.811855 -0.182387
+v -0.822076 -0.768036 0.182387
+v 0.183753 -1.252481 -0.182387
+v 0.183753 -1.252481 0.182387
+v -0.765502 -0.852402 -0.182387
+v -0.794690 -0.811855 0.182387
+v 0.183835 -1.252481 -0.182387
+v 0.183835 -1.252481 0.182387
+v -0.734525 -0.889683 -0.182387
+v -0.765502 -0.852402 0.182387
+v 0.183904 -1.252481 -0.182387
+v 0.183904 -1.252481 0.182387
+v -0.701772 -0.923703 -0.182387
+v -0.734525 -0.889683 0.182387
+v 0.183957 -1.252481 -0.182387
+v 0.183957 -1.252481 0.182387
+v -0.667254 -0.954468 -0.182387
+v -0.701772 -0.923703 0.182387
+v 0.183991 -1.252481 -0.182387
+v 0.183991 -1.252481 0.182387
+v -0.630985 -0.981984 -0.182387
+v -0.667254 -0.954468 0.182387
+v 0.184003 -1.252481 -0.182387
+v 0.184003 -1.252481 0.182387
+v -0.592977 -1.006257 -0.182387
+v -0.630985 -0.981984 0.182387
+v 0.187874 -1.252534 -0.182387
+v 0.187874 -1.252534 0.182387
+v -0.553243 -1.027292 -0.182387
+v -0.592977 -1.006257 0.182387
+v 0.191482 -1.252676 -0.182387
+v 0.191482 -1.252676 0.182387
+v -0.511795 -1.045095 -0.182387
+v -0.553243 -1.027292 0.182387
+v 0.194921 -1.252880 -0.182387
+v 0.194921 -1.252880 0.182387
+v -0.468646 -1.059673 -0.182387
+v -0.511795 -1.045095 0.182387
+v 0.198291 -1.253120 -0.182387
+v 0.198291 -1.253120 0.182387
+v -0.423807 -1.071030 -0.182387
+v -0.468646 -1.059673 0.182387
+v 0.201688 -1.253370 -0.182387
+v 0.201688 -1.253370 0.182387
+v -0.413388 -1.117919 -0.182387
+v -0.423807 -1.071030 0.182387
+v 0.205209 -1.253603 -0.182387
+v 0.205209 -1.253603 0.182387
+v -0.402043 -1.162206 -0.182387
+v -0.413388 -1.117919 0.182387
+v 0.208952 -1.253793 -0.182387
+v 0.208952 -1.253793 0.182387
+v -0.389771 -1.203891 -0.182387
+v -0.402043 -1.162206 0.182387
+v 0.213012 -1.253913 -0.182387
+v 0.213012 -1.253913 0.182387
+v -0.376574 -1.242972 -0.182387
+v -0.389771 -1.203891 0.182387
+v 0.217488 -1.253938 -0.182387
+v 0.217488 -1.253938 0.182387
+v -0.362454 -1.279447 -0.182387
+v -0.376574 -1.242972 0.182387
+v 0.222476 -1.253840 -0.182387
+v 0.222476 -1.253840 0.182387
+v -0.347411 -1.313315 -0.182387
+v -0.362454 -1.279447 0.182387
+v 0.228073 -1.253593 -0.182387
+v 0.228073 -1.253593 0.182387
+v -0.331446 -1.344574 -0.182387
+v -0.347411 -1.313315 0.182387
+v 0.234377 -1.253171 -0.182387
+v 0.234377 -1.253171 0.182387
+v -0.314560 -1.373223 -0.182387
+v -0.331446 -1.344574 0.182387
+v 0.234377 -1.515692 -0.182387
+v 0.234377 -1.515692 0.182387
+v -0.296754 -1.399261 -0.182387
+v -0.314560 -1.373223 0.182387
+v 0.223663 -1.517095 -0.182387
+v 0.223663 -1.517095 0.182387
+v -0.278030 -1.422685 -0.182387
+v -0.296754 -1.399261 0.182387
+v 0.211706 -1.518660 -0.182387
+v 0.211706 -1.518660 0.182387
+v -0.258387 -1.443494 -0.182387
+v -0.278030 -1.422685 0.182387
+v 0.198920 -1.520334 -0.182387
+v 0.198920 -1.520334 0.182387
+v -0.237828 -1.461687 -0.182387
+v -0.258387 -1.443494 0.182387
+v 0.185719 -1.522063 -0.182387
+v 0.185719 -1.522063 0.182387
+v -0.221488 -1.473931 -0.182387
+v -0.237828 -1.461687 0.182387
+v 0.172517 -1.523791 -0.182387
+v 0.172517 -1.523791 0.182387
+v -0.204283 -1.485104 -0.182387
+v -0.221488 -1.473931 0.182387
+v 0.159731 -1.525465 -0.182387
+v 0.159731 -1.525465 0.182387
+v -0.186216 -1.495208 -0.182387
+v -0.204283 -1.485104 0.182387
+v 0.147774 -1.527030 -0.182387
+v 0.147774 -1.527030 0.182387
+v -0.167291 -1.504244 -0.182387
+v -0.186216 -1.495208 0.182387
+v 0.137061 -1.528433 -0.182387
+v 0.137061 -1.528433 0.182387
+v -0.147509 -1.512212 -0.182387
+v -0.167291 -1.504244 0.182387
+v 0.128007 -1.529619 -0.182387
+v 0.128007 -1.529619 0.182387
+v -0.126874 -1.519115 -0.182387
+v -0.147509 -1.512212 0.182387
+v 0.121026 -1.530532 -0.182387
+v 0.121026 -1.530532 0.182387
+v -0.105388 -1.524953 -0.182387
+v -0.126874 -1.519115 0.182387
+v 0.116533 -1.531121 -0.182387
+v 0.116533 -1.531121 0.182387
+v -0.083055 -1.529726 -0.182387
+v -0.105388 -1.524953 0.182387
+v 0.114944 -1.531329 -0.182387
+v 0.114944 -1.531329 0.182387
+v -0.059876 -1.533437 -0.182388
+v -0.083055 -1.529726 0.182387
+v 0.106191 -1.532421 -0.182388
+v 0.106191 -1.532421 0.182386
+v -0.035856 -1.536087 -0.182388
+v -0.059876 -1.533437 0.182386
+v 0.097506 -1.533419 -0.182388
+v 0.097506 -1.533419 0.182386
+v -0.010996 -1.537676 -0.182388
+v -0.035856 -1.536087 0.182386
+v 0.088889 -1.534324 -0.182388
+v 0.088889 -1.534324 0.182386
+v 0.014699 -1.538205 -0.182388
+v -0.010996 -1.537676 0.182386
+v 0.080342 -1.535135 -0.182388
+v 0.080342 -1.535135 0.182386
+v 0.022624 -1.538157 -0.182388
+v 0.014699 -1.538205 0.182386
+v 0.071868 -1.535852 -0.182388
+v 0.071868 -1.535852 0.182386
+v 0.030633 -1.538012 -0.182388
+v 0.022624 -1.538157 0.182386
+v 0.063467 -1.536474 -0.182388
+v 0.063467 -1.536474 0.182386
+v 0.038723 -1.537771 -0.182388
+v 0.030633 -1.538012 0.182386
+v 0.055141 -1.537002 -0.182388
+v 0.055141 -1.537002 0.182386
+v 0.046893 -1.537434 -0.182388
+v 0.038723 -1.537771 0.182386
+v 0.046893 -1.537434 0.182386
+v 0.069721 0.127787 -0.182387
+v -0.507111 0.055574 -0.182387
+v -0.507627 0.137615 -0.182387
+v 0.030318 -0.471963 0.182387
+v -0.465641 -0.453883 0.182387
+v -0.455769 -0.499161 0.182387
+v -0.273302 0.974642 -0.182387
+v -0.292921 0.969356 -0.182387
+v -0.292921 0.969356 0.182387
+v -0.252844 0.977813 -0.182387
+v -0.273302 0.974642 0.182387
+v -0.311702 0.961955 -0.182387
+v -0.311702 0.961955 0.182387
+v -0.231547 0.978869 -0.182387
+v -0.252844 0.977813 0.182387
+v -0.329644 0.952436 -0.182387
+v -0.329644 0.952436 0.182387
+v -0.229829 0.978862 -0.182387
+v -0.231547 0.978869 0.182387
+v -0.346747 0.940799 -0.182387
+v -0.346747 0.940799 0.182387
+v -0.228101 0.978840 -0.182387
+v -0.229829 0.978862 0.182387
+v -0.363012 0.927042 -0.182387
+v -0.363012 0.927042 0.182387
+v -0.226363 0.978804 -0.182387
+v -0.228101 0.978840 0.182387
+v -0.378438 0.911165 -0.182387
+v -0.378438 0.911165 0.182387
+v -0.224615 0.978755 -0.182387
+v -0.226363 0.978804 0.182387
+v -0.393025 0.893167 -0.182387
+v -0.393025 0.893167 0.182387
+v -0.222860 0.978691 -0.182387
+v -0.224615 0.978755 0.182387
+v -0.406773 0.873046 -0.182387
+v -0.406773 0.873046 0.182387
+v -0.221097 0.978614 -0.182387
+v -0.222860 0.978691 0.182387
+v -0.419682 0.850800 -0.182387
+v -0.419682 0.850800 0.182387
+v -0.219327 0.978523 -0.182387
+v -0.221097 0.978614 0.182387
+v -0.431753 0.826431 -0.182387
+v -0.431753 0.826431 0.182387
+v -0.217552 0.978418 -0.182387
+v -0.219327 0.978523 0.182387
+v -0.443828 0.796221 -0.182387
+v -0.443828 0.796221 0.182387
+v -0.215772 0.978299 -0.182387
+v -0.217552 0.978418 0.182387
+v -0.454864 0.761058 -0.182387
+v -0.454864 0.761058 0.182387
+v -0.213988 0.978168 -0.182387
+v -0.215772 0.978299 0.182387
+v -0.464860 0.720945 -0.182387
+v -0.464860 0.720945 0.182387
+v -0.212200 0.978023 -0.182387
+v -0.213988 0.978168 0.182387
+v -0.473812 0.675884 -0.182387
+v -0.473812 0.675884 0.182387
+v -0.210411 0.977865 -0.182387
+v -0.212200 0.978023 0.182387
+v -0.481720 0.625878 -0.182387
+v -0.481720 0.625878 0.182387
+v -0.187470 0.974624 -0.182387
+v -0.210411 0.977865 0.182387
+v -0.488580 0.570931 -0.182387
+v -0.488580 0.570931 0.182387
+v -0.165518 0.969019 -0.182387
+v -0.187470 0.974624 0.182387
+v -0.494391 0.511044 -0.182387
+v -0.494391 0.511044 0.182387
+v -0.144552 0.961056 -0.182387
+v -0.165518 0.969019 0.182387
+v -0.499150 0.446221 -0.182387
+v -0.499150 0.446221 0.182387
+v -0.124571 0.950738 -0.182387
+v -0.144552 0.961056 0.182387
+v -0.502855 0.376463 -0.182387
+v -0.502855 0.376463 0.182387
+v -0.105573 0.938070 -0.182387
+v -0.124571 0.950738 0.182387
+v -0.505505 0.301775 -0.182387
+v -0.505505 0.301775 0.182387
+v -0.087555 0.923059 -0.182387
+v -0.105573 0.938070 0.182387
+v -0.507096 0.222158 -0.182387
+v -0.507096 0.222158 0.182387
+v -0.070516 0.905708 -0.182387
+v -0.087555 0.923059 0.182387
+v -0.507627 0.137615 0.182387
+v -0.054454 0.886023 -0.182387
+v -0.070516 0.905708 0.182387
+v -0.507111 0.055574 0.182387
+v -0.039367 0.864009 -0.182387
+v -0.054454 0.886023 0.182387
+v -0.505560 -0.022395 -0.182387
+v -0.505560 -0.022395 0.182387
+v -0.025253 0.839671 -0.182387
+v -0.039367 0.864009 0.182387
+v -0.502975 -0.096287 -0.182387
+v -0.502975 -0.096287 0.182387
+v -0.012110 0.813014 -0.182387
+v -0.025253 0.839671 0.182387
+v -0.499352 -0.166100 -0.182387
+v -0.499352 -0.166100 0.182387
+v 0.000065 0.784043 -0.182387
+v -0.012110 0.813014 0.182387
+v -0.494692 -0.231832 -0.182387
+v -0.494692 -0.231832 0.182387
+v 0.011252 0.752004 -0.182387
+v 0.000065 0.784043 0.182387
+v -0.488992 -0.293479 -0.182387
+v -0.488992 -0.293479 0.182387
+v 0.021450 0.715855 -0.182387
+v 0.011252 0.752004 0.182387
+v -0.482251 -0.351039 -0.182387
+v -0.482251 -0.351039 0.182387
+v 0.030663 0.675595 -0.182387
+v 0.021450 0.715855 0.182387
+v -0.474468 -0.404507 -0.182387
+v -0.474468 -0.404507 0.182387
+v 0.038893 0.631220 -0.182387
+v 0.030663 0.675595 0.182387
+v -0.465641 -0.453883 -0.182387
+v 0.046143 0.582729 -0.182387
+v 0.038893 0.631220 0.182387
+v -0.455769 -0.499161 -0.182387
+v 0.052417 0.530117 -0.182387
+v 0.046143 0.582729 0.182387
+v -0.444850 -0.540341 -0.182387
+v -0.444850 -0.540341 0.182387
+v 0.057717 0.473383 -0.182387
+v 0.052417 0.530117 0.182387
+v -0.432883 -0.577418 -0.182387
+v -0.432883 -0.577418 0.182387
+v 0.062046 0.412525 -0.182387
+v 0.057717 0.473383 0.182387
+v -0.420633 -0.609377 -0.182387
+v -0.420633 -0.609377 0.182387
+v 0.065408 0.347538 -0.182387
+v 0.062046 0.412525 0.182387
+v -0.407408 -0.638535 -0.182387
+v -0.407408 -0.638535 0.182387
+v 0.067806 0.278422 -0.182387
+v 0.065408 0.347538 0.182387
+v -0.393214 -0.664896 -0.182387
+v -0.393214 -0.664896 0.182387
+v 0.069243 0.205172 -0.182387
+v 0.067806 0.278422 0.182387
+v -0.378055 -0.688465 -0.182387
+v -0.378055 -0.688465 0.182387
+v 0.069243 0.205172 0.182387
+v -0.361938 -0.709246 -0.182387
+v -0.361938 -0.709246 0.182387
+v 0.069238 0.041715 -0.182387
+v 0.069721 0.127787 0.182387
+v -0.344867 -0.727242 -0.182387
+v -0.344867 -0.727242 0.182387
+v 0.067786 -0.039494 -0.182387
+v 0.069238 0.041715 0.182387
+v -0.326849 -0.742459 -0.182387
+v -0.326849 -0.742459 0.182387
+v 0.065364 -0.115843 -0.182387
+v 0.067786 -0.039494 0.182387
+v -0.307887 -0.754899 -0.182387
+v -0.307887 -0.754899 0.182387
+v 0.061970 -0.187334 -0.182387
+v 0.065364 -0.115843 0.182387
+v -0.287989 -0.764568 -0.182387
+v -0.287989 -0.764568 0.182387
+v 0.057600 -0.253967 -0.182387
+v 0.061970 -0.187334 0.182387
+v -0.267158 -0.771469 -0.182387
+v -0.267158 -0.771469 0.182387
+v 0.052252 -0.315745 -0.182387
+v 0.057600 -0.253967 0.182387
+v -0.245400 -0.775607 -0.182387
+v -0.245400 -0.775607 0.182387
+v 0.045924 -0.372668 -0.182387
+v 0.052252 -0.315745 0.182387
+v -0.222722 -0.776985 -0.182387
+v -0.222722 -0.776985 0.182387
+v 0.038614 -0.424741 -0.182387
+v 0.045924 -0.372668 0.182387
+v -0.221695 -0.776981 -0.182387
+v -0.221695 -0.776981 0.182387
+v 0.030318 -0.471963 -0.182387
+v 0.038614 -0.424741 0.182387
+v -0.220669 -0.776970 -0.182387
+v -0.220669 -0.776970 0.182387
+v 0.021036 -0.514336 -0.182387
+v -0.219646 -0.776952 -0.182387
+v -0.219646 -0.776952 0.182387
+v 0.010764 -0.551863 -0.182387
+v 0.021036 -0.514336 0.182387
+v -0.218623 -0.776927 -0.182387
+v -0.218623 -0.776927 0.182387
+v -0.000501 -0.584545 -0.182387
+v 0.010764 -0.551863 0.182387
+v -0.217601 -0.776896 -0.182387
+v -0.217601 -0.776896 0.182387
+v -0.012809 -0.613863 -0.182387
+v -0.000501 -0.584545 0.182387
+v -0.216578 -0.776860 -0.182387
+v -0.216578 -0.776860 0.182387
+v -0.026056 -0.640763 -0.182387
+v -0.012809 -0.613863 0.182387
+v -0.215555 -0.776818 -0.182387
+v -0.215555 -0.776818 0.182387
+v -0.040242 -0.665243 -0.182387
+v -0.026056 -0.640763 0.182387
+v -0.214531 -0.776771 -0.182387
+v -0.214531 -0.776771 0.182387
+v -0.055369 -0.687302 -0.182387
+v -0.040242 -0.665243 0.182387
+v -0.213505 -0.776720 -0.182387
+v -0.213505 -0.776720 0.182387
+v -0.071438 -0.706941 -0.182387
+v -0.055369 -0.687302 0.182387
+v -0.212477 -0.776665 -0.182387
+v -0.212477 -0.776665 0.182387
+v -0.088450 -0.724158 -0.182387
+v -0.071438 -0.706941 0.182387
+v -0.211446 -0.776607 -0.182387
+v -0.211446 -0.776607 0.182387
+v -0.106407 -0.738952 -0.182387
+v -0.088450 -0.724158 0.182387
+v -0.210411 -0.776546 -0.182387
+v -0.210411 -0.776546 0.182387
+v -0.125311 -0.751321 -0.182387
+v -0.106407 -0.738952 0.182387
+v -0.187710 -0.773880 -0.182387
+v -0.187710 -0.773880 0.182387
+v -0.145162 -0.761267 -0.182387
+v -0.125311 -0.751321 0.182387
+v -0.165961 -0.768786 -0.182387
+v -0.165961 -0.768786 0.182387
+v -0.145162 -0.761267 0.182387
+v -0.836574 2.034443 -0.182386
+v -1.543393 -1.434298 -0.182387
+v -1.543393 -1.802300 -0.182388
+v -1.543393 -2.132013 -0.182388
+v -1.543393 1.356561 -0.182387
+v -1.543393 1.141716 -0.182387
+v -1.543393 0.863055 -0.182387
+v -1.543393 0.533343 -0.182387
+v -1.543393 0.165341 -0.182387
+v -0.683363 2.009288 -0.182386
+v -0.484644 1.976661 -0.182386
+v -0.249518 1.938057 -0.182386
+v 0.012913 1.894969 -0.182386
+v 0.293547 1.848894 -0.182386
+v 1.153652 1.707676 -0.182386
+v 1.416083 1.664589 -0.182386
+v 1.651209 1.378124 -0.182387
+v 1.651209 1.625984 -0.182386
+v 1.651209 1.101481 -0.182387
+v 0.293547 1.848894 0.182388
+v -0.683363 2.009288 0.182388
+v -0.484644 1.976661 0.182388
+v -0.249518 1.938057 0.182388
+v 0.012913 1.894969 0.182388
+v 0.873018 1.753752 0.182388
+v 1.153652 1.707676 0.182388
+v 1.416083 1.664589 0.182388
+v 1.651209 1.378124 0.182387
+v 1.651209 1.625984 0.182388
+v 1.651209 1.101481 0.182387
+v -1.543393 -1.434298 0.182387
+v -1.543393 -1.802300 0.182386
+v -1.543393 1.356561 0.182387
+v -1.543393 1.141716 0.182387
+v -1.543393 0.863055 0.182387
+v -1.543393 -0.634479 0.182387
+v -1.543393 0.533343 0.182387
+v -1.543393 -0.228187 0.182387
+v 1.651209 -0.835023 -0.182387
+v 1.651209 -0.625542 -0.182387
+v 1.651209 0.805648 -0.182387
+v 1.651209 0.194794 -0.182387
+v 1.651209 -0.101039 -0.182387
+v 1.651209 -0.377682 -0.182387
+v 1.651209 -0.101039 0.182387
+v 1.651209 -0.625542 0.182387
+v 1.651209 0.194794 0.182387
+v 1.651209 -0.377682 0.182387
+vn 0.943300 -0.332000 0.000000
+vn 0.906700 -0.421700 0.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.970600 -0.240500 0.000000
+vn -0.000000 -0.000000 1.000000
+vn 0.860000 -0.510200 0.000000
+vn 0.050100 -0.998700 -0.000000
+vn 0.045400 -0.999000 -0.000000
+vn 0.045700 -0.999000 -0.000000
+vn 0.039800 -0.999200 -0.000000
+vn 0.040000 -0.999200 -0.000000
+vn 0.032900 -0.999500 -0.000000
+vn 0.033000 -0.999500 0.000000
+vn 0.032600 -0.999500 -0.000000
+vn 0.025300 -0.999700 -0.000000
+vn 0.025600 -0.999700 -0.000000
+vn 0.018200 -0.999800 -0.000000
+vn 0.018000 -0.999800 -0.000000
+vn 0.010500 -0.999900 -0.000000
+vn 0.010400 -0.999900 -0.000000
+vn 0.003300 -1.000000 -0.000000
+vn 0.003200 -1.000000 -0.000000
+vn -0.027200 -0.999600 -0.000000
+vn -0.086700 -0.996200 -0.000000
+vn -0.152500 -0.988300 -0.000000
+vn -0.224600 -0.974500 -0.000000
+vn -0.301200 -0.953600 -0.000000
+vn -0.380700 -0.924700 -0.000000
+vn -0.460400 -0.887700 -0.000000
+vn -0.537400 -0.843300 -0.000000
+vn -0.609300 -0.793000 -0.000000
+vn -0.674100 -0.738700 -0.000000
+vn -0.730400 -0.683100 -0.000000
+vn -0.730400 -0.683000 -0.000000
+vn -0.778100 -0.628200 -0.000000
+vn -0.836100 -0.548600 -0.000000
+vn -0.836000 -0.548700 -0.000000
+vn -0.899000 -0.437900 -0.000000
+vn -0.938800 -0.344400 -0.000000
+vn -0.963600 -0.267500 -0.000000
+vn -0.978700 -0.205500 -0.000000
+vn -0.987800 -0.155500 -0.000000
+vn -0.993300 -0.115400 -0.000000
+vn -0.996500 -0.083100 -0.000000
+vn -0.998400 -0.056900 -0.000000
+vn -0.999400 -0.036000 -0.000000
+vn -0.999800 -0.019100 -0.000000
+vn -1.000000 -0.005700 -0.000000
vn -1.000000 0.000000 0.000000
-vn 0.049600 0.000000 -0.998800
-vn -0.076200 0.000000 0.997100
-vn -0.105200 0.000000 0.994400
-vn 0.973500 0.000000 0.228800
-vn -0.071500 0.000000 0.997400
+vn 0.049600 0.998800 0.000000
+vn -0.076200 -0.997100 -0.000000
+vn -0.105200 -0.994400 0.000000
+vn 0.973500 -0.228800 -0.000000
+vn -0.071500 -0.997400 -0.000000
vn 1.000000 0.000000 0.000000
-vn 0.052500 0.000000 -0.998600
-vn 0.999800 0.000000 -0.021400
-vn 0.997800 0.000000 -0.066100
-vn 0.993500 0.000000 -0.113400
-vn 0.986600 0.000000 -0.163300
-vn 0.976400 0.000000 -0.215800
-vn 0.962600 0.000000 -0.270800
-vn 0.944600 0.000000 -0.328200
-vn 0.921800 0.000000 -0.387700
-vn 0.893600 0.000000 -0.448900
-vn 0.859500 0.000000 -0.511100
-vn 0.819000 0.000000 -0.573800
-vn 0.771800 0.000000 -0.635800
-vn 0.718300 0.000000 -0.695700
-vn 0.656000 0.000000 -0.754800
-vn 0.589800 0.000000 -0.807500
-vn 0.521500 0.000000 -0.853200
-vn 0.452300 0.000000 -0.891800
-vn 0.383700 0.000000 -0.923500
-vn 0.316600 0.000000 -0.948600
-vn 0.251800 0.000000 -0.967800
-vn 0.190000 0.000000 -0.981800
-vn 0.131400 0.000000 -0.991300
-vn 0.076300 0.000000 -0.997100
-vn 0.024600 0.000000 -0.999700
-vn 0.998800 0.000000 0.049500
-vn 0.989200 0.000000 0.146500
-vn 0.801600 0.000000 0.597800
-vn 0.729300 0.000000 0.684200
-vn 0.640400 0.000000 0.768100
-vn 0.532000 0.000000 0.846700
-vn 0.402500 0.000000 0.915400
-vn 0.252300 0.000000 0.967700
-vn 0.166000 0.000000 0.986100
-vn -0.997800 0.000000 -0.065600
-vn -0.979900 0.000000 -0.199400
-vn -0.943000 0.000000 -0.332900
-vn -0.886600 0.000000 -0.462600
-vn -0.811000 0.000000 -0.585000
-vn -0.717300 0.000000 -0.696700
-vn -0.607000 0.000000 -0.794700
-vn -0.482300 0.000000 -0.876000
-vn -0.346000 0.000000 -0.938200
-vn -0.201900 0.000000 -0.979400
-vn -0.054400 0.000000 -0.998500
-vn 0.091800 0.000000 -0.995800
-vn 0.162000 0.000000 -0.986800
-vn 0.440300 0.000000 0.897800
-vn 0.406900 0.000000 0.913500
-vn 0.374200 0.000000 0.927300
-vn 0.342200 0.000000 0.939600
-vn 0.310600 0.000000 0.950600
-vn 0.279100 0.000000 0.960300
-vn 0.247600 0.000000 0.968900
-vn 0.215700 0.000000 0.976500
-vn 0.183100 0.000000 0.983100
-vn 0.149600 0.000000 0.988700
-vn 0.114600 0.000000 0.993400
-vn 0.077700 0.000000 0.997000
-vn 0.056000 0.000000 0.998400
-vn 0.056400 0.000000 0.998400
-vn 0.055800 0.000000 0.998400
-vn 0.053400 0.000000 0.998600
-vn -0.003900 0.000000 -1.000000
-vn -0.053000 0.000000 -0.998600
-vn -0.059300 0.000000 -0.998200
-vn -0.065600 0.000000 -0.997800
-vn -0.071700 0.000000 -0.997400
-vn -0.077700 0.000000 -0.997000
-vn -0.100200 0.000000 -0.995000
-vn -0.130800 0.000000 -0.991400
-vn -0.160800 0.000000 -0.987000
-vn -0.190200 0.000000 -0.981800
-vn -0.218500 0.000000 -0.975800
-vn -0.245800 0.000000 -0.969300
-vn -0.271800 0.000000 -0.962400
-vn -0.296400 0.000000 -0.955100
-vn -0.319600 0.000000 -0.947600
-vn -0.341200 0.000000 -0.940000
-vn -0.361400 0.000000 -0.932400
-vn -0.380100 0.000000 -0.924900
-vn -0.011400 0.000000 -0.999900
-vn -0.018900 0.000000 -0.999800
-vn -0.026000 0.000000 -0.999700
-vn -0.033000 0.000000 -0.999500
-vn -0.039800 0.000000 -0.999200
-vn -0.046500 0.000000 -0.998900
-vn -0.970800 0.000000 -0.239800
-vn -0.979100 0.000000 -0.203200
-vn -0.960200 0.000000 -0.279200
-vn -0.985600 0.000000 -0.169100
-vn -0.947000 0.000000 -0.321200
-vn -0.990500 0.000000 -0.137400
-vn -0.930600 0.000000 -0.366000
-vn -0.994100 0.000000 -0.108100
-vn -0.910000 0.000000 -0.414700
-vn -0.996700 0.000000 -0.080800
-vn -0.885200 0.000000 -0.465200
-vn -0.998500 0.000000 -0.055500
-vn -0.855600 0.000000 -0.517600
-vn -0.999500 0.000000 -0.032100
-vn -0.820700 0.000000 -0.571400
-vn -0.999900 0.000000 -0.010300
-vn -0.780100 0.000000 -0.625700
-vn -0.999900 0.000000 0.012900
-vn -0.733600 0.000000 -0.679600
-vn -0.999200 0.000000 0.040200
-vn -0.681300 0.000000 -0.732000
-vn -0.997600 0.000000 0.070000
-vn -0.623700 0.000000 -0.781600
-vn -0.994800 0.000000 0.102300
-vn -0.561500 0.000000 -0.827500
-vn -0.990500 0.000000 0.137400
-vn -0.495700 0.000000 -0.868500
-vn -0.984500 0.000000 0.175600
-vn -0.427500 0.000000 -0.904000
-vn -0.976200 0.000000 0.216900
-vn -0.358300 0.000000 -0.933600
-vn -0.965200 0.000000 0.261500
-vn -0.978800 0.000000 0.204700
-vn -0.950900 0.000000 0.309500
-vn -0.972500 0.000000 0.233000
-vn -0.932700 0.000000 0.360700
-vn -0.964500 0.000000 0.264000
-vn -0.909800 0.000000 0.415100
-vn -0.954500 0.000000 0.298200
-vn -0.881600 0.000000 0.472000
-vn -0.941900 0.000000 0.335900
-vn -0.848000 0.000000 0.530000
-vn -0.926100 0.000000 0.377300
-vn -0.806700 0.000000 0.591000
-vn -0.906200 0.000000 0.422800
-vn -0.758500 0.000000 0.651700
-vn -0.881300 0.000000 0.472600
-vn -0.703400 0.000000 0.710800
-vn -0.850100 0.000000 0.526700
-vn -0.642000 0.000000 0.766700
-vn -0.811200 0.000000 0.584700
-vn -0.575300 0.000000 0.817900
-vn -0.763200 0.000000 0.646100
-vn -0.504600 0.000000 0.863400
-vn -0.704700 0.000000 0.709500
-vn -0.431400 0.000000 0.902100
-vn -0.641800 0.000000 0.766900
-vn -0.357600 0.000000 0.933900
-vn -0.591800 0.000000 0.806100
-vn -0.284700 0.000000 0.958600
-vn -0.541500 0.000000 0.840700
-vn -0.213900 0.000000 0.976800
-vn -0.491700 0.000000 0.870800
-vn -0.146500 0.000000 0.989200
-vn -0.442800 0.000000 0.896600
-vn -0.111600 0.000000 0.993800
-vn -0.395500 0.000000 0.918400
-vn -0.102400 0.000000 0.994700
-vn -0.350100 0.000000 0.936700
-vn -0.093200 0.000000 0.995600
-vn -0.306800 0.000000 0.951800
-vn -0.083800 0.000000 0.996500
-vn -0.265800 0.000000 0.964000
-vn -0.074400 0.000000 0.997200
-vn -0.227100 0.000000 0.973900
-vn -0.064800 0.000000 0.997900
-vn -0.190700 0.000000 0.981600
-vn -0.055100 0.000000 0.998500
-vn -0.156700 0.000000 0.987600
-vn -0.045300 0.000000 0.999000
-vn -0.131700 0.000000 0.991300
-vn -0.035400 0.000000 0.999400
-vn -0.042900 0.000000 0.999100
-vn -0.025400 0.000000 0.999700
-vn 0.028700 0.000000 0.999600
-vn -0.015300 0.000000 0.999900
-vn 0.079200 0.000000 0.996900
-vn -0.005100 0.000000 1.000000
-vn 0.116500 0.000000 0.993200
-vn 0.033100 0.000000 0.999500
-vn 0.131800 0.000000 0.991300
-vn 0.102600 0.000000 0.994700
-vn 0.132600 0.000000 0.991200
-vn 0.175900 0.000000 0.984400
-vn 0.113000 0.000000 0.993600
-vn 0.252000 0.000000 0.967700
-vn 0.078000 0.000000 0.997000
-vn 0.329800 0.000000 0.944000
-vn 0.024500 0.000000 0.999700
-vn 0.407700 0.000000 0.913100
-vn -0.040100 0.000000 0.999200
-vn 0.483900 0.000000 0.875100
-vn -0.120000 0.000000 0.992800
-vn 0.556800 0.000000 0.830600
-vn -0.091700 0.000000 0.995800
-vn 0.624900 0.000000 0.780700
-vn -0.013900 0.000000 0.999900
-vn 0.687100 0.000000 0.726600
-vn 0.048400 0.000000 0.998800
-vn 0.742600 0.000000 0.669800
-vn 0.093000 0.000000 0.995700
-vn 0.791100 0.000000 0.611700
-vn 0.123200 0.000000 0.992400
-vn 0.835900 0.000000 0.548800
-vn 0.138300 0.000000 0.990400
-vn 0.876200 0.000000 0.481900
-vn 0.141500 0.000000 0.989900
-vn 0.908600 0.000000 0.417800
-vn 0.131300 0.000000 0.991300
-vn 0.934000 0.000000 0.357300
-vn 0.106300 0.000000 0.994300
-vn 0.953700 0.000000 0.300900
-vn 0.067100 0.000000 0.997700
-vn 0.968600 0.000000 0.248700
-vn 0.012100 0.000000 0.999900
-vn 0.979700 0.000000 0.200700
-vn -0.060500 0.000000 0.998200
-vn 0.987700 0.000000 0.156600
-vn 0.993200 0.000000 0.116300
-vn -0.061600 0.000000 0.998100
-vn 0.996800 0.000000 0.079300
-vn -0.035800 0.000000 0.999400
-vn 0.999000 0.000000 0.045500
-vn -0.015000 0.000000 0.999900
-vn 0.999900 0.000000 0.014500
-vn 0.001700 0.000000 1.000000
-vn 0.999900 0.000000 -0.011400
-vn 0.014100 0.000000 0.999900
-vn 0.999400 0.000000 -0.035600
-vn 0.022400 0.000000 0.999700
-vn 0.998100 0.000000 -0.061800
-vn 0.026800 0.000000 0.999600
-vn 0.995900 0.000000 -0.090200
-vn 0.027200 0.000000 0.999600
-vn 0.992700 0.000000 -0.120900
-vn 0.023800 0.000000 0.999700
-vn 0.988000 0.000000 -0.154300
-vn 0.017000 0.000000 0.999900
-vn 0.981700 0.000000 -0.190600
-vn 0.006500 0.000000 1.000000
-vn 0.973200 0.000000 -0.230000
-vn 0.000000 0.000000 1.000000
-vn 0.962100 0.000000 -0.272800
-vn 0.947700 0.000000 -0.319200
-vn 0.929300 0.000000 -0.369200
-vn 0.906200 0.000000 -0.422800
-vn 0.878800 0.000000 -0.477200
-vn 0.848000 0.000000 -0.530000
-vn 0.811600 0.000000 -0.584200
-vn 0.769100 0.000000 -0.639100
-vn 0.720400 0.000000 -0.693600
-vn 0.665400 0.000000 -0.746500
-vn 0.604400 0.000000 -0.796700
-vn 0.538200 0.000000 -0.842800
-vn -0.013800 0.000000 0.999900
-vn 0.467900 0.000000 -0.883800
-vn -0.039400 0.000000 0.999200
-vn 0.394700 0.000000 -0.918800
-vn -0.059200 0.000000 0.998200
-vn 0.320100 0.000000 -0.947400
-vn -0.071000 0.000000 0.997500
-vn 0.245500 0.000000 -0.969400
-vn -0.073400 0.000000 0.997300
-vn 0.976200 0.000000 -0.216900
-vn -0.066100 0.000000 0.997800
-vn 0.968700 0.000000 -0.248200
-vn -0.050700 0.000000 0.998700
-vn 0.959300 0.000000 -0.282400
-vn -0.029600 0.000000 0.999600
-vn 0.947400 0.000000 -0.319900
-vn -0.005500 0.000000 1.000000
-vn 0.932600 0.000000 -0.361000
-vn 0.019700 0.000000 0.999800
-vn 0.913900 0.000000 -0.405900
-vn 0.044000 0.000000 0.999000
-vn 0.890600 0.000000 -0.454800
-vn 0.066700 0.000000 0.997800
-vn 0.861500 0.000000 -0.507800
-vn 0.825400 0.000000 -0.564500
-vn -0.129800 0.000000 -0.991500
-vn 0.781100 0.000000 -0.624400
-vn 0.727200 0.000000 -0.686400
-vn 0.662700 0.000000 -0.748900
-vn 0.599600 0.000000 -0.800300
-vn 0.544700 0.000000 -0.838700
-vn 0.488100 0.000000 -0.872800
-vn 0.430900 0.000000 -0.902400
-vn 0.373600 0.000000 -0.927600
-vn 0.317200 0.000000 -0.948400
-vn 0.262200 0.000000 -0.965000
-vn 0.209000 0.000000 -0.977900
-vn 0.158100 0.000000 -0.987400
-vn -0.123800 0.000000 -0.992300
-vn 0.109600 0.000000 -0.994000
-vn -0.114200 0.000000 -0.993500
-vn 0.063800 0.000000 -0.998000
-vn -0.104400 0.000000 -0.994500
-vn 0.020600 0.000000 -0.999800
-vn -0.094500 0.000000 -0.995500
-vn -0.006100 0.000000 -1.000000
-vn -0.084300 0.000000 -0.996400
-vn -0.018100 0.000000 -0.999800
-vn -0.073900 0.000000 -0.997300
-vn -0.029800 0.000000 -0.999600
-vn -0.063200 0.000000 -0.998000
-vn -0.041200 0.000000 -0.999200
-vn -0.052300 0.000000 -0.998600
-vn -0.260100 0.000000 -0.965600
-vn -0.153200 0.000000 -0.988200
-vn -0.366700 0.000000 -0.930400
-vn -0.049500 0.000000 -0.998800
-vn -0.468700 0.000000 -0.883400
-vn 0.004200 0.000000 -1.000000
-vn -0.562500 0.000000 -0.826800
-vn 0.012500 0.000000 -0.999900
-vn -0.645800 0.000000 -0.763500
-vn -0.717200 0.000000 -0.696800
-vn 0.028300 0.000000 -0.999600
-vn -0.776900 0.000000 -0.629600
-vn 0.036300 0.000000 -0.999300
-vn -0.825700 0.000000 -0.564200
-vn 0.044000 0.000000 -0.999000
-vn -0.864900 0.000000 -0.501900
-vn 0.051500 0.000000 -0.998700
-vn -0.896100 0.000000 -0.443900
-vn 0.059000 0.000000 -0.998300
-vn -0.928600 0.000000 -0.371100
-vn 0.066300 0.000000 -0.997800
-vn -0.954100 0.000000 -0.299500
-vn 0.073500 0.000000 -0.997300
-vn -0.970300 0.000000 -0.241800
-vn 0.080800 0.000000 -0.996700
-vn -0.980800 0.000000 -0.194900
-vn 0.088100 0.000000 -0.996100
-vn -0.987700 0.000000 -0.156200
-vn 0.139900 0.000000 -0.990200
-vn -0.992300 0.000000 -0.123900
-vn 0.247400 0.000000 -0.968900
-vn -0.995300 0.000000 -0.096600
-vn 0.355100 0.000000 -0.934800
-vn -0.997300 0.000000 -0.073200
-vn 0.458800 0.000000 -0.888500
-vn -0.998600 0.000000 -0.053000
-vn 0.554800 0.000000 -0.832000
-vn -0.999400 0.000000 -0.035400
-vn 0.640100 0.000000 -0.768300
-vn -0.999800 0.000000 -0.020000
-vn 0.713500 0.000000 -0.700700
-vn -1.000000 0.000000 -0.006300
-vn 0.774800 0.000000 -0.632200
-vn -1.000000 0.000000 0.006300
-vn 0.824900 0.000000 -0.565300
-vn -0.999800 0.000000 0.019900
-vn 0.865100 0.000000 -0.501700
-vn -0.999400 0.000000 0.035000
-vn 0.896900 0.000000 -0.442200
-vn -0.998700 0.000000 0.051800
-vn 0.921900 0.000000 -0.387400
-vn -0.997500 0.000000 0.070700
-vn 0.944100 0.000000 -0.329700
-vn -0.995800 0.000000 0.092100
-vn 0.962400 0.000000 -0.271500
-vn -0.993200 0.000000 0.116300
-vn 0.974800 0.000000 -0.223100
-vn -0.989600 0.000000 0.144000
-vn 0.983200 0.000000 -0.182400
-vn -0.984400 0.000000 0.176000
-vn 0.989000 0.000000 -0.147900
-vn -0.977000 0.000000 0.213000
-vn 0.993000 0.000000 -0.118400
-vn -0.966600 0.000000 0.256300
-vn 0.995700 0.000000 -0.093000
-vn -0.951700 0.000000 0.307200
-vn 0.997500 0.000000 -0.071000
-vn -0.933800 0.000000 0.357900
-vn 0.998700 0.000000 -0.051700
-vn -0.910700 0.000000 0.413100
-vn 0.999400 0.000000 -0.034700
-vn -0.880500 0.000000 0.474100
-vn 0.999800 0.000000 -0.019600
-vn -0.841100 0.000000 0.540900
-vn 1.000000 0.000000 -0.006200
-vn -0.790200 0.000000 0.612900
-vn 1.000000 0.000000 0.005600
-vn -0.725500 0.000000 0.688200
-vn 0.999800 0.000000 0.017900
-vn -0.645200 0.000000 0.764000
-vn 0.999500 0.000000 0.031700
-vn -0.548600 0.000000 0.836100
-vn 0.998900 0.000000 0.047400
-vn -0.437000 0.000000 0.899400
-vn 0.997900 0.000000 0.065400
-vn -0.314500 0.000000 0.949300
-vn 0.996300 0.000000 0.086200
-vn -0.186800 0.000000 0.982400
-vn 0.993900 0.000000 0.110500
-vn -0.060700 0.000000 0.998200
-vn 0.990300 0.000000 0.139000
-vn 0.003700 0.000000 1.000000
-vn 0.984900 0.000000 0.173000
-vn 0.011000 0.000000 0.999900
-vn 0.976800 0.000000 0.214000
-vn 0.017700 0.000000 0.999800
-vn 0.964500 0.000000 0.264000
-vn 0.024300 0.000000 0.999700
-vn 0.945400 0.000000 0.325800
-vn 0.030200 0.000000 0.999500
-vn 0.922000 0.000000 0.387100
-vn 0.035600 0.000000 0.999400
-vn 0.897100 0.000000 0.441800
-vn 0.040900 0.000000 0.999200
-vn 0.865200 0.000000 0.501400
-vn 0.045600 0.000000 0.999000
-vn 0.824700 0.000000 0.565500
-vn 0.049500 0.000000 0.998800
-vn 0.773900 0.000000 0.633300
-vn 0.053200 0.000000 0.998600
-vn 0.711300 0.000000 0.702900
-vn 0.056500 0.000000 0.998400
-vn 0.635800 0.000000 0.771800
-vn 0.059400 0.000000 0.998200
-vn 0.547600 0.000000 0.836800
-vn 0.116600 0.000000 0.993200
-vn 0.447900 0.000000 0.894100
-vn 0.228000 0.000000 0.973700
-vn 0.340000 0.000000 0.940400
-vn 0.000000 -1.000000 0.007100
-vn 0.000000 -1.000000 -0.007300
-vn 0.000000 -1.000000 0.004000
-vn 0.000000 -1.000000 -0.000100
-vn 0.000000 -1.000000 0.000600
-vn 0.000000 -1.000000 -0.000900
-vn 0.000000 -1.000000 -0.000700
-vn 0.000000 -1.000000 0.000100
-vn 0.000000 -1.000000 -0.000200
-vn 0.000000 1.000000 0.000100
-vn 0.000000 1.000000 -0.000100
-vn 0.000000 1.000000 -0.000200
-vn 0.050200 0.000000 0.998700
-vn 0.045500 0.000000 0.999000
-vn 0.039900 0.000000 0.999200
-vn 0.010600 0.000000 0.999900
-vn 0.003300 0.000000 1.000000
-vn -0.086700 0.000000 0.996200
-vn 0.055900 0.000000 0.998400
-vn 0.056200 0.000000 0.998400
-vn 0.053500 0.000000 0.998600
-vn -0.065500 0.000000 -0.997900
-vn -0.011500 0.000000 -0.999900
-vn -0.046400 0.000000 -0.998900
-vn -0.641700 0.000000 0.766900
-vn -0.395500 0.000000 0.918500
-vn -0.102500 0.000000 0.994700
-vn -0.093200 0.000000 0.995700
-vn -0.227000 0.000000 0.973900
-vn -0.064700 0.000000 0.997900
-vn -0.129900 0.000000 0.991500
-vn -0.044800 0.000000 0.999000
-vn 0.080100 0.000000 0.996800
-vn -0.005200 0.000000 1.000000
-vn 0.132700 0.000000 0.991200
-vn 0.130800 0.000000 0.991400
-vn 0.114800 0.000000 0.993400
-vn 0.026300 0.000000 0.999700
-vn -0.120900 0.000000 0.992700
-vn -0.091000 0.000000 0.995800
-vn -0.013200 0.000000 0.999900
-vn 0.123500 0.000000 0.992300
-vn 0.138600 0.000000 0.990300
-vn 0.141900 0.000000 0.989900
-vn 0.131000 0.000000 0.991400
-vn 0.105600 0.000000 0.994400
-vn 0.011500 0.000000 0.999900
-vn -0.060200 0.000000 0.998200
-vn -0.061500 0.000000 0.998100
-vn -0.035900 0.000000 0.999400
-vn 0.022500 0.000000 0.999700
-vn 0.026700 0.000000 0.999600
-vn 0.023900 0.000000 0.999700
-vn 0.006400 0.000000 1.000000
-vn -0.013700 0.000000 0.999900
-vn -0.039300 0.000000 0.999200
-vn -0.059300 0.000000 0.998200
-vn -0.071100 0.000000 0.997500
-vn -0.073300 0.000000 0.997300
-vn -0.066000 0.000000 0.997800
-vn -0.005400 0.000000 1.000000
-vn 0.066800 0.000000 0.997800
-vn 0.317200 0.000000 -0.948300
-vn -0.104500 0.000000 -0.994500
-vn -0.073800 0.000000 -0.997300
-vn -0.063300 0.000000 -0.998000
-vn 0.000000 -1.000000 -0.004600
-vn 0.000000 -1.000000 0.001100
-vn 0.000000 1.000000 0.004400
-vn 0.000000 1.000000 -0.003800
-vn 0.000000 1.000000 -0.000400
-vn 0.004300 0.000000 -1.000000
-vn 0.028200 0.000000 -0.999600
-vn 0.036200 0.000000 -0.999300
-vn 0.058900 0.000000 -0.998300
-vn 0.066400 0.000000 -0.997800
-vn 0.073600 0.000000 -0.997300
-vn 0.003800 0.000000 1.000000
-vn 0.017900 0.000000 0.999800
-vn 0.024100 0.000000 0.999700
-vn 0.030400 0.000000 0.999500
-vn 0.035800 0.000000 0.999400
-vn 0.049600 0.000000 0.998800
-vn 0.053300 0.000000 0.998600
-vn 0.059300 0.000000 0.998200
+vn 0.052500 0.998600 0.000000
+vn 0.999800 0.021400 0.000000
+vn 0.997800 0.066100 0.000000
+vn 0.993500 0.113400 0.000000
+vn 0.986600 0.163300 0.000000
+vn 0.976400 0.215800 0.000000
+vn 0.962600 0.270800 0.000000
+vn 0.944600 0.328200 0.000000
+vn 0.921800 0.387700 0.000000
+vn 0.893600 0.448900 0.000000
+vn 0.859500 0.511100 0.000000
+vn 0.819000 0.573800 0.000000
+vn 0.771800 0.635800 0.000000
+vn 0.718300 0.695700 0.000000
+vn 0.656000 0.754800 0.000000
+vn 0.589800 0.807500 0.000000
+vn 0.521500 0.853200 0.000000
+vn 0.452300 0.891800 0.000000
+vn 0.383700 0.923500 0.000000
+vn 0.316500 0.948600 0.000000
+vn 0.251800 0.967800 0.000000
+vn 0.190000 0.981800 0.000000
+vn 0.131400 0.991300 0.000000
+vn 0.076300 0.997100 0.000000
+vn 0.024600 0.999700 0.000000
+vn 0.998800 -0.049500 0.000000
+vn 0.989200 -0.146500 0.000000
+vn 0.801600 -0.597800 0.000000
+vn 0.729300 -0.684200 0.000000
+vn 0.640300 -0.768100 0.000000
+vn 0.532100 -0.846700 0.000000
+vn 0.402500 -0.915400 0.000000
+vn 0.252300 -0.967700 0.000000
+vn 0.166000 -0.986100 0.000000
+vn -0.997800 0.065600 0.000000
+vn -0.979900 0.199400 0.000000
+vn -0.943000 0.332900 0.000000
+vn -0.886600 0.462600 0.000000
+vn -0.811000 0.585000 0.000000
+vn -0.717300 0.696700 0.000000
+vn -0.607000 0.794700 0.000000
+vn -0.482300 0.876000 0.000000
+vn -0.346000 0.938200 0.000000
+vn -0.201900 0.979400 0.000000
+vn -0.054400 0.998500 0.000000
+vn 0.091800 0.995800 0.000000
+vn 0.162000 0.986800 0.000000
+vn 0.440300 -0.897900 -0.000000
+vn 0.407000 -0.913400 -0.000000
+vn 0.406900 -0.913500 -0.000000
+vn 0.374200 -0.927400 -0.000000
+vn 0.342200 -0.939600 -0.000000
+vn 0.310600 -0.950500 -0.000000
+vn 0.279100 -0.960300 -0.000000
+vn 0.247600 -0.968900 -0.000000
+vn 0.215700 -0.976500 -0.000000
+vn 0.183200 -0.983100 -0.000000
+vn 0.149500 -0.988800 -0.000000
+vn 0.114600 -0.993400 -0.000000
+vn 0.077600 -0.997000 -0.000000
+vn 0.056300 -0.998400 -0.000000
+vn 0.055900 -0.998400 -0.000000
+vn 0.056200 -0.998400 -0.000000
+vn 0.056000 -0.998400 -0.000000
+vn 0.055800 -0.998400 -0.000000
+vn 0.053300 -0.998600 -0.000000
+vn 0.053700 -0.998600 -0.000000
+vn -0.003900 1.000000 0.000000
+vn -0.052900 0.998600 0.000000
+vn -0.059200 0.998200 0.000000
+vn -0.065600 0.997800 0.000000
+vn -0.071800 0.997400 0.000000
+vn -0.077600 0.997000 0.000000
+vn -0.100200 0.995000 0.000000
+vn -0.130800 0.991400 0.000000
+vn -0.160800 0.987000 0.000000
+vn -0.190200 0.981800 0.000000
+vn -0.218500 0.975800 0.000000
+vn -0.245800 0.969300 0.000000
+vn -0.271800 0.962400 0.000000
+vn -0.296400 0.955100 0.000000
+vn -0.319600 0.947600 0.000000
+vn -0.341200 0.940000 0.000000
+vn -0.361400 0.932400 0.000000
+vn -0.380100 0.925000 0.000000
+vn -0.011500 0.999900 0.000000
+vn -0.018800 0.999800 0.000000
+vn -0.026200 0.999700 0.000000
+vn -0.032900 0.999500 0.000000
+vn -0.039800 0.999200 0.000000
+vn -0.046700 0.998900 0.000000
+vn -0.970800 0.239800 0.000000
+vn -0.979100 0.203200 0.000000
+vn -0.960200 0.279200 0.000000
+vn -0.985600 0.169100 0.000000
+vn -0.947000 0.321200 0.000000
+vn -0.990500 0.137400 0.000000
+vn -0.930600 0.365900 0.000000
+vn -0.994100 0.108100 0.000000
+vn -0.994100 0.108000 0.000000
+vn -0.910000 0.414700 0.000000
+vn -0.996700 0.080800 0.000000
+vn -0.885200 0.465200 0.000000
+vn -0.998500 0.055500 0.000000
+vn -0.855600 0.517600 0.000000
+vn -0.999500 0.032100 0.000000
+vn -0.820700 0.571300 0.000000
+vn -0.999900 0.010300 0.000000
+vn -0.780100 0.625700 0.000000
+vn -0.999900 -0.012900 -0.000000
+vn -0.733600 0.679600 0.000000
+vn -0.999200 -0.040200 -0.000000
+vn -0.681300 0.732000 0.000000
+vn -0.997600 -0.070000 -0.000000
+vn -0.623800 0.781600 0.000000
+vn -0.994800 -0.102300 -0.000000
+vn -0.561500 0.827500 0.000000
+vn -0.990500 -0.137400 -0.000000
+vn -0.495700 0.868500 0.000000
+vn -0.984500 -0.175600 -0.000000
+vn -0.427500 0.904000 0.000000
+vn -0.976200 -0.216900 -0.000000
+vn -0.358300 0.933600 0.000000
+vn -0.965200 -0.261500 -0.000000
+vn -0.978800 -0.204700 0.000000
+vn -0.950900 -0.309500 -0.000000
+vn -0.972500 -0.233000 0.000000
+vn -0.932700 -0.360700 -0.000000
+vn -0.964500 -0.264100 0.000000
+vn -0.909800 -0.415100 -0.000000
+vn -0.954500 -0.298200 0.000000
+vn -0.881600 -0.472000 -0.000000
+vn -0.941900 -0.335900 0.000000
+vn -0.848000 -0.530000 -0.000000
+vn -0.926100 -0.377300 0.000000
+vn -0.806700 -0.591000 0.000000
+vn -0.906200 -0.422900 0.000000
+vn -0.758500 -0.651700 0.000000
+vn -0.881300 -0.472600 0.000000
+vn -0.703400 -0.710800 0.000000
+vn -0.850100 -0.526600 0.000000
+vn -0.642000 -0.766700 0.000000
+vn -0.811200 -0.584800 0.000000
+vn -0.575300 -0.817900 0.000000
+vn -0.763300 -0.646100 0.000000
+vn -0.504600 -0.863400 0.000000
+vn -0.704700 -0.709500 0.000000
+vn -0.431400 -0.902100 0.000000
+vn -0.641700 -0.766900 0.000000
+vn -0.357600 -0.933900 0.000000
+vn -0.591700 -0.806100 0.000000
+vn -0.284700 -0.958600 0.000000
+vn -0.541500 -0.840700 0.000000
+vn -0.213900 -0.976900 0.000000
+vn -0.491700 -0.870800 0.000000
+vn -0.146500 -0.989200 0.000000
+vn -0.442800 -0.896600 0.000000
+vn -0.111600 -0.993800 0.000000
+vn -0.395500 -0.918400 0.000000
+vn -0.102400 -0.994700 0.000000
+vn -0.350100 -0.936700 0.000000
+vn -0.093100 -0.995700 0.000000
+vn -0.306700 -0.951800 0.000000
+vn -0.083800 -0.996500 0.000000
+vn -0.265700 -0.964100 0.000000
+vn -0.074300 -0.997200 0.000000
+vn -0.227100 -0.973900 0.000000
+vn -0.064800 -0.997900 0.000000
+vn -0.190700 -0.981700 0.000000
+vn -0.055000 -0.998500 0.000000
+vn -0.156800 -0.987600 0.000000
+vn -0.045300 -0.999000 0.000000
+vn -0.131500 -0.991300 0.000000
+vn -0.035400 -0.999400 0.000000
+vn -0.042200 -0.999100 -0.000000
+vn -0.025300 -0.999700 0.000000
+vn -0.025600 -0.999700 0.000000
+vn 0.029300 -0.999600 0.000000
+vn 0.028300 -0.999600 0.000000
+vn -0.015300 -0.999900 0.000000
+vn 0.080200 -0.996800 0.000000
+vn 0.079700 -0.996800 0.000000
+vn 0.078300 -0.996900 -0.000000
+vn -0.005100 -1.000000 0.000000
+vn 0.117200 -0.993100 0.000000
+vn 0.116100 -0.993200 -0.000000
+vn 0.033100 -0.999500 0.000000
+vn 0.132600 -0.991200 0.000000
+vn 0.131700 -0.991300 -0.000000
+vn 0.132200 -0.991200 -0.000000
+vn 0.102600 -0.994700 0.000000
+vn 0.132400 -0.991200 0.000000
+vn 0.175900 -0.984400 0.000000
+vn 0.113400 -0.993600 -0.000000
+vn 0.252000 -0.967700 0.000000
+vn 0.077300 -0.997000 0.000000
+vn 0.078200 -0.996900 -0.000000
+vn 0.329800 -0.944000 0.000000
+vn 0.024500 -0.999700 -0.000000
+vn 0.407700 -0.913100 0.000000
+vn -0.040400 -0.999200 0.000000
+vn -0.039500 -0.999200 0.000000
+vn 0.483900 -0.875100 0.000000
+vn -0.119400 -0.992800 0.000000
+vn -0.119000 -0.992900 0.000000
+vn -0.121100 -0.992600 -0.000000
+vn 0.556800 -0.830600 0.000000
+vn -0.091600 -0.995800 0.000000
+vn -0.091900 -0.995800 -0.000000
+vn -0.091400 -0.995800 0.000000
+vn 0.624900 -0.780700 0.000000
+vn -0.013600 -0.999900 0.000000
+vn -0.014200 -0.999900 0.000000
+vn 0.687100 -0.726600 0.000000
+vn 0.048300 -0.998800 0.000000
+vn 0.048600 -0.998800 0.000000
+vn 0.742600 -0.669800 0.000000
+vn 0.093400 -0.995600 0.000000
+vn 0.093200 -0.995600 0.000000
+vn 0.093000 -0.995700 -0.000000
+vn 0.791100 -0.611700 0.000000
+vn 0.123300 -0.992400 0.000000
+vn 0.123100 -0.992400 0.000000
+vn 0.835900 -0.548800 -0.000000
+vn 0.138600 -0.990300 0.000000
+vn 0.138400 -0.990400 -0.000000
+vn 0.876200 -0.481900 -0.000000
+vn 0.141400 -0.990000 0.000000
+vn 0.141700 -0.989900 -0.000000
+vn 0.908600 -0.417800 -0.000000
+vn 0.131000 -0.991400 0.000000
+vn 0.131200 -0.991400 -0.000000
+vn 0.131400 -0.991300 0.000000
+vn 0.934000 -0.357300 -0.000000
+vn 0.106100 -0.994400 0.000000
+vn 0.106300 -0.994300 0.000000
+vn 0.106000 -0.994400 -0.000000
+vn 0.953700 -0.300900 -0.000000
+vn 0.067200 -0.997700 0.000000
+vn 0.067100 -0.997700 -0.000000
+vn 0.066800 -0.997800 0.000000
+vn 0.968600 -0.248700 -0.000000
+vn 0.011700 -0.999900 0.000000
+vn 0.012000 -0.999900 0.000000
+vn 0.012100 -0.999900 -0.000000
+vn 0.979700 -0.200700 -0.000000
+vn -0.060700 -0.998200 0.000000
+vn -0.060300 -0.998200 -0.000000
+vn 0.987700 -0.156600 -0.000000
+vn -0.091500 -0.995800 0.000000
+vn 0.993200 -0.116300 -0.000000
+vn -0.061700 -0.998100 0.000000
+vn 0.996800 -0.079300 -0.000000
+vn -0.035800 -0.999400 0.000000
+vn 0.999000 -0.045500 -0.000000
+vn -0.015000 -0.999900 0.000000
+vn 0.999900 -0.014500 -0.000000
+vn 0.001600 -1.000000 0.000000
+vn 0.999900 0.011400 0.000000
+vn 0.014100 -0.999900 0.000000
+vn 0.999400 0.035600 0.000000
+vn 0.022500 -0.999700 0.000000
+vn 0.998100 0.061800 0.000000
+vn 0.026900 -0.999600 0.000000
+vn 0.027100 -0.999600 0.000000
+vn 0.995900 0.090200 0.000000
+vn 0.027000 -0.999600 -0.000000
+vn 0.027300 -0.999600 0.000000
+vn 0.992700 0.120900 0.000000
+vn 0.023800 -0.999700 0.000000
+vn 0.988000 0.154300 0.000000
+vn 0.016900 -0.999900 0.000000
+vn 0.981700 0.190600 0.000000
+vn 0.006800 -1.000000 0.000000
+vn 0.006400 -1.000000 0.000000
+vn 0.973200 0.230000 0.000000
+vn 0.000000 -1.000000 0.000000
+vn 0.962100 0.272900 0.000000
+vn 0.947700 0.319200 0.000000
+vn 0.929400 0.369200 0.000000
+vn 0.906200 0.422900 0.000000
+vn 0.878800 0.477200 0.000000
+vn 0.848000 0.530000 0.000000
+vn 0.811600 0.584200 0.000000
+vn 0.769100 0.639100 0.000000
+vn 0.720400 0.693600 0.000000
+vn 0.665400 0.746500 0.000000
+vn 0.604400 0.796700 0.000000
+vn 0.538200 0.842800 0.000000
+vn -0.013700 -0.999900 0.000000
+vn 0.467900 0.883800 0.000000
+vn -0.039300 -0.999200 0.000000
+vn 0.394700 0.918800 0.000000
+vn -0.059200 -0.998200 0.000000
+vn 0.320100 0.947400 0.000000
+vn -0.071000 -0.997500 0.000000
+vn 0.245500 0.969400 0.000000
+vn -0.073400 -0.997300 0.000000
+vn 0.976200 0.216900 0.000000
+vn -0.066000 -0.997800 0.000000
+vn 0.968700 0.248200 0.000000
+vn -0.050700 -0.998700 0.000000
+vn 0.959300 0.282400 0.000000
+vn -0.029600 -0.999600 0.000000
+vn 0.947400 0.319900 0.000000
+vn -0.005600 -1.000000 0.000000
+vn 0.932600 0.361000 0.000000
+vn 0.019600 -0.999800 0.000000
+vn 0.913900 0.405900 0.000000
+vn 0.044100 -0.999000 0.000000
+vn 0.890600 0.454800 0.000000
+vn 0.861500 0.507800 0.000000
+vn 0.825400 0.564500 0.000000
+vn -0.129800 0.991500 0.000000
+vn 0.781100 0.624400 0.000000
+vn 0.727200 0.686400 0.000000
+vn 0.662700 0.748900 0.000000
+vn 0.599700 0.800300 0.000000
+vn 0.544600 0.838700 0.000000
+vn 0.488100 0.872800 0.000000
+vn 0.430900 0.902400 0.000000
+vn -0.129900 0.991500 0.000000
+vn 0.373600 0.927600 0.000000
+vn 0.317200 0.948300 0.000000
+vn 0.262200 0.965000 0.000000
+vn 0.209000 0.977900 0.000000
+vn 0.158100 0.987400 0.000000
+vn -0.123800 0.992300 0.000000
+vn 0.109700 0.994000 0.000000
+vn -0.114200 0.993500 0.000000
+vn 0.063800 0.998000 0.000000
+vn -0.104500 0.994500 0.000000
+vn 0.020600 0.999800 0.000000
+vn -0.094500 0.995500 0.000000
+vn -0.006100 1.000000 0.000000
+vn -0.084300 0.996400 0.000000
+vn -0.018100 0.999800 0.000000
+vn -0.073800 0.997300 0.000000
+vn -0.029800 0.999600 0.000000
+vn -0.063300 0.998000 0.000000
+vn -0.041200 0.999200 0.000000
+vn -0.052300 0.998600 0.000000
+vn -0.260200 0.965600 0.000000
+vn -0.153200 0.988200 0.000000
+vn -0.366600 0.930400 0.000000
+vn -0.049500 0.998800 0.000000
+vn -0.468700 0.883400 0.000000
+vn 0.004100 1.000000 0.000000
+vn -0.562500 0.826800 0.000000
+vn 0.012700 0.999900 0.000000
+vn -0.645800 0.763500 0.000000
+vn 0.020700 0.999800 0.000000
+vn -0.717200 0.696800 0.000000
+vn 0.028000 0.999600 0.000000
+vn 0.028400 0.999600 0.000000
+vn -0.776900 0.629600 0.000000
+vn 0.036500 0.999300 0.000000
+vn -0.825700 0.564200 0.000000
+vn 0.044100 0.999000 0.000000
+vn -0.864900 0.501900 0.000000
+vn 0.051300 0.998700 0.000000
+vn -0.896100 0.443900 0.000000
+vn 0.059100 0.998300 0.000000
+vn -0.928600 0.371100 0.000000
+vn -0.928600 0.371200 0.000000
+vn 0.066400 0.997800 0.000000
+vn 0.066700 0.997800 0.000000
+vn -0.954100 0.299400 0.000000
+vn -0.954100 0.299500 0.000000
+vn 0.073600 0.997300 0.000000
+vn 0.073200 0.997300 0.000000
+vn -0.970300 0.241800 0.000000
+vn 0.080800 0.996700 0.000000
+vn -0.980800 0.194900 0.000000
+vn 0.088000 0.996100 0.000000
+vn -0.987700 0.156200 0.000000
+vn 0.139900 0.990200 0.000000
+vn -0.992300 0.123900 0.000000
+vn 0.247400 0.968900 0.000000
+vn -0.995300 0.096600 0.000000
+vn 0.355100 0.934800 0.000000
+vn -0.997300 0.073200 0.000000
+vn 0.458800 0.888500 0.000000
+vn -0.998600 0.053000 0.000000
+vn 0.554800 0.832000 0.000000
+vn -0.999400 0.035500 0.000000
+vn 0.640100 0.768300 0.000000
+vn -0.999800 0.020000 0.000000
+vn 0.713500 0.700700 0.000000
+vn -1.000000 0.006300 0.000000
+vn 0.774800 0.632200 0.000000
+vn -1.000000 -0.006300 -0.000000
+vn 0.824900 0.565300 0.000000
+vn -0.999800 -0.019900 -0.000000
+vn 0.865100 0.501700 0.000000
+vn -0.999400 -0.035000 -0.000000
+vn 0.896900 0.442200 0.000000
+vn -0.998700 -0.051800 -0.000000
+vn 0.921900 0.387400 0.000000
+vn -0.997500 -0.070700 -0.000000
+vn 0.944100 0.329700 0.000000
+vn -0.995800 -0.092100 -0.000000
+vn 0.962400 0.271500 0.000000
+vn -0.993200 -0.116300 -0.000000
+vn 0.974800 0.223100 0.000000
+vn -0.989600 -0.144000 -0.000000
+vn 0.983200 0.182400 0.000000
+vn -0.984400 -0.176000 -0.000000
+vn 0.989000 0.147900 0.000000
+vn -0.977000 -0.213000 -0.000000
+vn 0.993000 0.118400 0.000000
+vn -0.966600 -0.256300 -0.000000
+vn 0.995700 0.093000 0.000000
+vn -0.951700 -0.307200 -0.000000
+vn 0.997500 0.071000 0.000000
+vn -0.933800 -0.357900 -0.000000
+vn 0.998700 0.051700 0.000000
+vn -0.910700 -0.413100 -0.000000
+vn 0.999400 0.034700 0.000000
+vn -0.880500 -0.474100 -0.000000
+vn 0.999800 0.019600 0.000000
+vn -0.841100 -0.540900 -0.000000
+vn 1.000000 0.006200 0.000000
+vn -0.790200 -0.612800 -0.000000
+vn -0.790200 -0.612900 -0.000000
+vn 1.000000 -0.005600 -0.000000
+vn -0.725500 -0.688200 -0.000000
+vn 0.999800 -0.017900 -0.000000
+vn -0.645200 -0.764000 -0.000000
+vn 0.999500 -0.031700 -0.000000
+vn -0.548500 -0.836100 -0.000000
+vn 0.998900 -0.047400 -0.000000
+vn -0.437100 -0.899400 -0.000000
+vn 0.997900 -0.065400 -0.000000
+vn -0.314500 -0.949300 -0.000000
+vn 0.996300 -0.086200 -0.000000
+vn -0.186800 -0.982400 -0.000000
+vn 0.993900 -0.110500 -0.000000
+vn 0.990300 -0.139000 -0.000000
+vn 0.003900 -1.000000 -0.000000
+vn 0.984900 -0.173000 -0.000000
+vn 0.010700 -0.999900 -0.000000
+vn 0.976800 -0.214000 -0.000000
+vn 0.017900 -0.999800 -0.000000
+vn 0.017600 -0.999800 -0.000000
+vn 0.964500 -0.264000 -0.000000
+vn 0.945400 -0.325900 -0.000000
+vn 0.030300 -0.999500 -0.000000
+vn 0.922000 -0.387100 -0.000000
+vn 0.035700 -0.999400 -0.000000
+vn 0.035500 -0.999400 -0.000000
+vn 0.897100 -0.441800 -0.000000
+vn 0.040600 -0.999200 -0.000000
+vn 0.041000 -0.999200 -0.000000
+vn 0.040700 -0.999200 -0.000000
+vn 0.865200 -0.501400 -0.000000
+vn 0.045500 -0.999000 -0.000000
+vn 0.045800 -0.998900 -0.000000
+vn 0.824700 -0.565600 -0.000000
+vn 0.049700 -0.998800 -0.000000
+vn 0.773900 -0.633300 -0.000000
+vn 0.053100 -0.998600 -0.000000
+vn 0.053400 -0.998600 -0.000000
+vn 0.711300 -0.702900 -0.000000
+vn 0.056500 -0.998400 -0.000000
+vn 0.635900 -0.771800 -0.000000
+vn 0.059300 -0.998200 -0.000000
+vn 0.059100 -0.998200 -0.000000
+vn 0.547500 -0.836800 -0.000000
+vn 0.116600 -0.993200 -0.000000
+vn 0.448000 -0.894100 -0.000000
+vn 0.228000 -0.973700 -0.000000
+vn 0.340000 -0.940400 -0.000000
+vn -0.000000 0.000300 -1.000000
+vn -0.000000 0.006400 -1.000000
+vn -0.000000 -0.003500 -1.000000
+vn 0.000000 -0.001100 -1.000000
+vn 0.000000 -0.006200 -1.000000
+vn -0.000000 0.000600 -1.000000
+vn 0.000000 -0.007100 -1.000000
+vn 0.000000 0.014200 -0.999900
+vn 0.000100 0.004100 -1.000000
+vn 0.000000 -0.007600 -1.000000
+vn 0.000000 -0.000300 -1.000000
+vn -0.000100 0.000700 -1.000000
+vn 0.000000 -0.000500 -1.000000
+vn 0.000000 0.000700 -1.000000
+vn 0.000000 0.000500 -1.000000
+vn 0.000100 -0.000000 1.000000
+vn 0.045600 -0.999000 -0.000000
+vn 0.039900 -0.999200 -0.000000
+vn 0.003400 -1.000000 -0.000000
+vn 0.056100 -0.998400 -0.000000
+vn -0.078000 0.997000 0.000000
+vn -0.130700 -0.991400 0.000000
+vn -0.045100 -0.999000 -0.000000
+vn 0.028400 -0.999600 -0.000000
+vn 0.078700 -0.996900 0.000000
+vn 0.131100 -0.991400 0.000000
+vn 0.114300 -0.993400 -0.000000
+vn 0.026200 -0.999700 -0.000000
+vn -0.121600 -0.992600 0.000000
+vn -0.090900 -0.995900 0.000000
+vn -0.013400 -0.999900 0.000000
+vn 0.123400 -0.992400 0.000000
+vn 0.138500 -0.990400 -0.000000
+vn 0.141800 -0.989900 0.000000
+vn 0.131500 -0.991300 -0.000000
+vn 0.105600 -0.994400 0.000000
+vn 0.011600 -0.999900 0.000000
+vn -0.060000 -0.998200 0.000000
+vn 0.000000 -0.001700 -1.000000
+vn 0.000100 0.000000 -1.000000
+vn 0.000000 0.004600 -1.000000
+vn 0.000000 0.000600 1.000000
+vn 0.000200 0.000000 1.000000
+vn -0.000000 -0.004400 1.000000
+vn -0.000100 0.003800 1.000000
+vn 0.036100 0.999300 0.000000
+vn 0.024000 -0.999700 -0.000000
+vn 0.035800 -0.999400 -0.000000
usemtl SVGMat.002
-s off
-f 62//2 63//2 64//2
-f 61//3 64//3 66//3
-f 175//4 176//4 110//4
-f 324//4 192//4 323//4
-f 342//5 456//5 63//5
-f 566//6 572//6 577//6
-f 803//6 743//6 744//6
-f 65//7 66//7 572//7
-f 260//8 259//8 655//8
-f 261//9 260//9 654//9
-f 262//10 261//10 653//10
-f 263//11 262//11 652//11
-f 264//12 263//12 651//12
-f 265//13 264//13 650//13
-f 266//14 265//14 649//14
-f 267//15 266//15 648//15
-f 268//16 267//16 647//16
-f 269//17 268//17 646//17
-f 270//18 269//18 645//18
-f 271//19 270//19 644//19
-f 272//20 271//20 643//20
-f 273//21 272//21 642//21
-f 274//22 273//22 641//22
-f 275//23 274//23 640//23
-f 276//24 275//24 639//24
-f 277//25 276//25 638//25
-f 278//26 277//26 637//26
-f 279//27 278//27 636//27
-f 280//28 279//28 635//28
-f 281//29 280//29 634//29
-f 282//30 281//30 633//30
-f 283//31 282//31 632//31
-f 284//32 283//32 631//32
-f 285//33 284//33 630//33
-f 286//34 285//34 629//34
-f 287//35 286//35 628//35
-f 288//36 287//36 627//36
-f 289//37 288//37 626//37
-f 290//38 289//38 625//38
-f 291//39 290//39 624//39
-f 292//40 291//40 623//40
-f 293//40 292//40 622//40
-f 294//40 293//40 621//40
-f 295//40 294//40 620//40
-f 296//40 295//40 619//40
-f 297//40 296//40 618//40
-f 298//40 297//40 617//40
-f 299//40 298//40 616//40
-f 300//40 299//40 615//40
-f 301//40 300//40 614//40
-f 302//40 301//40 613//40
-f 303//40 302//40 612//40
-f 304//41 303//41 611//41
-f 305//40 304//40 610//40
-f 306//42 305//42 609//42
-f 307//40 306//40 608//40
-f 308//43 307//43 607//43
-f 309//44 308//44 606//44
-f 310//45 309//45 605//45
-f 311//46 310//46 604//46
-f 312//47 311//47 603//47
-f 313//46 312//46 602//46
-f 314//48 313//48 601//48
-f 315//49 314//49 600//49
-f 316//50 315//50 599//50
-f 317//51 316//51 598//51
-f 318//52 317//52 597//52
-f 319//53 318//53 596//53
-f 320//54 319//54 595//54
-f 321//55 320//55 594//55
-f 322//56 321//56 593//56
-f 323//57 322//57 592//57
-f 324//58 323//58 591//58
-f 325//59 324//59 590//59
-f 326//60 325//60 589//60
-f 327//61 326//61 588//61
-f 328//62 327//62 587//62
-f 329//63 328//63 586//63
-f 330//64 329//64 585//64
-f 331//65 330//65 584//65
-f 332//66 331//66 583//66
-f 333//67 332//67 582//67
-f 334//68 333//68 581//68
-f 335//69 334//69 580//69
-f 336//70 335//70 579//70
-f 337//71 336//71 578//71
-f 858//4 859//4 338//4
-f 872//46 885//46 886//46
-f 339//46 575//46 574//46
-f 340//72 574//72 573//72
-f 341//73 573//73 456//73
-f 343//74 572//74 571//74
-f 344//75 571//75 570//75
-f 345//76 570//76 569//76
-f 346//77 569//77 568//77
-f 347//78 568//78 567//78
-f 348//79 567//79 566//79
-f 104//80 566//80 809//80
-f 109//40 108//40 806//40
-f 116//40 798//40 797//40
-f 117//81 797//81 796//81
-f 118//82 796//82 795//82
-f 119//83 795//83 794//83
-f 120//84 794//84 793//84
-f 121//85 793//85 792//85
-f 122//86 792//86 791//86
-f 123//87 791//87 790//87
-f 124//88 790//88 789//88
-f 125//89 789//89 788//89
-f 126//90 788//90 787//90
-f 127//91 787//91 786//91
-f 128//92 786//92 785//92
-f 129//93 785//93 784//93
-f 130//93 784//93 686//93
-f 235//93 234//93 680//93
-f 242//40 241//40 673//40
-f 243//40 242//40 672//40
-f 244//94 243//94 671//94
-f 245//95 244//95 670//95
-f 246//96 245//96 669//96
-f 247//97 246//97 668//97
-f 248//98 247//98 667//98
-f 249//99 248//99 666//99
-f 250//100 249//100 665//100
-f 251//101 250//101 664//101
-f 252//102 251//102 663//102
-f 253//103 252//103 662//103
-f 254//104 253//104 661//104
-f 255//105 254//105 660//105
-f 256//106 255//106 659//106
-f 257//107 256//107 658//107
-f 258//108 257//108 657//108
-f 259//109 258//109 656//109
-f 576//6 891//6 909//6
-f 878//110 337//110 577//110
-f 845//111 884//111 893//111
-f 846//112 845//112 892//112
-f 847//113 846//113 924//113
-f 848//114 847//114 923//114
-f 849//115 848//115 922//115
-f 850//116 849//116 921//116
-f 851//117 850//117 920//117
-f 852//118 851//118 919//118
-f 853//119 852//119 918//119
-f 854//120 853//120 917//120
-f 855//121 854//121 916//121
-f 856//122 855//122 915//122
-f 857//123 856//123 914//123
-f 858//124 857//124 913//124
-f 859//125 858//125 912//125
-f 860//126 859//126 911//126
-f 861//127 860//127 910//127
-f 862//40 861//40 909//40
-f 863//40 862//40 908//40
-f 864//40 863//40 907//40
-f 865//40 864//40 906//40
-f 866//40 865//40 905//40
-f 867//40 866//40 904//40
-f 868//40 867//40 903//40
-f 869//40 868//40 902//40
-f 870//40 869//40 901//40
-f 241//40 870//40 900//40
-f 879//128 878//128 899//128
-f 880//129 879//129 898//129
-f 881//130 880//130 897//130
-f 882//131 881//131 896//131
-f 883//132 882//132 895//132
-f 884//133 883//133 894//133
-f 200//134 199//134 716//134
-f 201//135 200//135 715//135
-f 199//136 198//136 717//136
-f 202//137 201//137 714//137
-f 198//138 197//138 718//138
-f 203//139 202//139 713//139
-f 197//140 196//140 719//140
-f 204//141 203//141 712//141
-f 196//142 195//142 720//142
-f 205//143 204//143 711//143
-f 195//144 194//144 721//144
-f 206//145 205//145 710//145
-f 194//146 193//146 722//146
-f 207//147 206//147 709//147
-f 193//148 192//148 723//148
-f 208//149 207//149 708//149
-f 192//150 191//150 724//150
-f 209//151 208//151 707//151
-f 191//152 190//152 725//152
-f 210//153 209//153 706//153
-f 190//154 189//154 726//154
-f 211//155 210//155 705//155
-f 189//156 188//156 727//156
-f 212//157 211//157 704//157
-f 188//158 187//158 728//158
-f 213//159 212//159 703//159
-f 187//160 186//160 729//160
-f 214//161 213//161 702//161
-f 186//162 185//162 730//162
-f 215//163 214//163 701//163
-f 185//164 184//164 731//164
-f 216//165 215//165 700//165
-f 184//166 183//166 457//166
-f 217//167 216//167 699//167
-f 183//168 455//168 458//168
-f 218//169 217//169 698//169
-f 455//170 454//170 459//170
-f 219//171 218//171 697//171
-f 454//172 453//172 460//172
-f 220//173 219//173 696//173
-f 453//174 452//174 461//174
-f 221//175 220//175 695//175
-f 452//176 451//176 462//176
-f 222//177 221//177 694//177
-f 451//178 450//178 463//178
-f 223//179 222//179 693//179
-f 450//180 449//180 464//180
-f 224//181 223//181 692//181
-f 449//182 448//182 465//182
-f 225//183 224//183 691//183
-f 448//184 447//184 466//184
-f 226//185 225//185 690//185
-f 447//186 446//186 467//186
-f 227//187 226//187 689//187
-f 446//188 445//188 468//188
-f 228//189 227//189 688//189
-f 445//190 444//190 469//190
-f 132//191 228//191 687//191
-f 444//192 443//192 470//192
-f 133//193 132//193 783//193
-f 443//194 442//194 471//194
-f 134//195 133//195 782//195
-f 442//196 441//196 472//196
-f 135//197 134//197 781//197
-f 441//198 440//198 473//198
-f 136//199 135//199 780//199
-f 440//200 439//200 474//200
-f 137//201 136//201 779//201
-f 439//202 438//202 475//202
-f 138//203 137//203 778//203
-f 438//204 437//204 476//204
-f 139//205 138//205 777//205
-f 437//206 436//206 477//206
-f 140//207 139//207 776//207
-f 436//208 435//208 478//208
-f 141//209 140//209 775//209
-f 435//210 434//210 479//210
-f 142//211 141//211 774//211
-f 434//212 433//212 480//212
-f 143//213 142//213 773//213
-f 433//214 432//214 481//214
-f 144//215 143//215 772//215
-f 432//216 431//216 482//216
-f 145//217 144//217 771//217
-f 431//218 430//218 483//218
-f 146//219 145//219 770//219
-f 430//220 429//220 484//220
-f 147//221 146//221 769//221
-f 429//222 428//222 485//222
-f 148//223 147//223 768//223
-f 428//224 427//224 486//224
-f 149//225 148//225 767//225
-f 427//226 426//226 487//226
-f 150//227 149//227 766//227
-f 426//228 425//228 488//228
-f 151//229 150//229 765//229
-f 425//230 424//230 489//230
-f 152//231 151//231 764//231
-f 424//232 423//232 490//232
-f 153//233 152//233 763//233
-f 423//234 422//234 491//234
-f 154//235 153//235 762//235
-f 422//236 421//236 492//236
-f 155//237 154//237 761//237
-f 421//238 420//238 493//238
-f 156//239 155//239 760//239
-f 420//240 419//240 494//240
-f 157//241 156//241 759//241
-f 419//242 418//242 495//242
-f 158//243 157//243 758//243
-f 418//244 417//244 496//244
-f 159//245 158//245 757//245
-f 417//246 416//246 497//246
-f 160//247 159//247 756//247
-f 416//248 415//248 498//248
-f 161//249 160//249 755//249
-f 415//250 414//250 499//250
-f 162//251 161//251 754//251
-f 414//252 413//252 500//252
-f 163//253 162//253 753//253
-f 413//254 412//254 501//254
-f 164//255 163//255 752//255
-f 412//256 411//256 502//256
-f 165//257 164//257 751//257
-f 411//258 410//258 503//258
-f 166//259 165//259 750//259
-f 410//260 409//260 504//260
-f 167//261 166//261 749//261
-f 409//238 408//238 505//238
-f 168//262 167//262 748//262
-f 408//263 407//263 506//263
-f 169//264 168//264 747//264
-f 407//265 406//265 507//265
-f 170//266 169//266 746//266
-f 406//267 405//267 508//267
-f 171//268 170//268 745//268
-f 405//269 404//269 509//269
-f 172//270 171//270 744//270
-f 404//271 403//271 510//271
-f 173//272 172//272 743//272
-f 403//273 402//273 511//273
-f 174//274 173//274 742//274
-f 402//275 401//275 512//275
-f 175//276 174//276 741//276
-f 401//277 400//277 513//277
-f 176//278 175//278 740//278
-f 400//279 399//279 514//279
-f 177//280 176//280 739//280
-f 399//281 398//281 515//281
-f 178//282 177//282 738//282
-f 398//283 397//283 516//283
-f 179//284 178//284 737//284
-f 397//285 396//285 517//285
-f 180//286 179//286 736//286
-f 396//285 395//285 518//285
-f 181//287 180//287 735//287
-f 395//285 394//285 519//285
-f 182//288 181//288 734//288
-f 394//285 393//285 520//285
-f 67//289 182//289 733//289
-f 393//285 392//285 521//285
-f 68//290 67//290 732//290
-f 392//285 391//285 522//285
-f 69//291 68//291 844//291
-f 391//285 390//285 523//285
-f 70//292 69//292 843//292
-f 390//285 389//285 524//285
-f 71//293 70//293 842//293
-f 389//285 388//285 525//285
-f 72//294 71//294 841//294
-f 388//285 387//285 526//285
-f 73//295 72//295 840//295
-f 387//285 386//285 527//285
-f 74//296 73//296 839//296
-f 386//285 385//285 528//285
-f 75//297 74//297 838//297
-f 385//298 384//298 529//298
-f 76//299 75//299 837//299
-f 384//300 383//300 530//300
-f 77//301 76//301 836//301
-f 383//302 382//302 531//302
-f 78//303 77//303 835//303
-f 382//304 381//304 532//304
-f 79//305 78//305 834//305
-f 381//306 380//306 533//306
-f 80//307 79//307 833//307
-f 380//308 379//308 534//308
-f 81//309 80//309 832//309
-f 379//310 378//310 535//310
-f 82//311 81//311 831//311
-f 378//312 377//312 536//312
-f 83//313 82//313 830//313
-f 377//314 376//314 537//314
-f 84//315 83//315 829//315
-f 376//316 375//316 538//316
-f 85//317 84//317 828//317
-f 375//318 374//318 539//318
-f 86//319 85//319 827//319
-f 374//320 373//320 540//320
-f 87//321 86//321 826//321
-f 373//40 372//40 541//40
-f 88//322 87//322 825//322
-f 372//323 371//323 542//323
-f 89//324 88//324 824//324
-f 371//323 370//323 543//323
-f 90//325 89//325 823//325
-f 370//323 369//323 544//323
-f 91//326 90//326 822//326
-f 369//323 368//323 545//323
-f 92//327 91//327 821//327
-f 368//323 367//323 546//323
-f 93//328 92//328 820//328
-f 367//323 366//323 547//323
-f 94//329 93//329 819//329
-f 366//323 365//323 548//323
-f 95//330 94//330 818//330
-f 365//323 364//323 549//323
-f 96//331 95//331 817//331
-f 364//323 363//323 550//323
-f 97//332 96//332 816//332
-f 363//323 362//323 551//323
-f 98//333 97//333 815//333
-f 362//323 361//323 552//323
-f 99//334 98//334 814//334
-f 361//323 360//323 553//323
-f 100//335 99//335 813//335
-f 360//336 359//336 554//336
-f 101//337 100//337 812//337
-f 359//338 358//338 555//338
-f 102//339 101//339 811//339
-f 358//340 357//340 556//340
-f 103//341 102//341 810//341
-f 357//342 356//342 557//342
-f 349//343 103//343 565//343
-f 356//344 355//344 558//344
-f 350//345 349//345 564//345
-f 355//346 354//346 559//346
-f 351//347 350//347 563//347
-f 354//348 353//348 560//348
-f 352//349 351//349 562//349
-f 353//350 352//350 561//350
-f 998//4 937//4 938//4
-f 1088//6 1046//6 1047//6
-f 960//351 959//351 1136//351
-f 961//352 960//352 1135//352
-f 959//353 958//353 1137//353
-f 962//354 961//354 1134//354
-f 958//355 957//355 1138//355
-f 963//356 962//356 1133//356
-f 957//357 956//357 1139//357
-f 964//358 963//358 1132//358
-f 956//359 955//359 1140//359
-f 965//341 964//341 1131//341
-f 955//360 954//360 1141//360
-f 966//361 965//361 1130//361
-f 954//362 953//362 1142//362
-f 967//363 966//363 1129//363
-f 953//364 952//364 1143//364
-f 968//365 967//365 1128//365
-f 952//366 951//366 1144//366
-f 969//367 968//367 1127//367
-f 951//368 950//368 1145//368
-f 970//369 969//369 1126//369
-f 950//370 949//370 1146//370
-f 971//371 970//371 1125//371
-f 949//372 948//372 1147//372
-f 972//373 971//373 1124//373
-f 948//374 947//374 1148//374
-f 973//375 972//375 1123//375
-f 947//376 946//376 1149//376
-f 974//377 973//377 1122//377
-f 946//378 945//378 1150//378
-f 975//379 974//379 1121//379
-f 945//380 944//380 1151//380
-f 976//381 975//381 1120//381
-f 944//382 943//382 1152//382
-f 977//383 976//383 1119//383
-f 943//384 942//384 1153//384
-f 978//385 977//385 1118//385
-f 942//386 941//386 1154//386
-f 979//387 978//387 1117//387
-f 941//388 940//388 1155//388
-f 980//389 979//389 1116//389
-f 940//390 939//390 1156//390
-f 981//391 980//391 1115//391
-f 939//392 938//392 1157//392
-f 982//393 981//393 1114//393
-f 938//394 937//394 1158//394
-f 983//395 982//395 1113//395
-f 937//396 936//396 1159//396
-f 984//397 983//397 1112//397
-f 936//398 935//398 1160//398
-f 985//399 984//399 1111//399
-f 935//400 934//400 1161//400
-f 986//401 985//401 1110//401
-f 934//402 933//402 1162//402
-f 987//403 986//403 1109//403
-f 933//404 932//404 1163//404
-f 988//405 987//405 1108//405
-f 932//406 931//406 1164//406
-f 989//407 988//407 1107//407
-f 931//408 930//408 1045//408
-f 990//409 989//409 1106//409
-f 930//410 929//410 1046//410
-f 991//411 990//411 1105//411
-f 929//412 928//412 1047//412
-f 992//413 991//413 1104//413
-f 928//414 927//414 1048//414
-f 993//415 992//415 1103//415
-f 927//416 926//416 1049//416
-f 994//417 993//417 1102//417
-f 926//418 925//418 1050//418
-f 995//419 994//419 1101//419
-f 925//420 1044//420 1051//420
-f 996//421 995//421 1100//421
-f 1044//422 1043//422 1052//422
-f 997//423 996//423 1099//423
-f 1043//424 1042//424 1053//424
-f 998//425 997//425 1098//425
-f 1042//426 1041//426 1054//426
-f 999//427 998//427 1097//427
-f 1041//428 1040//428 1055//428
-f 1000//429 999//429 1096//429
-f 1040//430 1039//430 1056//430
-f 1001//431 1000//431 1095//431
-f 1039//432 1038//432 1057//432
-f 1002//433 1001//433 1094//433
-f 1038//434 1037//434 1058//434
-f 1003//435 1002//435 1093//435
-f 1037//436 1036//436 1059//436
-f 1004//437 1003//437 1092//437
-f 1036//438 1035//438 1060//438
-f 1005//439 1004//439 1091//439
-f 1035//440 1034//440 1061//440
-f 1006//441 1005//441 1090//441
-f 1034//442 1033//442 1062//442
-f 1007//443 1006//443 1089//443
-f 1033//444 1032//444 1063//444
-f 1008//445 1007//445 1088//445
-f 1032//446 1031//446 1064//446
-f 1009//447 1008//447 1087//447
-f 1031//448 1030//448 1065//448
-f 1010//449 1009//449 1086//449
-f 1030//450 1029//450 1066//450
-f 1011//451 1010//451 1085//451
-f 1029//452 1028//452 1067//452
-f 1012//453 1011//453 1084//453
-f 1028//454 1027//454 1068//454
-f 1013//455 1012//455 1083//455
-f 1027//456 1026//456 1069//456
-f 1014//457 1013//457 1082//457
-f 1026//458 1025//458 1070//458
-f 1015//459 1014//459 1081//459
-f 1025//460 1024//460 1071//460
-f 1016//461 1015//461 1080//461
-f 1024//462 1023//462 1072//462
-f 1017//463 1016//463 1079//463
-f 1023//464 1022//464 1073//464
-f 1018//465 1017//465 1078//465
-f 1022//466 1021//466 1074//466
-f 1019//467 1018//467 1077//467
-f 1021//468 1020//468 1075//468
-f 1020//469 1019//469 1076//469
-f 61//2 62//2 64//2
-f 65//3 61//3 66//3
-f 131//4 132//4 133//4
-f 78//4 79//4 80//4
-f 131//4 133//4 134//4
-f 81//4 78//4 80//4
-f 131//4 134//4 135//4
-f 81//4 77//4 78//4
-f 131//4 135//4 136//4
-f 81//4 82//4 77//4
-f 131//4 136//4 137//4
-f 82//4 76//4 77//4
-f 131//4 137//4 138//4
-f 82//4 83//4 76//4
-f 131//4 138//4 139//4
-f 76//4 83//4 75//4
-f 131//4 139//4 140//4
-f 83//4 84//4 75//4
-f 131//4 140//4 141//4
-f 75//4 84//4 107//4
-f 131//4 141//4 142//4
-f 75//4 107//4 74//4
-f 131//4 142//4 143//4
-f 107//4 73//4 74//4
-f 131//4 143//4 144//4
-f 107//4 72//4 73//4
-f 131//4 144//4 145//4
-f 107//4 84//4 85//4
-f 131//4 145//4 146//4
-f 106//4 85//4 86//4
-f 131//4 146//4 147//4
-f 106//4 86//4 87//4
-f 131//4 147//4 148//4
-f 89//4 106//4 88//4
-f 131//4 148//4 149//4
-f 90//4 106//4 89//4
-f 131//4 149//4 150//4
-f 105//4 103//4 104//4
-f 131//4 150//4 151//4
-f 105//4 102//4 103//4
-f 131//4 151//4 152//4
-f 101//4 102//4 105//4
-f 131//4 152//4 153//4
-f 100//4 101//4 105//4
-f 131//4 153//4 154//4
-f 99//4 100//4 105//4
-f 131//4 154//4 155//4
-f 98//4 99//4 105//4
-f 130//4 155//4 156//4
-f 97//4 98//4 105//4
-f 116//4 156//4 157//4
-f 96//4 97//4 105//4
-f 115//4 157//4 158//4
-f 95//4 96//4 105//4
-f 115//4 158//4 159//4
-f 94//4 95//4 105//4
-f 114//4 159//4 160//4
-f 93//4 94//4 105//4
-f 114//4 160//4 161//4
-f 92//4 93//4 105//4
-f 114//4 161//4 162//4
-f 91//4 92//4 105//4
-f 113//4 162//4 163//4
-f 90//4 91//4 105//4
-f 113//4 163//4 164//4
-f 106//4 90//4 105//4
-f 113//4 164//4 165//4
-f 106//4 87//4 88//4
-f 113//4 165//4 166//4
-f 106//4 107//4 85//4
-f 112//4 166//4 167//4
-f 72//4 107//4 71//4
-f 112//4 167//4 168//4
-f 71//4 107//4 108//4
-f 115//4 116//4 157//4
-f 70//4 71//4 108//4
-f 112//4 168//4 169//4
-f 69//4 70//4 108//4
-f 111//4 169//4 170//4
-f 68//4 69//4 108//4
-f 155//4 130//4 131//4
-f 67//4 68//4 108//4
-f 156//4 116//4 117//4
-f 182//4 67//4 108//4
-f 111//4 170//4 171//4
-f 109//4 182//4 108//4
-f 111//4 171//4 172//4
-f 109//4 181//4 182//4
-f 130//4 156//4 117//4
-f 109//4 180//4 181//4
-f 111//4 172//4 173//4
-f 109//4 179//4 180//4
-f 118//4 130//4 117//4
-f 109//4 178//4 179//4
-f 110//4 173//4 174//4
-f 124//4 125//4 126//4
-f 126//4 123//4 124//4
-f 126//4 127//4 122//4
-f 121//4 127//4 128//4
-f 129//4 120//4 128//4
-f 162//4 113//4 114//4
-f 128//4 120//4 121//4
-f 159//4 114//4 115//4
-f 173//4 110//4 111//4
-f 166//4 112//4 113//4
-f 121//4 122//4 127//4
-f 126//4 122//4 123//4
-f 118//4 129//4 130//4
-f 177//4 178//4 109//4
-f 120//4 129//4 119//4
-f 177//4 109//4 110//4
-f 169//4 111//4 112//4
-f 177//4 110//4 176//4
-f 174//4 175//4 110//4
-f 118//4 119//4 129//4
-f 185//4 455//4 183//4
-f 185//4 453//4 454//4
-f 186//4 451//4 452//4
-f 186//4 449//4 450//4
-f 437//4 447//4 448//4
-f 442//4 443//4 446//4
-f 445//4 443//4 444//4
-f 446//4 441//4 442//4
-f 446//4 439//4 440//4
-f 447//4 437//4 438//4
-f 410//4 435//4 436//4
-f 432//4 433//4 434//4
-f 430//4 431//4 432//4
-f 428//4 429//4 430//4
-f 420//4 421//4 422//4
-f 427//470 428//470 430//470
-f 419//4 420//4 422//4
-f 426//471 427//471 430//471
-f 418//4 419//4 422//4
-f 426//4 430//4 432//4
-f 418//471 422//471 423//471
-f 425//472 426//472 432//472
-f 417//4 418//4 423//4
-f 425//473 432//473 434//473
-f 416//4 417//4 423//4
-f 424//474 425//474 434//474
-f 415//4 416//4 423//4
-f 423//475 424//475 434//475
-f 448//4 436//4 437//4
-f 446//4 440//4 441//4
-f 446//4 443//4 445//4
-f 186//4 448//4 449//4
-f 186//4 452//4 453//4
-f 185//4 183//4 184//4
-f 229//4 132//4 131//4
-f 454//4 455//4 185//4
-f 229//4 230//4 132//4
-f 453//4 185//4 186//4
-f 132//4 230//4 231//4
-f 448//4 186//4 187//4
-f 232//4 132//4 231//4
-f 382//4 187//4 188//4
-f 232//4 233//4 132//4
-f 373//4 188//4 189//4
-f 233//4 228//4 132//4
-f 373//4 189//4 190//4
-f 233//4 227//4 228//4
-f 450//4 451//4 186//4
-f 226//4 227//4 233//4
-f 373//4 190//4 191//4
-f 225//4 226//4 233//4
-f 325//4 191//4 192//4
-f 225//4 233//4 234//4
-f 436//4 448//4 187//4
-f 224//4 225//4 234//4
-f 323//4 192//4 193//4
-f 308//4 224//4 234//4
-f 322//4 193//4 194//4
-f 223//4 224//4 308//4
-f 438//4 439//4 447//4
-f 222//4 223//4 308//4
-f 320//4 194//4 195//4
-f 221//4 222//4 308//4
-f 447//4 439//4 446//4
-f 220//4 221//4 308//4
-f 318//4 195//4 196//4
-f 220//4 308//4 219//4
-f 410//4 436//4 187//4
-f 219//4 308//4 310//4
-f 317//4 196//4 197//4
-f 218//4 219//4 310//4
-f 411//4 434//4 435//4
-f 217//4 310//4 216//4
-f 413//4 423//4 434//4
-f 216//4 310//4 215//4
-f 414//476 415//476 423//476
-f 215//4 310//4 214//4
-f 413//4 414//4 423//4
-f 310//4 311//4 214//4
-f 412//4 413//4 434//4
-f 214//4 311//4 213//4
-f 411//4 412//4 434//4
-f 213//4 311//4 212//4
-f 410//4 411//4 435//4
-f 212//4 311//4 211//4
-f 409//4 410//4 187//4
-f 211//4 311//4 312//4
-f 404//4 409//4 187//4
-f 210//4 211//4 312//4
-f 407//4 408//4 409//4
-f 209//4 210//4 312//4
-f 406//4 407//4 409//4
-f 208//4 209//4 312//4
-f 405//4 406//4 409//4
-f 307//4 235//4 236//4
-f 404//4 405//4 409//4
-f 307//4 236//4 237//4
-f 315//4 197//4 198//4
-f 239//4 237//4 238//4
-f 403//4 404//4 187//4
-f 307//4 237//4 239//4
-f 402//4 403//4 187//4
-f 307//4 239//4 240//4
-f 401//4 402//4 187//4
-f 240//4 241//4 242//4
-f 400//4 401//4 187//4
-f 240//4 242//4 243//4
-f 399//4 400//4 187//4
-f 292//4 243//4 244//4
-f 398//4 399//4 187//4
-f 292//4 244//4 245//4
-f 397//4 398//4 187//4
-f 291//4 245//4 246//4
-f 396//4 397//4 187//4
-f 291//4 246//4 247//4
-f 395//477 396//477 187//477
-f 290//4 247//4 248//4
-f 394//4 395//4 187//4
-f 289//4 248//4 249//4
-f 393//4 394//4 187//4
-f 289//4 249//4 250//4
-f 392//4 393//4 187//4
-f 288//4 250//4 251//4
-f 391//4 392//4 187//4
-f 287//4 251//4 252//4
-f 390//4 391//4 187//4
-f 286//4 252//4 253//4
-f 389//477 390//477 187//477
-f 286//4 253//4 254//4
-f 388//4 389//4 187//4
-f 284//4 254//4 255//4
-f 387//4 388//4 187//4
-f 284//4 255//4 256//4
-f 386//478 387//478 187//478
-f 284//4 256//4 257//4
-f 385//4 386//4 187//4
-f 284//4 257//4 258//4
-f 384//4 385//4 187//4
-f 284//4 258//4 259//4
-f 383//4 384//4 187//4
-f 283//4 259//4 260//4
-f 382//4 383//4 187//4
-f 283//4 260//4 261//4
-f 313//4 198//4 199//4
-f 283//4 261//4 262//4
-f 373//4 374//4 188//4
-f 283//4 262//4 263//4
-f 188//4 381//4 382//4
-f 283//4 263//4 264//4
-f 188//4 380//4 381//4
-f 283//477 264//477 265//477
-f 188//4 374//4 375//4
-f 283//4 265//4 266//4
-f 380//4 188//4 379//4
-f 283//4 266//4 267//4
-f 379//4 188//4 378//4
-f 283//4 267//4 268//4
-f 378//4 188//4 377//4
-f 283//4 268//4 269//4
-f 377//4 188//4 376//4
-f 282//4 269//4 270//4
-f 313//4 199//4 200//4
-f 282//4 270//4 271//4
-f 376//4 188//4 375//4
-f 277//4 271//4 272//4
-f 313//4 314//4 198//4
-f 276//4 272//4 273//4
-f 313//4 200//4 201//4
-f 275//4 273//4 274//4
-f 104//4 371//4 372//4
-f 276//4 273//4 275//4
-f 104//4 370//4 371//4
-f 277//4 272//4 276//4
-f 104//4 369//4 370//4
-f 278//4 271//4 277//4
-f 104//4 366//4 367//4
-f 281//4 271//4 278//4
-f 104//4 365//4 366//4
-f 281//4 278//4 279//4
-f 104//4 364//4 365//4
-f 281//4 279//4 280//4
-f 104//4 367//4 368//4
-f 282//4 271//4 281//4
-f 104//4 361//4 362//4
-f 283//4 269//4 282//4
-f 104//4 362//4 363//4
-f 284//4 259//4 283//4
-f 104//4 103//4 349//4
-f 285//4 254//4 284//4
-f 104//4 349//4 350//4
-f 286//4 254//4 285//4
-f 104//4 350//4 351//4
-f 287//4 252//4 286//4
-f 104//4 351//4 352//4
-f 288//4 251//4 287//4
-f 104//4 352//4 353//4
-f 289//4 250//4 288//4
-f 104//4 353//4 354//4
-f 290//4 248//4 289//4
-f 104//4 354//4 355//4
-f 291//4 247//4 290//4
-f 104//4 355//4 356//4
-f 292//4 245//4 291//4
-f 104//4 356//4 357//4
-f 293//4 243//4 292//4
-f 104//4 357//4 358//4
-f 294//4 243//4 293//4
-f 104//4 358//4 359//4
-f 295//4 243//4 294//4
-f 104//4 359//4 360//4
-f 296//4 243//4 295//4
-f 104//4 360//4 361//4
-f 297//4 243//4 296//4
-f 104//4 363//4 364//4
-f 298//4 243//4 297//4
-f 104//4 368//4 369//4
-f 304//4 243//4 298//4
-f 334//4 104//4 372//4
-f 304//4 300//4 301//4
-f 337//4 343//4 104//4
-f 304//4 299//4 300//4
-f 104//4 347//4 348//4
-f 304//4 301//4 302//4
-f 104//4 346//4 347//4
-f 304//4 302//4 303//4
-f 104//4 345//4 346//4
-f 298//4 299//4 304//4
-f 104//4 344//4 345//4
-f 240//4 243//4 304//4
-f 104//4 343//4 344//4
-f 240//4 304//4 305//4
-f 337//4 65//4 343//4
-f 307//4 305//4 306//4
-f 337//4 61//4 65//4
-f 240//4 305//4 307//4
-f 337//4 62//4 61//4
-f 308//4 235//4 307//4
-f 337//4 342//4 62//4
-f 234//4 235//4 308//4
-f 337//4 341//4 342//4
-f 310//4 308//4 309//4
-f 337//4 340//4 341//4
-f 217//4 218//4 310//4
-f 337//4 339//4 340//4
-f 208//4 312//4 207//4
-f 337//4 338//4 339//4
-f 312//4 206//4 207//4
-f 336//4 337//4 104//4
-f 312//4 313//4 206//4
-f 335//4 336//4 104//4
-f 206//4 313//4 205//4
-f 334//4 335//4 104//4
-f 313//4 204//4 205//4
-f 333//4 334//4 372//4
-f 313//4 203//4 204//4
-f 332//4 333//4 372//4
-f 313//4 202//4 203//4
-f 373//4 332//4 372//4
-f 313//4 201//4 202//4
-f 373//4 331//4 332//4
-f 314//4 315//4 198//4
-f 373//4 330//4 331//4
-f 315//4 316//4 197//4
-f 373//4 329//4 330//4
-f 316//4 317//4 197//4
-f 373//4 328//4 329//4
-f 317//4 318//4 196//4
-f 373//4 327//4 328//4
-f 318//4 319//4 195//4
-f 373//4 326//4 327//4
-f 319//4 320//4 195//4
-f 373//4 325//4 326//4
-f 320//4 321//4 194//4
-f 373//4 191//4 325//4
-f 321//4 322//4 194//4
-f 325//4 192//4 324//4
-f 322//4 323//4 193//4
-f 62//5 342//5 63//5
-f 730//6 731//6 457//6
-f 681//6 687//6 688//6
-f 458//6 730//6 457//6
-f 681//6 688//6 689//6
-f 458//6 459//6 730//6
-f 681//6 689//6 690//6
-f 459//6 460//6 730//6
-f 680//6 690//6 691//6
-f 730//6 460//6 729//6
-f 685//6 686//6 687//6
-f 729//6 460//6 461//6
-f 606//6 691//6 692//6
-f 729//6 461//6 462//6
-f 684//6 685//6 687//6
-f 463//6 729//6 462//6
-f 606//6 692//6 693//6
-f 464//6 729//6 463//6
-f 683//6 684//6 687//6
-f 465//6 729//6 464//6
-f 606//6 693//6 694//6
-f 465//6 728//6 729//6
-f 606//6 694//6 695//6
-f 466//6 475//6 476//6
-f 682//6 683//6 687//6
-f 473//6 467//6 472//6
-f 606//6 695//6 696//6
-f 470//6 468//6 469//6
-f 604//6 696//6 697//6
-f 467//6 468//6 470//6
-f 604//6 697//6 698//6
-f 471//6 467//6 470//6
-f 681//6 682//6 687//6
-f 472//6 467//6 471//6
-f 604//6 698//6 699//6
-f 473//6 474//6 467//6
-f 604//6 699//6 700//6
-f 474//6 466//6 467//6
-f 604//6 700//6 701//6
-f 474//6 475//6 466//6
-f 603//6 701//6 702//6
-f 466//6 476//6 465//6
-f 603//6 702//6 703//6
-f 476//6 477//6 465//6
-f 680//6 681//6 690//6
-f 477//6 728//6 465//6
-f 603//6 703//6 704//6
-f 477//6 478//6 728//6
-f 602//6 704//6 705//6
-f 478//6 479//6 728//6
-f 602//6 705//6 706//6
-f 479//6 480//6 728//6
-f 602//6 706//6 707//6
-f 480//6 481//6 728//6
-f 602//6 707//6 708//6
-f 481//6 482//6 728//6
-f 602//6 708//6 709//6
-f 482//6 483//6 728//6
-f 601//6 709//6 710//6
-f 728//6 483//6 484//6
-f 606//6 679//6 680//6
-f 728//6 484//6 485//6
-f 607//6 678//6 679//6
-f 728//6 485//6 486//6
-f 607//6 677//6 678//6
-f 728//6 486//6 487//6
-f 675//6 676//6 677//6
-f 728//6 487//6 488//6
-f 607//6 675//6 677//6
-f 489//6 728//6 488//6
-f 672//6 673//6 674//6
-f 490//6 728//6 489//6
-f 671//6 672//6 674//6
-f 491//6 728//6 490//6
-f 610//6 671//6 674//6
-f 492//6 728//6 491//6
-f 610//6 616//6 671//6
-f 493//6 728//6 492//6
-f 671//6 617//6 618//6
-f 494//6 728//6 493//6
-f 619//6 671//6 618//6
-f 495//6 728//6 494//6
-f 620//6 621//6 671//6
-f 496//6 728//6 495//6
-f 671//6 621//6 622//6
-f 497//6 728//6 496//6
-f 670//6 671//6 622//6
-f 498//6 728//6 497//6
-f 669//6 670//6 622//6
-f 499//6 728//6 498//6
-f 623//6 669//6 622//6
-f 500//6 728//6 499//6
-f 623//6 668//6 669//6
-f 501//6 728//6 500//6
-f 623//6 667//6 668//6
-f 502//6 728//6 501//6
-f 623//6 624//6 667//6
-f 503//6 728//6 502//6
-f 667//6 624//6 666//6
-f 504//6 728//6 503//6
-f 666//6 624//6 625//6
-f 509//6 728//6 504//6
-f 665//6 666//6 625//6
-f 510//6 728//6 509//6
-f 664//6 665//6 625//6
-f 512//6 728//6 511//6
-f 626//6 664//6 625//6
-f 514//6 728//6 513//6
-f 626//6 663//6 664//6
-f 515//6 728//6 514//6
-f 626//6 627//6 663//6
-f 517//6 728//6 516//6
-f 663//6 627//6 662//6
-f 518//479 728//479 517//479
-f 662//6 627//6 628//6
-f 520//6 728//6 519//6
-f 661//6 662//6 628//6
-f 521//6 728//6 520//6
-f 660//6 661//6 628//6
-f 522//6 728//6 521//6
-f 629//6 660//6 628//6
-f 506//6 504//6 505//6
-f 629//6 630//6 660//6
-f 507//6 504//6 506//6
-f 660//6 630//6 659//6
-f 508//6 504//6 507//6
-f 631//6 654//6 655//6
-f 509//6 504//6 508//6
-f 631//6 653//6 654//6
-f 510//6 511//6 728//6
-f 631//6 652//6 653//6
-f 513//6 728//6 512//6
-f 631//6 651//6 652//6
-f 728//6 515//6 516//6
-f 631//6 650//6 651//6
-f 518//6 519//6 728//6
-f 648//480 649//480 631//480
-f 522//6 523//6 728//6
-f 647//6 648//6 631//6
-f 523//479 524//479 728//479
-f 646//6 647//6 631//6
-f 524//6 525//6 728//6
-f 645//6 631//6 632//6
-f 525//6 526//6 728//6
-f 644//6 632//6 643//6
-f 526//481 527//481 728//481
-f 643//6 637//6 642//6
-f 527//6 528//6 728//6
-f 639//6 640//6 641//6
-f 528//6 529//6 728//6
-f 635//6 633//6 634//6
-f 529//6 530//6 728//6
-f 635//6 636//6 633//6
-f 530//6 531//6 728//6
-f 633//6 636//6 643//6
-f 531//6 727//6 728//6
-f 643//6 636//6 637//6
-f 532//6 727//6 531//6
-f 638//6 641//6 642//6
-f 533//6 727//6 532//6
-f 638//6 639//6 641//6
-f 534//6 727//6 533//6
-f 642//6 637//6 638//6
-f 535//6 727//6 534//6
-f 643//6 632//6 633//6
-f 536//6 727//6 535//6
-f 644//6 645//6 632//6
-f 537//6 727//6 536//6
-f 645//6 646//6 631//6
-f 723//6 724//6 589//6
-f 631//479 649//479 650//479
-f 723//6 591//6 722//6
-f 630//6 631//6 655//6
-f 591//6 592//6 722//6
-f 656//6 630//6 655//6
-f 593//6 721//6 592//6
-f 656//6 657//6 630//6
-f 590//6 723//6 589//6
-f 630//6 657//6 658//6
-f 724//6 725//6 540//6
-f 659//6 630//6 658//6
-f 540//6 726//6 727//6
-f 619//6 620//6 671//6
-f 539//6 727//6 538//6
-f 610//6 613//6 614//6
-f 727//6 537//6 538//6
-f 610//6 614//6 615//6
-f 540//6 727//6 539//6
-f 610//6 612//6 613//6
-f 725//6 726//6 540//6
-f 610//6 615//6 616//6
-f 724//6 540//6 589//6
-f 610//6 611//6 612//6
-f 594//6 720//6 721//6
-f 671//6 616//6 617//6
-f 595//6 596//6 720//6
-f 609//6 610//6 674//6
-f 597//6 719//6 596//6
-f 607//6 609//6 674//6
-f 582//6 540//6 541//6
-f 607//6 608//6 609//6
-f 599//6 718//6 598//6
-f 607//6 674//6 675//6
-f 566//6 542//6 543//6
-f 606//6 607//6 679//6
-f 566//6 543//6 544//6
-f 691//6 606//6 680//6
-f 566//6 544//6 545//6
-f 604//6 605//6 606//6
-f 566//6 547//6 548//6
-f 604//6 606//6 696//6
-f 566//6 548//6 549//6
-f 603//6 604//6 701//6
-f 566//6 549//6 550//6
-f 601//6 710//6 711//6
-f 566//6 546//6 547//6
-f 601//6 711//6 712//6
-f 566//6 552//6 553//6
-f 602//6 603//6 704//6
-f 566//6 551//6 552//6
-f 601//6 712//6 713//6
-f 564//6 565//6 566//6
-f 601//6 713//6 714//6
-f 563//6 564//6 566//6
-f 601//6 714//6 715//6
-f 562//6 563//6 566//6
-f 601//6 602//6 709//6
-f 561//6 562//6 566//6
-f 716//6 601//6 715//6
-f 560//6 561//6 566//6
-f 716//6 717//6 601//6
-f 559//6 560//6 566//6
-f 601//6 717//6 600//6
-f 558//6 559//6 566//6
-f 600//6 717//6 599//6
-f 557//6 558//6 566//6
-f 599//6 717//6 718//6
-f 556//6 557//6 566//6
-f 598//6 718//6 597//6
-f 555//6 556//6 566//6
-f 597//6 718//6 719//6
-f 554//6 555//6 566//6
-f 596//6 719//6 720//6
-f 553//6 554//6 566//6
-f 595//6 720//6 594//6
-f 550//6 551//6 566//6
-f 594//6 721//6 593//6
-f 545//6 546//6 566//6
-f 721//6 722//6 592//6
-f 541//6 542//6 566//6
-f 566//6 567//6 568//6
-f 566//6 569//6 570//6
-f 566//6 571//6 572//6
-f 577//6 66//6 64//6
-f 577//6 63//6 456//6
-f 577//6 573//6 574//6
-f 575//6 576//6 577//6
-f 577//6 574//6 575//6
-f 577//6 64//6 63//6
-f 566//6 570//6 571//6
-f 569//6 566//6 568//6
-f 723//6 590//6 591//6
-f 566//6 577//6 578//6
-f 588//6 589//6 540//6
-f 566//6 578//6 579//6
-f 587//6 588//6 540//6
-f 566//6 579//6 580//6
-f 586//6 587//6 540//6
-f 541//6 580//6 581//6
-f 585//6 586//6 540//6
-f 456//6 573//6 577//6
-f 584//6 585//6 540//6
-f 541//6 581//6 582//6
-f 583//6 584//6 540//6
-f 540//6 582//6 583//6
-f 577//6 572//6 66//6
-f 580//6 541//6 566//6
-f 832//6 833//6 834//6
-f 783//6 687//6 686//6
-f 831//6 834//6 835//6
-f 782//6 783//6 686//6
-f 830//6 835//6 836//6
-f 781//6 782//6 686//6
-f 829//6 836//6 837//6
-f 780//6 781//6 686//6
-f 831//6 832//6 834//6
-f 779//6 780//6 686//6
-f 807//6 837//6 838//6
-f 778//6 779//6 686//6
-f 807//6 838//6 839//6
-f 777//6 778//6 686//6
-f 830//6 831//6 835//6
-f 776//6 777//6 686//6
-f 807//6 839//6 840//6
-f 775//6 776//6 686//6
-f 829//6 830//6 836//6
-f 774//6 775//6 686//6
-f 828//6 829//6 837//6
-f 773//6 774//6 686//6
-f 807//6 840//6 841//6
-f 772//6 773//6 686//6
-f 807//6 828//6 837//6
-f 771//6 772//6 686//6
-f 807//6 827//6 828//6
-f 770//6 771//6 686//6
-f 807//6 808//6 827//6
-f 769//6 770//6 686//6
-f 827//6 808//6 826//6
-f 768//6 769//6 686//6
-f 808//6 824//6 825//6
-f 767//6 768//6 686//6
-f 809//6 565//6 810//6
-f 766//6 767//6 686//6
-f 809//6 810//6 811//6
-f 765//6 766//6 686//6
-f 809//6 566//6 565//6
-f 764//6 765//6 686//6
-f 809//6 811//6 812//6
-f 763//6 764//6 686//6
-f 809//6 812//6 813//6
-f 762//6 763//6 686//6
-f 809//6 813//6 814//6
-f 761//6 762//6 686//6
-f 809//6 814//6 815//6
-f 760//6 761//6 686//6
-f 809//6 815//6 816//6
-f 784//6 760//6 686//6
-f 809//6 816//6 817//6
-f 784//6 759//6 760//6
-f 809//6 817//6 818//6
-f 784//6 797//6 759//6
-f 809//6 818//6 819//6
-f 759//6 798//6 758//6
-f 809//6 819//6 820//6
-f 758//6 799//6 757//6
-f 809//6 820//6 821//6
-f 800//6 755//6 756//6
-f 809//6 821//6 822//6
-f 800//6 754//6 755//6
-f 808//6 822//6 823//6
-f 800//6 753//6 754//6
-f 808//6 823//6 824//6
-f 800//6 801//6 753//6
-f 806//6 841//6 842//6
-f 753//6 801//6 752//6
-f 806//6 842//6 843//6
-f 752//6 801//6 751//6
-f 806//6 843//6 844//6
-f 751//6 801//6 750//6
-f 806//6 844//6 732//6
-f 750//6 801//6 749//6
-f 806//6 732//6 733//6
-f 799//6 756//6 757//6
-f 805//6 733//6 734//6
-f 749//6 801//6 802//6
-f 805//6 734//6 735//6
-f 748//6 749//6 802//6
-f 805//6 735//6 736//6
-f 796//6 784//6 785//6
-f 805//6 736//6 737//6
-f 794//6 785//6 786//6
-f 805//6 737//6 738//6
-f 747//6 748//6 802//6
-f 804//6 738//6 739//6
-f 746//6 802//6 803//6
-f 804//6 739//6 740//6
-f 793//6 786//6 787//6
-f 804//6 740//6 741//6
-f 745//6 746//6 803//6
-f 804//6 741//6 742//6
-f 841//6 806//6 807//6
-f 808//6 809//6 822//6
-f 733//6 805//6 806//6
-f 826//6 808//6 825//6
-f 792//6 787//6 788//6
-f 788//6 789//6 790//6
-f 788//6 791//6 792//6
-f 786//6 793//6 794//6
-f 785//6 795//6 796//6
-f 759//6 797//6 798//6
-f 802//6 746//6 747//6
-f 758//6 798//6 799//6
-f 785//6 794//6 795//6
-f 788//6 790//6 791//6
-f 796//6 797//6 784//6
-f 742//6 803//6 804//6
-f 804//6 805//6 738//6
-f 787//6 792//6 793//6
-f 756//6 799//6 800//6
-f 742//6 743//6 803//6
-f 744//6 745//6 803//6
-f 343//7 65//7 572//7
-f 654//482 260//482 655//482
-f 653//483 261//483 654//483
-f 652//484 262//484 653//484
-f 651//11 263//11 652//11
-f 650//12 264//12 651//12
-f 649//13 265//13 650//13
-f 648//485 266//485 649//485
-f 647//486 267//486 648//486
-f 646//16 268//16 647//16
-f 645//487 269//487 646//487
-f 644//18 270//18 645//18
-f 643//19 271//19 644//19
-f 642//20 272//20 643//20
-f 641//21 273//21 642//21
-f 640//22 274//22 641//22
-f 639//23 275//23 640//23
-f 638//24 276//24 639//24
-f 637//25 277//25 638//25
-f 636//26 278//26 637//26
-f 635//27 279//27 636//27
-f 634//28 280//28 635//28
-f 633//29 281//29 634//29
-f 632//30 282//30 633//30
-f 631//31 283//31 632//31
-f 630//32 284//32 631//32
-f 629//33 285//33 630//33
-f 628//34 286//34 629//34
-f 627//35 287//35 628//35
-f 626//36 288//36 627//36
-f 625//37 289//37 626//37
-f 624//38 290//38 625//38
-f 623//39 291//39 624//39
-f 622//40 292//40 623//40
-f 621//40 293//40 622//40
-f 620//40 294//40 621//40
-f 619//40 295//40 620//40
-f 618//40 296//40 619//40
-f 617//40 297//40 618//40
-f 616//40 298//40 617//40
-f 615//40 299//40 616//40
-f 614//40 300//40 615//40
-f 613//40 301//40 614//40
-f 612//40 302//40 613//40
-f 611//40 303//40 612//40
-f 610//41 304//41 611//41
-f 609//40 305//40 610//40
-f 608//42 306//42 609//42
-f 607//40 307//40 608//40
-f 606//43 308//43 607//43
-f 605//44 309//44 606//44
-f 604//45 310//45 605//45
-f 603//46 311//46 604//46
-f 602//47 312//47 603//47
-f 601//46 313//46 602//46
-f 600//48 314//48 601//48
-f 599//49 315//49 600//49
-f 598//50 316//50 599//50
-f 597//51 317//51 598//51
-f 596//52 318//52 597//52
-f 595//53 319//53 596//53
-f 594//54 320//54 595//54
-f 593//55 321//55 594//55
-f 592//56 322//56 593//56
-f 591//57 323//57 592//57
-f 590//58 324//58 591//58
-f 589//59 325//59 590//59
-f 588//60 326//60 589//60
-f 587//61 327//61 588//61
-f 586//62 328//62 587//62
-f 585//63 329//63 586//63
-f 584//64 330//64 585//64
-f 583//65 331//65 584//65
-f 582//66 332//66 583//66
-f 581//67 333//67 582//67
-f 580//68 334//68 581//68
-f 579//69 335//69 580//69
-f 578//70 336//70 579//70
-f 577//71 337//71 578//71
-f 338//4 337//4 878//4
-f 877//4 862//4 863//4
-f 338//473 878//473 879//473
-f 877//4 863//4 864//4
-f 338//4 879//4 880//4
-f 877//4 864//4 865//4
-f 338//4 880//4 881//4
-f 877//4 866//4 867//4
-f 338//4 881//4 882//4
-f 877//4 865//4 866//4
-f 338//4 882//4 883//4
-f 876//4 870//4 241//4
-f 338//4 883//4 884//4
-f 871//4 241//4 240//4
-f 338//4 884//4 845//4
-f 871//4 872//4 241//4
-f 338//4 845//4 846//4
-f 241//4 872//4 873//4
-f 338//4 846//4 847//4
-f 874//4 241//4 873//4
-f 338//4 847//4 848//4
-f 875//4 241//4 874//4
-f 338//4 848//4 849//4
-f 876//4 241//4 875//4
-f 338//4 849//4 850//4
-f 869//4 870//4 876//4
-f 338//4 850//4 851//4
-f 869//4 876//4 868//4
-f 338//4 851//4 852//4
-f 876//4 877//4 868//4
-f 338//4 852//4 853//4
-f 877//4 867//4 868//4
-f 338//4 853//4 854//4
-f 861//4 862//4 877//4
-f 338//4 854//4 855//4
-f 338//4 861//4 877//4
-f 338//4 855//4 856//4
-f 338//4 860//4 861//4
-f 338//4 856//4 857//4
-f 338//4 859//4 860//4
-f 338//4 857//4 858//4
-f 888//46 875//46 874//46
-f 891//46 877//46 876//46
-f 575//46 339//46 338//46
-f 338//46 576//46 575//46
-f 876//46 890//46 891//46
-f 873//46 887//46 888//46
-f 876//46 889//46 890//46
-f 891//46 576//46 338//46
-f 888//46 889//46 875//46
-f 887//46 873//46 872//46
-f 885//46 871//46 240//46
-f 675//46 239//46 238//46
-f 238//46 676//46 675//46
-f 240//46 674//46 885//46
-f 872//46 886//46 887//46
-f 877//46 891//46 338//46
-f 888//46 874//46 873//46
-f 675//46 240//46 239//46
-f 240//46 675//46 674//46
-f 876//46 875//46 889//46
-f 872//46 871//46 885//46
-f 340//46 339//46 574//46
-f 341//72 340//72 573//72
-f 342//73 341//73 456//73
-f 344//74 343//74 571//74
-f 345//75 344//75 570//75
-f 346//76 345//76 569//76
-f 347//77 346//77 568//77
-f 348//78 347//78 567//78
-f 104//79 348//79 566//79
-f 105//80 104//80 809//80
-f 799//40 115//40 114//40
-f 799//40 798//40 116//40
-f 114//40 800//40 799//40
-f 112//40 802//40 801//40
-f 110//40 804//40 803//40
-f 109//40 806//40 805//40
-f 105//40 809//40 808//40
-f 109//40 805//40 804//40
-f 106//40 808//40 807//40
-f 808//40 106//40 105//40
-f 807//40 108//40 107//40
-f 804//40 110//40 109//40
-f 802//40 112//40 111//40
-f 799//40 116//40 115//40
-f 801//40 113//40 112//40
-f 807//40 107//40 106//40
-f 803//40 111//40 110//40
-f 801//40 800//40 114//40
-f 111//40 803//40 802//40
-f 806//40 108//40 807//40
-f 801//40 114//40 113//40
-f 117//40 116//40 797//40
-f 118//81 117//81 796//81
-f 119//82 118//82 795//82
-f 120//83 119//83 794//83
-f 121//84 120//84 793//84
-f 122//85 121//85 792//85
-f 123//86 122//86 791//86
-f 124//87 123//87 790//87
-f 125//88 124//88 789//88
-f 126//89 125//89 788//89
-f 127//90 126//90 787//90
-f 128//91 127//91 786//91
-f 129//92 128//92 785//92
-f 130//93 129//93 784//93
-f 131//93 130//93 686//93
-f 682//93 232//93 231//93
-f 681//93 234//93 233//93
-f 677//93 237//93 236//93
-f 681//93 233//93 232//93
-f 678//93 236//93 235//93
-f 677//93 676//93 238//93
-f 236//93 678//93 677//93
-f 235//93 680//93 679//93
-f 232//93 682//93 681//93
-f 230//93 684//93 683//93
-f 131//93 686//93 685//93
-f 685//93 229//93 131//93
-f 683//93 231//93 230//93
-f 677//93 238//93 237//93
-f 235//93 679//93 678//93
-f 231//93 683//93 682//93
-f 230//93 229//93 685//93
-f 681//93 680//93 234//93
-f 230//93 685//93 684//93
-f 672//40 242//40 673//40
-f 671//40 243//40 672//40
-f 670//94 244//94 671//94
-f 669//95 245//95 670//95
-f 668//96 246//96 669//96
-f 667//97 247//97 668//97
-f 666//98 248//98 667//98
-f 665//99 249//99 666//99
-f 664//100 250//100 665//100
-f 663//101 251//101 664//101
-f 662//102 252//102 663//102
-f 661//103 253//103 662//103
-f 660//104 254//104 661//104
-f 659//105 255//105 660//105
-f 658//488 256//488 659//488
-f 657//489 257//489 658//489
-f 656//106 258//106 657//106
-f 655//490 259//490 656//490
-f 891//6 908//6 909//6
-f 899//6 577//6 576//6
-f 891//6 907//6 908//6
-f 898//480 899//480 576//480
-f 891//6 906//6 907//6
-f 897//6 898//6 576//6
-f 891//6 904//6 905//6
-f 896//6 897//6 576//6
-f 891//6 905//6 906//6
-f 895//6 896//6 576//6
-f 890//6 900//6 901//6
-f 894//6 895//6 576//6
-f 890//6 673//6 900//6
-f 893//6 894//6 576//6
-f 890//6 901//6 902//6
-f 892//6 893//6 576//6
-f 891//6 902//6 903//6
-f 924//6 892//6 576//6
-f 891//6 903//6 904//6
-f 923//6 924//6 576//6
-f 885//6 674//6 673//6
-f 922//6 923//6 576//6
-f 886//6 885//6 673//6
-f 921//6 922//6 576//6
-f 887//6 886//6 673//6
-f 920//6 921//6 576//6
-f 888//6 887//6 673//6
-f 919//6 920//6 576//6
-f 889//6 888//6 673//6
-f 918//6 919//6 576//6
-f 890//6 889//6 673//6
-f 917//6 918//6 576//6
-f 891//6 890//6 902//6
-f 916//6 917//6 576//6
-f 576//6 909//6 910//6
-f 915//6 916//6 576//6
-f 576//6 910//6 911//6
-f 914//6 915//6 576//6
-f 576//6 911//6 912//6
-f 913//6 914//6 576//6
-f 576//6 912//6 913//6
-f 899//110 878//110 577//110
-f 892//111 845//111 893//111
-f 924//112 846//112 892//112
-f 923//491 847//491 924//491
-f 922//114 848//114 923//114
-f 921//115 849//115 922//115
-f 920//116 850//116 921//116
-f 919//117 851//117 920//117
-f 918//118 852//118 919//118
-f 917//119 853//119 918//119
-f 916//120 854//120 917//120
-f 915//121 855//121 916//121
-f 914//122 856//122 915//122
-f 913//123 857//123 914//123
-f 912//124 858//124 913//124
-f 911//125 859//125 912//125
-f 910//126 860//126 911//126
-f 909//127 861//127 910//127
-f 908//40 862//40 909//40
-f 907//40 863//40 908//40
-f 906//40 864//40 907//40
-f 905//40 865//40 906//40
-f 904//40 866//40 905//40
-f 903//40 867//40 904//40
-f 902//40 868//40 903//40
-f 901//40 869//40 902//40
-f 900//40 870//40 901//40
-f 673//40 241//40 900//40
-f 898//492 879//492 899//492
-f 897//129 880//129 898//129
-f 896//130 881//130 897//130
-f 895//131 882//131 896//131
-f 894//132 883//132 895//132
-f 893//493 884//493 894//493
-f 715//134 200//134 716//134
-f 714//135 201//135 715//135
-f 716//136 199//136 717//136
-f 713//137 202//137 714//137
-f 717//138 198//138 718//138
-f 712//139 203//139 713//139
-f 718//140 197//140 719//140
-f 711//141 204//141 712//141
-f 719//142 196//142 720//142
-f 710//143 205//143 711//143
-f 720//144 195//144 721//144
-f 709//145 206//145 710//145
-f 721//146 194//146 722//146
-f 708//147 207//147 709//147
-f 722//148 193//148 723//148
-f 707//149 208//149 708//149
-f 723//150 192//150 724//150
-f 706//151 209//151 707//151
-f 724//152 191//152 725//152
-f 705//153 210//153 706//153
-f 725//154 190//154 726//154
-f 704//155 211//155 705//155
-f 726//156 189//156 727//156
-f 703//157 212//157 704//157
-f 727//158 188//158 728//158
-f 702//159 213//159 703//159
-f 728//160 187//160 729//160
-f 701//161 214//161 702//161
-f 729//162 186//162 730//162
-f 700//163 215//163 701//163
-f 730//164 185//164 731//164
-f 699//165 216//165 700//165
-f 731//166 184//166 457//166
-f 698//167 217//167 699//167
-f 457//168 183//168 458//168
-f 697//169 218//169 698//169
-f 458//170 455//170 459//170
-f 696//171 219//171 697//171
-f 459//172 454//172 460//172
-f 695//173 220//173 696//173
-f 460//174 453//174 461//174
-f 694//175 221//175 695//175
-f 461//176 452//176 462//176
-f 693//177 222//177 694//177
-f 462//178 451//178 463//178
-f 692//179 223//179 693//179
-f 463//180 450//180 464//180
-f 691//181 224//181 692//181
-f 464//182 449//182 465//182
-f 690//183 225//183 691//183
-f 465//184 448//184 466//184
-f 689//185 226//185 690//185
-f 466//186 447//186 467//186
-f 688//187 227//187 689//187
-f 467//188 446//188 468//188
-f 687//189 228//189 688//189
-f 468//494 445//494 469//494
-f 783//191 132//191 687//191
-f 469//192 444//192 470//192
-f 782//193 133//193 783//193
-f 470//194 443//194 471//194
-f 781//195 134//195 782//195
-f 471//196 442//196 472//196
-f 780//197 135//197 781//197
-f 472//198 441//198 473//198
-f 779//199 136//199 780//199
-f 473//495 440//495 474//495
-f 778//496 137//496 779//496
-f 474//202 439//202 475//202
-f 777//497 138//497 778//497
-f 475//204 438//204 476//204
-f 776//205 139//205 777//205
-f 476//206 437//206 477//206
-f 775//207 140//207 776//207
-f 477//498 436//498 478//498
-f 774//499 141//499 775//499
-f 478//210 435//210 479//210
-f 773//211 142//211 774//211
-f 479//212 434//212 480//212
-f 772//213 143//213 773//213
-f 480//500 433//500 481//500
-f 771//215 144//215 772//215
-f 481//501 432//501 482//501
-f 770//217 145//217 771//217
-f 482//218 431//218 483//218
-f 769//219 146//219 770//219
-f 483//502 430//502 484//502
-f 768//503 147//503 769//503
-f 484//222 429//222 485//222
-f 767//223 148//223 768//223
-f 485//504 428//504 486//504
-f 766//225 149//225 767//225
-f 486//505 427//505 487//505
-f 765//227 150//227 766//227
-f 487//506 426//506 488//506
-f 764//229 151//229 765//229
-f 488//230 425//230 489//230
-f 763//231 152//231 764//231
-f 489//507 424//507 490//507
-f 762//233 153//233 763//233
-f 490//234 423//234 491//234
-f 761//235 154//235 762//235
-f 491//508 422//508 492//508
-f 760//237 155//237 761//237
-f 492//509 421//509 493//509
-f 759//239 156//239 760//239
-f 493//510 420//510 494//510
-f 758//241 157//241 759//241
-f 494//242 419//242 495//242
-f 757//243 158//243 758//243
-f 495//244 418//244 496//244
-f 756//245 159//245 757//245
-f 496//511 417//511 497//511
-f 755//247 160//247 756//247
-f 497//512 416//512 498//512
-f 754//249 161//249 755//249
-f 498//513 415//513 499//513
-f 753//251 162//251 754//251
-f 499//514 414//514 500//514
-f 752//253 163//253 753//253
-f 500//515 413//515 501//515
-f 751//255 164//255 752//255
-f 501//256 412//256 502//256
-f 750//257 165//257 751//257
-f 502//516 411//516 503//516
-f 749//259 166//259 750//259
-f 503//517 410//517 504//517
-f 748//261 167//261 749//261
-f 504//238 409//238 505//238
-f 747//262 168//262 748//262
-f 505//518 408//518 506//518
-f 746//264 169//264 747//264
-f 506//519 407//519 507//519
-f 745//266 170//266 746//266
-f 507//267 406//267 508//267
-f 744//268 171//268 745//268
-f 508//269 405//269 509//269
-f 743//270 172//270 744//270
-f 509//271 404//271 510//271
-f 742//272 173//272 743//272
-f 510//520 403//520 511//520
-f 741//274 174//274 742//274
-f 511//521 402//521 512//521
-f 740//276 175//276 741//276
-f 512//277 401//277 513//277
-f 739//278 176//278 740//278
-f 513//522 400//522 514//522
-f 738//280 177//280 739//280
-f 514//281 399//281 515//281
-f 737//282 178//282 738//282
-f 515//523 398//523 516//523
-f 736//284 179//284 737//284
-f 516//285 397//285 517//285
-f 735//286 180//286 736//286
-f 517//285 396//285 518//285
-f 734//287 181//287 735//287
-f 518//285 395//285 519//285
-f 733//288 182//288 734//288
-f 519//285 394//285 520//285
-f 732//289 67//289 733//289
-f 520//285 393//285 521//285
-f 844//290 68//290 732//290
-f 521//285 392//285 522//285
-f 843//291 69//291 844//291
-f 522//285 391//285 523//285
-f 842//292 70//292 843//292
-f 523//285 390//285 524//285
-f 841//293 71//293 842//293
-f 524//285 389//285 525//285
-f 840//294 72//294 841//294
-f 525//285 388//285 526//285
-f 839//295 73//295 840//295
-f 526//285 387//285 527//285
-f 838//296 74//296 839//296
-f 527//285 386//285 528//285
-f 837//297 75//297 838//297
-f 528//524 385//524 529//524
-f 836//299 76//299 837//299
-f 529//525 384//525 530//525
-f 835//301 77//301 836//301
-f 530//526 383//526 531//526
-f 834//303 78//303 835//303
-f 531//527 382//527 532//527
-f 833//305 79//305 834//305
-f 532//528 381//528 533//528
-f 832//307 80//307 833//307
-f 533//529 380//529 534//529
-f 831//309 81//309 832//309
-f 534//310 379//310 535//310
-f 830//311 82//311 831//311
-f 535//312 378//312 536//312
-f 829//313 83//313 830//313
-f 536//530 377//530 537//530
-f 828//315 84//315 829//315
-f 537//316 376//316 538//316
-f 827//317 85//317 828//317
-f 538//318 375//318 539//318
-f 826//319 86//319 827//319
-f 539//531 374//531 540//531
-f 825//321 87//321 826//321
-f 540//40 373//40 541//40
-f 824//322 88//322 825//322
-f 541//323 372//323 542//323
-f 823//324 89//324 824//324
-f 542//323 371//323 543//323
-f 822//325 90//325 823//325
-f 543//323 370//323 544//323
-f 821//326 91//326 822//326
-f 544//323 369//323 545//323
-f 820//327 92//327 821//327
-f 545//323 368//323 546//323
-f 819//328 93//328 820//328
-f 546//323 367//323 547//323
-f 818//329 94//329 819//329
-f 547//323 366//323 548//323
-f 817//330 95//330 818//330
-f 548//323 365//323 549//323
-f 816//331 96//331 817//331
-f 549//323 364//323 550//323
-f 815//532 97//532 816//532
-f 550//323 363//323 551//323
-f 814//333 98//333 815//333
-f 551//323 362//323 552//323
-f 813//334 99//334 814//334
-f 552//323 361//323 553//323
-f 812//335 100//335 813//335
-f 553//336 360//336 554//336
-f 811//337 101//337 812//337
-f 554//338 359//338 555//338
-f 810//339 102//339 811//339
-f 555//533 358//533 556//533
-f 565//341 103//341 810//341
-f 556//342 357//342 557//342
-f 564//343 349//343 565//343
-f 557//344 356//344 558//344
-f 563//345 350//345 564//345
-f 558//534 355//534 559//534
-f 562//347 351//347 563//347
-f 559//535 354//535 560//535
-f 561//349 352//349 562//349
-f 560//350 353//350 561//350
-f 1012//4 1044//4 925//4
-f 1013//4 1014//4 1043//4
-f 1020//4 1040//4 1041//4
-f 1029//4 1033//4 1039//4
-f 1038//4 1036//4 1037//4
-f 1038//4 1039//4 1035//4
-f 1031//4 1032//4 1033//4
-f 1029//536 1030//536 1031//536
-f 1039//4 1028//4 1029//4
-f 1039//4 1026//4 1027//4
-f 1039//4 1024//4 1025//4
-f 1040//4 1022//4 1023//4
-f 1040//4 1020//4 1021//4
-f 1041//4 1018//4 1019//4
-f 1041//4 1016//4 1017//4
-f 1016//4 1042//4 1015//4
-f 1044//4 1012//4 1013//4
-f 926//4 1010//4 1011//4
-f 927//4 1008//4 1009//4
-f 929//4 1006//4 1007//4
-f 931//4 1004//4 1005//4
-f 933//4 1002//4 1003//4
-f 935//4 1000//4 1001//4
-f 937//4 998//4 999//4
-f 939//4 996//4 997//4
-f 941//4 994//4 995//4
-f 943//4 992//4 993//4
-f 992//4 944//4 991//4
-f 946//4 988//4 989//4
-f 948//4 986//4 987//4
-f 949//4 984//4 985//4
-f 984//4 951//4 983//4
-f 953//4 980//4 981//4
-f 975//4 978//4 979//4
-f 978//4 976//4 977//4
-f 954//4 974//4 975//4
-f 954//4 972//4 973//4
-f 954//4 970//4 971//4
-f 954//4 955//4 969//4
-f 955//4 966//4 967//4
-f 955//4 964//4 965//4
-f 955//4 962//4 963//4
-f 956//4 960//4 961//4
-f 957//4 958//4 959//4
-f 960//4 956//4 957//4
-f 965//4 966//4 955//4
-f 981//4 952//4 953//4
-f 952//4 982//4 951//4
-f 985//4 948//4 949//4
-f 988//4 946//4 947//4
-f 989//4 990//4 945//4
-f 993//4 942//4 943//4
-f 995//4 940//4 941//4
-f 997//4 938//4 939//4
-f 999//4 936//4 937//4
-f 1001//4 934//4 935//4
-f 1003//4 932//4 933//4
-f 1005//4 930//4 931//4
-f 1007//4 928//4 929//4
-f 1009//4 926//4 927//4
-f 1013//4 1043//4 1044//4
-f 1023//4 1039//4 1040//4
-f 1038//4 1035//4 1036//4
-f 1029//537 1031//537 1033//537
-f 1039//4 1027//4 1028//4
-f 1039//4 1023//4 1024//4
-f 1041//4 1019//4 1020//4
-f 1041//4 1042//4 1016//4
-f 925//4 1011//4 1012//4
-f 928//4 1007//4 1008//4
-f 932//4 1003//4 1004//4
-f 936//4 999//4 1000//4
-f 940//4 995//4 996//4
-f 943//4 944//4 992//4
-f 947//4 987//4 988//4
-f 949//4 950//4 984//4
-f 953//4 954//4 980//4
-f 978//4 975//4 976//4
-f 954//4 971//4 972//4
-f 969//4 955//4 968//4
-f 955//4 963//4 964//4
-f 957//4 959//4 960//4
-f 961//4 955//4 956//4
-f 981//4 982//4 952//4
-f 987//4 947//4 948//4
-f 945//4 990//4 991//4
-f 996//4 939//4 940//4
-f 1000//4 935//4 936//4
-f 1004//4 931//4 932//4
-f 1008//4 927//4 928//4
-f 1043//4 1014//4 1042//4
-f 1035//4 1039//4 1034//4
-f 1039//473 1025//473 1026//473
-f 1041//4 1017//4 1018//4
-f 926//4 1009//4 1010//4
-f 933//4 934//4 1002//4
-f 941//4 942//4 994//4
-f 948//4 985//4 986//4
-f 954//4 975//4 979//4
-f 954//4 969//4 970//4
-f 955//4 961//4 962//4
-f 955//4 967//4 968//4
-f 989//4 945//4 946//4
-f 997//4 998//4 938//4
-f 1005//4 1006//4 930//4
-f 1039//473 1033//473 1034//473
-f 1040//4 1021//4 1022//4
-f 929//4 930//4 1006//4
-f 994//4 942//4 993//4
-f 980//4 954//4 979//4
-f 973//4 974//4 954//4
-f 944//4 945//4 991//4
-f 1011//4 925//4 926//4
-f 1015//4 1042//4 1014//4
-f 984//4 950//4 951//4
-f 951//4 982//4 983//4
-f 934//4 1001//4 1002//4
-f 1090//6 1164//6 1045//6
-f 1092//6 1162//6 1163//6
-f 1093//6 1094//6 1161//6
-f 1095//6 1096//6 1159//6
-f 1098//6 1156//6 1157//6
-f 1100//6 1154//6 1155//6
-f 1101//6 1102//6 1153//6
-f 1103//6 1104//6 1151//6
-f 1107//6 1148//6 1149//6
-f 1109//6 1110//6 1147//6
-f 1111//6 1144//6 1145//6
-f 1114//6 1142//6 1143//6
-f 1126//6 1140//6 1141//6
-f 1135//6 1138//6 1139//6
-f 1138//6 1136//6 1137//6
-f 1139//6 1134//6 1135//6
-f 1140//6 1132//6 1133//6
-f 1140//6 1130//6 1131//6
-f 1140//6 1128//6 1129//6
-f 1140//6 1126//6 1127//6
-f 1141//6 1124//6 1125//6
-f 1141//6 1122//6 1123//6
-f 1141//6 1120//6 1121//6
-f 1117//6 1118//6 1119//6
-f 1120//6 1116//6 1117//6
-f 1142//6 1114//6 1115//6
-f 1144//6 1112//6 1113//6
-f 1145//6 1146//6 1111//6
-f 1147//6 1108//6 1109//6
-f 1149//6 1106//6 1107//6
-f 1106//6 1150//6 1105//6
-f 1151//6 1152//6 1103//6
-f 1154//6 1100//6 1101//6
-f 1156//6 1098//6 1099//6
-f 1157//6 1158//6 1097//6
-f 1159//6 1160//6 1095//6
-f 1162//6 1092//6 1093//6
-f 1164//6 1090//6 1091//6
-f 1045//6 1046//6 1089//6
-f 1047//6 1048//6 1087//6
-f 1049//6 1084//6 1085//6
-f 1051//6 1082//6 1083//6
-f 1053//6 1080//6 1081//6
-f 1053//6 1054//6 1079//6
-f 1054//6 1076//6 1077//6
-f 1054//6 1055//6 1075//6
-f 1055//6 1072//6 1073//6
-f 1056//6 1070//6 1071//6
-f 1056//6 1068//6 1069//6
-f 1065//6 1066//6 1067//6
-f 1063//538 1064//538 1065//538
-f 1061//539 1062//539 1063//539
-f 1056//6 1060//6 1061//6
-f 1057//6 1058//6 1059//6
-f 1060//6 1056//6 1057//6
-f 1056//480 1069//480 1070//480
-f 1081//6 1052//6 1053//6
-f 1083//6 1050//6 1051//6
-f 1085//6 1086//6 1049//6
-f 1087//6 1088//6 1047//6
-f 1091//6 1163//6 1164//6
-f 1161//6 1094//6 1160//6
-f 1099//6 1155//6 1156//6
-f 1153//6 1102//6 1152//6
-f 1108//6 1147//6 1148//6
-f 1113//6 1143//6 1144//6
-f 1133//6 1134//6 1140//6
-f 1138//6 1135//6 1136//6
-f 1140//6 1131//6 1132//6
-f 1140//6 1127//6 1128//6
-f 1141//6 1123//6 1124//6
-f 1117//6 1119//6 1120//6
-f 1141//6 1115//6 1116//6
-f 1144//6 1111//6 1112//6
-f 1148//6 1107//6 1108//6
-f 1105//6 1150//6 1104//6
-f 1155//6 1099//6 1100//6
-f 1097//6 1158//6 1096//6
-f 1163//6 1091//6 1092//6
-f 1089//6 1046//6 1088//6
-f 1050//6 1083//6 1084//6
-f 1053//6 1079//6 1080//6
-f 1054//6 1075//6 1076//6
-f 1055//6 1056//6 1072//6
-f 1056//6 1067//6 1068//6
-f 1061//6 1063//6 1065//6
-f 1057//6 1059//6 1060//6
-f 1061//6 1067//6 1056//6
-f 1082//6 1051//6 1052//6
-f 1049//6 1086//6 1048//6
-f 1093//6 1161//6 1162//6
-f 1101//6 1153//6 1154//6
-f 1147//6 1110//6 1146//6
-f 1140//6 1134//6 1139//6
-f 1140//6 1129//6 1130//6
-f 1141//6 1121//6 1122//6
-f 1143//6 1113//6 1114//6
-f 1149//6 1150//6 1106//6
-f 1157//6 1097//6 1098//6
-f 1045//6 1089//6 1090//6
-f 1052//6 1081//6 1082//6
-f 1075//6 1055//6 1074//6
-f 1061//540 1065//540 1067//540
-f 1056//6 1071//6 1072//6
-f 1084//6 1049//6 1050//6
-f 1160//6 1094//6 1095//6
-f 1115//6 1141//6 1142//6
-f 1141//6 1125//6 1126//6
-f 1111//6 1146//6 1110//6
-f 1096//6 1158//6 1159//6
-f 1079//6 1054//6 1078//6
-f 1073//6 1074//6 1055//6
-f 1048//6 1086//6 1087//6
-f 1116//6 1120//6 1141//6
-f 1104//6 1150//6 1151//6
-f 1078//6 1054//6 1077//6
-f 1152//6 1102//6 1103//6
-f 1135//351 960//351 1136//351
-f 1134//352 961//352 1135//352
-f 1136//353 959//353 1137//353
-f 1133//354 962//354 1134//354
-f 1137//355 958//355 1138//355
-f 1132//541 963//541 1133//541
-f 1138//357 957//357 1139//357
-f 1131//358 964//358 1132//358
-f 1139//359 956//359 1140//359
-f 1130//341 965//341 1131//341
-f 1140//360 955//360 1141//360
-f 1129//542 966//542 1130//542
-f 1141//362 954//362 1142//362
-f 1128//543 967//543 1129//543
-f 1142//364 953//364 1143//364
-f 1127//365 968//365 1128//365
-f 1143//366 952//366 1144//366
-f 1126//367 969//367 1127//367
-f 1144//368 951//368 1145//368
-f 1125//544 970//544 1126//544
-f 1145//370 950//370 1146//370
-f 1124//545 971//545 1125//545
-f 1146//372 949//372 1147//372
-f 1123//546 972//546 1124//546
-f 1147//374 948//374 1148//374
-f 1122//375 973//375 1123//375
-f 1148//376 947//376 1149//376
-f 1121//377 974//377 1122//377
-f 1149//378 946//378 1150//378
-f 1120//379 975//379 1121//379
-f 1150//380 945//380 1151//380
-f 1119//381 976//381 1120//381
-f 1151//382 944//382 1152//382
-f 1118//383 977//383 1119//383
-f 1152//384 943//384 1153//384
-f 1117//385 978//385 1118//385
-f 1153//386 942//386 1154//386
-f 1116//387 979//387 1117//387
-f 1154//388 941//388 1155//388
-f 1115//389 980//389 1116//389
-f 1155//390 940//390 1156//390
-f 1114//391 981//391 1115//391
-f 1156//392 939//392 1157//392
-f 1113//393 982//393 1114//393
-f 1157//394 938//394 1158//394
-f 1112//395 983//395 1113//395
-f 1158//396 937//396 1159//396
-f 1111//397 984//397 1112//397
-f 1159//398 936//398 1160//398
-f 1110//399 985//399 1111//399
-f 1160//400 935//400 1161//400
-f 1109//401 986//401 1110//401
-f 1161//402 934//402 1162//402
-f 1108//403 987//403 1109//403
-f 1162//404 933//404 1163//404
-f 1107//405 988//405 1108//405
-f 1163//406 932//406 1164//406
-f 1106//407 989//407 1107//407
-f 1164//408 931//408 1045//408
-f 1105//409 990//409 1106//409
-f 1045//410 930//410 1046//410
-f 1104//411 991//411 1105//411
-f 1046//412 929//412 1047//412
-f 1103//413 992//413 1104//413
-f 1047//414 928//414 1048//414
-f 1102//415 993//415 1103//415
-f 1048//416 927//416 1049//416
-f 1101//417 994//417 1102//417
-f 1049//418 926//418 1050//418
-f 1100//419 995//419 1101//419
-f 1050//420 925//420 1051//420
-f 1099//421 996//421 1100//421
-f 1051//422 1044//422 1052//422
-f 1098//423 997//423 1099//423
-f 1052//424 1043//424 1053//424
-f 1097//425 998//425 1098//425
-f 1053//426 1042//426 1054//426
-f 1096//427 999//427 1097//427
-f 1054//428 1041//428 1055//428
-f 1095//429 1000//429 1096//429
-f 1055//430 1040//430 1056//430
-f 1094//431 1001//431 1095//431
-f 1056//432 1039//432 1057//432
-f 1093//433 1002//433 1094//433
-f 1057//434 1038//434 1058//434
-f 1092//435 1003//435 1093//435
-f 1058//436 1037//436 1059//436
-f 1091//437 1004//437 1092//437
-f 1059//438 1036//438 1060//438
-f 1090//439 1005//439 1091//439
-f 1060//440 1035//440 1061//440
-f 1089//441 1006//441 1090//441
-f 1061//547 1034//547 1062//547
-f 1088//443 1007//443 1089//443
-f 1062//444 1033//444 1063//444
-f 1087//445 1008//445 1088//445
-f 1063//548 1032//548 1064//548
-f 1086//447 1009//447 1087//447
-f 1064//549 1031//549 1065//549
-f 1085//449 1010//449 1086//449
-f 1065//550 1030//550 1066//550
-f 1084//451 1011//451 1085//451
-f 1066//551 1029//551 1067//551
-f 1083//453 1012//453 1084//453
-f 1067//454 1028//454 1068//454
-f 1082//455 1013//455 1083//455
-f 1068//456 1027//456 1069//456
-f 1081//457 1014//457 1082//457
-f 1069//552 1026//552 1070//552
-f 1080//459 1015//459 1081//459
-f 1070//553 1025//553 1071//553
-f 1079//461 1016//461 1080//461
-f 1071//462 1024//462 1072//462
-f 1078//463 1017//463 1079//463
-f 1072//554 1023//554 1073//554
-f 1077//465 1018//465 1078//465
-f 1073//466 1022//466 1074//466
-f 1076//467 1019//467 1077//467
-f 1074//468 1021//468 1075//468
-f 1075//469 1020//469 1076//469
+s 1
+f 1//1 2//1 3//1
+f 4//2 3//2 5//2
+f 6//3 7//3 8//3
+f 9//3 10//3 11//3
+f 12//4 13//4 2//4
+f 14//5 15//5 16//5
+f 17//5 18//5 19//5
+f 20//6 5//6 15//6
+f 21//7 22//7 23//7
+f 24//8 21//9 25//9
+f 26//10 24//11 27//11
+f 28//12 26//13 29//14
+f 30//15 28//16 31//15
+f 32//17 30//18 33//17
+f 34//19 32//20 35//19
+f 36//21 34//22 37//22
+f 38//23 36//23 39//23
+f 40//24 38//24 41//24
+f 42//25 40//25 43//25
+f 44//26 42//26 45//26
+f 46//27 44//27 47//27
+f 48//28 46//28 49//28
+f 50//29 48//29 51//29
+f 52//30 50//30 53//30
+f 54//31 52//31 55//31
+f 56//32 54//32 57//32
+f 58//33 56//33 59//34
+f 60//35 58//35 61//35
+f 62//36 60//36 63//37
+f 64//38 62//38 65//38
+f 66//39 64//39 67//39
+f 68//40 66//40 69//40
+f 70//41 68//41 71//41
+f 72//42 70//42 73//42
+f 74//43 72//43 75//43
+f 76//44 74//44 77//44
+f 78//45 76//45 79//45
+f 80//46 78//46 81//46
+f 82//47 80//47 83//47
+f 84//48 82//48 85//48
+f 86//49 84//49 87//49
+f 88//49 86//49 89//49
+f 90//49 88//49 91//49
+f 92//49 90//49 93//49
+f 94//49 92//49 95//49
+f 96//49 94//49 97//49
+f 98//49 96//49 99//49
+f 100//49 98//49 101//49
+f 102//49 100//49 103//49
+f 104//49 102//49 105//49
+f 106//49 104//49 107//49
+f 108//49 106//49 109//49
+f 110//50 108//50 111//50
+f 112//49 110//49 113//49
+f 114//51 112//51 115//51
+f 116//49 114//49 117//49
+f 118//52 116//52 119//52
+f 120//53 118//53 121//53
+f 122//54 120//54 123//54
+f 124//55 122//55 125//55
+f 126//56 124//56 127//56
+f 128//55 126//55 129//55
+f 130//57 128//57 131//57
+f 132//58 130//58 133//58
+f 134//59 132//59 135//59
+f 136//60 134//60 137//60
+f 138//61 136//61 139//61
+f 140//62 138//62 141//62
+f 142//63 140//63 143//63
+f 144//64 142//64 145//64
+f 146//65 144//65 147//65
+f 11//66 146//66 148//66
+f 9//67 11//67 149//67
+f 150//68 9//68 151//68
+f 152//69 150//69 153//69
+f 154//70 152//70 155//70
+f 156//71 154//71 157//71
+f 158//72 156//72 159//72
+f 160//73 158//73 161//73
+f 162//74 160//74 163//74
+f 164//75 162//75 165//75
+f 166//76 164//76 167//76
+f 168//77 166//77 169//77
+f 170//78 168//78 171//78
+f 172//79 170//79 173//79
+f 174//80 172//80 175//80
+f 176//3 177//3 178//3
+f 179//55 180//55 181//55
+f 182//55 183//55 184//55
+f 185//81 184//81 186//81
+f 187//82 186//82 13//82
+f 188//83 15//83 189//83
+f 190//84 189//84 191//84
+f 192//85 191//85 193//85
+f 194//86 193//86 195//86
+f 196//87 195//87 197//87
+f 198//88 197//88 14//88
+f 199//89 14//89 200//89
+f 201//49 202//49 203//49
+f 204//49 205//49 206//49
+f 207//90 206//90 208//90
+f 209//91 208//91 210//91
+f 211//92 210//92 212//92
+f 213//93 212//93 214//93
+f 215//94 214//94 216//94
+f 217//95 216//95 218//95
+f 219//96 218//96 220//96
+f 221//97 220//97 222//97
+f 223//98 222//98 224//98
+f 225//99 224//99 226//99
+f 227//100 226//100 228//100
+f 229//101 228//101 230//101
+f 231//102 230//102 232//102
+f 233//102 232//102 234//102
+f 235//102 236//102 237//102
+f 238//49 239//49 240//49
+f 241//49 238//49 242//49
+f 243//103 241//103 244//103
+f 245//104 243//104 246//105
+f 247//106 245//106 248//106
+f 249//107 247//107 250//107
+f 251//108 249//108 252//108
+f 253//109 251//109 254//109
+f 255//110 253//110 256//110
+f 257//111 255//111 258//111
+f 259//112 257//112 260//112
+f 261//113 259//113 262//113
+f 263//114 261//114 264//114
+f 265//115 263//115 266//115
+f 267//116 265//117 268//118
+f 269//119 267//116 270//116
+f 271//120 269//119 272//119
+f 22//121 271//121 273//122
+f 274//5 275//5 276//5
+f 277//123 174//123 16//123
+f 278//124 279//124 280//124
+f 281//125 278//125 282//125
+f 283//126 281//126 284//126
+f 285//127 283//127 286//127
+f 287//128 285//128 288//128
+f 289//129 287//129 290//129
+f 291//130 289//130 292//130
+f 293//131 291//131 294//131
+f 295//132 293//132 296//132
+f 297//133 295//133 298//133
+f 299//134 297//134 300//134
+f 301//135 299//135 302//135
+f 303//136 301//136 304//136
+f 176//137 303//137 305//137
+f 177//138 176//138 306//138
+f 307//139 177//139 308//139
+f 309//140 307//140 310//140
+f 311//49 309//49 276//49
+f 312//49 311//49 313//49
+f 314//49 312//49 315//49
+f 316//49 314//49 317//49
+f 318//49 316//49 319//49
+f 320//49 318//49 321//49
+f 322//49 320//49 323//49
+f 324//49 322//49 325//49
+f 326//49 324//49 327//49
+f 239//49 326//49 328//49
+f 329//141 277//141 330//141
+f 331//142 329//142 332//142
+f 333//143 331//143 334//143
+f 335//144 333//144 336//144
+f 337//145 335//145 338//145
+f 279//146 337//146 339//146
+f 340//147 341//147 342//147
+f 343//148 340//148 344//148
+f 341//149 345//149 346//149
+f 347//150 343//150 348//150
+f 345//151 349//151 350//151
+f 351//152 347//152 352//152
+f 349//153 353//153 354//153
+f 355//154 351//154 356//155
+f 353//156 357//156 358//156
+f 359//157 355//157 360//157
+f 357//158 361//158 362//158
+f 363//159 359//159 364//159
+f 361//160 365//160 366//160
+f 367//161 363//161 368//161
+f 365//162 10//162 369//162
+f 370//163 367//163 371//163
+f 10//164 372//164 373//164
+f 374//165 370//165 375//165
+f 372//166 376//166 377//166
+f 378//167 374//167 379//167
+f 376//168 380//168 381//168
+f 382//169 378//169 383//169
+f 380//170 384//170 385//170
+f 386//171 382//171 387//171
+f 384//172 388//172 389//172
+f 390//173 386//173 391//173
+f 388//174 392//174 393//174
+f 394//175 390//175 395//175
+f 392//176 396//176 397//176
+f 398//177 394//177 399//177
+f 396//178 400//178 401//178
+f 402//179 398//179 403//179
+f 400//180 404//180 405//180
+f 406//181 402//181 407//181
+f 404//182 408//182 409//182
+f 410//183 406//183 411//183
+f 408//184 412//184 413//184
+f 414//185 410//185 415//185
+f 412//186 416//186 417//186
+f 418//187 414//187 419//187
+f 416//188 420//188 421//188
+f 422//189 418//189 423//189
+f 420//190 424//190 425//190
+f 426//191 422//191 427//191
+f 424//192 428//192 429//192
+f 430//193 426//193 431//193
+f 428//194 432//194 433//194
+f 434//195 430//195 435//195
+f 432//196 436//196 437//196
+f 438//197 434//197 439//197
+f 436//198 440//198 441//198
+f 442//199 438//199 443//199
+f 440//200 444//200 445//200
+f 446//201 442//201 447//201
+f 444//202 448//202 449//202
+f 450//203 446//203 451//203
+f 448//204 452//204 453//204
+f 454//205 450//205 455//205
+f 452//206 456//206 457//206
+f 458//207 454//207 459//207
+f 456//208 460//208 461//208
+f 462//209 458//209 463//209
+f 460//210 464//210 465//210
+f 466//211 462//211 467//211
+f 464//212 468//212 469//212
+f 470//213 466//213 471//213
+f 468//214 472//214 473//214
+f 474//215 470//215 475//215
+f 472//216 476//216 477//216
+f 478//217 474//217 479//217
+f 476//218 480//218 481//218
+f 482//219 478//219 483//219
+f 480//220 484//220 485//220
+f 486//221 482//221 487//221
+f 484//222 488//222 489//222
+f 490//223 486//223 491//223
+f 488//224 492//224 493//224
+f 494//225 490//225 495//225
+f 492//226 496//226 497//226
+f 498//227 494//227 499//227
+f 496//228 500//228 501//228
+f 502//229 498//229 503//229
+f 500//230 504//230 505//230
+f 506//231 502//231 507//232
+f 504//233 508//233 509//234
+f 510//235 506//235 511//235
+f 508//236 512//237 513//238
+f 514//239 510//239 515//239
+f 512//240 516//240 517//241
+f 518//242 514//242 519//242
+f 516//243 520//244 521//245
+f 522//246 518//246 523//246
+f 520//247 524//247 525//247
+f 526//248 522//248 527//248
+f 524//249 528//249 529//249
+f 530//250 526//250 531//250
+f 528//251 532//251 533//252
+f 534//253 530//253 535//253
+f 532//254 536//254 537//254
+f 538//255 534//255 539//255
+f 536//256 540//256 541//257
+f 542//258 538//258 543//258
+f 540//259 544//260 545//261
+f 546//262 542//262 547//262
+f 544//263 548//264 549//265
+f 550//266 546//266 551//266
+f 548//267 552//268 553//267
+f 554//269 550//269 555//269
+f 552//270 556//270 557//271
+f 558//272 554//272 559//272
+f 556//273 560//274 561//275
+f 562//276 558//276 563//276
+f 560//277 564//278 565//277
+f 566//279 562//279 567//279
+f 564//280 568//281 569//281
+f 570//282 566//282 571//282
+f 568//283 572//283 573//284
+f 574//285 570//285 575//285
+f 572//286 576//287 577//288
+f 578//289 574//289 579//289
+f 576//290 580//291 581//292
+f 582//293 578//293 583//293
+f 580//294 584//295 585//296
+f 586//297 582//297 587//297
+f 584//298 588//299 589//300
+f 590//301 586//301 591//301
+f 588//302 592//302 593//303
+f 594//304 590//304 595//304
+f 592//305 596//305 597//305
+f 598//306 594//306 599//306
+f 596//307 600//307 601//307
+f 602//308 598//308 603//308
+f 600//309 604//309 605//309
+f 606//310 602//310 607//310
+f 604//311 608//311 609//311
+f 610//312 606//312 611//312
+f 608//313 612//313 613//313
+f 614//314 610//314 19//314
+f 612//315 615//315 616//315
+f 617//316 614//316 18//316
+f 615//317 618//317 619//317
+f 620//318 617//318 621//318
+f 618//319 622//320 623//320
+f 6//321 620//321 624//321
+f 622//320 625//322 626//323
+f 7//324 6//324 627//324
+f 625//325 628//325 629//325
+f 630//326 7//326 631//326
+f 628//327 632//327 633//327
+f 634//328 630//328 635//328
+f 632//329 636//330 637//330
+f 638//331 634//331 639//331
+f 636//332 640//332 641//332
+f 642//333 638//333 643//333
+f 640//332 644//332 645//332
+f 646//334 642//334 647//334
+f 644//332 648//332 649//332
+f 650//335 646//335 651//335
+f 648//332 652//332 653//332
+f 654//336 650//336 655//336
+f 652//332 656//332 657//332
+f 658//337 654//337 659//337
+f 656//332 660//332 661//332
+f 662//338 658//338 663//338
+f 660//332 664//332 665//332
+f 666//339 662//339 667//339
+f 664//332 668//332 669//332
+f 670//340 666//340 671//340
+f 668//332 672//332 673//332
+f 674//341 670//341 675//341
+f 672//332 676//332 677//332
+f 678//342 674//342 679//342
+f 676//332 680//332 681//332
+f 682//343 678//343 683//343
+f 680//332 684//332 685//332
+f 686//344 682//344 687//344
+f 684//345 688//345 689//345
+f 690//346 686//346 691//346
+f 688//347 692//347 693//347
+f 694//348 690//348 695//348
+f 692//349 696//349 697//349
+f 698//350 694//350 699//350
+f 696//351 700//351 701//351
+f 702//352 698//352 703//352
+f 700//353 704//353 705//353
+f 706//354 702//354 707//354
+f 704//355 708//355 709//355
+f 710//356 706//356 711//356
+f 708//357 712//357 713//357
+f 714//358 710//358 715//358
+f 712//359 716//359 717//359
+f 718//360 714//360 719//360
+f 716//361 720//361 721//361
+f 722//362 718//362 723//362
+f 720//363 724//363 725//363
+f 726//364 722//364 727//364
+f 724//365 728//365 729//365
+f 730//366 726//366 731//366
+f 728//296 732//296 733//296
+f 734//367 730//367 735//367
+f 732//49 736//49 737//49
+f 738//368 734//368 739//368
+f 736//369 740//369 741//369
+f 742//370 738//370 743//370
+f 740//369 744//369 745//369
+f 746//371 742//371 747//371
+f 744//369 748//369 749//369
+f 750//372 746//372 751//372
+f 748//369 752//369 753//369
+f 754//373 750//373 755//373
+f 752//369 756//369 757//369
+f 758//374 754//374 759//374
+f 756//369 760//369 761//369
+f 762//375 758//375 763//375
+f 760//369 764//369 765//369
+f 766//376 762//376 767//376
+f 764//369 768//377 769//377
+f 770//378 766//378 771//378
+f 768//377 772//369 773//369
+f 774//379 770//379 775//379
+f 772//369 776//369 777//369
+f 778//380 774//380 779//380
+f 776//369 780//377 781//377
+f 782//381 778//381 783//381
+f 780//377 784//369 785//369
+f 786//382 782//382 787//382
+f 784//383 788//383 789//383
+f 790//384 786//384 791//384
+f 788//385 792//385 793//385
+f 794//386 790//386 795//386
+f 792//387 796//387 797//387
+f 798//388 794//388 799//388
+f 796//389 800//389 801//389
+f 802//390 798//390 803//390
+f 800//391 804//391 805//391
+f 806//392 802//392 807//392
+f 804//393 808//393 809//393
+f 810//394 806//394 811//394
+f 808//395 812//395 813//395
+f 814//396 810//396 815//396
+f 812//397 814//397 816//397
+f 817//3 818//3 819//3
+f 820//5 821//5 822//5
+f 823//398 824//398 825//398
+f 826//399 823//399 827//399
+f 824//400 828//400 829//400
+f 830//401 826//401 831//401
+f 828//402 832//402 833//402
+f 834//403 830//403 835//403
+f 832//404 836//404 837//404
+f 838//405 834//405 839//405
+f 836//406 840//406 841//406
+f 842//407 838//407 843//407
+f 840//408 844//408 845//408
+f 846//409 842//410 847//409
+f 844//411 848//411 849//411
+f 850//412 846//412 851//412
+f 848//413 852//413 853//413
+f 854//414 850//414 855//414
+f 852//415 856//415 857//415
+f 858//416 854//416 859//416
+f 856//417 860//417 861//417
+f 862//418 858//418 863//418
+f 860//419 864//419 865//420
+f 866//421 862//422 867//421
+f 864//423 868//423 869//424
+f 870//425 866//426 871//425
+f 868//427 872//427 873//427
+f 874//428 870//428 875//428
+f 872//429 876//429 877//429
+f 878//430 874//430 879//430
+f 876//431 880//431 881//431
+f 882//432 878//432 883//432
+f 880//433 884//433 885//433
+f 886//434 882//434 887//434
+f 884//435 888//435 889//435
+f 890//436 886//436 891//436
+f 888//437 892//437 893//437
+f 894//438 890//438 895//438
+f 892//439 896//439 897//439
+f 898//440 894//440 899//440
+f 896//441 900//441 901//441
+f 902//442 898//442 903//442
+f 900//443 904//443 905//443
+f 906//444 902//444 907//444
+f 904//445 819//445 908//445
+f 909//446 906//446 910//446
+f 819//447 818//447 911//447
+f 912//448 909//448 913//448
+f 818//449 914//449 915//449
+f 916//450 912//450 917//450
+f 914//451 918//451 919//451
+f 920//452 916//452 921//452
+f 918//453 922//453 923//453
+f 924//454 920//454 925//454
+f 922//455 926//455 927//455
+f 928//456 924//456 929//456
+f 926//457 930//457 931//457
+f 932//458 928//458 933//458
+f 930//459 934//459 935//459
+f 936//460 932//460 937//460
+f 934//461 938//461 939//461
+f 940//462 936//462 941//462
+f 938//463 942//463 821//463
+f 943//464 940//464 944//464
+f 942//465 945//465 822//465
+f 946//466 943//466 947//466
+f 945//467 948//467 949//467
+f 950//468 946//468 951//468
+f 948//469 952//469 953//469
+f 954//470 950//470 955//470
+f 952//471 956//471 957//471
+f 958//472 954//472 959//472
+f 956//473 960//473 961//473
+f 962//474 958//474 963//474
+f 960//475 964//475 965//475
+f 966//476 962//476 967//476
+f 964//477 968//477 969//477
+f 817//478 966//478 970//478
+f 968//479 971//479 972//480
+f 973//481 817//481 974//481
+f 971//482 975//482 976//482
+f 977//483 973//483 978//483
+f 975//484 979//484 980//484
+f 981//485 977//485 982//485
+f 979//486 983//486 984//486
+f 985//487 981//487 986//487
+f 983//488 987//488 988//488
+f 989//489 985//489 990//489
+f 987//490 991//490 992//490
+f 993//491 989//491 994//491
+f 991//492 995//492 996//492
+f 997//493 993//493 998//493
+f 995//302 999//302 1000//302
+f 1001//494 997//494 1002//494
+f 999//495 1003//495 1004//495
+f 1005//496 1001//496 1006//496
+f 1003//497 1007//497 1008//497
+f 1009//498 1005//498 820//498
+f 1007//499 1010//500 1011//499
+f 1012//501 1009//501 1013//501
+f 1010//254 1014//254 1015//254
+f 1016//502 1012//502 1017//502
+f 1014//503 1018//503 1019//503
+f 1020//504 1016//504 1021//504
+f 1018//505 1022//506 1023//505
+f 1024//507 1020//507 1025//507
+f 1022//508 1026//509 1027//510
+f 1028//511 1024//511 1029//511
+f 1026//512 1030//513 1031//513
+f 1032//514 1028//514 1033//514
+f 1030//515 1034//515 1035//515
+f 1036//516 1032//516 1037//516
+f 1034//517 1038//517 1039//518
+f 1040//519 1036//519 1041//519
+f 1038//520 1042//520 1043//520
+f 1044//521 1040//521 1045//521
+f 1042//522 1046//523 1047//522
+f 1048//524 1044//524 1049//524
+f 1046//525 1050//525 1051//525
+f 1052//526 1048//526 1053//526
+f 1050//527 1054//527 1055//527
+f 1054//528 1052//528 1056//528
+f 4//1 1//1 3//1
+f 20//2 4//2 5//2
+f 1057//3 454//3 458//3
+f 698//3 702//3 706//3
+f 1057//3 458//3 462//3
+f 710//3 698//3 706//3
+f 1057//3 462//3 466//3
+f 710//3 694//3 698//3
+f 1057//3 466//3 470//3
+f 710//3 714//3 694//3
+f 1057//3 470//3 474//3
+f 714//3 690//3 694//3
+f 1057//3 474//3 478//3
+f 714//3 718//3 690//3
+f 1057//3 478//3 482//3
+f 690//3 718//3 686//3
+f 1057//3 482//3 486//3
+f 718//3 722//3 686//3
+f 1057//3 486//3 490//3
+f 686//3 722//3 1058//3
+f 1057//3 490//3 494//3
+f 686//3 1058//3 682//3
+f 1057//3 494//3 498//3
+f 1058//3 678//3 682//3
+f 1057//3 498//3 502//3
+f 1058//3 674//3 678//3
+f 1057//3 502//3 506//3
+f 1058//3 722//3 726//3
+f 1057//3 506//3 510//3
+f 1059//3 726//3 730//3
+f 1057//3 510//3 514//3
+f 1059//3 730//3 734//3
+f 1057//3 514//3 518//3
+f 742//3 1059//3 738//3
+f 1057//3 518//3 522//3
+f 746//3 1059//3 742//3
+f 1057//3 522//3 526//3
+f 1060//3 798//3 199//3
+f 1057//3 526//3 530//3
+f 1060//3 794//3 798//3
+f 1057//3 530//3 534//3
+f 790//3 794//3 1060//3
+f 1057//3 534//3 538//3
+f 786//3 790//3 1060//3
+f 1057//3 538//3 542//3
+f 782//3 786//3 1060//3
+f 1057//3 542//3 546//3
+f 778//3 782//3 1060//3
+f 233//3 546//3 550//3
+f 774//3 778//3 1060//3
+f 204//3 550//3 554//3
+f 770//3 774//3 1060//3
+f 1061//3 554//3 558//3
+f 766//3 770//3 1060//3
+f 1061//3 558//3 562//3
+f 762//3 766//3 1060//3
+f 1062//3 562//3 566//3
+f 758//3 762//3 1060//3
+f 1062//3 566//3 570//3
+f 754//3 758//3 1060//3
+f 1062//3 570//3 574//3
+f 750//3 754//3 1060//3
+f 1063//3 574//3 578//3
+f 746//3 750//3 1060//3
+f 1063//3 578//3 582//3
+f 1059//3 746//3 1060//3
+f 1063//3 582//3 586//3
+f 1059//3 734//3 738//3
+f 1063//3 586//3 590//3
+f 1059//3 1058//3 726//3
+f 1064//3 590//3 594//3
+f 674//3 1058//3 670//3
+f 1064//3 594//3 598//3
+f 670//3 1058//3 202//3
+f 1061//3 204//3 554//3
+f 666//3 670//3 202//3
+f 1064//3 598//3 602//3
+f 662//3 666//3 202//3
+f 1065//3 602//3 606//3
+f 658//3 662//3 202//3
+f 546//3 233//3 1057//3
+f 654//3 658//3 202//3
+f 550//3 204//3 207//3
+f 650//3 654//3 202//3
+f 1065//3 606//3 610//3
+f 201//3 650//3 202//3
+f 1065//3 610//3 614//3
+f 201//3 646//3 650//3
+f 233//3 550//3 207//3
+f 201//3 642//3 646//3
+f 1065//3 614//3 617//3
+f 201//3 638//3 642//3
+f 209//3 233//3 207//3
+f 201//3 634//3 638//3
+f 8//3 617//3 620//3
+f 221//3 223//3 225//3
+f 225//3 219//3 221//3
+f 225//3 227//3 217//3
+f 215//3 227//3 229//3
+f 231//3 213//3 229//3
+f 574//3 1063//3 1062//3
+f 229//3 213//3 215//3
+f 562//3 1062//3 1061//3
+f 617//3 8//3 1065//3
+f 590//3 1064//3 1063//3
+f 215//3 217//3 227//3
+f 225//3 217//3 219//3
+f 209//3 231//3 233//3
+f 630//3 634//3 201//3
+f 213//3 231//3 211//3
+f 630//3 201//3 8//3
+f 602//3 1065//3 1064//3
+f 630//3 8//3 7//3
+f 620//3 6//3 8//3
+f 209//3 211//3 231//3
+f 396//3 408//3 404//3
+f 396//3 416//3 412//3
+f 392//3 424//3 420//3
+f 392//3 432//3 428//3
+f 480//3 440//3 436//3
+f 460//3 456//3 444//3
+f 448//3 456//3 452//3
+f 444//3 464//3 460//3
+f 444//3 472//3 468//3
+f 440//3 480//3 476//3
+f 588//3 488//3 484//3
+f 500//529 496//530 492//3
+f 508//3 504//531 500//532
+f 516//533 512//533 508//533
+f 548//534 544//3 540//3
+f 520//535 516//535 508//535
+f 552//3 548//534 540//3
+f 524//536 520//536 508//536
+f 556//3 552//3 540//3
+f 524//3 508//3 500//532
+f 556//537 540//537 536//537
+f 528//538 524//538 500//538
+f 560//3 556//3 536//3
+f 528//539 500//529 492//3
+f 564//3 560//3 536//3
+f 532//540 528//539 492//3
+f 568//541 564//3 536//3
+f 536//3 532//540 492//3
+f 436//3 484//3 480//3
+f 444//3 468//3 464//3
+f 444//3 456//3 448//3
+f 392//3 436//3 432//3
+f 392//3 420//3 416//3
+f 396//3 404//3 400//3
+f 1066//3 454//3 1057//3
+f 412//3 408//3 396//3
+f 1066//3 1067//3 454//3
+f 416//3 396//3 392//3
+f 454//3 1067//3 1068//3
+f 436//3 392//3 388//3
+f 1069//3 454//3 1068//3
+f 696//3 388//3 384//3
+f 1069//3 1070//3 454//3
+f 732//3 384//3 380//3
+f 1070//3 450//3 454//3
+f 732//3 380//3 376//3
+f 1070//3 446//3 450//3
+f 428//3 424//3 392//3
+f 442//3 446//3 1070//3
+f 732//3 376//3 372//3
+f 438//3 442//3 1070//3
+f 150//3 372//3 10//3
+f 438//3 1070//3 236//3
+f 484//3 436//3 388//3
+f 434//3 438//3 236//3
+f 11//3 10//3 365//3
+f 118//3 434//3 236//3
+f 146//3 365//3 361//3
+f 430//3 434//3 118//3
+f 476//3 472//3 440//3
+f 426//3 430//3 118//3
+f 142//3 361//3 357//3
+f 422//3 426//3 118//3
+f 440//3 472//3 444//3
+f 418//3 422//3 118//3
+f 138//3 357//3 353//3
+f 418//3 118//3 414//3
+f 588//3 484//3 388//3
+f 414//3 118//3 122//3
+f 136//3 353//3 349//3
+f 410//3 414//3 122//3
+f 584//542 492//3 488//3
+f 406//3 122//3 402//3
+f 576//3 536//3 492//3
+f 402//3 122//3 398//3
+f 572//543 568//541 536//3
+f 398//3 122//3 394//3
+f 576//3 572//543 536//3
+f 122//3 124//3 394//3
+f 580//3 576//3 492//3
+f 394//3 124//3 390//3
+f 584//542 580//3 492//3
+f 390//3 124//3 386//3
+f 588//3 584//542 488//3
+f 386//3 124//3 382//3
+f 592//3 588//3 388//3
+f 382//3 124//3 126//3
+f 612//3 592//3 388//3
+f 378//3 382//3 126//3
+f 600//3 596//3 592//3
+f 374//3 378//3 126//3
+f 604//3 600//3 592//3
+f 370//3 374//3 126//3
+f 608//3 604//3 592//3
+f 116//3 235//3 1071//3
+f 612//3 608//3 592//3
+f 116//3 1071//3 1072//3
+f 132//3 349//3 345//3
+f 1073//3 1072//3 1074//3
+f 615//3 612//3 388//3
+f 116//3 1072//3 1073//3
+f 618//3 615//3 388//3
+f 116//3 1073//3 1075//3
+f 622//3 618//3 388//3
+f 1075//3 239//3 238//3
+f 625//3 622//3 388//3
+f 1075//3 238//3 241//3
+f 628//3 625//3 388//3
+f 86//3 241//3 243//3
+f 632//3 628//3 388//3
+f 86//3 243//3 245//3
+f 636//3 632//3 388//3
+f 84//3 245//3 247//3
+f 640//3 636//3 388//3
+f 84//3 247//3 249//3
+f 644//3 640//3 388//3
+f 82//3 249//3 251//3
+f 648//3 644//3 388//3
+f 80//3 251//3 253//3
+f 652//3 648//3 388//3
+f 80//3 253//3 255//3
+f 656//3 652//3 388//3
+f 78//3 255//3 257//3
+f 660//3 656//3 388//3
+f 76//3 257//3 259//3
+f 664//3 660//3 388//3
+f 74//3 259//3 261//3
+f 668//3 664//3 388//3
+f 74//3 261//3 263//3
+f 672//3 668//3 388//3
+f 70//3 263//3 265//3
+f 676//3 672//3 388//3
+f 70//3 265//3 267//3
+f 680//3 676//3 388//3
+f 70//3 267//3 269//3
+f 684//3 680//3 388//3
+f 70//3 269//3 271//3
+f 688//3 684//3 388//3
+f 70//3 271//3 22//3
+f 692//3 688//3 388//3
+f 68//3 22//3 21//3
+f 696//3 692//3 388//3
+f 68//3 21//3 24//3
+f 128//3 345//3 341//3
+f 68//3 24//3 26//3
+f 732//3 728//3 384//3
+f 68//3 26//3 28//3
+f 384//3 700//3 696//3
+f 68//3 28//3 30//3
+f 384//3 704//3 700//3
+f 68//3 30//3 32//3
+f 384//3 728//3 724//3
+f 68//3 32//3 34//3
+f 704//3 384//3 708//3
+f 68//3 34//3 36//3
+f 708//3 384//3 712//3
+f 68//3 36//3 38//3
+f 712//3 384//3 716//3
+f 68//3 38//3 40//3
+f 716//3 384//3 720//3
+f 66//3 40//3 42//3
+f 128//3 341//3 340//3
+f 66//3 42//3 44//3
+f 720//3 384//3 724//3
+f 56//3 44//3 46//3
+f 128//3 130//3 345//3
+f 54//3 46//3 48//3
+f 128//3 340//3 343//3
+f 52//3 48//3 50//3
+f 199//3 740//3 736//3
+f 54//3 48//3 52//3
+f 199//3 744//3 740//3
+f 56//3 46//3 54//3
+f 199//3 748//3 744//3
+f 58//3 44//3 56//3
+f 199//3 760//3 756//3
+f 64//3 44//3 58//3
+f 199//3 764//3 760//3
+f 64//3 58//3 60//3
+f 199//3 768//3 764//3
+f 64//3 60//3 62//3
+f 199//3 756//3 752//3
+f 66//3 44//3 64//3
+f 199//3 780//3 776//3
+f 68//3 40//3 66//3
+f 199//3 776//3 772//3
+f 70//3 22//3 68//3
+f 199//3 798//3 802//3
+f 72//3 263//3 70//3
+f 199//3 802//3 806//3
+f 74//3 263//3 72//3
+f 199//3 806//3 810//3
+f 76//3 259//3 74//3
+f 199//3 810//3 814//3
+f 78//3 257//3 76//3
+f 199//3 814//3 812//3
+f 80//3 255//3 78//3
+f 199//3 812//3 808//3
+f 82//3 251//3 80//3
+f 199//3 808//3 804//3
+f 84//3 249//3 82//3
+f 199//3 804//3 800//3
+f 86//3 245//3 84//3
+f 199//3 800//3 796//3
+f 88//3 241//3 86//3
+f 199//3 796//3 792//3
+f 90//3 241//3 88//3
+f 199//3 792//3 788//3
+f 92//3 241//3 90//3
+f 199//3 788//3 784//3
+f 94//3 241//3 92//3
+f 199//3 784//3 780//3
+f 96//3 241//3 94//3
+f 199//3 772//3 768//3
+f 98//3 241//3 96//3
+f 199//3 752//3 748//3
+f 110//3 241//3 98//3
+f 168//3 199//3 736//3
+f 110//3 102//3 104//3
+f 174//3 188//3 199//3
+f 110//3 100//3 102//3
+f 199//3 196//3 198//3
+f 110//3 104//3 106//3
+f 199//3 194//3 196//3
+f 110//3 106//3 108//3
+f 199//3 192//3 194//3
+f 98//3 100//3 110//3
+f 199//3 190//3 192//3
+f 1075//3 241//3 110//3
+f 199//3 188//3 190//3
+f 1075//3 110//3 112//3
+f 174//3 20//3 188//3
+f 116//3 112//3 114//3
+f 174//3 4//3 20//3
+f 1075//3 112//3 116//3
+f 174//3 1//3 4//3
+f 118//3 235//3 116//3
+f 174//3 12//3 1//3
+f 236//3 235//3 118//3
+f 174//3 187//3 12//3
+f 122//3 118//3 120//3
+f 174//3 185//3 187//3
+f 406//3 410//3 122//3
+f 174//3 182//3 185//3
+f 370//3 126//3 367//3
+f 174//3 178//3 182//3
+f 126//3 363//3 367//3
+f 172//3 174//3 199//3
+f 126//3 128//3 363//3
+f 170//3 172//3 199//3
+f 363//3 128//3 359//3
+f 168//3 170//3 199//3
+f 128//3 355//3 359//3
+f 166//3 168//3 736//3
+f 128//3 351//3 355//3
+f 164//3 166//3 736//3
+f 128//3 347//3 351//3
+f 732//3 164//3 736//3
+f 128//3 343//3 347//3
+f 732//3 162//3 164//3
+f 130//3 132//3 345//3
+f 732//3 160//3 162//3
+f 132//3 134//3 349//3
+f 732//3 158//3 160//3
+f 134//3 136//3 349//3
+f 732//3 156//3 158//3
+f 136//3 138//3 353//3
+f 732//3 154//3 156//3
+f 138//3 140//3 357//3
+f 732//3 152//3 154//3
+f 140//3 142//3 357//3
+f 732//3 150//3 152//3
+f 142//3 144//3 361//3
+f 732//3 372//3 150//3
+f 144//3 146//3 361//3
+f 150//3 10//3 9//3
+f 146//3 11//3 365//3
+f 1//4 12//4 2//4
+f 397//5 401//5 405//5
+f 1076//5 455//5 451//5
+f 409//5 397//5 405//5
+f 1076//5 451//5 447//5
+f 409//5 413//5 397//5
+f 1076//5 447//5 443//5
+f 413//5 417//5 397//5
+f 237//5 443//5 439//5
+f 397//5 417//5 393//5
+f 1077//5 234//5 455//5
+f 393//5 417//5 421//5
+f 121//5 439//5 435//5
+f 393//5 421//5 425//5
+f 1078//5 1077//5 455//5
+f 429//5 393//5 425//5
+f 121//5 435//5 431//5
+f 433//5 393//5 429//5
+f 1079//5 1078//5 455//5
+f 437//5 393//5 433//5
+f 121//5 431//5 427//5
+f 437//5 389//5 393//5
+f 121//5 427//5 423//5
+f 441//5 477//5 481//5
+f 1080//5 1079//5 455//5
+f 469//5 445//5 465//5
+f 121//5 423//5 419//5
+f 457//5 449//5 453//5
+f 125//5 419//5 415//5
+f 445//5 449//5 457//5
+f 125//5 415//5 411//5
+f 461//5 445//5 457//5
+f 1076//5 1080//5 455//5
+f 465//5 445//5 461//5
+f 125//5 411//5 407//5
+f 469//5 473//5 445//5
+f 125//5 407//5 403//5
+f 473//5 441//5 445//5
+f 125//5 403//5 399//5
+f 473//5 477//5 441//5
+f 127//5 399//5 395//5
+f 441//5 481//5 437//5
+f 127//5 395//5 391//5
+f 481//5 485//5 437//5
+f 237//5 1076//5 443//5
+f 485//5 389//5 437//5
+f 127//5 391//5 387//5
+f 485//5 489//5 389//5
+f 129//5 387//5 383//5
+f 489//5 493//5 389//5
+f 129//5 383//5 379//5
+f 493//5 497//5 389//5
+f 129//5 379//5 375//5
+f 497//5 501//5 389//5
+f 129//5 375//5 371//5
+f 501//5 505//5 389//5
+f 129//5 371//5 368//5
+f 505//5 509//5 389//5
+f 131//5 368//5 364//5
+f 389//5 509//5 513//5
+f 121//5 1081//5 237//5
+f 389//5 513//5 517//544
+f 119//5 1082//5 1081//5
+f 389//5 517//544 521//5
+f 119//5 1083//5 1082//5
+f 389//5 521//5 525//5
+f 1084//5 1085//5 1083//5
+f 389//5 525//5 529//5
+f 119//5 1084//5 1083//5
+f 533//5 389//5 529//5
+f 242//5 240//5 1086//5
+f 537//544 389//5 533//5
+f 244//5 242//5 1086//5
+f 541//544 389//5 537//544
+f 113//5 244//5 1086//5
+f 545//5 389//5 541//544
+f 113//5 101//5 244//5
+f 549//5 389//5 545//5
+f 244//5 99//5 97//5
+f 553//5 389//5 549//5
+f 95//5 244//5 97//5
+f 557//5 389//5 553//5
+f 93//5 91//5 244//5
+f 561//5 389//5 557//5
+f 244//5 91//5 89//5
+f 565//5 389//5 561//5
+f 246//5 244//5 89//5
+f 569//5 389//5 565//5
+f 248//5 246//5 89//5
+f 573//5 389//5 569//5
+f 87//5 248//5 89//5
+f 577//5 389//5 573//5
+f 87//5 250//5 248//5
+f 581//5 389//5 577//5
+f 87//5 252//5 250//5
+f 585//5 389//5 581//5
+f 87//5 85//5 252//5
+f 589//5 389//5 585//5
+f 252//5 85//5 254//5
+f 593//5 389//5 589//5
+f 254//5 85//5 83//5
+f 613//5 389//5 593//5
+f 256//5 254//5 83//5
+f 616//5 389//5 613//5
+f 258//5 256//5 83//5
+f 623//5 389//5 619//5
+f 81//5 258//5 83//5
+f 629//5 389//5 626//5
+f 81//5 260//5 258//5
+f 633//5 389//5 629//5
+f 81//5 79//5 260//5
+f 641//5 389//5 637//5
+f 260//5 79//5 262//5
+f 645//5 389//5 641//5
+f 262//5 79//5 77//5
+f 653//5 389//5 649//5
+f 264//5 262//5 77//5
+f 657//5 389//5 653//5
+f 266//5 264//5 77//5
+f 661//5 389//5 657//5
+f 75//5 266//5 77//5
+f 601//5 593//5 597//5
+f 75//5 73//5 266//5
+f 605//5 593//5 601//5
+f 266//5 73//5 268//5
+f 609//5 593//5 605//5
+f 71//5 25//5 23//5
+f 613//5 593//5 609//5
+f 71//5 27//5 25//5
+f 616//5 619//5 389//5
+f 71//5 29//5 27//5
+f 626//5 389//5 623//5
+f 71//5 31//5 29//5
+f 389//5 633//5 637//5
+f 71//5 33//5 31//5
+f 645//5 649//5 389//5
+f 37//5 35//5 71//5
+f 661//5 665//5 389//5
+f 39//5 37//5 71//5
+f 665//5 669//5 389//5
+f 41//5 39//5 71//5
+f 669//5 673//5 389//5
+f 43//5 71//5 69//5
+f 673//5 677//5 389//5
+f 45//5 69//5 47//5
+f 677//5 681//5 389//5
+f 47//5 59//5 49//5
+f 681//5 685//5 389//5
+f 55//5 53//5 51//5
+f 685//5 689//5 389//5
+f 63//5 67//5 65//5
+f 689//5 693//5 389//5
+f 63//5 61//5 67//5
+f 693//5 697//5 389//5
+f 67//5 61//5 47//5
+f 697//5 385//5 389//5
+f 47//5 61//5 59//5
+f 701//5 385//5 697//5
+f 57//5 51//5 49//5
+f 705//5 385//5 701//5
+f 57//5 55//5 51//5
+f 709//5 385//5 705//5
+f 49//5 59//5 57//5
+f 713//5 385//5 709//5
+f 47//5 69//5 67//5
+f 717//5 385//5 713//5
+f 45//5 43//5 69//5
+f 721//5 385//5 717//5
+f 43//5 41//5 71//5
+f 369//5 373//5 153//5
+f 71//5 35//5 33//5
+f 369//5 149//5 366//5
+f 73//5 71//5 23//5
+f 149//5 148//5 366//5
+f 273//5 73//5 23//5
+f 147//5 362//5 148//5
+f 273//5 272//5 73//5
+f 151//5 369//5 153//5
+f 73//5 272//5 270//5
+f 373//5 377//5 733//5
+f 268//5 73//5 270//5
+f 733//5 381//5 385//5
+f 95//5 93//5 244//5
+f 729//5 385//5 725//5
+f 113//5 107//5 105//5
+f 385//5 721//5 725//5
+f 113//5 105//5 103//5
+f 733//5 385//5 729//5
+f 113//5 109//5 107//5
+f 377//5 381//5 733//5
+f 113//5 103//5 101//5
+f 373//5 733//5 153//5
+f 113//5 111//5 109//5
+f 145//5 358//5 362//5
+f 244//5 101//5 99//5
+f 143//5 141//5 358//5
+f 115//5 113//5 1086//5
+f 139//5 354//5 141//5
+f 119//5 115//5 1086//5
+f 167//5 733//5 737//5
+f 119//5 117//5 115//5
+f 135//5 350//5 137//5
+f 119//5 1086//5 1084//5
+f 14//5 741//5 745//5
+f 121//5 119//5 1081//5
+f 14//5 745//5 749//5
+f 439//5 121//5 237//5
+f 14//5 749//5 753//5
+f 125//5 123//5 121//5
+f 14//5 761//5 765//5
+f 125//5 121//5 419//5
+f 14//5 765//5 769//5
+f 127//5 125//5 399//5
+f 14//5 769//5 773//5
+f 131//5 364//5 360//5
+f 14//5 757//5 761//5
+f 131//5 360//5 356//5
+f 14//5 781//5 785//5
+f 129//5 127//5 387//5
+f 14//5 777//5 781//5
+f 131//5 356//5 352//5
+f 807//5 803//5 14//5
+f 131//5 352//5 348//5
+f 811//5 807//5 14//5
+f 131//5 348//5 344//5
+f 815//5 811//5 14//5
+f 131//5 129//5 368//5
+f 816//5 815//5 14//5
+f 342//5 131//5 344//5
+f 813//5 816//5 14//5
+f 342//5 346//5 131//5
+f 809//5 813//5 14//5
+f 131//5 346//5 133//5
+f 805//5 809//5 14//5
+f 133//5 346//5 135//5
+f 801//5 805//5 14//5
+f 135//5 346//5 350//5
+f 797//5 801//5 14//5
+f 137//5 350//5 139//5
+f 793//5 797//5 14//5
+f 139//5 350//5 354//5
+f 789//5 793//5 14//5
+f 141//5 354//5 358//5
+f 785//5 789//5 14//5
+f 143//5 358//5 145//5
+f 773//5 777//5 14//5
+f 145//5 362//5 147//5
+f 753//5 757//5 14//5
+f 362//5 366//5 148//5
+f 737//5 741//5 14//5
+f 14//5 197//5 195//5
+f 14//5 193//5 191//5
+f 14//5 189//5 15//5
+f 16//5 5//5 3//5
+f 16//5 2//5 13//5
+f 16//5 186//5 184//5
+f 183//5 274//5 16//5
+f 16//5 184//5 183//5
+f 16//5 3//5 2//5
+f 14//5 191//5 189//5
+f 193//5 14//5 195//5
+f 369//5 151//5 149//5
+f 14//5 16//5 175//5
+f 155//5 153//5 733//5
+f 14//5 175//5 173//5
+f 157//5 155//5 733//5
+f 14//5 173//5 171//5
+f 159//5 157//5 733//5
+f 737//5 171//5 169//5
+f 161//5 159//5 733//5
+f 13//5 186//5 16//5
+f 163//5 161//5 733//5
+f 737//5 169//5 167//5
+f 165//5 163//5 733//5
+f 733//5 167//5 165//5
+f 16//5 15//5 5//5
+f 171//5 737//5 14//5
+f 711//5 707//5 703//5
+f 459//5 455//5 234//5
+f 715//5 703//5 699//5
+f 463//5 459//5 234//5
+f 719//5 699//5 695//5
+f 467//5 463//5 234//5
+f 723//5 695//5 691//5
+f 471//5 467//5 234//5
+f 715//5 711//5 703//5
+f 475//5 471//5 234//5
+f 1087//5 691//5 687//5
+f 479//5 475//5 234//5
+f 1087//5 687//5 683//5
+f 483//5 479//5 234//5
+f 719//5 715//5 699//5
+f 487//5 483//5 234//5
+f 1087//5 683//5 679//5
+f 491//5 487//5 234//5
+f 723//5 719//5 695//5
+f 495//5 491//5 234//5
+f 727//5 723//5 691//5
+f 499//5 495//5 234//5
+f 1087//5 679//5 675//5
+f 503//5 499//5 234//5
+f 1087//5 727//5 691//5
+f 507//5 503//5 234//5
+f 1087//5 731//5 727//5
+f 511//5 507//5 234//5
+f 1087//5 1088//5 731//5
+f 515//5 511//5 234//5
+f 731//5 1088//5 735//5
+f 519//5 515//5 234//5
+f 1088//5 743//5 739//5
+f 523//5 519//5 234//5
+f 200//5 803//5 799//5
+f 527//5 523//5 234//5
+f 200//5 799//5 795//5
+f 531//5 527//5 234//5
+f 200//5 14//5 803//5
+f 535//5 531//5 234//5
+f 200//5 795//5 791//5
+f 539//5 535//5 234//5
+f 200//5 791//5 787//5
+f 543//5 539//5 234//5
+f 200//5 787//5 783//5
+f 547//5 543//5 234//5
+f 200//5 783//5 779//5
+f 551//5 547//5 234//5
+f 200//5 779//5 775//5
+f 232//5 551//5 234//5
+f 200//5 775//5 771//5
+f 232//5 555//5 551//5
+f 200//5 771//5 767//5
+f 232//5 206//5 555//5
+f 200//5 767//5 763//5
+f 555//5 205//5 559//5
+f 200//5 763//5 759//5
+f 559//5 1089//5 563//5
+f 200//5 759//5 755//5
+f 1090//5 571//5 567//5
+f 200//5 755//5 751//5
+f 1090//5 575//5 571//5
+f 1088//5 751//5 747//5
+f 1090//5 579//5 575//5
+f 1088//5 747//5 743//5
+f 1090//5 1091//5 579//5
+f 203//5 675//5 671//5
+f 579//5 1091//5 583//5
+f 203//5 671//5 667//5
+f 583//5 1091//5 587//5
+f 203//5 667//5 663//5
+f 587//5 1091//5 591//5
+f 203//5 663//5 659//5
+f 591//5 1091//5 595//5
+f 203//5 659//5 655//5
+f 1089//5 567//5 563//5
+f 1092//5 655//5 651//5
+f 595//5 1091//5 1093//5
+f 1092//5 651//5 647//5
+f 599//5 595//5 1093//5
+f 1092//5 647//5 643//5
+f 208//5 232//5 230//5
+f 1092//5 643//5 639//5
+f 212//5 230//5 228//5
+f 1092//5 639//5 635//5
+f 603//5 599//5 1093//5
+f 1094//5 635//5 631//5
+f 607//5 1093//5 17//5
+f 1094//5 631//5 627//5
+f 214//5 228//5 226//5
+f 1094//5 627//5 624//5
+f 611//5 607//5 17//5
+f 1094//5 624//5 621//5
+f 675//5 203//5 1087//5
+f 1088//5 200//5 751//5
+f 655//5 1092//5 203//5
+f 735//5 1088//5 739//5
+f 216//5 226//5 224//5
+f 224//5 222//5 220//5
+f 224//5 218//5 216//5
+f 228//5 214//5 212//5
+f 230//5 210//5 208//5
+f 555//5 206//5 205//5
+f 1093//5 607//5 603//5
+f 559//5 205//5 1089//5
+f 230//5 212//5 210//5
+f 224//5 220//5 218//5
+f 208//5 206//5 232//5
+f 621//5 17//5 1094//5
+f 1094//5 1092//5 635//5
+f 226//5 216//5 214//5
+f 567//5 1089//5 1090//5
+f 621//5 18//5 17//5
+f 19//5 611//5 17//5
+f 188//6 20//6 15//6
+f 25//7 21//7 23//7
+f 27//545 24//8 25//9
+f 29//546 26//10 27//11
+f 31//14 28//12 29//14
+f 33//16 30//15 31//15
+f 35//18 32//17 33//17
+f 37//19 34//19 35//19
+f 39//547 36//21 37//22
+f 41//23 38//23 39//23
+f 43//24 40//24 41//24
+f 45//25 42//25 43//25
+f 47//26 44//26 45//26
+f 49//27 46//27 47//27
+f 51//28 48//28 49//28
+f 53//29 50//29 51//29
+f 55//30 52//30 53//30
+f 57//31 54//31 55//31
+f 59//32 56//32 57//32
+f 61//34 58//33 59//34
+f 63//35 60//35 61//35
+f 65//37 62//36 63//37
+f 67//38 64//38 65//38
+f 69//39 66//39 67//39
+f 71//40 68//40 69//40
+f 73//41 70//41 71//41
+f 75//42 72//42 73//42
+f 77//43 74//43 75//43
+f 79//44 76//44 77//44
+f 81//45 78//45 79//45
+f 83//46 80//46 81//46
+f 85//47 82//47 83//47
+f 87//48 84//48 85//48
+f 89//49 86//49 87//49
+f 91//49 88//49 89//49
+f 93//49 90//49 91//49
+f 95//49 92//49 93//49
+f 97//49 94//49 95//49
+f 99//49 96//49 97//49
+f 101//49 98//49 99//49
+f 103//49 100//49 101//49
+f 105//49 102//49 103//49
+f 107//49 104//49 105//49
+f 109//49 106//49 107//49
+f 111//49 108//49 109//49
+f 113//50 110//50 111//50
+f 115//49 112//49 113//49
+f 117//51 114//51 115//51
+f 119//49 116//49 117//49
+f 121//52 118//52 119//52
+f 123//53 120//53 121//53
+f 125//54 122//54 123//54
+f 127//55 124//55 125//55
+f 129//56 126//56 127//56
+f 131//55 128//55 129//55
+f 133//57 130//57 131//57
+f 135//58 132//58 133//58
+f 137//59 134//59 135//59
+f 139//60 136//60 137//60
+f 141//61 138//61 139//61
+f 143//62 140//62 141//62
+f 145//63 142//63 143//63
+f 147//64 144//64 145//64
+f 148//65 146//65 147//65
+f 149//66 11//66 148//66
+f 151//67 9//67 149//67
+f 153//68 150//68 151//68
+f 155//69 152//69 153//69
+f 157//70 154//70 155//70
+f 159//71 156//71 157//71
+f 161//72 158//72 159//72
+f 163//73 160//73 161//73
+f 165//74 162//74 163//74
+f 167//75 164//75 165//75
+f 169//76 166//76 167//76
+f 171//77 168//77 169//77
+f 173//78 170//78 171//78
+f 175//79 172//79 173//79
+f 16//80 174//80 175//80
+f 178//3 174//3 277//3
+f 1095//3 311//3 312//3
+f 178//3 277//3 329//3
+f 1095//3 312//3 314//3
+f 178//3 329//3 331//3
+f 1095//3 314//3 316//3
+f 178//3 331//3 333//3
+f 1095//3 318//3 320//3
+f 178//3 333//3 335//3
+f 1095//3 316//3 318//3
+f 178//3 335//3 337//3
+f 1096//3 326//3 239//3
+f 178//3 337//3 279//3
+f 1097//3 239//3 1075//3
+f 178//3 279//3 278//3
+f 1097//3 179//3 239//3
+f 178//3 278//3 281//3
+f 239//3 179//3 1098//3
+f 178//3 281//3 283//3
+f 1099//3 239//3 1098//3
+f 178//3 283//3 285//3
+f 1100//3 239//3 1099//3
+f 178//3 285//3 287//3
+f 1096//3 239//3 1100//3
+f 178//3 287//3 289//3
+f 324//3 326//3 1096//3
+f 178//3 289//3 291//3
+f 324//3 1096//3 322//3
+f 178//3 291//3 293//3
+f 1096//3 1095//3 322//3
+f 178//3 293//3 295//3
+f 1095//3 320//3 322//3
+f 178//3 295//3 297//3
+f 309//3 311//3 1095//3
+f 178//3 297//3 299//3
+f 178//3 309//3 1095//3
+f 178//3 299//3 301//3
+f 178//3 307//3 309//3
+f 178//3 301//3 303//3
+f 178//3 177//3 307//3
+f 178//3 303//3 176//3
+f 1101//55 1100//55 1099//55
+f 275//55 1095//55 1096//55
+f 183//55 182//55 178//55
+f 178//55 274//55 183//55
+f 1096//55 1102//55 275//55
+f 1098//55 1103//55 1101//55
+f 1096//55 1104//55 1102//55
+f 275//55 274//55 178//55
+f 1101//55 1104//55 1100//55
+f 1103//55 1098//55 179//55
+f 180//55 1097//55 1075//55
+f 1084//55 1073//55 1074//55
+f 1074//55 1085//55 1084//55
+f 1075//55 1086//55 180//55
+f 179//55 181//55 1103//55
+f 1095//55 275//55 178//55
+f 1101//55 1099//55 1098//55
+f 1084//55 1075//55 1073//55
+f 1075//55 1084//55 1086//55
+f 1096//55 1100//55 1104//55
+f 179//55 1097//55 180//55
+f 185//55 182//55 184//55
+f 187//81 185//81 186//81
+f 12//82 187//82 13//82
+f 190//83 188//83 189//83
+f 192//84 190//84 191//84
+f 194//85 192//85 193//85
+f 196//86 194//86 195//86
+f 198//87 196//87 197//87
+f 199//88 198//88 14//88
+f 1060//89 199//89 200//89
+f 1089//49 1061//49 1062//49
+f 1089//49 205//49 204//49
+f 1062//49 1090//49 1089//49
+f 1064//49 1093//49 1091//49
+f 8//49 1094//49 17//49
+f 201//49 203//49 1092//49
+f 1060//49 200//49 1088//49
+f 201//49 1092//49 1094//49
+f 1059//49 1088//49 1087//49
+f 1088//49 1059//49 1060//49
+f 1087//49 202//49 1058//49
+f 1094//49 8//49 201//49
+f 1093//49 1064//49 1065//49
+f 1089//49 204//49 1061//49
+f 1091//49 1063//49 1064//49
+f 1087//49 1058//49 1059//49
+f 17//49 1065//49 8//49
+f 1091//49 1090//49 1062//49
+f 1065//49 17//49 1093//49
+f 203//49 202//49 1087//49
+f 1091//49 1062//49 1063//49
+f 207//49 204//49 206//49
+f 209//90 207//90 208//90
+f 211//91 209//91 210//91
+f 213//92 211//92 212//92
+f 215//93 213//93 214//93
+f 217//94 215//94 216//94
+f 219//95 217//95 218//95
+f 221//96 219//96 220//96
+f 223//97 221//97 222//97
+f 225//98 223//98 224//98
+f 227//99 225//99 226//99
+f 229//100 227//100 228//100
+f 231//101 229//101 230//101
+f 233//102 231//102 232//102
+f 1057//102 233//102 234//102
+f 1080//102 1069//102 1068//102
+f 1076//102 236//102 1070//102
+f 1083//102 1072//102 1071//102
+f 1076//102 1070//102 1069//102
+f 1082//102 1071//102 235//102
+f 1083//102 1085//102 1074//102
+f 1071//102 1082//102 1083//102
+f 235//102 237//102 1081//102
+f 1069//102 1080//102 1076//102
+f 1067//102 1078//102 1079//102
+f 1057//102 234//102 1077//102
+f 1077//102 1066//102 1057//102
+f 1079//102 1068//102 1067//102
+f 1083//102 1074//102 1072//102
+f 235//102 1081//102 1082//102
+f 1068//102 1079//102 1080//102
+f 1067//102 1066//102 1077//102
+f 1076//102 237//102 236//102
+f 1067//102 1077//102 1078//102
+f 242//49 238//49 240//49
+f 244//49 241//49 242//49
+f 246//103 243//103 244//103
+f 248//105 245//104 246//105
+f 250//106 247//106 248//106
+f 252//107 249//107 250//107
+f 254//108 251//108 252//108
+f 256//109 253//109 254//109
+f 258//110 255//110 256//110
+f 260//111 257//111 258//111
+f 262//112 259//112 260//112
+f 264//113 261//113 262//113
+f 266//114 263//114 264//114
+f 268//115 265//115 266//115
+f 270//116 267//116 268//118
+f 272//119 269//119 270//116
+f 273//548 271//120 272//119
+f 23//122 22//121 273//122
+f 275//5 313//5 276//5
+f 330//5 16//5 274//5
+f 275//5 315//5 313//5
+f 332//5 330//5 274//5
+f 275//5 317//5 315//5
+f 334//5 332//5 274//5
+f 275//5 321//5 319//5
+f 336//5 334//5 274//5
+f 275//5 319//5 317//5
+f 338//5 336//5 274//5
+f 1102//5 328//5 327//5
+f 339//5 338//5 274//5
+f 1102//5 240//5 328//5
+f 280//5 339//5 274//5
+f 1102//5 327//5 325//5
+f 282//5 280//5 274//5
+f 275//5 325//5 323//5
+f 284//5 282//5 274//5
+f 275//5 323//5 321//5
+f 286//5 284//5 274//5
+f 180//5 1086//5 240//5
+f 288//5 286//5 274//5
+f 181//5 180//5 240//5
+f 290//5 288//5 274//5
+f 1103//5 181//5 240//5
+f 292//5 290//5 274//5
+f 1101//5 1103//5 240//5
+f 294//5 292//5 274//5
+f 1104//5 1101//5 240//5
+f 296//5 294//5 274//5
+f 1102//5 1104//5 240//5
+f 298//5 296//5 274//5
+f 275//5 1102//5 325//5
+f 300//5 298//5 274//5
+f 274//5 276//5 310//5
+f 302//5 300//5 274//5
+f 274//5 310//5 308//5
+f 304//5 302//5 274//5
+f 274//5 308//5 306//5
+f 305//5 304//5 274//5
+f 274//5 306//5 305//5
+f 330//123 277//123 16//123
+f 282//124 278//124 280//124
+f 284//125 281//125 282//125
+f 286//126 283//126 284//126
+f 288//127 285//127 286//127
+f 290//549 287//128 288//128
+f 292//129 289//129 290//129
+f 294//130 291//130 292//130
+f 296//131 293//131 294//131
+f 298//132 295//132 296//132
+f 300//133 297//133 298//133
+f 302//134 299//134 300//134
+f 304//135 301//135 302//135
+f 305//136 303//136 304//136
+f 306//137 176//137 305//137
+f 308//138 177//138 306//138
+f 310//139 307//139 308//139
+f 276//140 309//140 310//140
+f 313//49 311//49 276//49
+f 315//49 312//49 313//49
+f 317//49 314//49 315//49
+f 319//49 316//49 317//49
+f 321//49 318//49 319//49
+f 323//49 320//49 321//49
+f 325//49 322//49 323//49
+f 327//49 324//49 325//49
+f 328//49 326//49 327//49
+f 240//49 239//49 328//49
+f 332//141 329//141 330//141
+f 334//142 331//142 332//142
+f 336//143 333//143 334//143
+f 338//144 335//144 336//144
+f 339//145 337//145 338//145
+f 280//146 279//146 339//146
+f 344//147 340//147 342//147
+f 348//148 343//148 344//148
+f 342//149 341//149 346//149
+f 352//150 347//150 348//150
+f 346//151 345//151 350//151
+f 356//152 351//152 352//152
+f 350//153 349//153 354//153
+f 360//155 355//154 356//155
+f 354//156 353//156 358//156
+f 364//157 359//157 360//157
+f 358//158 357//158 362//158
+f 368//159 363//159 364//159
+f 362//160 361//160 366//160
+f 371//161 367//161 368//161
+f 366//162 365//162 369//162
+f 375//163 370//163 371//163
+f 369//164 10//164 373//164
+f 379//165 374//165 375//165
+f 373//166 372//166 377//166
+f 383//167 378//167 379//167
+f 377//168 376//168 381//168
+f 387//169 382//169 383//169
+f 381//170 380//170 385//170
+f 391//171 386//171 387//171
+f 385//172 384//172 389//172
+f 395//173 390//173 391//173
+f 389//174 388//174 393//174
+f 399//175 394//175 395//175
+f 393//176 392//176 397//176
+f 403//177 398//177 399//177
+f 397//178 396//178 401//178
+f 407//179 402//179 403//179
+f 401//180 400//180 405//180
+f 411//181 406//181 407//181
+f 405//182 404//182 409//182
+f 415//183 410//183 411//183
+f 409//184 408//184 413//184
+f 419//185 414//185 415//185
+f 413//186 412//186 417//186
+f 423//187 418//187 419//187
+f 417//188 416//188 421//188
+f 427//189 422//189 423//189
+f 421//190 420//190 425//190
+f 431//191 426//191 427//191
+f 425//192 424//192 429//192
+f 435//193 430//193 431//193
+f 429//194 428//194 433//194
+f 439//195 434//195 435//195
+f 433//196 432//196 437//196
+f 443//197 438//197 439//197
+f 437//198 436//198 441//198
+f 447//199 442//199 443//199
+f 441//200 440//200 445//200
+f 451//201 446//201 447//201
+f 445//202 444//202 449//202
+f 455//203 450//203 451//203
+f 449//204 448//204 453//204
+f 459//205 454//205 455//205
+f 453//206 452//206 457//206
+f 463//207 458//207 459//207
+f 457//208 456//208 461//208
+f 467//209 462//209 463//209
+f 461//210 460//210 465//210
+f 471//211 466//211 467//211
+f 465//212 464//212 469//212
+f 475//213 470//213 471//213
+f 469//214 468//214 473//214
+f 479//215 474//215 475//215
+f 473//216 472//216 477//216
+f 483//217 478//217 479//217
+f 477//218 476//218 481//218
+f 487//219 482//219 483//219
+f 481//220 480//220 485//220
+f 491//221 486//221 487//221
+f 485//222 484//222 489//222
+f 495//223 490//223 491//223
+f 489//224 488//224 493//224
+f 499//225 494//225 495//225
+f 493//226 492//226 497//226
+f 503//227 498//227 499//227
+f 497//550 496//550 501//550
+f 507//229 502//229 503//229
+f 501//551 500//551 505//551
+f 511//232 506//231 507//232
+f 505//552 504//233 509//234
+f 515//235 510//235 511//235
+f 509//553 508//236 513//238
+f 519//239 514//239 515//239
+f 513//241 512//240 517//241
+f 523//242 518//242 519//242
+f 517//244 516//244 521//244
+f 527//246 522//246 523//246
+f 521//245 520//244 525//554
+f 531//248 526//248 527//248
+f 525//555 524//555 529//555
+f 535//250 530//250 531//250
+f 529//252 528//251 533//252
+f 539//253 534//253 535//253
+f 533//556 532//556 537//556
+f 543//255 538//255 539//255
+f 537//257 536//256 541//257
+f 547//258 542//258 543//258
+f 541//557 540//259 545//261
+f 551//262 546//262 547//262
+f 545//558 544//263 549//265
+f 555//266 550//266 551//266
+f 549//559 548//267 553//267
+f 559//269 554//269 555//269
+f 553//271 552//270 557//271
+f 563//272 558//272 559//272
+f 557//275 556//273 561//275
+f 567//276 562//276 563//276
+f 561//560 560//277 565//277
+f 571//279 566//279 567//279
+f 565//561 564//280 569//281
+f 575//282 570//282 571//282
+f 569//562 568//283 573//284
+f 579//285 574//285 575//285
+f 573//563 572//286 577//288
+f 583//289 578//289 579//289
+f 577//564 576//290 581//292
+f 587//293 582//293 583//293
+f 581//296 580//294 585//296
+f 591//297 586//297 587//297
+f 585//565 584//298 589//300
+f 595//301 590//301 591//301
+f 589//566 588//302 593//303
+f 599//304 594//304 595//304
+f 593//305 592//305 597//305
+f 603//306 598//306 599//306
+f 597//307 596//307 601//307
+f 607//308 602//308 603//308
+f 601//309 600//309 605//309
+f 611//310 606//310 607//310
+f 605//311 604//311 609//311
+f 19//312 610//312 611//312
+f 609//313 608//313 613//313
+f 18//314 614//314 19//314
+f 613//315 612//315 616//315
+f 621//316 617//316 18//316
+f 616//317 615//317 619//317
+f 624//318 620//318 621//318
+f 619//319 618//319 623//320
+f 627//321 6//321 624//321
+f 623//320 622//320 626//323
+f 631//324 7//324 627//324
+f 626//325 625//325 629//325
+f 635//326 630//326 631//326
+f 629//327 628//327 633//327
+f 639//328 634//328 635//328
+f 633//330 632//329 637//330
+f 643//331 638//331 639//331
+f 637//332 636//332 641//332
+f 647//333 642//333 643//333
+f 641//332 640//332 645//332
+f 651//334 646//334 647//334
+f 645//332 644//332 649//332
+f 655//335 650//335 651//335
+f 649//332 648//332 653//332
+f 659//336 654//336 655//336
+f 653//332 652//332 657//332
+f 663//337 658//337 659//337
+f 657//332 656//332 661//332
+f 667//338 662//338 663//338
+f 661//332 660//332 665//332
+f 671//339 666//339 667//339
+f 665//332 664//332 669//332
+f 675//340 670//340 671//340
+f 669//332 668//332 673//332
+f 679//341 674//341 675//341
+f 673//332 672//332 677//332
+f 683//342 678//342 679//342
+f 677//332 676//332 681//332
+f 687//343 682//343 683//343
+f 681//332 680//332 685//332
+f 691//344 686//344 687//344
+f 685//345 684//345 689//345
+f 695//346 690//346 691//346
+f 689//347 688//347 693//347
+f 699//348 694//348 695//348
+f 693//349 692//349 697//349
+f 703//350 698//350 699//350
+f 697//351 696//351 701//351
+f 707//352 702//352 703//352
+f 701//353 700//353 705//353
+f 711//354 706//354 707//354
+f 705//355 704//355 709//355
+f 715//356 710//356 711//356
+f 709//357 708//357 713//357
+f 719//358 714//358 715//358
+f 713//359 712//359 717//359
+f 723//360 718//360 719//360
+f 717//361 716//361 721//361
+f 727//362 722//362 723//362
+f 721//363 720//363 725//363
+f 731//364 726//364 727//364
+f 725//365 724//365 729//365
+f 735//366 730//366 731//366
+f 729//296 728//296 733//296
+f 739//367 734//367 735//367
+f 733//49 732//49 737//49
+f 743//368 738//368 739//368
+f 737//369 736//369 741//369
+f 747//370 742//370 743//370
+f 741//369 740//369 745//369
+f 751//371 746//371 747//371
+f 745//369 744//369 749//369
+f 755//372 750//372 751//372
+f 749//369 748//369 753//369
+f 759//373 754//373 755//373
+f 753//369 752//369 757//369
+f 763//374 758//374 759//374
+f 757//369 756//369 761//369
+f 767//375 762//375 763//375
+f 761//369 760//369 765//369
+f 771//376 766//376 767//376
+f 765//369 764//369 769//377
+f 775//378 770//378 771//378
+f 769//377 768//377 773//369
+f 779//379 774//379 775//379
+f 773//369 772//369 777//369
+f 783//380 778//380 779//380
+f 777//369 776//369 781//377
+f 787//381 782//381 783//381
+f 781//377 780//377 785//369
+f 791//382 786//382 787//382
+f 785//383 784//383 789//383
+f 795//384 790//384 791//384
+f 789//385 788//385 793//385
+f 799//386 794//386 795//386
+f 793//387 792//387 797//387
+f 803//388 798//388 799//388
+f 797//389 796//389 801//389
+f 807//390 802//390 803//390
+f 801//391 800//391 805//391
+f 811//392 806//392 807//392
+f 805//393 804//393 809//393
+f 815//394 810//394 811//394
+f 809//395 808//395 813//395
+f 816//396 814//396 815//396
+f 813//397 812//397 816//397
+f 1024//3 960//3 956//3
+f 1028//3 1032//3 964//3
+f 1054//3 975//3 971//3
+f 1018//541 1003//541 979//3
+f 983//3 991//3 987//3
+f 983//3 979//3 995//3
+f 1010//567 1007//568 1003//541
+f 1018//569 1014//569 1010//569
+f 979//3 1022//3 1018//541
+f 979//3 1030//3 1026//3
+f 979//3 1038//3 1034//3
+f 975//3 1046//3 1042//3
+f 975//3 1054//3 1050//3
+f 971//3 1048//3 1052//3
+f 971//3 1040//3 1044//3
+f 1040//3 968//3 1036//3
+f 960//3 1024//3 1028//3
+f 952//3 1016//3 1020//3
+f 948//3 1009//3 1012//3
+f 942//3 1001//3 1005//3
+f 934//3 993//3 997//3
+f 926//3 985//3 989//3
+f 918//3 977//3 981//3
+f 818//3 817//3 973//3
+f 904//3 962//3 966//3
+f 896//3 954//3 958//3
+f 888//3 946//3 950//3
+f 946//3 884//3 943//3
+f 876//3 932//3 936//3
+f 868//3 924//3 928//3
+f 864//3 916//3 920//3
+f 916//3 856//3 912//3
+f 848//3 902//3 906//3
+f 882//3 894//3 898//3
+f 894//3 886//3 890//3
+f 844//3 878//3 882//3
+f 844//3 870//3 874//3
+f 844//3 862//3 866//3
+f 844//3 840//3 858//3
+f 840//3 846//3 850//3
+f 840//3 838//3 842//3
+f 840//3 830//3 834//3
+f 836//3 823//3 826//3
+f 832//3 828//3 824//3
+f 823//3 836//3 832//3
+f 842//3 846//3 840//3
+f 906//3 852//3 848//3
+f 852//3 909//3 856//3
+f 920//3 868//3 864//3
+f 932//3 876//3 872//3
+f 936//3 940//3 880//3
+f 950//3 892//3 888//3
+f 958//3 900//3 896//3
+f 966//3 819//3 904//3
+f 973//3 914//3 818//3
+f 981//3 922//3 918//3
+f 989//3 930//3 926//3
+f 997//3 938//3 934//3
+f 1005//3 945//3 942//3
+f 1012//3 952//3 948//3
+f 1028//3 964//3 960//3
+f 1042//3 979//3 975//3
+f 983//3 995//3 991//3
+f 1018//541 1010//567 1003//541
+f 979//3 1026//3 1022//3
+f 979//3 1042//3 1038//3
+f 971//3 1052//3 1054//3
+f 971//3 968//3 1040//3
+f 956//3 1020//3 1024//3
+f 945//3 1005//3 1009//3
+f 930//3 989//3 993//3
+f 914//3 973//3 977//3
+f 900//3 958//3 962//3
+f 888//3 884//3 946//3
+f 872//3 928//3 932//3
+f 864//3 860//3 916//3
+f 848//3 844//3 902//3
+f 894//3 882//3 886//3
+f 844//3 866//3 870//3
+f 858//3 840//3 854//3
+f 840//3 834//3 838//3
+f 832//3 824//3 823//3
+f 826//3 840//3 836//3
+f 906//3 909//3 852//3
+f 928//3 872//3 868//3
+f 880//3 940//3 943//3
+f 962//3 904//3 900//3
+f 977//3 918//3 914//3
+f 993//3 934//3 930//3
+f 1009//3 948//3 945//3
+f 964//3 1032//3 968//3
+f 995//3 979//3 999//3
+f 979//3 1034//3 1030//3
+f 971//3 1044//3 1048//3
+f 952//3 1012//3 1016//3
+f 926//3 922//3 985//3
+f 896//3 892//3 954//3
+f 868//3 920//3 924//3
+f 844//3 882//3 898//3
+f 844//3 858//3 862//3
+f 840//3 826//3 830//3
+f 840//3 850//3 854//3
+f 936//3 880//3 876//3
+f 966//3 817//3 819//3
+f 997//3 1001//3 938//3
+f 979//3 1003//541 999//3
+f 975//3 1050//3 1046//3
+f 942//3 938//3 1001//3
+f 954//3 892//3 950//3
+f 902//3 844//3 898//3
+f 874//3 878//3 844//3
+f 884//3 880//3 943//3
+f 1020//3 956//3 952//3
+f 1036//3 968//3 1032//3
+f 916//3 860//3 856//3
+f 856//3 909//3 912//3
+f 922//3 981//3 985//3
+f 1002//5 935//5 939//5
+f 994//5 927//5 931//5
+f 990//5 986//5 923//5
+f 982//5 978//5 915//5
+f 970//5 905//5 908//5
+f 963//5 897//5 901//5
+f 959//5 955//5 893//5
+f 951//5 947//5 885//5
+f 937//5 873//5 877//5
+f 929//5 925//5 869//5
+f 921//5 857//5 861//5
+f 910//5 849//5 853//5
+f 863//5 841//5 845//5
+f 827//5 833//5 837//5
+f 833//5 825//5 829//5
+f 837//5 831//5 827//5
+f 841//5 839//5 835//5
+f 841//5 847//5 843//5
+f 841//5 855//5 851//5
+f 841//5 863//5 859//5
+f 845//5 871//5 867//5
+f 845//5 879//5 875//5
+f 845//5 887//5 883//5
+f 899//5 895//5 891//5
+f 887//5 903//5 899//5
+f 849//5 910//5 907//5
+f 857//5 917//5 913//5
+f 861//5 865//5 921//5
+f 869//5 933//5 929//5
+f 877//5 941//5 937//5
+f 941//5 881//5 944//5
+f 885//5 889//5 951//5
+f 897//5 963//5 959//5
+f 905//5 970//5 967//5
+f 908//5 911//5 974//5
+f 915//5 919//5 982//5
+f 927//5 994//5 990//5
+f 935//5 1002//5 998//5
+f 939//5 821//5 1006//5
+f 822//5 949//5 1013//5
+f 953//5 1025//5 1021//5
+f 961//5 1033//5 1029//5
+f 969//5 1041//5 1037//5
+f 969//5 972//5 1045//5
+f 972//5 1056//5 1053//5
+f 972//5 976//5 1055//5
+f 976//5 1043//5 1047//5
+f 980//5 1035//5 1039//5
+f 980//5 1027//5 1031//5
+f 1015//570 1019//571 1023//5
+f 1008//572 1011//572 1015//572
+f 1000//573 1004//573 1008//573
+f 980//5 996//5 1000//5
+f 984//5 988//5 992//5
+f 996//5 980//5 984//5
+f 980//5 1031//5 1035//5
+f 1037//5 965//5 969//5
+f 1029//5 957//5 961//5
+f 1021//5 1017//5 953//5
+f 1013//5 820//5 822//5
+f 998//5 931//5 935//5
+f 923//5 986//5 919//5
+f 967//5 901//5 905//5
+f 893//5 955//5 889//5
+f 933//5 869//5 873//5
+f 913//5 853//5 857//5
+f 835//5 831//5 841//5
+f 833//5 827//5 825//5
+f 841//5 843//5 839//5
+f 841//5 859//5 855//5
+f 845//5 875//5 871//5
+f 899//5 891//5 887//5
+f 845//5 907//5 903//5
+f 857//5 921//5 917//5
+f 873//5 937//5 933//5
+f 944//5 881//5 947//5
+f 901//5 967//5 963//5
+f 974//5 911//5 978//5
+f 931//5 998//5 994//5
+f 1006//5 821//5 820//5
+f 957//5 1029//5 1025//5
+f 969//5 1045//5 1041//5
+f 972//5 1055//5 1056//5
+f 976//5 980//5 1043//5
+f 980//5 1023//5 1027//5
+f 1000//5 1008//5 1015//570
+f 984//5 992//5 996//5
+f 1000//5 1023//5 980//5
+f 1033//5 961//5 965//5
+f 953//5 1017//5 949//5
+f 990//5 923//5 927//5
+f 959//5 893//5 897//5
+f 869//5 925//5 865//5
+f 841//5 831//5 837//5
+f 841//5 851//5 847//5
+f 845//5 883//5 879//5
+f 853//5 913//5 910//5
+f 877//5 881//5 941//5
+f 908//5 974//5 970//5
+f 939//5 1006//5 1002//5
+f 965//5 1037//5 1033//5
+f 1055//5 976//5 1051//5
+f 1000//5 1015//570 1023//5
+f 980//5 1039//5 1043//5
+f 1025//5 953//5 957//5
+f 919//5 986//5 982//5
+f 907//5 845//5 849//5
+f 845//5 867//5 863//5
+f 921//5 865//5 925//5
+f 978//5 911//5 915//5
+f 1045//5 972//5 1049//5
+f 1047//5 1051//5 976//5
+f 949//5 1017//5 1013//5
+f 903//5 887//5 845//5
+f 947//5 881//5 885//5
+f 1049//5 972//5 1053//5
+f 889//5 955//5 951//5
+f 827//398 823//398 825//398
+f 831//399 826//399 827//399
+f 825//400 824//400 829//400
+f 835//401 830//401 831//401
+f 829//402 828//402 833//402
+f 839//403 834//403 835//403
+f 833//404 832//404 837//404
+f 843//405 838//405 839//405
+f 837//406 836//406 841//406
+f 847//407 842//407 843//407
+f 841//408 840//408 845//408
+f 851//409 846//409 847//409
+f 845//411 844//411 849//411
+f 855//574 850//412 851//412
+f 849//413 848//413 853//413
+f 859//414 854//414 855//414
+f 853//415 852//415 857//415
+f 863//416 858//416 859//416
+f 857//417 856//417 861//417
+f 867//418 862//418 863//418
+f 861//420 860//419 865//420
+f 871//421 866//421 867//421
+f 865//424 864//423 869//424
+f 875//425 870//425 871//425
+f 869//427 868//427 873//427
+f 879//428 874//428 875//428
+f 873//429 872//429 877//429
+f 883//430 878//430 879//430
+f 877//431 876//431 881//431
+f 887//432 882//432 883//432
+f 881//433 880//433 885//433
+f 891//434 886//434 887//434
+f 885//435 884//435 889//435
+f 895//436 890//436 891//436
+f 889//437 888//437 893//437
+f 899//438 894//438 895//438
+f 893//439 892//439 897//439
+f 903//440 898//440 899//440
+f 897//441 896//441 901//441
+f 907//442 902//442 903//442
+f 901//443 900//443 905//443
+f 910//444 906//444 907//444
+f 905//445 904//445 908//445
+f 913//446 909//446 910//446
+f 908//447 819//447 911//447
+f 917//448 912//448 913//448
+f 911//449 818//449 915//449
+f 921//450 916//450 917//450
+f 915//451 914//451 919//451
+f 925//452 920//452 921//452
+f 919//453 918//453 923//453
+f 929//454 924//454 925//454
+f 923//455 922//455 927//455
+f 933//456 928//456 929//456
+f 927//457 926//457 931//457
+f 937//458 932//458 933//458
+f 931//459 930//459 935//459
+f 941//460 936//460 937//460
+f 935//461 934//461 939//461
+f 944//462 940//462 941//462
+f 939//463 938//463 821//463
+f 947//464 943//464 944//464
+f 821//465 942//465 822//465
+f 951//466 946//466 947//466
+f 822//467 945//467 949//467
+f 955//468 950//468 951//468
+f 949//469 948//469 953//469
+f 959//470 954//470 955//470
+f 953//471 952//471 957//471
+f 963//472 958//472 959//472
+f 957//473 956//473 961//473
+f 967//474 962//474 963//474
+f 961//475 960//475 965//475
+f 970//476 966//476 967//476
+f 965//477 964//477 969//477
+f 974//478 817//478 970//478
+f 969//480 968//479 972//480
+f 978//481 973//481 974//481
+f 972//482 971//482 976//482
+f 982//483 977//483 978//483
+f 976//484 975//484 980//484
+f 986//485 981//485 982//485
+f 980//486 979//486 984//486
+f 990//487 985//487 986//487
+f 984//488 983//488 988//488
+f 994//489 989//489 990//489
+f 988//490 987//490 992//490
+f 998//491 993//491 994//491
+f 992//492 991//492 996//492
+f 1002//493 997//493 998//493
+f 996//302 995//302 1000//302
+f 1006//494 1001//494 1002//494
+f 1000//495 999//495 1004//495
+f 820//496 1005//496 1006//496
+f 1004//497 1003//497 1008//497
+f 1013//498 1009//498 820//498
+f 1008//500 1007//499 1011//499
+f 1017//501 1012//501 1013//501
+f 1011//575 1010//254 1015//254
+f 1021//502 1016//502 1017//502
+f 1015//503 1014//503 1019//503
+f 1025//504 1020//504 1021//504
+f 1019//576 1018//505 1023//505
+f 1029//507 1024//507 1025//507
+f 1023//509 1022//508 1027//510
+f 1033//511 1028//511 1029//511
+f 1027//513 1026//512 1031//513
+f 1037//514 1032//514 1033//514
+f 1031//515 1030//515 1035//515
+f 1041//516 1036//516 1037//516
+f 1035//518 1034//517 1039//518
+f 1045//519 1040//519 1041//519
+f 1039//520 1038//520 1043//520
+f 1049//521 1044//521 1045//521
+f 1043//523 1042//522 1047//522
+f 1053//524 1048//524 1049//524
+f 1047//525 1046//525 1051//525
+f 1056//526 1052//526 1053//526
+f 1051//527 1050//527 1055//527
+f 1055//528 1054//528 1056//528
o Curve_path22
-v 0.138516 0.000000 1.118892
-v 0.138067 0.000000 1.118845
-v 0.137614 0.000000 1.118798
-v 0.137159 0.000000 1.118750
-v 0.136702 0.000000 1.118701
-v 0.136243 0.000000 1.118652
-v 0.135784 0.000000 1.118602
-v 0.135325 0.000000 1.118550
-v 0.134866 0.000000 1.118497
-v 0.134409 0.000000 1.118442
-v 0.133954 0.000000 1.118385
-v 0.133501 0.000000 1.118326
-v 0.133052 0.000000 1.118264
-v 0.133501 0.000000 1.118326
-v 0.133954 0.000000 1.118385
-v 0.134409 0.000000 1.118442
-v 0.134866 0.000000 1.118497
-v 0.135325 0.000000 1.118550
-v 0.135784 0.000000 1.118602
-v 0.136243 0.000000 1.118652
-v 0.136702 0.000000 1.118701
-v 0.137159 0.000000 1.118750
-v 0.137614 0.000000 1.118798
-v 0.138067 0.000000 1.118845
+v 0.133501 -0.000000 1.118326
+v 0.133501 -0.000000 1.118326
+v 0.133052 -0.000000 1.118264
+v 0.133954 -0.000000 1.118385
+v 0.133954 -0.000000 1.118385
+v 0.134409 -0.000000 1.118442
+v 0.134409 -0.000000 1.118442
+v 0.134866 -0.000000 1.118497
+v 0.134866 -0.000000 1.118497
+v 0.135325 -0.000000 1.118550
+v 0.135325 -0.000000 1.118550
+v 0.135784 -0.000000 1.118602
+v 0.135784 -0.000000 1.118602
+v 0.136243 -0.000000 1.118652
+v 0.136243 -0.000000 1.118652
+v 0.136702 -0.000000 1.118701
+v 0.136702 -0.000000 1.118701
+v 0.137159 -0.000000 1.118750
+v 0.137159 -0.000000 1.118750
+v 0.137614 -0.000000 1.118798
+v 0.137614 -0.000000 1.118798
+v 0.138067 -0.000000 1.118845
+v 0.138067 -0.000000 1.118845
+v 0.138516 -0.000000 1.118892
vn 0.000000 0.000000 1.000000
-vn 0.000000 1.000000 0.000000
+vn 0.000000 0.000000 -0.000000
+vn -0.000000 1.000000 -0.000000
+vn -0.000000 1.000000 -0.000100
+vn -0.000300 1.000000 0.000000
+vn 0.000000 0.000000 -0.000100
usemtl SVGMat.001
-s off
-f 1176//555 1178//555 1177//555
-f 1176//555 1179//555 1178//555
-f 1175//555 1179//555 1176//555
-f 1175//555 1180//555 1179//555
-f 1174//556 1180//556 1175//556
-f 1174//556 1181//556 1180//556
-f 1173//556 1181//556 1174//556
-f 1173//556 1182//556 1181//556
-f 1172//556 1182//556 1173//556
-f 1172//556 1183//556 1182//556
-f 1171//556 1183//556 1172//556
-f 1171//556 1184//556 1183//556
-f 1170//555 1184//555 1171//555
-f 1170//555 1185//555 1184//555
-f 1169//555 1185//555 1170//555
-f 1169//555 1186//555 1185//555
-f 1168//555 1186//555 1169//555
-f 1168//555 1187//555 1186//555
-f 1167//556 1187//556 1168//556
-f 1167//556 1188//556 1187//556
-f 1166//556 1188//556 1167//556
-f 1166//556 1165//556 1188//556
+s 1
+f 1105//577 1106//577 1107//577
+f 1105//577 1108//577 1106//577
+f 1109//577 1108//577 1105//577
+f 1109//577 1110//577 1108//577
+f 1111//578 1110//579 1109//579
+f 1111//580 1112//581 1110//578
+f 1113//579 1112//581 1111//580
+f 1113//579 1114//581 1112//581
+f 1115//579 1114//581 1113//579
+f 1115//579 1116//579 1114//581
+f 1117//578 1116//579 1115//579
+f 1117//580 1118//579 1116//582
+f 1119//577 1118//577 1117//577
+f 1119//577 1120//577 1118//577
+f 1121//577 1120//577 1119//577
+f 1121//577 1122//577 1120//577
+f 1123//577 1122//577 1121//577
+f 1123//577 1124//577 1122//577
+f 1125//578 1124//579 1123//580
+f 1125//579 1126//579 1124//578
+f 1127//581 1126//579 1125//579
+f 1127//581 1128//579 1126//579
+o Curve.003_path34
+v 0.131158 -0.000000 1.117179
+v 0.139489 -0.000000 1.117165
+v 0.130979 -0.000000 1.117165
+v 0.148988 -0.000000 1.117165
+v 0.159145 -0.000000 1.117165
+v 0.169632 -0.000000 1.117165
+v 0.180118 -0.000000 1.117165
+v 0.190275 -0.000000 1.117165
+v 0.199774 -0.000000 1.117165
+v 0.208284 -0.000000 1.117165
+v 0.215477 -0.000000 1.117165
+v 0.221022 -0.000000 1.117165
+v 0.224591 -0.000000 1.117165
+v 0.225853 -0.000000 1.117165
+v 0.221277 -0.000000 1.117233
+v 0.131333 -0.000000 1.117217
+v 0.131506 -0.000000 1.117275
+v 0.216748 -0.000000 1.117421
+v 0.131677 -0.000000 1.117349
+v 0.131847 -0.000000 1.117434
+v 0.212268 -0.000000 1.117705
+v 0.132015 -0.000000 1.117526
+v 0.132185 -0.000000 1.117621
+v 0.132354 -0.000000 1.117714
+v 0.207836 -0.000000 1.118061
+v 0.132525 -0.000000 1.117801
+v 0.132698 -0.000000 1.117877
+v 0.132873 -0.000000 1.117939
+v 0.133052 -0.000000 1.117981
+v 0.133501 -0.000000 1.118049
+v 0.133954 -0.000000 1.118123
+v 0.203452 -0.000000 1.118464
+v 0.134409 -0.000000 1.118203
+v 0.134866 -0.000000 1.118287
+v 0.135325 -0.000000 1.118374
+v 0.135784 -0.000000 1.118460
+v 0.136243 -0.000000 1.118546
+v 0.199116 -0.000000 1.118892
+v 0.136702 -0.000000 1.118628
+v 0.137159 -0.000000 1.118706
+v 0.137614 -0.000000 1.118777
+v 0.138067 -0.000000 1.118839
+v 0.138516 -0.000000 1.118892
+v 0.141317 -0.000000 1.119183
+v 0.194828 -0.000000 1.119320
+v 0.144144 -0.000000 1.119445
+v 0.190587 -0.000000 1.119724
+v 0.146999 -0.000000 1.119678
+v 0.149884 -0.000000 1.119884
+v 0.186394 -0.000000 1.120079
+v 0.152797 -0.000000 1.120063
+v 0.155742 -0.000000 1.120215
+v 0.182248 -0.000000 1.120363
+v 0.158718 -0.000000 1.120341
+v 0.161726 -0.000000 1.120443
+v 0.178149 -0.000000 1.120551
+v 0.164767 -0.000000 1.120521
+v 0.167842 -0.000000 1.120576
+v 0.174098 -0.000000 1.120619
+v 0.170952 -0.000000 1.120608
+vn -0.000000 1.000000 0.000000
+usemtl SVGMat.004
+s 1
+f 1129//583 1130//583 1131//583
+f 1129//583 1132//583 1130//583
+f 1129//583 1133//583 1132//583
+f 1129//583 1134//583 1133//583
+f 1129//583 1135//583 1134//583
+f 1129//583 1136//583 1135//583
+f 1129//583 1137//583 1136//583
+f 1129//583 1138//583 1137//583
+f 1129//583 1139//583 1138//583
+f 1129//583 1140//583 1139//583
+f 1129//583 1141//583 1140//583
+f 1129//583 1142//583 1141//583
+f 1129//583 1143//583 1142//583
+f 1144//583 1143//583 1129//583
+f 1145//583 1143//583 1144//583
+f 1145//583 1146//583 1143//583
+f 1147//583 1146//583 1145//583
+f 1148//583 1146//583 1147//583
+f 1148//583 1149//583 1146//583
+f 1150//583 1149//583 1148//583
+f 1151//583 1149//583 1150//583
+f 1152//583 1149//583 1151//583
+f 1152//583 1153//583 1149//583
+f 1154//583 1153//583 1152//583
+f 1155//583 1153//583 1154//583
+f 1156//583 1153//583 1155//583
+f 1157//583 1153//583 1156//583
+f 1158//583 1153//583 1157//583
+f 1159//583 1153//583 1158//583
+f 1159//583 1160//583 1153//583
+f 1161//583 1160//583 1159//583
+f 1162//583 1160//583 1161//583
+f 1163//583 1160//583 1162//583
+f 1164//583 1160//583 1163//583
+f 1165//583 1160//583 1164//583
+f 1165//583 1166//583 1160//583
+f 1167//583 1166//583 1165//583
+f 1168//583 1166//583 1167//583
+f 1169//583 1166//583 1168//583
+f 1170//583 1166//583 1169//583
+f 1171//583 1166//583 1170//583
+f 1172//583 1166//583 1171//583
+f 1172//583 1173//583 1166//583
+f 1174//583 1173//583 1172//583
+f 1174//583 1175//583 1173//583
+f 1176//583 1175//583 1174//583
+f 1177//583 1175//583 1176//583
+f 1177//583 1178//583 1175//583
+f 1179//583 1178//583 1177//583
+f 1180//583 1178//583 1179//583
+f 1180//583 1181//583 1178//583
+f 1182//583 1181//583 1180//583
+f 1183//583 1181//583 1182//583
+f 1183//583 1184//583 1181//583
+f 1185//583 1184//583 1183//583
+f 1186//583 1184//583 1185//583
+f 1186//583 1187//583 1184//583
+f 1188//583 1187//583 1186//583
diff --git a/examples/qt3d/controls/main.cpp b/examples/qt3d/controls/main.cpp
index 89744b04d..b5e448538 100644
--- a/examples/qt3d/controls/main.cpp
+++ b/examples/qt3d/controls/main.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/controls/main.qml b/examples/qt3d/controls/main.qml
index c0bf1a637..2b438ac20 100644
--- a/examples/qt3d/controls/main.qml
+++ b/examples/qt3d/controls/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -123,9 +137,9 @@ Item {
Slider {
id: rotation_x
Layout.fillWidth: true
- minimumValue: 45
- maximumValue: 135
- value: rotationValue + 90
+ minimumValue: -45
+ maximumValue: 45
+ value: rotationValue
}
}
RowLayout {
@@ -133,9 +147,9 @@ Item {
Slider {
id: rotation_y
Layout.fillWidth: true
- minimumValue: 135
- maximumValue: 225
- value: rotationValue + 180
+ minimumValue: -45
+ maximumValue: 45
+ value: rotationValue
}
}
RowLayout {
@@ -168,9 +182,9 @@ Item {
Slider {
id: viewCenter_z
Layout.fillWidth: true
- minimumValue: -12
- maximumValue: -4
- value: -7.5
+ minimumValue: 4
+ maximumValue: 12
+ value: 7.5
}
}
diff --git a/examples/qt3d/cpp_example/cpp_example.pro b/examples/qt3d/cpp_example/cpp_example.pro
deleted file mode 100644
index f78ec0860..000000000
--- a/examples/qt3d/cpp_example/cpp_example.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput
-
-SOURCES += main.cpp
-
-
-RESOURCES += \
- ../exampleresources/test_scene.qrc \
- ../exampleresources/gltf.qrc
diff --git a/examples/qt3d/cpp_example/doc/src/cpp_example.qdoc b/examples/qt3d/cpp_example/doc/src/cpp_example.qdoc
deleted file mode 100644
index 84e3cb4d7..000000000
--- a/examples/qt3d/cpp_example/doc/src/cpp_example.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example cpp_example
- \title Qt 3D: C++ Example
- \ingroup qt3d-examples-cpp
-*/
diff --git a/examples/qt3d/cpp_example/main.cpp b/examples/qt3d/cpp_example/main.cpp
deleted file mode 100644
index 242867566..000000000
--- a/examples/qt3d/cpp_example/main.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-
-#include <window.h>
-#include <Qt3DCore/qcamera.h>
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qcameralens.h>
-#include <Qt3DCore/qaspectengine.h>
-#include <Qt3DCore/qtransform.h>
-
-#include <Qt3DInput/QInputAspect>
-
-#include <Qt3DRender/qtorusmesh.h>
-#include <Qt3DRender/qmesh.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qsceneloader.h>
-#include <Qt3DRender/qcameraselector.h>
-#include <Qt3DRender/qrenderpassfilter.h>
-#include <Qt3DRender/qtechniquefilter.h>
-#include <Qt3DRender/qviewport.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DRender/qframegraph.h>
-#include <Qt3DRender/qclearbuffer.h>
-
-int main(int ac, char **av)
-{
- QGuiApplication app(ac, av);
-
- Window view;
- Qt3DCore::QAspectEngine engine;
- engine.registerAspect(new Qt3DRender::QRenderAspect());
- Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- engine.registerAspect(input);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.setData(data);
-
- // Root entity
- Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
- rootEntity->setObjectName(QStringLiteral("rootEntity"));
- // Torus
- Qt3DCore::QEntity *torusEntity = new Qt3DCore::QEntity(rootEntity);
-
- // Torus shape data
- Qt3DRender::QTorusMesh *torus = new Qt3DRender::QTorusMesh();
- torus->setRadius(40);
- torus->setMinorRadius(15);
-
- torusEntity->addComponent(torus);
-
- // TorusMesh Transform
- Qt3DCore::QTransform *torusTransforms = new Qt3DCore::QTransform();
- torusTransforms->setTranslation(QVector3D(-5.0f, 3.5f, 2.0f));
- torusTransforms->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), 35.0f));
- torusEntity->addComponent(torusTransforms);
-
- // Scene file
- Qt3DCore::QEntity *sceneEntity = new Qt3DCore::QEntity(rootEntity);
- Qt3DRender::QSceneLoader *scene = new Qt3DRender::QSceneLoader();
- scene->setObjectName(QStringLiteral("scene"));
- Qt3DCore::QTransform *sceneTransform = new Qt3DCore::QTransform();
- sceneTransform->setTranslation(QVector3D(2.5f, 0.5f, -10.0f));
- sceneEntity->addComponent(sceneTransform);
- scene->setSource(QUrl("qrc:/assets/test_scene.dae"));
- sceneEntity->addComponent(scene);
-
- // Camera
- Qt3DCore::QCamera *cameraEntity = new Qt3DCore::QCamera(rootEntity);
- cameraEntity->setObjectName(QStringLiteral("cameraEntity"));
- cameraEntity->lens()->setPerspectiveProjection(60.0f, 16.0f/9.0f, 0.1f, 1000.0f);
- cameraEntity->setPosition(QVector3D(-5, 0, -20.0f));
- cameraEntity->setViewCenter(QVector3D(11, 0, 5));
- cameraEntity->setUpVector(QVector3D(0, 1, 0));
- input->setCamera(cameraEntity);
-
- // FrameGraph
- Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph();
- Qt3DRender::QTechniqueFilter *techniqueFilter = new Qt3DRender::QTechniqueFilter();
- Qt3DRender::QViewport *viewport = new Qt3DRender::QViewport(techniqueFilter);
- Qt3DRender::QClearBuffer *clearBuffer = new Qt3DRender::QClearBuffer(viewport);
- Qt3DRender::QCameraSelector *cameraSelector = new Qt3DRender::QCameraSelector(clearBuffer);
- (void) new Qt3DRender::QRenderPassFilter(cameraSelector);
-
- // TechiqueFilter and renderPassFilter are not implement yet
- viewport->setRect(QRectF(0, 0, 1, 1));
- clearBuffer->setBuffers(Qt3DRender::QClearBuffer::ColorDepthBuffer);
- cameraSelector->setCamera(cameraEntity);
- frameGraph->setActiveFrameGraph(techniqueFilter);
-
- // Setting the FrameGraph
- rootEntity->addComponent(frameGraph);
-
- // Set root object of the scene
- engine.setRootEntity(rootEntity);
- // Show window
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro b/examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro
deleted file mode 100644
index e562663bd..000000000
--- a/examples/qt3d/custom-mesh-cpp/custom-mesh-cpp.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput
-
-SOURCES += \
- main.cpp
diff --git a/examples/qt3d/custom-mesh-cpp/main.cpp b/examples/qt3d/custom-mesh-cpp/main.cpp
deleted file mode 100644
index e7b804a28..000000000
--- a/examples/qt3d/custom-mesh-cpp/main.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-
-#include <window.h>
-#include <Qt3DCore/QEntity>
-#include <Qt3DCore/QCamera>
-#include <Qt3DCore/QCameraLens>
-#include <Qt3DCore/QTransform>
-#include <Qt3DCore/QAspectEngine>
-
-#include <Qt3DInput/QInputAspect>
-
-#include <Qt3DRender/QStateSet>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QForwardRenderer>
-#include <Qt3DRender/QPerVertexColorMaterial>
-
-#include <Qt3DRender/QGeometryRenderer>
-#include <Qt3DRender/QGeometry>
-#include <Qt3DRender/QAttribute>
-#include <Qt3DRender/QBuffer>
-
-#include <QPropertyAnimation>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
- Window view;
-
- Qt3DCore::QAspectEngine engine;
- engine.registerAspect(new Qt3DRender::QRenderAspect());
- Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- engine.registerAspect(input);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.setData(data);
-
- // Root entity
- Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
-
- // Camera
- Qt3DCore::QCamera *cameraEntity = new Qt3DCore::QCamera(rootEntity);
-
- cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
- cameraEntity->setPosition(QVector3D(0, 0, -40.0f));
- cameraEntity->setUpVector(QVector3D(0, 1, 0));
- cameraEntity->setViewCenter(QVector3D(0, 0, 0));
- input->setCamera(cameraEntity);
-
- // FrameGraph
- Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph();
- Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
- forwardRenderer->setClearColor(QColor::fromRgbF(0.0, 0.5, 1.0, 1.0));
- forwardRenderer->setCamera(cameraEntity);
- frameGraph->setActiveFrameGraph(forwardRenderer);
-
- // Material
- Qt3DRender::QMaterial *material = new Qt3DRender::QPerVertexColorMaterial(rootEntity);
-
- // Torus
- Qt3DCore::QEntity *customMeshEntity = new Qt3DCore::QEntity(rootEntity);
-
- // Transform
- Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
- transform->setScale(8.0f);
-
- // Custom Mesh (TetraHedron)
- Qt3DRender::QGeometryRenderer *customMeshRenderer = new Qt3DRender::QGeometryRenderer;
- Qt3DRender::QGeometry *customGeometry = new Qt3DRender::QGeometry(customMeshRenderer);
-
- Qt3DRender::QBuffer *vertexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, customGeometry);
- Qt3DRender::QBuffer *indexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, customGeometry);
-
- // vec3 for position
- // vec3 for colors
- // vec3 for normals
-
- /* 2
- /|\
- / | \
- / /3\ \
- 0/___\ 1
- */
-
- // 4 distinct vertices
- QByteArray vertexBufferData;
- vertexBufferData.resize(4 * (3 + 3 + 3) * sizeof(float));
-
- // Vertices
- QVector3D v0(-1.0f, 0.0f, -1.0f);
- QVector3D v1(1.0f, 0.0f, -1.0f);
- QVector3D v2(0.0f, 1.0f, 0.0f);
- QVector3D v3(0.0f, 0.0f, 1.0f);
-
- // Faces Normals
- QVector3D n023 = QVector3D::normal(v0, v2, v3);
- QVector3D n012 = QVector3D::normal(v0, v1, v2);
- QVector3D n310 = QVector3D::normal(v3, v1, v0);
- QVector3D n132 = QVector3D::normal(v1, v3, v2);
-
- // Vector Normals
- QVector3D n0 = QVector3D(n023 + n012 + n310).normalized();
- QVector3D n1 = QVector3D(n132 + n012 + n310).normalized();
- QVector3D n2 = QVector3D(n132 + n012 + n023).normalized();
- QVector3D n3 = QVector3D(n132 + n310 + n023).normalized();
-
- // Colors
- QVector3D red(1.0f, 0.0f, 0.0f);
- QVector3D green(0.0f, 1.0f, 0.0f);
- QVector3D blue(0.0f, 0.0f, 1.0f);
- QVector3D white(1.0f, 1.0f, 1.0f);
-
- QVector<QVector3D> vertices = QVector<QVector3D>()
- << v0 << n0 << red
- << v1 << n1 << blue
- << v2 << n2 << green
- << v3 << n3 << white;
-
- float *rawVertexArray = reinterpret_cast<float *>(vertexBufferData.data());
- int idx = 0;
-
- Q_FOREACH (const QVector3D &v, vertices) {
- rawVertexArray[idx++] = v.x();
- rawVertexArray[idx++] = v.y();
- rawVertexArray[idx++] = v.z();
- }
-
- // Indices (12)
- QByteArray indexBufferData;
- indexBufferData.resize(4 * 3 * sizeof(ushort));
- ushort *rawIndexArray = reinterpret_cast<ushort *>(indexBufferData.data());
-
- // Front
- rawIndexArray[0] = 0;
- rawIndexArray[1] = 1;
- rawIndexArray[2] = 2;
- // Bottom
- rawIndexArray[3] = 3;
- rawIndexArray[4] = 1;
- rawIndexArray[5] = 0;
- // Left
- rawIndexArray[6] = 0;
- rawIndexArray[7] = 2;
- rawIndexArray[8] = 3;
- // Right
- rawIndexArray[9] = 1;
- rawIndexArray[10] = 3;
- rawIndexArray[11] = 2;
-
- vertexDataBuffer->setData(vertexBufferData);
- indexDataBuffer->setData(indexBufferData);
-
- // Attributes
- Qt3DRender::QAttribute *positionAttribute = new Qt3DRender::QAttribute();
- positionAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
- positionAttribute->setBuffer(vertexDataBuffer);
- positionAttribute->setDataType(Qt3DRender::QAttribute::Float);
- positionAttribute->setDataSize(3);
- positionAttribute->setByteOffset(0);
- positionAttribute->setByteStride(9 * sizeof(float));
- positionAttribute->setCount(4);
- positionAttribute->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
-
- Qt3DRender::QAttribute *normalAttribute = new Qt3DRender::QAttribute();
- normalAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
- normalAttribute->setBuffer(vertexDataBuffer);
- normalAttribute->setDataType(Qt3DRender::QAttribute::Float);
- normalAttribute->setDataSize(3);
- normalAttribute->setByteOffset(3 * sizeof(float));
- normalAttribute->setByteStride(9 * sizeof(float));
- normalAttribute->setCount(4);
- normalAttribute->setName(Qt3DRender::QAttribute::defaultNormalAttributeName());
-
- Qt3DRender::QAttribute *colorAttribute = new Qt3DRender::QAttribute();
- colorAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
- colorAttribute->setBuffer(vertexDataBuffer);
- colorAttribute->setDataType(Qt3DRender::QAttribute::Float);
- colorAttribute->setDataSize(3);
- colorAttribute->setByteOffset(6 * sizeof(float));
- colorAttribute->setByteStride(9 * sizeof(float));
- colorAttribute->setCount(4);
- colorAttribute->setName(Qt3DRender::QAttribute::defaultColorAttributeName());
-
- Qt3DRender::QAttribute *indexAttribute = new Qt3DRender::QAttribute();
- indexAttribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute);
- indexAttribute->setBuffer(indexDataBuffer);
- indexAttribute->setDataType(Qt3DRender::QAttribute::UnsignedShort);
- indexAttribute->setDataSize(1);
- indexAttribute->setByteOffset(0);
- indexAttribute->setByteStride(0);
- indexAttribute->setCount(12);
-
- customGeometry->addAttribute(positionAttribute);
- customGeometry->addAttribute(normalAttribute);
- customGeometry->addAttribute(colorAttribute);
- customGeometry->addAttribute(indexAttribute);
-
- customMeshRenderer->setInstanceCount(1);
- customMeshRenderer->setBaseVertex(0);
- customMeshRenderer->setBaseInstance(0);
- customMeshRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
- customMeshRenderer->setGeometry(customGeometry);
- // 4 faces of 3 points
- customMeshRenderer->setPrimitiveCount(12);
-
- customMeshEntity->addComponent(customMeshRenderer);
- customMeshEntity->addComponent(transform);
- customMeshEntity->addComponent(material);
-
-
- rootEntity->addComponent(frameGraph);
-
- engine.setRootEntity(rootEntity);
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro b/examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro
deleted file mode 100644
index 111d0ef40..000000000
--- a/examples/qt3d/custom-mesh-qml/custom-mesh-qml.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick quick
-
-SOURCES += \
- main.cpp
-
-RESOURCES += \
- custom-mesh-qml.qrc
diff --git a/examples/qt3d/custom-mesh-qml/main.cpp b/examples/qt3d/custom-mesh-qml/main.cpp
deleted file mode 100644
index a308bfacc..000000000
--- a/examples/qt3d/custom-mesh-qml/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/custom-mesh-qml/main.qml b/examples/qt3d/custom-mesh-qml/main.qml
deleted file mode 100644
index 74272f83a..000000000
--- a/examples/qt3d/custom-mesh-qml/main.qml
+++ /dev/null
@@ -1,230 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.2 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- components: [
- FrameGraph {
- activeFrameGraph: ForwardRenderer {
- clearColor: Qt.rgba(0.5, 0.5, 1, 1)
- camera: camera
- }
- }
- ]
-
- PerVertexColorMaterial {
- id: material
- }
-
- function buildVertexBufferData()
- {
- // Vertices
- var v0 = Qt.vector3d(-1.0, 0.0, -1.0)
- var v1 = Qt.vector3d(1.0, 0.0, -1.0)
- var v2 = Qt.vector3d(0.0, 1.0, 0.0)
- var v3 = Qt.vector3d(0.0, 0.0, 1.0)
-
- // Face Normals
- function normal(v0, v1, v2) {
- return v1.minus(v0).crossProduct(v2.minus(v0)).normalized();
- }
- var n023 = normal(v0, v2, v3)
- var n012 = normal(v0, v1, v2)
- var n310 = normal(v3, v1, v0)
- var n132 = normal(v1, v3, v2)
-
- // Vector normals
- var n0 = n023.plus(n012).plus(n310).normalized()
- var n1 = n132.plus(n012).plus(n310).normalized()
- var n2 = n132.plus(n012).plus(n023).normalized()
- var n3 = n132.plus(n310).plus(n023).normalized()
-
- // Colors
- var red = Qt.vector3d(1.0, 0.0, 0.0)
- var green = Qt.vector3d(0.0, 1.0, 0.0)
- var blue = Qt.vector3d(0.0, 0.0, 1.0)
- var white = Qt.vector3d(1.0, 1.0, 1.0)
-
- var vertices = [
- v0, n0, red,
- v1, n1, blue,
- v2, n2, green,
- v3, n3, white
- ]
-
- var vertexArray = new Float32Array(4 * (3 + 3 + 3));
- var i = 0;
-
- vertices.forEach(function(vec3) {
- vertexArray[i++] = vec3.x;
- vertexArray[i++] = vec3.y;
- vertexArray[i++] = vec3.z;
- });
-
- return vertexArray;
- }
-
- function buildIndexBufferData()
- {
- var indexArray = new Uint16Array(12);
-
- // Front
- indexArray[0] = 0;
- indexArray[1] = 1;
- indexArray[2] = 2;
- // Bottom
- indexArray[3] = 3;
- indexArray[4] = 1;
- indexArray[5] = 0;
- // Left
- indexArray[6] = 0;
- indexArray[7] = 2;
- indexArray[8] = 3;
- // Right
- indexArray[9] = 1;
- indexArray[10] = 3;
- indexArray[11] = 2;
-
- return indexArray;
- }
-
- GeometryRenderer {
- id: customMesh
- instanceCount: 1
- baseVertex: 0
- baseInstance: 0
- primitiveType: GeometryRenderer.Triangles
- Buffer {
- id: vertexBuffer
- type: Buffer.VertexBuffer
- data: buildVertexBufferData()
- }
-
- Buffer {
- id: indexBuffer
- type: Buffer.IndexBuffer
- data: buildIndexBufferData()
- }
- geometry: Geometry {
- Attribute {
- attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
- byteOffset: 0
- byteStride: 9 * 4
- count: 4
- name: defaultPositionAttributeName()
- buffer: vertexBuffer
- }
-
- Attribute {
- attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
- byteOffset: 3 * 4
- byteStride: 9 * 4
- count: 4
- name: defaultNormalAttributeName()
- buffer: vertexBuffer
- }
-
- Attribute {
- attributeType: Attribute.VertexAttribute
- dataType: Attribute.Float
- dataSize: 3
- byteOffset: 6 * 4
- byteStride: 9 * 4
- count: 4
- name: defaultColorAttributeName()
- buffer: vertexBuffer
- }
-
- Attribute {
- attributeType: Attribute.IndexAttribute
- dataType: Attribute.UnsignedShort
- dataSize: 1
- byteOffset: 0
- byteStride: 0
- count: 12
- buffer: indexBuffer
- }
- }
- }
-
- Transform {
- id: meshTransform
- property real userAngle: 0.0
- scale: 10
- rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
- }
-
- QQ2.NumberAnimation {
- target: meshTransform
- property: "userAngle"
- duration: 10000
- from: 0
- to: 360
-
- loops: QQ2.Animation.Infinite
- running: true
- }
-
- Entity {
- id: sphereEntity
- components: [ customMesh, material, meshTransform ]
- }
-}
diff --git a/examples/qt3d/cylinder-cpp/cylinder-cpp.pro b/examples/qt3d/cylinder-cpp/cylinder-cpp.pro
deleted file mode 100644
index ef2da4ed6..000000000
--- a/examples/qt3d/cylinder-cpp/cylinder-cpp.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput
-
-SOURCES += main.cpp
-
-
diff --git a/examples/qt3d/cylinder-cpp/doc/src/cylinder-cpp.qdoc b/examples/qt3d/cylinder-cpp/doc/src/cylinder-cpp.qdoc
deleted file mode 100644
index 45b74a4ba..000000000
--- a/examples/qt3d/cylinder-cpp/doc/src/cylinder-cpp.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example cylinder-cpp
- \title Qt 3D: Cylinder C++ Example
- \ingroup qt3d-examples-cpp
-*/
diff --git a/examples/qt3d/cylinder-cpp/main.cpp b/examples/qt3d/cylinder-cpp/main.cpp
deleted file mode 100644
index ff996d6c5..000000000
--- a/examples/qt3d/cylinder-cpp/main.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-
-#include <window.h>
-#include <Qt3DCore/qcamera.h>
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qcameralens.h>
-
-#include <Qt3DInput/QInputAspect>
-
-#include <Qt3DRender/qcylindermesh.h>
-#include <Qt3DRender/qmesh.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qrenderpass.h>
-
-#include <Qt3DCore/qtransform.h>
-#include <Qt3DCore/qaspectengine.h>
-
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DRender/qframegraph.h>
-#include <Qt3DRender/qforwardrenderer.h>
-
-int main(int argc, char **argv)
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::QAspectEngine engine;
- engine.registerAspect(new Qt3DRender::QRenderAspect());
- Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- engine.registerAspect(input);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.setData(data);
-
- // Root entity
- Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
-
- // Camera
- Qt3DCore::QCamera *cameraEntity = new Qt3DCore::QCamera(rootEntity);
- cameraEntity->setObjectName(QStringLiteral("cameraEntity"));
-
- cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
- cameraEntity->setPosition(QVector3D(0, 0, -20.0f));
- cameraEntity->setUpVector(QVector3D(0, 1, 0));
- cameraEntity->setViewCenter(QVector3D(0, 0, 0));
- input->setCamera(cameraEntity);
-
- // FrameGraph
- Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph();
- Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
-
- // TechiqueFilter and renderPassFilter are not implement yet
- forwardRenderer->setCamera(cameraEntity);
- forwardRenderer->setClearColor(Qt::black);
-
- frameGraph->setActiveFrameGraph(forwardRenderer);
-
-
- // Cylinder shape data
- Qt3DRender::QCylinderMesh *cylinder = new Qt3DRender::QCylinderMesh();
- cylinder->setRadius(1);
- cylinder->setLength(3);
- cylinder->setRings(100);
- cylinder->setSlices(20);
-
- // CylinderMesh Transform
- Qt3DCore::QTransform *cylinderTransform = new Qt3DCore::QTransform;
- cylinderTransform->setScale(1.5f);
- cylinderTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), 45.0f));
-
- // Cylinder
- Qt3DCore::QEntity *cylinderEntity = new Qt3DCore::QEntity(rootEntity);
- cylinderEntity->addComponent(cylinder);
- cylinderEntity->addComponent(cylinderTransform);
-
- // Setting the FrameGraph
- rootEntity->addComponent(frameGraph);
-
- // Set root object of the scene
- engine.setRootEntity(rootEntity);
- // Show window
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/cylinder-qml/cylinder-qml.pro b/examples/qt3d/cylinder-qml/cylinder-qml.pro
deleted file mode 100644
index 5658d30ff..000000000
--- a/examples/qt3d/cylinder-qml/cylinder-qml.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml
-
-RESOURCES += \
- cylinder-qml.qrc
diff --git a/examples/qt3d/cylinder-qml/doc/src/cylinder-qml.qdoc b/examples/qt3d/cylinder-qml/doc/src/cylinder-qml.qdoc
deleted file mode 100644
index 7ab372c72..000000000
--- a/examples/qt3d/cylinder-qml/doc/src/cylinder-qml.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example cylinder-qml
- \title Qt 3D: Cylinder QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/cylinder-qml/main.cpp b/examples/qt3d/cylinder-qml/main.cpp
deleted file mode 100644
index c5654586c..000000000
--- a/examples/qt3d/cylinder-qml/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/cylinder-qml/main.qml b/examples/qt3d/cylinder-qml/main.qml
deleted file mode 100644
index 4c68d6054..000000000
--- a/examples/qt3d/cylinder-qml/main.qml
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -20.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- FrameGraph {
- id : external_forward_renderer
- activeFrameGraph : ForwardRenderer {
- camera: camera
- clearColor: "black"
- }
- }
-
- components: [external_forward_renderer]
-
- CylinderMesh {
- id: mesh
- radius: 1
- length: 3
- rings: 100
- slices: 20
- }
-
- Transform {
- id: transform
- scale: 1.5
- rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
- }
-
- Material {
- id: material
- effect: Effect {}
- }
-
- Entity {
- id: mainEntity
- objectName: "mainEntity"
- components: [ mesh, material, transform ]
- }
-}
diff --git a/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro b/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro
index 261d893ce..f9f239f24 100644
--- a/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro
+++ b/examples/qt3d/deferred-renderer-cpp/deferred-renderer-cpp.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput
+QT += 3dcore 3drender 3dinput 3dextras
HEADERS += \
gbuffer.h \
diff --git a/examples/qt3d/deferred-renderer-cpp/deferredrenderer.cpp b/examples/qt3d/deferred-renderer-cpp/deferredrenderer.cpp
deleted file mode 100644
index f22966f48..000000000
--- a/examples/qt3d/deferred-renderer-cpp/deferredrenderer.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "deferredrenderer.h"
-
-
-DeferredRenderer::DeferredRenderer(Qt3DCore::QNode *parent)
- : Qt3DRender::QViewport(parent)
- , m_sceneFilter(new Qt3DRender::QLayerFilter(this))
- , m_screenQuadFilter(new Qt3DRender::QLayerFilter(this))
- , m_clearScreenQuad(new Qt3DRender::QClearBuffer(m_screenQuadFilter))
- , m_gBufferTargetSelector(new Qt3DRender::QRenderTargetSelector(m_sceneFilter))
- , m_clearGBuffer(new Qt3DRender::QClearBuffer(m_gBufferTargetSelector))
- , m_geometryPassFilter(new Qt3DRender::QRenderPassFilter(m_clearGBuffer))
- , m_finalPassFilter(new Qt3DRender::QRenderPassFilter(m_clearScreenQuad))
- , m_sceneCameraSelector(new Qt3DRender::QCameraSelector(m_geometryPassFilter))
-{
- m_clearGBuffer->setBuffers(Qt3DRender::QClearBuffer::ColorDepthBuffer);
- m_clearScreenQuad->setBuffers(Qt3DRender::QClearBuffer::ColorDepthBuffer);
-}
-
-void DeferredRenderer::setSceneCamera(Qt3DCore::QEntity *camera)
-{
- m_sceneCameraSelector->setCamera(camera);
-}
-
-void DeferredRenderer::setGBuffer(Qt3DRender::QRenderTarget *gBuffer)
-{
- m_gBufferTargetSelector->setTarget(gBuffer);
-}
-
-void DeferredRenderer::setGeometryPassCriteria(QList<Qt3DRender::QAnnotation *> criteria)
-{
- Q_FOREACH (Qt3DRender::QAnnotation *c, criteria)
- m_geometryPassFilter->addInclude(c);
-}
-
-void DeferredRenderer::setFinalPassCriteria(QList<Qt3DRender::QAnnotation *> criteria)
-{
- Q_FOREACH (Qt3DRender::QAnnotation *c, criteria)
- c->setParent(m_finalPassFilter);
-}
-
-void DeferredRenderer::setGBufferLayers(const QStringList &layerNames)
-{
- m_sceneFilter->setLayers(layerNames);
-}
-
-void DeferredRenderer::setScreenQuadLayers(const QStringList &layerNames)
-{
- m_screenQuadFilter->setLayers(layerNames);
-}
diff --git a/examples/qt3d/deferred-renderer-cpp/deferredrenderer.h b/examples/qt3d/deferred-renderer-cpp/deferredrenderer.h
deleted file mode 100644
index 902d2654d..000000000
--- a/examples/qt3d/deferred-renderer-cpp/deferredrenderer.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DEFERREDRENDERER_H
-#define DEFERREDRENDERER_H
-
-#include <Qt3DRender/QViewport>
-#include <Qt3DRender/QClearBuffer>
-#include <Qt3DRender/QLayerFilter>
-#include <Qt3DRender/QRenderPassFilter>
-#include <Qt3DRender/QRenderTargetSelector>
-#include <Qt3DRender/QCameraSelector>
-#include <Qt3DRender/QAnnotation>
-
-class DeferredRenderer : public Qt3DRender::QViewport
-{
-public:
- explicit DeferredRenderer(Qt3DCore::QNode *parent = 0);
-
- void setSceneCamera(Qt3DCore::QEntity *camera);
- void setGBuffer(Qt3DRender::QRenderTarget *gBuffer);
- void setGeometryPassCriteria(QList<Qt3DRender::QAnnotation *> criteria);
- void setFinalPassCriteria(QList<Qt3DRender::QAnnotation *> criteria);
- void setGBufferLayers(const QStringList &layerName);
- void setScreenQuadLayers(const QStringList &layerName);
-
-private:
- Qt3DRender::QLayerFilter *m_sceneFilter;
- Qt3DRender::QLayerFilter *m_screenQuadFilter;
- Qt3DRender::QClearBuffer *m_clearScreenQuad;
- Qt3DRender::QRenderTargetSelector *m_gBufferTargetSelector;
- Qt3DRender::QClearBuffer *m_clearGBuffer;
- Qt3DRender::QRenderPassFilter *m_geometryPassFilter;
- Qt3DRender::QRenderPassFilter *m_finalPassFilter;
- Qt3DRender::QCameraSelector *m_sceneCameraSelector;
-};
-
-#endif // DEFERREDRENDERER_H
diff --git a/examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc b/examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc
index d5327345a..65311e77f 100644
--- a/examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc
+++ b/examples/qt3d/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/deferred-renderer-cpp/finaleffect.cpp b/examples/qt3d/deferred-renderer-cpp/finaleffect.cpp
index ebbcfa357..63c821caa 100644
--- a/examples/qt3d/deferred-renderer-cpp/finaleffect.cpp
+++ b/examples/qt3d/deferred-renderer-cpp/finaleffect.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -46,7 +60,7 @@ FinalEffect::FinalEffect(Qt3DCore::QNode *parent)
, m_gl2Technique(new Qt3DRender::QTechnique())
, m_gl2Pass(new Qt3DRender::QRenderPass())
, m_gl3Pass(new Qt3DRender::QRenderPass())
- , m_passCriterion(new Qt3DRender::QAnnotation(this))
+ , m_passCriterion(new Qt3DRender::QFilterKey(this))
{
m_gl3Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
m_gl3Technique->graphicsApiFilter()->setMajorVersion(3);
@@ -65,23 +79,23 @@ FinalEffect::FinalEffect(Qt3DCore::QNode *parent)
gl3Shader->setVertexShaderCode(gl3Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl3.vert"))));
gl3Shader->setFragmentShaderCode(gl3Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl3.frag"))));
- m_gl3Pass->addAnnotation(m_passCriterion);
+ m_gl3Pass->addFilterKey(m_passCriterion);
m_gl3Pass->setShaderProgram(gl3Shader);
- m_gl3Technique->addPass(m_gl3Pass);
+ m_gl3Technique->addRenderPass(m_gl3Pass);
Qt3DRender::QShaderProgram *gl2Shader = new Qt3DRender::QShaderProgram();
gl2Shader->setVertexShaderCode(gl2Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl2.vert"))));
gl2Shader->setFragmentShaderCode(gl2Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl2.frag"))));
- m_gl2Pass->addAnnotation(m_passCriterion);
+ m_gl2Pass->addFilterKey(m_passCriterion);
m_gl2Pass->setShaderProgram(gl2Shader);
- m_gl2Technique->addPass(m_gl2Pass);
+ m_gl2Technique->addRenderPass(m_gl2Pass);
addTechnique(m_gl3Technique);
addTechnique(m_gl2Technique);
}
-QList<Qt3DRender::QAnnotation *> FinalEffect::passCriteria() const
+QList<Qt3DRender::QFilterKey *> FinalEffect::passCriteria() const
{
- return QList<Qt3DRender::QAnnotation *>() << m_passCriterion;
+ return QList<Qt3DRender::QFilterKey *>() << m_passCriterion;
}
diff --git a/examples/qt3d/deferred-renderer-cpp/finaleffect.h b/examples/qt3d/deferred-renderer-cpp/finaleffect.h
index cdfdfaf0e..69a1b126c 100644
--- a/examples/qt3d/deferred-renderer-cpp/finaleffect.h
+++ b/examples/qt3d/deferred-renderer-cpp/finaleffect.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -45,7 +59,7 @@ class FinalEffect : public Qt3DRender::QEffect
public:
explicit FinalEffect(Qt3DCore::QNode *parent = 0);
- QList<Qt3DRender::QAnnotation *> passCriteria() const;
+ QList<Qt3DRender::QFilterKey *> passCriteria() const;
inline Qt3DRender::QTechnique *gl3Technique() const { return m_gl3Technique; }
inline Qt3DRender::QTechnique *gl2Technique() const { return m_gl2Technique; }
@@ -54,7 +68,7 @@ private :
Qt3DRender::QTechnique *m_gl2Technique;
Qt3DRender::QRenderPass *m_gl2Pass;
Qt3DRender::QRenderPass *m_gl3Pass;
- Qt3DRender::QAnnotation *m_passCriterion;
+ Qt3DRender::QFilterKey *m_passCriterion;
};
#endif // FINALEFFECT_H
diff --git a/examples/qt3d/deferred-renderer-cpp/gbuffer.cpp b/examples/qt3d/deferred-renderer-cpp/gbuffer.cpp
index cf268dcb8..984dbb1f2 100644
--- a/examples/qt3d/deferred-renderer-cpp/gbuffer.cpp
+++ b/examples/qt3d/deferred-renderer-cpp/gbuffer.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -39,29 +53,22 @@
GBuffer::GBuffer(Qt3DCore::QNode *parent)
: Qt3DRender::QRenderTarget(parent)
{
- const Qt3DRender::QAbstractTextureProvider::TextureFormat formats[AttachmentsCount] = {
- Qt3DRender::QAbstractTextureProvider::RGBA32F,
- Qt3DRender::QAbstractTextureProvider::RGB32F,
- Qt3DRender::QAbstractTextureProvider::RGB16F,
- Qt3DRender::QAbstractTextureProvider::D32F
+ const Qt3DRender::QAbstractTexture::TextureFormat formats[AttachmentsCount] = {
+ Qt3DRender::QAbstractTexture::RGBA32F,
+ Qt3DRender::QAbstractTexture::RGB32F,
+ Qt3DRender::QAbstractTexture::RGB16F,
+ Qt3DRender::QAbstractTexture::D32F
};
- const Qt3DRender::QRenderAttachment::RenderAttachmentType attachmentTypes[AttachmentsCount] = {
- Qt3DRender::QRenderAttachment::ColorAttachment0,
- Qt3DRender::QRenderAttachment::ColorAttachment1,
- Qt3DRender::QRenderAttachment::ColorAttachment2,
- Qt3DRender::QRenderAttachment::DepthAttachment
- };
-
- const QString attachmentNames[AttachmentsCount] = {
- QString::fromLatin1("color"),
- QString::fromLatin1("position"),
- QString::fromLatin1("normal"),
- QString::fromLatin1("depth")
+ const Qt3DRender::QRenderTargetOutput::AttachmentPoint attachmentPoints[AttachmentsCount] = {
+ Qt3DRender::QRenderTargetOutput::Color0,
+ Qt3DRender::QRenderTargetOutput::Color1,
+ Qt3DRender::QRenderTargetOutput::Color2,
+ Qt3DRender::QRenderTargetOutput::Depth
};
for (int i = 0; i < AttachmentsCount; i++) {
- Qt3DRender::QRenderAttachment *attachment = new Qt3DRender::QRenderAttachment(this);
+ Qt3DRender::QRenderTargetOutput *output = new Qt3DRender::QRenderTargetOutput(this);
m_textures[i] = new Qt3DRender::QTexture2D();
m_textures[i]->setFormat(formats[i]);
@@ -69,33 +76,31 @@ GBuffer::GBuffer(Qt3DCore::QNode *parent)
m_textures[i]->setHeight(1024);
m_textures[i]->setGenerateMipMaps(false);
m_textures[i]->setWrapMode(Qt3DRender::QTextureWrapMode(Qt3DRender::QTextureWrapMode::ClampToEdge));
- m_textures[i]->setMinificationFilter(Qt3DRender::QAbstractTextureProvider::Linear);
- m_textures[i]->setMagnificationFilter(Qt3DRender::QAbstractTextureProvider::Linear);
-
- attachment->setTexture(m_textures[i]);
- attachment->setType(attachmentTypes[i]);
- attachment->setName(attachmentNames[i]);
+ m_textures[i]->setMinificationFilter(Qt3DRender::QAbstractTexture::Linear);
+ m_textures[i]->setMagnificationFilter(Qt3DRender::QAbstractTexture::Linear);
- addAttachment(attachment);
+ output->setTexture(m_textures[i]);
+ output->setAttachmentPoint(attachmentPoints[i]);
+ addOutput(output);
}
}
-Qt3DRender::QAbstractTextureProvider *GBuffer::colorTexture() const
+Qt3DRender::QAbstractTexture *GBuffer::colorTexture() const
{
return m_textures[Color];
}
-Qt3DRender::QAbstractTextureProvider *GBuffer::positionTexture() const
+Qt3DRender::QAbstractTexture *GBuffer::positionTexture() const
{
return m_textures[Position];
}
-Qt3DRender::QAbstractTextureProvider *GBuffer::normalTexture() const
+Qt3DRender::QAbstractTexture *GBuffer::normalTexture() const
{
return m_textures[Normal];
}
-Qt3DRender::QAbstractTextureProvider *GBuffer::depthTexture() const
+Qt3DRender::QAbstractTexture *GBuffer::depthTexture() const
{
return m_textures[Depth];
}
diff --git a/examples/qt3d/deferred-renderer-cpp/gbuffer.h b/examples/qt3d/deferred-renderer-cpp/gbuffer.h
index 3ea57da7f..dab8b6752 100644
--- a/examples/qt3d/deferred-renderer-cpp/gbuffer.h
+++ b/examples/qt3d/deferred-renderer-cpp/gbuffer.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -39,7 +53,7 @@
#include <Qt3DRender/QRenderTarget>
#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/QRenderAttachment>
+#include <Qt3DRender/QRenderTargetOutput>
class GBuffer : public Qt3DRender::QRenderTarget
{
@@ -54,14 +68,14 @@ public:
AttachmentsCount
};
- Qt3DRender::QAbstractTextureProvider *colorTexture() const;
- Qt3DRender::QAbstractTextureProvider *positionTexture() const;
- Qt3DRender::QAbstractTextureProvider *normalTexture() const;
- Qt3DRender::QAbstractTextureProvider *depthTexture() const;
+ Qt3DRender::QAbstractTexture *colorTexture() const;
+ Qt3DRender::QAbstractTexture *positionTexture() const;
+ Qt3DRender::QAbstractTexture *normalTexture() const;
+ Qt3DRender::QAbstractTexture *depthTexture() const;
private:
- Qt3DRender::QAbstractTextureProvider *m_textures[AttachmentsCount];
- Qt3DRender::QRenderAttachment *m_attachments[AttachmentsCount];
+ Qt3DRender::QAbstractTexture *m_textures[AttachmentsCount];
+ Qt3DRender::QRenderTargetOutput *m_attachments[AttachmentsCount];
};
#endif // GBUFFER_H
diff --git a/examples/qt3d/deferred-renderer-cpp/main.cpp b/examples/qt3d/deferred-renderer-cpp/main.cpp
deleted file mode 100644
index 3ab122b0a..000000000
--- a/examples/qt3d/deferred-renderer-cpp/main.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <Qt3DCore/QEntity>
-#include <window.h>
-
-#include <Qt3DInput/QInputAspect>
-
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QMaterial>
-#include <Qt3DRender/QSphereMesh>
-#include <Qt3DRender/QPlaneMesh>
-#include <Qt3DRender/QLayer>
-#include <Qt3DRender/QParameter>
-#include <Qt3DCore/QCamera>
-#include <Qt3DCore/QCameraLens>
-#include <Qt3DCore/QTransform>
-#include <Qt3DRender/QPointLight>
-#include <Qt3DRender/QWindow>
-#include <Qt3DCore/qaspectengine.h>
-
-#include <QGuiApplication>
-
-#include "gbuffer.h"
-#include "deferredrenderer.h"
-#include "finaleffect.h"
-#include "sceneeffect.h"
-#include "pointlightblock.h"
-
-int main(int ac, char **av)
-{
- QGuiApplication app(ac, av);
-
- Qt3DRender::QWindow view;
- Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect();
- view.registerAspect(input);
-
- // Root entity
- Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
- rootEntity->setObjectName(QStringLiteral("rootEntity"));
-
- // Shared Components
- GBuffer *gBuffer = new GBuffer();
- FinalEffect *finalEffect = new FinalEffect();
- SceneEffect *sceneEffect = new SceneEffect();
-
- Qt3DRender::QSphereMesh *sphereMesh = new Qt3DRender::QSphereMesh();
- sphereMesh->setRings(50);
- sphereMesh->setSlices(100);
-
- Qt3DRender::QLayer *sceneLayer = new Qt3DRender::QLayer();
- sceneLayer->setNames(QStringList("scene"));
-
- Qt3DRender::QLayer *quadLayer = new Qt3DRender::QLayer();
- quadLayer->setNames(QStringList("screenQuad"));
-
- Qt3DRender::QPlaneMesh *planeMesh = new Qt3DRender::QPlaneMesh();
- planeMesh->setMeshResolution(QSize(2, 2));
- planeMesh->setWidth(2.0f);
- planeMesh->setHeight(2.0f);
-
- Qt3DRender::QPointLight *light1 = new Qt3DRender::QPointLight();
- light1->setColor(Qt::white);
- light1->setIntensity(1.5f);
-
- rootEntity->addComponent(light1);
-
- // Scene Camera
- Qt3DCore::QCamera *camera = view.defaultCamera();
-
- camera->setFieldOfView(45.0f);
- camera->setNearPlane(0.01f);
- camera->setFarPlane(1000.0f);
- camera->setProjectionType(Qt3DCore::QCameraLens::PerspectiveProjection);
-
- camera->setPosition(QVector3D(10.0f, 10.0f, -25.0f));
- camera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
- camera->setViewCenter(QVector3D(0.0f, 0.0f, 10.0f));
-
- input->setCamera(camera);
-
- // FrameGraph
- Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph();
- DeferredRenderer *deferredRenderer = new DeferredRenderer();
- deferredRenderer->setClearColor(Qt::black);
- deferredRenderer->setRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f));
- deferredRenderer->setFinalPassCriteria(finalEffect->passCriteria());
- deferredRenderer->setGeometryPassCriteria(sceneEffect->passCriteria());
- deferredRenderer->setGBuffer(gBuffer);
- deferredRenderer->setSceneCamera(camera);
- deferredRenderer->setGBufferLayers(sceneLayer->names());
- deferredRenderer->setScreenQuadLayers(quadLayer->names());
-
- frameGraph->setActiveFrameGraph(deferredRenderer);
- view.setFrameGraph(frameGraph);
-
- // Scene Content
- Qt3DCore::QEntity *sphereOne = new Qt3DCore::QEntity(rootEntity);
- Qt3DRender::QMaterial *sphereOneMaterial = new Qt3DRender::QMaterial();
-
- sphereOneMaterial->setEffect(sceneEffect);
- sphereOneMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("meshColor"), QColor(Qt::blue)));
-
- Qt3DCore::QTransform *sphereOneTransform = new Qt3DCore::QTransform;
- sphereOneTransform->setTranslation(QVector3D(-10.0f, 0.0f, 25.0f));
-
- Qt3DRender::QPointLight *light2 = new Qt3DRender::QPointLight();
- light2->setColor(Qt::white);
- light2->setIntensity(1.5f);
-
- sphereOne->addComponent(sphereOneTransform);
- sphereOne->addComponent(sphereOneMaterial);
- sphereOne->addComponent(sphereMesh);
- sphereOne->addComponent(sceneLayer);
- sphereOne->addComponent(light2);
-
- Qt3DCore::QEntity *sphereTwo = new Qt3DCore::QEntity(rootEntity);
- Qt3DRender::QMaterial *sphereTwoMaterial = new Qt3DRender::QMaterial();
- sphereTwoMaterial->setEffect(sceneEffect);
- sphereTwoMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("meshColor"), QColor(Qt::yellow)));
-
- Qt3DRender::QPointLight *light3 = new Qt3DRender::QPointLight();
- light3->setColor(Qt::blue);
- light3->setIntensity(0.5f);
-
- sphereTwo->addComponent(sphereMesh);
- sphereTwo->addComponent(sceneLayer);
- sphereTwo->addComponent(sphereTwoMaterial);
- sphereTwo->addComponent(light3);
-
- // Screen Quad
- Qt3DCore::QEntity *screenQuad = new Qt3DCore::QEntity(rootEntity);
- Qt3DRender::QMaterial *screenQuadMaterial = new Qt3DRender::QMaterial();
- screenQuadMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("position"), gBuffer->positionTexture()));
- screenQuadMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("normal"), gBuffer->normalTexture()));
- screenQuadMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("color"), gBuffer->colorTexture()));
- screenQuadMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("winSize"), QSize(1024, 1024)));
- PointLightBlock *lightsData = new PointLightBlock(screenQuadMaterial);
- lightsData->addLight(light1);
- lightsData->addLight(light2);
- lightsData->addLight(light3);
-
- finalEffect->gl3Technique()->addParameter(new Qt3DRender::QParameter(QStringLiteral("PointLightBlock"), QVariant::fromValue(lightsData)));
- finalEffect->gl2Technique()->addParameter(new Qt3DRender::QParameter(QStringLiteral("pointLights"), QVariant::fromValue(lightsData)));
- screenQuadMaterial->setEffect(finalEffect);
-
- Qt3DCore::QTransform *screenPlaneTransform = new Qt3DCore::QTransform;
- screenPlaneTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1.0f, 0.0f, 0.0f), 90.0f));
-
- screenQuad->addComponent(quadLayer);
- screenQuad->addComponent(screenPlaneTransform);
- screenQuad->addComponent(screenQuadMaterial);
- screenQuad->addComponent(planeMesh);
-
- // Set root object of the scene
- view.setRootEntity(rootEntity);
- // Show window
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp b/examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp
index 9090ba11b..36bab9966 100644
--- a/examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp
+++ b/examples/qt3d/deferred-renderer-cpp/pointlightblock.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -46,12 +60,12 @@ PointLightBlock::~PointLightBlock()
{
}
-QList<Qt3DRender::QShaderData *> PointLightBlock::lights() const
+QVector<Qt3DRender::QAbstractLight *> PointLightBlock::lights() const
{
return m_lights;
}
-void PointLightBlock::addLight(Qt3DRender::QShaderData *light)
+void PointLightBlock::addLight(Qt3DRender::QAbstractLight *light)
{
m_lights.append(light);
emit lightsChanged();
diff --git a/examples/qt3d/deferred-renderer-cpp/pointlightblock.h b/examples/qt3d/deferred-renderer-cpp/pointlightblock.h
index c9dd3f267..9c93528c8 100644
--- a/examples/qt3d/deferred-renderer-cpp/pointlightblock.h
+++ b/examples/qt3d/deferred-renderer-cpp/pointlightblock.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,24 +51,25 @@
#ifndef POINTLIGHTBLOCK_H
#define POINTLIGHTBLOCK_H
+#include <Qt3DRender/QAbstractLight>
#include <Qt3DRender/QShaderData>
class PointLightBlock : public Qt3DRender::QShaderData
{
Q_OBJECT
- Q_PROPERTY(QList<QShaderData *> lights READ lights NOTIFY lightsChanged)
+ Q_PROPERTY(QVector<Qt3DRender::QAbstractLight *> lights READ lights NOTIFY lightsChanged)
public:
explicit PointLightBlock(Qt3DCore::QNode *parent = 0);
~PointLightBlock();
- QList<Qt3DRender::QShaderData *> lights() const;
- void addLight(Qt3DRender::QShaderData *light);
+ QVector<Qt3DRender::QAbstractLight *> lights() const;
+ void addLight(Qt3DRender::QAbstractLight *light);
Q_SIGNALS:
void lightsChanged();
private:
- QList<Qt3DRender::QShaderData *> m_lights;
+ QVector<Qt3DRender::QAbstractLight *> m_lights;
};
#endif // POINTLIGHTBLOCK_H
diff --git a/examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp b/examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp
index 7ea21cc24..bdb6ea76e 100644
--- a/examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp
+++ b/examples/qt3d/deferred-renderer-cpp/sceneeffect.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -46,7 +60,7 @@ SceneEffect::SceneEffect(Qt3DCore::QNode *parent)
, m_gl2Technique(new Qt3DRender::QTechnique())
, m_gl2Pass(new Qt3DRender::QRenderPass())
, m_gl3Pass(new Qt3DRender::QRenderPass())
- , m_passCriterion(new Qt3DRender::QAnnotation(this))
+ , m_passCriterion(new Qt3DRender::QFilterKey(this))
{
m_gl3Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
@@ -67,23 +81,23 @@ SceneEffect::SceneEffect(Qt3DCore::QNode *parent)
gl3Shader->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl3.vert"))));
gl3Shader->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl3.frag"))));
- m_gl3Pass->addAnnotation(m_passCriterion);
+ m_gl3Pass->addFilterKey(m_passCriterion);
m_gl3Pass->setShaderProgram(gl3Shader);
- m_gl3Technique->addPass(m_gl3Pass);
+ m_gl3Technique->addRenderPass(m_gl3Pass);
Qt3DRender::QShaderProgram *gl2Shader = new Qt3DRender::QShaderProgram();
gl2Shader->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl2.vert"))));
gl2Shader->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl2.frag"))));
- m_gl2Pass->addAnnotation(m_passCriterion);
+ m_gl2Pass->addFilterKey(m_passCriterion);
m_gl2Pass->setShaderProgram(gl2Shader);
- m_gl2Technique->addPass(m_gl2Pass);
+ m_gl2Technique->addRenderPass(m_gl2Pass);
addTechnique(m_gl3Technique);
addTechnique(m_gl2Technique);
}
-QList<Qt3DRender::QAnnotation *> SceneEffect::passCriteria() const
+QList<Qt3DRender::QFilterKey *> SceneEffect::passCriteria() const
{
- return QList<Qt3DRender::QAnnotation *>() << m_passCriterion;
+ return QList<Qt3DRender::QFilterKey *>() << m_passCriterion;
}
diff --git a/examples/qt3d/deferred-renderer-cpp/sceneeffect.h b/examples/qt3d/deferred-renderer-cpp/sceneeffect.h
index e5f0dba33..eb361c273 100644
--- a/examples/qt3d/deferred-renderer-cpp/sceneeffect.h
+++ b/examples/qt3d/deferred-renderer-cpp/sceneeffect.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -45,14 +59,14 @@ class SceneEffect : public Qt3DRender::QEffect
public:
explicit SceneEffect(Qt3DCore::QNode *parent = 0);
- QList<Qt3DRender::QAnnotation *> passCriteria() const;
+ QList<Qt3DRender::QFilterKey *> passCriteria() const;
private:
Qt3DRender::QTechnique *m_gl3Technique;
Qt3DRender::QTechnique *m_gl2Technique;
Qt3DRender::QRenderPass *m_gl2Pass;
Qt3DRender::QRenderPass *m_gl3Pass;
- Qt3DRender::QAnnotation *m_passCriterion;
+ Qt3DRender::QFilterKey *m_passCriterion;
};
#endif // SCENEEFFECT_H
diff --git a/examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml b/examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml
deleted file mode 100644
index 75c169f9e..000000000
--- a/examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Viewport {
- rect : Qt.rect(0.0, 0.0, 1.0, 1.0)
-
- property alias gBuffer : gBufferTargetSelector.target
- property alias camera : sceneCameraSelector.camera
-
- LayerFilter {
- layers : "scene"
-
- RenderTargetSelector {
- id : gBufferTargetSelector
-
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
-
- RenderPassFilter {
- id : geometryPass
- includes : Annotation { name : "pass"; value : "geometry" }
-
- CameraSelector {
- id : sceneCameraSelector
- }
- }
- }
- }
- }
-
- LayerFilter {
- layers : "screenQuad"
-
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
-
- RenderPassFilter {
- id : finalPass
- includes : Annotation { name : "pass"; value : "final" }
- CameraSelector {
- camera: sceneCameraSelector.camera
- }
- }
-
- }
- }
-}
diff --git a/examples/qt3d/deferred-renderer-qml/FinalEffect.qml b/examples/qt3d/deferred-renderer-qml/FinalEffect.qml
deleted file mode 100644
index 5acead772..000000000
--- a/examples/qt3d/deferred-renderer-qml/FinalEffect.qml
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Effect {
- techniques : [
- // OpenGL 3.1
- Technique {
- graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.CoreProfile; minorVersion : 1; majorVersion : 3 }
- parameters: Parameter { name: "PointLightBlock"; value: ShaderData {
- property ShaderDataArray lights: ShaderDataArray {
- // hard coded lights until we have a way to filter
- // ShaderData in a scene
- values: [sceneEntity.light, sphere1.light, sphere2.light, light3.light, light4.light]
- }
- }
- }
- renderPasses : RenderPass {
- annotations : Annotation { name : "pass"; value : "final" }
- shaderProgram : ShaderProgram {
- id : finalShaderGL3
- vertexShaderCode:
- "#version 140
-
- in vec4 vertexPosition;
- uniform mat4 modelMatrix;
-
- void main()
- {
- gl_Position = modelMatrix * vertexPosition;
- }
- "
- fragmentShaderCode:
- "#version 140
-
- uniform sampler2D color;
- uniform sampler2D position;
- uniform sampler2D normal;
- uniform vec2 winSize;
-
- out vec4 fragColor;
-
- struct PointLight
- {
- vec3 position;
- vec3 direction;
- vec4 color;
- float intensity;
- };
-
- const int lightCount = 5;
- uniform PointLightBlock {
- PointLight lights[lightCount];
- };
-
- void main()
- {
- vec2 texCoord = gl_FragCoord.xy / winSize;
- vec4 col = texture(color, texCoord);
- vec3 pos = texture(position, texCoord).xyz;
- vec3 norm = texture(normal, texCoord).xyz;
-
- vec4 lightColor;
- for (int i = 0; i < lightCount; i++) {
- vec3 s = normalize(lights[i].position - pos);
- lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0));
- }
- lightColor /= float(lightCount);
- fragColor = col * lightColor;
- }
- "
- }
- }
- },
- // OpenGL 2.0 with FBO extension
- Technique {
- graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.NoProfile; minorVersion : 0; majorVersion : 2 }
- parameters: Parameter { name: "pointLights"; value: ShaderData {
- property ShaderDataArray lights: ShaderDataArray {
- // hard coded lights until we have a way to filter
- // ShaderData in a scene
- values: [sceneEntity.light, sphere1.light, sphere2.light, light3.light, light4.light]
- }
- }
- }
- renderPasses : RenderPass {
- annotations : Annotation { name : "pass"; value : "final" }
- shaderProgram : ShaderProgram {
- id : finalShaderGL2
- vertexShaderCode:
- "#version 110
-
- attribute vec4 vertexPosition;
- uniform mat4 modelMatrix;
-
- void main()
- {
- gl_Position = modelMatrix * vertexPosition;
- }
- "
- fragmentShaderCode:
- "#version 110
-
- uniform sampler2D color;
- uniform sampler2D position;
- uniform sampler2D normal;
- uniform vec2 winSize;
-
- struct PointLight
- {
- vec3 position;
- vec3 direction;
- vec4 color;
- float intensity;
- };
-
- const int lightCount = 5;
- uniform struct
- {
- PointLight lights[lightCount];
- };
-
- void main()
- {
- vec2 texCoord = gl_FragCoord.xy / winSize;
- vec4 col = texture2D(color, texCoord);
- vec3 pos = texture2D(position, texCoord).xyz;
- vec3 norm = texture2D(normal, texCoord).xyz;
-
- vec4 lightColor;
- for (int i = 0; i < lightCount; i++) {
- vec3 s = lights[i].position - pos);
- lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0));
- }
- lightColor /= float(lightCount);
- gl_FragColor = col * lightColor;
- }
- "
- }
- }
- }]
-}
diff --git a/examples/qt3d/deferred-renderer-qml/GBuffer.qml b/examples/qt3d/deferred-renderer-qml/GBuffer.qml
deleted file mode 100644
index c2d4ed35f..000000000
--- a/examples/qt3d/deferred-renderer-qml/GBuffer.qml
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-RenderTarget {
-
- property alias color : colorAttachment
- property alias position : positionAttachment
- property alias normal : normalAttachment
- property alias depth : depthAttachment
-
- attachments : [
-
- RenderAttachment {
- name : "color"
- type : RenderAttachment.ColorAttachment0
- texture : Texture2D {
- id : colorAttachment
- width : 1024
- height : 1024
- format : Texture.RGBA32F
- generateMipMaps : false
- magnificationFilter : Texture.Linear
- minificationFilter : Texture.Linear
- wrapMode {
- x: WrapMode.ClampToEdge
- y: WrapMode.ClampToEdge
- }
- }
- },
- RenderAttachment {
- name : "position"
- type : RenderAttachment.ColorAttachment1
- texture : Texture2D {
- id : positionAttachment
- width : 1024
- height : 1024
- // This texture format may not be supported by
- // some OpenGL vendors when used as a color attachment
- format : Texture.RGB32F
- generateMipMaps : false
- magnificationFilter : Texture.Linear
- minificationFilter : Texture.Linear
- wrapMode {
- x: WrapMode.ClampToEdge
- y: WrapMode.ClampToEdge
- }
- }
- },
- RenderAttachment {
- name : "normal"
- type : RenderAttachment.ColorAttachment2
- texture : Texture2D {
- id : normalAttachment
- width : 1024
- height : 1024
- // This texture format may not be supported by
- // some OpenGL vendors when used as a color attachment
- format : Texture.RGB16F
- generateMipMaps : false
- magnificationFilter : Texture.Linear
- minificationFilter : Texture.Linear
- wrapMode {
- x: WrapMode.ClampToEdge
- y: WrapMode.ClampToEdge
- }
- }
- },
- RenderAttachment {
- name : "depth"
- type : RenderAttachment.DepthAttachment
- texture : Texture2D {
- id : depthAttachment
- width : 1024
- height : 1024
- format : Texture.D32F
- generateMipMaps : false
- magnificationFilter : Texture.Linear
- minificationFilter : Texture.Linear
- wrapMode {
- x: WrapMode.ClampToEdge
- y: WrapMode.ClampToEdge
- }
- }
- }
- ] // attachments
-}
diff --git a/examples/qt3d/deferred-renderer-qml/SceneEffect.qml b/examples/qt3d/deferred-renderer-qml/SceneEffect.qml
deleted file mode 100644
index 5dbc3ed9d..000000000
--- a/examples/qt3d/deferred-renderer-qml/SceneEffect.qml
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Effect {
- id : sceneMaterialEffect
- techniques : [
- // OpenGL 3.1
- Technique {
- graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.CoreProfile; minorVersion : 1; majorVersion : 3 }
- renderPasses : RenderPass {
- annotations : Annotation { name : "pass"; value : "geometry" }
- shaderProgram : ShaderProgram {
- id : sceneShaderGL3
- vertexShaderCode:
- "#version 140
-
- in vec4 vertexPosition;
- in vec3 vertexNormal;
-
- out vec4 color0;
- out vec3 position0;
- out vec3 normal0;
-
- uniform mat4 mvp;
- uniform mat4 modelView;
- uniform mat3 modelViewNormal;
- uniform vec4 meshColor;
-
- void main()
- {
- color0 = meshColor;
- position0 = vec3(modelView * vertexPosition);
- normal0 = normalize(modelViewNormal * vertexNormal);
- gl_Position = mvp * vertexPosition;
- }
- "
- fragmentShaderCode:
- "#version 140
-
- in vec4 color0;
- in vec3 position0;
- in vec3 normal0;
-
- out vec4 color;
- out vec3 position;
- out vec3 normal;
-
- void main()
- {
- color = color0;
- position = position0;
- normal = normal0;
- }
- "
- }
- }
- },
- // OpenGL 2.0
- Technique {
- graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.CoreProfile; minorVersion : 0; majorVersion : 2 }
- renderPasses : RenderPass {
- annotations : Annotation { name : "pass"; value : "geometry" }
- shaderProgram : ShaderProgram {
- id : sceneShaderGL2
- vertexShaderCode:
- "#version 110
-
- attribute vec4 vertexPosition;
- attribute vec3 vertexNormal;
-
- varying vec4 color0;
- varying vec3 position0;
- varying vec3 normal0;
-
- uniform mat4 mvp;
- uniform mat4 modelView;
- uniform mat3 modelViewNormal;
- uniform vec4 meshColor;
-
- void main()
- {
- color0 = meshColor;
- position0 = vec3(modelView * vertexPosition);
- normal0 = normalize(modelViewNormal * vertexNormal);
- gl_Position = mvp * vertexPosition;
- }
- "
- fragmentShaderCode:
- "#version 110
-
- varying vec4 color0;
- varying vec3 position0;
- varying vec3 normal0;
-
- void main()
- {
- gl_FragData[0] = color0;
- gl_FragData[1] = vec4(position0, 0);
- gl_FragData[2] = vec4(normal0, 0);
- }
- "
- }
- }
- }
- ]
-}
diff --git a/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.pro b/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.pro
deleted file mode 100644
index b16b57d7f..000000000
--- a/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-HEADERS += \
-
-
-OTHER_FILES += \
- main.qml \
- DeferredRenderer.qml \
- FinalEffect.qml \
- SceneEffect.qml \
- GBuffer.qml
-
-RESOURCES += \
- deferred-renderer-qml.qrc
-
-SOURCES += \
- main.cpp
diff --git a/examples/qt3d/deferred-renderer-qml/doc/src/deferred-renderer-qml.qdoc b/examples/qt3d/deferred-renderer-qml/doc/src/deferred-renderer-qml.qdoc
deleted file mode 100644
index 24003ccb1..000000000
--- a/examples/qt3d/deferred-renderer-qml/doc/src/deferred-renderer-qml.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example deferred-renderer-qml
- \title Qt 3D: Deferred Renderer QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/deferred-renderer-qml/main.cpp b/examples/qt3d/deferred-renderer-qml/main.cpp
deleted file mode 100644
index 65edece13..000000000
--- a/examples/qt3d/deferred-renderer-qml/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/deferred-renderer-qml/main.qml b/examples/qt3d/deferred-renderer-qml/main.qml
deleted file mode 100644
index 85d6094c1..000000000
--- a/examples/qt3d/deferred-renderer-qml/main.qml
+++ /dev/null
@@ -1,239 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id : root
-
- GBuffer {
- id : gBuffer
- }
-
- components : FrameGraph {
- id : deferredFrameGraphComponent
- activeFrameGraph: DeferredRenderer {
- camera : camera
- gBuffer: gBuffer
- }
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- Entity {
- id : screenQuadEntity
- components : [
- Layer {
- names : "screenQuad"
- },
- PlaneMesh {
- width: 2.0
- height: 2.0
- meshResolution: Qt.size(2, 2)
- },
- Transform { // We rotate the plane so that it faces us
- rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90)
- },
- Material {
- parameters : [
- Parameter { name: "color"; value : gBuffer.color },
- Parameter { name: "position"; value : gBuffer.position },
- Parameter { name: "normal"; value : gBuffer.normal },
- Parameter { name: "winSize"; value : Qt.size(1024, 1024) }
- ]
- effect : FinalEffect {}
- }
- ]
-
- }
-
- Entity {
- id : sceneEntity
-
- property PointLight light: PointLight {
- color : "white"
- intensity : 4.0
- QQ2.ColorAnimation on color { from: "white"; to: "blue"; duration: 4000; loops: 2 }
- QQ2.NumberAnimation on intensity { from: 0; to: 5.0; duration: 1000; loops: QQ2.Animation.Infinite }
- }
-
- components: sceneEntity.light
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.01
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -25.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 10.0 )
- }
-
- Layer {
- id : sceneLayer
- names : "scene"
- }
-
- SphereMesh {
- id : sphereMesh
- rings: 50
- slices: 100
- shareable: false
- }
-
- SceneEffect {
- id : sceneMaterialEffect
- }
-
- Entity {
- id : sphere1
-
- property Material material : Material {
- effect : sceneMaterialEffect
- parameters : Parameter { name : "meshColor"; value : "dodgerblue" }
- }
-
- property Transform transform: Transform {
- id: sphere1Transform
- property real x: -10.0
- translation: Qt.vector3d(x, 0, 5)
- }
-
- QQ2.SequentialAnimation {
- loops: QQ2.Animation.Infinite
- running: false
- QQ2.NumberAnimation { target: sphere1Transform; property: "x"; to: 6; duration: 2000 }
- QQ2.NumberAnimation { target: sphere1Transform; property: "x"; to: -10; duration: 2000 }
- }
-
- property PointLight light : PointLight {
- color : "green"
- intensity : 5.0
- }
-
- components : [
- sphereMesh,
- material,
- sphere1.transform,
- sphere1.light,
- sceneLayer
- ]
- }
-
- Entity {
- id : sphere2
-
- property Material material : Material {
- effect : sceneMaterialEffect
- parameters : Parameter { name : "meshColor"; value : "green" }
- }
-
- property PointLight light : PointLight {
- color : "orange"
- intensity : 2.0
- }
-
- property Transform transform: Transform {
- translation: Qt.vector3d(5, 0, 5)
- }
-
- components : [
- sphereMesh,
- sphere2.transform,
- material,
- sphere2.light,
- sceneLayer
- ]
- }
-
- Entity {
- id: light3
- property PointLight light : PointLight {
- color : "white"
- intensity : 2.0
- }
-
- property Material material : Material {
- effect : sceneMaterialEffect
- parameters : Parameter { name : "meshColor"; value : "red" }
- }
-
- property Transform transform: Transform {
- id: light3Transform
- property real y: 2.0
- translation: Qt.vector3d(2, y, 7)
- }
-
- QQ2.SequentialAnimation {
- loops: QQ2.Animation.Infinite
- running: true
- QQ2.NumberAnimation { target: light3Transform; property: "y"; to: 6; duration: 1000; easing.type: QQ2.Easing.InOutQuad }
- QQ2.NumberAnimation { target: light3Transform; property: "y"; to: -6; duration: 1000; easing.type: QQ2.Easing.InOutQuint }
- }
-
- components: [
- sphereMesh,
- material,
- light,
- transform,
- sceneLayer
- ]
- }
-
- Entity {
- id: light4
- property PointLight light : PointLight {
- color : "white"
- intensity : 3.0
- }
- property Transform transform: Transform {
- translation: Qt.vector3d(5, 2, 7)
- }
-
- components: [
- light4.light,
- light4.transform,
- sceneLayer
- ]
- }
- }
-}
diff --git a/examples/qt3d/dynamicscene-cpp/boxentity.cpp b/examples/qt3d/dynamicscene-cpp/boxentity.cpp
deleted file mode 100644
index f816b172f..000000000
--- a/examples/qt3d/dynamicscene-cpp/boxentity.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "boxentity.h"
-
-#include <qmath.h>
-
-BoxEntity::BoxEntity(QNode *parent)
- : Qt3DCore::QEntity(parent)
- , m_transform(new Qt3DCore::QTransform())
- , m_mesh(new Qt3DRender::QCuboidMesh())
- , m_material(new Qt3DRender::QPhongMaterial())
- , m_angle(0.0f)
- , m_radius(1.0f)
-{
- connect(m_material, SIGNAL(diffuseChanged(const QColor &)),
- this, SIGNAL(diffuseColorChanged(const QColor &)));
- m_material->setAmbient(Qt::gray);
- m_material->setSpecular(Qt::white);
- m_material->setShininess(150.0f);
-
- addComponent(m_transform);
- addComponent(m_mesh);
- addComponent(m_material);
-}
-
-void BoxEntity::setDiffuseColor(const QColor &diffuseColor)
-{
- m_material->setDiffuse(diffuseColor);
-}
-
-void BoxEntity::setAngle(float arg)
-{
- if (m_angle == arg)
- return;
-
- m_angle = arg;
- emit angleChanged();
- updateTransformation();
-}
-
-void BoxEntity::setRadius(float arg)
-{
- if (m_radius == arg)
- return;
-
- m_radius = arg;
- emit radiusChanged();
- updateTransformation();
-}
-
-QColor BoxEntity::diffuseColor()
-{
- return m_material->diffuse();
-}
-
-float BoxEntity::angle() const
-{
- return m_angle;
-}
-
-float BoxEntity::radius() const
-{
- return m_radius;
-}
-
-void BoxEntity::updateTransformation()
-{
- m_transform->setTranslation(QVector3D(qCos(m_angle) * m_radius,
- 1.0f,
- qSin(m_angle) * m_radius));
-}
-
diff --git a/examples/qt3d/dynamicscene-cpp/boxentity.h b/examples/qt3d/dynamicscene-cpp/boxentity.h
deleted file mode 100644
index ca8cdb1b6..000000000
--- a/examples/qt3d/dynamicscene-cpp/boxentity.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BOXENTITY_H
-#define BOXENTITY_H
-
-#include <Qt3DCore/QEntity>
-#include <Qt3DCore/QTransform>
-#include <Qt3DRender/QCuboidMesh>
-#include <Qt3DRender/QPhongMaterial>
-
-class BoxEntity : public Qt3DCore::QEntity
-{
- Q_OBJECT
-
- Q_PROPERTY(QColor diffuseColor READ diffuseColor WRITE setDiffuseColor NOTIFY diffuseColorChanged)
- Q_PROPERTY(float angle READ angle WRITE setAngle NOTIFY angleChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
-
-public:
- BoxEntity(QNode *parent = 0);
-
- QColor diffuseColor();
- float angle() const;
- float radius() const;
-
-public Q_SLOTS:
- void setDiffuseColor(const QColor &diffuseColor);
- void setAngle(float arg);
- void setRadius(float arg);
-
-Q_SIGNALS:
- void diffuseColorChanged(const QColor &);
- void angleChanged();
- void radiusChanged();
-
-private:
- void updateTransformation();
-
- Qt3DCore::QTransform *m_transform;
- Qt3DRender::QCuboidMesh *m_mesh;
- Qt3DRender::QPhongMaterial *m_material;
- float m_angle;
- float m_radius;
-};
-
-#endif // BOXENTITY_H
diff --git a/examples/qt3d/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc b/examples/qt3d/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc
deleted file mode 100644
index e9057c2d1..000000000
--- a/examples/qt3d/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example dynamicscene-cpp
- \title Qt 3D: Dynamic Scene C++ Example
- \ingroup qt3d-examples-cpp
-*/
diff --git a/examples/qt3d/dynamicscene-cpp/dynamicscene-cpp.pro b/examples/qt3d/dynamicscene-cpp/dynamicscene-cpp.pro
deleted file mode 100644
index ec8f7e624..000000000
--- a/examples/qt3d/dynamicscene-cpp/dynamicscene-cpp.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput
-
-SOURCES += \
- main.cpp \
- examplescene.cpp \
- forwardrenderer.cpp \
- boxentity.cpp
-
-HEADERS += \
- examplescene.h \
- forwardrenderer.h \
- boxentity.h
diff --git a/examples/qt3d/dynamicscene-cpp/examplescene.cpp b/examples/qt3d/dynamicscene-cpp/examplescene.cpp
deleted file mode 100644
index 81f09b7da..000000000
--- a/examples/qt3d/dynamicscene-cpp/examplescene.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "examplescene.h"
-#include "boxentity.h"
-
-#include <QTimer>
-#include <qmath.h>
-
-ExampleScene::ExampleScene(Qt3DCore::QNode *parent)
- : Qt3DCore::QEntity(parent)
- , m_timer(new QTimer(this))
- , m_even(true)
-{
- QObject::connect(m_timer, SIGNAL(timeout()), SLOT(updateScene()));
- m_timer->setInterval(1200);
- m_timer->start();
-}
-
-ExampleScene::~ExampleScene()
-{
- qDeleteAll(m_entities);
-}
-
-void ExampleScene::updateScene()
-{
- if (m_entities.isEmpty()) {
- buildScene();
- } else {
- int i = 0;
- Q_FOREACH (BoxEntity *entity, m_entities) {
- if (i % 2 == 0)
- entity->setParent(m_even ? Q_NULLPTR : this);
- else
- entity->setParent(m_even ? this : Q_NULLPTR);
- ++i;
- }
- m_even = !m_even;
- }
-}
-
-void ExampleScene::buildScene()
-{
- int count = 20;
- const float radius = 5.0f;
-
- for (int i = 0; i < count; ++i) {
- BoxEntity *entity = new BoxEntity;
- const float angle = M_PI * 2.0f * float(i) / count;
- entity->setAngle(angle);
- entity->setRadius(radius);
- entity->setDiffuseColor(QColor(qFabs(qCos(angle)) * 255, 204, 75));
- m_entities.append(entity);
- }
-}
-
diff --git a/examples/qt3d/dynamicscene-cpp/examplescene.h b/examples/qt3d/dynamicscene-cpp/examplescene.h
deleted file mode 100644
index 66ebb1b75..000000000
--- a/examples/qt3d/dynamicscene-cpp/examplescene.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef EXAMPLESCENE_H
-#define EXAMPLESCENE_H
-
-#include <Qt3DCore/QEntity>
-
-class BoxEntity;
-
-QT_BEGIN_NAMESPACE
-class QTimer;
-QT_END_NAMESPACE
-
-class ExampleScene : public Qt3DCore::QEntity
-{
- Q_OBJECT
-
-public:
- explicit ExampleScene(Qt3DCore::QNode *parent = 0);
- ~ExampleScene();
-
-private Q_SLOTS:
- void updateScene();
- void buildScene();
-
-private:
- QVector<BoxEntity *> m_entities;
- QTimer *m_timer;
- bool m_even;
-};
-
-#endif // EXAMPLESCENE_H
diff --git a/examples/qt3d/dynamicscene-cpp/forwardrenderer.cpp b/examples/qt3d/dynamicscene-cpp/forwardrenderer.cpp
deleted file mode 100644
index 9248c8800..000000000
--- a/examples/qt3d/dynamicscene-cpp/forwardrenderer.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "forwardrenderer.h"
-
-ForwardRenderer::ForwardRenderer(Qt3DCore::QNode *parent)
- : Qt3DRender::QFrameGraph(parent)
- , m_viewport(new Qt3DRender::QViewport())
- , m_cameraSelector(new Qt3DRender::QCameraSelector())
- , m_clearBuffer(new Qt3DRender::QClearBuffer())
-{
- m_viewport->setRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f));
- m_viewport->setClearColor(Qt::white);
- m_clearBuffer->setBuffers(Qt3DRender::QClearBuffer::ColorDepthBuffer);
- m_cameraSelector->setParent(m_viewport);
- m_clearBuffer->setParent(m_cameraSelector);
- setActiveFrameGraph(m_viewport);
-}
-
-void ForwardRenderer::setCamera(Qt3DCore::QEntity *camera)
-{
- m_cameraSelector->setCamera(camera);
-}
diff --git a/examples/qt3d/dynamicscene-cpp/forwardrenderer.h b/examples/qt3d/dynamicscene-cpp/forwardrenderer.h
deleted file mode 100644
index a5f3443b8..000000000
--- a/examples/qt3d/dynamicscene-cpp/forwardrenderer.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef FORWARDRENDERER_H
-#define FORWARDRENDERER_H
-
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QViewport>
-#include <Qt3DRender/QCameraSelector>
-#include <Qt3DRender/QClearBuffer>
-
-class ForwardRenderer : public Qt3DRender::QFrameGraph
-{
-public:
- ForwardRenderer(Qt3DCore::QNode *parent);
-
- void setCamera(Qt3DCore::QEntity *camera);
-
-private:
- Qt3DRender::QViewport *m_viewport;
- Qt3DRender::QCameraSelector *m_cameraSelector;
- Qt3DRender::QClearBuffer *m_clearBuffer;
-};
-
-#endif // FORWARDRENDERER_H
diff --git a/examples/qt3d/dynamicscene-cpp/main.cpp b/examples/qt3d/dynamicscene-cpp/main.cpp
deleted file mode 100644
index 29c920cd8..000000000
--- a/examples/qt3d/dynamicscene-cpp/main.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-
-#include <window.h>
-#include <Qt3DCore/QAspectEngine>
-#include <Qt3DCore/QCamera>
-
-#include <Qt3DInput/QInputAspect>
-
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QForwardRenderer>
-
-#include "forwardrenderer.h"
-#include "examplescene.h"
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::QAspectEngine engine;
- engine.registerAspect(new Qt3DRender::QRenderAspect());
- Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- engine.registerAspect(input);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.setData(data);
-
- ExampleScene *sceneRoot = new ExampleScene();
-
- // Scene Camera
- Qt3DCore::QCamera *basicCamera = new Qt3DCore::QCamera(sceneRoot);
- basicCamera->setProjectionType(Qt3DCore::QCameraLens::PerspectiveProjection);
- basicCamera->setAspectRatio(view.width() / view.height());
- basicCamera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
- basicCamera->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f));
- basicCamera->setPosition(QVector3D(0.0f, 3.5f, 25.0f));
- // For camera controls
- input->setCamera(basicCamera);
-
- // Forward Renderer FrameGraph
- Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph(sceneRoot);
- Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
- forwardRenderer->setCamera(basicCamera);
- frameGraph->setActiveFrameGraph(forwardRenderer);
- sceneRoot->addComponent(frameGraph);
-
- engine.setRootEntity(sceneRoot);
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/enabled-qml/doc/src/enabled-qml.qdoc b/examples/qt3d/enabled-qml/doc/src/enabled-qml.qdoc
deleted file mode 100644
index 02141aef0..000000000
--- a/examples/qt3d/enabled-qml/doc/src/enabled-qml.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example enabled-qml
- \title Qt 3D: Enabled QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/enabled-qml/enabled-qml.pro b/examples/qt3d/enabled-qml/enabled-qml.pro
deleted file mode 100644
index a1f83a2f4..000000000
--- a/examples/qt3d/enabled-qml/enabled-qml.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dquick qml
-
-SOURCES += \
- main.cpp
-
-RESOURCES += \
- enabled-qml.qrc
-
diff --git a/examples/qt3d/enabled-qml/main.cpp b/examples/qt3d/enabled-qml/main.cpp
deleted file mode 100644
index 53939cc62..000000000
--- a/examples/qt3d/enabled-qml/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-
-#include <window.h>
-#include <Qt3DCore/QCamera>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QForwardRenderer>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/enabled-qml/main.qml b/examples/qt3d/enabled-qml/main.qml
deleted file mode 100644
index 438491936..000000000
--- a/examples/qt3d/enabled-qml/main.qml
+++ /dev/null
@@ -1,190 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import QtQuick 2.0 as QQ2
-
-Entity {
- id: sceneRoot
- property int counter: 0
-
- components: FrameGraph {
- Viewport {
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- clearColor: "white"
- enabled: counter !== 5
-
- ClearBuffer {
- buffers : ClearBuffer.ColorDepthBuffer
- enabled: counter !== 6
- }
-
- CameraSelector {
- camera: camera
- enabled: counter !== 7
-
- LayerFilter {
- enabled: counter === 12
- layers: "scene"
- }
- }
- }
- }
-
- QQ2.Timer {
- interval: 500
- repeat: true
- running: true
- onTriggered: {
- counter += 1;
- if (counter > 15)
- counter = 0;
- }
- }
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- enabled: counter !== 4
- position: Qt.vector3d(0, 10, -10)
- viewCenter: Qt.vector3d(0, 0, 0)
- upVector: Qt.vector3d(0, 1, 0)
- }
-
- // Sphere
- Entity {
- SphereMesh {
- id: sphereMesh
- enabled: counter !== 0
- }
-
- PhongMaterial {
- id: material
- ambient: "dodgerblue"
- diffuse: "chartreuse"
- specular: "ghostwhite"
- enabled: counter !== 1
- }
-
- Layer {
- id: layer
- enabled: counter !== 2
- names: "scene"
- }
-
- Transform {
- id: transform
- property real x: 0.0
- property real y: 0.0
- property real z: 0.0
- translation: Qt.vector3d(x, y, z)
- enabled: counter !== 3
- }
-
- QQ2.SequentialAnimation {
- running: true
- loops: QQ2.Animation.Infinite
- QQ2.NumberAnimation {
- target: transform; property: "x"
- from: 0; to: 5;
- duration: 550
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: transform; property: "y"
- from: 0; to: 5;
- duration: 650
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: transform; property: "z"
- from: 0; to: 5;
- duration: 350
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: transform; property: "x"
- from: 5; to: 0;
- duration: 550
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: transform; property: "y"
- from: 5; to: 0;
- duration: 350
- easing.type: QQ2.Easing.InOutQuad
- }
- QQ2.NumberAnimation {
- target: transform; property: "z"
- from: 5; to: 0;
- duration: 650
- easing.type: QQ2.Easing.InOutQuad
- }
- }
-
- components: [sphereMesh, material, layer, transform]
- }
-
- // Floor
- Entity {
- PlaneMesh {
- id: planeMesh
- width: 25.0
- height: 10
- }
-
- PhongMaterial {
- id: floorMaterial
- ambient: "lawngreen"
- diffuse: "forestgreen"
- specular: "floralwhite"
- shininess: 0.5
- }
-
- Layer {
- id: floorLayer
- names: "floor"
- }
-
- components: [planeMesh, floorMaterial, floorLayer]
- }
-}
-
diff --git a/examples/qt3d/exampleresources/obj.qrc b/examples/qt3d/exampleresources/obj.qrc
index 952fd59d0..b8134bf2d 100644
--- a/examples/qt3d/exampleresources/obj.qrc
+++ b/examples/qt3d/exampleresources/obj.qrc
@@ -1,7 +1,10 @@
<RCC>
<qresource prefix="/">
- <file>assets/obj/ball.obj</file>
+ <file>assets/textures/pattern_09/specular.webp</file>
+ <file>assets/textures/pattern_09/normal.webp</file>
+ <file>assets/textures/pattern_09/diffuse.webp</file>
<file>assets/obj/trefoil.obj</file>
<file>assets/obj/toyplane.obj</file>
+ <file>assets/obj/ball.obj</file>
</qresource>
</RCC>
diff --git a/examples/qt3d/examples.pri b/examples/qt3d/examples.pri
index 5f67884c0..31cafc396 100644
--- a/examples/qt3d/examples.pri
+++ b/examples/qt3d/examples.pri
@@ -1,8 +1,6 @@
TEMPLATE = app
-INCLUDEPATH += $$PWD/common
-SOURCES += $$PWD/common/window.cpp
-HEADERS += $$PWD/common/window.h
+QT += 3dextras
target.path = $$[QT_INSTALL_EXAMPLES]/qt3d/$$TARGET
INSTALLS += target
diff --git a/examples/qt3d/gltf/Wine.qml b/examples/qt3d/gltf/Wine.qml
deleted file mode 100644
index e743ad2d9..000000000
--- a/examples/qt3d/gltf/Wine.qml
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
-
- property vector3d position: Qt.vector3d(0, 0, 0)
- property real angleX: 0
- property real angleY: 0
- property real angleZ: 0
- property real scale: 1
-
- components: [
- Transform {
- translation: root.position
- rotation: fromEulerAngles(root.angleX, root.angleY, root.angleZ)
- scale: root.scale
- },
- SceneLoader {
- source: "qrc:/assets/gltf/wine/wine.gltf"
- }
- ]
-}
diff --git a/examples/qt3d/gltf/doc/src/gltf.qdoc b/examples/qt3d/gltf/doc/src/gltf.qdoc
deleted file mode 100644
index f03d453f5..000000000
--- a/examples/qt3d/gltf/doc/src/gltf.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example gltf
- \title Qt 3D: glTF Assets Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/gltf/gltf.pro b/examples/qt3d/gltf/gltf.pro
deleted file mode 100644
index 8a79ab06c..000000000
--- a/examples/qt3d/gltf/gltf.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-HEADERS += \
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- Wine.qml
-
-RESOURCES += \
- gltf_example.qrc \
- ../exampleresources/gltf.qrc \
diff --git a/examples/qt3d/gltf/main.cpp b/examples/qt3d/gltf/main.cpp
deleted file mode 100644
index 51bde76a6..000000000
--- a/examples/qt3d/gltf/main.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QOpenGLContext>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
-
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- const bool isES = QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES
- || view.requestedFormat().renderableType() == QSurfaceFormat::OpenGLES;
- if (!isES)
- qDebug("Using a non-OpenGL ES context. This may result in no material on the model "
- "as currently the standard glTF format only includes OpenGL ES 2.0 shaders. "
- "To overcome this, run the application on OpenGL ES or use the qgltf tool "
- "with -g to generate a slightly extended glTF asset from the original COLLADA source.");
-
- return app.exec();
-}
diff --git a/examples/qt3d/gltf/main.qml b/examples/qt3d/gltf/main.qml
deleted file mode 100644
index c244c24f8..000000000
--- a/examples/qt3d/gltf/main.qml
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 20.0, -120.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 10.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- FrameGraph {
- id : framegraph
- activeFrameGraph : Viewport {
- clearColor: "black"
- CameraSelector {
- camera: camera
- ClearBuffer {
- buffers : ClearBuffer.ColorDepthBuffer
- SortMethod {
- criteria: [
- SortCriterion { sort: SortCriterion.BackToFront }
- ]
- }
- }
- }
- }
- }
-
- components: [ framegraph ]
-
- Wine {
- id: wineRack
- position: Qt.vector3d(-60.0, 0.0, 50.0)
- angleX: 180
- }
-}
diff --git a/examples/qt3d/gooch-qml/MyEntity.qml b/examples/qt3d/gooch-qml/MyEntity.qml
deleted file mode 100644
index 6e057c3ed..000000000
--- a/examples/qt3d/gooch-qml/MyEntity.qml
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
- property alias position: transform.translation
- property alias scale: transform.scale
- property alias material: gooch
- property alias source: mesh.source
-
- components: [
- Transform { id: transform },
- Mesh { id: mesh },
- GoochMaterial { id: gooch }
- ]
-}
diff --git a/examples/qt3d/gooch-qml/gooch-qml.pro b/examples/qt3d/gooch-qml/gooch-qml.pro
deleted file mode 100644
index c5ead19d8..000000000
--- a/examples/qt3d/gooch-qml/gooch-qml.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dquick 3dinput qml quick
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- MyEntity.qml
-
-RESOURCES += \
- gooch-qml.qrc \
- ../exampleresources/obj.qrc
diff --git a/examples/qt3d/gooch-qml/main.cpp b/examples/qt3d/gooch-qml/main.cpp
deleted file mode 100644
index c84ba5dd7..000000000
--- a/examples/qt3d/gooch-qml/main.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-#include <Qt3DInput/QInputAspect>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
-
- // Expose the window as a context property so we can set the aspect ratio
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/gooch-qml/main.qml b/examples/qt3d/gooch-qml/main.qml
deleted file mode 100644
index a3c340501..000000000
--- a/examples/qt3d/gooch-qml/main.qml
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import QtQuick 2.2 as QQ2
-
-Entity {
- id: sceneRoot
-
- Configuration { controlledCamera: mainCamera }
-
- components: [
- FrameGraph { ForwardRenderer { camera: mainCamera } }
- ]
-
- Camera {
- id: mainCamera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 22.5
- aspectRatio: _window.width / _window.height
- nearPlane: 0.01
- farPlane: 1000.0
- position: Qt.vector3d( 0.0, 0.0, 15.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- }
-
- MyEntity {
- id: myEntity
-
- source: "assets/obj/trefoil.obj"
- scale: 1.0
- material.diffuse: Qt.rgba( 1.0, 0.75, 1.0, 1.0 )
- material.specular: Qt.rgba( 0.2, 0.2, 0.2, 1.0 )
- material.alpha: 0.2
- material.beta: 0.6
- }
-}
diff --git a/examples/qt3d/instanced-arrays-qml/instancebuffer.cpp b/examples/qt3d/instanced-arrays-qml/instancebuffer.cpp
index f457c96b9..bfe7fa951 100644
--- a/examples/qt3d/instanced-arrays-qml/instancebuffer.cpp
+++ b/examples/qt3d/instanced-arrays-qml/instancebuffer.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -43,7 +57,7 @@ static const int colCount = 20;
static const int maxInstanceCount = rowCount * colCount;
InstanceBuffer::InstanceBuffer(Qt3DCore::QNode *parent)
- : Qt3DRender::QBuffer(QBuffer::VertexBuffer, parent)
+ : Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, parent)
, m_instanceCount(maxInstanceCount)
{
// Create some per instance data - position of each instance
diff --git a/examples/qt3d/instanced-arrays-qml/instancebuffer.h b/examples/qt3d/instanced-arrays-qml/instancebuffer.h
index 6ff61d47c..0c769cbf4 100644
--- a/examples/qt3d/instanced-arrays-qml/instancebuffer.h
+++ b/examples/qt3d/instanced-arrays-qml/instancebuffer.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro b/examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro
index d15f5ad56..e3f7e436f 100644
--- a/examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro
+++ b/examples/qt3d/instanced-arrays-qml/instanced-arrays-qml.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += qml quick 3dcore 3drender 3dinput 3dquick
+QT += qml quick 3dcore 3drender 3dinput 3dquick 3dquickextras
SOURCES += \
main.cpp \
diff --git a/examples/qt3d/instanced-arrays-qml/main.cpp b/examples/qt3d/instanced-arrays-qml/main.cpp
index ca100d238..20b32563b 100644
--- a/examples/qt3d/instanced-arrays-qml/main.cpp
+++ b/examples/qt3d/instanced-arrays-qml/main.cpp
@@ -1,66 +1,68 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "instancebuffer.h"
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <Qt3DQuick/QQmlAspectEngine>
-#include <QtQml>
+#include <QQmlEngine>
+#include <QQmlContext>
#include <QGuiApplication>
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
InstanceBuffer buffer;
- engine.qmlEngine()->rootContext()->setContextProperty("_instanceBuffer", &buffer);
-
- engine.setSource(QUrl("qrc:/main.qml"));
-
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_instanceBuffer", &buffer);
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/instanced-arrays-qml/main.qml b/examples/qt3d/instanced-arrays-qml/main.qml
index c1bf01dda..91558fc42 100644
--- a/examples/qt3d/instanced-arrays-qml/main.qml
+++ b/examples/qt3d/instanced-arrays-qml/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,8 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
import QtQuick 2.2 as QQ2
Entity {
@@ -48,22 +64,22 @@ Entity {
aspectRatio: 16/9
nearPlane : 0.1
farPlane : 1000.0
- position: Qt.vector3d(10.0, 7.0, 35.0)
+ position: Qt.vector3d(9.5, 7.0, 45.0)
upVector: Qt.vector3d(0.0, 1.0, 0.0)
- viewCenter: Qt.vector3d(10.0, 0.5, 0.0)
+ viewCenter: Qt.vector3d(9.5, 0.5, 0.0)
}
- Configuration {
- controlledCamera: camera
- }
+ FirstPersonCameraController { camera: camera }
components: [
- FrameGraph {
+ RenderSettings {
activeFrameGraph: ForwardRenderer {
clearColor: Qt.rgba(0, 0.5, 1, 1)
camera: camera
}
- }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
]
Material {
@@ -76,10 +92,8 @@ Entity {
minorVersion: 2
majorVersion: 3
}
+ filterKeys: FilterKey { name: "renderingStyle"; value: "forward" }
renderPasses: RenderPass {
- bindings: [
- ParameterMapping { parameterName: "pos"; shaderVariableName: "pos"; bindingType: ParameterMapping.Attribute }
- ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/instanced.vert")
fragmentShaderCode: loadSource("qrc:/instanced.frag")
@@ -140,9 +154,9 @@ Entity {
Attribute {
id: instanceDataAttribute
name: "pos"
- attributeType: AbstractAttribute.VertexAttribute
- dataType: AbstractAttribute.Float
- dataSize: 3
+ attributeType: Attribute.VertexAttribute
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
divisor: 1
buffer: _instanceBuffer
}
diff --git a/examples/qt3d/keyboardinput-qml/SphereEntity.qml b/examples/qt3d/keyboardinput-qml/SphereEntity.qml
deleted file mode 100644
index 3f445cc2f..000000000
--- a/examples/qt3d/keyboardinput-qml/SphereEntity.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import Qt3D.Input 2.0
-import QtQuick 2.3 as QQ2
-
-Entity {
- id: root
- property alias position: transform.translation
- property alias color: material.diffuse
- property alias input: input
-
- PhongMaterial { id: material }
-
- SphereMesh { id: sphereMesh }
-
- Transform {
- id: transform
- scale: root.input.focus ? 2 : 1
-
- QQ2.Behavior on scale {
- QQ2.NumberAnimation {
- duration: 250
- }
- }
- }
-
- KeyboardInput { id: input }
-
- components: [material, sphereMesh, transform, input]
-}
diff --git a/examples/qt3d/keyboardinput-qml/doc/src/keyboardinput-qml.qdoc b/examples/qt3d/keyboardinput-qml/doc/src/keyboardinput-qml.qdoc
deleted file mode 100644
index 130e06698..000000000
--- a/examples/qt3d/keyboardinput-qml/doc/src/keyboardinput-qml.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example keyboardinput-qml
- \title Qt 3D: Keyboard Input QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/keyboardinput-qml/keyboardinput-qml.pro b/examples/qt3d/keyboardinput-qml/keyboardinput-qml.pro
deleted file mode 100644
index 5ebea8962..000000000
--- a/examples/qt3d/keyboardinput-qml/keyboardinput-qml.pro
+++ /dev/null
@@ -1,15 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dquick 3dinput quick qml
-
-SOURCES += \
- main.cpp
-
-RESOURCES += \
- keyboardinput-qml.qrc
-
-OTHER_FILES += \
- main.qml \
- SphereEntity.qml
diff --git a/examples/qt3d/keyboardinput-qml/main.cpp b/examples/qt3d/keyboardinput-qml/main.cpp
deleted file mode 100644
index 072fef361..000000000
--- a/examples/qt3d/keyboardinput-qml/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/qinputaspect.h>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/keyboardinput-qml/main.qml b/examples/qt3d/keyboardinput-qml/main.qml
deleted file mode 100644
index e943f190c..000000000
--- a/examples/qt3d/keyboardinput-qml/main.qml
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import Qt3D.Input 2.0
-
-Entity {
- id: root
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, 12.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration { controlledCamera: camera }
-
- components: FrameGraph {
- activeFrameGraph: ForwardRenderer {
- camera: camera
- }
- }
-
- KeyboardController {
- id: keyboardController
- }
-
- SphereEntity {
- id: sphere1
- position: Qt.vector3d(-5, 0, 0)
- color: "red"
- input.onTabPressed: sphere2.input.focus = true
- input.focus: true
- input.controller: keyboardController
- }
-
- SphereEntity {
- id: sphere2
- color: "green"
- input.onTabPressed: sphere3.input.focus = true
- input.controller: keyboardController
- }
-
- SphereEntity {
- id: sphere3
- position: Qt.vector3d(5, 0, 0)
- color: "blue"
- input.onTabPressed: sphere1.input.focus = true
- input.controller: keyboardController
- }
-}
diff --git a/examples/qt3d/lights/PlaneEntity.qml b/examples/qt3d/lights/PlaneEntity.qml
index ce07db08b..268c59add 100644
--- a/examples/qt3d/lights/PlaneEntity.qml
+++ b/examples/qt3d/lights/PlaneEntity.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
diff --git a/examples/qt3d/lights/lights.pro b/examples/qt3d/lights/lights.pro
index 85fe72c15..be41ac01d 100644
--- a/examples/qt3d/lights/lights.pro
+++ b/examples/qt3d/lights/lights.pro
@@ -4,7 +4,7 @@
SOURCE += main.cpp
-QT += qml quick 3dcore 3drender 3dinput 3dquick
+QT += qml quick 3dcore 3drender 3dinput 3dquick 3dquickextras
OTHER_FILES += main.qml \
PlaneEntity.qml
diff --git a/examples/qt3d/lights/main.cpp b/examples/qt3d/lights/main.cpp
index eb4a0f5b0..ddddf6e3d 100644
--- a/examples/qt3d/lights/main.cpp
+++ b/examples/qt3d/lights/main.cpp
@@ -1,59 +1,62 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <QGuiApplication>
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/lights/main.qml b/examples/qt3d/lights/main.qml
index 99bc1147d..d16df0795 100644
--- a/examples/qt3d/lights/main.qml
+++ b/examples/qt3d/lights/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,15 +51,20 @@
import QtQuick 2.0 as Quick
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
Entity
{
- components: FrameGraph {
- activeFrameGraph: ForwardRenderer {
- clearColor: Qt.rgba(0, 0, 0, 1)
- camera: camera
- }
- }
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0, 0, 1)
+ camera: camera
+ }
+ },
+ InputSettings { }
+ ]
Camera {
id: camera
@@ -59,8 +78,11 @@ Entity
viewCenter: Qt.vector3d( 0.0, -10.0, -1.0 )
}
- Configuration {
- controlledCamera: camera
+ FirstPersonCameraController {
+ camera: camera
+ linearSpeed: 1000.0
+ acceleration: 0.1
+ deceleration: 1.0
}
Entity {
@@ -68,7 +90,7 @@ Entity
components: [
DirectionalLight {
color: Qt.rgba(0.8, 0.8, 0.8, 1.0)
- direction: Qt.vector3d(-1, -1, 0)
+ worldDirection: Qt.vector3d(-1, -1, 0)
}
]
}
@@ -123,14 +145,14 @@ Entity
translation: Qt.vector3d(-5.0, 40.0, -5.0)
},
SpotLight {
- direction: Qt.vector3d(1.0, -4.0, 0.0)
- Quick.SequentialAnimation on direction.x {
+ localDirection: Qt.vector3d(1.0, -4.0, 0.0)
+ Quick.SequentialAnimation on localDirection.x {
Quick.NumberAnimation { from: -4.0; to: 4.0; duration: 5000 }
Quick.NumberAnimation { from: 4.0; to: -4.0; duration: 5000 }
loops: Quick.Animation.Infinite
}
cutOffAngle: 30
- attenuation: Qt.vector3d(1, 0, 0)
+ constantAttenuation: 1
intensity: 4
}
]
diff --git a/examples/qt3d/loader-qml/CuboidEntity.qml b/examples/qt3d/loader-qml/CuboidEntity.qml
deleted file mode 100644
index e359ad985..000000000
--- a/examples/qt3d/loader-qml/CuboidEntity.qml
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.4 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- components: [ mesh, phongMaterial, transform ]
-
- CuboidMesh {
- id: mesh
- yzMeshResolution: Qt.size(2, 2)
- xzMeshResolution: Qt.size(2, 2)
- xyMeshResolution: Qt.size(2, 2)
- }
-
- GoochMaterial {
- id: phongMaterial
- }
-
- Transform {
- id: transform
- property real userAngle: 0.0
- scale: 4
- rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
- }
-
- QQ2.ColorAnimation {
- target: phongMaterial
- property: "warmColor"
- from: "red"
- to: "blue"
- duration: 2500
- loops: QQ2.Animation.Infinite
- running: true
- }
-
- QQ2.NumberAnimation {
- target: transform
- property: "userAngle"
- duration: 750
- loops: QQ2.Animation.Infinite
- running: true
- easing.type: QQ2.Easing.InOutQuad
- from: 0
- to: 360
- }
-}
diff --git a/examples/qt3d/loader-qml/SphereEntity.qml b/examples/qt3d/loader-qml/SphereEntity.qml
deleted file mode 100644
index 56be1eb07..000000000
--- a/examples/qt3d/loader-qml/SphereEntity.qml
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.4 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- components: [ mesh, material, transform ]
-
- SphereMesh {
- id: mesh
- radius: 3
- }
-
- Transform {
- id: transform
- scale: 3
- }
-
- QQ2.ColorAnimation {
- target: material
- property: "diffuse"
- from: "yellow"
- to: "orange"
- duration: 1500
- loops: QQ2.Animation.Infinite
- running: true
- }
-
- QQ2.NumberAnimation {
- target: transform
- property: "scale"
- duration: 1500
- loops: QQ2.Animation.Infinite
- running: true
- easing.type: QQ2.Easing.InOutQuad
- from: 1
- to: 1.5
- }
-}
diff --git a/examples/qt3d/loader-qml/doc/src/loader-qml.qdoc b/examples/qt3d/loader-qml/doc/src/loader-qml.qdoc
deleted file mode 100644
index 8dc320fac..000000000
--- a/examples/qt3d/loader-qml/doc/src/loader-qml.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example loader-qml
- \title Qt 3D: Loader QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/loader-qml/loader-qml.pro b/examples/qt3d/loader-qml/loader-qml.pro
deleted file mode 100644
index ed74a300a..000000000
--- a/examples/qt3d/loader-qml/loader-qml.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- SphereEntity.qml \
- CuboidEntity.qml
-
-RESOURCES += \
- loader-qml.qrc
diff --git a/examples/qt3d/loader-qml/main.cpp b/examples/qt3d/loader-qml/main.cpp
deleted file mode 100644
index 1a538e49d..000000000
--- a/examples/qt3d/loader-qml/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/loader-qml/main.qml b/examples/qt3d/loader-qml/main.qml
deleted file mode 100644
index 76b7d3378..000000000
--- a/examples/qt3d/loader-qml/main.qml
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.2 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- components: [
- FrameGraph {
- activeFrameGraph: ForwardRenderer {
- camera: camera
- }
- }
- ]
-
-
- PhongMaterial {
- id: material
- diffuse: "yellow"
- }
-
- TorusMesh {
- id: torusMesh
- radius: 5
- minorRadius: 1
- rings: 100
- slices: 20
- }
-
- Transform {
- id: torusTransform
- scale3D: Qt.vector3d(1.5, 1, 0.5)
- rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
- }
-
- Entity {
- id: torusEntity
- components: [ torusMesh, material, torusTransform ]
- }
-
- QQ2.Timer {
- interval: 1000
- running: true
- repeat: true
- property bool hasSphere: true
-
- onTriggered: {
- loader.source = hasSphere ? "qrc:/SphereEntity.qml" : "qrc:/CuboidEntity.qml"
- hasSphere = !hasSphere
- }
- }
-
- EntityLoader {
- id: loader
- components: [ revolutionTransform ]
- }
-
- Transform {
- id: revolutionTransform
- property real userAngle: 0.0
- matrix: {
- var m = Qt.matrix4x4();
- m.rotate(userAngle, Qt.vector3d(0, 1, 0));
- m.translate(Qt.vector3d(20, 0, 0));
- return m;
- }
- }
-
- QQ2.NumberAnimation {
- target: revolutionTransform
- property: "userAngle"
- duration: 10000
- from: 0
- to: 360
-
- loops: QQ2.Animation.Infinite
- running: true
- }
-}
diff --git a/examples/qt3d/materials-cpp/barrel.cpp b/examples/qt3d/materials-cpp/barrel.cpp
index 96a5e0c35..147f586aa 100644
--- a/examples/qt3d/materials-cpp/barrel.cpp
+++ b/examples/qt3d/materials-cpp/barrel.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -62,7 +76,7 @@ Barrel::Barrel(Qt3DCore::QNode *parent)
, m_bumps(NoBumps)
, m_diffuseColor(Red)
, m_specularColor(None)
- , m_material(new Qt3DRender::QNormalDiffuseSpecularMapMaterial())
+ , m_material(new Qt3DExtras::QNormalDiffuseSpecularMapMaterial())
, m_diffuseTexture(m_material->diffuse())
, m_normalTexture(m_material->normal())
, m_specularTexture(m_material->specular())
diff --git a/examples/qt3d/materials-cpp/barrel.h b/examples/qt3d/materials-cpp/barrel.h
index f4ba576bc..237ab446c 100644
--- a/examples/qt3d/materials-cpp/barrel.h
+++ b/examples/qt3d/materials-cpp/barrel.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,7 +51,7 @@
#ifndef BARREL_H
#define BARREL_H
-#include <Qt3DRender/QNormalDiffuseSpecularMapMaterial>
+#include <Qt3DExtras/QNormalDiffuseSpecularMapMaterial>
#include <Qt3DRender/qtexture.h>
#include "renderableentity.h"
@@ -82,10 +96,10 @@ private:
Bumps m_bumps;
DiffuseColor m_diffuseColor;
SpecularColor m_specularColor;
- Qt3DRender::QNormalDiffuseSpecularMapMaterial *m_material;
- Qt3DRender::QAbstractTextureProvider *m_diffuseTexture;
- Qt3DRender::QAbstractTextureProvider *m_normalTexture;
- Qt3DRender::QAbstractTextureProvider *m_specularTexture;
+ Qt3DExtras::QNormalDiffuseSpecularMapMaterial *m_material;
+ Qt3DRender::QAbstractTexture *m_diffuseTexture;
+ Qt3DRender::QAbstractTexture *m_normalTexture;
+ Qt3DRender::QAbstractTexture *m_specularTexture;
Qt3DRender::QTextureImage *m_diffuseTextureImage;
Qt3DRender::QTextureImage *m_normalTextureImage;
Qt3DRender::QTextureImage *m_specularTextureImage;
diff --git a/examples/qt3d/materials-cpp/doc/src/materials-cpp.qdoc b/examples/qt3d/materials-cpp/doc/src/materials-cpp.qdoc
index e94b7f4ff..65975b88c 100644
--- a/examples/qt3d/materials-cpp/doc/src/materials-cpp.qdoc
+++ b/examples/qt3d/materials-cpp/doc/src/materials-cpp.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/materials-cpp/houseplant.cpp b/examples/qt3d/materials-cpp/houseplant.cpp
index 12ce2ba37..638f8c4d1 100644
--- a/examples/qt3d/materials-cpp/houseplant.cpp
+++ b/examples/qt3d/materials-cpp/houseplant.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -58,9 +72,9 @@ HousePlant::HousePlant(Qt3DCore::QNode *parent)
, m_pot(new RenderableEntity(this))
, m_plant(new RenderableEntity(m_pot))
, m_cover(new RenderableEntity(m_pot))
- , m_potMaterial(new Qt3DRender::QNormalDiffuseMapMaterial())
- , m_plantMaterial(new Qt3DRender::QNormalDiffuseMapAlphaMaterial())
- , m_coverMaterial(new Qt3DRender::QNormalDiffuseMapMaterial())
+ , m_potMaterial(new Qt3DExtras::QNormalDiffuseMapMaterial())
+ , m_plantMaterial(new Qt3DExtras::QNormalDiffuseMapAlphaMaterial())
+ , m_coverMaterial(new Qt3DExtras::QNormalDiffuseMapMaterial())
, m_potImage(new Qt3DRender::QTextureImage())
, m_potNormalImage(new Qt3DRender::QTextureImage())
, m_plantImage(new Qt3DRender::QTextureImage())
diff --git a/examples/qt3d/materials-cpp/houseplant.h b/examples/qt3d/materials-cpp/houseplant.h
index 15854d30a..d2081b3d1 100644
--- a/examples/qt3d/materials-cpp/houseplant.h
+++ b/examples/qt3d/materials-cpp/houseplant.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -39,8 +53,8 @@
#include "renderableentity.h"
#include <QEntity>
-#include <QNormalDiffuseMapAlphaMaterial>
-#include <QNormalDiffuseMapMaterial>
+#include <Qt3DExtras/QNormalDiffuseMapAlphaMaterial>
+#include <Qt3DExtras/QNormalDiffuseMapMaterial>
#include <QTextureImage>
class HousePlant : public Qt3DCore::QEntity
@@ -82,9 +96,9 @@ private:
RenderableEntity *m_plant;
RenderableEntity *m_cover;
- Qt3DRender::QNormalDiffuseMapMaterial *m_potMaterial;
- Qt3DRender::QNormalDiffuseMapAlphaMaterial *m_plantMaterial;
- Qt3DRender::QNormalDiffuseMapMaterial *m_coverMaterial;
+ Qt3DExtras::QNormalDiffuseMapMaterial *m_potMaterial;
+ Qt3DExtras::QNormalDiffuseMapAlphaMaterial *m_plantMaterial;
+ Qt3DExtras::QNormalDiffuseMapMaterial *m_coverMaterial;
Qt3DRender::QTextureImage *m_potImage;
Qt3DRender::QTextureImage *m_potNormalImage;
diff --git a/examples/qt3d/materials-cpp/main.cpp b/examples/qt3d/materials-cpp/main.cpp
index b9f7a72d7..5ca6998e0 100644
--- a/examples/qt3d/materials-cpp/main.cpp
+++ b/examples/qt3d/materials-cpp/main.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,58 +50,44 @@
#include <QGuiApplication>
-#include <window.h>
#include <Qt3DCore/QEntity>
#include <Qt3DCore/QAspectEngine>
-#include <Qt3DCore/QCamera>
+#include <Qt3DRender/QCamera>
#include <Qt3DInput/QInputAspect>
#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QPhongMaterial>
-#include <Qt3DRender/QDiffuseMapMaterial>
-#include <Qt3DRender/QForwardRenderer>
-#include <Qt3DRender/QFrameGraph>
+#include <Qt3DExtras/QPhongMaterial>
+#include <Qt3DExtras/QDiffuseMapMaterial>
+#include <Qt3DExtras/QForwardRenderer>
#include <Qt3DRender/QTextureImage>
#include "planeentity.h"
#include "rotatingtrefoilknot.h"
#include "barrel.h"
#include "houseplant.h"
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qfirstpersoncameracontroller.h>
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
- Window view;
- Qt3DCore::QAspectEngine engine;
- engine.registerAspect(new Qt3DRender::QRenderAspect());
- Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- engine.registerAspect(input);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.setData(data);
+ Qt3DExtras::Qt3DWindow view;
// Scene Root
Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity();
// Scene Camera
- Qt3DCore::QCamera *basicCamera = new Qt3DCore::QCamera(sceneRoot);
- basicCamera->setProjectionType(Qt3DCore::QCameraLens::PerspectiveProjection);
+ Qt3DRender::QCamera *basicCamera = view.camera();
+ basicCamera->setProjectionType(Qt3DRender::QCameraLens::PerspectiveProjection);
basicCamera->setAspectRatio(view.width() / view.height());
basicCamera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
basicCamera->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f));
basicCamera->setPosition(QVector3D(0.0f, 3.5f, 25.0f));
// For camera controls
- input->setCamera(basicCamera);
-
- // Forward Renderer FrameGraph
- Qt3DRender::QFrameGraph *frameGraphComponent = new Qt3DRender::QFrameGraph(sceneRoot);
- Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
- forwardRenderer->setCamera(basicCamera);
- frameGraphComponent->setActiveFrameGraph(forwardRenderer);
- sceneRoot->addComponent(frameGraphComponent);
+ Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot);
+ camController->setCamera(basicCamera);
// Scene floor
PlaneEntity *planeEntity = new PlaneEntity(sceneRoot);
@@ -95,7 +95,7 @@ int main(int argc, char* argv[])
planeEntity->mesh()->setWidth(100.0f);
planeEntity->mesh()->setMeshResolution(QSize(20, 20));
- Qt3DRender::QNormalDiffuseSpecularMapMaterial *normalDiffuseSpecularMapMaterial = new Qt3DRender::QNormalDiffuseSpecularMapMaterial();
+ Qt3DExtras::QNormalDiffuseSpecularMapMaterial *normalDiffuseSpecularMapMaterial = new Qt3DExtras::QNormalDiffuseSpecularMapMaterial();
normalDiffuseSpecularMapMaterial->setTextureScale(10.0f);
normalDiffuseSpecularMapMaterial->setShininess(80.0f);
normalDiffuseSpecularMapMaterial->setAmbient(QColor::fromRgbF(0.2f, 0.2f, 0.2f, 1.0f));
@@ -118,7 +118,7 @@ int main(int argc, char* argv[])
RenderableEntity *chest = new RenderableEntity(sceneRoot);
chest->transform()->setScale(0.03f);
chest->mesh()->setSource(QUrl(QStringLiteral("qrc:/assets/chest/Chest.obj")));
- Qt3DRender::QDiffuseMapMaterial *diffuseMapMaterial = new Qt3DRender::QDiffuseMapMaterial();
+ Qt3DExtras::QDiffuseMapMaterial *diffuseMapMaterial = new Qt3DExtras::QDiffuseMapMaterial();
diffuseMapMaterial->setSpecular(QColor::fromRgbF(0.2f, 0.2f, 0.2f, 1.0f));
diffuseMapMaterial->setShininess(2.0f);
@@ -133,7 +133,7 @@ int main(int argc, char* argv[])
RotatingTrefoilKnot *trefoil = new RotatingTrefoilKnot(sceneRoot);
trefoil->setPosition(QVector3D(0.0f, 3.5f, 0.0f));
trefoil->setScale(0.5f);
- Qt3DRender::QPhongMaterial *phongMaterial = new Qt3DRender::QPhongMaterial();
+ Qt3DExtras::QPhongMaterial *phongMaterial = new Qt3DExtras::QPhongMaterial();
phongMaterial->setDiffuse(QColor(204, 205, 75)); // Safari Yellow #cccd4b
phongMaterial->setSpecular(Qt::white);
trefoil->addComponent(phongMaterial);
@@ -194,7 +194,7 @@ int main(int argc, char* argv[])
crossShrub->setPosition(QVector3D(0.0f, 0.0f, 8.0f));
crossShrub->setScale(0.05f);
- engine.setRootEntity(sceneRoot);
+ view.setRootEntity(sceneRoot);
view.show();
return app.exec();
diff --git a/examples/qt3d/materials-cpp/materials-cpp.pro b/examples/qt3d/materials-cpp/materials-cpp.pro
index 8cdffd313..326feca75 100644
--- a/examples/qt3d/materials-cpp/materials-cpp.pro
+++ b/examples/qt3d/materials-cpp/materials-cpp.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput
+QT += 3dcore 3drender 3dinput 3dextras
HEADERS += \
planeentity.h \
diff --git a/examples/qt3d/materials-cpp/planeentity.cpp b/examples/qt3d/materials-cpp/planeentity.cpp
index 86d2dba79..b60e6c186 100644
--- a/examples/qt3d/materials-cpp/planeentity.cpp
+++ b/examples/qt3d/materials-cpp/planeentity.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,12 +50,12 @@
#include "planeentity.h"
-#include <Qt3DRender/QPlaneMesh>
+#include <Qt3DExtras/QPlaneMesh>
#include <Qt3DCore/QTransform>
PlaneEntity::PlaneEntity(Qt3DCore::QNode *parent)
: Qt3DCore::QEntity(new Qt3DCore::QEntity(parent))
- , m_mesh(new Qt3DRender::QPlaneMesh())
+ , m_mesh(new Qt3DExtras::QPlaneMesh())
, m_transform(new Qt3DCore::QTransform())
{
addComponent(m_mesh);
@@ -52,7 +66,7 @@ PlaneEntity::~PlaneEntity()
{
}
-Qt3DRender::QPlaneMesh *PlaneEntity::mesh() const
+Qt3DExtras::QPlaneMesh *PlaneEntity::mesh() const
{
return m_mesh;
}
diff --git a/examples/qt3d/materials-cpp/planeentity.h b/examples/qt3d/materials-cpp/planeentity.h
index 768f9da5f..8491efb1a 100644
--- a/examples/qt3d/materials-cpp/planeentity.h
+++ b/examples/qt3d/materials-cpp/planeentity.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -39,7 +53,7 @@
#include <Qt3DCore/QEntity>
#include <Qt3DCore/QTransform>
-#include <Qt3DRender/QPlaneMesh>
+#include <Qt3DExtras/QPlaneMesh>
class PlaneEntity : public Qt3DCore::QEntity
{
@@ -47,10 +61,10 @@ public:
PlaneEntity(Qt3DCore::QNode *parent = 0);
~PlaneEntity();
- Qt3DRender::QPlaneMesh *mesh() const;
+ Qt3DExtras::QPlaneMesh *mesh() const;
private:
- Qt3DRender::QPlaneMesh *m_mesh;
+ Qt3DExtras::QPlaneMesh *m_mesh;
Qt3DCore::QTransform *m_transform;
};
diff --git a/examples/qt3d/materials-cpp/renderableentity.cpp b/examples/qt3d/materials-cpp/renderableentity.cpp
index 8c4bad85c..87474f6e1 100644
--- a/examples/qt3d/materials-cpp/renderableentity.cpp
+++ b/examples/qt3d/materials-cpp/renderableentity.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -45,11 +59,6 @@ RenderableEntity::RenderableEntity(Qt3DCore::QNode *parent)
addComponent(m_transform);
}
-RenderableEntity::~RenderableEntity()
-{
- QNode::cleanup();
-}
-
Qt3DRender::QMesh *RenderableEntity::mesh() const
{
return m_mesh;
diff --git a/examples/qt3d/materials-cpp/renderableentity.h b/examples/qt3d/materials-cpp/renderableentity.h
index af7233a00..5ed767b54 100644
--- a/examples/qt3d/materials-cpp/renderableentity.h
+++ b/examples/qt3d/materials-cpp/renderableentity.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -45,7 +59,6 @@ class RenderableEntity : public Qt3DCore::QEntity
{
public:
RenderableEntity(Qt3DCore::QNode *parent = 0);
- ~RenderableEntity();
Qt3DRender::QMesh *mesh() const;
Qt3DCore::QTransform *transform() const;
diff --git a/examples/qt3d/materials-cpp/rotatingtrefoilknot.cpp b/examples/qt3d/materials-cpp/rotatingtrefoilknot.cpp
index bbe7f8161..6e50ccbdf 100644
--- a/examples/qt3d/materials-cpp/rotatingtrefoilknot.cpp
+++ b/examples/qt3d/materials-cpp/rotatingtrefoilknot.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/materials-cpp/rotatingtrefoilknot.h b/examples/qt3d/materials-cpp/rotatingtrefoilknot.h
index 397aa1705..6f1858863 100644
--- a/examples/qt3d/materials-cpp/rotatingtrefoilknot.h
+++ b/examples/qt3d/materials-cpp/rotatingtrefoilknot.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/materials-cpp/trefoilknot.cpp b/examples/qt3d/materials-cpp/trefoilknot.cpp
index e0da64987..82a65e294 100644
--- a/examples/qt3d/materials-cpp/trefoilknot.cpp
+++ b/examples/qt3d/materials-cpp/trefoilknot.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/materials-cpp/trefoilknot.h b/examples/qt3d/materials-cpp/trefoilknot.h
index b96291512..42ac3419b 100644
--- a/examples/qt3d/materials-cpp/trefoilknot.h
+++ b/examples/qt3d/materials-cpp/trefoilknot.h
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/materials/Barrel.qml b/examples/qt3d/materials/Barrel.qml
index 02a7e4812..40da0533a 100644
--- a/examples/qt3d/materials/Barrel.qml
+++ b/examples/qt3d/materials/Barrel.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
diff --git a/examples/qt3d/materials/BasicCamera.qml b/examples/qt3d/materials/BasicCamera.qml
index d89de8b73..9f2ce729b 100644
--- a/examples/qt3d/materials/BasicCamera.qml
+++ b/examples/qt3d/materials/BasicCamera.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/materials/Chest.qml b/examples/qt3d/materials/Chest.qml
index 3e361cadb..879ebb26f 100644
--- a/examples/qt3d/materials/Chest.qml
+++ b/examples/qt3d/materials/Chest.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
diff --git a/examples/qt3d/materials/HousePlant.qml b/examples/qt3d/materials/HousePlant.qml
index c8d4693d3..a06f69e1e 100644
--- a/examples/qt3d/materials/HousePlant.qml
+++ b/examples/qt3d/materials/HousePlant.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
diff --git a/examples/qt3d/materials/PlaneEntity.qml b/examples/qt3d/materials/PlaneEntity.qml
index ce07db08b..268c59add 100644
--- a/examples/qt3d/materials/PlaneEntity.qml
+++ b/examples/qt3d/materials/PlaneEntity.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
diff --git a/examples/qt3d/materials/RenderableEntity.qml b/examples/qt3d/materials/RenderableEntity.qml
index f6883be3a..d64f75a72 100644
--- a/examples/qt3d/materials/RenderableEntity.qml
+++ b/examples/qt3d/materials/RenderableEntity.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/materials/SortedForwardRenderer.qml b/examples/qt3d/materials/SortedForwardRenderer.qml
index 9d09f0a29..e39afa2f5 100644
--- a/examples/qt3d/materials/SortedForwardRenderer.qml
+++ b/examples/qt3d/materials/SortedForwardRenderer.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -43,28 +57,33 @@ TechniqueFilter {
// Expose camera to allow user to choose which camera to use for rendering
property alias camera: cameraSelector.camera
+ property alias window: surfaceSelector.surface
// Select the forward rendering Technique of any used Effect
- requires: [ Annotation { name: "renderingStyle"; value: "forward" } ]
+ matchAll: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
+
+ RenderSurfaceSelector {
+ id: surfaceSelector
- // Use the whole viewport
- Viewport {
- id: viewport
- objectName : "viewport"
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- clearColor: "white"
+ // Use the whole viewport
+ Viewport {
+ id: viewport
+ objectName : "viewport"
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- // Use the specified camera
- CameraSelector {
- id : cameraSelector
- objectName : "cameraSelector"
- ClearBuffer {
- buffers : ClearBuffer.ColorDepthBuffer
- SortMethod {
- criteria: [
- SortCriterion { sort: SortCriterion.StateChangeCost },
- SortCriterion { sort: SortCriterion.Material }
- ]
+ // Use the specified camera
+ CameraSelector {
+ id : cameraSelector
+ objectName : "cameraSelector"
+ ClearBuffers {
+ buffers : ClearBuffers.ColorDepthBuffer
+ clearColor: "white"
+ SortPolicy {
+ sortTypes: [
+ SortPolicy.StateChangeCost,
+ SortPolicy.Material
+ ]
+ }
}
}
}
diff --git a/examples/qt3d/materials/TrefoilKnot.qml b/examples/qt3d/materials/TrefoilKnot.qml
index 8dd03ea4e..2ea1bdea9 100644
--- a/examples/qt3d/materials/TrefoilKnot.qml
+++ b/examples/qt3d/materials/TrefoilKnot.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/materials/doc/src/materials.qdoc b/examples/qt3d/materials/doc/src/materials.qdoc
index e4e2b01c1..e0bda954f 100644
--- a/examples/qt3d/materials/doc/src/materials.qdoc
+++ b/examples/qt3d/materials/doc/src/materials.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/materials/main.cpp b/examples/qt3d/materials/main.cpp
index e2eb9aa9c..faed40390 100644
--- a/examples/qt3d/materials/main.cpp
+++ b/examples/qt3d/materials/main.cpp
@@ -1,64 +1,67 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <Qt3DQuick/QQmlAspectEngine>
-
#include <QGuiApplication>
-#include <QtQml>
+#include <QQmlEngine>
+#include <QQmlContext>
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
-
- engine.aspectEngine()->setData(data);
- // Expose the window as a context property so we can set the aspect ratio
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
- engine.setSource(QUrl("qrc:/main.qml"));
+ // Expose the window as a context property so we can set the aspect ratio
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/materials/main.qml b/examples/qt3d/materials/main.qml
index de759209b..46a48c4e2 100644
--- a/examples/qt3d/materials/main.qml
+++ b/examples/qt3d/materials/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,6 +51,8 @@
import QtQuick 2.1 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
@@ -45,12 +61,14 @@ Entity {
// Use the renderer configuration specified in ForwardRenderer.qml
// and render from the mainCamera
components: [
- FrameGraph {
+ RenderSettings {
activeFrameGraph: SortedForwardRenderer {
id: renderer
camera: mainCamera
}
- }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
]
BasicCamera {
@@ -59,9 +77,7 @@ Entity {
viewCenter: Qt.vector3d( 0.0, 3.5, 0.0 )
}
- Configuration {
- controlledCamera: mainCamera
- }
+ FirstPersonCameraController { camera: mainCamera }
PhongMaterial {
id: redAdsMaterial
diff --git a/examples/qt3d/materials/materials.pro b/examples/qt3d/materials/materials.pro
index a5c892fe8..c19361472 100644
--- a/examples/qt3d/materials/materials.pro
+++ b/examples/qt3d/materials/materials.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput 3dquick qml quick
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
HEADERS += \
diff --git a/examples/qt3d/mouseinput-qml/main.cpp b/examples/qt3d/mouseinput-qml/main.cpp
deleted file mode 100644
index c102cfa2d..000000000
--- a/examples/qt3d/mouseinput-qml/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
-
- engine.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/mouseinput-qml/main.qml b/examples/qt3d/mouseinput-qml/main.qml
deleted file mode 100644
index 2d9a8a138..000000000
--- a/examples/qt3d/mouseinput-qml/main.qml
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import Qt3D.Input 2.0
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- components: FrameGraph {
- ForwardRenderer {
- camera: camera
- clearColor: "black"
- }
- }
-
- SphereMesh {
- id: sphereMesh
- radius: 3
- }
-
- Material {
- id: material
- effect : Effect {
- }
- }
-
- MouseController {
- id: mouseController
- }
-
- Entity {
- id: sphere1
-
- property real scaleFactor: 1.0
-
- property Transform transform: Transform {
- scale: sphere1.scaleFactor
- }
-
- property MouseInput mouseInput : MouseInput {
- controller: mouseController
-
- onClicked: {
- //Signal not implemented yet
- }
-
- onReleased: {
- switch (mouse.button) {
- case Qt.LeftButton:
- sphere1.scaleFactor += 0.5;
- break;
-
- case Qt.RightButton:
- sphere1.scaleFactor -= 0.5;
- break;
- }
- }
- }
-
- components: [sphereMesh, material, transform, mouseInput]
- }
-}
diff --git a/examples/qt3d/mouseinput-qml/mouseinput-qml.pro b/examples/qt3d/mouseinput-qml/mouseinput-qml.pro
deleted file mode 100644
index 8d72e3a8b..000000000
--- a/examples/qt3d/mouseinput-qml/mouseinput-qml.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-SOURCES += main.cpp
-
-RESOURCES += \
- mouseinput-qml.qrc
-
-OTHER_FILES += \
- main.qml
diff --git a/examples/qt3d/multiviewport/QuadViewportFrameGraph.qml b/examples/qt3d/multiviewport/QuadViewportFrameGraph.qml
index 2011aaf4d..814629a23 100644
--- a/examples/qt3d/multiviewport/QuadViewportFrameGraph.qml
+++ b/examples/qt3d/multiviewport/QuadViewportFrameGraph.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,44 +51,49 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
-FrameGraph {
+RenderSettings {
id: quadViewportFrameGraph
property alias topLeftCamera: cameraSelectorTopLeftViewport.camera;
property alias topRightCamera: cameraSelectorTopRightViewport.camera;
property alias bottomLeftCamera: cameraSelectorBottomLeftViewport.camera;
property alias bottomRightCamera: cameraSelectorBottomRightViewport.camera;
+ property alias window: surfaceSelector.surface
- Viewport {
- id: mainViewport
- rect: Qt.rect(0, 0, 1, 1)
-
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
- }
+ activeFrameGraph: RenderSurfaceSelector {
+ id: surfaceSelector
Viewport {
- id: topLeftViewport
- rect: Qt.rect(0, 0, 0.5, 0.5)
- CameraSelector { id: cameraSelectorTopLeftViewport }
- }
+ id: mainViewport
+ normalizedRect: Qt.rect(0, 0, 1, 1)
- Viewport {
- id: topRightViewport
- rect: Qt.rect(0.5, 0, 0.5, 0.5)
- CameraSelector { id: cameraSelectorTopRightViewport }
- }
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
+ }
- Viewport {
- id: bottomLeftViewport
- rect: Qt.rect(0, 0.5, 0.5, 0.5)
- CameraSelector { id: cameraSelectorBottomLeftViewport }
- }
+ Viewport {
+ id: topLeftViewport
+ normalizedRect: Qt.rect(0, 0, 0.5, 0.5)
+ CameraSelector { id: cameraSelectorTopLeftViewport }
+ }
- Viewport {
- id: bottomRightViewport
- rect: Qt.rect(0.5, 0.5, 0.5, 0.5)
- CameraSelector { id: cameraSelectorBottomRightViewport }
+ Viewport {
+ id: topRightViewport
+ normalizedRect: Qt.rect(0.5, 0, 0.5, 0.5)
+ CameraSelector { id: cameraSelectorTopRightViewport }
+ }
+
+ Viewport {
+ id: bottomLeftViewport
+ normalizedRect: Qt.rect(0, 0.5, 0.5, 0.5)
+ CameraSelector { id: cameraSelectorBottomLeftViewport }
+ }
+
+ Viewport {
+ id: bottomRightViewport
+ normalizedRect: Qt.rect(0.5, 0.5, 0.5, 0.5)
+ CameraSelector { id: cameraSelectorBottomRightViewport }
+ }
}
}
}
diff --git a/examples/qt3d/multiviewport/SimpleCamera.qml b/examples/qt3d/multiviewport/SimpleCamera.qml
index ee474eb77..e1cb95426 100644
--- a/examples/qt3d/multiviewport/SimpleCamera.qml
+++ b/examples/qt3d/multiviewport/SimpleCamera.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/multiviewport/doc/src/multiviewport.qdoc b/examples/qt3d/multiviewport/doc/src/multiviewport.qdoc
index 2316c1c70..42eb836b2 100644
--- a/examples/qt3d/multiviewport/doc/src/multiviewport.qdoc
+++ b/examples/qt3d/multiviewport/doc/src/multiviewport.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/multiviewport/main.cpp b/examples/qt3d/multiviewport/main.cpp
index 254254111..ce5b883bd 100644
--- a/examples/qt3d/multiviewport/main.cpp
+++ b/examples/qt3d/multiviewport/main.cpp
@@ -1,59 +1,61 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <QGuiApplication>
int main(int ac, char **av)
{
QGuiApplication app(ac, av);
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect);
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/multiviewport/main.qml b/examples/qt3d/multiviewport/main.qml
index cfdd7a1a5..df01bacec 100644
--- a/examples/qt3d/multiviewport/main.qml
+++ b/examples/qt3d/multiviewport/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,10 +51,12 @@
import QtQuick 2.0
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
Entity {
id: rootNode
- components: [quadViewportFrameGraph]
+ components: [quadViewportFrameGraph, inputSettings]
QuadViewportFrameGraph {
id: quadViewportFrameGraph
@@ -50,6 +66,9 @@ Entity {
bottomRightCamera: cameraSet.cameras[3]
}
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { id: inputSettings }
+
Entity {
id: cameraSet
property var cameras: [camera1, camera2, camera3, camera4]
diff --git a/examples/qt3d/multiviewport/multiviewport.pro b/examples/qt3d/multiviewport/multiviewport.pro
index 12b30ad50..c53be2113 100644
--- a/examples/qt3d/multiviewport/multiviewport.pro
+++ b/examples/qt3d/multiviewport/multiviewport.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput 3dquick qml quick
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
HEADERS += \
diff --git a/examples/qt3d/picking-qml/main.cpp b/examples/qt3d/picking-qml/main.cpp
deleted file mode 100644
index d8d66801e..000000000
--- a/examples/qt3d/picking-qml/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-#include <QQmlContext>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.qmlEngine()->rootContext()->setContextProperty("_view", &view);
-
- engine.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/picking-qml/main.qml b/examples/qt3d/picking-qml/main.qml
deleted file mode 100644
index 47bb97192..000000000
--- a/examples/qt3d/picking-qml/main.qml
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import Qt3D.Input 2.0
-import QtQuick 2.0 as QQ2
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: _view.width / _view.height
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- components: FrameGraph {
- ForwardRenderer {
- camera: camera
- clearColor: "black"
- }
- }
-
- SphereMesh {
- id: sphereMesh
- }
-
- Entity {
- id: sphere1
-
- property real scaleFactor: objectPicker.pressed ? 3.0 : 1.0
- QQ2.Behavior on scaleFactor { QQ2.NumberAnimation { duration: 150; easing.type: QQ2.Easing.InQuad } }
-
- property Transform transform: Transform {
- scale: sphere1.scaleFactor
- translation: Qt.vector3d(-8, 0, 0)
- }
-
- property Material material: PhongMaterial {
- ambient: "green"
- diffuse: "green"
- }
-
- property ObjectPicker objectPicker: ObjectPicker {
- hoverEnabled: true
-
- onPressed: sphere1.material.diffuse = "orange"
- onReleased: sphere1.material.diffuse = "green"
-
- onEntered: sphere1.material.ambient = "blue"
- onExited: sphere1.material.ambient = "green"
-
- onClicked: console.log("Clicked Sphere 1")
- }
-
- components: [sphereMesh, material, transform, objectPicker]
- }
-
- Entity {
- id: sphere2
-
- property Material material: PhongMaterial {
- ambient: sphere2.objectPicker.containsMouse ? "blue" : "red"
- }
-
- property Transform transform: Transform {
- scale: 1.5
- }
-
- property ObjectPicker objectPicker: ObjectPicker {
- hoverEnabled: true
-
- onPressed: sphere2.material.diffuse = "white"
- onReleased: sphere2.material.diffuse = "red"
-
- onClicked: console.log("Clicked Sphere 2")
- }
-
- components: [sphereMesh, material, transform, objectPicker]
- }
-
- Entity {
- id: sphere3
-
- property Material material: PhongMaterial {
- diffuse: "yellow"
- }
-
- property bool toggled: false
- property real scaleFactor: toggled ? 5.0 : 0.5
- QQ2.Behavior on scaleFactor { QQ2.NumberAnimation { duration: 200; easing.type: QQ2.Easing.InQuad } }
-
- property Transform transform: Transform {
- scale: sphere3.scaleFactor
- translation: Qt.vector3d(8, 0, 0)
- }
-
- property ObjectPicker objectPicker: ObjectPicker {
- hoverEnabled: false
-
- onPressed: sphere3.toggled = !sphere3.toggled
-
- onEntered: sphere3.material.ambient = "black"
- onExited: sphere3.material.ambient = "white"
-
- onClicked: console.log("Clicked Sphere 3")
- }
-
- components: [sphereMesh, material, transform, objectPicker]
- }
-}
diff --git a/examples/qt3d/picking-qml/picking-qml.pro b/examples/qt3d/picking-qml/picking-qml.pro
deleted file mode 100644
index 1954c7426..000000000
--- a/examples/qt3d/picking-qml/picking-qml.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-SOURCES += main.cpp
-
-RESOURCES += \
- picking-qml.qrc
-
-OTHER_FILES += \
- main.qml
diff --git a/examples/qt3d/picking-qml/picking-qml.qrc b/examples/qt3d/picking-qml/picking-qml.qrc
deleted file mode 100644
index 5f6483ac3..000000000
--- a/examples/qt3d/picking-qml/picking-qml.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/qt3d/planets-qml/CloudEffectDS.qml b/examples/qt3d/planets-qml/CloudEffectDS.qml
index a949e25c6..4f07559e3 100644
--- a/examples/qt3d/planets-qml/CloudEffectDS.qml
+++ b/examples/qt3d/planets-qml/CloudEffectDS.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -58,19 +72,11 @@ Effect {
minorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "Desktop" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "Desktop" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/gl3/planetD.vert")
@@ -87,20 +93,11 @@ Effect {
majorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetD.vert")
@@ -118,20 +115,11 @@ Effect {
minorVersion: 0
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetD.vert")
diff --git a/examples/qt3d/planets-qml/FpsDisplay.qml b/examples/qt3d/planets-qml/FpsDisplay.qml
index 6dc5d7f3a..f3a0c51aa 100644
--- a/examples/qt3d/planets-qml/FpsDisplay.qml
+++ b/examples/qt3d/planets-qml/FpsDisplay.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/planets-qml/InfoSheet.qml b/examples/qt3d/planets-qml/InfoSheet.qml
index 53aabf63e..4d03d8871 100644
--- a/examples/qt3d/planets-qml/InfoSheet.qml
+++ b/examples/qt3d/planets-qml/InfoSheet.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/planets-qml/Planet.qml b/examples/qt3d/planets-qml/Planet.qml
index 005312b5d..231cd7bac 100644
--- a/examples/qt3d/planets-qml/Planet.qml
+++ b/examples/qt3d/planets-qml/Planet.qml
@@ -1,40 +1,55 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
SphereMesh {
property real r: 0
diff --git a/examples/qt3d/planets-qml/PlanetButton.qml b/examples/qt3d/planets-qml/PlanetButton.qml
index ccd16d08d..443244478 100644
--- a/examples/qt3d/planets-qml/PlanetButton.qml
+++ b/examples/qt3d/planets-qml/PlanetButton.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/planets-qml/PlanetEffectD.qml b/examples/qt3d/planets-qml/PlanetEffectD.qml
index 1287967e4..d8660650f 100644
--- a/examples/qt3d/planets-qml/PlanetEffectD.qml
+++ b/examples/qt3d/planets-qml/PlanetEffectD.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -59,25 +73,11 @@ Effect {
minorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "Desktop" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "Desktop" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/gl3/planetD.vert")
@@ -94,25 +94,11 @@ Effect {
majorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetD.vert")
@@ -130,25 +116,11 @@ Effect {
minorVersion: 0
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetD.vert")
diff --git a/examples/qt3d/planets-qml/PlanetEffectDB.qml b/examples/qt3d/planets-qml/PlanetEffectDB.qml
index b05e8ceaa..40af57fce 100644
--- a/examples/qt3d/planets-qml/PlanetEffectDB.qml
+++ b/examples/qt3d/planets-qml/PlanetEffectDB.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -59,25 +73,11 @@ Effect {
minorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "Desktop" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "Desktop" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/gl3/planetDB.vert")
@@ -94,25 +94,11 @@ Effect {
majorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetDB.vert")
@@ -130,25 +116,11 @@ Effect {
minorVersion: 0
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetDB.vert")
diff --git a/examples/qt3d/planets-qml/PlanetEffectDSB.qml b/examples/qt3d/planets-qml/PlanetEffectDSB.qml
index 82e93edac..b9cda657a 100644
--- a/examples/qt3d/planets-qml/PlanetEffectDSB.qml
+++ b/examples/qt3d/planets-qml/PlanetEffectDSB.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -59,20 +73,11 @@ Effect {
minorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "Desktop" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "Desktop" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/gl3/planetDB.vert")
@@ -89,20 +94,11 @@ Effect {
majorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetDB.vert")
@@ -120,20 +116,11 @@ Effect {
minorVersion: 0
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetDB.vert")
diff --git a/examples/qt3d/planets-qml/PlanetFrameGraph.qml b/examples/qt3d/planets-qml/PlanetFrameGraph.qml
index cf5d0937f..cbad3a024 100644
--- a/examples/qt3d/planets-qml/PlanetFrameGraph.qml
+++ b/examples/qt3d/planets-qml/PlanetFrameGraph.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -38,7 +52,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
-FrameGraph {
+RenderSettings {
id: root
property alias viewCamera: viewCameraSelector.camera
@@ -46,60 +60,62 @@ FrameGraph {
readonly property Texture2D shadowTexture: depthTexture
activeFrameGraph: Viewport {
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- clearColor: Qt.rgba(0.0, 0.0, 0.0, 1.0)
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- TechniqueFilter {
- requires: [ Annotation { name: "name"; value: "Desktop" } ]
+ RenderSurfaceSelector {
+ TechniqueFilter {
+ matchAll: [ FilterKey { name: "name"; value: "Desktop" } ]
- RenderPassFilter {
- includes: [ Annotation { name: "pass"; value: "shadowmap" } ]
+ RenderPassFilter {
+ matchAny: [ FilterKey { name: "pass"; value: "shadowmap" } ]
- RenderTargetSelector {
- target: RenderTarget {
- attachments: [
- RenderAttachment {
- name: "depth"
- type: RenderAttachment.DepthAttachment
- texture: Texture2D {
- id: depthTexture
- width: mainview.width
- height: mainview.height
- format: Texture.D24
- generateMipMaps: false
- magnificationFilter: Texture.Linear
- minificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.ClampToEdge
- y: WrapMode.ClampToEdge
+ RenderTargetSelector {
+ target: RenderTarget {
+ attachments: [
+ RenderTargetOutput {
+ objectName: "depth"
+ attachmentPoint: RenderTargetOutput.Depth
+ texture: Texture2D {
+ id: depthTexture
+ width: mainview.width
+ height: mainview.height
+ format: Texture.D24
+ generateMipMaps: false
+ magnificationFilter: Texture.Linear
+ minificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ comparisonFunction: Texture.CompareLessEqual
+ comparisonMode: Texture.CompareRefToTexture
}
- comparisonFunction: Texture.CompareLessEqual
- comparisonMode: Texture.CompareRefToTexture
}
- }
- ]
- }
+ ]
+ }
- ClearBuffer {
- buffers: ClearBuffer.DepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.DepthBuffer
+ clearColor: Qt.rgba(0., 0., 0., 1.)
- CameraSelector {
- id: lightCameraSelector
+ CameraSelector {
+ id: lightCameraSelector
+ }
}
}
}
}
- }
- RenderPassFilter {
- includes: [ Annotation { name: "pass"; value: "forward" } ]
+ RenderPassFilter {
+ matchAny: [ FilterKey { name: "pass"; value: "forward" } ]
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
- CameraSelector {
- id: viewCameraSelector
+ CameraSelector {
+ id: viewCameraSelector
+ }
}
}
}
diff --git a/examples/qt3d/planets-qml/PlanetMaterial.qml b/examples/qt3d/planets-qml/PlanetMaterial.qml
index cdeb0b93e..ca0fa5405 100644
--- a/examples/qt3d/planets-qml/PlanetMaterial.qml
+++ b/examples/qt3d/planets-qml/PlanetMaterial.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/planets-qml/PlanetShadowEffectD.qml b/examples/qt3d/planets-qml/PlanetShadowEffectD.qml
index 1bbdf7548..05022586a 100644
--- a/examples/qt3d/planets-qml/PlanetShadowEffectD.qml
+++ b/examples/qt3d/planets-qml/PlanetShadowEffectD.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -60,11 +74,11 @@ Effect {
minorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "Desktop" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "Desktop" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name: "pass"; value: "shadowmap" } ]
+ filterKeys: [ FilterKey { name: "pass"; value: "shadowmap" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/gl3/shadowmap.vert")
@@ -72,26 +86,12 @@ Effect {
}
renderStates: [
- PolygonOffset { factor: 4; units: 4 },
- DepthTest { func: DepthTest.Less }
+ PolygonOffset { scaleFactor: 4; depthSteps: 4 },
+ DepthTest { depthFunction: DepthTest.Less }
]
},
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/gl3/planetD.vert")
@@ -108,25 +108,11 @@ Effect {
majorVersion: 2
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetD.vert")
@@ -144,25 +130,11 @@ Effect {
minorVersion: 0
}
- annotations: [ Annotation { name: "name"; value: "ES2" } ]
+ filterKeys: [ FilterKey { name: "name"; value: "ES2" } ]
renderPasses: [
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping {
- parameterName: "ambient";
- shaderVariableName: "ka";
- bindingType: ParameterMapping.Uniform
- },
- ParameterMapping {
- parameterName: "specular";
- shaderVariableName: "ks";
- bindingType: ParameterMapping.Uniform
- }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es2/planetD.vert")
diff --git a/examples/qt3d/planets-qml/PlanetsLight.qml b/examples/qt3d/planets-qml/PlanetsLight.qml
index d904d2cff..ea73fe9db 100644
--- a/examples/qt3d/planets-qml/PlanetsLight.qml
+++ b/examples/qt3d/planets-qml/PlanetsLight.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/planets-qml/PlanetsMain.qml b/examples/qt3d/planets-qml/PlanetsMain.qml
index 6505f12d2..f6e8db05b 100644
--- a/examples/qt3d/planets-qml/PlanetsMain.qml
+++ b/examples/qt3d/planets-qml/PlanetsMain.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -52,7 +66,7 @@ Item {
//! [0]
Scene3D {
anchors.fill: parent
- aspects: ["render", "logic"]
+ aspects: ["render", "logic", "input"]
focus: true
SolarSystem { id: solarsystem }
diff --git a/examples/qt3d/planets-qml/Ring.qml b/examples/qt3d/planets-qml/Ring.qml
index 7bf585805..c3d075bc1 100644
--- a/examples/qt3d/planets-qml/Ring.qml
+++ b/examples/qt3d/planets-qml/Ring.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/planets-qml/SolarSystem.qml b/examples/qt3d/planets-qml/SolarSystem.qml
index eb8611aa5..6cc8814c9 100644
--- a/examples/qt3d/planets-qml/SolarSystem.qml
+++ b/examples/qt3d/planets-qml/SolarSystem.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,7 +51,9 @@
import QtQuick 2.0 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
import Qt3D.Logic 2.0
+import Qt3D.Extras 2.0
import "planets.js" as Planets
@@ -100,8 +116,8 @@ Entity {
property real actualScale
// Animate solar system with LogicComponent
- LogicComponent {
- onFrameUpdate: {
+ FrameAction {
+ onTriggered: {
frames++
animate(focusedPlanet)
}
@@ -124,16 +140,15 @@ Entity {
viewCenter: Qt.vector3d( xLookAtOffset, yLookAtOffset, zLookAtOffset )
}
- Configuration {
- controlledCamera: camera
- }
+ FirstPersonCameraController { camera: camera }
components: [
PlanetFrameGraph {
id: framegraph
viewCamera: camera
lightCamera: light.lightCamera
- }
+ },
+ InputSettings {}
]
CloudEffectDS {
diff --git a/examples/qt3d/planets-qml/StyledSlider.qml b/examples/qt3d/planets-qml/StyledSlider.qml
index b56f4d803..6694d136e 100644
--- a/examples/qt3d/planets-qml/StyledSlider.qml
+++ b/examples/qt3d/planets-qml/StyledSlider.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/planets-qml/doc/src/planets-qml.qdoc b/examples/qt3d/planets-qml/doc/src/planets-qml.qdoc
index 9b65226e9..086a9871e 100644
--- a/examples/qt3d/planets-qml/doc/src/planets-qml.qdoc
+++ b/examples/qt3d/planets-qml/doc/src/planets-qml.qdoc
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/planets-qml/main.cpp b/examples/qt3d/planets-qml/main.cpp
index 7345e27f3..2e1199432 100644
--- a/examples/qt3d/planets-qml/main.cpp
+++ b/examples/qt3d/planets-qml/main.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -48,6 +62,7 @@ int main(int argc, char **argv)
format.setProfile(QSurfaceFormat::CoreProfile);
}
format.setDepthBufferSize(24);
+ format.setStencilBufferSize(8);
format.setSamples(4);
QQuickView view;
diff --git a/examples/qt3d/planets-qml/planets.js b/examples/qt3d/planets-qml/planets.js
index 1de683c21..0534d86ab 100644
--- a/examples/qt3d/planets-qml/planets.js
+++ b/examples/qt3d/planets-qml/planets.js
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/plasma/main.cpp b/examples/qt3d/plasma/main.cpp
deleted file mode 100644
index bfd3cfa64..000000000
--- a/examples/qt3d/plasma/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
-
- // Expose the window as a context property so we can set the aspect ratio
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/plasma/main.qml b/examples/qt3d/plasma/main.qml
deleted file mode 100644
index 96aad76f5..000000000
--- a/examples/qt3d/plasma/main.qml
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- components: FrameGraph {
- ForwardRenderer {}
- }
-
- Entity {
- components: [
- PlaneMesh {
- width: 2.0
- height: 2.0
- meshResolution: Qt.size(2, 2)
- },
-
- Transform { // Rotate the plane so that it faces us
- rotation: fromAxisAndAngle(Qt.vector3d(1.0, 0.0, 0.0), 90)
- },
-
- Material {
- parameters: Parameter { name: "winsize"; value: Qt.vector2d(_window.width, _window.height) }
-
- effect: Effect {
- techniques: Technique {
-
- graphicsApiFilter {
- minorVersion: 3
- majorVersion: 2
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- }
-
- renderPasses: RenderPass {
- shaderProgram: ShaderProgram {
- vertexShaderCode: loadSource("qrc:/plasma.vert")
- fragmentShaderCode: loadSource("qrc:/plasma.frag")
- }
- }
- }
- }
- }
- ]
- }
-}
diff --git a/examples/qt3d/plasma/plasma.pro b/examples/qt3d/plasma/plasma.pro
deleted file mode 100644
index dbd221b40..000000000
--- a/examples/qt3d/plasma/plasma.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dquick qml quick
-
-HEADERS += \
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- plasma.frag \
- plasma.vert
-
-RESOURCES += \
- plasma.qrc
diff --git a/examples/qt3d/playground-qml/AdsEffect.qml b/examples/qt3d/playground-qml/AdsEffect.qml
deleted file mode 100644
index 3e48d2b80..000000000
--- a/examples/qt3d/playground-qml/AdsEffect.qml
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-// For Qt.vector3d() and friends. For some reason this is provided by
-// QQuickValueTypeProvider in QtQuick rather than the default value
-// type provider in QtQml. So we will need to replicate this in Qt3D
-// for the types that we wish to support. Otherwise we'll have to import
-// QtQuick 2.1 all over the place.
-import QtQuick 2.1
-
-Effect {
- // TODO add another effect that uses texture for diffuse
- //property Texture2D diffuseTexture
- property vector3d ambient: Qt.vector3d( 0.1, 0.1, 0.1 )
- property vector3d diffuse: Qt.vector3d( 0.7, 0.7, 0.7 )
- property vector3d specular: Qt.vector3d( 0.2, 0.2, 0.2 )
- property real shininess: 10.0
-
- techniques: [
- Technique {
- criteria : [
- TechniqueCriterion { criterionType : TechniqueCriterion.RenderingStyle; criterionValue : "forward"}
- ]
-
- renderPasses: [
- RenderPass {
- name: "zFill"
- shaderProgram: zFillProgram
- //renderStates: [ DepthState { depthTest: true; } ]
- },
-
- RenderPass {
- name: "lighting"
- shaderProgram: adsProgram
- //renderStates: [ DepthState { depthWrites: true; depthTest: true; } ]
- }
- ]
- }
- ]
-
- ShaderProgram {
- id: zFillProgram
- objectName: "zFillProgram"
- vertexSourceFile: ":/shaders/zfill.vert"
- fragmentSourceFile: ":/shaders/zfill.frag"
- }
-
- ShaderProgram {
- id: adsProgram
- objectName: "adsProgram"
- vertexSourceFile: ":/shaders/phong.vert"
- fragmentSourceFile: ":/shaders/phong.frag"
-
-// // How to handle uniforms? Especially arrays and structs
-// uniforms: [
-// Uniform { name: "light[0].position:"; value: Qt.vector3d( 0.0, 0.0, 0.0 ) },
-// Uniform { name: "light[0].intensity:"; value: Qt.vector3d( 1.0, 1.0, 1.0 ) }
-// ]
- }
-}
diff --git a/examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml b/examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml
deleted file mode 100644
index 511c433bb..000000000
--- a/examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml
+++ /dev/null
@@ -1,270 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import QtQuick 2.2 as QQ2
-
-Material {
- id: material
-
- property color ambientColor: "#cc2200";
- property color diffuseColor: "pink"
- property bool enabled: true
- property Texture2D texture;
-
- QQ2.Timer {
- id: testTimer
- interval: 5000
- repeat: true
- running: true
- property bool even: true
- onTriggered: {
- console.log("Triggered");
- even = !even
- pointLightBlockShaderData.u.values[0].t = (even) ? null : shaderDataT
- }
- }
-
- ShaderData {
- id: shaderDataT
- property real a: testTimer.even ? 1.0 : 0.0
- property real b: 5.0
- property var r: [Qt.vector3d(1, 1, 1), Qt.vector3d(2, 2, 2), Qt.vector3d(3, 3, 3), Qt.vector3d(4, 4, 4)]
- }
-
- parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d(material.ambientColor.r, material.ambientColor.g, material.ambientColor.b) },
- Parameter { name: "lightIntensity"; value: Qt.vector3d(0.5, 0.5, 0.5)},
- Parameter { name: "texture"; value: texture},
- Parameter { name: "PointLightBlock"; value: ShaderData {
- id: pointLightBlockShaderData
- property color colorAmbient;
- property color colorDiffuse;
- property color colorSpecular;
- property real shininess: 1.0;
- property vector3d position: Qt.vector3d(1.0, 1.0, 0.0)
- property vector3d intensity: Qt.vector3d(0.7, 0.8, 0.6);
-
- property ShaderData s: ShaderData {
- property real innerV: 3.0
- property var innerVec3Array: [Qt.vector3d(1, 1, 1), Qt.vector3d(2, 2, 2), Qt.vector3d(3, 3, 3), Qt.vector3d(4, 4, 4)]
- }
-
- property ShaderDataArray u: ShaderDataArray {
- id: array
- ShaderData {
- property real innerV: 2.0
- property vector3d innerVec3
- property var innerVec3Array: [Qt.vector3d(1, 1, 1), Qt.vector3d(2, 2, 2), Qt.vector3d(3, 3, 3), Qt.vector3d(4, 4, 4)]
- property ShaderData t: shaderDataT
- property ShaderDataArray c: ShaderDataArray {
- ShaderData {
- property real a: 3.0
- property real b: 4.0
- property var r: [Qt.vector3d(1, 1, 1), Qt.vector3d(2, 2, 2), Qt.vector3d(3, 3, 3), Qt.vector3d(4, 4, 4)]
- }
- ShaderData {
- property real a: 2.0
- property real b: 3.0
- property var r: [Qt.vector3d(2, 2, 2), Qt.vector3d(1, 1, 1), Qt.vector3d(4, 4, 4), Qt.vector3d(3, 3, 3)]
- }
- }
- }
- ShaderData {
- property real innerV: 3.2
- property var innerVec3Array: [Qt.vector3d(1, 0, 1), Qt.vector3d(0, 2, 2), Qt.vector3d(3, 0, 3), Qt.vector3d(4, 0, 4)]
- property ShaderData t: ShaderData {
- property real a: 1.0
- property real b: 5.0
- property var r: [Qt.vector3d(1, 1, 1), Qt.vector3d(2, 2, 2), Qt.vector3d(3, 3, 3), Qt.vector3d(4, 4, 4)]
- }
- }
- ShaderData {
- property real innerV: 0.2
- property var innerVec3Array: [Qt.vector3d(1, 0, 1), Qt.vector3d(0, 2, 2), Qt.vector3d(3, 0, 3), Qt.vector3d(4, 0, 4)]
- }
- }
-
- QQ2.ColorAnimation on colorAmbient { from: "blue"; to: "yellow"; duration: 1000; loops: QQ2.Animation.Infinite }
- QQ2.ColorAnimation on colorDiffuse { from: "red"; to: "green"; duration: 1000; loops: QQ2.Animation.Infinite }
- QQ2.ColorAnimation on colorSpecular { from: "white"; to: "orange"; duration: 1000; loops: QQ2.Animation.Infinite }
- QQ2.NumberAnimation on shininess { from: 0; to: 1.0; duration: 1000; loops: QQ2.Animation.Infinite }
-
- } }
- ]
-
- effect : Effect {
- parameters : Parameter { name: "diffuse"; value: Qt.vector3d(material.diffuseColor.r, material.diffuseColor.g, material.diffuseColor.b)}
-
- techniques : [
- // OpenGL 3.1 Technique
- Technique {
- graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.CoreProfile; minorVersion : 1; majorVersion : 3 }
-
- annotations: [
- Annotation { name : "RenderingStyle"; value : "forward"},
- Annotation { name : "Enabled"; value: enabled }
- ]
-
- parameters : Parameter { name : "lightPos"; value : Qt.vector4d(10.0, 10.0, 0.0, 1.0)}
-
- renderPasses : [
- // COLOR PASS
- RenderPass {
- annotations: Annotation {name: "Name"; value: "ColorMaterial"}
-
- bindings: [ // Add only the bindings needed for a shader
- ParameterMapping {parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform},
- ParameterMapping {parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform},
- ParameterMapping {parameterName: "lightPos"; shaderVariableName: "lightPosition"; bindingType: ParameterMapping.Uniform},
- ParameterMapping {parameterName: "lightIntensity"; shaderVariableName: "lightIntensity"; bindingType: ParameterMapping.Uniform}
- ]
-
- shaderProgram: ShaderProgram {
- id: diffuseShader
- vertexShaderCode: loadSource("qrc:/shaders/diffuse.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/diffuse.frag")
- }
- },
- // TEXTURE PASS + UBO
- RenderPass {
- annotations : [Annotation {name : "Name"; value : "Texture" }]
- bindings: ParameterMapping {parameterName: "texture"; shaderVariableName: "tex"; bindingType: ParameterMapping.Uniform}
- renderStates : [BlendState {srcRGB: BlendState.One; dstRGB : BlendState.One},
- BlendEquation {mode: BlendEquation.FuncAdd},
- CullFace { mode : CullFace.Back },
- DepthTest { func : DepthTest.LessOrEqual}
- ]
- shaderProgram : ShaderProgram {
- vertexShaderCode: "
- #version 140
- in vec4 vertexPosition;
- in vec3 vertexNormal;
- in vec2 vertexTexCoord;
-
- out vec3 worldPosition;
- out vec3 normal;
- out vec2 texCoord;
-
- uniform mat4 modelViewProjection;
- uniform mat4 modelView;
- uniform mat3 modelViewNormal;
-
- void main()
- {
- texCoord = vertexTexCoord;
- worldPosition = vec3(modelView * vertexPosition);
- normal = normalize(modelViewNormal * vertexNormal);
- gl_Position = modelViewProjection * vertexPosition;
- }
- "
-
- fragmentShaderCode: "
- #version 140
- in vec3 worldPosition;
- in vec3 normal;
- in vec2 texCoord;
- out vec4 fragColor;
-
- struct subStruct
- {
- float a;
- float b;
- float r[4];
- };
-
- struct innerStruct
- {
- float innerV;
- vec3 innerVec3;
- vec3 innerVec3Array[4];
- subStruct t;
- subStruct c[2];
- };
-
- uniform PointLightBlock
- {
- vec4 colorAmbient;
- vec4 colorDiffuse;
- vec4 colorSpecular;
- float shininess;
- vec3 position;
- vec3 intensity;
- innerStruct s;
- innerStruct u[4];
- } lightSource;
-
- uniform sampler2D tex;
-
- void main()
- {
- vec3 n = normalize(normal);
- vec3 s = normalize(lightSource.position - worldPosition);
- vec3 v = normalize(-worldPosition);
- vec3 r = reflect(-s, n);
-
- float diffuse = max(dot(s, n), 0.0);
- float specular = step(diffuse, 0.0) * pow(max(dot(r, v), 0.0), lightSource.shininess);
-
- vec3 sum = vec3(0.0, 0.0, 0.0);
-
- for (int i = 0; i < 4; ++i) {
- sum += lightSource.s.innerVec3Array[i];
- }
-
- float tmp = 0;
-
- for (int i = 0; i < 4; ++i) {
- tmp += lightSource.u[i].innerV;
- }
-
- if (sum == vec3(10.0, 10.0, 10.0))
- fragColor = vec4(lightSource.intensity, 1.0) * (
- lightSource.colorAmbient * lightSource.s.innerV +
- lightSource.colorDiffuse * diffuse +
- lightSource.colorSpecular * specular) * 0.2 + texture(tex, texCoord);
- else
- fragColor = vec4(1.0, 1.0, 1.0, 1.0);
- }"
- }
- }
- ]
- }
- ]
- }
-}
-
diff --git a/examples/qt3d/playground-qml/ComplexTechnique.qml b/examples/qt3d/playground-qml/ComplexTechnique.qml
deleted file mode 100644
index f9d44249a..000000000
--- a/examples/qt3d/playground-qml/ComplexTechnique.qml
+++ /dev/null
@@ -1,229 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Technique {
- annotations : [
- Annotation { name : "RenderingStyle"; value : "forward"},
- Annotation { name : "Enabled"; value : true}
- ]
- graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.CoreProfile; minorVersion : 1; majorVersion : 3 }
- renderPasses : [
- RenderPass {
- annotations : [Annotation {name : "Name"; value : "TextureLighting" }]
- bindings : [ // Add only the bindings needed for a shader
- ParameterMapping {parameterName: "vertexTexCoord"; shaderVariableName: "texCoord0"; bindingType: ParameterMapping.Attribute},
- ParameterMapping {parameterName: "tex"; shaderVariableName: "texture"; bindingType: ParameterMapping.Uniform},
- ParameterMapping {parameterName: "modelViewProjection"; shaderVariableName: "customMvp"; bindingType: ParameterMapping.StandardUniform}
- ]
-
- shaderProgram : ShaderProgram {
- id : textureShaderLighting
- vertexShaderCode: "
- #version 140
- in vec4 vertexPosition;
- in vec3 vertexNormal;
- in vec2 texCoord0;
-
- out vec2 texCoord;
- out vec3 worldPosition;
- out vec3 normal;
-
- uniform mat4 customMvp;
- uniform mat4 modelView;
- uniform mat3 modelViewNormal;
-
- void main()
- {
- texCoord = texCoord0;
- worldPosition = vec3(modelView * vertexPosition);
- normal = normalize(modelViewNormal * vertexNormal);
- gl_Position = customMvp * vertexPosition;
- }"
-
- fragmentShaderCode: "
- #version 140
- in vec2 texCoord;
- in vec3 worldPosition;
- in vec3 normal;
- out vec4 fragColor;
-
- struct PointLight
- {
- vec3 position;
- vec3 direction;
- vec4 color;
- float intensity;
- };
-
- const int lightCount = 3;
- uniform PointLight pointLights[lightCount];
- uniform sampler2D texture;
-
- void main()
- {
- vec4 color;
- for (int i = 0; i < lightCount; i++) {
- vec3 s = normalize(pointLights[i].position - worldPosition);
- color += pointLights[i].color * (pointLights[i].intensity * max(dot(s, normal), 0.0));
- }
- color /= float(lightCount);
- fragColor = texture(texture, texCoord) * color;
- }"
- }
- },
- RenderPass {
- annotations : [Annotation {name : "Name"; value : "Texture" }]
- shaderProgram : ShaderProgram {
- vertexShaderCode : "
- #version 140
- in vec4 vertexPosition;
- in vec2 vertexTexCoord;
- out vec2 texCoord;
-
- uniform mat4 mvp;
-
- void main()
- {
- texCoord = vertexTexCoord;
- gl_Position = mvp * vertexPosition;
- }"
-
- fragmentShaderCode: "
- #version 140
- in vec2 texCoord;
- out vec4 fragColor;
- uniform sampler2D tex;
-
- void main()
- {
- fragColor = texture(tex, texCoord);
- }
- "
- }
- },
- RenderPass {
- annotations : [Annotation {name : "Name"; value : "Lighting" }]
- renderStates : [BlendState {srcRGB: BlendState.One; dstRGB : BlendState.One},
- BlendEquation {mode: BlendEquation.FuncAdd},
- CullFace { mode : CullFace.Back },
- DepthTest { func : DepthTest.LessOrEqual}
- ]
- shaderProgram : ShaderProgram {
- vertexShaderCode: "
- #version 140
- in vec4 vertexPosition;
- in vec3 vertexNormal;
-
- out vec3 worldPosition;
- out vec3 normal;
-
- uniform mat4 modelViewProjection;
- uniform mat4 modelView;
- uniform mat3 modelViewNormal;
-
- void main()
- {
- worldPosition = vec3(modelView * vertexPosition);
- normal = normalize(modelViewNormal * vertexNormal);
- gl_Position = modelViewProjection * vertexPosition;
- }
- "
-
- fragmentShaderCode: "
- #version 140
- in vec3 worldPosition;
- in vec3 normal;
- out vec4 fragColor;
-
- struct PointLight
- {
- vec3 position;
- vec3 direction;
- vec4 color;
- float intensity;
- };
-
- const int lightCount = 3;
- uniform PointLight pointLights[lightCount];
-
- void main()
- {
- vec4 color;
- for (int i = 0; i < lightCount; i++) {
- vec3 s = normalize(pointLights[i].position - worldPosition);
- color += pointLights[i].color * (pointLights[i].intensity * max(dot(s, normal), 0.0));
- }
- color /= float(lightCount);
- fragColor = color;
- }"
- }
- },
- RenderPass {
- annotations : Annotation {name : "Name"; value : "Final" }
- shaderProgram : ShaderProgram {
- vertexShaderCode: "
- #version 140
- in vec4 vertexPosition;
- in vec2 vertexTexCoord;
- out vec2 texCoord;
- uniform mat4 modelViewProjection;
-
- void main()
- {
- texCoord = vertexTexCoord;
- gl_Position = modelViewProjection * vertexPosition;
- }
- "
-
- fragmentShaderCode: "
- #version 140
- in vec2 texCoord;
- out vec4 fragColor;
- uniform sampler2D gBuffer;
-
- void main()
- {
- fragColor = texture(gBuffer, texCoord);
- }
- "
- }
- }
-
- ]
-}
diff --git a/examples/qt3d/playground-qml/DetailView.qml b/examples/qt3d/playground-qml/DetailView.qml
deleted file mode 100644
index d3389bbd0..000000000
--- a/examples/qt3d/playground-qml/DetailView.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- property Entity camera: Camera {
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 60
- aspectRatio: 16/9
- nearPlane: 0.001
- farPlane: 10000.0
- position: Qt.vector3d( 10.0, 10.0, -25.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 10.0 )
- }
-}
diff --git a/examples/qt3d/playground-qml/MainView.qml b/examples/qt3d/playground-qml/MainView.qml
deleted file mode 100644
index 3333c28fe..000000000
--- a/examples/qt3d/playground-qml/MainView.qml
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import QtQuick 2.0 as QQ2
-
-Entity {
-
- property Entity camera: Camera {
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane: 0.01
- farPlane: 1000.0
- position: Qt.vector3d( 10.0, 10.0, -25.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 10.0 )
- }
-
- // Shareable Components
-
- Mesh {
- id: ballMesh
- objectName: "ballMesh"
- source: "assets/ball.obj"
- }
-
- Mesh {
- id: cubeMesh
- objectName: "cubeMesh"
- source: "assets/cube.obj"
- }
-
- AnimatedDiffuseMaterial {
- id: animatedMaterial
- texture: Texture2D { TextureImage { source : "assets/gltf/wine/Wood_Cherry_Original_.jpg" } }
- }
-
- // Scene elements
-
- Entity {
- id : sceneEntity
- components : SceneLoader {
- id: scene
- source: "qrc:/assets/test_scene.dae"
- objectName: "dae_scene"
- }
- }
-
- RenderableEntity {
- mesh: ballMesh
- material: animatedMaterial
- transform: Transform {
- property real z: 25
- translation: Qt.vector3d( 0, -10, z )
- scale: 0.3
- QQ2.SequentialAnimation on z {
- running: true
- loops: QQ2.Animation.Infinite
- QQ2.NumberAnimation { to: -1000; duration: 5000 }
- QQ2.NumberAnimation { to: 1000; duration: 3000 }
- }
- }
- }
-
- RenderableEntity {
- mesh: cubeMesh
- material: animatedMaterial
- transform: Transform {
- property real x: 0
- translation: Qt.vector3d( x, -10, 25 )
- scale: 0.3
- QQ2.SequentialAnimation on x {
- running : true
- loops: QQ2.Animation.Infinite
- QQ2.NumberAnimation { to : -100; duration : 10000 }
- QQ2.NumberAnimation { to : 100; duration : 5000 }
- }
- }
- }
-}
diff --git a/examples/qt3d/playground-qml/MyForwardRenderer.qml b/examples/qt3d/playground-qml/MyForwardRenderer.qml
deleted file mode 100644
index 51e9c9cf0..000000000
--- a/examples/qt3d/playground-qml/MyForwardRenderer.qml
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-TechniqueFilter {
- id: root
-
- objectName : "techniqueFilter"
-
- // Expose the viewport rect and camera. This allows users of this
- // forward rendering framegraph to decide which camera in the
- // scene renders to a given viewport region.
- //
- // Using this as a building block for a larger framegraph would
- // allow a scene to be rendered multiple times to different
- // viewports using different cameras for e.g.
- property alias mainCamera: mainCameraSelector.camera
- property alias detailCamera: detailCameraSelector.camera
- property alias layerFilters: layerFilter.layers
- property alias clearColor: viewport.clearColor
-
- requires : [
- Annotation { name: "RenderingStyle"; value: "forward";},
- Annotation { name: "Enabled"; value: true;}
- ]
-
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
-
- // Main Viewport
- Viewport {
- id: viewport
- rect: Qt.rect(0.0, 0, 1.0, 1.0)
-
- CameraSelector {
- id: mainCameraSelector
-
- LayerFilter {
- id: layerFilter
- RenderPassFilter { includes: [
- Annotation {name : "Name"; value : "Texture"}
- ] }
- }
- }
- }
- }
-
- Viewport {
- id: detailViewport
- rect: Qt.rect(0.75, 0.0, 0.25, 0.25)
-
- CameraSelector {
- id: detailCameraSelector
- RenderPassFilter {
- includes: [ Annotation { name: "Name"; value: "ColorMaterial"; } ]
- }
- }
- }
-}
diff --git a/examples/qt3d/playground-qml/RenderableEntity.qml b/examples/qt3d/playground-qml/RenderableEntity.qml
deleted file mode 100644
index 0cb44fafe..000000000
--- a/examples/qt3d/playground-qml/RenderableEntity.qml
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- property Transform transform;
- property Mesh mesh;
- property Material material;
-
- components: [
- transform,
- mesh,
- material
- ]
-}
diff --git a/examples/qt3d/playground-qml/assets/ball.obj b/examples/qt3d/playground-qml/assets/ball.obj
deleted file mode 100644
index f54f28552..000000000
--- a/examples/qt3d/playground-qml/assets/ball.obj
+++ /dev/null
@@ -1,10149 +0,0 @@
-# Blender v2.69 (sub 0) OBJ File: ''
-# www.blender.org
-mtllib ball.mtl
-o Sphere
-v -0.490086 4.975924 0.000000
-v -0.975452 4.903926 0.000000
-v -1.451423 4.784702 0.000000
-v -1.913417 4.619398 0.000000
-v -2.356984 4.409606 0.000000
-v -2.777851 4.157348 0.000000
-v -3.171966 3.865052 0.000000
-v -3.535534 3.535534 0.000000
-v -3.865052 3.171967 0.000000
-v -4.157348 2.777852 0.000000
-v -4.619398 1.913417 0.000000
-v -4.784702 1.451423 0.000000
-v -5.000000 -0.000001 0.000000
-v -4.784701 -1.451425 0.000000
-v -4.619397 -1.913419 0.000000
-v -4.157347 -2.777853 0.000000
-v -3.865051 -3.171968 0.000000
-v -3.535532 -3.535536 0.000000
-v -3.171964 -3.865054 0.000000
-v -2.777849 -4.157350 0.000000
-v -2.356981 -4.409608 0.000000
-v -1.913414 -4.619399 0.000000
-v -1.451420 -4.784703 0.000000
-v -0.975448 -4.903927 0.000000
-v -0.490082 -4.975924 0.000000
-v 0.000004 -5.000000 0.000000
-v -0.487726 4.975924 -0.048037
-v -0.970755 4.903926 -0.095611
-v -1.444434 4.784702 -0.142265
-v -1.904204 4.619398 -0.187548
-v -2.345634 4.409606 -0.231025
-v -2.764475 4.157348 -0.272277
-v -3.156693 3.865052 -0.310907
-v -3.518509 3.535534 -0.346543
-v -3.846441 3.171967 -0.378842
-v -4.137330 2.777852 -0.407492
-v -4.388373 2.356984 -0.432217
-v -4.597154 1.913417 -0.452781
-v -4.761662 1.451423 -0.468983
-v -4.880312 0.975451 -0.480669
-v -4.951963 0.490085 -0.487726
-v -4.975924 -0.000001 -0.490086
-v -4.951963 -0.490087 -0.487726
-v -4.880312 -0.975453 -0.480669
-v -4.761662 -1.451425 -0.468983
-v -4.597154 -1.913419 -0.452780
-v -4.388371 -2.356985 -0.432217
-v -4.137328 -2.777853 -0.407492
-v -3.846440 -3.171968 -0.378842
-v -3.518508 -3.535536 -0.346543
-v -3.156690 -3.865054 -0.310907
-v -2.764472 -4.157350 -0.272277
-v -2.345632 -4.409608 -0.231025
-v -1.904201 -4.619399 -0.187548
-v -1.444431 -4.784703 -0.142264
-v -0.970751 -4.903927 -0.095611
-v -0.487722 -4.975924 -0.048037
-v -0.480669 4.975924 -0.095612
-v -0.956708 4.903926 -0.190302
-v -1.423535 4.784702 -0.283159
-v -1.876652 4.619398 -0.373290
-v -2.311695 4.409606 -0.459825
-v -2.724475 4.157348 -0.541933
-v -3.111018 3.865052 -0.618821
-v -3.467600 3.535534 -0.689749
-v -3.790786 3.171967 -0.754035
-v -4.077466 2.777852 -0.811059
-v -4.324877 2.356984 -0.860272
-v -4.530637 1.913417 -0.901201
-v -4.692765 1.451423 -0.933450
-v -4.809699 0.975451 -0.956709
-v -4.880312 0.490085 -0.970755
-v -4.903926 -0.000001 -0.975452
-v -4.880312 -0.490087 -0.970755
-v -4.809699 -0.975453 -0.956709
-v -4.692764 -1.451425 -0.933450
-v -4.530637 -1.913419 -0.901200
-v -4.324876 -2.356985 -0.860272
-v -4.077465 -2.777853 -0.811059
-v -3.790785 -3.171968 -0.754035
-v -3.467598 -3.535536 -0.689749
-v -3.111016 -3.865054 -0.618820
-v -2.724473 -4.157350 -0.541932
-v -2.311692 -4.409608 -0.459825
-v -1.876648 -4.619399 -0.373289
-v -1.423531 -4.784703 -0.283159
-v -0.956705 -4.903927 -0.190301
-v -0.480665 -4.975924 -0.095611
-v -0.468983 4.975924 -0.142266
-v -0.933449 4.903926 -0.283160
-v -1.388925 4.784702 -0.421327
-v -1.831026 4.619398 -0.555437
-v -2.255492 4.409606 -0.684197
-v -2.658237 4.157348 -0.806369
-v -3.035383 3.865052 -0.920774
-v -3.383295 3.535534 -1.026312
-v -3.698624 3.171967 -1.121967
-v -3.978334 2.777852 -1.206816
-v -4.219730 2.356984 -1.280042
-v -4.420488 1.913417 -1.340942
-v -4.578674 1.451423 -1.388927
-v -4.692765 0.975451 -1.423536
-v -4.761662 0.490085 -1.444435
-v -4.784701 -0.000001 -1.451424
-v -4.761662 -0.490087 -1.444435
-v -4.692765 -0.975453 -1.423536
-v -4.578673 -1.451425 -1.388927
-v -4.420487 -1.913419 -1.340941
-v -4.219729 -2.356985 -1.280042
-v -3.978333 -2.777853 -1.206815
-v -3.698623 -3.171968 -1.121966
-v -3.383294 -3.535536 -1.026312
-v -3.035380 -3.865054 -0.920774
-v -2.658235 -4.157350 -0.806368
-v -2.255490 -4.409608 -0.684197
-v -1.831023 -4.619399 -0.555436
-v -1.388922 -4.784703 -0.421326
-v -0.933445 -4.903927 -0.283159
-v -0.468979 -4.975924 -0.142264
-v -0.452780 4.975924 -0.187549
-v -0.901199 4.903926 -0.373291
-v -1.340940 4.784702 -0.555437
-v -1.767767 4.619398 -0.732235
-v -2.177568 4.409606 -0.901980
-v -2.566399 4.157348 -1.063039
-v -2.930515 3.865052 -1.213860
-v -3.266407 3.535534 -1.352992
-v -3.570842 3.171967 -1.479093
-v -3.840889 2.777852 -1.590950
-v -4.073946 2.356984 -1.687485
-v -4.267766 1.913417 -1.767769
-v -4.420488 1.451423 -1.831028
-v -4.530637 0.975451 -1.876653
-v -4.597154 0.490085 -1.904205
-v -4.619397 -0.000001 -1.913419
-v -4.597154 -0.490087 -1.904205
-v -4.530637 -0.975453 -1.876653
-v -4.420487 -1.451425 -1.831027
-v -4.267766 -1.913419 -1.767768
-v -4.073944 -2.356985 -1.687484
-v -3.840888 -2.777853 -1.590949
-v -3.570841 -3.171968 -1.479092
-v -3.266406 -3.535536 -1.352991
-v -2.930512 -3.865054 -1.213860
-v -2.566397 -4.157350 -1.063038
-v -2.177566 -4.409608 -0.901979
-v -1.767764 -4.619399 -0.732234
-v -1.340937 -4.784703 -0.555436
-v -0.901196 -4.903927 -0.373289
-v -0.452776 -4.975924 -0.187548
-v -0.432217 4.975924 -0.231027
-v -0.860271 4.903926 -0.459827
-v -1.280041 4.784702 -0.684198
-v -1.687483 4.619398 -0.901981
-v -2.078673 4.409606 -1.111076
-v -2.449845 4.157348 -1.309472
-v -2.797424 3.865052 -1.495256
-v -3.118062 3.535534 -1.666641
-v -3.408671 3.171967 -1.821975
-v -3.666454 2.777852 -1.959762
-v -3.888926 2.356984 -2.078676
-v -4.073944 1.913417 -2.177571
-v -4.219730 1.451423 -2.255495
-v -4.324876 0.975451 -2.311697
-v -4.388372 0.490085 -2.345636
-v -4.409606 -0.000001 -2.356985
-v -4.388372 -0.490087 -2.345636
-v -4.324876 -0.975453 -2.311697
-v -4.219729 -1.451425 -2.255494
-v -4.073944 -1.913419 -2.177571
-v -3.888925 -2.356985 -2.078676
-v -3.666452 -2.777853 -1.959762
-v -3.408670 -3.171968 -1.821974
-v -3.118061 -3.535536 -1.666640
-v -2.797422 -3.865054 -1.495255
-v -2.449843 -4.157350 -1.309471
-v -2.078671 -4.409608 -1.111075
-v -1.687480 -4.619399 -0.901979
-v -1.280038 -4.784703 -0.684197
-v -0.860268 -4.903927 -0.459825
-v -0.432213 -4.975924 -0.231025
-v -0.407491 4.975924 -0.272279
-v -0.811058 4.903926 -0.541934
-v -1.206814 4.784702 -0.806370
-v -1.590948 4.619398 -1.063040
-v -1.959760 4.409606 -1.309472
-v -2.309698 4.157348 -1.543293
-v -2.637393 3.865052 -1.762252
-v -2.939688 3.535534 -1.964240
-v -3.213673 3.171967 -2.147310
-v -3.456708 2.777852 -2.309701
-v -3.666454 2.356984 -2.449849
-v -3.840888 1.913417 -2.566402
-v -3.978334 1.451423 -2.658240
-v -4.077465 0.975451 -2.724478
-v -4.137329 0.490085 -2.764477
-v -4.157347 -0.000001 -2.777853
-v -4.137329 -0.490087 -2.764477
-v -4.077465 -0.975453 -2.724478
-v -3.978333 -1.451425 -2.658240
-v -3.840887 -1.913419 -2.566402
-v -3.666452 -2.356985 -2.449848
-v -3.456707 -2.777853 -2.309700
-v -3.213672 -3.171968 -2.147309
-v -2.939687 -3.535536 -1.964239
-v -2.637391 -3.865054 -1.762251
-v -2.309696 -4.157350 -1.543292
-v -1.959757 -4.409608 -1.309471
-v -1.590945 -4.619399 -1.063038
-v -1.206811 -4.784703 -0.806368
-v -0.811055 -4.903927 -0.541932
-v -0.407487 -4.975924 -0.272277
-v -0.378840 4.975924 -0.310910
-v -0.754033 4.903926 -0.618823
-v -1.121965 4.784702 -0.920776
-v -1.479091 4.619398 -1.213862
-v -1.821972 4.409606 -1.495257
-v -2.147307 4.157348 -1.762252
-v -2.451962 3.865052 -2.012276
-v -2.733004 3.535534 -2.242922
-v -2.987725 3.171967 -2.451966
-v -3.213673 2.777852 -2.637397
-v -3.408672 2.356984 -2.797428
-v -3.570842 1.913417 -2.930518
-v -3.698624 1.451423 -3.035385
-v -3.790785 0.975451 -3.111020
-v -3.846441 0.490085 -3.156695
-v -3.865051 -0.000001 -3.171969
-v -3.846441 -0.490087 -3.156695
-v -3.790785 -0.975453 -3.111020
-v -3.698623 -1.451425 -3.035385
-v -3.570841 -1.913419 -2.930517
-v -3.408670 -2.356985 -2.797427
-v -3.213672 -2.777853 -2.637396
-v -2.987724 -3.171968 -2.451965
-v -2.733003 -3.535536 -2.242921
-v -2.451961 -3.865054 -2.012275
-v -2.147305 -4.157350 -1.762251
-v -1.821970 -4.409608 -1.495255
-v -1.479088 -4.619399 -1.213860
-v -1.121962 -4.784703 -0.920774
-v -0.754031 -4.903927 -0.618820
-v -0.378837 -4.975924 -0.310907
-v -0.346542 4.975924 -0.346546
-v -0.689747 4.903926 -0.689751
-v -1.026310 4.784702 -1.026314
-v -1.352989 4.619398 -1.352993
-v -1.666638 4.409606 -1.666642
-v -1.964236 4.157348 -1.964240
-v -2.242918 3.865052 -2.242922
-v -2.499999 3.535534 -2.500003
-v -2.733003 3.171967 -2.733007
-v -2.939688 2.777852 -2.939692
-v -3.118062 2.356984 -3.118066
-v -3.266406 1.913417 -3.266411
-v -3.383294 1.451423 -3.383298
-v -3.467598 0.975451 -3.467602
-v -3.518509 0.490085 -3.518513
-v -3.535533 -0.000001 -3.535537
-v -3.518509 -0.490087 -3.518513
-v -3.467598 -0.975453 -3.467602
-v -3.383294 -1.451425 -3.383298
-v -3.266406 -1.913419 -3.266410
-v -3.118061 -2.356985 -3.118065
-v -2.939687 -2.777853 -2.939692
-v -2.733003 -3.171968 -2.733006
-v -2.499998 -3.535536 -2.500002
-v -2.242916 -3.865054 -2.242920
-v -1.964234 -4.157350 -1.964238
-v -1.666636 -4.409608 -1.666640
-v -1.352987 -4.619399 -1.352991
-v -1.026308 -4.784703 -1.026312
-v -0.689745 -4.903927 -0.689749
-v -0.346539 -4.975924 -0.346543
-v -0.310906 4.975924 -0.378844
-v -0.618818 4.903926 -0.754037
-v -0.920772 4.784702 -1.121969
-v -1.213858 4.619398 -1.479095
-v -1.495253 4.409606 -1.821976
-v -1.762249 4.157348 -2.147311
-v -2.012273 3.865052 -2.451966
-v -2.242918 3.535534 -2.733008
-v -2.451962 3.171967 -2.987729
-v -2.637393 2.777852 -3.213677
-v -2.797424 2.356984 -3.408676
-v -2.930513 1.913417 -3.570846
-v -3.035382 1.451423 -3.698628
-v -3.111016 0.975451 -3.790790
-v -3.156692 0.490085 -3.846445
-v -3.171965 -0.000001 -3.865056
-v -3.156692 -0.490087 -3.846445
-v -3.111016 -0.975453 -3.790790
-v -3.035381 -1.451425 -3.698627
-v -2.930513 -1.913419 -3.570846
-v -2.797423 -2.356985 -3.408675
-v -2.637392 -2.777853 -3.213676
-v -2.451961 -3.171968 -2.987728
-v -2.242917 -3.535536 -2.733007
-v -2.012271 -3.865054 -2.451965
-v -1.762247 -4.157350 -2.147309
-v -1.495251 -4.409608 -1.821974
-v -1.213856 -4.619399 -1.479092
-v -0.920770 -4.784703 -1.121966
-v -0.618816 -4.903927 -0.754035
-v -0.310903 -4.975924 -0.378841
-v -0.272275 4.975924 -0.407495
-v -0.541930 4.903926 -0.811062
-v -0.806366 4.784702 -1.206818
-v -1.063036 4.619398 -1.590952
-v -1.309468 4.409606 -1.959763
-v -1.543290 4.157348 -2.309702
-v -1.762248 3.865052 -2.637397
-v -1.964236 3.535534 -2.939692
-v -2.147306 3.171967 -3.213677
-v -2.309697 2.777852 -3.456712
-v -2.449845 2.356984 -3.666458
-v -2.566398 1.913417 -3.840893
-v -2.658237 1.451423 -3.978338
-v -2.724473 0.975451 -4.077469
-v -2.764474 0.490085 -4.137333
-v -2.777850 -0.000001 -4.157351
-v -2.764474 -0.490087 -4.137333
-v -2.724473 -0.975453 -4.077469
-v -2.658236 -1.451425 -3.978337
-v -2.566397 -1.913419 -3.840892
-v -2.449844 -2.356985 -3.666457
-v -2.309697 -2.777853 -3.456712
-v -2.147305 -3.171968 -3.213676
-v -1.964235 -3.535536 -2.939691
-v -1.762247 -3.865054 -2.637395
-v -1.543288 -4.157350 -2.309700
-v -1.309467 -4.409608 -1.959761
-v -1.063034 -4.619399 -1.590949
-v -0.806364 -4.784703 -1.206815
-v -0.541928 -4.903927 -0.811059
-v -0.272273 -4.975924 -0.407491
-v -0.231023 4.975924 -0.432220
-v -0.459823 4.903926 -0.860275
-v -0.684194 4.784702 -1.280045
-v -0.901977 4.619398 -1.687487
-v -1.111072 4.409606 -2.078677
-v -1.309468 4.157348 -2.449849
-v -1.495252 3.865052 -2.797428
-v -1.666637 3.535534 -3.118066
-v -1.821971 3.171967 -3.408675
-v -1.959758 2.777852 -3.666458
-v -2.078672 2.356984 -3.888930
-v -2.177567 1.913417 -4.073949
-v -2.255491 1.451423 -4.219734
-v -2.311692 0.975451 -4.324881
-v -2.345633 0.490085 -4.388378
-v -2.356982 -0.000001 -4.409610
-v -2.345633 -0.490087 -4.388378
-v -2.311692 -0.975453 -4.324881
-v -2.255491 -1.451425 -4.219734
-v -2.177566 -1.913419 -4.073948
-v -2.078671 -2.356985 -3.888929
-v -1.959758 -2.777853 -3.666457
-v -1.821970 -3.171968 -3.408674
-v -1.666636 -3.535536 -3.118065
-v -1.495251 -3.865054 -2.797426
-v -1.309467 -4.157350 -2.449847
-v -1.111071 -4.409608 -2.078675
-v -0.901975 -4.619399 -1.687484
-v -0.684193 -4.784703 -1.280042
-v -0.459821 -4.903927 -0.860272
-v -0.231021 -4.975924 -0.432217
-v -0.187545 4.975924 -0.452784
-v -0.373287 4.903926 -0.901204
-v -0.555433 4.784702 -1.340944
-v -0.732231 4.619398 -1.767771
-v -0.901976 4.409606 -2.177572
-v -1.063035 4.157348 -2.566403
-v -1.213857 3.865052 -2.930518
-v -1.352988 3.535534 -3.266411
-v -1.479089 3.171967 -3.570847
-v -1.590946 2.777852 -3.840893
-v -1.687481 2.356984 -4.073950
-v -1.767764 1.913417 -4.267771
-v -1.831024 1.451423 -4.420493
-v -1.876648 0.975451 -4.530641
-v -1.904202 0.490085 -4.597159
-v -1.913415 -0.000001 -4.619402
-v -1.904202 -0.490087 -4.597159
-v -1.876648 -0.975453 -4.530641
-v -1.831023 -1.451425 -4.420492
-v -1.767764 -1.913419 -4.267771
-v -1.687480 -2.356985 -4.073948
-v -1.590945 -2.777853 -3.840892
-v -1.479088 -3.171968 -3.570845
-v -1.352987 -3.535536 -3.266410
-v -1.213856 -3.865054 -2.930517
-v -1.063034 -4.157350 -2.566401
-v -0.901975 -4.409608 -2.177570
-v -0.732230 -4.619399 -1.767768
-v -0.555432 -4.784703 -1.340941
-v -0.373285 -4.903927 -0.901200
-v -0.187544 -4.975924 -0.452780
-v -0.142261 4.975924 -0.468986
-v -0.283156 4.903926 -0.933453
-v -0.421323 4.784702 -1.388929
-v -0.555433 4.619398 -1.831030
-v -0.684194 4.409606 -2.255496
-v -0.806365 4.157348 -2.658242
-v -0.920770 3.865052 -3.035386
-v -1.026308 3.535534 -3.383299
-v -1.121962 3.171967 -3.698629
-v -1.206812 2.777852 -3.978338
-v -1.280039 2.356984 -4.219735
-v -1.340937 1.913417 -4.420492
-v -1.388923 1.451423 -4.578679
-v -1.423531 0.975451 -4.692769
-v -1.444432 0.490085 -4.761668
-v -1.451421 -0.000001 -4.784707
-v -1.444432 -0.490087 -4.761668
-v -1.423531 -0.975453 -4.692769
-v -1.388923 -1.451425 -4.578678
-v -1.340937 -1.913419 -4.420492
-v -1.280038 -2.356985 -4.219734
-v -1.206811 -2.777853 -3.978338
-v -1.121962 -3.171968 -3.698627
-v -1.026308 -3.535536 -3.383298
-v -0.920770 -3.865054 -3.035385
-v -0.806364 -4.157350 -2.658240
-v -0.684193 -4.409608 -2.255494
-v -0.555432 -4.619399 -1.831027
-v -0.421322 -4.784703 -1.388927
-v -0.283155 -4.903927 -0.933450
-v -0.142260 -4.975924 -0.468983
-v -0.095608 4.975924 -0.480673
-v -0.190298 4.903926 -0.956713
-v -0.283156 4.784702 -1.423539
-v -0.373286 4.619398 -1.876655
-v -0.459822 4.409606 -2.311698
-v -0.541929 4.157348 -2.724479
-v -0.618817 3.865052 -3.111022
-v -0.689745 3.535534 -3.467604
-v -0.754031 3.171967 -3.790791
-v -0.811055 2.777852 -4.077470
-v -0.860269 2.356984 -4.324883
-v -0.901196 1.913417 -4.530642
-v -0.933446 1.451423 -4.692770
-v -0.956705 0.975451 -4.809703
-v -0.970751 0.490085 -4.880319
-v -0.975448 -0.000001 -4.903931
-v -0.970751 -0.490087 -4.880319
-v -0.956705 -0.975453 -4.809703
-v -0.933446 -1.451425 -4.692770
-v -0.901196 -1.913419 -4.530641
-v -0.860268 -2.356985 -4.324881
-v -0.811055 -2.777853 -4.077469
-v -0.754031 -3.171968 -3.790790
-v -0.689745 -3.535536 -3.467602
-v -0.618816 -3.865054 -3.111020
-v -0.541928 -4.157350 -2.724477
-v -0.459821 -4.409608 -2.311696
-v -0.373285 -4.619399 -1.876652
-v -0.283155 -4.784703 -1.423536
-v -0.190297 -4.903927 -0.956709
-v -0.095607 -4.975924 -0.480669
-v -0.048033 4.975924 -0.487730
-v -0.095607 4.903926 -0.970759
-v -0.142261 4.784702 -1.444438
-v -0.187544 4.619398 -1.904207
-v -0.231021 4.409606 -2.345638
-v -0.272273 4.157348 -2.764479
-v -0.310904 3.865052 -3.156696
-v -0.346539 3.535534 -3.518514
-v -0.378837 3.171967 -3.846445
-v -0.407488 2.777852 -4.137334
-v -0.432213 2.356984 -4.388379
-v -0.452776 1.913417 -4.597158
-v -0.468979 1.451423 -4.761667
-v -0.480665 0.975451 -4.880317
-v -0.487722 0.490085 -4.951970
-v -0.490082 -0.000001 -4.975928
-v -0.487722 -0.490087 -4.951970
-v -0.480665 -0.975453 -4.880317
-v -0.468979 -1.451425 -4.761667
-v -0.452776 -1.913419 -4.597158
-v -0.432213 -2.356985 -4.388377
-v -0.407488 -2.777853 -4.137333
-v -0.378837 -3.171968 -3.846444
-v -0.346539 -3.535536 -3.518512
-v -0.310903 -3.865054 -3.156695
-v -0.272273 -4.157350 -2.764477
-v -0.231021 -4.409608 -2.345636
-v -0.187544 -4.619399 -1.904204
-v -0.142261 -4.784703 -1.444435
-v -0.095607 -4.903927 -0.970755
-v -0.048033 -4.975924 -0.487726
-v 0.000004 4.975924 -0.490090
-v 0.000004 4.903926 -0.975456
-v 0.000004 4.784702 -1.451427
-v 0.000004 4.619398 -1.913421
-v 0.000004 4.409606 -2.356987
-v 0.000004 4.157348 -2.777855
-v 0.000004 3.865052 -3.171970
-v 0.000004 3.535534 -3.535538
-v 0.000005 3.171967 -3.865057
-v 0.000004 2.777852 -4.157353
-v 0.000004 2.356984 -4.409612
-v 0.000005 1.913417 -4.619402
-v 0.000004 1.451423 -4.784707
-v 0.000005 0.975451 -4.903931
-v 0.000004 0.490085 -4.975930
-v 0.000004 -0.000001 -5.000005
-v 0.000004 -0.490087 -4.975930
-v 0.000005 -0.975453 -4.903931
-v 0.000004 -1.451425 -4.784707
-v 0.000005 -1.913419 -4.619401
-v 0.000004 -2.356985 -4.409611
-v 0.000004 -2.777853 -4.157352
-v 0.000004 -3.171968 -3.865055
-v 0.000004 -3.535536 -3.535537
-v 0.000004 -3.865054 -3.171969
-v 0.000004 -4.157350 -2.777853
-v 0.000004 -4.409608 -2.356985
-v 0.000004 -4.619399 -1.913418
-v 0.000004 -4.784703 -1.451424
-v 0.000004 -4.903927 -0.975452
-v 0.000004 -4.975924 -0.490086
-v 0.048041 4.975924 -0.487730
-v 0.095616 4.903926 -0.970759
-v 0.142269 4.784702 -1.444438
-v 0.187552 4.619398 -1.904207
-v 0.231029 4.409606 -2.345638
-v 0.272281 4.157348 -2.764479
-v 0.310911 3.865052 -3.156697
-v 0.346547 3.535534 -3.518514
-v 0.378846 3.171967 -3.846445
-v 0.407496 2.777852 -4.137334
-v 0.432222 2.356984 -4.388379
-v 0.452785 1.913417 -4.597158
-v 0.468987 1.451423 -4.761667
-v 0.480674 0.975451 -4.880317
-v 0.487731 0.490085 -4.951970
-v 0.490090 -0.000001 -4.975928
-v 0.487731 -0.490087 -4.951970
-v 0.480674 -0.975453 -4.880317
-v 0.468988 -1.451425 -4.761667
-v 0.452785 -1.913419 -4.597158
-v 0.432222 -2.356985 -4.388377
-v 0.407496 -2.777853 -4.137333
-v 0.378846 -3.171968 -3.846444
-v 0.346548 -3.535536 -3.518512
-v 0.310912 -3.865054 -3.156695
-v 0.272282 -4.157350 -2.764477
-v 0.231029 -4.409608 -2.345636
-v 0.187552 -4.619399 -1.904204
-v 0.142268 -4.784703 -1.444435
-v 0.095615 -4.903927 -0.970755
-v 0.048041 -4.975924 -0.487726
-v 0.095616 4.975924 -0.480673
-v 0.190306 4.903926 -0.956713
-v 0.283163 4.784702 -1.423538
-v 0.373294 4.619398 -1.876655
-v 0.459829 4.409606 -2.311699
-v 0.541937 4.157348 -2.724479
-v 0.618825 3.865052 -3.111022
-v 0.689753 3.535534 -3.467604
-v 0.754040 3.171967 -3.790790
-v 0.811063 2.777852 -4.077470
-v 0.860277 2.356984 -4.324883
-v 0.901205 1.913417 -4.530642
-v 0.933454 1.451423 -4.692770
-v 0.956714 0.975451 -4.809703
-v 0.970760 0.490085 -4.880319
-v 0.975457 -0.000001 -4.903931
-v 0.970760 -0.490087 -4.880319
-v 0.956714 -0.975453 -4.809703
-v 0.933454 -1.451425 -4.692770
-v 0.901205 -1.913419 -4.530641
-v 0.860277 -2.356985 -4.324882
-v 0.811063 -2.777853 -4.077470
-v 0.754039 -3.171968 -3.790789
-v 0.689753 -3.535536 -3.467602
-v 0.618825 -3.865054 -3.111021
-v 0.541937 -4.157350 -2.724477
-v 0.459829 -4.409608 -2.311697
-v 0.373293 -4.619399 -1.876652
-v 0.283163 -4.784703 -1.423535
-v 0.190305 -4.903927 -0.956709
-v 0.095615 -4.975924 -0.480669
-v 0.142269 4.975924 -0.468986
-v 0.283164 4.903926 -0.933453
-v 0.421331 4.784702 -1.388929
-v 0.555440 4.619398 -1.831030
-v 0.684201 4.409606 -2.255497
-v 0.806373 4.157348 -2.658242
-v 0.920778 3.865052 -3.035387
-v 1.026317 3.535534 -3.383299
-v 1.121971 3.171967 -3.698628
-v 1.206820 2.777852 -3.978338
-v 1.280047 2.356984 -4.219736
-v 1.340946 1.913417 -4.420492
-v 1.388931 1.451423 -4.578679
-v 1.423541 0.975451 -4.692770
-v 1.444441 0.490085 -4.761669
-v 1.451429 -0.000001 -4.784706
-v 1.444441 -0.490087 -4.761669
-v 1.423541 -0.975453 -4.692770
-v 1.388931 -1.451425 -4.578679
-v 1.340946 -1.913419 -4.420492
-v 1.280047 -2.356985 -4.219735
-v 1.206820 -2.777853 -3.978338
-v 1.121971 -3.171968 -3.698627
-v 1.026316 -3.535536 -3.383298
-v 0.920778 -3.865054 -3.035385
-v 0.806372 -4.157350 -2.658239
-v 0.684201 -4.409608 -2.255495
-v 0.555440 -4.619399 -1.831027
-v 0.421330 -4.784703 -1.388926
-v 0.283163 -4.903927 -0.933450
-v 0.142268 -4.975924 -0.468983
-v 0.187553 4.975924 -0.452784
-v 0.373295 4.903926 -0.901204
-v 0.555441 4.784702 -1.340944
-v 0.732238 4.619398 -1.767770
-v 0.901984 4.409606 -2.177573
-v 1.063043 4.157348 -2.566403
-v 1.213864 3.865052 -2.930519
-v 1.352996 3.535534 -3.266412
-v 1.479097 3.171967 -3.570846
-v 1.590954 2.777852 -3.840893
-v 1.687490 2.356984 -4.073951
-v 1.767773 1.913417 -4.267771
-v 1.831032 1.451423 -4.420493
-v 1.876658 0.975451 -4.530642
-v 1.904210 0.490085 -4.597160
-v 1.913423 -0.000001 -4.619402
-v 1.904210 -0.490087 -4.597160
-v 1.876658 -0.975453 -4.530642
-v 1.831032 -1.451425 -4.420493
-v 1.767773 -1.913419 -4.267770
-v 1.687489 -2.356985 -4.073950
-v 1.590954 -2.777853 -3.840893
-v 1.479097 -3.171968 -3.570845
-v 1.352996 -3.535536 -3.266410
-v 1.213864 -3.865054 -2.930517
-v 1.063043 -4.157350 -2.566401
-v 0.901983 -4.409608 -2.177571
-v 0.732237 -4.619399 -1.767767
-v 0.555440 -4.784703 -1.340941
-v 0.373293 -4.903927 -0.901200
-v 0.187552 -4.975924 -0.452780
-v 0.231031 4.975924 -0.432220
-v 0.459831 4.903926 -0.860275
-v 0.684202 4.784702 -1.280044
-v 0.901984 4.619398 -1.687487
-v 1.111080 4.409606 -2.078678
-v 1.309476 4.157348 -2.449849
-v 1.495260 3.865052 -2.797428
-v 1.666645 3.535534 -3.118067
-v 1.821979 3.171967 -3.408675
-v 1.959767 2.777852 -3.666458
-v 2.078681 2.356984 -3.888932
-v 2.177576 1.913417 -4.073948
-v 2.255499 1.451423 -4.219735
-v 2.311702 0.975451 -4.324881
-v 2.345642 0.490085 -4.388379
-v 2.356990 -0.000001 -4.409611
-v 2.345642 -0.490087 -4.388379
-v 2.311702 -0.975453 -4.324881
-v 2.255499 -1.451425 -4.219735
-v 2.177575 -1.913419 -4.073948
-v 2.078680 -2.356985 -3.888930
-v 1.959766 -2.777853 -3.666457
-v 1.821979 -3.171968 -3.408674
-v 1.666645 -3.535536 -3.118065
-v 1.495260 -3.865054 -2.797427
-v 1.309475 -4.157350 -2.449847
-v 1.111079 -4.409608 -2.078676
-v 0.901983 -4.619399 -1.687484
-v 0.684201 -4.784703 -1.280042
-v 0.459829 -4.903927 -0.860272
-v 0.231029 -4.975924 -0.432217
-v 0.272283 4.975924 -0.407495
-v 0.541938 4.903926 -0.811062
-v 0.806373 4.784702 -1.206818
-v 1.063043 4.619398 -1.590951
-v 1.309476 4.409606 -1.959764
-v 1.543298 4.157348 -2.309702
-v 1.762256 3.865052 -2.637397
-v 1.964244 3.535534 -2.939693
-v 2.147315 3.171967 -3.213677
-v 2.309705 2.777852 -3.456712
-v 2.449853 2.356984 -3.666460
-v 2.566407 1.913417 -3.840892
-v 2.658245 1.451423 -3.978339
-v 2.724483 0.975451 -4.077470
-v 2.764483 0.490085 -4.137335
-v 2.777858 -0.000001 -4.157352
-v 2.764483 -0.490087 -4.137335
-v 2.724483 -0.975453 -4.077470
-v 2.658245 -1.451425 -3.978338
-v 2.566406 -1.913419 -3.840892
-v 2.449852 -2.356985 -3.666458
-v 2.309705 -2.777853 -3.456712
-v 2.147314 -3.171968 -3.213676
-v 1.964243 -3.535536 -2.939692
-v 1.762256 -3.865054 -2.637396
-v 1.543297 -4.157350 -2.309700
-v 1.309475 -4.409608 -1.959762
-v 1.063042 -4.619399 -1.590949
-v 0.806372 -4.784703 -1.206815
-v 0.541936 -4.903927 -0.811059
-v 0.272281 -4.975924 -0.407491
-v 0.310914 4.975924 -0.378844
-v 0.618827 4.903926 -0.754037
-v 0.920779 4.784702 -1.121968
-v 1.213865 4.619398 -1.479094
-v 1.495261 4.409606 -1.821976
-v 1.762257 4.157348 -2.147311
-v 2.012280 3.865052 -2.451967
-v 2.242926 3.535534 -2.733008
-v 2.451970 3.171967 -2.987729
-v 2.637401 2.777852 -3.213677
-v 2.797432 2.356984 -3.408677
-v 2.930522 1.913417 -3.570846
-v 3.035390 1.451423 -3.698629
-v 3.111025 0.975451 -3.790790
-v 3.156701 0.490085 -3.846447
-v 3.171973 -0.000001 -3.865056
-v 3.156701 -0.490087 -3.846447
-v 3.111025 -0.975453 -3.790790
-v 3.035390 -1.451425 -3.698628
-v 2.930522 -1.913419 -3.570845
-v 2.797431 -2.356985 -3.408676
-v 2.637400 -2.777853 -3.213677
-v 2.451969 -3.171968 -2.987728
-v 2.242925 -3.535536 -2.733007
-v 2.012280 -3.865054 -2.451965
-v 1.762255 -4.157350 -2.147310
-v 1.495260 -4.409608 -1.821975
-v 1.213863 -4.619399 -1.479092
-v 0.920778 -4.784703 -1.121966
-v 0.618824 -4.903927 -0.754035
-v 0.310911 -4.975924 -0.378841
-v 0.346550 4.975924 -0.346546
-v 0.689755 4.903926 -0.689751
-v 1.026318 4.784702 -1.026314
-v 1.352996 4.619398 -1.352993
-v 1.666646 4.409606 -1.666642
-v 1.964244 4.157348 -1.964240
-v 2.242925 3.865052 -2.242922
-v 2.500007 3.535534 -2.500004
-v 2.733012 3.171967 -2.733008
-v 2.939696 2.777852 -2.939692
-v 3.118071 2.356984 -3.118068
-v 3.266415 1.913417 -3.266410
-v 3.383303 1.451423 -3.383299
-v 3.467607 0.975451 -3.467603
-v 3.518518 0.490085 -3.518515
-v 3.535541 -0.000001 -3.535537
-v 3.518518 -0.490087 -3.518515
-v 3.467607 -0.975453 -3.467603
-v 3.383303 -1.451425 -3.383299
-v 3.266414 -1.913419 -3.266410
-v 3.118070 -2.356985 -3.118067
-v 2.939696 -2.777853 -2.939692
-v 2.733011 -3.171968 -2.733007
-v 2.500006 -3.535536 -2.500002
-v 2.242925 -3.865054 -2.242921
-v 1.964243 -4.157350 -1.964239
-v 1.666644 -4.409608 -1.666641
-v 1.352994 -4.619399 -1.352991
-v 1.026316 -4.784703 -1.026312
-v 0.689753 -4.903927 -0.689749
-v 0.346547 -4.975924 -0.346543
-v 0.378848 4.975924 -0.310909
-v 0.754042 4.903926 -0.618823
-v 1.121972 4.784702 -0.920776
-v 1.479098 4.619398 -1.213861
-v 1.821980 4.409606 -1.495257
-v 2.147315 4.157348 -1.762253
-v 2.451970 3.865052 -2.012277
-v 2.733012 3.535534 -2.242922
-v 2.987733 3.171967 -2.451966
-v 3.213681 2.777852 -2.637397
-v 3.408680 2.356984 -2.797429
-v 3.570850 1.913417 -2.930517
-v 3.698633 1.451423 -3.035387
-v 3.790794 0.975451 -3.111021
-v 3.846450 0.490085 -3.156697
-v 3.865060 -0.000001 -3.171970
-v 3.846450 -0.490087 -3.156697
-v 3.790794 -0.975453 -3.111021
-v 3.698632 -1.451425 -3.035386
-v 3.570850 -1.913419 -2.930517
-v 3.408679 -2.356985 -2.797428
-v 3.213681 -2.777853 -2.637397
-v 2.987732 -3.171968 -2.451965
-v 2.733011 -3.535536 -2.242921
-v 2.451969 -3.865054 -2.012276
-v 2.147313 -4.157350 -1.762251
-v 1.821978 -4.409608 -1.495256
-v 1.479096 -4.619399 -1.213859
-v 1.121970 -4.784703 -0.920774
-v 0.754039 -4.903927 -0.618820
-v 0.378845 -4.975924 -0.310907
-v 0.407499 4.975924 -0.272279
-v 0.811066 4.903926 -0.541934
-v 1.206821 4.784702 -0.806370
-v 1.590955 4.619398 -1.063040
-v 1.959767 4.409606 -1.309472
-v 2.309706 4.157348 -1.543293
-v 2.637401 3.865052 -1.762253
-v 2.939697 3.535534 -1.964240
-v 3.213681 3.171967 -2.147311
-v 3.456717 2.777852 -2.309701
-v 3.666463 2.356984 -2.449850
-v 3.840896 1.913417 -2.566402
-v 3.978343 1.451423 -2.658241
-v 4.077474 0.975451 -2.724478
-v 4.137339 0.490085 -2.764479
-v 4.157356 -0.000001 -2.777854
-v 4.137339 -0.490087 -2.764479
-v 4.077474 -0.975453 -2.724478
-v 3.978342 -1.451425 -2.658241
-v 3.840896 -1.913419 -2.566401
-v 3.666461 -2.356985 -2.449849
-v 3.456716 -2.777853 -2.309702
-v 3.213680 -3.171968 -2.147310
-v 2.939696 -3.535536 -1.964239
-v 2.637400 -3.865054 -1.762252
-v 2.309704 -4.157350 -1.543292
-v 1.959765 -4.409608 -1.309471
-v 1.590952 -4.619399 -1.063038
-v 1.206819 -4.784703 -0.806368
-v 0.811063 -4.903927 -0.541932
-v 0.407495 -4.975924 -0.272277
-v 0.432224 4.975924 -0.231027
-v 0.860279 4.903926 -0.459827
-v 1.280048 4.784702 -0.684198
-v 1.687490 4.619398 -0.901980
-v 2.078681 4.409606 -1.111076
-v 2.449853 4.157348 -1.309472
-v 2.797432 3.865052 -1.495257
-v 3.118070 3.535534 -1.666642
-v 3.408680 3.171967 -1.821975
-v 3.666462 2.777852 -1.959763
-v 3.888935 2.356984 -2.078678
-v 4.073953 1.913417 -2.177571
-v 4.219739 1.451423 -2.255496
-v 4.324885 0.975451 -2.311697
-v 4.388383 0.490085 -2.345638
-v 4.409614 -0.000001 -2.356987
-v 4.388383 -0.490087 -2.345638
-v 4.324885 -0.975453 -2.311697
-v 4.219738 -1.451425 -2.255496
-v 4.073952 -1.913419 -2.177570
-v 3.888934 -2.356985 -2.078677
-v 3.666461 -2.777853 -1.959763
-v 3.408679 -3.171968 -1.821974
-v 3.118069 -3.535536 -1.666641
-v 2.797431 -3.865054 -1.495256
-v 2.449852 -4.157350 -1.309471
-v 2.078679 -4.409608 -1.111075
-v 1.687487 -4.619399 -0.901979
-v 1.280046 -4.784703 -0.684197
-v 0.860276 -4.903927 -0.459825
-v 0.432221 -4.975924 -0.231025
-v 0.452788 4.975924 -0.187549
-v 0.901208 4.903926 -0.373291
-v 1.340947 4.784702 -0.555437
-v 1.767774 4.619398 -0.732235
-v 2.177576 4.409606 -0.901980
-v 2.566407 4.157348 -1.063039
-v 2.930522 3.865052 -1.213861
-v 3.266415 3.535534 -1.352992
-v 3.570851 3.171967 -1.479093
-v 3.840897 2.777852 -1.590950
-v 4.073955 2.356984 -1.687486
-v 4.267775 1.913417 -1.767768
-v 4.420497 1.451423 -1.831028
-v 4.530646 0.975451 -1.876653
-v 4.597165 0.490085 -1.904207
-v 4.619406 -0.000001 -1.913420
-v 4.597165 -0.490087 -1.904207
-v 4.530646 -0.975453 -1.876653
-v 4.420496 -1.451425 -1.831028
-v 4.267775 -1.913419 -1.767768
-v 4.073953 -2.356985 -1.687486
-v 3.840897 -2.777853 -1.590950
-v 3.570850 -3.171968 -1.479092
-v 3.266414 -3.535536 -1.352992
-v 2.930521 -3.865054 -1.213860
-v 2.566405 -4.157350 -1.063038
-v 2.177574 -4.409608 -0.901979
-v 1.767771 -4.619399 -0.732233
-v 1.340945 -4.784703 -0.555436
-v 0.901204 -4.903927 -0.373289
-v 0.452784 -4.975924 -0.187548
-v 0.468990 4.975924 -0.142265
-v 0.933457 4.903926 -0.283160
-v 1.388933 4.784702 -0.421327
-v 1.831033 4.619398 -0.555437
-v 2.255500 4.409606 -0.684197
-v 2.658245 4.157348 -0.806369
-v 3.035390 3.865052 -0.920775
-v 3.383303 3.535534 -1.026313
-v 3.698632 3.171967 -1.121967
-v 3.978342 2.777852 -1.206816
-v 4.219740 2.356984 -1.280044
-v 4.420496 1.913417 -1.340941
-v 4.578683 1.451423 -1.388927
-v 4.692774 0.975451 -1.423536
-v 4.761673 0.490085 -1.444437
-v 4.784710 -0.000001 -1.451425
-v 4.761673 -0.490087 -1.444437
-v 4.692774 -0.975453 -1.423536
-v 4.578682 -1.451425 -1.388927
-v 4.420496 -1.913419 -1.340941
-v 4.219738 -2.356985 -1.280043
-v 3.978342 -2.777853 -1.206816
-v 3.698631 -3.171968 -1.121966
-v 3.383302 -3.535536 -1.026312
-v 3.035389 -3.865054 -0.920774
-v 2.658243 -4.157350 -0.806368
-v 2.255498 -4.409608 -0.684197
-v 1.831030 -4.619399 -0.555436
-v 1.388930 -4.784703 -0.421326
-v 0.933453 -4.903927 -0.283159
-v 0.468987 -4.975924 -0.142264
-v 0.480677 4.975924 -0.095612
-v 0.956717 4.903926 -0.190302
-v 1.423542 4.784702 -0.283160
-v 1.876658 4.619398 -0.373290
-v 2.311702 4.409606 -0.459826
-v 2.724483 4.157348 -0.541933
-v 3.111026 3.865052 -0.618821
-v 3.467608 3.535534 -0.689750
-v 3.790795 3.171967 -0.754035
-v 4.077474 2.777852 -0.811059
-v 4.324887 2.356984 -0.860274
-v 4.530645 1.913417 -0.901200
-v 4.692774 1.451423 -0.933450
-v 4.809708 0.975451 -0.956709
-v 4.880324 0.490085 -0.970756
-v 4.903934 -0.000001 -0.975453
-v 4.880324 -0.490087 -0.970756
-v 4.809708 -0.975453 -0.956709
-v 4.692774 -1.451425 -0.933450
-v 4.530645 -1.913419 -0.901200
-v 4.324885 -2.356985 -0.860273
-v 4.077474 -2.777853 -0.811060
-v 3.790793 -3.171968 -0.754035
-v 3.467607 -3.535536 -0.689749
-v 3.111024 -3.865054 -0.618821
-v 2.724481 -4.157350 -0.541932
-v 2.311700 -4.409608 -0.459825
-v 1.876656 -4.619399 -0.373289
-v 1.423539 -4.784703 -0.283159
-v 0.956713 -4.903927 -0.190301
-v 0.480673 -4.975924 -0.095611
-v 0.487734 4.975924 -0.048037
-v 0.970763 4.903926 -0.095611
-v 1.444442 4.784702 -0.142265
-v 1.904210 4.619398 -0.187548
-v 2.345642 4.409606 -0.231025
-v 2.764482 4.157348 -0.272278
-v 3.156700 3.865052 -0.310908
-v 3.518518 3.535534 -0.346544
-v 3.846449 3.171967 -0.378842
-v 4.137338 2.777852 -0.407492
-v 4.388383 2.356984 -0.432218
-v 4.597162 1.913417 -0.452780
-v 4.761672 1.451423 -0.468983
-v 4.880322 0.975451 -0.480669
-v 4.951975 0.490085 -0.487727
-v 4.975932 -0.000001 -0.490087
-v 4.951975 -0.490087 -0.487727
-v 4.880322 -0.975453 -0.480669
-v 4.761671 -1.451425 -0.468984
-v 4.597162 -1.913419 -0.452780
-v 4.388381 -2.356985 -0.432218
-v 4.137337 -2.777853 -0.407492
-v 3.846448 -3.171968 -0.378841
-v 3.518516 -3.535536 -0.346543
-v 3.156699 -3.865054 -0.310907
-v 2.764481 -4.157350 -0.272277
-v 2.345639 -4.409608 -0.231025
-v 1.904208 -4.619399 -0.187548
-v 1.444439 -4.784703 -0.142265
-v 0.970759 -4.903927 -0.095611
-v 0.487730 -4.975924 -0.048037
-v 0.490094 4.975924 0.000000
-v 0.975460 4.903926 -0.000000
-v 1.451431 4.784702 -0.000000
-v 1.913424 4.619398 -0.000000
-v 2.356991 4.409606 -0.000000
-v 2.777858 4.157348 -0.000000
-v 3.171974 3.865052 -0.000000
-v 3.535542 3.535534 -0.000000
-v 3.865060 3.171967 -0.000000
-v 4.157357 2.777852 0.000000
-v 4.409616 2.356984 -0.000001
-v 4.619406 1.913417 0.000000
-v 4.784711 1.451423 -0.000000
-v 4.903936 0.975451 0.000000
-v 4.975935 0.490085 -0.000000
-v 5.000008 -0.000001 -0.000001
-v 4.975935 -0.490087 -0.000000
-v 4.903936 -0.975453 0.000000
-v 4.784711 -1.451425 -0.000000
-v 4.619405 -1.913419 0.000000
-v 4.409615 -2.356985 -0.000001
-v 4.157356 -2.777853 -0.000000
-v 3.865059 -3.171968 0.000000
-v 3.535541 -3.535536 -0.000000
-v 3.171973 -3.865054 -0.000000
-v 2.777857 -4.157350 0.000000
-v 2.356989 -4.409608 -0.000000
-v 1.913421 -4.619399 -0.000000
-v 1.451428 -4.784703 -0.000000
-v 0.975456 -4.903927 -0.000000
-v 0.490090 -4.975924 -0.000000
-v 0.487734 4.975924 0.048037
-v 0.970763 4.903926 0.095611
-v 1.444442 4.784702 0.142264
-v 1.904210 4.619398 0.187548
-v 2.345642 4.409606 0.231025
-v 2.764482 4.157348 0.272277
-v 3.156700 3.865052 0.310907
-v 3.518518 3.535534 0.346543
-v 3.846449 3.171967 0.378842
-v 4.137338 2.777852 0.407492
-v 4.388382 2.356984 0.432217
-v 4.597162 1.913417 0.452781
-v 4.761672 1.451423 0.468983
-v 4.880322 0.975451 0.480670
-v 4.951975 0.490085 0.487726
-v 4.975932 -0.000001 0.490085
-v 4.951975 -0.490087 0.487726
-v 4.880322 -0.975453 0.480670
-v 4.761671 -1.451425 0.468983
-v 4.597162 -1.913419 0.452781
-v 4.388381 -2.356985 0.432217
-v 4.137337 -2.777853 0.407491
-v 3.846448 -3.171968 0.378842
-v 3.518516 -3.535536 0.346543
-v 3.156698 -3.865054 0.310907
-v 2.764480 -4.157350 0.272277
-v 2.345639 -4.409608 0.231025
-v 1.904208 -4.619399 0.187548
-v 1.444439 -4.784703 0.142264
-v 0.970759 -4.903927 0.095611
-v 0.487730 -4.975924 0.048037
-v 0.480677 4.975924 0.095612
-v 0.956717 4.903926 0.190302
-v 1.423542 4.784702 0.283159
-v 1.876658 4.619398 0.373289
-v 2.311702 4.409606 0.459825
-v 2.724482 4.157348 0.541932
-v 3.111026 3.865052 0.618820
-v 3.467608 3.535534 0.689749
-v 3.790794 3.171967 0.754035
-v 4.077474 2.777852 0.811059
-v 4.324886 2.356984 0.860272
-v 4.530645 1.913417 0.901201
-v 4.692774 1.451423 0.933450
-v 4.809708 0.975451 0.956710
-v 4.880324 0.490085 0.970756
-v 4.903934 -0.000001 0.975452
-v 4.880324 -0.490087 0.970756
-v 4.809708 -0.975453 0.956710
-v 4.692774 -1.451425 0.933450
-v 4.530645 -1.913419 0.901201
-v 4.324885 -2.356985 0.860272
-v 4.077474 -2.777853 0.811059
-v 3.790793 -3.171968 0.754035
-v 3.467606 -3.535536 0.689749
-v 3.111024 -3.865054 0.618820
-v 2.724481 -4.157350 0.541932
-v 2.311700 -4.409608 0.459825
-v 1.876655 -4.619399 0.373289
-v 1.423539 -4.784703 0.283159
-v 0.956713 -4.903927 0.190301
-v 0.480673 -4.975924 0.095611
-v 0.468990 4.975924 0.142266
-v 0.933457 4.903926 0.283160
-v 1.388933 4.784702 0.421326
-v 1.831033 4.619398 0.555436
-v 2.255500 4.409606 0.684197
-v 2.658244 4.157348 0.806368
-v 3.035390 3.865052 0.920774
-v 3.383303 3.535534 1.026312
-v 3.698632 3.171967 1.121967
-v 3.978342 2.777852 1.206816
-v 4.219739 2.356984 1.280042
-v 4.420496 1.913417 1.340942
-v 4.578683 1.451423 1.388927
-v 4.692774 0.975451 1.423537
-v 4.761674 0.490085 1.444436
-v 4.784709 -0.000001 1.451424
-v 4.761674 -0.490087 1.444436
-v 4.692774 -0.975453 1.423537
-v 4.578683 -1.451425 1.388927
-v 4.420496 -1.913419 1.340942
-v 4.219738 -2.356985 1.280042
-v 3.978342 -2.777853 1.206815
-v 3.698631 -3.171968 1.121966
-v 3.383302 -3.535536 1.026312
-v 3.035388 -3.865054 0.920774
-v 2.658243 -4.157350 0.806368
-v 2.255498 -4.409608 0.684196
-v 1.831030 -4.619399 0.555436
-v 1.388930 -4.784703 0.421326
-v 0.933453 -4.903927 0.283159
-v 0.468987 -4.975924 0.142264
-v 0.452788 4.975924 0.187549
-v 0.901208 4.903926 0.373291
-v 1.340947 4.784702 0.555436
-v 1.767773 4.619398 0.732234
-v 2.177576 4.409606 0.901980
-v 2.566406 4.157348 1.063039
-v 2.930522 3.865052 1.213860
-v 3.266415 3.535534 1.352991
-v 3.570850 3.171967 1.479093
-v 3.840896 2.777852 1.590950
-v 4.073954 2.356984 1.687485
-v 4.267775 1.913417 1.767769
-v 4.420497 1.451423 1.831028
-v 4.530646 0.975451 1.876654
-v 4.597166 0.490085 1.904206
-v 4.619405 -0.000001 1.913418
-v 4.597166 -0.490087 1.904206
-v 4.530646 -0.975453 1.876654
-v 4.420497 -1.451425 1.831028
-v 4.267774 -1.913419 1.767769
-v 4.073953 -2.356985 1.687484
-v 3.840896 -2.777853 1.590949
-v 3.570849 -3.171968 1.479093
-v 3.266414 -3.535536 1.352991
-v 2.930521 -3.865054 1.213859
-v 2.566405 -4.157350 1.063038
-v 2.177574 -4.409608 0.901979
-v 1.767771 -4.619399 0.732233
-v 1.340945 -4.784703 0.555436
-v 0.901204 -4.903927 0.373289
-v 0.452784 -4.975924 0.187548
-v 0.432224 4.975924 0.231027
-v 0.860279 4.903926 0.459827
-v 1.280048 4.784702 0.684197
-v 1.687490 4.619398 0.901979
-v 2.078681 4.409606 1.111076
-v 2.449852 4.157348 1.309471
-v 2.797432 3.865052 1.495256
-v 3.118070 3.535534 1.666641
-v 3.408679 3.171967 1.821975
-v 3.666461 2.777852 1.959763
-v 3.888935 2.356984 2.078676
-v 4.073952 1.913417 2.177571
-v 4.219739 1.451423 2.255495
-v 4.324886 0.975451 2.311698
-v 4.388384 0.490085 2.345638
-v 4.409614 -0.000001 2.356985
-v 4.388384 -0.490087 2.345638
-v 4.324886 -0.975453 2.311698
-v 4.219739 -1.451425 2.255495
-v 4.073952 -1.913419 2.177571
-v 3.888934 -2.356985 2.078675
-v 3.666461 -2.777853 1.959762
-v 3.408678 -3.171968 1.821975
-v 3.118069 -3.535536 1.666640
-v 2.797430 -3.865054 1.495255
-v 2.449851 -4.157350 1.309471
-v 2.078679 -4.409608 1.111074
-v 1.687487 -4.619399 0.901978
-v 1.280045 -4.784703 0.684196
-v 0.860276 -4.903927 0.459825
-v 0.432221 -4.975924 0.231025
-v 0.407499 4.975924 0.272279
-v 0.811066 4.903926 0.541934
-v 1.206821 4.784702 0.806369
-v 1.590954 4.619398 1.063039
-v 1.959767 4.409606 1.309472
-v 2.309705 4.157348 1.543293
-v 2.637401 3.865052 1.762252
-v 2.939697 3.535534 1.964239
-v 3.213681 3.171967 2.147310
-v 3.456716 2.777852 2.309701
-v 3.666462 2.356984 2.449848
-v 3.840896 1.913417 2.566402
-v 3.978343 1.451423 2.658241
-v 4.077475 0.975451 2.724479
-v 4.137340 0.490085 2.764479
-v 4.157356 -0.000001 2.777853
-v 4.137340 -0.490087 2.764479
-v 4.077475 -0.975453 2.724479
-v 3.978342 -1.451425 2.658240
-v 3.840895 -1.913419 2.566402
-v 3.666461 -2.356985 2.449848
-v 3.456716 -2.777853 2.309700
-v 3.213679 -3.171968 2.147310
-v 2.939695 -3.535536 1.964239
-v 2.637399 -3.865054 1.762251
-v 2.309703 -4.157350 1.543292
-v 1.959765 -4.409608 1.309470
-v 1.590952 -4.619399 1.063038
-v 1.206819 -4.784703 0.806368
-v 0.811063 -4.903927 0.541932
-v 0.407495 -4.975924 0.272277
-v 0.378848 4.975924 0.310910
-v 0.754041 4.903926 0.618822
-v 1.121972 4.784702 0.920775
-v 1.479097 4.619398 1.213860
-v 1.821980 4.409606 1.495257
-v 2.147314 4.157348 1.762252
-v 2.451970 3.865052 2.012276
-v 2.733012 3.535534 2.242921
-v 2.987732 3.171967 2.451965
-v 3.213680 2.777852 2.637396
-v 3.408680 2.356984 2.797427
-v 3.570849 1.913417 2.930518
-v 3.698633 1.451423 3.035386
-v 3.790795 0.975451 3.111022
-v 3.846451 0.490085 3.156697
-v 3.865060 -0.000001 3.171968
-v 3.846451 -0.490087 3.156697
-v 3.790795 -0.975453 3.111022
-v 3.698632 -1.451425 3.035385
-v 3.570849 -1.913419 2.930517
-v 3.408679 -2.356985 2.797427
-v 3.213680 -2.777853 2.637396
-v 2.987731 -3.171968 2.451965
-v 2.733011 -3.535536 2.242921
-v 2.451969 -3.865054 2.012275
-v 2.147312 -4.157350 1.762251
-v 1.821978 -4.409608 1.495255
-v 1.479095 -4.619399 1.213859
-v 1.121969 -4.784703 0.920773
-v 0.754038 -4.903927 0.618820
-v 0.378845 -4.975924 0.310907
-v 0.346550 4.975924 0.346546
-v 0.689755 4.903926 0.689751
-v 1.026317 4.784702 1.026313
-v 1.352996 4.619398 1.352992
-v 1.666645 4.409606 1.666641
-v 1.964243 4.157348 1.964239
-v 2.242926 3.865052 2.242921
-v 2.500007 3.535534 2.500003
-v 2.733011 3.171967 2.733007
-v 2.939695 2.777852 2.939692
-v 3.118071 2.356984 3.118065
-v 3.266414 1.913417 3.266410
-v 3.383303 1.451423 3.383298
-v 3.467607 0.975451 3.467603
-v 3.518519 0.490085 3.518515
-v 3.535541 -0.000001 3.535536
-v 3.518519 -0.490087 3.518515
-v 3.467607 -0.975453 3.467603
-v 3.383303 -1.451425 3.383297
-v 3.266413 -1.913419 3.266410
-v 3.118070 -2.356985 3.118065
-v 2.939695 -2.777853 2.939691
-v 2.733010 -3.171968 2.733006
-v 2.500006 -3.535536 2.500002
-v 2.242924 -3.865054 2.242920
-v 1.964241 -4.157350 1.964238
-v 1.666644 -4.409608 1.666639
-v 1.352994 -4.619399 1.352990
-v 1.026315 -4.784703 1.026311
-v 0.689753 -4.903927 0.689748
-v 0.346547 -4.975924 0.346543
-v 0.310914 4.975924 0.378844
-v 0.618827 4.903926 0.754037
-v 0.920779 4.784702 1.121967
-v 1.213865 4.619398 1.479093
-v 1.495261 4.409606 1.821976
-v 1.762255 4.157348 2.147310
-v 2.012280 3.865052 2.451965
-v 2.242926 3.535534 2.733007
-v 2.451969 3.171967 2.987728
-v 2.637400 2.777852 3.213676
-v 2.797432 2.356984 3.408675
-v 2.930521 1.913417 3.570846
-v 3.035390 1.451423 3.698628
-v 3.111026 0.975451 3.790791
-v 3.156702 0.490085 3.846447
-v 3.171973 -0.000001 3.865055
-v 3.156702 -0.490087 3.846447
-v 3.111026 -0.975453 3.790791
-v 3.035390 -1.451425 3.698627
-v 2.930520 -1.913419 3.570845
-v 2.797432 -2.356985 3.408674
-v 2.637400 -2.777853 3.213676
-v 2.451969 -3.171968 2.987727
-v 2.242924 -3.535536 2.733006
-v 2.012279 -3.865054 2.451964
-v 1.762254 -4.157350 2.147309
-v 1.495259 -4.409608 1.821973
-v 1.213863 -4.619399 1.479091
-v 0.920777 -4.784703 1.121966
-v 0.618824 -4.903927 0.754034
-v 0.310911 -4.975924 0.378841
-v 0.272283 4.975924 0.407495
-v 0.541938 4.903926 0.811062
-v 0.806373 4.784702 1.206817
-v 1.063043 4.619398 1.590950
-v 1.309476 4.409606 1.959763
-v 1.543296 4.157348 2.309701
-v 1.762256 3.865052 2.637396
-v 1.964244 3.535534 2.939692
-v 2.147314 3.171967 3.213676
-v 2.309705 2.777852 3.456712
-v 2.449853 2.356984 3.666457
-v 2.566405 1.913417 3.840892
-v 2.658245 1.451423 3.978338
-v 2.724483 0.975451 4.077470
-v 2.764483 0.490085 4.137335
-v 2.777858 -0.000001 4.157351
-v 2.764483 -0.490087 4.137335
-v 2.724483 -0.975453 4.077470
-v 2.658245 -1.451425 3.978337
-v 2.566405 -1.913419 3.840892
-v 2.449853 -2.356985 3.666456
-v 2.309705 -2.777853 3.456711
-v 2.147313 -3.171968 3.213675
-v 1.964243 -3.535536 2.939691
-v 1.762255 -3.865054 2.637395
-v 1.543295 -4.157350 2.309700
-v 1.309474 -4.409608 1.959761
-v 1.063041 -4.619399 1.590948
-v 0.806372 -4.784703 1.206815
-v 0.541936 -4.903927 0.811058
-v 0.272281 -4.975924 0.407491
-v 0.231031 4.975924 0.432220
-v 0.459831 4.903926 0.860275
-v 0.684202 4.784702 1.280043
-v 0.901984 4.619398 1.687485
-v 1.111080 4.409606 2.078677
-v 1.309475 4.157348 2.449848
-v 1.495260 3.865052 2.797427
-v 1.666645 3.535534 3.118065
-v 1.821979 3.171967 3.408674
-v 1.959766 2.777852 3.666457
-v 2.078681 2.356984 3.888929
-v 2.177574 1.913417 4.073948
-v 2.255499 1.451423 4.219734
-v 2.311701 0.975451 4.324882
-v 2.345642 0.490085 4.388380
-v 2.356990 -0.000001 4.409609
-v 2.345642 -0.490087 4.388380
-v 2.311701 -0.975453 4.324882
-v 2.255499 -1.451425 4.219733
-v 2.177574 -1.913419 4.073948
-v 2.078681 -2.356985 3.888928
-v 1.959766 -2.777853 3.666456
-v 1.821978 -3.171968 3.408674
-v 1.666644 -3.535536 3.118064
-v 1.495259 -3.865054 2.797426
-v 1.309474 -4.157350 2.449847
-v 1.111079 -4.409608 2.078674
-v 0.901982 -4.619399 1.687483
-v 0.684200 -4.784703 1.280041
-v 0.459829 -4.903927 0.860271
-v 0.231029 -4.975924 0.432217
-v 0.187553 4.975924 0.452784
-v 0.373295 4.903926 0.901203
-v 0.555441 4.784702 1.340943
-v 0.732238 4.619398 1.767769
-v 0.901984 4.409606 2.177572
-v 1.063042 4.157348 2.566402
-v 1.213864 3.865052 2.930517
-v 1.352996 3.535534 3.266410
-v 1.479097 3.171967 3.570845
-v 1.590953 2.777852 3.840892
-v 1.687490 2.356984 4.073948
-v 1.767772 1.913417 4.267770
-v 1.831032 1.451423 4.420492
-v 1.876657 0.975451 4.530642
-v 1.904211 0.490085 4.597161
-v 1.913423 -0.000001 4.619401
-v 1.904211 -0.490087 4.597161
-v 1.876657 -0.975453 4.530642
-v 1.831032 -1.451425 4.420491
-v 1.767771 -1.913419 4.267770
-v 1.687489 -2.356985 4.073948
-v 1.590954 -2.777853 3.840891
-v 1.479096 -3.171968 3.570844
-v 1.352995 -3.535536 3.266409
-v 1.213863 -3.865054 2.930516
-v 1.063041 -4.157350 2.566401
-v 0.901983 -4.409608 2.177569
-v 0.732237 -4.619399 1.767767
-v 0.555440 -4.784703 1.340941
-v 0.373293 -4.903927 0.901200
-v 0.187552 -4.975924 0.452780
-v 0.142269 4.975924 0.468987
-v 0.283164 4.903926 0.933453
-v 0.421331 4.784702 1.388928
-v 0.555440 4.619398 1.831028
-v 0.684201 4.409606 2.255495
-v 0.806372 4.157348 2.658240
-v 0.920778 3.865052 3.035385
-v 1.026317 3.535534 3.383298
-v 1.121970 3.171967 3.698627
-v 1.206819 2.777852 3.978337
-v 1.280047 2.356984 4.219734
-v 1.340945 1.913417 4.420491
-v 1.388931 1.451423 4.578678
-v 1.423540 0.975451 4.692770
-v 1.444441 0.490085 4.761669
-v 1.451429 -0.000001 4.784705
-v 1.444441 -0.490087 4.761669
-v 1.423540 -0.975453 4.692770
-v 1.388931 -1.451425 4.578677
-v 1.340945 -1.913419 4.420491
-v 1.280047 -2.356985 4.219733
-v 1.206820 -2.777853 3.978337
-v 1.121970 -3.171968 3.698626
-v 1.026316 -3.535536 3.383297
-v 0.920778 -3.865054 3.035383
-v 0.806371 -4.157350 2.658238
-v 0.684200 -4.409608 2.255493
-v 0.555439 -4.619399 1.831026
-v 0.421330 -4.784703 1.388926
-v 0.283163 -4.903927 0.933449
-v 0.142268 -4.975924 0.468983
-v 0.095616 4.975924 0.480673
-v 0.190306 4.903926 0.956712
-v 0.283163 4.784702 1.423537
-v 0.373294 4.619398 1.876654
-v 0.459829 4.409606 2.311697
-v 0.541936 4.157348 2.724477
-v 0.618825 3.865052 3.111020
-v 0.689753 3.535534 3.467602
-v 0.754039 3.171967 3.790789
-v 0.811063 2.777852 4.077468
-v 0.860277 2.356984 4.324881
-v 0.901204 1.913417 4.530640
-v 0.933454 1.451423 4.692769
-v 0.956713 0.975451 4.809704
-v 0.970760 0.490085 4.880320
-v 0.975457 -0.000001 4.903929
-v 0.970760 -0.490087 4.880320
-v 0.956713 -0.975453 4.809704
-v 0.933454 -1.451425 4.692768
-v 0.901204 -1.913419 4.530640
-v 0.860277 -2.356985 4.324880
-v 0.811063 -2.777853 4.077468
-v 0.754038 -3.171968 3.790788
-v 0.689753 -3.535536 3.467601
-v 0.618824 -3.865054 3.111019
-v 0.541935 -4.157350 2.724476
-v 0.459829 -4.409608 2.311695
-v 0.373293 -4.619399 1.876651
-v 0.283163 -4.784703 1.423535
-v 0.190305 -4.903927 0.956708
-v 0.095615 -4.975924 0.480669
-v 0.048041 4.975924 0.487730
-v 0.095615 4.903926 0.970758
-v 0.142269 4.784702 1.444437
-v 0.187552 4.619398 1.904206
-v 0.231029 4.409606 2.345636
-v 0.272281 4.157348 2.764477
-v 0.310912 3.865052 3.156695
-v 0.346547 3.535534 3.518512
-v 0.378846 3.171967 3.846443
-v 0.407495 2.777852 4.137331
-v 0.432222 2.356984 4.388377
-v 0.452784 1.913417 4.597157
-v 0.468987 1.451423 4.761666
-v 0.480673 0.975451 4.880318
-v 0.487731 0.490085 4.951970
-v 0.490090 -0.000001 4.975926
-v 0.487731 -0.490087 4.951970
-v 0.480673 -0.975453 4.880318
-v 0.468988 -1.451425 4.761665
-v 0.452784 -1.913419 4.597157
-v 0.432222 -2.356985 4.388376
-v 0.407496 -2.777853 4.137332
-v 0.378845 -3.171968 3.846443
-v 0.346547 -3.535536 3.518511
-v 0.310911 -3.865054 3.156693
-v 0.272280 -4.157350 2.764475
-v 0.231029 -4.409608 2.345634
-v 0.187551 -4.619399 1.904203
-v 0.142268 -4.784703 1.444435
-v 0.095615 -4.903927 0.970754
-v 0.048041 -4.975924 0.487726
-v 0.000004 4.975924 0.490090
-v 0.000004 4.903926 0.975455
-v 0.000004 4.784702 1.451426
-v 0.000004 4.619398 1.913419
-v 0.000004 4.409606 2.356986
-v 0.000004 4.157348 2.777853
-v 0.000004 3.865052 3.171968
-v 0.000004 3.535534 3.535537
-v 0.000004 3.171967 3.865055
-v 0.000004 2.777852 4.157350
-v 0.000005 2.356984 4.409610
-v 0.000004 1.913417 4.619400
-v 0.000004 1.451423 4.784706
-v 0.000004 0.975451 4.903932
-v 0.000004 0.490085 4.975930
-v 0.000004 -0.000001 5.000002
-v 0.000004 -0.490087 4.975930
-v 0.000004 -0.975453 4.903932
-v 0.000005 -1.451425 4.784705
-v 0.000004 -1.913419 4.619400
-v 0.000005 -2.356985 4.409610
-v 0.000004 -2.777853 4.157351
-v 0.000004 -3.171968 3.865054
-v 0.000004 -3.535536 3.535535
-v 0.000004 -3.865054 3.171967
-v 0.000003 -4.157350 2.777851
-v 0.000004 -4.409608 2.356983
-v 0.000004 -4.619399 1.913417
-v 0.000004 -4.784703 1.451424
-v 0.000004 -4.903927 0.975451
-v 0.000004 -4.975924 0.490086
-v -0.048033 4.975924 0.487730
-v -0.095607 4.903926 0.970758
-v -0.142260 4.784702 1.444437
-v -0.187544 4.619398 1.904206
-v -0.231021 4.409606 2.345636
-v -0.272273 4.157348 2.764476
-v -0.310903 3.865052 3.156695
-v -0.346539 3.535534 3.518512
-v -0.378837 3.171967 3.846443
-v -0.407488 2.777852 4.137331
-v -0.432213 2.356984 4.388377
-v -0.452777 1.913417 4.597157
-v -0.468979 1.451423 4.761666
-v -0.480666 0.975451 4.880318
-v -0.487722 0.490085 4.951970
-v -0.490081 -0.000001 4.975926
-v -0.487722 -0.490087 4.951970
-v -0.480666 -0.975453 4.880318
-v -0.468978 -1.451425 4.761665
-v -0.452777 -1.913419 4.597157
-v -0.432213 -2.356985 4.388376
-v -0.407487 -2.777853 4.137332
-v -0.378838 -3.171968 3.846442
-v -0.346539 -3.535536 3.518511
-v -0.310903 -3.865054 3.156693
-v -0.272274 -4.157350 2.764475
-v -0.231021 -4.409608 2.345634
-v -0.187544 -4.619399 1.904203
-v -0.142261 -4.784703 1.444435
-v -0.095607 -4.903927 0.970754
-v -0.048033 -4.975924 0.487726
-v -0.095608 4.975924 0.480673
-v -0.190298 4.903926 0.956712
-v -0.283155 4.784702 1.423538
-v -0.373286 4.619398 1.876653
-v -0.459821 4.409606 2.311697
-v -0.541928 4.157348 2.724477
-v -0.618816 3.865052 3.111020
-v -0.689745 3.535534 3.467602
-v -0.754031 3.171967 3.790788
-v -0.811055 2.777852 4.077468
-v -0.860267 2.356984 4.324881
-v -0.901197 1.913417 4.530640
-v -0.933446 1.451423 4.692769
-v -0.956706 0.975451 4.809704
-v -0.970752 0.490085 4.880319
-v -0.975448 -0.000001 4.903928
-v -0.970752 -0.490087 4.880319
-v -0.956706 -0.975453 4.809704
-v -0.933445 -1.451425 4.692768
-v -0.901197 -1.913419 4.530640
-v -0.860268 -2.356985 4.324881
-v -0.811055 -2.777853 4.077469
-v -0.754031 -3.171968 3.790787
-v -0.689745 -3.535536 3.467601
-v -0.618816 -3.865054 3.111019
-v -0.541928 -4.157350 2.724475
-v -0.459820 -4.409608 2.311695
-v -0.373286 -4.619399 1.876651
-v -0.283155 -4.784703 1.423535
-v -0.190297 -4.903927 0.956708
-v -0.095607 -4.975924 0.480669
-v -0.142262 4.975924 0.468987
-v -0.283156 4.903926 0.933452
-v -0.421323 4.784702 1.388928
-v -0.555432 4.619398 1.831028
-v -0.684193 4.409606 2.255495
-v -0.806364 4.157348 2.658239
-v -0.920769 3.865052 3.035385
-v -1.026308 3.535534 3.383297
-v -1.121962 3.171967 3.698626
-v -1.206811 2.777852 3.978336
-v -1.280038 2.356984 4.219734
-v -1.340937 1.913417 4.420490
-v -1.388923 1.451423 4.578678
-v -1.423532 0.975451 4.692770
-v -1.444432 0.490085 4.761668
-v -1.451420 -0.000001 4.784703
-v -1.444432 -0.490087 4.761668
-v -1.423532 -0.975453 4.692770
-v -1.388922 -1.451425 4.578677
-v -1.340938 -1.913419 4.420490
-v -1.280038 -2.356985 4.219734
-v -1.206811 -2.777853 3.978337
-v -1.121962 -3.171968 3.698625
-v -1.026308 -3.535536 3.383296
-v -0.920769 -3.865054 3.035383
-v -0.806364 -4.157350 2.658237
-v -0.684192 -4.409608 2.255492
-v -0.555432 -4.619399 1.831026
-v -0.421322 -4.784703 1.388926
-v -0.283154 -4.903927 0.933449
-v -0.142260 -4.975924 0.468983
-v 0.000002 5.000000 0.000004
-v -0.187545 4.975924 0.452784
-v -0.373286 4.903926 0.901203
-v -0.555433 4.784702 1.340943
-v -0.732230 4.619398 1.767769
-v -0.901975 4.409606 2.177571
-v -1.063034 4.157348 2.566401
-v -1.213855 3.865052 2.930517
-v -1.352987 3.535534 3.266410
-v -1.479088 3.171967 3.570844
-v -1.590945 2.777852 3.840890
-v -1.687480 2.356984 4.073949
-v -1.767764 1.913417 4.267769
-v -1.831023 1.451423 4.420492
-v -1.876650 0.975451 4.530642
-v -1.904202 0.490085 4.597159
-v -1.913414 -0.000001 4.619399
-v -1.904202 -0.490087 4.597159
-v -1.876650 -0.975453 4.530642
-v -1.831023 -1.451425 4.420491
-v -1.767764 -1.913419 4.267769
-v -1.687480 -2.356985 4.073948
-v -1.590945 -2.777853 3.840891
-v -1.479088 -3.171968 3.570843
-v -1.352987 -3.535536 3.266409
-v -1.213855 -3.865054 2.930515
-v -1.063034 -4.157350 2.566399
-v -0.901974 -4.409608 2.177568
-v -0.732229 -4.619399 1.767767
-v -0.555432 -4.784703 1.340940
-v -0.373285 -4.903927 0.901200
-v -0.187544 -4.975924 0.452780
-v -0.231023 4.975924 0.432220
-v -0.459822 4.903926 0.860275
-v -0.684193 4.784702 1.280044
-v -0.901976 4.619398 1.687485
-v -1.111071 4.409606 2.078676
-v -1.309467 4.157348 2.449847
-v -1.495251 3.865052 2.797426
-v -1.666636 3.535534 3.118064
-v -1.821970 3.171967 3.408674
-v -1.959758 2.777852 3.666455
-v -2.078671 2.356984 3.888930
-v -2.177567 1.913417 4.073946
-v -2.255491 1.451423 4.219734
-v -2.311694 0.975451 4.324882
-v -2.345633 0.490085 4.388378
-v -2.356980 -0.000001 4.409608
-v -2.345633 -0.490087 4.388378
-v -2.311694 -0.975453 4.324882
-v -2.255490 -1.451425 4.219733
-v -2.177567 -1.913419 4.073946
-v -2.078671 -2.356985 3.888929
-v -1.959758 -2.777853 3.666456
-v -1.821970 -3.171968 3.408673
-v -1.666636 -3.535536 3.118064
-v -1.495251 -3.865054 2.797425
-v -1.309466 -4.157350 2.449845
-v -1.111070 -4.409608 2.078673
-v -0.901975 -4.619399 1.687483
-v -0.684193 -4.784703 1.280041
-v -0.459820 -4.903927 0.860271
-v -0.231021 -4.975924 0.432217
-v -0.272275 4.975924 0.407495
-v -0.541930 4.903926 0.811061
-v -0.806365 4.784702 1.206817
-v -1.063035 4.619398 1.590950
-v -1.309467 4.409606 1.959762
-v -1.543288 4.157348 2.309699
-v -1.762247 3.865052 2.637395
-v -1.964235 3.535534 2.939691
-v -2.147305 3.171967 3.213675
-v -2.309696 2.777852 3.456710
-v -2.449844 2.356984 3.666458
-v -2.566397 1.913417 3.840890
-v -2.658236 1.451423 3.978338
-v -2.724475 0.975451 4.077470
-v -2.764474 0.490085 4.137334
-v -2.777848 -0.000001 4.157350
-v -2.764474 -0.490087 4.137334
-v -2.724475 -0.975453 4.077470
-v -2.658235 -1.451425 3.978337
-v -2.566398 -1.913419 3.840890
-v -2.449844 -2.356985 3.666457
-v -2.309696 -2.777853 3.456711
-v -2.147305 -3.171968 3.213674
-v -1.964234 -3.535536 2.939690
-v -1.762246 -3.865054 2.637394
-v -1.543288 -4.157350 2.309698
-v -1.309466 -4.409608 1.959760
-v -1.063034 -4.619399 1.590948
-v -0.806364 -4.784703 1.206815
-v -0.541928 -4.903927 0.811058
-v -0.272273 -4.975924 0.407491
-v -0.310906 4.975924 0.378844
-v -0.618818 4.903926 0.754037
-v -0.920771 4.784702 1.121968
-v -1.213856 4.619398 1.479093
-v -1.495252 4.409606 1.821974
-v -1.762247 4.157348 2.147308
-v -2.012271 3.865052 2.451964
-v -2.242917 3.535534 2.733006
-v -2.451960 3.171967 2.987727
-v -2.637391 2.777852 3.213675
-v -2.797423 2.356984 3.408675
-v -2.930512 1.913417 3.570844
-v -3.035381 1.451423 3.698628
-v -3.111017 0.975451 3.790790
-v -3.156693 0.490085 3.846445
-v -3.171963 -0.000001 3.865054
-v -3.156693 -0.490087 3.846445
-v -3.111017 -0.975453 3.790790
-v -3.035380 -1.451425 3.698627
-v -2.930513 -1.913419 3.570844
-v -2.797423 -2.356985 3.408674
-v -2.637392 -2.777853 3.213675
-v -2.451960 -3.171968 2.987726
-v -2.242916 -3.535536 2.733005
-v -2.012270 -3.865054 2.451963
-v -1.762246 -4.157350 2.147307
-v -1.495250 -4.409608 1.821972
-v -1.213855 -4.619399 1.479091
-v -0.920770 -4.784703 1.121966
-v -0.618816 -4.903927 0.754034
-v -0.310903 -4.975924 0.378841
-v -0.346542 4.975924 0.346546
-v -0.689747 4.903926 0.689751
-v -1.026309 4.784702 1.026314
-v -1.352988 4.619398 1.352992
-v -1.666637 4.409606 1.666640
-v -1.964234 4.157348 1.964238
-v -2.242916 3.865052 2.242920
-v -2.499998 3.535534 2.500001
-v -2.733002 3.171967 2.733006
-v -2.939687 2.777852 2.939690
-v -3.118061 2.356984 3.118066
-v -3.266405 1.913417 3.266408
-v -3.383294 1.451423 3.383298
-v -3.467600 0.975451 3.467603
-v -3.518510 0.490085 3.518513
-v -3.535531 -0.000001 3.535535
-v -3.518510 -0.490087 3.518513
-v -3.467600 -0.975453 3.467603
-v -3.383293 -1.451425 3.383298
-v -3.266405 -1.913419 3.266408
-v -3.118061 -2.356985 3.118065
-v -2.939687 -2.777853 2.939691
-v -2.733001 -3.171968 2.733005
-v -2.499997 -3.535536 2.500000
-v -2.242915 -3.865054 2.242919
-v -1.964234 -4.157350 1.964236
-v -1.666635 -4.409608 1.666638
-v -1.352986 -4.619399 1.352990
-v -1.026308 -4.784703 1.026312
-v -0.689744 -4.903927 0.689748
-v -0.346539 -4.975924 0.346543
-v -0.378840 4.975924 0.310910
-v -0.754033 4.903926 0.618822
-v -1.121964 4.784702 0.920775
-v -1.479089 4.619398 1.213860
-v -1.821971 4.409606 1.495256
-v -2.147305 4.157348 1.762250
-v -2.451960 3.865052 2.012275
-v -2.733002 3.535534 2.242920
-v -2.987723 3.171967 2.451964
-v -3.213671 2.777852 2.637394
-v -3.408670 2.356984 2.797428
-v -3.570840 1.913417 2.930516
-v -3.698623 1.451423 3.035385
-v -3.790787 0.975451 3.111021
-v -3.846442 0.490085 3.156696
-v -3.865050 -0.000001 3.171968
-v -3.846442 -0.490087 3.156696
-v -3.790787 -0.975453 3.111021
-v -3.698622 -1.451425 3.035385
-v -3.570841 -1.913419 2.930515
-v -3.408670 -2.356985 2.797426
-v -3.213672 -2.777853 2.637395
-v -2.987722 -3.171968 2.451963
-v -2.733002 -3.535536 2.242919
-v -2.451960 -3.865054 2.012274
-v -2.147304 -4.157350 1.762249
-v -1.821968 -4.409608 1.495254
-v -1.479088 -4.619399 1.213859
-v -1.121962 -4.784703 0.920773
-v -0.754030 -4.903927 0.618820
-v -0.378837 -4.975924 0.310907
-v -0.407491 4.975924 0.272279
-v -0.811057 4.903926 0.541934
-v -1.206813 4.784702 0.806369
-v -1.590946 4.619398 1.063039
-v -1.959758 4.409606 1.309471
-v -2.309696 4.157348 1.543292
-v -2.637391 3.865052 1.762251
-v -2.939687 3.535534 1.964238
-v -3.213671 3.171967 2.147309
-v -3.456707 2.777852 2.309699
-v -3.666453 2.356984 2.449849
-v -3.840887 1.913417 2.566400
-v -3.978333 1.451423 2.658240
-v -4.077466 0.975451 2.724478
-v -4.137330 0.490085 2.764478
-v -4.157346 -0.000001 2.777852
-v -4.137330 -0.490087 2.764478
-v -4.077466 -0.975453 2.724478
-v -3.978332 -1.451425 2.658240
-v -3.840887 -1.913419 2.566400
-v -3.666452 -2.356985 2.449847
-v -3.456707 -2.777853 2.309700
-v -3.213670 -3.171968 2.147308
-v -2.939686 -3.535536 1.964237
-v -2.637390 -3.865054 1.762250
-v -2.309695 -4.157350 1.543290
-v -1.959756 -4.409608 1.309470
-v -1.590944 -4.619399 1.063038
-v -1.206811 -4.784703 0.806368
-v -0.811054 -4.903927 0.541932
-v -0.407487 -4.975924 0.272277
-v -0.432216 4.975924 0.231027
-v -0.860271 4.903926 0.459826
-v -1.280040 4.784702 0.684198
-v -1.687481 4.619398 0.901980
-v -2.078672 4.409606 1.111075
-v -2.449843 4.157348 1.309470
-v -2.797422 3.865052 1.495255
-v -3.118060 3.535534 1.666639
-v -3.408669 3.171967 1.821974
-v -3.666452 2.777852 1.959760
-v -3.888925 2.356984 2.078676
-v -4.073943 1.913417 2.177569
-v -4.219729 1.451423 2.255494
-v -4.324878 0.975451 2.311697
-v -4.388374 0.490085 2.345636
-v -4.409605 -0.000001 2.356984
-v -4.388374 -0.490087 2.345636
-v -4.324878 -0.975453 2.311697
-v -4.219728 -1.451425 2.255494
-v -4.073943 -1.913419 2.177569
-v -3.888925 -2.356985 2.078675
-v -3.666452 -2.777853 1.959761
-v -3.408669 -3.171968 1.821973
-v -3.118060 -3.535536 1.666639
-v -2.797421 -3.865054 1.495254
-v -2.449842 -4.157350 1.309469
-v -2.078669 -4.409608 1.111074
-v -1.687479 -4.619399 0.901978
-v -1.280038 -4.784703 0.684196
-v -0.860267 -4.903927 0.459825
-v -0.432213 -4.975924 0.231025
-v -0.452780 4.975924 0.187549
-v -0.901199 4.903926 0.373290
-v -1.340939 4.784702 0.555437
-v -1.767765 4.619398 0.732234
-v -2.177567 4.409606 0.901979
-v -2.566397 4.157348 1.063038
-v -2.930512 3.865052 1.213859
-v -3.266405 3.535534 1.352991
-v -3.570840 3.171967 1.479092
-v -3.840887 2.777852 1.590948
-v -4.073945 2.356984 1.687485
-v -4.267765 1.913417 1.767767
-v -4.420487 1.451423 1.831027
-v -4.530638 0.975451 1.876652
-v -4.597156 0.490085 1.904205
-v -4.619396 -0.000001 1.913418
-v -4.597156 -0.490087 1.904205
-v -4.530638 -0.975453 1.876652
-v -4.420486 -1.451425 1.831027
-v -4.267765 -1.913419 1.767767
-v -4.073944 -2.356985 1.687484
-v -3.840887 -2.777853 1.590949
-v -3.570839 -3.171968 1.479091
-v -3.266404 -3.535536 1.352990
-v -2.930511 -3.865054 1.213859
-v -2.566396 -4.157350 1.063036
-v -2.177564 -4.409608 0.901978
-v -1.767763 -4.619399 0.732233
-v -1.340937 -4.784703 0.555436
-v -0.901195 -4.903927 0.373289
-v -0.452776 -4.975924 0.187548
-v -0.468983 4.975924 0.142265
-v -0.933448 4.903926 0.283160
-v -1.388925 4.784702 0.421327
-v -1.831024 4.619398 0.555436
-v -2.255491 4.409606 0.684197
-v -2.658235 4.157348 0.806367
-v -3.035380 3.865052 0.920773
-v -3.383293 3.535534 1.026311
-v -3.698622 3.171967 1.121966
-v -3.978332 2.777852 1.206814
-v -4.219730 2.356984 1.280043
-v -4.420486 1.913417 1.340940
-v -4.578673 1.451423 1.388926
-v -4.692766 0.975451 1.423535
-v -4.761663 0.490085 1.444436
-v -4.784700 -0.000001 1.451424
-v -4.761663 -0.490087 1.444436
-v -4.692766 -0.975453 1.423535
-v -4.578672 -1.451425 1.388927
-v -4.420486 -1.913419 1.340940
-v -4.219729 -2.356985 1.280042
-v -3.978333 -2.777853 1.206815
-v -3.698621 -3.171968 1.121965
-v -3.383292 -3.535536 1.026311
-v -3.035379 -3.865054 0.920773
-v -2.658234 -4.157350 0.806366
-v -2.255488 -4.409608 0.684196
-v -1.831022 -4.619399 0.555435
-v -1.388922 -4.784703 0.421326
-v -0.933445 -4.903927 0.283159
-v -0.468979 -4.975924 0.142264
-v -0.480669 4.975924 0.095612
-v -0.956708 4.903926 0.190302
-v -1.423534 4.784702 0.283159
-v -1.876650 4.619398 0.373289
-v -2.311693 4.409606 0.459825
-v -2.724472 4.157348 0.541932
-v -3.111015 3.865052 0.618820
-v -3.467597 3.535534 0.689748
-v -3.790784 3.171967 0.754035
-v -4.077464 2.777852 0.811058
-v -4.324877 2.356984 0.860273
-v -4.530635 1.913417 0.901199
-v -4.692764 1.451423 0.933449
-v -4.809700 0.975451 0.956708
-v -4.880314 0.490085 0.970755
-v -4.903924 -0.000001 0.975452
-v -4.880314 -0.490087 0.970755
-v -4.809700 -0.975453 0.956708
-v -4.692763 -1.451425 0.933450
-v -4.530635 -1.913419 0.901199
-v -4.324876 -2.356985 0.860272
-v -4.077465 -2.777853 0.811058
-v -3.790783 -3.171968 0.754034
-v -3.467597 -3.535536 0.689748
-v -3.111014 -3.865054 0.618820
-v -2.724471 -4.157350 0.541931
-v -2.311690 -4.409608 0.459825
-v -1.876647 -4.619399 0.373289
-v -1.423531 -4.784703 0.283158
-v -0.956704 -4.903927 0.190301
-v -0.480665 -4.975924 0.095611
-v -0.487726 4.975924 0.048037
-v -0.970754 4.903926 0.095611
-v -1.444433 4.784702 0.142265
-v -1.904202 4.619398 0.187548
-v -2.345632 4.409606 0.231025
-v -2.764472 4.157348 0.272277
-v -3.156690 3.865052 0.310907
-v -3.518507 3.535534 0.346543
-v -3.846438 3.171967 0.378842
-v -4.137327 2.777852 0.407490
-v -4.388373 2.356984 0.432218
-v -4.597152 1.913417 0.452779
-v -4.761662 1.451423 0.468983
-v -4.880314 0.975451 0.480668
-v -4.951965 0.490085 0.487726
-v -4.975922 -0.000001 0.490086
-v -4.951965 -0.490087 0.487726
-v -4.880314 -0.975453 0.480668
-v -4.761661 -1.451425 0.468983
-v -4.597152 -1.913419 0.452779
-v -4.388372 -2.356985 0.432217
-v -4.137328 -2.777853 0.407491
-v -3.846438 -3.171968 0.378841
-v -3.518506 -3.535536 0.346543
-v -3.156688 -3.865054 0.310907
-v -2.764471 -4.157350 0.272276
-v -2.345629 -4.409608 0.231025
-v -1.904200 -4.619399 0.187547
-v -1.444431 -4.784703 0.142264
-v -0.970750 -4.903927 0.095611
-v -0.487722 -4.975924 0.048037
-v -4.409607 2.356984 0.000000
-v -4.903928 0.975451 -0.000001
-v -4.975925 0.490085 -0.000000
-v -4.975925 -0.490087 -0.000000
-v -4.903928 -0.975453 -0.000001
-v -4.409606 -2.356985 -0.000000
-vt 0.418325 0.134504
-vt 0.400298 0.124661
-vt 0.422771 0.127088
-vt 0.275693 0.101862
-vt 0.258611 0.110737
-vt 0.269239 0.091095
-vt 0.383191 0.115267
-vt 0.367168 0.106413
-vt 0.389645 0.104501
-vt 0.240605 0.120149
-vt 0.221849 0.130006
-vt 0.236159 0.112733
-vt 0.352384 0.098183
-vt 0.338981 0.090658
-vt 0.360599 0.084480
-vt 0.202522 0.140214
-vt 0.182811 0.150674
-vt 0.200255 0.136433
-vt 0.101255 0.395047
-vt 0.080340 0.398961
-vt 0.101870 0.377066
-vt 0.476156 0.165763
-vt 0.456438 0.155154
-vt 0.477294 0.163863
-vt 0.256357 0.398961
-vt 0.234773 0.395047
-vt 0.256950 0.381601
-vt 0.319803 0.079277
-vt 0.306437 0.086056
-vt 0.310822 0.064297
-vt 0.437099 0.144701
-vt 0.440471 0.139076
-vt 0.291687 0.093608
-vt 0.284316 0.081314
-vt 0.405775 0.115526
-vt 0.253135 0.101602
-vt 0.374538 0.094119
-vt 0.218476 0.124381
-vt 0.315769 0.416822
-vt 0.297051 0.409901
-vt 0.316265 0.402297
-vt 0.041513 0.409901
-vt 0.023976 0.416822
-vt 0.042047 0.394278
-vt 0.458704 0.151374
-vt 0.298222 0.072353
-vt 0.444379 0.133808
-vt 0.213270 0.373795
-vt 0.190809 0.371820
-vt 0.213989 0.356662
-vt 0.275776 0.069802
-vt 0.412121 0.106971
-vt 0.246789 0.093047
-vt 0.168221 0.371159
-vt 0.145725 0.371820
-vt 0.168955 0.353690
-vt 0.383078 0.082607
-vt 0.214568 0.119113
-vt 0.123537 0.373795
-vt 0.124256 0.356662
-vt 0.297585 0.394278
-vt 0.316832 0.388793
-vt 0.080933 0.381601
-vt 0.060928 0.387357
-vt 0.081610 0.365462
-vt 0.277749 0.387357
-vt 0.278396 0.371951
-vt 0.024472 0.402297
-vt 0.042656 0.379753
-vt 0.461330 0.147833
-vt 0.235388 0.377066
-vt 0.236090 0.360349
-vt 0.288703 0.059521
-vt 0.427923 0.120143
-vt 0.191539 0.354435
-vt 0.261760 0.081013
-vt 0.397124 0.094419
-vt 0.231008 0.105788
-vt 0.146455 0.354435
-vt 0.347962 0.075678
-vt 0.370118 0.071648
-vt 0.181672 0.148775
-vt 0.197629 0.132893
-vt 0.102571 0.360349
-vt 0.298194 0.379753
-vt 0.061574 0.371951
-vt 0.478614 0.162084
-vt 0.257628 0.365462
-vt 0.300416 0.050269
-vt 0.464291 0.144567
-vt 0.236872 0.345058
-vt 0.277972 0.047683
-vt 0.433731 0.113737
-vt 0.192352 0.338532
-vt 0.253328 0.071713
-vt 0.405556 0.085118
-vt 0.225200 0.099382
-vt 0.518765 0.338532
-vt 0.541203 0.340989
-vt 0.517951 0.354435
-vt 0.358368 0.061650
-vt 0.380849 0.059811
-vt 0.180353 0.146996
-vt 0.194668 0.129627
-vt 0.563284 0.345058
-vt 0.584796 0.350699
-vt 0.562502 0.360349
-vt 0.298874 0.366466
-vt 0.605529 0.357858
-vt 0.625287 0.366466
-vt 0.604809 0.371951
-vt 0.480101 0.160444
-vt 0.258383 0.350699
-vt 0.288685 0.037329
-vt 0.448784 0.128948
-vt 0.214790 0.340989
-vt 0.266148 0.059182
-vt 0.419275 0.099080
-vt 0.239635 0.085156
-vt 0.496185 0.337711
-vt 0.495367 0.353690
-vt 0.392706 0.071986
-vt 0.210163 0.114253
-vt 0.540402 0.356662
-vt 0.347942 0.052707
-vt 0.370100 0.048709
-vt 0.584040 0.365462
-vt 0.279117 0.357858
-vt 0.643876 0.376441
-vt 0.624607 0.379753
-vt 0.481743 0.158956
-vt 0.408023 0.365462
-vt 0.428984 0.360349
-vt 0.407346 0.381601
-vt 0.275741 0.025600
-vt 0.453645 0.124544
-vt 0.450669 0.356662
-vt 0.472868 0.354435
-vt 0.449950 0.373795
-vt 0.255526 0.049556
-vt 0.427168 0.091927
-vt 0.231742 0.078003
-vt 0.494634 0.371159
-vt 0.403329 0.062361
-vt 0.205302 0.109849
-vt 0.539683 0.373795
-vt 0.360561 0.038787
-vt 0.383043 0.036980
-vt 0.583363 0.381601
-vt 0.387987 0.371951
-vt 0.387340 0.387357
-vt 0.643245 0.388793
-vt 0.623997 0.394278
-vt 0.467558 0.141607
-vt 0.428282 0.377066
-vt 0.266132 0.036955
-vt 0.440138 0.107931
-vt 0.472138 0.371820
-vt 0.244026 0.063283
-vt 0.414858 0.076689
-vt 0.218792 0.093575
-vt 0.517222 0.371820
-vt 0.392689 0.049082
-vt 0.178865 0.145355
-vt 0.191402 0.126667
-vt 0.561801 0.377066
-vt 0.369069 0.379753
-vt 0.368460 0.394278
-vt 0.604162 0.387357
-vt 0.406752 0.398961
-vt 0.642678 0.402297
-vt 0.623464 0.409901
-vt 0.471099 0.138981
-vt 0.427668 0.395047
-vt 0.253297 0.027438
-vt 0.447085 0.102780
-vt 0.471499 0.390519
-vt 0.233941 0.055806
-vt 0.424943 0.069211
-vt 0.211846 0.088425
-vt 0.516583 0.390519
-vt 0.405524 0.039565
-vt 0.177224 0.143868
-vt 0.187860 0.124041
-vt 0.582770 0.398961
-vt 0.367926 0.409901
-vt 0.603596 0.403928
-vt 0.483522 0.157637
-vt 0.261710 0.015196
-vt 0.458914 0.120637
-vt 0.449320 0.392224
-vt 0.435724 0.085583
-vt 0.223185 0.071659
-vt 0.493992 0.389949
-vt 0.414844 0.053823
-vt 0.200033 0.105942
-vt 0.539053 0.392224
-vt 0.350885 0.402297
-vt 0.350389 0.416822
-vt 0.386774 0.403928
-vt 0.367473 0.426472
-vt 0.603115 0.421505
-vt 0.485422 0.156499
-vt 0.406249 0.417374
-vt 0.642182 0.416822
-vt 0.659570 0.424624
-vt 0.641760 0.432228
-vt 0.464541 0.117265
-vt 0.448785 0.411771
-vt 0.244011 0.041018
-vt 0.231714 0.033649
-vt 0.444862 0.080107
-vt 0.214048 0.066183
-vt 0.493447 0.409879
-vt 0.427140 0.046454
-vt 0.194406 0.102570
-vt 0.561186 0.395047
-vt 0.538518 0.411771
-vt 0.349967 0.432228
-vt 0.582267 0.417374
-vt 0.623011 0.426472
-vt 0.474880 0.136715
-vt 0.427147 0.414119
-vt 0.239591 0.019224
-vt 0.454502 0.098335
-vt 0.470957 0.410353
-vt 0.223172 0.049352
-vt 0.435712 0.062758
-vt 0.204428 0.083980
-vt 0.516040 0.410353
-vt 0.397075 0.026576
-vt 0.419231 0.031352
-vt 0.175445 0.142549
-vt 0.184079 0.121775
-vt 0.349626 0.448367
-vt 0.581858 0.436663
-vt 0.386294 0.421505
-vt 0.405840 0.436663
-vt 0.622643 0.443832
-vt 0.478866 0.134831
-vt 0.426723 0.434098
-vt 0.225145 0.012393
-vt 0.462320 0.094638
-vt 0.470517 0.431131
-vt 0.211823 0.043985
-vt 0.447061 0.057391
-vt 0.196611 0.080283
-vt 0.515600 0.431131
-vt 0.412058 0.017597
-vt 0.433676 0.024521
-vt 0.173545 0.141410
-vt 0.180093 0.119891
-vt 0.560665 0.414119
-vt 0.385903 0.439918
-vt 0.602725 0.439918
-vt 0.487424 0.155552
-vt 0.659185 0.438717
-vt 0.641419 0.448367
-vt 0.470471 0.114461
-vt 0.448352 0.432248
-vt 0.218754 0.027521
-vt 0.454492 0.075554
-vt 0.204418 0.061629
-vt 0.493005 0.430758
-vt 0.188476 0.099766
-vt 0.538085 0.432248
-vt 0.427850 0.010130
-vt 0.448721 0.019138
-vt 0.171543 0.140464
-vt 0.175942 0.118405
-vt 0.560242 0.434098
-vt 0.581548 0.456642
-vt 0.367105 0.443832
-vt 0.366826 0.461813
-vt 0.602429 0.458990
-vt 0.489510 0.154806
-vt 0.405530 0.456642
-vt 0.658872 0.453480
-vt 0.641159 0.465084
-vt 0.476648 0.112251
-vt 0.448023 0.453458
-vt 0.205256 0.022692
-vt 0.464522 0.071965
-vt 0.194388 0.058041
-vt 0.492670 0.452383
-vt 0.440100 0.040325
-vt 0.453599 0.035496
-vt 0.182300 0.097556
-vt 0.537755 0.453458
-vt 0.622364 0.461813
-vt 0.483017 0.133346
-vt 0.210100 0.007011
-vt 0.470463 0.091725
-vt 0.470183 0.452653
-vt 0.200002 0.039756
-vt 0.458882 0.053162
-vt 0.188468 0.077370
-vt 0.515266 0.452653
-vt 0.467505 0.032013
-vt 0.175936 0.095962
-vt 0.559921 0.454792
-vt 0.537534 0.475197
-vt 0.349366 0.465084
-vt 0.366638 0.480242
-vt 0.581340 0.477120
-vt 0.385608 0.458990
-vt 0.405322 0.477120
-vt 0.622176 0.480242
-vt 0.487294 0.132275
-vt 0.426402 0.454792
-vt 0.447801 0.475197
-vt 0.194599 0.003129
-vt 0.478852 0.089624
-vt 0.469958 0.474710
-vt 0.187823 0.036706
-vt 0.180079 0.075269
-vt 0.515042 0.474710
-vt 0.333397 0.468771
-vt 0.333237 0.484444
-vt 0.169457 0.139717
-vt 0.171666 0.117334
-vt 0.602230 0.478537
-vt 0.491658 0.154268
-vt 0.658635 0.468771
-vt 0.640985 0.482217
-vt 0.483011 0.110657
-vt 0.191349 0.019209
-vt 0.474856 0.069377
-vt 0.184054 0.055453
-vt 0.492444 0.474547
-vt 0.471061 0.050112
-vt 0.483480 0.048270
-vt 0.171525 0.074000
-vt 0.537423 0.497254
-vt 0.349192 0.482217
-vt 0.333157 0.500347
-vt 0.167308 0.139179
-vt 0.167305 0.116688
-vt 0.559705 0.476002
-vt 0.581235 0.497897
-vt 0.385409 0.478537
-vt 0.366544 0.498941
-vt 0.602131 0.498371
-vt 0.493849 0.153943
-vt 0.426187 0.476002
-vt 0.405217 0.497897
-vt 0.658475 0.484444
-vt 0.640897 0.499602
-vt 0.489500 0.109695
-vt 0.447690 0.497254
-vt 0.177168 0.017105
-vt 0.485393 0.067814
-vt 0.173516 0.053890
-vt 0.492331 0.497037
-vt 0.464222 0.015256
-vt 0.481687 0.029910
-vt 0.169447 0.095000
-vt 0.622082 0.498941
-vt 0.491655 0.131628
-vt 0.178793 0.000784
-vt 0.487406 0.088355
-vt 0.469846 0.497092
-vt 0.175403 0.034864
-vt 0.496033 0.067292
-vt 0.162876 0.053367
-vt 0.514929 0.497092
-vt 0.492331 0.519636
-vt 0.480029 0.012912
-vt 0.496006 0.029206
-vt 0.162895 0.094678
-vt 0.559596 0.497524
-vt 0.537423 0.519419
-vt 0.349104 0.499602
-vt 0.366544 0.517731
-vt 0.581235 0.518776
-vt 0.385309 0.498371
-vt 0.405217 0.518776
-vt 0.622082 0.517731
-vt 0.496058 0.131411
-vt 0.426078 0.497524
-vt 0.447690 0.519419
-vt 0.162832 0.000000
-vt 0.496044 0.087931
-vt 0.469846 0.519581
-vt 0.162864 0.034248
-vt 0.162887 0.073576
-vt 0.333157 0.516326
-vt 0.165117 0.138854
-vt 0.162901 0.116471
-vt 0.602131 0.518302
-vt 0.496062 0.153834
-vt 0.658395 0.500347
-vt 0.640897 0.517071
-vt 0.496052 0.109373
-vt 0.162849 0.016402
-vt 0.506673 0.067814
-vt 0.469958 0.541963
-vt 0.150324 0.034864
-vt 0.496020 0.047654
-vt 0.508560 0.048269
-vt 0.154249 0.074000
-vt 0.514929 0.519581
-vt 0.537534 0.541476
-vt 0.349104 0.517071
-vt 0.333237 0.532229
-vt 0.162905 0.138746
-vt 0.158498 0.116687
-vt 0.559596 0.519149
-vt 0.581340 0.539553
-vt 0.385309 0.518302
-vt 0.366638 0.536431
-vt 0.602230 0.538136
-vt 0.498274 0.153942
-vt 0.426078 0.519149
-vt 0.405322 0.539554
-vt 0.658395 0.516326
-vt 0.640985 0.534456
-vt 0.502604 0.109695
-vt 0.447801 0.541476
-vt 0.148530 0.017105
-vt 0.152236 0.053890
-vt 0.492444 0.542126
-vt 0.495989 0.012127
-vt 0.510325 0.029909
-vt 0.156343 0.095000
-vt 0.349192 0.534456
-vt 0.622176 0.536431
-vt 0.500462 0.131628
-vt 0.146872 0.000783
-vt 0.504681 0.088355
-vt 0.509093 0.110657
-vt 0.448023 0.563215
-vt 0.134348 0.019207
-vt 0.517211 0.069376
-vt 0.141699 0.055452
-vt 0.515042 0.541963
-vt 0.492670 0.564290
-vt 0.511949 0.012911
-vt 0.524506 0.032012
-vt 0.149854 0.095962
-vt 0.559705 0.540671
-vt 0.537755 0.563215
-vt 0.349366 0.551589
-vt 0.581548 0.560031
-vt 0.385409 0.538136
-vt 0.405530 0.560031
-vt 0.622364 0.554860
-vt 0.504823 0.132274
-vt 0.426187 0.540671
-vt 0.131065 0.003127
-vt 0.513236 0.089623
-vt 0.470183 0.564020
-vt 0.137904 0.036705
-vt 0.520980 0.050111
-vt 0.145695 0.075268
-vt 0.333397 0.547901
-vt 0.160692 0.138854
-vt 0.154137 0.117334
-vt 0.366826 0.554860
-vt 0.602429 0.557683
-vt 0.500465 0.154267
-vt 0.658475 0.532229
-vt 0.641159 0.551589
-vt 0.509099 0.133345
-vt 0.426402 0.561881
-vt 0.448352 0.584425
-vt 0.115565 0.007009
-vt 0.521625 0.091724
-vt 0.470517 0.585542
-vt 0.125726 0.039755
-vt 0.533158 0.053160
-vt 0.137306 0.077369
-vt 0.515266 0.564020
-vt 0.538085 0.584425
-vt 0.527756 0.015255
-vt 0.530698 0.000000
-vt 0.543257 0.019136
-vt 0.158501 0.139179
-vt 0.149860 0.118405
-vt 0.559921 0.561881
-vt 0.581858 0.580010
-vt 0.385608 0.557683
-vt 0.385903 0.576755
-vt 0.602725 0.576755
-vt 0.502614 0.154805
-vt 0.405840 0.580010
-vt 0.658635 0.547902
-vt 0.641419 0.568306
-vt 0.515457 0.112250
-vt 0.120442 0.022690
-vt 0.527544 0.071964
-vt 0.131365 0.058040
-vt 0.493005 0.585915
-vt 0.538413 0.035494
-vt 0.143491 0.097555
-vt 0.349626 0.568306
-vt 0.504699 0.155551
-vt 0.426723 0.582575
-vt 0.406249 0.599299
-vt 0.658872 0.563193
-vt 0.641760 0.584445
-vt 0.521633 0.114460
-vt 0.448785 0.604902
-vt 0.113904 0.043983
-vt 0.544980 0.057389
-vt 0.121335 0.061627
-vt 0.515600 0.585542
-vt 0.493447 0.606794
-vt 0.551911 0.040323
-vt 0.137314 0.099764
-vt 0.560242 0.582575
-vt 0.538518 0.604902
-vt 0.367105 0.572841
-vt 0.349967 0.584445
-vt 0.582267 0.599299
-vt 0.622643 0.572841
-vt 0.513250 0.134830
-vt 0.100519 0.012390
-vt 0.529767 0.094636
-vt 0.470957 0.606320
-vt 0.129163 0.080281
-vt 0.547644 0.004243
-vt 0.558302 0.024518
-vt 0.156353 0.139717
-vt 0.145709 0.119890
-vt 0.367473 0.590201
-vt 0.603115 0.595168
-vt 0.386294 0.595168
-vt 0.406752 0.617712
-vt 0.623011 0.590201
-vt 0.642182 0.599851
-vt 0.517236 0.136714
-vt 0.427147 0.602554
-vt 0.449320 0.624449
-vt 0.106943 0.027518
-vt 0.086074 0.019220
-vt 0.537575 0.075552
-vt 0.537585 0.098333
-vt 0.471499 0.626154
-vt 0.102555 0.049349
-vt 0.556329 0.062755
-vt 0.121345 0.083978
-vt 0.516040 0.606320
-vt 0.539053 0.624449
-vt 0.564092 0.010126
-vt 0.572748 0.031348
-vt 0.154267 0.140463
-vt 0.141723 0.121774
-vt 0.560665 0.602554
-vt 0.582770 0.617712
-vt 0.367926 0.606772
-vt 0.603596 0.612745
-vt 0.506702 0.156498
-vt 0.659185 0.577956
-vt 0.527563 0.117263
-vt 0.093984 0.033646
-vt 0.111705 0.066181
-vt 0.493992 0.626724
-vt 0.564871 0.046450
-vt 0.131384 0.102568
-vt 0.350389 0.599851
-vt 0.386774 0.612745
-vt 0.368460 0.622395
-vt 0.623464 0.606772
-vt 0.604162 0.629316
-vt 0.508602 0.157637
-vt 0.427668 0.621626
-vt 0.407346 0.635072
-vt 0.078901 0.006213
-vt 0.063918 0.015191
-vt 0.533190 0.120635
-vt 0.449950 0.642878
-vt 0.081687 0.041014
-vt 0.547205 0.080105
-vt 0.556342 0.085580
-vt 0.102567 0.071656
-vt 0.516583 0.626154
-vt 0.494634 0.645514
-vt 0.577168 0.053819
-vt 0.125757 0.105940
-vt 0.561186 0.621626
-vt 0.539683 0.642878
-vt 0.350885 0.614376
-vt 0.583363 0.635072
-vt 0.642678 0.614376
-vt 0.521017 0.138980
-vt 0.072367 0.027433
-vt 0.545003 0.102778
-vt 0.472138 0.644853
-vt 0.091786 0.055802
-vt 0.567098 0.069208
-vt 0.113928 0.088422
-vt 0.579883 0.017593
-vt 0.586454 0.039561
-vt 0.152265 0.141410
-vt 0.137942 0.124040
-vt 0.594867 0.026571
-vt 0.602326 0.014976
-vt 0.608898 0.036975
-vt 0.584040 0.651211
-vt 0.387340 0.629316
-vt 0.408023 0.651211
-vt 0.623997 0.622395
-vt 0.643245 0.627880
-vt 0.524558 0.141606
-vt 0.428282 0.639607
-vt 0.450669 0.660011
-vt 0.059533 0.036949
-vt 0.551949 0.107928
-vt 0.472868 0.662238
-vt 0.081702 0.063279
-vt 0.577182 0.076685
-vt 0.106981 0.093572
-vt 0.517222 0.644853
-vt 0.540402 0.660011
-vt 0.599289 0.049077
-vt 0.150365 0.142548
-vt 0.134401 0.126666
-vt 0.561801 0.639607
-vt 0.369069 0.636920
-vt 0.604809 0.644722
-vt 0.510381 0.158956
-vt 0.049886 0.025594
-vt 0.538459 0.124542
-vt 0.070172 0.049551
-vt 0.094011 0.078000
-vt 0.495367 0.662983
-vt 0.588683 0.062356
-vt 0.120488 0.109847
-vt 0.611129 0.059805
-vt 0.148586 0.143867
-vt 0.131134 0.129625
-vt 0.562502 0.656324
-vt 0.584795 0.665974
-vt 0.387987 0.644722
-vt 0.369749 0.650207
-vt 0.980674 0.936496
-vt 0.972066 0.956253
-vt 0.966582 0.935775
-vt 0.512022 0.160443
-vt 0.428984 0.656324
-vt 0.408778 0.665974
-vt 0.036943 0.037323
-vt 0.543320 0.128946
-vt 0.451470 0.675684
-vt 0.059549 0.059177
-vt 0.564898 0.091924
-vt 0.572792 0.099076
-vt 0.086118 0.085152
-vt 0.517951 0.662238
-vt 0.496185 0.678962
-vt 0.599305 0.071981
-vt 0.115627 0.114251
-vt 0.541203 0.675684
-vt 0.617418 0.026166
-vt 0.621842 0.048703
-vt 0.987833 0.915762
-vt 0.973070 0.915007
-vt 0.980674 0.719674
-vt 0.987833 0.739744
-vt 0.973070 0.738989
-vt 0.962091 0.974843
-vt 0.949739 0.974211
-vt 0.527825 0.144566
-vt 0.047692 0.047678
-vt 0.558357 0.113734
-vt 0.473681 0.678141
-vt 0.072399 0.071708
-vt 0.586485 0.085114
-vt 0.100574 0.099379
-vt 0.608933 0.082601
-vt 0.111222 0.119110
-vt 0.981870 0.871368
-vt 0.978183 0.893469
-vt 0.964737 0.870649
-vt 0.631341 0.038781
-vt 0.633573 0.061643
-vt 0.956931 0.914329
-vt 0.966581 0.718953
-vt 0.956931 0.738312
-vt 0.958779 0.955573
-vt 0.936235 0.973644
-vt 0.530786 0.147831
-vt 0.978183 0.759950
-vt 0.981870 0.781635
-vt 0.964737 0.780916
-vt 0.036961 0.059515
-vt 0.564165 0.120140
-vt 0.984097 0.803834
-vt 0.984842 0.826334
-vt 0.966712 0.803104
-vt 0.063967 0.081008
-vt 0.594917 0.094414
-vt 0.094766 0.105785
-vt 0.984097 0.848918
-vt 0.621860 0.071642
-vt 0.146944 0.145355
-vt 0.128173 0.132891
-vt 0.958779 0.700036
-vt 0.944254 0.699426
-vt 0.951175 0.935128
-vt 0.513510 0.162084
-vt 0.025211 0.050263
-vt 0.547725 0.133805
-vt 0.049921 0.069796
-vt 0.078964 0.093043
-vt 0.967373 0.825601
-vt 0.602396 0.104496
-vt 0.089614 0.112729
-vt 0.966712 0.848188
-vt 0.946308 0.870019
-vt 0.631379 0.084474
-vt 0.145457 0.146995
-vt 0.125547 0.136432
-vt 0.961466 0.892767
-vt 0.939571 0.913736
-vt 0.951175 0.718307
-vt 0.928631 0.698892
-vt 0.944254 0.954964
-vt 0.928631 0.954430
-vt 0.514829 0.163862
-vt 0.961466 0.759249
-vt 0.939571 0.737719
-vt 0.014805 0.064290
-vt 0.551633 0.139073
-vt 0.946308 0.780286
-vt 0.041381 0.081308
-vt 0.579946 0.106967
-vt 0.072618 0.101597
-vt 0.948583 0.824958
-vt 0.617473 0.094113
-vt 0.107314 0.124378
-vt 0.936235 0.681851
-vt 0.921710 0.681355
-vt 0.533412 0.151372
-vt 0.027442 0.072346
-vt 0.569316 0.127084
-vt 0.948013 0.802465
-vt 0.056488 0.091090
-vt 0.586292 0.115521
-vt 0.608850 0.115262
-vt 0.067141 0.110732
-vt 0.948013 0.847549
-vt 0.928179 0.847007
-vt 0.624843 0.106406
-vt 0.103942 0.130003
-vt 0.943485 0.892152
-vt 0.926761 0.869485
-vt 0.906304 0.680934
-vt 0.934604 0.934562
-vt 0.921158 0.913233
-vt 0.934604 0.717740
-vt 0.921158 0.737215
-vt 0.921710 0.973148
-vt 0.912060 0.953977
-vt 0.535679 0.155152
-vt 0.943485 0.758634
-vt 0.926761 0.779752
-vt 0.019227 0.086049
-vt 0.573762 0.134500
-vt 0.928179 0.801923
-vt 0.050034 0.101856
-vt 0.085168 0.120145
-vt 0.643979 0.075670
-vt 0.639594 0.098176
-vt 0.144137 0.148774
-vt 0.123280 0.140212
-vt 0.912060 0.698439
-vt 0.515968 0.165762
-vt 0.913908 0.990536
-vt 0.906304 0.972727
-vt 0.555005 0.144698
-vt 0.034011 0.093602
-vt 0.591768 0.124656
-vt 0.577460 0.142316
-vt 0.928653 0.824414
-vt 0.907401 0.801483
-vt 0.044666 0.113203
-vt 0.614218 0.126608
-vt 0.081471 0.127961
-vt 0.906284 0.869051
-vt 0.652960 0.090650
-vt 0.646426 0.112618
-vt 0.142999 0.150673
-vt 0.121395 0.144196
-vt 0.924413 0.891631
-vt 0.901869 0.912824
-vt 0.917027 0.717260
-vt 0.894700 0.698071
-vt 0.917027 0.934082
-vt 0.894700 0.953609
-vt 0.516915 0.167763
-vt 0.924413 0.758113
-vt 0.901869 0.736807
-vt 0.899815 0.990151
-vt 0.890165 0.972385
-vt 0.557810 0.150627
-vt 0.906284 0.779318
-vt 0.027881 0.106558
-vt 0.062586 0.120360
-vt 0.907401 0.846566
-vt 0.630973 0.119363
-vt 0.101137 0.135932
-vt 0.890165 0.680592
-vt 0.537564 0.159137
-vt 0.904434 0.757690
-vt 0.012395 0.100490
-vt 0.560020 0.156802
-vt 0.885074 0.778989
-vt 0.040436 0.125021
-vt 0.596323 0.134284
-vt 0.599912 0.144311
-vt 0.058997 0.130387
-vt 0.907774 0.823971
-vt 0.886149 0.823636
-vt 0.635803 0.132858
-vt 0.098927 0.142107
-vt 0.904434 0.891208
-vt 0.885074 0.868722
-vt 0.873448 0.680333
-vt 0.898614 0.933692
-vt 0.881890 0.912514
-vt 0.898614 0.716870
-vt 0.881890 0.736497
-vt 0.876719 0.953330
-vt 0.539049 0.163287
-vt 0.007012 0.115532
-vt 0.580373 0.150456
-vt 0.885880 0.801149
-vt 0.618448 0.138426
-vt 0.078557 0.136101
-vt 0.660429 0.106437
-vt 0.651810 0.127659
-vt 0.142051 0.152675
-vt 0.119910 0.148346
-vt 0.876719 0.697792
-vt 0.517661 0.169849
-vt 0.885052 0.989838
-vt 0.873448 0.972126
-vt 0.540120 0.167562
-vt 0.883740 0.757369
-vt 0.863335 0.778768
-vt 0.023052 0.120053
-vt 0.003129 0.131029
-vt 0.582475 0.158843
-vt 0.863822 0.800925
-vt 0.037385 0.137197
-vt 0.621499 0.150602
-vt 0.076456 0.144488
-vt 0.885880 0.846233
-vt 0.863335 0.868501
-vt 0.869761 0.664363
-vt 0.854088 0.664204
-vt 0.141305 0.154760
-vt 0.118839 0.152622
-vt 0.883740 0.890887
-vt 0.861413 0.912306
-vt 0.879542 0.716574
-vt 0.858290 0.697605
-vt 0.879542 0.933396
-vt 0.858290 0.953143
-vt 0.518199 0.171997
-vt 0.861413 0.736288
-vt 0.869761 0.989601
-vt 0.856315 0.971951
-vt 0.561614 0.163163
-vt 0.602500 0.154642
-vt 0.056409 0.140718
-vt 0.863985 0.823410
-vt 0.639286 0.146761
-vt 0.097333 0.148468
-vt 0.856315 0.680158
-vt 0.518524 0.174187
-vt 0.862530 0.757153
-vt 0.840635 0.736184
-vt 0.854088 0.989442
-vt 0.838930 0.971864
-vt 0.562577 0.169651
-vt 0.841278 0.778657
-vt 0.019568 0.133956
-vt 0.035543 0.149613
-vt 0.604063 0.165177
-vt 0.054846 0.151253
-vt 0.863822 0.846008
-vt 0.841495 0.823297
-vt 0.655692 0.143156
-vt 0.641390 0.160939
-vt 0.096370 0.154956
-vt 0.862530 0.890671
-vt 0.841278 0.868390
-vt 0.838930 0.680071
-vt 0.859995 0.933197
-vt 0.840635 0.912201
-vt 0.859995 0.716375
-vt 0.839591 0.953048
-vt 0.540767 0.171922
-vt 0.000784 0.146831
-vt 0.583743 0.167395
-vt 0.841440 0.800812
-vt 0.623341 0.163018
-vt 0.075187 0.153040
-vt 0.838185 0.664123
-vt 0.140767 0.156909
-vt 0.118192 0.156982
-vt 0.839591 0.697511
-vt 0.840161 0.716275
-vt 0.819756 0.736184
-vt 0.820801 0.953048
-vt 0.540983 0.176324
-vt 0.841008 0.757044
-vt 0.819113 0.778657
-vt 0.017465 0.148134
-vt 0.000000 0.162788
-vt 0.584168 0.176031
-vt 0.818951 0.800812
-vt 0.034927 0.162150
-vt 0.623957 0.175555
-vt 0.074763 0.161676
-vt 0.841440 0.845896
-vt 0.819113 0.868390
-vt 0.822206 0.664123
-vt 0.140442 0.159099
-vt 0.117976 0.161384
-vt 0.841008 0.890563
-vt 0.819756 0.912201
-vt 0.820801 0.697511
-vt 0.840161 0.933097
-vt 0.518633 0.176399
-vt 0.838185 0.989361
-vt 0.821461 0.971864
-vt 0.562899 0.176201
-vt 0.604586 0.175815
-vt 0.054323 0.161891
-vt 0.818951 0.845896
-vt 0.658037 0.158959
-vt 0.642093 0.175254
-vt 0.096049 0.161506
-vt 0.821461 0.680071
-vt 0.820231 0.716275
-vt 0.802101 0.697605
-vt 0.820231 0.933097
-vt 0.802101 0.953143
-vt 0.518524 0.178611
-vt 0.819383 0.757044
-vt 0.798979 0.736288
-vt 0.822206 0.989361
-vt 0.804076 0.971951
-vt 0.562577 0.182752
-vt 0.797056 0.778768
-vt 0.016761 0.162449
-vt 0.017465 0.176765
-vt 0.604063 0.186452
-vt 0.054846 0.172528
-vt 0.818896 0.823297
-vt 0.796569 0.846008
-vt 0.658821 0.174915
-vt 0.641390 0.189570
-vt 0.096370 0.168057
-vt 0.819383 0.890563
-vt 0.797056 0.868501
-vt 0.804076 0.680158
-vt 0.798979 0.912306
-vt 0.540767 0.180727
-vt 0.000784 0.178744
-vt 0.583743 0.184666
-vt 0.796569 0.800925
-vt 0.035543 0.174686
-vt 0.623341 0.188092
-vt 0.075187 0.170311
-vt 0.806303 0.664204
-vt 0.140333 0.161311
-vt 0.118192 0.165787
-vt 0.786943 0.680333
-vt 0.800396 0.933197
-vt 0.778501 0.912514
-vt 0.800396 0.716375
-vt 0.778501 0.736497
-vt 0.783672 0.953330
-vt 0.540120 0.185087
-vt 0.797862 0.757153
-vt 0.775317 0.778989
-vt 0.003129 0.194547
-vt 0.582474 0.193219
-vt 0.796407 0.823410
-vt 0.774512 0.801149
-vt 0.037385 0.187103
-vt 0.621498 0.200508
-vt 0.076456 0.178864
-vt 0.775317 0.868722
-vt 0.790631 0.664363
-vt 0.140442 0.163523
-vt 0.118839 0.170147
-vt 0.797862 0.890671
-vt 0.783672 0.697792
-vt 0.518199 0.180801
-vt 0.806303 0.989442
-vt 0.786943 0.972126
-vt 0.561614 0.189239
-vt 0.019568 0.190943
-vt 0.056409 0.183063
-vt 0.774512 0.846233
-vt 0.658037 0.190871
-vt 0.639286 0.203747
-vt 0.097333 0.174544
-vt 0.770226 0.680592
-vt 0.140767 0.165713
-vt 0.119910 0.174422
-vt 0.776652 0.890887
-vt 0.758522 0.912824
-vt 0.780849 0.716574
-vt 0.765691 0.698071
-vt 0.780849 0.933396
-vt 0.765691 0.953609
-vt 0.517661 0.182949
-vt 0.776652 0.757369
-vt 0.758522 0.736807
-vt 0.790631 0.989601
-vt 0.770226 0.972385
-vt 0.560020 0.195601
-vt 0.754107 0.779318
-vt 0.040436 0.199278
-vt 0.602500 0.196987
-vt 0.618448 0.212684
-vt 0.058998 0.193394
-vt 0.774242 0.823636
-vt 0.752990 0.846566
-vt 0.655692 0.206674
-vt 0.635803 0.217651
-vt 0.098927 0.180906
-vt 0.754107 0.869051
-vt 0.539049 0.189362
-vt 0.007011 0.210044
-vt 0.580373 0.201606
-vt 0.752990 0.801483
-vt 0.078557 0.187250
-vt 0.651810 0.222171
-vt 0.630973 0.231146
-vt 0.101137 0.187081
-vt 0.755957 0.891208
-vt 0.733630 0.869485
-vt 0.754087 0.680934
-vt 0.761777 0.933692
-vt 0.739233 0.913233
-vt 0.761777 0.716870
-vt 0.739233 0.737215
-vt 0.748331 0.953977
-vt 0.537564 0.193512
-vt 0.755957 0.757690
-vt 0.733630 0.779752
-vt 0.023052 0.204846
-vt 0.012395 0.225086
-vt 0.599912 0.207318
-vt 0.577460 0.209746
-vt 0.752617 0.823971
-vt 0.732213 0.801923
-vt 0.044666 0.211097
-vt 0.614218 0.224502
-vt 0.081471 0.195391
-vt 0.666314 0.226201
-vt 0.660429 0.242645
-vt 0.141305 0.167861
-vt 0.121395 0.178572
-vt 0.748331 0.698439
-vt 0.516915 0.185035
-vt 0.775339 0.989838
-vt 0.754087 0.972727
-vt 0.557810 0.201776
-vt 0.596323 0.217346
-vt 0.062586 0.203422
-vt 0.732212 0.847007
-vt 0.608850 0.235849
-vt 0.085168 0.203207
-vt 0.714083 0.870019
-vt 0.646426 0.237213
-vt 0.652960 0.258433
-vt 0.142051 0.169947
-vt 0.123280 0.182557
-vt 0.735978 0.891631
-vt 0.720820 0.913736
-vt 0.743364 0.717260
-vt 0.731760 0.698892
-vt 0.743364 0.934082
-vt 0.731760 0.954430
-vt 0.515968 0.187036
-vt 0.735978 0.758113
-vt 0.720820 0.737719
-vt 0.760576 0.990151
-vt 0.738681 0.973148
-vt 0.555005 0.207705
-vt 0.714083 0.780286
-vt 0.027881 0.218341
-vt 0.050034 0.222444
-vt 0.067141 0.213050
-vt 0.731739 0.824414
-vt 0.712378 0.847549
-vt 0.624843 0.244103
-vt 0.103942 0.193010
-vt 0.738681 0.681355
-vt 0.535679 0.197497
-vt 0.019227 0.239528
-vt 0.573762 0.217562
-vt 0.712378 0.802465
-vt 0.639594 0.251655
-vt 0.617473 0.256397
-vt 0.107314 0.198635
-vt 0.716906 0.892153
-vt 0.695654 0.870649
-vt 0.724156 0.681851
-vt 0.725787 0.934562
-vt 0.703460 0.914329
-vt 0.725787 0.717740
-vt 0.703460 0.738312
-vt 0.716137 0.954964
-vt 0.533412 0.201278
-vt 0.716906 0.758634
-vt 0.695654 0.780916
-vt 0.034011 0.231298
-vt 0.027442 0.253231
-vt 0.591768 0.226974
-vt 0.569316 0.224978
-vt 0.711808 0.824959
-vt 0.693679 0.803104
-vt 0.056488 0.233210
-vt 0.602396 0.246616
-vt 0.089614 0.210623
-vt 0.643979 0.273413
-vt 0.142999 0.171948
-vt 0.125547 0.186338
-vt 0.716137 0.699426
-vt 0.514829 0.188936
-vt 0.005824 0.247053
-vt 0.014805 0.262033
-vt 0.551633 0.213330
-vt 0.586292 0.236109
-vt 0.072618 0.222185
-vt 0.693679 0.848188
-vt 0.594917 0.256698
-vt 0.094766 0.217568
-vt 0.678521 0.871368
-vt 0.631379 0.265358
-vt 0.621860 0.278190
-vt 0.144137 0.173848
-vt 0.128173 0.189878
-vt 0.698925 0.892767
-vt 0.687321 0.915007
-vt 0.709216 0.718307
-vt 0.701612 0.700036
-vt 0.709216 0.935128
-vt 0.701612 0.955573
-vt 0.513510 0.190715
-vt 0.698925 0.759249
-vt 0.687321 0.738989
-vt 0.025211 0.276061
-vt 0.547725 0.218598
-vt 0.678521 0.781635
-vt 0.041381 0.243592
-vt 0.063967 0.243292
-vt 0.078964 0.230740
-vt 0.693018 0.825601
-vt 0.676294 0.848918
-vt 0.608933 0.267909
-vt 0.111222 0.203903
-vt 0.710652 0.682418
-vt 0.724156 0.973644
-vt 0.530786 0.204818
-vt 0.036961 0.266063
-vt 0.564165 0.231923
-vt 0.676294 0.803834
-vt 0.579946 0.244663
-vt 0.586485 0.265998
-vt 0.086118 0.238631
-vt 0.675549 0.826334
-vt 0.660391 0.849731
-vt 0.599305 0.278529
-vt 0.115627 0.208763
-vt 0.682208 0.893469
-vt 0.662848 0.872169
-vt 0.698300 0.648430
-vt 0.688325 0.629840
-vt 0.710653 0.647798
-vt 0.693810 0.935775
-vt 0.672558 0.915762
-vt 0.679717 0.610083
-vt 0.672558 0.589349
-vt 0.687321 0.588594
-vt 0.014785 0.285004
-vt 0.027404 0.298923
-vt 0.527825 0.208084
-vt 0.666917 0.567838
-vt 0.662848 0.545757
-vt 0.678521 0.544955
-vt 0.049921 0.255104
-vt 0.047692 0.277900
-vt 0.558357 0.238329
-vt 0.660391 0.523318
-vt 0.659570 0.500738
-vt 0.676294 0.522505
-vt 0.072399 0.252593
-vt 0.100574 0.223974
-vt 0.633573 0.287441
-vt 0.621842 0.300382
-vt 0.145457 0.175627
-vt 0.131134 0.193144
-vt 0.701612 0.629161
-vt 0.688325 0.956253
-vt 0.512022 0.192355
-vt 0.036943 0.289002
-vt 0.543320 0.223458
-vt 0.572792 0.252555
-vt 0.551949 0.244136
-vt 0.675549 0.499921
-vt 0.693679 0.521775
-vt 0.081702 0.261022
-vt 0.577182 0.274428
-vt 0.106981 0.229780
-vt 0.676294 0.477421
-vt 0.678521 0.455222
-vt 0.695654 0.454503
-vt 0.611129 0.290027
-vt 0.608898 0.312111
-vt 0.146944 0.177268
-vt 0.134401 0.196104
-vt 0.682208 0.433538
-vt 0.687321 0.412577
-vt 0.703460 0.411899
-vt 0.693810 0.609362
-vt 0.716137 0.628551
-vt 0.693810 0.392541
-vt 0.701612 0.373623
-vt 0.716137 0.373013
-vt 0.510381 0.193843
-vt 0.682208 0.567056
-vt 0.703460 0.587917
-vt 0.049887 0.300731
-vt 0.538459 0.227862
-vt 0.695654 0.544236
-vt 0.059549 0.265724
-vt 0.094011 0.245783
-vt 0.693018 0.499188
-vt 0.588683 0.288155
-vt 0.120488 0.213167
-vt 0.724156 0.647232
-vt 0.041326 0.311539
-vt 0.524558 0.211044
-vt 0.059533 0.288629
-vt 0.533190 0.231769
-vt 0.714083 0.543606
-vt 0.070172 0.275350
-vt 0.091786 0.268500
-vt 0.564898 0.259707
-vt 0.567098 0.281905
-vt 0.102567 0.252128
-vt 0.693679 0.476692
-vt 0.712378 0.476053
-vt 0.599289 0.300756
-vt 0.577168 0.296693
-vt 0.125757 0.217074
-vt 0.698925 0.432836
-vt 0.714083 0.453873
-vt 0.738681 0.646735
-vt 0.709216 0.391894
-vt 0.720820 0.411306
-vt 0.709216 0.608716
-vt 0.720820 0.587323
-vt 0.724156 0.355439
-vt 0.731760 0.372479
-vt 0.521017 0.213670
-vt 0.698925 0.566354
-vt 0.072367 0.298146
-vt 0.545003 0.249286
-vt 0.712378 0.521136
-vt 0.113928 0.234931
-vt 0.594867 0.322515
-vt 0.148586 0.178755
-vt 0.137942 0.198730
-vt 0.731760 0.628017
-vt 0.508602 0.195162
-vt 0.063918 0.311135
-vt 0.517236 0.215936
-vt 0.716906 0.565740
-vt 0.733630 0.543072
-vt 0.081687 0.283888
-vt 0.086074 0.306359
-vt 0.556342 0.266052
-vt 0.537585 0.253731
-vt 0.711808 0.498546
-vt 0.732213 0.520594
-vt 0.102555 0.274953
-vt 0.556329 0.288358
-vt 0.121345 0.239376
-vt 0.733630 0.453339
-vt 0.746483 0.664123
-vt 0.760576 0.663738
-vt 0.150365 0.180074
-vt 0.141723 0.200996
-vt 0.716906 0.432222
-vt 0.739233 0.410803
-vt 0.725787 0.608149
-vt 0.748332 0.627564
-vt 0.725787 0.391328
-vt 0.748332 0.372026
-vt 0.506702 0.196300
-vt 0.739233 0.586820
-vt 0.078901 0.320114
-vt 0.527563 0.235141
-vt 0.111705 0.257604
-vt 0.732213 0.475510
-vt 0.586454 0.310273
-vt 0.564871 0.304062
-vt 0.131384 0.220446
-vt 0.754087 0.646314
-vt 0.738681 0.354942
-vt 0.504699 0.197247
-vt 0.735978 0.565218
-vt 0.758522 0.586411
-vt 0.094693 0.327581
-vt 0.521633 0.237945
-vt 0.754107 0.542638
-vt 0.093983 0.291257
-vt 0.113904 0.280320
-vt 0.547205 0.271527
-vt 0.537575 0.276081
-vt 0.121335 0.262157
-vt 0.731739 0.498001
-vt 0.752990 0.475070
-vt 0.572748 0.318487
-vt 0.558302 0.325317
-vt 0.137314 0.223250
-vt 0.735978 0.431700
-vt 0.754107 0.452905
-vt 0.770226 0.645972
-vt 0.743364 0.390847
-vt 0.758522 0.410394
-vt 0.743364 0.607669
-vt 0.754087 0.354521
-vt 0.765691 0.371658
-vt 0.513250 0.217820
-vt 0.100519 0.313190
-vt 0.529767 0.257428
-vt 0.752990 0.520154
-vt 0.544980 0.293725
-vt 0.129163 0.243073
-vt 0.775339 0.663425
-vt 0.152265 0.181213
-vt 0.145709 0.202880
-vt 0.765691 0.627196
-vt 0.761777 0.607279
-vt 0.778502 0.586101
-vt 0.770226 0.354179
-vt 0.783672 0.371379
-vt 0.509099 0.219305
-vt 0.755957 0.564795
-vt 0.775317 0.542309
-vt 0.106943 0.297386
-vt 0.115564 0.318572
-vt 0.521625 0.260341
-vt 0.752617 0.497559
-vt 0.774512 0.519820
-vt 0.125726 0.284549
-vt 0.551911 0.310190
-vt 0.533158 0.297954
-vt 0.137306 0.245986
-vt 0.774512 0.474736
-vt 0.790631 0.663188
-vt 0.154267 0.182159
-vt 0.149860 0.204365
-vt 0.755957 0.431277
-vt 0.778502 0.410084
-vt 0.783672 0.626917
-vt 0.761777 0.390457
-vt 0.502614 0.197993
-vt 0.111141 0.333465
-vt 0.515457 0.240155
-vt 0.131365 0.265746
-vt 0.538413 0.315019
-vt 0.143491 0.225460
-vt 0.775317 0.452576
-vt 0.786943 0.645713
-vt 0.780849 0.606983
-vt 0.802101 0.626730
-vt 0.780849 0.390161
-vt 0.802101 0.371192
-vt 0.500465 0.198532
-vt 0.776652 0.564474
-vt 0.798979 0.585893
-vt 0.786943 0.353920
-vt 0.790631 0.337950
-vt 0.804076 0.353745
-vt 0.509093 0.241748
-vt 0.797056 0.542088
-vt 0.120442 0.302214
-vt 0.137904 0.287599
-vt 0.527544 0.279669
-vt 0.520980 0.301004
-vt 0.141699 0.268334
-vt 0.774242 0.497223
-vt 0.796569 0.474512
-vt 0.543257 0.330700
-vt 0.524506 0.318502
-vt 0.149854 0.227054
-vt 0.776652 0.430956
-vt 0.797056 0.452355
-vt 0.804076 0.645538
-vt 0.798979 0.409876
-vt 0.504823 0.220376
-vt 0.131065 0.322455
-vt 0.513236 0.262442
-vt 0.796569 0.519595
-vt 0.145695 0.248087
-vt 0.806303 0.663029
-vt 0.156353 0.182905
-vt 0.154137 0.205436
-vt 0.821461 0.645451
-vt 0.800396 0.389962
-vt 0.819757 0.409771
-vt 0.800396 0.606784
-vt 0.819757 0.585788
-vt 0.820801 0.371098
-vt 0.500462 0.221023
-vt 0.797862 0.564258
-vt 0.819113 0.541977
-vt 0.134348 0.305697
-vt 0.146872 0.324799
-vt 0.517211 0.282258
-vt 0.504681 0.263711
-vt 0.796407 0.496998
-vt 0.818951 0.519483
-vt 0.150324 0.289441
-vt 0.508560 0.302846
-vt 0.154249 0.249356
-vt 0.819113 0.452244
-vt 0.822206 0.662949
-vt 0.158501 0.183444
-vt 0.158498 0.206083
-vt 0.797862 0.430740
-vt 0.820801 0.626636
-vt 0.498274 0.198857
-vt 0.806303 0.337791
-vt 0.821461 0.353658
-vt 0.502604 0.242711
-vt 0.152236 0.269897
-vt 0.818951 0.474399
-vt 0.527756 0.334582
-vt 0.510325 0.320605
-vt 0.156343 0.228016
-vt 0.838185 0.662949
-vt 0.160692 0.183769
-vt 0.162901 0.206300
-vt 0.819383 0.430632
-vt 0.840635 0.409771
-vt 0.820231 0.606684
-vt 0.839591 0.626636
-vt 0.820231 0.389862
-vt 0.839591 0.371098
-vt 0.496062 0.198965
-vt 0.819383 0.564150
-vt 0.840635 0.585788
-vt 0.822206 0.337711
-vt 0.838930 0.353658
-vt 0.496052 0.243033
-vt 0.841278 0.541977
-vt 0.148530 0.307801
-vt 0.162864 0.290057
-vt 0.506673 0.283821
-vt 0.496020 0.303463
-vt 0.162876 0.270419
-vt 0.818896 0.496884
-vt 0.841441 0.474399
-vt 0.511949 0.336926
-vt 0.496006 0.321309
-vt 0.162895 0.228338
-vt 0.841278 0.452244
-vt 0.838930 0.645451
-vt 0.496058 0.221240
-vt 0.162832 0.325583
-vt 0.496044 0.264135
-vt 0.841441 0.519483
-vt 0.162887 0.249780
-vt 0.495989 0.337711
-vt 0.481687 0.320606
-vt 0.169447 0.228016
-vt 0.841008 0.430632
-vt 0.863335 0.452355
-vt 0.856315 0.645538
-vt 0.840161 0.389862
-vt 0.861413 0.409876
-vt 0.840161 0.606684
-vt 0.861413 0.585893
-vt 0.858290 0.371192
-vt 0.491655 0.221023
-vt 0.841008 0.564150
-vt 0.863335 0.542088
-vt 0.162849 0.308504
-vt 0.178792 0.324800
-vt 0.496033 0.284343
-vt 0.487406 0.263711
-vt 0.841495 0.496884
-vt 0.863822 0.519595
-vt 0.175403 0.289442
-vt 0.483480 0.302847
-vt 0.171524 0.249356
-vt 0.854088 0.663029
-vt 0.162905 0.183877
-vt 0.167305 0.206084
-vt 0.858290 0.626730
-vt 0.493849 0.198857
-vt 0.838185 0.337711
-vt 0.856315 0.353745
-vt 0.489500 0.242711
-vt 0.173516 0.269897
-vt 0.863822 0.474512
-vt 0.471061 0.301006
-vt 0.180079 0.248088
-vt 0.885074 0.452576
-vt 0.869761 0.663188
-vt 0.165117 0.183769
-vt 0.171666 0.205437
-vt 0.862530 0.430740
-vt 0.881890 0.410084
-vt 0.859995 0.606784
-vt 0.876719 0.626917
-vt 0.859995 0.389962
-vt 0.876719 0.371379
-vt 0.491658 0.198532
-vt 0.862530 0.564258
-vt 0.881890 0.586101
-vt 0.854088 0.337791
-vt 0.873448 0.353920
-vt 0.483011 0.241749
-vt 0.885074 0.542309
-vt 0.177168 0.307801
-vt 0.187823 0.287600
-vt 0.485393 0.283821
-vt 0.184054 0.268335
-vt 0.863985 0.496998
-vt 0.886149 0.497223
-vt 0.480029 0.336927
-vt 0.467505 0.318503
-vt 0.175936 0.227054
-vt 0.873448 0.645713
-vt 0.194599 0.322456
-vt 0.478852 0.262443
-vt 0.885880 0.519820
-vt 0.474856 0.282259
-vt 0.458883 0.297956
-vt 0.194387 0.265747
-vt 0.885880 0.474736
-vt 0.907774 0.497559
-vt 0.464222 0.334583
-vt 0.453599 0.315021
-vt 0.182300 0.225461
-vt 0.883740 0.430956
-vt 0.906284 0.452905
-vt 0.890165 0.645972
-vt 0.879542 0.390161
-vt 0.901869 0.410394
-vt 0.879542 0.606983
-vt 0.901869 0.586411
-vt 0.894700 0.371658
-vt 0.487294 0.220377
-vt 0.483017 0.219306
-vt 0.883740 0.564474
-vt 0.906284 0.542638
-vt 0.191349 0.305699
-vt 0.210100 0.318575
-vt 0.470463 0.260342
-vt 0.907401 0.520154
-vt 0.200001 0.284551
-vt 0.188468 0.245987
-vt 0.885052 0.663425
-vt 0.167308 0.183444
-vt 0.175942 0.204366
-vt 0.894700 0.627196
-vt 0.489510 0.197994
-vt 0.197541 0.337711
-vt 0.214487 0.333468
-vt 0.476648 0.240156
-vt 0.464522 0.279671
-vt 0.462320 0.257430
-vt 0.928179 0.520594
-vt 0.211823 0.280322
-vt 0.447061 0.293728
-vt 0.196610 0.243075
-vt 0.907401 0.475070
-vt 0.926761 0.453339
-vt 0.899815 0.663738
-vt 0.169457 0.182906
-vt 0.180093 0.202881
-vt 0.904434 0.431277
-vt 0.921158 0.410803
-vt 0.898614 0.607279
-vt 0.912060 0.627564
-vt 0.898614 0.390457
-vt 0.912060 0.372026
-vt 0.487424 0.197248
-vt 0.904434 0.564795
-vt 0.921158 0.586820
-vt 0.230935 0.327584
-vt 0.470471 0.237946
-vt 0.926761 0.543072
-vt 0.205256 0.302217
-vt 0.204418 0.262159
-vt 0.928179 0.475510
-vt 0.448721 0.330702
-vt 0.440100 0.310193
-vt 0.188476 0.223251
-vt 0.906304 0.646314
-vt 0.890165 0.354179
-vt 0.478866 0.217821
-vt 0.225145 0.313193
-vt 0.464541 0.235142
-vt 0.946308 0.543606
-vt 0.218754 0.297388
-vt 0.223172 0.274956
-vt 0.454492 0.276083
-vt 0.435712 0.288361
-vt 0.214048 0.257606
-vt 0.928653 0.498001
-vt 0.948013 0.476053
-vt 0.433676 0.325320
-vt 0.427141 0.304065
-vt 0.194406 0.220448
-vt 0.924413 0.431700
-vt 0.946308 0.453873
-vt 0.921710 0.646735
-vt 0.917027 0.390847
-vt 0.939571 0.411306
-vt 0.917027 0.607669
-vt 0.939571 0.587323
-vt 0.906304 0.354521
-vt 0.928631 0.372479
-vt 0.474881 0.215937
-vt 0.924413 0.565218
-vt 0.239591 0.306363
-vt 0.454502 0.253733
-vt 0.948013 0.521136
-vt 0.204428 0.239378
-vt 0.913908 0.664123
-vt 0.171543 0.182160
-vt 0.184079 0.200997
-vt 0.928631 0.628017
-vt 0.485422 0.196301
-vt 0.246726 0.320118
-vt 0.483522 0.195163
-vt 0.943485 0.565740
-vt 0.956931 0.587917
-vt 0.261710 0.311139
-vt 0.458914 0.231771
-vt 0.964737 0.544236
-vt 0.231714 0.291261
-vt 0.233941 0.268503
-vt 0.444862 0.271530
-vt 0.424943 0.281909
-vt 0.223185 0.252131
-vt 0.948583 0.498546
-vt 0.966713 0.476692
-vt 0.419231 0.318490
-vt 0.414844 0.296697
-vt 0.200033 0.217076
-vt 0.943485 0.432222
-vt 0.964737 0.454503
-vt 0.936235 0.647232
-vt 0.934604 0.391328
-vt 0.956931 0.411899
-vt 0.934604 0.608149
-vt 0.921710 0.354942
-vt 0.944254 0.373013
-vt 0.471099 0.213671
-vt 0.253297 0.298150
-vt 0.447085 0.249288
-vt 0.966713 0.521775
-vt 0.211846 0.234933
-vt 0.412058 0.331498
-vt 0.405524 0.310278
-vt 0.173545 0.181213
-vt 0.187860 0.198731
-vt 0.944254 0.628551
-vt 0.951175 0.608716
-vt 0.973070 0.588594
-vt 0.269169 0.322735
-vt 0.284261 0.311545
-vt 0.467558 0.211045
-vt 0.961466 0.566354
-vt 0.981870 0.544955
-vt 0.244011 0.283892
-vt 0.266132 0.288634
-vt 0.435724 0.266055
-vt 0.440138 0.244138
-vt 0.967373 0.499188
-vt 0.984097 0.522505
-vt 0.244025 0.261026
-vt 0.414859 0.274432
-vt 0.218792 0.229783
-vt 0.981870 0.455222
-vt 0.397075 0.322519
-vt 0.383043 0.312116
-vt 0.175445 0.180075
-vt 0.191402 0.196105
-vt 0.961466 0.432836
-vt 0.973070 0.412576
-vt 0.958779 0.629161
-vt 0.951175 0.391894
-vt 0.958779 0.373623
-vt 0.481743 0.193843
-vt 0.275741 0.300736
-vt 0.453645 0.227864
-vt 0.231741 0.245787
-vt 0.984097 0.477421
-vt 0.403329 0.288159
-vt 0.205302 0.213169
-vt 0.949739 0.647798
-vt 0.298874 0.650207
-vt 0.279117 0.658815
-vt 0.298194 0.636920
-vt 0.062295 0.658815
-vt 0.043336 0.650207
-vt 0.042656 0.636920
-vt 0.480101 0.192356
-vt 0.978183 0.567056
-vt 0.987833 0.589349
-vt 0.288685 0.289008
-vt 0.448784 0.223460
-vt 0.997543 0.545757
-vt 0.255526 0.275355
-vt 0.253328 0.252597
-vt 0.427168 0.259711
-vt 0.405556 0.266002
-vt 0.239635 0.238635
-vt 0.169772 0.678962
-vt 0.147268 0.678141
-vt 0.168955 0.662983
-vt 0.392690 0.300761
-vt 0.392706 0.278534
-vt 0.210163 0.208765
-vt 0.978183 0.433538
-vt 0.997543 0.456024
-vt 0.317464 0.640232
-vt 0.316832 0.627880
-vt 0.966581 0.392541
-vt 0.987833 0.413332
-vt 0.966581 0.609362
-vt 0.298184 0.298930
-vt 0.464291 0.208085
-vt 0.277972 0.277906
-vt 0.433731 0.238332
-vt 0.192352 0.678141
-vt 0.191538 0.662238
-vt 0.225200 0.223977
-vt 0.370100 0.300388
-vt 0.177224 0.178755
-vt 0.194668 0.193145
-vt 0.316265 0.614376
-vt 0.081610 0.651211
-vt 0.061574 0.644722
-vt 0.080933 0.635072
-vt 0.278396 0.644722
-vt 0.257628 0.651211
-vt 0.256950 0.635072
-vt 0.310802 0.285011
-vt 0.461330 0.204820
-vt 0.236090 0.656324
-vt 0.213989 0.660011
-vt 0.213270 0.642878
-vt 0.266148 0.265729
-vt 0.288703 0.266069
-vt 0.419275 0.252559
-vt 0.427923 0.231926
-vt 0.190809 0.644853
-vt 0.261760 0.243297
-vt 0.397124 0.256702
-vt 0.231008 0.217571
-vt 0.146455 0.662238
-vt 0.124256 0.660011
-vt 0.123537 0.642878
-vt 0.380849 0.290033
-vt 0.370118 0.278196
-vt 0.178865 0.177268
-vt 0.197629 0.189880
-vt 0.102571 0.656324
-vt 0.297585 0.622395
-vt 0.042047 0.622395
-vt 0.478614 0.190715
-vt 0.300416 0.276068
-vt 0.444379 0.218601
-vt 0.246789 0.230744
-vt 0.168221 0.645514
-vt 0.383079 0.267914
-vt 0.214568 0.203906
-vt 0.358369 0.287448
-vt 0.360599 0.265365
-vt 0.180353 0.175628
-vt 0.200255 0.186339
-vt 0.101870 0.639607
-vt 0.080340 0.617712
-vt 0.277749 0.629316
-vt 0.297051 0.606772
-vt 0.060928 0.629316
-vt 0.041513 0.606772
-vt 0.477294 0.188937
-vt 0.235388 0.639607
-vt 0.256357 0.617712
-vt 0.310822 0.262040
-vt 0.440471 0.213333
-vt 0.212640 0.624449
-vt 0.275776 0.255110
-vt 0.269239 0.233215
-vt 0.412121 0.244668
-vt 0.389645 0.246621
-vt 0.253135 0.222189
-vt 0.145725 0.644853
-vt 0.145086 0.626154
-vt 0.374538 0.256402
-vt 0.218476 0.198638
-vt 0.122907 0.624449
-vt 0.315769 0.599851
-vt 0.024472 0.614376
-vt 0.298222 0.253237
-vt 0.422771 0.224982
-vt 0.190170 0.626154
-vt 0.236159 0.210627
-vt 0.367168 0.244109
-vt 0.221849 0.193013
-vt 0.101255 0.621626
-vt 0.122373 0.604902
-vt 0.315348 0.584445
-vt 0.060361 0.612745
-vt 0.079836 0.599299
-vt 0.277183 0.612745
-vt 0.255854 0.599299
-vt 0.023976 0.599851
-vt 0.041060 0.590201
-vt 0.458704 0.201279
-vt 0.456438 0.197499
-vt 0.234773 0.621626
-vt 0.212106 0.604902
-vt 0.284316 0.243598
-vt 0.306437 0.239535
-vt 0.405775 0.236113
-vt 0.418325 0.217566
-vt 0.167579 0.626724
-vt 0.189628 0.606320
-vt 0.275693 0.222449
-vt 0.383191 0.235855
-vt 0.240605 0.203211
-vt 0.144544 0.606320
-vt 0.333157 0.592049
-vt 0.332772 0.577956
-vt 0.181672 0.173849
-vt 0.202522 0.182559
-vt 0.296598 0.590201
-vt 0.476156 0.187037
-vt 0.437099 0.207708
-vt 0.258611 0.213055
-vt 0.377823 0.224508
-vt 0.244303 0.195395
-vt 0.144104 0.585542
-vt 0.332459 0.563193
-vt 0.182811 0.171949
-vt 0.204407 0.178574
-vt 0.100734 0.602554
-vt 0.079428 0.580010
-vt 0.276703 0.595168
-vt 0.296230 0.572841
-vt 0.059881 0.595168
-vt 0.040692 0.572841
-vt 0.475209 0.185036
-vt 0.234252 0.602554
-vt 0.255445 0.580010
-vt 0.319803 0.247061
-vt 0.313269 0.225093
-vt 0.434294 0.201779
-vt 0.211672 0.584425
-vt 0.291687 0.231304
-vt 0.281061 0.211102
-vt 0.400298 0.226979
-vt 0.263166 0.203427
-vt 0.167035 0.606794
-vt 0.352384 0.251662
-vt 0.361038 0.231152
-vt 0.224653 0.187084
-vt 0.121939 0.584425
-vt 0.315006 0.568306
-vt 0.023555 0.584445
-vt 0.454553 0.193514
-vt 0.414628 0.209750
-vt 0.189187 0.585542
-vt 0.395743 0.217351
-vt 0.373593 0.212690
-vt 0.266755 0.193399
-vt 0.166592 0.585915
-vt 0.143770 0.564020
-vt 0.345552 0.237220
-vt 0.356209 0.217658
-vt 0.226863 0.180909
-vt 0.100311 0.582575
-vt 0.121610 0.563215
-vt 0.314746 0.551589
-vt 0.059491 0.576755
-vt 0.079118 0.560031
-vt 0.276312 0.576755
-vt 0.255135 0.560031
-vt 0.023213 0.568306
-vt 0.040413 0.554860
-vt 0.453067 0.189364
-vt 0.233829 0.582575
-vt 0.211343 0.563215
-vt 0.297816 0.218348
-vt 0.318653 0.210051
-vt 0.411714 0.201610
-vt 0.188854 0.564020
-vt 0.285291 0.199284
-vt 0.247216 0.187255
-vt 0.332222 0.547902
-vt 0.183758 0.169948
-vt 0.205892 0.174424
-vt 0.295951 0.554860
-vt 0.474462 0.182951
-vt 0.327272 0.231273
-vt 0.432084 0.195604
-vt 0.392155 0.207323
-vt 0.409613 0.193223
-vt 0.166257 0.564290
-vt 0.188629 0.541963
-vt 0.288342 0.187109
-vt 0.370543 0.200514
-vt 0.249318 0.178868
-vt 0.143546 0.541963
-vt 0.332062 0.532229
-vt 0.184504 0.167863
-vt 0.206963 0.170149
-vt 0.099990 0.561881
-vt 0.078909 0.539553
-vt 0.276017 0.557683
-vt 0.295764 0.536431
-vt 0.059195 0.557683
-vt 0.040226 0.536431
-vt 0.473924 0.180802
-vt 0.233508 0.561881
-vt 0.254927 0.539553
-vt 0.022953 0.551589
-vt 0.006984 0.547901
-vt 0.006824 0.532229
-vt 0.430490 0.189242
-vt 0.211122 0.541476
-vt 0.302646 0.204853
-vt 0.269343 0.183068
-vt 0.340169 0.222179
-vt 0.352725 0.203754
-vt 0.228457 0.174547
-vt 0.121389 0.541476
-vt 0.314572 0.534456
-vt 0.451996 0.185089
-vt 0.322535 0.194555
-vt 0.429527 0.182755
-vt 0.211010 0.519419
-vt 0.306129 0.190950
-vt 0.290184 0.174693
-vt 0.389566 0.196992
-vt 0.368700 0.188098
-vt 0.270906 0.172533
-vt 0.166031 0.542126
-vt 0.143433 0.519581
-vt 0.336286 0.206682
-vt 0.350622 0.189577
-vt 0.229420 0.168060
-vt 0.099774 0.540671
-vt 0.121278 0.519419
-vt 0.314485 0.517071
-vt 0.058996 0.538136
-vt 0.078805 0.518776
-vt 0.275818 0.538136
-vt 0.254822 0.518776
-vt 0.022779 0.534456
-vt 0.040131 0.517731
-vt 0.451349 0.180729
-vt 0.233292 0.540671
-vt 0.324880 0.178752
-vt 0.408344 0.184671
-vt 0.188516 0.519581
-vt 0.250587 0.170316
-vt 0.331982 0.516326
-vt 0.185043 0.165714
-vt 0.207610 0.165789
-vt 0.295669 0.517732
-vt 0.473599 0.178612
-vt 0.006744 0.516326
-vt 0.451133 0.176327
-vt 0.233184 0.519149
-vt 0.211010 0.497254
-vt 0.308233 0.176772
-vt 0.325664 0.162796
-vt 0.388003 0.186457
-vt 0.407920 0.176035
-vt 0.165918 0.519636
-vt 0.188516 0.497092
-vt 0.290800 0.162156
-vt 0.368084 0.175561
-vt 0.251011 0.161680
-vt 0.121278 0.497254
-vt 0.331982 0.500347
-vt 0.185368 0.163524
-vt 0.207827 0.161387
-vt 0.099665 0.519149
-vt 0.078805 0.497897
-vt 0.275718 0.518302
-vt 0.295669 0.498942
-vt 0.058896 0.518302
-vt 0.040131 0.498941
-vt 0.473490 0.176400
-vt 0.254822 0.497897
-vt 0.022692 0.517071
-vt 0.006744 0.500347
-vt 0.429206 0.176205
-vt 0.271429 0.161896
-vt 0.165918 0.497037
-vt 0.333941 0.190879
-vt 0.349918 0.175261
-vt 0.229742 0.161510
-vt 0.314485 0.499602
-vt 0.473599 0.174188
-vt 0.233184 0.497524
-vt 0.254927 0.477120
-vt 0.022692 0.499602
-vt 0.006824 0.484444
-vt 0.429527 0.169654
-vt 0.211122 0.475197
-vt 0.308936 0.162457
-vt 0.290184 0.149619
-vt 0.387480 0.175820
-vt 0.368700 0.163024
-vt 0.270906 0.151259
-vt 0.143433 0.497092
-vt 0.166031 0.474548
-vt 0.333157 0.174923
-vt 0.350622 0.160946
-vt 0.229420 0.154959
-vt 0.099665 0.497524
-vt 0.121389 0.475197
-vt 0.314572 0.482217
-vt 0.058896 0.498371
-vt 0.078909 0.477120
-vt 0.275718 0.498371
-vt 0.040226 0.480242
-vt 0.451349 0.171924
-vt 0.324880 0.146839
-vt 0.408344 0.167400
-vt 0.188629 0.474710
-vt 0.250587 0.153044
-vt 0.332062 0.484444
-vt 0.185476 0.161312
-vt 0.207610 0.156984
-vt 0.295764 0.480242
-vt 0.275818 0.478537
-vt 0.255135 0.456642
-vt 0.022779 0.482217
-vt 0.040413 0.461813
-vt 0.451996 0.167564
-vt 0.233292 0.476002
-vt 0.211343 0.453458
-vt 0.308233 0.148141
-vt 0.322535 0.131037
-vt 0.388003 0.165183
-vt 0.409613 0.158847
-vt 0.188854 0.452653
-vt 0.288342 0.137203
-vt 0.370543 0.150608
-vt 0.249318 0.144492
-vt 0.143546 0.474710
-vt 0.121610 0.453458
-vt 0.314746 0.465084
-vt 0.185368 0.159100
-vt 0.206963 0.152624
-vt 0.099774 0.476002
-vt 0.079118 0.456642
-vt 0.295951 0.461813
-vt 0.058996 0.478537
-vt 0.473924 0.171998
-vt 0.006984 0.468771
-vt 0.430490 0.163167
-vt 0.269343 0.140724
-vt 0.166257 0.452383
-vt 0.333941 0.158967
-vt 0.352725 0.146768
-vt 0.228457 0.148472
-vt 0.276017 0.458990
-vt 0.296230 0.443832
-vt 0.059195 0.458990
-vt 0.040692 0.443832
-vt 0.474462 0.169850
-vt 0.233508 0.454793
-vt 0.255445 0.436663
-vt 0.022953 0.465084
-vt 0.007221 0.453480
-vt 0.432084 0.156805
-vt 0.211672 0.432248
-vt 0.306129 0.133963
-vt 0.285291 0.125027
-vt 0.389566 0.154648
-vt 0.373593 0.138432
-vt 0.266755 0.130393
-vt 0.143770 0.452653
-vt 0.166592 0.430758
-vt 0.336286 0.143164
-vt 0.356209 0.132865
-vt 0.226863 0.142110
-vt 0.099990 0.454792
-vt 0.121939 0.432248
-vt 0.315006 0.448367
-vt 0.079428 0.436663
-vt 0.453067 0.163289
-vt 0.318653 0.115540
-vt 0.411714 0.150460
-vt 0.189187 0.431131
-vt 0.247216 0.136105
-vt 0.332222 0.468772
-vt 0.185043 0.156910
-vt 0.205892 0.148349
-vt 0.315348 0.432228
-vt 0.059491 0.439918
-vt 0.079836 0.417374
-vt 0.276312 0.439918
-vt 0.255854 0.417374
-vt 0.023213 0.448367
-vt 0.041060 0.426472
-vt 0.454553 0.159139
-vt 0.233829 0.434098
-vt 0.212106 0.411771
-vt 0.302646 0.120060
-vt 0.313269 0.100498
-vt 0.392155 0.144317
-vt 0.414628 0.142320
-vt 0.189628 0.410353
-vt 0.281061 0.113209
-vt 0.377823 0.126614
-vt 0.244303 0.127965
-vt 0.144104 0.431131
-vt 0.122373 0.411771
-vt 0.332459 0.453480
-vt 0.184504 0.154761
-vt 0.204407 0.144199
-vt 0.100311 0.434098
-vt 0.296598 0.426472
-vt 0.475209 0.167765
-vt 0.333157 0.111509
-vt 0.434294 0.150630
-vt 0.263166 0.120365
-vt 0.167035 0.409879
-vt 0.340169 0.127667
-vt 0.361038 0.119370
-vt 0.224653 0.135935
-vt 0.212640 0.392224
-vt 0.144544 0.410353
-vt 0.122907 0.392224
-vt 0.190170 0.390519
-vt 0.167579 0.389949
-vt 0.145086 0.390519
-vt 0.277183 0.403928
-vt 0.060361 0.403928
-vt 0.162906 0.161287
-vt 0.496063 0.176424
-vt 0.183758 0.152676
-vt 0.332772 0.438717
-vt 0.100734 0.414119
-vt 0.276703 0.421505
-vt 0.059881 0.421505
-vt 0.234252 0.414119
-vt 0.327272 0.095065
-vt 0.297816 0.106565
-vt 0.395743 0.134289
-vt 0.345552 0.112625
-vt 0.023555 0.432228
-vt 0.025039 0.388793
-vt 0.169772 0.337711
-vt 0.374483 0.026172
-vt 0.444298 0.004246
-vt 0.659570 0.592049
-vt 0.624607 0.636920
-vt 0.563284 0.671615
-vt 0.388708 0.658815
-vt 0.429766 0.671615
-vt 0.518765 0.678141
-vt 0.643959 0.052699
-vt 0.666314 0.122881
-vt 0.775339 0.664600
-vt 0.746483 0.990536
-vt 0.693810 0.718953
-vt 0.682208 0.759950
-vt 0.710652 0.974211
-vt 0.659570 0.827151
-vt 0.666917 0.894251
-vt 0.679717 0.936496
-vt 0.869761 0.337950
-vt 0.936235 0.355439
-vt 0.984842 0.499921
-vt 0.993474 0.567838
-vt 1.000000 0.523318
-vt 0.993474 0.434320
-vt 0.980674 0.393261
-vt 0.980674 0.610083
-vt 1.000000 0.478235
-vt 0.347962 0.273421
-vt 0.333157 0.214830
-vt 0.333157 0.424624
-vn -0.383984 -0.923307 0.000000
-vn -0.472579 -0.881283 0.000000
-vn -0.382122 -0.923307 -0.037629
-vn -0.556627 0.830744 0.000000
-vn -0.472579 0.881283 0.000000
-vn -0.553941 0.830744 -0.054537
-vn -0.556627 -0.830744 0.000000
-vn -0.635304 -0.772240 0.000000
-vn -0.553941 -0.830744 -0.054537
-vn -0.383984 0.923307 0.000000
-vn -0.291665 0.956511 0.000000
-vn -0.382122 0.923307 -0.037629
-vn -0.707846 -0.706320 0.000000
-vn -0.773614 -0.633625 0.000000
-vn -0.704459 -0.706320 -0.069369
-vn -0.196539 0.980468 0.000000
-vn -0.099521 0.995025 0.000000
-vn -0.195593 0.980468 -0.019257
-vn -0.957060 0.289834 0.000000
-vn -0.924100 0.382122 0.000000
-vn -0.952452 0.289834 -0.093783
-vn -0.099521 -0.995025 0.000000
-vn -0.196539 -0.980468 0.000000
-vn -0.099033 -0.995025 -0.009735
-vn -0.924100 -0.382122 0.000000
-vn -0.957060 -0.289834 0.000000
-vn -0.919645 -0.382122 -0.090548
-vn -0.773614 0.633625 0.000000
-vn -0.707846 0.706320 0.000000
-vn -0.769890 0.633625 -0.075808
-vn -0.291665 -0.956511 0.000000
-vn -0.290262 -0.956511 -0.028565
-vn -0.635304 0.772240 0.000000
-vn -0.632221 0.772240 -0.062258
-vn -0.470290 -0.881283 -0.046297
-vn -0.470290 0.881283 -0.046297
-vn -0.632221 -0.772240 -0.062258
-vn -0.290262 0.956511 -0.028565
-vn -0.831935 -0.554857 0.000000
-vn -0.769890 -0.633625 -0.075808
-vn -0.831935 0.554857 0.000000
-vn -0.827906 0.554857 -0.081515
-vn -0.195593 -0.980468 -0.019257
-vn -0.704459 0.706320 -0.069369
-vn -0.286081 -0.956511 -0.056887
-vn -0.976104 -0.194769 -0.096133
-vn -0.990387 -0.097842 -0.097537
-vn -0.961974 -0.194769 -0.191351
-vn -0.623096 0.772240 -0.123936
-vn -0.463485 -0.881283 -0.092196
-vn -0.463485 0.881283 -0.092196
-vn -0.995178 0.000000 -0.097995
-vn -0.990387 0.097842 -0.097537
-vn -0.980773 0.000000 -0.195074
-vn -0.623096 -0.772240 -0.123936
-vn -0.286081 0.956511 -0.056887
-vn -0.976104 0.194769 -0.096133
-vn -0.961974 0.194769 -0.191351
-vn -0.827906 -0.554857 -0.081515
-vn -0.758751 -0.633625 -0.150914
-vn -0.919645 0.382122 -0.090548
-vn -0.877987 0.470748 -0.086459
-vn -0.906339 0.382122 -0.180273
-vn -0.877987 -0.470748 -0.086459
-vn -0.865291 -0.470748 -0.172094
-vn -0.815943 0.554857 -0.162297
-vn -0.192785 -0.980468 -0.038331
-vn -0.952452 -0.289834 -0.093783
-vn -0.938658 -0.289834 -0.186712
-vn -0.694266 0.706320 -0.138096
-vn -0.376598 -0.923307 -0.074892
-vn -0.976074 -0.097842 -0.194128
-vn -0.545915 0.830744 -0.108585
-vn -0.545915 -0.830744 -0.108585
-vn -0.376598 0.923307 -0.074892
-vn -0.976074 0.097842 -0.194128
-vn -0.694266 -0.706320 -0.138096
-vn -0.099033 0.995025 -0.009735
-vn -0.192785 0.980468 -0.038331
-vn -0.938658 0.289834 -0.186712
-vn -0.815943 -0.554857 -0.162297
-vn -0.865291 0.470748 -0.172094
-vn -0.097598 -0.995025 -0.019410
-vn -0.906339 -0.382122 -0.180273
-vn -0.758751 0.633625 -0.150914
-vn -0.188086 -0.980468 -0.057039
-vn -0.915830 -0.289834 -0.277810
-vn -0.677389 0.706320 -0.205481
-vn -0.367443 -0.923307 -0.111454
-vn -0.952330 -0.097842 -0.288888
-vn -0.532640 0.830744 -0.161565
-vn -0.532640 -0.830744 -0.161565
-vn -0.367443 0.923307 -0.111454
-vn -0.952330 0.097842 -0.288888
-vn -0.677389 -0.706320 -0.205481
-vn -0.097598 0.995025 -0.019410
-vn -0.188086 0.980468 -0.057039
-vn -0.915830 0.289834 -0.277810
-vn -0.796106 -0.554857 -0.241493
-vn -0.844264 0.470748 -0.256081
-vn -0.095248 -0.995025 -0.028871
-vn -0.884304 -0.382122 -0.268227
-vn -0.740287 0.633625 -0.224555
-vn -0.279122 -0.956511 -0.084658
-vn -0.938597 -0.194769 -0.284707
-vn -0.607929 0.772240 -0.184393
-vn -0.452223 -0.881283 -0.137181
-vn -0.452223 0.881283 -0.137181
-vn -0.956938 0.000000 -0.290262
-vn -0.607929 -0.772240 -0.184393
-vn -0.279122 0.956511 -0.084658
-vn -0.938597 0.194769 -0.284707
-vn -0.740287 -0.633625 -0.224555
-vn -0.884304 0.382122 -0.268227
-vn -0.844264 -0.470748 -0.256081
-vn -0.796106 0.554857 -0.241493
-vn -0.091952 -0.995025 -0.038087
-vn -0.853755 -0.382122 -0.353618
-vn -0.714713 0.633625 -0.296030
-vn -0.269478 -0.956511 -0.111606
-vn -0.906156 -0.194769 -0.375347
-vn -0.586932 0.772240 -0.243110
-vn -0.436598 -0.881283 -0.180822
-vn -0.436598 0.881283 -0.180822
-vn -0.923856 0.000000 -0.382672
-vn -0.586932 -0.772240 -0.243110
-vn -0.269478 0.956511 -0.111606
-vn -0.906156 0.194769 -0.375347
-vn -0.714713 -0.633625 -0.296030
-vn -0.853755 0.382122 -0.353618
-vn -0.815088 -0.470748 -0.337626
-vn -0.768609 0.554857 -0.318369
-vn -0.181585 -0.980468 -0.075198
-vn -0.884213 -0.289834 -0.366253
-vn -0.653981 0.706320 -0.270882
-vn -0.354747 -0.923307 -0.146947
-vn -0.919431 -0.097842 -0.380840
-vn -0.514237 0.830744 -0.212989
-vn -0.514237 -0.830744 -0.212989
-vn -0.354747 0.923307 -0.146947
-vn -0.919431 0.097842 -0.380840
-vn -0.653981 -0.706320 -0.270882
-vn -0.095248 0.995025 -0.028871
-vn -0.181585 0.980468 -0.075198
-vn -0.884213 0.289834 -0.366253
-vn -0.768609 -0.554857 -0.318369
-vn -0.815088 0.470748 -0.337626
-vn -0.814966 -0.382122 -0.435591
-vn -0.733696 0.554857 -0.392163
-vn -0.173345 -0.980468 -0.092654
-vn -0.844050 -0.289834 -0.451155
-vn -0.624287 0.706320 -0.333659
-vn -0.338633 -0.923307 -0.181005
-vn -0.877682 -0.097842 -0.469131
-vn -0.490890 0.830744 -0.262368
-vn -0.490890 -0.830744 -0.262368
-vn -0.338633 0.923307 -0.181005
-vn -0.877682 0.097842 -0.469131
-vn -0.624287 -0.706320 -0.333659
-vn -0.091952 0.995025 -0.038057
-vn -0.173345 0.980468 -0.092654
-vn -0.814966 0.382122 -0.435591
-vn -0.733696 -0.554857 -0.392163
-vn -0.778069 0.470748 -0.415876
-vn -0.087771 -0.995025 -0.046907
-vn -0.682272 0.633625 -0.364666
-vn -0.257241 -0.956511 -0.137486
-vn -0.865017 -0.194769 -0.462355
-vn -0.416761 -0.881283 -0.222755
-vn -0.416761 0.881283 -0.222755
-vn -0.881893 0.000000 -0.471389
-vn -0.560289 -0.772240 -0.299478
-vn -0.257241 0.956511 -0.137486
-vn -0.865017 0.194769 -0.462355
-vn -0.682272 -0.633625 -0.364666
-vn -0.778069 -0.470748 -0.415876
-vn -0.691733 -0.554857 -0.462172
-vn -0.733573 0.470748 -0.490158
-vn -0.082736 -0.995025 -0.055269
-vn -0.768334 -0.382122 -0.513382
-vn -0.643239 0.633625 -0.429792
-vn -0.242500 -0.956511 -0.162023
-vn -0.815516 -0.194769 -0.544908
-vn -0.560289 0.772240 -0.299478
-vn -0.528214 0.772240 -0.352947
-vn -0.392926 -0.881283 -0.262551
-vn -0.392926 0.881283 -0.262551
-vn -0.831446 0.000000 -0.555559
-vn -0.528214 -0.772240 -0.352947
-vn -0.242500 0.956511 -0.162023
-vn -0.844050 0.289834 -0.451155
-vn -0.815516 0.194769 -0.544908
-vn -0.643239 -0.633625 -0.429792
-vn -0.768334 0.382122 -0.513382
-vn -0.691733 0.554857 -0.462172
-vn -0.163427 -0.980468 -0.109195
-vn -0.795770 -0.289834 -0.531693
-vn -0.588549 0.706320 -0.393262
-vn -0.319254 -0.923338 -0.213324
-vn -0.827448 -0.097842 -0.552873
-vn -0.462813 0.830744 -0.309244
-vn -0.462813 -0.830744 -0.309244
-vn -0.319254 0.923307 -0.213324
-vn -0.827448 0.097842 -0.552873
-vn -0.588549 -0.706320 -0.393262
-vn -0.087771 0.995025 -0.046907
-vn -0.163427 0.980468 -0.109195
-vn -0.598010 -0.633625 -0.490768
-vn -0.714316 0.382122 -0.586230
-vn -0.733543 -0.470748 -0.490158
-vn -0.714316 -0.382122 -0.586230
-vn -0.643086 0.554857 -0.527757
-vn -0.151921 -0.980468 -0.124699
-vn -0.739799 -0.289834 -0.607135
-vn -0.547166 0.706320 -0.449049
-vn -0.296823 -0.923307 -0.243599
-vn -0.769280 -0.097842 -0.631336
-vn -0.430250 0.830744 -0.353099
-vn -0.430250 -0.830744 -0.353099
-vn -0.296823 0.923307 -0.243599
-vn -0.769280 0.097842 -0.631336
-vn -0.547166 -0.706320 -0.449049
-vn -0.082736 0.995025 -0.055300
-vn -0.151921 0.980468 -0.124699
-vn -0.795770 0.289834 -0.531693
-vn -0.681967 -0.470748 -0.559679
-vn -0.681997 0.470748 -0.559679
-vn -0.076937 -0.995025 -0.063143
-vn -0.598010 0.633625 -0.490768
-vn -0.225471 -0.956511 -0.185034
-vn -0.758202 -0.194769 -0.622211
-vn -0.491073 0.772240 -0.403027
-vn -0.365307 -0.881283 -0.299783
-vn -0.365307 0.881283 -0.299783
-vn -0.773003 0.000000 -0.634388
-vn -0.225471 0.956511 -0.185034
-vn -0.758202 0.194769 -0.622211
-vn -0.500534 -0.706320 -0.500534
-vn -0.076937 0.995025 -0.063112
-vn -0.138981 0.980468 -0.138981
-vn -0.739799 0.289834 -0.607135
-vn -0.653432 0.382122 -0.653432
-vn -0.643086 -0.554857 -0.527757
-vn -0.588244 -0.554857 -0.588244
-vn -0.623829 0.470748 -0.623829
-vn -0.070376 -0.995025 -0.070376
-vn -0.653432 -0.382122 -0.653432
-vn -0.547014 0.633625 -0.547014
-vn -0.206244 -0.956511 -0.206244
-vn -0.693533 -0.194769 -0.693533
-vn -0.449202 0.772240 -0.449202
-vn -0.334147 -0.881283 -0.334147
-vn -0.334147 0.881283 -0.334147
-vn -0.707083 0.000000 -0.707083
-vn -0.491073 -0.772240 -0.403027
-vn -0.449202 -0.772240 -0.449202
-vn -0.206244 0.956511 -0.206244
-vn -0.693533 0.194769 -0.693533
-vn -0.588244 0.554857 -0.588244
-vn -0.138981 -0.980468 -0.138981
-vn -0.500534 0.706320 -0.500534
-vn -0.271493 -0.923338 -0.271493
-vn -0.703696 -0.097842 -0.703696
-vn -0.393567 0.830744 -0.393567
-vn -0.393567 -0.830744 -0.393567
-vn -0.271493 0.923307 -0.271493
-vn -0.703696 0.097842 -0.703696
-vn -0.403027 -0.772240 -0.491073
-vn -0.185034 0.956511 -0.225471
-vn -0.676748 0.289834 -0.676748
-vn -0.622211 0.194769 -0.758202
-vn -0.547014 -0.633625 -0.547014
-vn -0.527757 -0.554857 -0.643086
-vn -0.586230 0.382122 -0.714316
-vn -0.623829 -0.470748 -0.623829
-vn -0.586230 -0.382122 -0.714316
-vn -0.527757 0.554857 -0.643086
-vn -0.124668 -0.980468 -0.151921
-vn -0.676748 -0.289834 -0.676748
-vn -0.622211 -0.194769 -0.758202
-vn -0.449049 0.706320 -0.547166
-vn -0.243599 -0.923307 -0.296823
-vn -0.631336 -0.097842 -0.769280
-vn -0.353099 0.830744 -0.430250
-vn -0.243599 0.923307 -0.296823
-vn -0.631336 0.097842 -0.769280
-vn -0.449049 -0.706320 -0.547166
-vn -0.070376 0.995025 -0.070376
-vn -0.124699 0.980468 -0.151921
-vn -0.559679 0.470748 -0.681997
-vn -0.063143 -0.995025 -0.076937
-vn -0.490768 0.633625 -0.598010
-vn -0.185034 -0.956511 -0.225471
-vn -0.403027 0.772240 -0.491073
-vn -0.299783 -0.881283 -0.365307
-vn -0.299783 0.881283 -0.365307
-vn -0.634388 0.000000 -0.773003
-vn -0.353099 -0.830744 -0.430250
-vn -0.309244 -0.830744 -0.462813
-vn -0.213324 0.923307 -0.319254
-vn -0.544908 0.194769 -0.815516
-vn -0.490768 -0.633625 -0.598010
-vn -0.393262 -0.706320 -0.588549
-vn -0.063143 0.995025 -0.076937
-vn -0.109195 0.980468 -0.163427
-vn -0.607135 0.289834 -0.739799
-vn -0.513382 0.382122 -0.768334
-vn -0.559679 -0.470748 -0.681967
-vn -0.462172 -0.554857 -0.691733
-vn -0.490158 0.470748 -0.733543
-vn -0.055269 -0.995025 -0.082736
-vn -0.607135 -0.289834 -0.739799
-vn -0.513382 -0.382122 -0.768334
-vn -0.429792 0.633625 -0.643239
-vn -0.162023 -0.956511 -0.242500
-vn -0.544908 -0.194769 -0.815516
-vn -0.352947 0.772240 -0.528214
-vn -0.262551 -0.881283 -0.392926
-vn -0.262551 0.881283 -0.392926
-vn -0.555559 0.000000 -0.831446
-vn -0.352947 -0.772240 -0.528214
-vn -0.162023 0.956511 -0.242500
-vn -0.462172 0.554857 -0.691733
-vn -0.109195 -0.980468 -0.163427
-vn -0.393262 0.706320 -0.588549
-vn -0.213324 -0.923307 -0.319254
-vn -0.552873 -0.097842 -0.827448
-vn -0.309244 0.830744 -0.462813
-vn -0.222755 -0.881283 -0.416761
-vn -0.222755 0.881283 -0.416761
-vn -0.552904 0.097842 -0.827448
-vn -0.471389 0.000000 -0.881893
-vn -0.299478 -0.772240 -0.560289
-vn -0.137486 0.956511 -0.257241
-vn -0.531693 0.289834 -0.795770
-vn -0.462355 0.194769 -0.865017
-vn -0.429792 -0.633625 -0.643239
-vn -0.392163 -0.554857 -0.733696
-vn -0.435591 0.382122 -0.814966
-vn -0.490158 -0.470748 -0.733543
-vn -0.435591 -0.382122 -0.814966
-vn -0.392163 0.554857 -0.733696
-vn -0.092654 -0.980468 -0.173345
-vn -0.531693 -0.289834 -0.795770
-vn -0.462355 -0.194769 -0.865017
-vn -0.333659 0.706320 -0.624287
-vn -0.181005 -0.923307 -0.338633
-vn -0.469131 -0.097842 -0.877682
-vn -0.262368 0.830744 -0.490890
-vn -0.181005 0.923307 -0.338633
-vn -0.333659 -0.706320 -0.624256
-vn -0.055269 0.995025 -0.082736
-vn -0.092654 0.980468 -0.173345
-vn -0.415876 0.470748 -0.778069
-vn -0.046907 -0.995025 -0.087771
-vn -0.364666 0.633625 -0.682272
-vn -0.137486 -0.956511 -0.257241
-vn -0.299478 0.772240 -0.560289
-vn -0.180822 -0.881283 -0.436598
-vn -0.380840 -0.097842 -0.919431
-vn -0.212989 0.830744 -0.514237
-vn -0.262368 -0.830744 -0.490890
-vn -0.212989 -0.830744 -0.514237
-vn -0.146947 0.923307 -0.354747
-vn -0.469131 0.097842 -0.877682
-vn -0.375347 0.194769 -0.906156
-vn -0.364666 -0.633625 -0.682272
-vn -0.270882 -0.706320 -0.653981
-vn -0.046907 0.995025 -0.087771
-vn -0.075198 0.980468 -0.181585
-vn -0.451155 0.289834 -0.844050
-vn -0.353618 0.382122 -0.853755
-vn -0.415876 -0.470748 -0.778069
-vn -0.318369 -0.554857 -0.768609
-vn -0.337626 0.470748 -0.815088
-vn -0.038087 -0.995025 -0.091952
-vn -0.451155 -0.289834 -0.844050
-vn -0.353618 -0.382122 -0.853755
-vn -0.296030 0.633625 -0.714713
-vn -0.111606 -0.956511 -0.269478
-vn -0.375347 -0.194769 -0.906156
-vn -0.243110 0.772240 -0.586932
-vn -0.180822 0.881283 -0.436598
-vn -0.382672 0.000000 -0.923856
-vn -0.243110 -0.772240 -0.586932
-vn -0.111606 0.956511 -0.269478
-vn -0.296030 -0.633625 -0.714713
-vn -0.318369 0.554857 -0.768609
-vn -0.075198 -0.980468 -0.181585
-vn -0.270882 0.706320 -0.653981
-vn -0.146947 -0.923307 -0.354747
-vn -0.084658 -0.956511 -0.279122
-vn -0.284707 -0.194769 -0.938597
-vn -0.184393 0.772240 -0.607929
-vn -0.137181 -0.881283 -0.452223
-vn -0.137181 0.881283 -0.452223
-vn -0.380840 0.097842 -0.919431
-vn -0.290262 0.000000 -0.956938
-vn -0.184393 -0.772240 -0.607929
-vn -0.084658 0.956511 -0.279122
-vn -0.366253 0.289834 -0.884213
-vn -0.284707 0.194769 -0.938597
-vn -0.224555 -0.633625 -0.740287
-vn -0.268227 0.382122 -0.884304
-vn -0.337596 -0.470748 -0.815088
-vn -0.268227 -0.382122 -0.884304
-vn -0.241493 0.554857 -0.796106
-vn -0.057039 -0.980468 -0.188086
-vn -0.366253 -0.289834 -0.884213
-vn -0.205481 0.706320 -0.677389
-vn -0.111454 -0.923307 -0.367443
-vn -0.288888 -0.097842 -0.952330
-vn -0.161565 0.830744 -0.532640
-vn -0.161565 -0.830744 -0.532640
-vn -0.111454 0.923307 -0.367443
-vn -0.205481 -0.706320 -0.677389
-vn -0.038087 0.995025 -0.091952
-vn -0.057039 0.980468 -0.188086
-vn -0.241493 -0.554857 -0.796106
-vn -0.256081 0.470748 -0.844264
-vn -0.028871 -0.995025 -0.095218
-vn -0.224555 0.633625 -0.740287
-vn -0.038331 -0.980468 -0.192785
-vn -0.277810 -0.289834 -0.915830
-vn -0.191351 -0.194769 -0.961974
-vn -0.138096 0.706320 -0.694266
-vn -0.074892 -0.923307 -0.376598
-vn -0.194128 -0.097842 -0.976074
-vn -0.108585 0.830744 -0.545915
-vn -0.108585 -0.830744 -0.545915
-vn -0.074892 0.923307 -0.376598
-vn -0.288888 0.097842 -0.952330
-vn -0.191351 0.194769 -0.961974
-vn -0.138096 -0.706320 -0.694266
-vn -0.028871 0.995025 -0.095218
-vn -0.038331 0.980468 -0.192785
-vn -0.277810 0.289834 -0.915830
-vn -0.180273 0.382122 -0.906339
-vn -0.256081 -0.470748 -0.844264
-vn -0.172094 -0.470748 -0.865291
-vn -0.172094 0.470748 -0.865291
-vn -0.019410 -0.995025 -0.097598
-vn -0.180273 -0.382122 -0.906339
-vn -0.150914 0.633625 -0.758751
-vn -0.056887 -0.956511 -0.286081
-vn -0.123936 0.772240 -0.623096
-vn -0.092196 -0.881283 -0.463485
-vn -0.092196 0.881283 -0.463485
-vn -0.195074 0.000000 -0.980773
-vn -0.123936 -0.772240 -0.623096
-vn -0.056887 0.956511 -0.286081
-vn -0.150914 -0.633625 -0.758751
-vn -0.009735 -0.995025 -0.099033
-vn -0.186712 -0.289834 -0.938658
-vn -0.090548 -0.382122 -0.919645
-vn -0.075808 0.633625 -0.769890
-vn -0.028565 -0.956511 -0.290262
-vn -0.096133 -0.194769 -0.976104
-vn -0.054537 0.830744 -0.553941
-vn -0.054537 -0.830744 -0.553941
-vn -0.046297 0.881283 -0.470290
-vn -0.194128 0.097842 -0.976074
-vn -0.097995 0.000000 -0.995178
-vn -0.062258 -0.772240 -0.632221
-vn -0.028565 0.956511 -0.290262
-vn -0.186712 0.289834 -0.938658
-vn -0.096133 0.194769 -0.976104
-vn -0.162297 -0.554857 -0.815943
-vn -0.075808 -0.633625 -0.769890
-vn -0.090548 0.382122 -0.919645
-vn -0.162297 0.554857 -0.815943
-vn -0.019257 -0.980468 -0.195593
-vn -0.069369 0.706320 -0.704459
-vn -0.037629 -0.923307 -0.382122
-vn -0.097537 -0.097842 -0.990387
-vn -0.037629 0.923307 -0.382122
-vn -0.069369 -0.706320 -0.704459
-vn -0.019410 0.995025 -0.097598
-vn -0.019257 0.980468 -0.195593
-vn -0.081515 -0.554857 -0.827906
-vn -0.086459 0.470748 -0.877987
-vn -0.086459 -0.470748 -0.877987
-vn 0.000000 -0.382122 -0.924100
-vn -0.081515 0.554857 -0.827906
-vn 0.000000 0.633625 -0.773614
-vn 0.000000 -0.980468 -0.196539
-vn -0.093783 -0.289834 -0.952452
-vn 0.000000 -0.194769 -0.980834
-vn -0.062258 0.772240 -0.632221
-vn 0.000000 0.706320 -0.707846
-vn -0.046297 -0.881283 -0.470290
-vn 0.000000 -0.923307 -0.383984
-vn 0.000000 -0.097842 -0.995178
-vn 0.000000 0.830744 -0.556627
-vn 0.000000 -0.830744 -0.556627
-vn 0.000000 0.923307 -0.383984
-vn -0.097537 0.097842 -0.990387
-vn 0.000000 0.194769 -0.980834
-vn 0.000000 -0.706320 -0.707846
-vn -0.009735 0.995025 -0.099033
-vn 0.000000 0.980468 -0.196539
-vn -0.093783 0.289834 -0.952452
-vn 0.000000 0.382122 -0.924100
-vn 0.000000 -0.554857 -0.831935
-vn 0.000000 0.470748 -0.882260
-vn 0.000000 -0.995025 -0.099521
-vn 0.000000 -0.956511 -0.291665
-vn 0.000000 0.772240 -0.635304
-vn 0.000000 0.881283 -0.472579
-vn 0.000000 0.000000 -0.999969
-vn 0.000000 -0.772240 -0.635304
-vn 0.000000 0.956511 -0.291665
-vn 0.000000 -0.633625 -0.773614
-vn 0.000000 -0.470748 -0.882260
-vn 0.081515 -0.554857 -0.827906
-vn 0.000000 0.554857 -0.831935
-vn 0.086459 0.470748 -0.877987
-vn 0.009735 -0.995025 -0.099033
-vn 0.000000 -0.289834 -0.957060
-vn 0.090548 -0.382122 -0.919645
-vn 0.075808 0.633625 -0.769890
-vn 0.028565 -0.956511 -0.290262
-vn 0.096133 -0.194769 -0.976104
-vn 0.062258 0.772240 -0.632221
-vn 0.000000 -0.881283 -0.472579
-vn 0.046297 -0.881283 -0.470290
-vn 0.046297 0.881283 -0.470290
-vn 0.000000 0.097842 -0.995178
-vn 0.097995 0.000000 -0.995178
-vn 0.062258 -0.772240 -0.632221
-vn 0.028565 0.956511 -0.290262
-vn 0.000000 0.289834 -0.957060
-vn 0.096133 0.194769 -0.976104
-vn 0.075808 -0.633625 -0.769890
-vn 0.090548 0.382122 -0.919645
-vn 0.019257 -0.980468 -0.195593
-vn 0.069369 0.706320 -0.704459
-vn 0.037629 -0.923338 -0.382122
-vn 0.097537 -0.097842 -0.990387
-vn 0.054537 0.830744 -0.553941
-vn 0.054537 -0.830744 -0.553941
-vn 0.037629 0.923307 -0.382122
-vn 0.069369 -0.706320 -0.704459
-vn 0.000000 0.995025 -0.099521
-vn 0.019257 0.980468 -0.195593
-vn 0.150914 -0.633625 -0.758751
-vn 0.180273 0.382122 -0.906339
-vn 0.086459 -0.470748 -0.877987
-vn 0.180273 -0.382122 -0.906339
-vn 0.081515 0.554857 -0.827906
-vn 0.150914 0.633625 -0.758751
-vn 0.038331 -0.980468 -0.192785
-vn 0.093783 -0.289834 -0.952452
-vn 0.191351 -0.194769 -0.961974
-vn 0.138096 0.706320 -0.694266
-vn 0.074892 -0.923338 -0.376598
-vn 0.194128 -0.097842 -0.976074
-vn 0.108585 0.830744 -0.545915
-vn 0.108585 -0.830744 -0.545915
-vn 0.074892 0.923307 -0.376598
-vn 0.097537 0.097842 -0.990387
-vn 0.191351 0.194769 -0.961974
-vn 0.138096 -0.706320 -0.694266
-vn 0.009735 0.995025 -0.099033
-vn 0.038331 0.980468 -0.192785
-vn 0.093783 0.289834 -0.952452
-vn 0.162297 -0.554857 -0.815943
-vn 0.172094 0.470748 -0.865291
-vn 0.019410 -0.995025 -0.097598
-vn 0.056887 -0.956511 -0.286081
-vn 0.123936 0.772240 -0.623096
-vn 0.092196 0.881283 -0.463485
-vn 0.195074 0.000000 -0.980773
-vn 0.123936 -0.772240 -0.623096
-vn 0.056887 0.956511 -0.286081
-vn 0.205481 -0.706320 -0.677389
-vn 0.019410 0.995025 -0.097598
-vn 0.057039 0.980468 -0.188086
-vn 0.186712 0.289834 -0.938658
-vn 0.268227 0.382122 -0.884304
-vn 0.172094 -0.470748 -0.865291
-vn 0.241493 -0.554857 -0.796106
-vn 0.162297 0.554857 -0.815943
-vn 0.256081 0.470748 -0.844264
-vn 0.028871 -0.995025 -0.095248
-vn 0.186712 -0.289834 -0.938658
-vn 0.268227 -0.382122 -0.884304
-vn 0.224555 0.633625 -0.740287
-vn 0.084658 -0.956511 -0.279122
-vn 0.284707 -0.194800 -0.938597
-vn 0.184393 0.772240 -0.607929
-vn 0.092196 -0.881283 -0.463485
-vn 0.137181 -0.881283 -0.452223
-vn 0.137181 0.881283 -0.452223
-vn 0.194128 0.097842 -0.976074
-vn 0.290262 0.000000 -0.956938
-vn 0.184393 -0.772240 -0.607929
-vn 0.084658 0.956511 -0.279122
-vn 0.284707 0.194769 -0.938597
-vn 0.224555 -0.633625 -0.740287
-vn 0.057039 -0.980468 -0.188086
-vn 0.205481 0.706320 -0.677389
-vn 0.111454 -0.923338 -0.367443
-vn 0.288888 -0.097842 -0.952330
-vn 0.161565 0.830744 -0.532640
-vn 0.161565 -0.830744 -0.532640
-vn 0.111454 0.923307 -0.367443
-vn 0.243110 -0.772240 -0.586932
-vn 0.111606 0.956511 -0.269478
-vn 0.277810 0.289834 -0.915830
-vn 0.375347 0.194769 -0.906156
-vn 0.296030 -0.633625 -0.714713
-vn 0.353618 0.382122 -0.853755
-vn 0.256081 -0.470748 -0.844264
-vn 0.353618 -0.382122 -0.853755
-vn 0.241493 0.554857 -0.796106
-vn 0.296030 0.633625 -0.714713
-vn 0.075198 -0.980468 -0.181585
-vn 0.277810 -0.289834 -0.915830
-vn 0.375347 -0.194769 -0.906156
-vn 0.270882 0.706320 -0.653981
-vn 0.146916 -0.923338 -0.354747
-vn 0.380840 -0.097842 -0.919431
-vn 0.212989 0.830744 -0.514237
-vn 0.212989 -0.830744 -0.514237
-vn 0.146947 0.923307 -0.354747
-vn 0.288888 0.097842 -0.952330
-vn 0.270882 -0.706320 -0.653981
-vn 0.028871 0.995025 -0.095248
-vn 0.075198 0.980468 -0.181585
-vn 0.318369 -0.554857 -0.768609
-vn 0.337626 0.470748 -0.815088
-vn 0.038087 -0.995025 -0.091952
-vn 0.111606 -0.956511 -0.269478
-vn 0.243110 0.772240 -0.586932
-vn 0.180822 0.881283 -0.436598
-vn 0.382672 0.000000 -0.923856
-vn 0.262368 -0.830744 -0.490890
-vn 0.181005 0.923307 -0.338633
-vn 0.380840 0.097842 -0.919431
-vn 0.462355 0.194769 -0.865017
-vn 0.333659 -0.706320 -0.624287
-vn 0.038087 0.995025 -0.091952
-vn 0.092654 0.980468 -0.173345
-vn 0.366253 0.289834 -0.884213
-vn 0.435591 0.382122 -0.814966
-vn 0.337626 -0.470748 -0.815088
-vn 0.392163 -0.554857 -0.733696
-vn 0.318369 0.554857 -0.768609
-vn 0.392163 0.554857 -0.733696
-vn 0.046907 -0.995025 -0.087771
-vn 0.366253 -0.289834 -0.884213
-vn 0.435591 -0.382122 -0.814966
-vn 0.364666 0.633625 -0.682272
-vn 0.137486 -0.956511 -0.257241
-vn 0.462355 -0.194769 -0.865017
-vn 0.299478 0.772240 -0.560289
-vn 0.180822 -0.881283 -0.436598
-vn 0.222755 0.881283 -0.416761
-vn 0.471389 0.000000 -0.881893
-vn 0.299478 -0.772240 -0.560289
-vn 0.137486 0.956511 -0.257241
-vn 0.364666 -0.633625 -0.682272
-vn 0.092654 -0.980468 -0.173345
-vn 0.333659 0.706320 -0.624287
-vn 0.181005 -0.923338 -0.338633
-vn 0.469131 -0.097842 -0.877682
-vn 0.262368 0.830744 -0.490890
-vn 0.222755 -0.881283 -0.416761
-vn 0.309244 -0.830744 -0.462813
-vn 0.262551 0.881283 -0.392926
-vn 0.469131 0.097842 -0.877682
-vn 0.552873 0.097842 -0.827448
-vn 0.352947 -0.772240 -0.528214
-vn 0.162023 0.956511 -0.242500
-vn 0.451155 0.289834 -0.844050
-vn 0.544908 0.194769 -0.815516
-vn 0.429792 -0.633625 -0.643239
-vn 0.415876 0.470748 -0.778069
-vn 0.513382 0.382122 -0.768334
-vn 0.415876 -0.470748 -0.778069
-vn 0.513382 -0.382122 -0.768334
-vn 0.462172 0.554857 -0.691733
-vn 0.109195 -0.980468 -0.163427
-vn 0.451155 -0.289834 -0.844050
-vn 0.544908 -0.194769 -0.815516
-vn 0.393262 0.706320 -0.588549
-vn 0.213324 -0.923338 -0.319254
-vn 0.552873 -0.097842 -0.827448
-vn 0.309244 0.830744 -0.462813
-vn 0.213324 0.923307 -0.319254
-vn 0.393262 -0.706320 -0.588549
-vn 0.046907 0.995025 -0.087771
-vn 0.109195 0.980468 -0.163427
-vn 0.462172 -0.554857 -0.691733
-vn 0.055269 -0.995025 -0.082736
-vn 0.429792 0.633625 -0.643239
-vn 0.162023 -0.956511 -0.242500
-vn 0.352947 0.772240 -0.528214
-vn 0.262551 -0.881283 -0.392926
-vn 0.243599 -0.923307 -0.296823
-vn 0.555559 0.000000 -0.831446
-vn 0.631336 -0.097842 -0.769280
-vn 0.353099 0.830744 -0.430250
-vn 0.353099 -0.830744 -0.430250
-vn 0.243599 0.923307 -0.296823
-vn 0.622211 0.194769 -0.758202
-vn 0.449049 -0.706320 -0.547166
-vn 0.055269 0.995025 -0.082736
-vn 0.124699 0.980468 -0.151921
-vn 0.531693 0.289834 -0.795770
-vn 0.586230 0.382122 -0.714316
-vn 0.490158 -0.470748 -0.733543
-vn 0.527757 -0.554857 -0.643086
-vn 0.490158 0.470748 -0.733573
-vn 0.527757 0.554857 -0.643086
-vn 0.063143 -0.995025 -0.076937
-vn 0.531693 -0.289834 -0.795770
-vn 0.586230 -0.382122 -0.714316
-vn 0.490768 0.633625 -0.598010
-vn 0.185034 -0.956511 -0.225471
-vn 0.622211 -0.194800 -0.758171
-vn 0.403027 0.772240 -0.491073
-vn 0.299783 0.881283 -0.365307
-vn 0.631336 0.097842 -0.769280
-vn 0.403027 -0.772240 -0.491073
-vn 0.185034 0.956511 -0.225471
-vn 0.490768 -0.633625 -0.598010
-vn 0.124699 -0.980468 -0.151921
-vn 0.607135 -0.289834 -0.739799
-vn 0.449049 0.706320 -0.547166
-vn 0.206244 -0.956511 -0.206244
-vn 0.693533 -0.194800 -0.693533
-vn 0.393567 0.830744 -0.393567
-vn 0.299783 -0.881283 -0.365307
-vn 0.334147 -0.881283 -0.334147
-vn 0.334147 0.881283 -0.334147
-vn 0.634388 0.000000 -0.773003
-vn 0.707083 0.000000 -0.707083
-vn 0.449202 -0.772240 -0.449202
-vn 0.206244 0.956511 -0.206244
-vn 0.607135 0.289834 -0.739799
-vn 0.693533 0.194769 -0.693533
-vn 0.547014 -0.633625 -0.547014
-vn 0.559679 0.470748 -0.681997
-vn 0.653432 0.382122 -0.653432
-vn 0.559679 -0.470748 -0.681997
-vn 0.653432 -0.382122 -0.653432
-vn 0.588244 0.554857 -0.588244
-vn 0.138981 -0.980468 -0.138981
-vn 0.500534 0.706320 -0.500534
-vn 0.271493 -0.923307 -0.271493
-vn 0.703696 -0.097842 -0.703696
-vn 0.393567 -0.830744 -0.393567
-vn 0.271493 0.923307 -0.271493
-vn 0.500534 -0.706320 -0.500534
-vn 0.063143 0.995025 -0.076937
-vn 0.138981 0.980468 -0.138981
-vn 0.588244 -0.554857 -0.588244
-vn 0.070376 -0.995025 -0.070376
-vn 0.547014 0.633625 -0.547014
-vn 0.151921 -0.980468 -0.124668
-vn 0.676748 -0.289834 -0.676748
-vn 0.758202 -0.194800 -0.622211
-vn 0.449202 0.772240 -0.449202
-vn 0.547166 0.706320 -0.449049
-vn 0.296823 -0.923307 -0.243599
-vn 0.769280 -0.097842 -0.631336
-vn 0.430250 0.830744 -0.353099
-vn 0.430250 -0.830744 -0.353099
-vn 0.296823 0.923307 -0.243599
-vn 0.703696 0.097842 -0.703696
-vn 0.758202 0.194769 -0.622211
-vn 0.547166 -0.706320 -0.449049
-vn 0.070376 0.995025 -0.070376
-vn 0.151921 0.980468 -0.124699
-vn 0.676748 0.289834 -0.676748
-vn 0.714316 0.382122 -0.586230
-vn 0.623829 -0.470748 -0.623829
-vn 0.643086 -0.554857 -0.527757
-vn 0.623829 0.470748 -0.623829
-vn 0.643086 0.554857 -0.527757
-vn 0.076937 -0.995025 -0.063143
-vn 0.714316 -0.382122 -0.586230
-vn 0.598010 0.633625 -0.490768
-vn 0.225471 -0.956511 -0.185034
-vn 0.365307 -0.881283 -0.299783
-vn 0.365307 0.881283 -0.299783
-vn 0.773003 0.000000 -0.634388
-vn 0.491073 -0.772240 -0.403027
-vn 0.225471 0.956511 -0.185034
-vn 0.598010 -0.633625 -0.490768
-vn 0.082736 -0.995025 -0.055300
-vn 0.739799 -0.289834 -0.607135
-vn 0.768334 -0.382122 -0.513382
-vn 0.643239 0.633625 -0.429792
-vn 0.242500 -0.956511 -0.162023
-vn 0.815516 -0.194800 -0.544908
-vn 0.491073 0.772240 -0.403027
-vn 0.462813 0.830744 -0.309244
-vn 0.392926 -0.881283 -0.262551
-vn 0.392926 0.881283 -0.262551
-vn 0.769280 0.097842 -0.631336
-vn 0.831446 0.000000 -0.555559
-vn 0.528214 -0.772240 -0.352947
-vn 0.242500 0.956511 -0.162053
-vn 0.739799 0.289834 -0.607135
-vn 0.815516 0.194769 -0.544908
-vn 0.643239 -0.633625 -0.429792
-vn 0.681997 0.470748 -0.559679
-vn 0.768334 0.382122 -0.513382
-vn 0.681997 -0.470748 -0.559679
-vn 0.691733 0.554857 -0.462172
-vn 0.163427 -0.980468 -0.109195
-vn 0.588549 0.706320 -0.393262
-vn 0.319254 -0.923307 -0.213324
-vn 0.827448 -0.097842 -0.552873
-vn 0.462813 -0.830744 -0.309244
-vn 0.319254 0.923307 -0.213324
-vn 0.588549 -0.706320 -0.393262
-vn 0.076937 0.995025 -0.063112
-vn 0.163427 0.980468 -0.109195
-vn 0.691733 -0.554857 -0.462172
-vn 0.733573 -0.470748 -0.490158
-vn 0.814966 -0.382122 -0.435591
-vn 0.733696 0.554857 -0.392163
-vn 0.173345 -0.980468 -0.092654
-vn 0.795770 -0.289834 -0.531693
-vn 0.865017 -0.194800 -0.462355
-vn 0.528214 0.772240 -0.352947
-vn 0.624287 0.706320 -0.333659
-vn 0.338633 -0.923307 -0.181005
-vn 0.877682 -0.097842 -0.469131
-vn 0.490890 0.830744 -0.262368
-vn 0.490890 -0.830744 -0.262368
-vn 0.338633 0.923307 -0.181005
-vn 0.827448 0.097842 -0.552873
-vn 0.865017 0.194769 -0.462355
-vn 0.624287 -0.706320 -0.333659
-vn 0.082736 0.995025 -0.055269
-vn 0.173345 0.980468 -0.092654
-vn 0.795770 0.289834 -0.531693
-vn 0.814966 0.382122 -0.435591
-vn 0.733696 -0.554857 -0.392163
-vn 0.733573 0.470748 -0.490158
-vn 0.087771 -0.995025 -0.046907
-vn 0.682272 0.633625 -0.364666
-vn 0.257241 -0.956511 -0.137486
-vn 0.416761 -0.881283 -0.222755
-vn 0.416761 0.881283 -0.222755
-vn 0.877682 0.097842 -0.469131
-vn 0.560289 -0.772240 -0.299478
-vn 0.257241 0.956511 -0.137486
-vn 0.682272 -0.633625 -0.364666
-vn 0.778069 -0.470748 -0.415876
-vn 0.768609 -0.554857 -0.318369
-vn 0.778069 0.470748 -0.415876
-vn 0.768609 0.554857 -0.318369
-vn 0.091952 -0.995025 -0.038087
-vn 0.844050 -0.289834 -0.451155
-vn 0.853755 -0.382122 -0.353618
-vn 0.714713 0.633625 -0.296030
-vn 0.269478 -0.956511 -0.111606
-vn 0.906156 -0.194800 -0.375347
-vn 0.560289 0.772240 -0.299478
-vn 0.586932 0.772240 -0.243110
-vn 0.436598 -0.881283 -0.180822
-vn 0.436598 0.881283 -0.180822
-vn 0.881893 0.000000 -0.471389
-vn 0.919431 0.097842 -0.380840
-vn 0.586932 -0.772240 -0.243110
-vn 0.269478 0.956511 -0.111606
-vn 0.844050 0.289834 -0.451155
-vn 0.906156 0.194769 -0.375347
-vn 0.714713 -0.633625 -0.296030
-vn 0.853755 0.382122 -0.353618
-vn 0.181585 -0.980468 -0.075198
-vn 0.653981 0.706320 -0.270882
-vn 0.354747 -0.923307 -0.146947
-vn 0.919431 -0.097842 -0.380840
-vn 0.514237 0.830744 -0.212989
-vn 0.514237 -0.830744 -0.212989
-vn 0.354747 0.923307 -0.146916
-vn 0.653981 -0.706320 -0.270882
-vn 0.087771 0.995025 -0.046907
-vn 0.181585 0.980468 -0.075198
-vn 0.740287 -0.633625 -0.224555
-vn 0.815088 0.470748 -0.337626
-vn 0.884304 0.382122 -0.268227
-vn 0.815088 -0.470748 -0.337626
-vn 0.884304 -0.382122 -0.268227
-vn 0.796106 0.554857 -0.241493
-vn 0.188086 -0.980468 -0.057039
-vn 0.884213 -0.289834 -0.366253
-vn 0.938597 -0.194800 -0.284707
-vn 0.677389 0.706320 -0.205481
-vn 0.367443 -0.923307 -0.111454
-vn 0.923856 0.000000 -0.382672
-vn 0.952330 -0.097842 -0.288888
-vn 0.532640 0.830744 -0.161565
-vn 0.532640 -0.830744 -0.161565
-vn 0.367443 0.923307 -0.111454
-vn 0.938597 0.194769 -0.284707
-vn 0.677389 -0.706320 -0.205481
-vn 0.091952 0.995025 -0.038087
-vn 0.188086 0.980468 -0.057039
-vn 0.884213 0.289834 -0.366253
-vn 0.796106 -0.554857 -0.241493
-vn 0.095248 -0.995025 -0.028871
-vn 0.740287 0.633625 -0.224555
-vn 0.279122 -0.956511 -0.084658
-vn 0.607929 0.772240 -0.184393
-vn 0.452223 0.881283 -0.137181
-vn 0.952330 0.097842 -0.288888
-vn 0.607929 -0.772240 -0.184393
-vn 0.279122 0.956511 -0.084658
-vn 0.758751 -0.633625 -0.150914
-vn 0.095248 0.995025 -0.028871
-vn 0.192785 0.980468 -0.038331
-vn 0.915830 0.289834 -0.277810
-vn 0.906339 0.382122 -0.180273
-vn 0.844264 -0.470748 -0.256081
-vn 0.815943 -0.554857 -0.162297
-vn 0.844264 0.470748 -0.256081
-vn 0.815943 0.554857 -0.162297
-vn 0.097598 -0.995025 -0.019410
-vn 0.915830 -0.289834 -0.277810
-vn 0.906339 -0.382122 -0.180273
-vn 0.758751 0.633625 -0.150914
-vn 0.286081 -0.956511 -0.056887
-vn 0.961974 -0.194800 -0.191351
-vn 0.545915 0.830744 -0.108585
-vn 0.452223 -0.881283 -0.137181
-vn 0.545915 -0.830744 -0.108585
-vn 0.463485 0.881283 -0.092196
-vn 0.956938 0.000000 -0.290262
-vn 0.976074 0.097842 -0.194128
-vn 0.623096 -0.772240 -0.123936
-vn 0.286081 0.956511 -0.056887
-vn 0.961974 0.194769 -0.191351
-vn 0.192785 -0.980468 -0.038331
-vn 0.694266 0.706320 -0.138096
-vn 0.376598 -0.923307 -0.074892
-vn 0.976074 -0.097842 -0.194128
-vn 0.376598 0.923307 -0.074892
-vn 0.694266 -0.706320 -0.138096
-vn 0.632221 -0.772240 -0.062258
-vn 0.290262 0.956511 -0.028565
-vn 0.938658 0.289834 -0.186712
-vn 0.976104 0.194769 -0.096133
-vn 0.769890 -0.633625 -0.075808
-vn 0.865291 0.470748 -0.172094
-vn 0.919645 0.382122 -0.090548
-vn 0.865291 -0.470748 -0.172094
-vn 0.919645 -0.382122 -0.090548
-vn 0.827906 0.554857 -0.081515
-vn 0.195593 -0.980468 -0.019257
-vn 0.938658 -0.289834 -0.186712
-vn 0.976104 -0.194800 -0.096133
-vn 0.623096 0.772240 -0.123936
-vn 0.704459 0.706320 -0.069369
-vn 0.463485 -0.881283 -0.092196
-vn 0.382122 -0.923307 -0.037629
-vn 0.980773 0.000000 -0.195074
-vn 0.990387 -0.097842 -0.097537
-vn 0.553941 0.830744 -0.054537
-vn 0.553941 -0.830744 -0.054537
-vn 0.382122 0.923307 -0.037629
-vn 0.097598 0.995025 -0.019410
-vn 0.195593 0.980468 -0.019257
-vn 0.827906 -0.554857 -0.081515
-vn 0.099033 -0.995025 -0.009735
-vn 0.769890 0.633625 -0.075808
-vn 0.290262 -0.956511 -0.028565
-vn 0.470290 -0.881283 -0.046297
-vn 0.470290 0.881283 -0.046297
-vn 0.990387 0.097842 -0.097537
-vn 0.556627 -0.830744 0.000000
-vn 0.383984 0.923307 0.000000
-vn 0.980834 0.194769 0.000000
-vn 0.704459 -0.706320 -0.069369
-vn 0.773614 -0.633625 0.000000
-vn 0.099033 0.995025 -0.009735
-vn 0.196539 0.980468 0.000000
-vn 0.952452 0.289834 -0.093783
-vn 0.924100 0.382122 0.000000
-vn 0.877987 -0.470748 -0.086459
-vn 0.831935 -0.554857 0.000000
-vn 0.877987 0.470748 -0.086459
-vn 0.831935 0.554857 0.000000
-vn 0.099521 -0.995025 0.000000
-vn 0.952452 -0.289834 -0.093783
-vn 0.924100 -0.382122 0.000000
-vn 0.773614 0.633625 0.000000
-vn 0.291665 -0.956511 0.000000
-vn 0.980834 -0.194800 0.000000
-vn 0.632221 0.772240 -0.062258
-vn 0.556627 0.830744 0.000000
-vn 0.472579 0.881283 0.000000
-vn 0.995178 0.000000 -0.097995
-vn 0.995178 0.097842 0.000000
-vn 0.635304 -0.772240 0.000000
-vn 0.291665 0.956511 0.000000
-vn 0.196539 -0.980468 0.000000
-vn 0.707846 0.706320 0.000000
-vn 0.383984 -0.923307 0.000000
-vn 0.995178 -0.097842 0.000000
-vn 0.707846 -0.706320 0.000000
-vn 0.632221 -0.772240 0.062258
-vn 0.290262 0.956511 0.028565
-vn 0.957060 0.289834 0.000000
-vn 0.976104 0.194769 0.096133
-vn 0.769890 -0.633625 0.075808
-vn 0.882260 0.470748 0.000000
-vn 0.919645 0.382122 0.090548
-vn 0.882260 -0.470748 0.000000
-vn 0.919645 -0.382122 0.090548
-vn 0.827906 0.554857 0.081515
-vn 0.195593 -0.980468 0.019257
-vn 0.957060 -0.289834 0.000000
-vn 0.976104 -0.194800 0.096133
-vn 0.635304 0.772240 0.000000
-vn 0.704459 0.706320 0.069369
-vn 0.472579 -0.881283 0.000000
-vn 0.382122 -0.923307 0.037629
-vn 1.000000 0.000000 0.000000
-vn 0.990387 -0.097842 0.097537
-vn 0.553941 0.830744 0.054537
-vn 0.553941 -0.830744 0.054537
-vn 0.382122 0.923307 0.037629
-vn 0.099521 0.995025 0.000000
-vn 0.195593 0.980468 0.019257
-vn 0.827906 -0.554857 0.081515
-vn 0.099033 -0.995025 0.009735
-vn 0.769890 0.633625 0.075808
-vn 0.290262 -0.956511 0.028565
-vn 0.470290 -0.881283 0.046297
-vn 0.470290 0.881283 0.046297
-vn 0.990387 0.097842 0.097537
-vn 0.545915 -0.830744 0.108585
-vn 0.376598 0.923307 0.074892
-vn 0.961974 0.194800 0.191351
-vn 0.704459 -0.706320 0.069369
-vn 0.694266 -0.706320 0.138096
-vn 0.099033 0.995025 0.009735
-vn 0.192785 0.980468 0.038331
-vn 0.952452 0.289834 0.093783
-vn 0.906339 0.382122 0.180273
-vn 0.877987 -0.470748 0.086459
-vn 0.815943 -0.554857 0.162297
-vn 0.877987 0.470748 0.086459
-vn 0.815943 0.554857 0.162297
-vn 0.097598 -0.995025 0.019410
-vn 0.952452 -0.289834 0.093783
-vn 0.906339 -0.382122 0.180273
-vn 0.758751 0.633625 0.150914
-vn 0.286081 -0.956511 0.056887
-vn 0.961974 -0.194800 0.191351
-vn 0.632221 0.772240 0.062258
-vn 0.545915 0.830744 0.108585
-vn 0.463485 0.881283 0.092196
-vn 0.995178 0.000000 0.097995
-vn 0.976074 0.097842 0.194128
-vn 0.623096 -0.772240 0.123936
-vn 0.286081 0.956511 0.056887
-vn 0.758751 -0.633625 0.150914
-vn 0.192785 -0.980468 0.038331
-vn 0.694266 0.706320 0.138096
-vn 0.376598 -0.923307 0.074892
-vn 0.976074 -0.097842 0.194128
-vn 0.463485 -0.881283 0.092196
-vn 0.532640 -0.830744 0.161565
-vn 0.452223 0.881283 0.137181
-vn 0.980773 0.000000 0.195074
-vn 0.952330 0.097842 0.288888
-vn 0.607929 -0.772240 0.184393
-vn 0.279122 0.956511 0.084658
-vn 0.938658 0.289834 0.186712
-vn 0.938597 0.194800 0.284707
-vn 0.740287 -0.633625 0.224555
-vn 0.865291 0.470748 0.172094
-vn 0.884304 0.382122 0.268227
-vn 0.865291 -0.470748 0.172094
-vn 0.884304 -0.382122 0.268227
-vn 0.796106 0.554857 0.241493
-vn 0.188086 -0.980468 0.057039
-vn 0.938658 -0.289834 0.186712
-vn 0.938597 -0.194800 0.284707
-vn 0.623096 0.772240 0.123936
-vn 0.677389 0.706320 0.205481
-vn 0.367443 -0.923338 0.111454
-vn 0.952330 -0.097842 0.288888
-vn 0.532640 0.830744 0.161565
-vn 0.367443 0.923307 0.111454
-vn 0.097598 0.995025 0.019410
-vn 0.188086 0.980468 0.057039
-vn 0.796106 -0.554857 0.241493
-vn 0.095248 -0.995025 0.028871
-vn 0.740287 0.633625 0.224555
-vn 0.279122 -0.956511 0.084658
-vn 0.452223 -0.881283 0.137181
-vn 0.354747 -0.923307 0.146916
-vn 0.956938 0.000000 0.290262
-vn 0.919431 -0.097842 0.380840
-vn 0.514237 0.830744 0.212989
-vn 0.514237 -0.830744 0.212989
-vn 0.354747 0.923307 0.146947
-vn 0.906156 0.194800 0.375347
-vn 0.677389 -0.706320 0.205481
-vn 0.714713 -0.633625 0.296030
-vn 0.095248 0.995025 0.028871
-vn 0.181585 0.980468 0.075198
-vn 0.915830 0.289834 0.277810
-vn 0.853755 0.382122 0.353618
-vn 0.844264 -0.470748 0.256081
-vn 0.768609 -0.554857 0.318369
-vn 0.844264 0.470748 0.256081
-vn 0.768609 0.554857 0.318369
-vn 0.091952 -0.995025 0.038057
-vn 0.915830 -0.289834 0.277810
-vn 0.853755 -0.382122 0.353618
-vn 0.714713 0.633625 0.296030
-vn 0.269478 -0.956511 0.111606
-vn 0.906156 -0.194800 0.375347
-vn 0.607929 0.772240 0.184393
-vn 0.436598 0.881283 0.180822
-vn 0.923856 0.000000 0.382672
-vn 0.586932 -0.772240 0.243110
-vn 0.269478 0.956511 0.111606
-vn 0.181585 -0.980468 0.075198
-vn 0.653981 0.706320 0.270882
-vn 0.257241 -0.956511 0.137486
-vn 0.865017 -0.194800 0.462355
-vn 0.586932 0.772240 0.243110
-vn 0.490890 0.830744 0.262368
-vn 0.436598 -0.881283 0.180822
-vn 0.490890 -0.830744 0.262368
-vn 0.416761 0.881283 0.222755
-vn 0.919431 0.097842 0.380840
-vn 0.877682 0.097842 0.469131
-vn 0.653981 -0.706320 0.270882
-vn 0.560289 -0.772240 0.299478
-vn 0.257241 0.956511 0.137486
-vn 0.884213 0.289834 0.366253
-vn 0.865017 0.194769 0.462355
-vn 0.682272 -0.633625 0.364666
-vn 0.815088 0.470748 0.337626
-vn 0.814966 0.382122 0.435591
-vn 0.815088 -0.470748 0.337596
-vn 0.814966 -0.382122 0.435591
-vn 0.733696 0.554857 0.392163
-vn 0.173345 -0.980468 0.092654
-vn 0.884213 -0.289834 0.366253
-vn 0.624287 0.706320 0.333659
-vn 0.338633 -0.923338 0.181005
-vn 0.877682 -0.097842 0.469131
-vn 0.338633 0.923307 0.181005
-vn 0.091952 0.995025 0.038087
-vn 0.173345 0.980468 0.092654
-vn 0.733696 -0.554857 0.392163
-vn 0.087771 -0.995025 0.046907
-vn 0.682272 0.633625 0.364666
-vn 0.163427 -0.980468 0.109195
-vn 0.844050 -0.289834 0.451155
-vn 0.815516 -0.194800 0.544908
-vn 0.560289 0.772240 0.299478
-vn 0.588549 0.706320 0.393262
-vn 0.416761 -0.881283 0.222755
-vn 0.319254 -0.923338 0.213324
-vn 0.881893 0.000000 0.471389
-vn 0.827448 -0.097842 0.552873
-vn 0.462813 0.830744 0.309244
-vn 0.462813 -0.830744 0.309244
-vn 0.319254 0.923307 0.213324
-vn 0.815516 0.194800 0.544908
-vn 0.624287 -0.706320 0.333659
-vn 0.588549 -0.706320 0.393262
-vn 0.087771 0.995025 0.046907
-vn 0.163427 0.980468 0.109195
-vn 0.844050 0.289834 0.451155
-vn 0.768334 0.382122 0.513382
-vn 0.778069 -0.470748 0.415876
-vn 0.691733 -0.554857 0.462172
-vn 0.778069 0.470748 0.415876
-vn 0.691733 0.554857 0.462172
-vn 0.082736 -0.995025 0.055300
-vn 0.768334 -0.382122 0.513382
-vn 0.643239 0.633625 0.429792
-vn 0.242500 -0.956511 0.162053
-vn 0.392926 0.881283 0.262551
-vn 0.827448 0.097842 0.552873
-vn 0.528214 -0.772240 0.352947
-vn 0.242500 0.956511 0.162023
-vn 0.643239 -0.633625 0.429792
-vn 0.076937 -0.995025 0.063143
-vn 0.795770 -0.289834 0.531693
-vn 0.714316 -0.382122 0.586230
-vn 0.598010 0.633625 0.490768
-vn 0.225471 -0.956511 0.185034
-vn 0.758171 -0.194800 0.622211
-vn 0.528214 0.772240 0.352947
-vn 0.430250 0.830744 0.353099
-vn 0.392926 -0.881283 0.262551
-vn 0.365307 -0.881283 0.299783
-vn 0.365307 0.881283 0.299783
-vn 0.831446 0.000000 0.555559
-vn 0.769280 0.097842 0.631336
-vn 0.547166 -0.706320 0.449049
-vn 0.225471 0.956511 0.185034
-vn 0.795770 0.289834 0.531693
-vn 0.758171 0.194800 0.622211
-vn 0.598010 -0.633625 0.490768
-vn 0.733543 0.470748 0.490158
-vn 0.714316 0.382122 0.586230
-vn 0.733543 -0.470748 0.490158
-vn 0.643086 0.554857 0.527757
-vn 0.151921 -0.980468 0.124668
-vn 0.547166 0.706320 0.449049
-vn 0.296823 -0.923307 0.243599
-vn 0.769280 -0.097842 0.631336
-vn 0.430250 -0.830744 0.353099
-vn 0.296823 0.923307 0.243599
-vn 0.082736 0.995025 0.055300
-vn 0.151921 0.980468 0.124668
-vn 0.643086 -0.554857 0.527757
-vn 0.681967 -0.470748 0.559679
-vn 0.653432 -0.382122 0.653432
-vn 0.588244 0.554857 0.588244
-vn 0.138981 -0.980468 0.138981
-vn 0.739799 -0.289834 0.607135
-vn 0.693533 -0.194800 0.693533
-vn 0.491073 0.772240 0.403027
-vn 0.500534 0.706320 0.500534
-vn 0.271493 -0.923307 0.271493
-vn 0.773003 0.000000 0.634388
-vn 0.703696 -0.097842 0.703696
-vn 0.393567 0.830744 0.393567
-vn 0.491073 -0.772240 0.403027
-vn 0.393567 -0.830744 0.393567
-vn 0.271493 0.923307 0.271493
-vn 0.703696 0.097842 0.703696
-vn 0.500534 -0.706320 0.500534
-vn 0.076937 0.995025 0.063143
-vn 0.138981 0.980468 0.138981
-vn 0.739799 0.289834 0.607135
-vn 0.653432 0.382122 0.653432
-vn 0.588244 -0.554857 0.588244
-vn 0.681997 0.470748 0.559679
-vn 0.070376 -0.995025 0.070376
-vn 0.547014 0.633625 0.547014
-vn 0.206244 -0.956511 0.206244
-vn 0.334147 0.881283 0.334147
-vn 0.449202 -0.772240 0.449202
-vn 0.206244 0.956511 0.206244
-vn 0.693533 0.194800 0.693533
-vn 0.547014 -0.633625 0.547014
-vn 0.623829 -0.470748 0.623829
-vn 0.527757 -0.554857 0.643086
-vn 0.623829 0.470748 0.623829
-vn 0.527757 0.554857 0.643086
-vn 0.063143 -0.995025 0.076937
-vn 0.676748 -0.289834 0.676748
-vn 0.586230 -0.382122 0.714316
-vn 0.490768 0.633625 0.598010
-vn 0.185034 -0.956511 0.225471
-vn 0.622211 -0.194800 0.758171
-vn 0.449202 0.772240 0.449202
-vn 0.353099 0.830744 0.430250
-vn 0.334147 -0.881283 0.334147
-vn 0.353099 -0.830744 0.430250
-vn 0.299783 0.881283 0.365307
-vn 0.707083 0.000000 0.707083
-vn 0.631336 0.097842 0.769280
-vn 0.403027 -0.772240 0.491073
-vn 0.185034 0.956511 0.225471
-vn 0.676748 0.289834 0.676748
-vn 0.622211 0.194800 0.758202
-vn 0.490768 -0.633625 0.598010
-vn 0.586230 0.382122 0.714316
-vn 0.124699 -0.980468 0.151921
-vn 0.449049 0.706320 0.547166
-vn 0.243599 -0.923338 0.296823
-vn 0.631336 -0.097842 0.769280
-vn 0.243599 0.923307 0.296823
-vn 0.449049 -0.706320 0.547166
-vn 0.070376 0.995025 0.070376
-vn 0.124699 0.980468 0.151921
-vn 0.429792 -0.633625 0.643239
-vn 0.559679 0.470748 0.681967
-vn 0.513382 0.382122 0.768334
-vn 0.559679 -0.470748 0.681997
-vn 0.513382 -0.382122 0.768334
-vn 0.462172 0.554857 0.691733
-vn 0.109195 -0.980468 0.163427
-vn 0.607135 -0.289834 0.739799
-vn 0.544908 -0.194800 0.815516
-vn 0.403027 0.772240 0.491073
-vn 0.393262 0.706320 0.588549
-vn 0.299783 -0.881283 0.365307
-vn 0.213324 -0.923338 0.319254
-vn 0.634388 0.000000 0.773003
-vn 0.552873 -0.097842 0.827448
-vn 0.309244 0.830744 0.462813
-vn 0.309244 -0.830744 0.462813
-vn 0.213324 0.923307 0.319254
-vn 0.544908 0.194800 0.815516
-vn 0.393262 -0.706320 0.588549
-vn 0.063143 0.995025 0.076937
-vn 0.109195 0.980468 0.163427
-vn 0.607135 0.289834 0.739799
-vn 0.462172 -0.554857 0.691733
-vn 0.055269 -0.995025 0.082736
-vn 0.429792 0.633625 0.643239
-vn 0.162023 -0.956511 0.242500
-vn 0.262551 0.881283 0.392926
-vn 0.552873 0.097842 0.827448
-vn 0.352947 -0.772240 0.528214
-vn 0.162023 0.956511 0.242500
-vn 0.333659 -0.706320 0.624287
-vn 0.055269 0.995025 0.082736
-vn 0.092654 0.980468 0.173345
-vn 0.531693 0.289834 0.795770
-vn 0.435591 0.382122 0.814966
-vn 0.490158 -0.470748 0.733543
-vn 0.392163 -0.554857 0.733696
-vn 0.490158 0.470748 0.733543
-vn 0.392163 0.554857 0.733696
-vn 0.046907 -0.995025 0.087771
-vn 0.531693 -0.289834 0.795770
-vn 0.435591 -0.382122 0.814966
-vn 0.364666 0.633625 0.682272
-vn 0.137486 -0.956511 0.257241
-vn 0.462355 -0.194800 0.865017
-vn 0.352947 0.772240 0.528214
-vn 0.262368 0.830744 0.490890
-vn 0.262551 -0.881283 0.392926
-vn 0.262368 -0.830744 0.490890
-vn 0.222755 0.881283 0.416761
-vn 0.555559 0.000000 0.831446
-vn 0.469131 0.097842 0.877682
-vn 0.299478 -0.772240 0.560289
-vn 0.137486 0.956511 0.257241
-vn 0.462355 0.194800 0.865017
-vn 0.364666 -0.633625 0.682272
-vn 0.092654 -0.980468 0.173345
-vn 0.333659 0.706320 0.624287
-vn 0.181005 -0.923338 0.338633
-vn 0.469131 -0.097842 0.877682
-vn 0.181005 0.923307 0.338633
-vn 0.243110 -0.772240 0.586932
-vn 0.111606 0.956511 0.269478
-vn 0.451155 0.289834 0.844050
-vn 0.375347 0.194800 0.906156
-vn 0.296030 -0.633625 0.714713
-vn 0.415876 0.470748 0.778069
-vn 0.353618 0.382122 0.853755
-vn 0.415876 -0.470748 0.778069
-vn 0.353618 -0.382122 0.853755
-vn 0.318369 0.554857 0.768609
-vn 0.075198 -0.980468 0.181585
-vn 0.451155 -0.289834 0.844050
-vn 0.375347 -0.194800 0.906156
-vn 0.299478 0.772240 0.560289
-vn 0.270882 0.706320 0.653981
-vn 0.222755 -0.881283 0.416761
-vn 0.146947 -0.923307 0.354747
-vn 0.471389 0.000000 0.881893
-vn 0.380840 -0.097842 0.919431
-vn 0.212989 0.830744 0.514237
-vn 0.212989 -0.830744 0.514237
-vn 0.146947 0.923307 0.354747
-vn 0.270882 -0.706320 0.653981
-vn 0.046907 0.995025 0.087771
-vn 0.075198 0.980468 0.181585
-vn 0.318369 -0.554857 0.768609
-vn 0.038087 -0.995025 0.091952
-vn 0.296030 0.633625 0.714713
-vn 0.111606 -0.956511 0.269478
-vn 0.180822 0.881283 0.436598
-vn 0.380840 0.097842 0.919431
-vn 0.161565 -0.830744 0.532640
-vn 0.111454 0.923307 0.367443
-vn 0.284707 0.194800 0.938597
-vn 0.205481 -0.706320 0.677389
-vn 0.038087 0.995025 0.091952
-vn 0.057039 0.980468 0.188086
-vn 0.366253 0.289834 0.884213
-vn 0.268227 0.382122 0.884304
-vn 0.337626 -0.470748 0.815088
-vn 0.241493 -0.554857 0.796106
-vn 0.337626 0.470748 0.815088
-vn 0.241493 0.554857 0.796106
-vn 0.028871 -0.995025 0.095248
-vn 0.366253 -0.289834 0.884213
-vn 0.268227 -0.382122 0.884304
-vn 0.224555 0.633625 0.740287
-vn 0.084658 -0.956511 0.279122
-vn 0.284707 -0.194800 0.938597
-vn 0.243110 0.772240 0.586932
-vn 0.161565 0.830744 0.532640
-vn 0.180822 -0.881283 0.436598
-vn 0.137181 0.881283 0.452223
-vn 0.382672 0.000000 0.923856
-vn 0.290262 0.000000 0.956938
-vn 0.184393 -0.772240 0.607929
-vn 0.084658 0.956511 0.279122
-vn 0.224555 -0.633625 0.740287
-vn 0.205481 0.706320 0.677389
-vn 0.111454 -0.923307 0.367443
-vn 0.288888 -0.097842 0.952330
-vn 0.137181 -0.881283 0.452223
-vn 0.108585 -0.830744 0.545915
-vn 0.092196 0.881283 0.463485
-vn 0.288888 0.097842 0.952330
-vn 0.195074 0.000000 0.980773
-vn 0.123936 -0.772240 0.623096
-vn 0.056887 0.956511 0.286081
-vn 0.277810 0.289834 0.915830
-vn 0.191351 0.194800 0.961974
-vn 0.150914 -0.633625 0.758751
-vn 0.256081 0.470748 0.844264
-vn 0.180273 0.382122 0.906339
-vn 0.256081 -0.470748 0.844264
-vn 0.180273 -0.382122 0.906339
-vn 0.162297 0.554857 0.815943
-vn 0.057039 -0.980468 0.188086
-vn 0.038331 -0.980468 0.192785
-vn 0.277810 -0.289834 0.915830
-vn 0.191351 -0.194800 0.961974
-vn 0.184393 0.772240 0.607929
-vn 0.138096 0.706320 0.694266
-vn 0.074892 -0.923307 0.376598
-vn 0.194128 -0.097842 0.976074
-vn 0.108585 0.830744 0.545915
-vn 0.074892 0.923307 0.376598
-vn 0.138096 -0.706320 0.694266
-vn 0.028871 0.995025 0.095248
-vn 0.038331 0.980468 0.192785
-vn 0.162297 -0.554857 0.815943
-vn 0.019410 -0.995025 0.097598
-vn 0.150914 0.633625 0.758751
-vn 0.056887 -0.956511 0.286081
-vn 0.092196 -0.881283 0.463485
-vn 0.037629 -0.923307 0.382122
-vn 0.097537 -0.097842 0.990387
-vn 0.054537 0.830744 0.553941
-vn 0.054537 -0.830744 0.553941
-vn 0.037629 0.923307 0.382122
-vn 0.194128 0.097842 0.976074
-vn 0.096133 0.194800 0.976104
-vn 0.069369 -0.706320 0.704459
-vn 0.019410 0.995025 0.097598
-vn 0.019257 0.980468 0.195593
-vn 0.186712 0.289834 0.938658
-vn 0.090548 0.382122 0.919645
-vn 0.172094 -0.470748 0.865291
-vn 0.081515 -0.554857 0.827906
-vn 0.172094 0.470748 0.865291
-vn 0.081515 0.554857 0.827906
-vn 0.009735 -0.995025 0.099033
-vn 0.186712 -0.289834 0.938658
-vn 0.090548 -0.382122 0.919645
-vn 0.075808 0.633625 0.769890
-vn 0.028565 -0.956511 0.290262
-vn 0.096133 -0.194800 0.976104
-vn 0.123936 0.772240 0.623096
-vn 0.046297 0.881283 0.470290
-vn 0.097537 0.097842 0.990387
-vn 0.062258 -0.772240 0.632221
-vn 0.028565 0.956511 0.290262
-vn 0.075808 -0.633625 0.769890
-vn 0.019257 -0.980468 0.195593
-vn 0.069369 0.706320 0.704459
-vn 0.000000 -0.956511 0.291665
-vn 0.000000 -0.194800 0.980834
-vn 0.062258 0.772240 0.632221
-vn 0.000000 0.830744 0.556627
-vn 0.046297 -0.881283 0.470290
-vn 0.000000 -0.830744 0.556627
-vn 0.000000 0.881283 0.472579
-vn 0.097995 0.000000 0.995178
-vn 0.000000 0.097842 0.995178
-vn 0.000000 -0.772240 0.635304
-vn 0.000000 0.956511 0.291665
-vn 0.093783 0.289834 0.952452
-vn 0.000000 0.194800 0.980834
-vn 0.000000 -0.633625 0.773614
-vn 0.086459 0.470748 0.877987
-vn 0.000000 0.382122 0.924100
-vn 0.086459 -0.470748 0.877987
-vn 0.000000 -0.382122 0.924100
-vn 0.000000 0.554857 0.831935
-vn 0.000000 -0.980468 0.196539
-vn 0.093783 -0.289834 0.952452
-vn 0.000000 0.706320 0.707846
-vn 0.000000 -0.923307 0.383984
-vn 0.000000 -0.097842 0.995178
-vn 0.000000 0.923307 0.383984
-vn 0.000000 -0.706320 0.707846
-vn 0.009735 0.995025 0.099033
-vn 0.000000 0.980468 0.196539
-vn 0.000000 -0.554857 0.831935
-vn 0.000000 -0.995025 0.099521
-vn 0.000000 0.633625 0.773614
-vn -0.009735 -0.995025 0.099033
-vn 0.000000 -0.289834 0.957060
-vn -0.090548 -0.382122 0.919645
-vn -0.075808 0.633625 0.769890
-vn -0.028565 -0.956511 0.290262
-vn -0.096133 -0.194800 0.976104
-vn 0.000000 0.772240 0.635304
-vn -0.054537 0.830744 0.553941
-vn 0.000000 -0.881283 0.472579
-vn -0.054537 -0.830744 0.553941
-vn -0.046297 0.881283 0.470290
-vn 0.000000 0.000000 0.999969
-vn -0.097537 0.097842 0.990387
-vn -0.062258 -0.772240 0.632221
-vn -0.028565 0.956511 0.290262
-vn 0.000000 0.289834 0.957060
-vn -0.096133 0.194800 0.976104
-vn -0.075808 -0.633625 0.769890
-vn 0.000000 0.470748 0.882260
-vn -0.090548 0.382122 0.919645
-vn 0.000000 -0.470748 0.882260
-vn -0.081515 0.554857 0.827906
-vn -0.019257 -0.980468 0.195593
-vn -0.069369 0.706320 0.704459
-vn -0.037629 -0.923307 0.382122
-vn -0.097537 -0.097842 0.990387
-vn -0.037629 0.923307 0.382122
-vn -0.069369 -0.706320 0.704459
-vn 0.000000 0.995025 0.099521
-vn -0.019257 0.980468 0.195593
-vn -0.081515 -0.554857 0.827906
-vn -0.086459 -0.470748 0.877987
-vn -0.180273 -0.382122 0.906339
-vn -0.162297 0.554857 0.815943
-vn -0.038331 -0.980468 0.192785
-vn -0.093783 -0.289834 0.952452
-vn -0.191351 -0.194800 0.961974
-vn -0.062258 0.772240 0.632221
-vn -0.138096 0.706320 0.694266
-vn -0.046297 -0.881283 0.470290
-vn -0.074892 -0.923307 0.376598
-vn -0.097995 0.000000 0.995178
-vn -0.194128 -0.097842 0.976074
-vn -0.108585 0.830744 0.545915
-vn -0.108585 -0.830744 0.545915
-vn -0.074892 0.923307 0.376598
-vn -0.191351 0.194769 0.961974
-vn -0.150914 -0.633625 0.758751
-vn -0.009735 0.995025 0.099033
-vn -0.038331 0.980468 0.192785
-vn -0.093783 0.289834 0.952452
-vn -0.180273 0.382122 0.906339
-vn -0.162297 -0.554857 0.815943
-vn -0.086459 0.470748 0.877987
-vn -0.019410 -0.995025 0.097598
-vn -0.150914 0.633625 0.758751
-vn -0.056887 -0.956511 0.286081
-vn -0.092196 0.881283 0.463485
-vn -0.194128 0.097842 0.976074
-vn -0.123936 -0.772240 0.623096
-vn -0.056887 0.956511 0.286081
-vn -0.172094 -0.470748 0.865291
-vn -0.241493 -0.554857 0.796106
-vn -0.172094 0.470748 0.865291
-vn -0.241493 0.554857 0.796106
-vn -0.028871 -0.995025 0.095218
-vn -0.186712 -0.289834 0.938658
-vn -0.268227 -0.382122 0.884304
-vn -0.224555 0.633625 0.740287
-vn -0.084658 -0.956511 0.279122
-vn -0.284707 -0.194800 0.938597
-vn -0.123936 0.772240 0.623096
-vn -0.161565 0.830744 0.532640
-vn -0.092196 -0.881283 0.463485
-vn -0.161565 -0.830744 0.532640
-vn -0.137181 0.881283 0.452223
-vn -0.195074 0.000000 0.980773
-vn -0.290262 0.000000 0.956938
-vn -0.138096 -0.706320 0.694266
-vn -0.184393 -0.772240 0.607929
-vn -0.084658 0.956511 0.279122
-vn -0.186712 0.289834 0.938658
-vn -0.284707 0.194769 0.938597
-vn -0.224555 -0.633625 0.740287
-vn -0.268227 0.382122 0.884304
-vn -0.057039 -0.980468 0.188086
-vn -0.205481 0.706320 0.677389
-vn -0.111454 -0.923307 0.367443
-vn -0.288888 -0.097842 0.952330
-vn -0.111454 0.923307 0.367443
-vn -0.019410 0.995025 0.097598
-vn -0.057039 0.980468 0.188086
-vn -0.296030 -0.633625 0.714713
-vn -0.256081 0.470748 0.844264
-vn -0.353618 0.382122 0.853755
-vn -0.256081 -0.470748 0.844264
-vn -0.353618 -0.382122 0.853755
-vn -0.318369 0.554857 0.768609
-vn -0.075198 -0.980468 0.181585
-vn -0.277810 -0.289834 0.915830
-vn -0.375347 -0.194800 0.906156
-vn -0.184393 0.772240 0.607929
-vn -0.270882 0.706320 0.653981
-vn -0.137181 -0.881283 0.452223
-vn -0.146947 -0.923307 0.354747
-vn -0.380840 -0.097842 0.919431
-vn -0.212989 0.830744 0.514237
-vn -0.212989 -0.830744 0.514237
-vn -0.146947 0.923307 0.354747
-vn -0.288888 0.097842 0.952330
-vn -0.375347 0.194769 0.906156
-vn -0.205481 -0.706320 0.677389
-vn -0.270882 -0.706320 0.653981
-vn -0.028871 0.995025 0.095248
-vn -0.075198 0.980468 0.181585
-vn -0.277810 0.289834 0.915830
-vn -0.318369 -0.554857 0.768609
-vn -0.038087 -0.995025 0.091952
-vn -0.296030 0.633625 0.714713
-vn -0.111606 -0.956511 0.269478
-vn -0.180822 0.881283 0.436598
-vn -0.382672 0.000000 0.923856
-vn -0.243110 -0.772240 0.586932
-vn -0.111606 0.956511 0.269478
-vn -0.333659 -0.706320 0.624287
-vn -0.038087 0.995025 0.091952
-vn -0.092654 0.980468 0.173345
-vn -0.366253 0.289834 0.884213
-vn -0.435591 0.382122 0.814966
-vn -0.337626 -0.470748 0.815088
-vn -0.392163 -0.554857 0.733696
-vn -0.337626 0.470748 0.815088
-vn -0.392163 0.554857 0.733696
-vn -0.046907 -0.995025 0.087771
-vn -0.366253 -0.289834 0.884213
-vn -0.435591 -0.382122 0.814966
-vn -0.364666 0.633625 0.682272
-vn -0.137486 -0.956511 0.257241
-vn -0.462355 -0.194800 0.865017
-vn -0.243110 0.772240 0.586932
-vn -0.262368 0.830744 0.490890
-vn -0.180822 -0.881283 0.436598
-vn -0.262368 -0.830744 0.490890
-vn -0.222755 0.881283 0.416761
-vn -0.380840 0.097842 0.919431
-vn -0.469131 0.097842 0.877682
-vn -0.299478 -0.772240 0.560289
-vn -0.137486 0.956511 0.257241
-vn -0.462355 0.194769 0.865017
-vn -0.364666 -0.633625 0.682272
-vn -0.333659 0.706320 0.624287
-vn -0.181005 -0.923307 0.338633
-vn -0.469131 -0.097842 0.877682
-vn -0.181005 0.923307 0.338633
-vn -0.352947 -0.772240 0.528214
-vn -0.162023 0.956511 0.242500
-vn -0.451155 0.289834 0.844050
-vn -0.544908 0.194769 0.815516
-vn -0.429792 -0.633625 0.643239
-vn -0.415876 0.470748 0.778069
-vn -0.513382 0.382122 0.768334
-vn -0.415876 -0.470748 0.778069
-vn -0.513382 -0.382122 0.768334
-vn -0.462172 0.554857 0.691733
-vn -0.092654 -0.980468 0.173345
-vn -0.109195 -0.980468 0.163427
-vn -0.451155 -0.289834 0.844050
-vn -0.544908 -0.194800 0.815516
-vn -0.299478 0.772240 0.560289
-vn -0.393262 0.706320 0.588549
-vn -0.222755 -0.881283 0.416761
-vn -0.213324 -0.923307 0.319254
-vn -0.471389 0.000000 0.881893
-vn -0.552873 -0.097842 0.827448
-vn -0.309244 0.830744 0.462813
-vn -0.309244 -0.830744 0.462813
-vn -0.213324 0.923307 0.319254
-vn -0.552873 0.097842 0.827448
-vn -0.393262 -0.706320 0.588549
-vn -0.046907 0.995025 0.087771
-vn -0.109195 0.980468 0.163427
-vn -0.462172 -0.554857 0.691733
-vn -0.055269 -0.995025 0.082736
-vn -0.162023 -0.956511 0.242500
-vn -0.262551 0.881283 0.392926
-vn -0.353099 -0.830744 0.430250
-vn -0.243599 0.923307 0.296823
-vn -0.631336 0.097842 0.769280
-vn -0.449049 -0.706320 0.547166
-vn -0.055269 0.995025 0.082736
-vn -0.124699 0.980468 0.151921
-vn -0.531693 0.289834 0.795770
-vn -0.586230 0.382122 0.714316
-vn -0.490158 -0.470748 0.733573
-vn -0.527757 -0.554857 0.643086
-vn -0.490158 0.470748 0.733543
-vn -0.527757 0.554857 0.643086
-vn -0.063143 -0.995025 0.076937
-vn -0.531693 -0.289834 0.795770
-vn -0.586230 -0.382122 0.714316
-vn -0.429792 0.633625 0.643239
-vn -0.449049 0.706320 0.547166
-vn -0.185034 -0.956511 0.225471
-vn -0.622211 -0.194800 0.758171
-vn -0.352947 0.772240 0.528214
-vn -0.353099 0.830744 0.430280
-vn -0.262551 -0.881283 0.392926
-vn -0.299783 0.881283 0.365307
-vn -0.555559 0.000000 0.831446
-vn -0.403027 -0.772240 0.491073
-vn -0.185034 0.956511 0.225471
-vn -0.622211 0.194769 0.758171
-vn -0.490768 -0.633625 0.598010
-vn -0.124699 -0.980468 0.151921
-vn -0.243599 -0.923307 0.296823
-vn -0.631336 -0.097842 0.769280
-vn -0.299783 -0.881283 0.365307
-vn -0.393567 -0.830744 0.393567
-vn -0.334147 0.881283 0.334147
-vn -0.634388 0.000000 0.773003
-vn -0.703696 0.097842 0.703696
-vn -0.449202 -0.772240 0.449202
-vn -0.206244 0.956511 0.206244
-vn -0.607135 0.289834 0.739799
-vn -0.693533 0.194769 0.693533
-vn -0.547014 -0.633625 0.547014
-vn -0.559679 0.470748 0.681967
-vn -0.653432 0.382122 0.653432
-vn -0.559679 -0.470748 0.681997
-vn -0.653432 -0.382122 0.653432
-vn -0.490768 0.633625 0.598010
-vn -0.588244 0.554857 0.588244
-vn -0.138981 -0.980468 0.138981
-vn -0.607135 -0.289834 0.739799
-vn -0.693533 -0.194800 0.693533
-vn -0.403027 0.772240 0.491073
-vn -0.500534 0.706320 0.500534
-vn -0.271493 -0.923307 0.271493
-vn -0.703696 -0.097842 0.703696
-vn -0.393567 0.830744 0.393567
-vn -0.271493 0.923307 0.271493
-vn -0.500534 -0.706320 0.500534
-vn -0.063143 0.995025 0.076937
-vn -0.138981 0.980468 0.138981
-vn -0.588244 -0.554857 0.588244
-vn -0.070376 -0.995025 0.070376
-vn -0.206244 -0.956511 0.206244
-vn -0.334147 -0.881283 0.334147
-vn -0.296823 -0.923307 0.243599
-vn -0.707083 0.000000 0.707083
-vn -0.769280 -0.097842 0.631336
-vn -0.430250 0.830744 0.353099
-vn -0.430250 -0.830744 0.353099
-vn -0.296823 0.923307 0.243599
-vn -0.769280 0.097842 0.631336
-vn -0.547166 -0.706320 0.449049
-vn -0.070376 0.995025 0.070376
-vn -0.151921 0.980468 0.124668
-vn -0.676748 0.289834 0.676748
-vn -0.714316 0.382122 0.586230
-vn -0.623829 -0.470748 0.623829
-vn -0.643086 -0.554857 0.527757
-vn -0.623829 0.470748 0.623829
-vn -0.643086 0.554857 0.527757
-vn -0.076937 -0.995025 0.063143
-vn -0.676748 -0.289834 0.676748
-vn -0.714316 -0.382122 0.586230
-vn -0.547014 0.633625 0.547014
-vn -0.547166 0.706320 0.449049
-vn -0.225471 -0.956511 0.185034
-vn -0.758202 -0.194800 0.622211
-vn -0.449202 0.772240 0.449202
-vn -0.365307 0.881283 0.299783
-vn -0.491073 -0.772240 0.403027
-vn -0.225471 0.956511 0.185034
-vn -0.758202 0.194769 0.622211
-vn -0.598010 -0.633625 0.490768
-vn -0.151921 -0.980468 0.124668
-vn -0.242500 -0.956511 0.162023
-vn -0.815516 -0.194800 0.544908
-vn -0.491073 0.772240 0.403027
-vn -0.462813 0.830744 0.309244
-vn -0.365307 -0.881283 0.299783
-vn -0.462813 -0.830744 0.309244
-vn -0.392926 0.881283 0.262551
-vn -0.773003 0.000000 0.634388
-vn -0.827448 0.097842 0.552873
-vn -0.528214 -0.772240 0.352947
-vn -0.242500 0.956511 0.162053
-vn -0.739799 0.289834 0.607135
-vn -0.815516 0.194769 0.544908
-vn -0.643239 -0.633625 0.429792
-vn -0.681967 0.470748 0.559679
-vn -0.768334 0.382122 0.513382
-vn -0.681997 -0.470748 0.559679
-vn -0.768334 -0.382122 0.513382
-vn -0.598010 0.633625 0.490768
-vn -0.691733 0.554857 0.462172
-vn -0.163427 -0.980468 0.109195
-vn -0.739799 -0.289834 0.607135
-vn -0.588549 0.706320 0.393262
-vn -0.319254 -0.923307 0.213324
-vn -0.827448 -0.097842 0.552873
-vn -0.319254 0.923307 0.213324
-vn -0.588549 -0.706320 0.393262
-vn -0.076937 0.995025 0.063143
-vn -0.163427 0.980468 0.109195
-vn -0.691733 -0.554857 0.462172
-vn -0.082736 -0.995025 0.055269
-vn -0.173345 -0.980468 0.092654
-vn -0.795770 -0.289834 0.531693
-vn -0.865017 -0.194800 0.462355
-vn -0.528214 0.772240 0.352947
-vn -0.624287 0.706320 0.333659
-vn -0.392926 -0.881283 0.262551
-vn -0.338633 -0.923307 0.181005
-vn -0.831446 0.000000 0.555559
-vn -0.877682 -0.097842 0.469131
-vn -0.490890 0.830744 0.262368
-vn -0.490890 -0.830744 0.262368
-vn -0.338633 0.923307 0.181005
-vn -0.865017 0.194769 0.462355
-vn -0.624287 -0.706320 0.333659
-vn -0.082736 0.995025 0.055300
-vn -0.173345 0.980468 0.092654
-vn -0.795770 0.289834 0.531693
-vn -0.814966 0.382122 0.435591
-vn -0.733573 -0.470748 0.490158
-vn -0.733696 -0.554857 0.392163
-vn -0.733543 0.470748 0.490158
-vn -0.733696 0.554857 0.392163
-vn -0.087771 -0.995025 0.046907
-vn -0.814966 -0.382122 0.435591
-vn -0.643239 0.633625 0.429792
-vn -0.257241 -0.956511 0.137486
-vn -0.416761 0.881283 0.222755
-vn -0.881893 0.000000 0.471389
-vn -0.560289 -0.772240 0.299478
-vn -0.257241 0.956511 0.137486
-vn -0.682272 -0.633625 0.364666
-vn -0.091952 -0.995025 0.038057
-vn -0.844050 -0.289834 0.451155
-vn -0.853755 -0.382122 0.353618
-vn -0.682272 0.633625 0.364666
-vn -0.653981 0.706320 0.270882
-vn -0.269478 -0.956511 0.111606
-vn -0.906156 -0.194800 0.375347
-vn -0.560289 0.772240 0.299478
-vn -0.514237 0.830744 0.212989
-vn -0.416761 -0.881283 0.222755
-vn -0.514237 -0.830744 0.212989
-vn -0.436598 0.881283 0.180822
-vn -0.877682 0.097842 0.469131
-vn -0.923856 0.000000 0.382672
-vn -0.586932 -0.772240 0.243110
-vn -0.269478 0.956511 0.111606
-vn -0.844050 0.289834 0.451155
-vn -0.906156 0.194769 0.375347
-vn -0.714713 -0.633625 0.296030
-vn -0.778069 0.470748 0.415876
-vn -0.853755 0.382122 0.353618
-vn -0.778069 -0.470748 0.415876
-vn -0.768609 0.554857 0.318369
-vn -0.181585 -0.980468 0.075198
-vn -0.354747 -0.923307 0.146916
-vn -0.919431 -0.097842 0.380840
-vn -0.354747 0.923307 0.146947
-vn -0.653981 -0.706320 0.270882
-vn -0.087771 0.995025 0.046907
-vn -0.181585 0.980468 0.075198
-vn -0.768609 -0.554857 0.318369
-vn -0.815088 -0.470748 0.337626
-vn -0.884304 -0.382122 0.268227
-vn -0.714713 0.633625 0.296030
-vn -0.796106 0.554857 0.241493
-vn -0.188086 -0.980468 0.057039
-vn -0.884213 -0.289834 0.366253
-vn -0.938597 -0.194800 0.284707
-vn -0.586932 0.772240 0.243110
-vn -0.677389 0.706320 0.205481
-vn -0.436598 -0.881283 0.180822
-vn -0.367443 -0.923307 0.111454
-vn -0.952330 -0.097842 0.288888
-vn -0.532640 0.830744 0.161565
-vn -0.532640 -0.830744 0.161565
-vn -0.367443 0.923307 0.111454
-vn -0.919431 0.097842 0.380840
-vn -0.938597 0.194769 0.284707
-vn -0.740287 -0.633625 0.224555
-vn -0.091952 0.995025 0.038087
-vn -0.188086 0.980468 0.057039
-vn -0.884213 0.289834 0.366253
-vn -0.884304 0.382122 0.268227
-vn -0.796106 -0.554857 0.241493
-vn -0.815088 0.470748 0.337626
-vn -0.095248 -0.995025 0.028871
-vn -0.279122 -0.956511 0.084658
-vn -0.452223 0.881283 0.137181
-vn -0.956938 0.000000 0.290262
-vn -0.607929 -0.772240 0.184393
-vn -0.279122 0.956511 0.084658
-vn -0.844264 -0.470748 0.256081
-vn -0.815943 -0.554857 0.162297
-vn -0.844264 0.470748 0.256081
-vn -0.815943 0.554857 0.162297
-vn -0.097598 -0.995025 0.019410
-vn -0.915830 -0.289834 0.277810
-vn -0.906339 -0.382122 0.180273
-vn -0.740287 0.633625 0.224555
-vn -0.694266 0.706320 0.138096
-vn -0.286081 -0.956511 0.056887
-vn -0.961974 -0.194800 0.191351
-vn -0.607929 0.772240 0.184393
-vn -0.545915 0.830744 0.108585
-vn -0.452223 -0.881283 0.137181
-vn -0.545915 -0.830744 0.108585
-vn -0.463485 0.881283 0.092196
-vn -0.952330 0.097842 0.288888
-vn -0.980773 0.000000 0.195074
-vn -0.677389 -0.706320 0.205481
-vn -0.623096 -0.772240 0.123936
-vn -0.286081 0.956511 0.056887
-vn -0.915830 0.289834 0.277810
-vn -0.961974 0.194769 0.191351
-vn -0.758751 -0.633625 0.150914
-vn -0.906339 0.382122 0.180273
-vn -0.192785 -0.980468 0.038331
-vn -0.376598 -0.923307 0.074892
-vn -0.976074 -0.097842 0.194128
-vn -0.376598 0.923307 0.074892
-vn -0.095248 0.995025 0.028871
-vn -0.192785 0.980468 0.038331
-vn -0.769890 -0.633625 0.075808
-vn -0.865291 0.470748 0.172094
-vn -0.919645 0.382122 0.090579
-vn -0.865291 -0.470748 0.172094
-vn -0.919645 -0.382122 0.090579
-vn -0.758751 0.633625 0.150914
-vn -0.827906 0.554857 0.081545
-vn -0.195593 -0.980468 0.019257
-vn -0.938658 -0.289834 0.186712
-vn -0.976104 -0.194800 0.096133
-vn -0.623096 0.772240 0.123936
-vn -0.704459 0.706320 0.069369
-vn -0.463485 -0.881283 0.092196
-vn -0.382122 -0.923307 0.037629
-vn -0.990387 -0.097842 0.097537
-vn -0.553941 0.830744 0.054537
-vn -0.553941 -0.830744 0.054537
-vn -0.382122 0.923307 0.037629
-vn -0.976074 0.097842 0.194128
-vn -0.976104 0.194769 0.096133
-vn -0.694266 -0.706320 0.138096
-vn -0.097598 0.995025 0.019410
-vn -0.195593 0.980468 0.019257
-vn -0.938658 0.289834 0.186712
-vn -0.827906 -0.554857 0.081515
-vn -0.099033 -0.995025 0.009735
-vn -0.290262 -0.956511 0.028565
-vn -0.470290 0.881283 0.046297
-vn -0.995178 0.000000 0.097995
-vn -0.632221 -0.772240 0.062258
-vn -0.290262 0.956511 0.028565
-vn -0.980834 -0.194769 0.000000
-vn -0.990387 0.097842 0.097537
-vn -0.980834 0.194769 0.000000
-vn -0.995178 -0.097842 0.000000
-vn -1.000000 0.000000 0.000000
-vn -0.995178 0.097842 0.000000
-vn -0.882260 -0.470748 0.000000
-vn -0.882260 0.470748 0.000000
-vn 0.000000 1.000000 0.000000
-vn 0.000000 -1.000000 0.000000
-vn -0.099033 0.995025 0.009735
-vn -0.704459 -0.706320 0.069369
-vn -0.952452 0.289834 0.093783
-vn -0.877987 -0.470748 0.086459
-vn -0.877987 0.470748 0.086459
-vn -0.952452 -0.289834 0.093783
-vn -0.769890 0.633625 0.075808
-vn -0.632221 0.772240 0.062258
-vn -0.470290 -0.881283 0.046297
-usemtl Material.001
-s 1
-f 22/1/1 21/2/2 54/3/3
-f 6/4/4 5/5/5 32/6/6
-f 20/7/7 19/8/8 52/9/9
-f 4/10/10 3/11/11 30/12/12
-f 18/13/13 17/14/14 50/15/15
-f 2/16/16 1/17/17 28/18/18
-f 12/19/19 11/20/20 39/21/21
-f 25/22/22 24/23/23 57/24/24
-f 15/25/25 14/26/26 46/27/27
-f 9/28/28 8/29/29 35/30/30
-f 23/31/31 22/1/1 55/32/32
-f 7/33/33 6/4/4 33/34/34
-f 21/2/2 20/7/7 53/35/35
-f 5/5/5 4/10/10 31/36/36
-f 19/8/8 18/13/13 51/37/37
-f 3/11/11 2/16/16 29/38/38
-f 17/39/14 16/40/39 49/41/40
-f 10/42/41 9/43/28 36/44/42
-f 24/23/23 23/31/31 56/45/43
-f 8/29/29 7/33/33 34/46/44
-f 55/32/32 54/3/3 86/47/45
-f 44/48/46 43/49/47 75/50/48
-f 33/34/34 32/6/6 64/51/49
-f 53/35/35 52/9/9 84/52/50
-f 31/36/36 30/12/12 62/53/51
-f 42/54/52 41/55/53 73/56/54
-f 51/37/37 50/15/15 82/57/55
-f 29/38/38 28/18/18 60/58/56
-f 40/59/57 39/21/21 71/60/58
-f 49/41/40 48/61/59 80/62/60
-f 38/63/61 37/64/62 69/65/63
-f 47/66/64 46/27/27 78/67/65
-f 36/44/42 35/68/30 67/69/66
-f 56/45/43 55/32/32 87/70/67
-f 45/71/68 44/48/46 76/72/69
-f 34/46/44 33/34/34 65/73/70
-f 54/3/3 53/35/35 85/74/71
-f 43/49/47 42/54/52 74/75/72
-f 32/6/6 31/36/36 63/76/73
-f 52/9/9 51/37/37 83/77/74
-f 30/12/12 29/38/38 61/78/75
-f 41/55/53 40/59/57 72/79/76
-f 50/15/15 49/80/40 81/81/77
-f 28/18/18 27/82/78 59/83/79
-f 39/21/21 38/63/61 70/84/80
-f 48/61/59 47/66/64 79/85/81
-f 37/64/62 36/44/42 68/86/82
-f 57/24/24 56/45/43 88/87/83
-f 46/27/27 45/71/68 77/88/84
-f 35/30/30 34/46/44 66/89/85
-f 87/70/67 86/47/45 118/90/86
-f 76/72/69 75/50/48 107/91/87
-f 65/73/70 64/51/49 96/92/88
-f 85/74/71 84/52/50 116/93/89
-f 74/75/72 73/56/54 105/94/90
-f 63/76/73 62/53/51 94/95/91
-f 83/77/74 82/57/55 114/96/92
-f 61/78/75 60/58/56 92/97/93
-f 72/98/76 71/99/58 103/100/94
-f 81/81/77 80/101/60 112/102/95
-f 59/83/79 58/103/96 90/104/97
-f 70/105/80 69/106/63 101/107/98
-f 79/85/81 78/67/65 110/108/99
-f 68/109/82 67/110/66 99/111/100
-f 88/87/83 87/70/67 119/112/101
-f 77/88/84 76/72/69 108/113/102
-f 66/89/85 65/73/70 97/114/103
-f 86/47/45 85/74/71 117/115/104
-f 75/50/48 74/75/72 106/116/105
-f 64/51/49 63/76/73 95/117/106
-f 84/52/50 83/77/74 115/118/107
-f 62/53/51 61/78/75 93/119/108
-f 73/120/54 72/98/76 104/121/109
-f 82/57/55 81/81/77 113/122/110
-f 60/58/56 59/83/79 91/123/111
-f 71/99/58 70/105/80 102/124/112
-f 80/101/60 79/125/81 111/126/113
-f 69/106/63 68/109/82 100/127/114
-f 78/67/65 77/88/84 109/128/115
-f 67/110/66 66/129/85 98/130/116
-f 119/112/101 118/90/86 150/131/117
-f 108/132/102 107/133/87 139/134/118
-f 97/114/103 96/92/88 128/135/119
-f 117/115/104 116/93/89 148/136/120
-f 106/137/105 105/138/90 137/139/121
-f 95/117/106 94/95/91 126/140/122
-f 115/118/107 114/96/92 146/141/123
-f 93/119/108 92/97/93 124/142/124
-f 104/121/109 103/100/94 135/143/125
-f 113/122/110 112/102/95 144/144/126
-f 91/123/111 90/104/97 122/145/127
-f 102/124/112 101/107/98 133/146/128
-f 111/126/113 110/147/99 142/148/129
-f 100/127/114 99/111/100 131/149/130
-f 109/150/115 108/132/102 140/151/131
-f 98/130/116 97/152/103 129/153/132
-f 118/90/86 117/115/104 149/154/133
-f 107/133/87 106/137/105 138/155/134
-f 96/92/88 95/117/106 127/156/135
-f 116/93/89 115/118/107 147/157/136
-f 105/138/90 104/121/109 136/158/137
-f 94/95/91 93/119/108 125/159/138
-f 114/96/92 113/122/110 145/160/139
-f 92/97/93 91/123/111 123/161/140
-f 103/100/94 102/124/112 134/162/141
-f 112/102/95 111/126/113 143/163/142
-f 90/104/97 89/164/143 121/165/144
-f 101/107/98 100/127/114 132/166/145
-f 110/167/99 109/150/115 141/168/146
-f 99/111/100 98/130/116 130/169/147
-f 140/151/131 139/134/118 170/170/148
-f 129/153/132 128/171/119 160/172/149
-f 149/154/133 148/136/120 180/173/150
-f 138/155/134 137/139/121 169/174/151
-f 127/156/135 126/140/122 158/175/152
-f 147/157/136 146/141/123 178/176/153
-f 136/158/137 135/143/125 167/177/154
-f 125/159/138 124/142/124 156/178/155
-f 145/160/139 144/144/126 176/179/156
-f 123/161/140 122/145/127 154/180/157
-f 134/162/141 133/146/128 165/181/158
-f 143/163/142 142/148/129 174/182/159
-f 121/165/144 120/183/160 152/184/161
-f 132/166/145 131/149/130 162/185/162
-f 141/168/146 140/151/131 172/186/163
-f 130/169/147 129/153/132 161/187/164
-f 150/131/117 149/154/133 181/188/165
-f 139/134/118 138/155/134 170/170/148
-f 128/135/119 127/156/135 159/189/166
-f 148/136/120 147/157/136 179/190/167
-f 137/139/121 136/158/137 168/191/168
-f 126/140/122 125/159/138 156/178/155
-f 146/141/123 145/160/139 177/192/169
-f 124/142/124 123/161/140 155/193/170
-f 135/143/125 134/162/141 166/194/171
-f 144/144/126 143/163/142 175/195/172
-f 122/145/127 121/165/144 153/196/173
-f 133/146/128 132/166/145 164/197/174
-f 142/198/129 141/168/146 173/199/175
-f 131/149/130 130/169/147 162/185/162
-f 172/186/163 171/200/176 203/201/177
-f 161/187/164 160/172/149 192/202/178
-f 181/188/165 180/173/150 212/203/179
-f 170/170/148 169/174/151 201/204/180
-f 159/205/166 158/206/152 190/207/181
-f 179/190/167 178/176/153 210/208/182
-f 168/191/168 167/177/154 199/209/183
-f 157/210/184 156/178/155 188/211/185
-f 177/192/169 176/179/156 208/212/186
-f 155/193/170 154/180/157 186/213/187
-f 166/194/171 165/181/158 197/214/188
-f 175/195/172 174/182/159 206/215/189
-f 153/196/173 152/184/161 184/216/190
-f 164/197/174 163/217/191 195/218/192
-f 173/199/175 172/186/163 204/219/193
-f 162/185/162 161/187/164 193/220/194
-f 171/200/176 170/170/148 201/204/180
-f 160/172/149 159/205/166 191/221/195
-f 180/173/150 179/190/167 211/222/196
-f 169/174/151 168/191/168 200/223/197
-f 158/175/152 157/210/184 189/224/198
-f 178/176/153 177/192/169 209/225/199
-f 167/177/154 166/194/171 198/226/200
-f 156/178/155 155/193/170 187/227/201
-f 176/179/156 175/195/172 207/228/202
-f 154/180/157 153/196/173 185/229/203
-f 165/181/158 164/197/174 196/230/204
-f 174/182/159 173/231/175 205/232/205
-f 152/184/161 151/233/206 183/234/207
-f 163/217/191 162/185/162 193/220/194
-f 204/219/193 203/201/177 235/235/208
-f 193/220/194 192/202/178 224/236/209
-f 202/237/210 201/204/180 232/238/211
-f 191/221/195 190/207/181 222/239/212
-f 211/222/196 210/208/182 242/240/213
-f 200/223/197 199/209/183 231/241/214
-f 189/224/198 188/211/185 220/242/215
-f 209/225/199 208/212/186 240/243/216
-f 198/226/200 197/214/188 229/244/217
-f 187/227/201 186/213/187 218/245/218
-f 207/228/202 206/215/189 238/246/219
-f 185/229/203 184/216/190 216/247/220
-f 196/230/204 195/218/192 227/248/221
-f 205/232/205 204/249/193 236/250/222
-f 183/234/207 182/251/223 214/252/224
-f 194/253/225 193/220/194 224/236/209
-f 203/201/177 202/237/210 233/254/226
-f 192/202/178 191/221/195 223/255/227
-f 212/203/179 211/222/196 243/256/228
-f 201/204/180 200/223/197 232/238/211
-f 190/207/181 189/257/198 221/258/229
-f 210/208/182 209/225/199 241/259/230
-f 199/209/183 198/226/200 230/260/231
-f 188/211/185 187/227/201 219/261/232
-f 208/212/186 207/228/202 239/262/233
-f 186/213/187 185/229/203 217/263/234
-f 197/214/188 196/230/204 228/264/235
-f 206/215/189 205/232/205 236/250/222
-f 184/216/190 183/234/207 215/265/236
-f 195/218/192 194/253/225 226/266/237
-f 236/250/222 235/267/208 267/268/238
-f 214/252/224 213/269/239 245/270/240
-f 225/271/241 224/236/209 255/272/242
-f 234/273/243 233/254/226 265/274/244
-f 223/255/227 222/239/212 254/275/245
-f 243/256/228 242/240/213 274/276/246
-f 232/238/211 231/241/214 263/277/247
-f 221/258/229 220/278/215 252/279/248
-f 241/259/230 240/243/216 272/280/249
-f 230/260/231 229/244/217 261/281/250
-f 219/261/232 218/245/218 250/282/251
-f 239/262/233 238/246/219 270/283/252
-f 217/263/234 216/247/220 248/284/253
-f 228/264/235 227/248/221 259/285/254
-f 237/286/255 236/250/222 268/287/256
-f 215/265/236 214/252/224 246/288/257
-f 226/266/237 225/271/241 257/289/258
-f 235/235/208 234/273/243 265/274/244
-f 224/236/209 223/255/227 255/272/242
-f 233/254/226 232/238/211 263/277/247
-f 222/239/212 221/258/229 253/290/259
-f 242/240/213 241/259/230 273/291/260
-f 231/241/214 230/260/231 261/281/250
-f 220/242/215 219/261/232 251/292/261
-f 240/243/216 239/262/233 271/293/262
-f 229/244/217 228/264/235 260/294/263
-f 218/245/218 217/263/234 249/295/264
-f 238/246/219 237/286/255 269/296/265
-f 216/247/220 215/265/236 247/297/266
-f 227/248/221 226/266/237 258/298/267
-f 268/287/256 267/268/238 299/299/268
-f 246/288/257 245/270/240 277/300/269
-f 257/289/258 256/301/270 288/302/271
-f 266/303/272 265/274/244 296/304/273
-f 255/272/242 254/275/245 286/305/274
-f 264/306/275 263/277/247 294/307/276
-f 253/290/259 252/279/248 284/308/277
-f 273/291/260 272/280/249 304/309/278
-f 262/310/279 261/281/250 292/311/280
-f 251/292/261 250/282/251 282/312/281
-f 271/293/262 270/283/252 302/313/282
-f 260/294/263 259/285/254 291/314/283
-f 249/295/264 248/284/253 280/315/284
-f 269/296/265 268/287/256 299/299/268
-f 247/297/266 246/288/257 278/316/285
-f 258/298/267 257/289/258 289/317/286
-f 267/318/238 266/303/272 298/319/287
-f 245/270/240 244/320/288 276/321/289
-f 256/301/270 255/272/242 286/305/274
-f 265/274/244 264/306/275 296/304/273
-f 254/275/245 253/290/259 285/322/290
-f 274/276/246 273/291/260 305/323/291
-f 263/277/247 262/310/279 294/307/276
-f 252/279/248 251/324/261 283/325/292
-f 272/280/249 271/293/262 303/326/293
-f 261/281/250 260/294/263 292/311/280
-f 250/282/251 249/295/264 281/327/294
-f 270/283/252 269/296/265 301/328/295
-f 248/284/253 247/297/266 279/329/296
-f 259/285/254 258/298/267 290/330/297
-f 300/331/298 299/299/268 331/332/299
-f 278/316/285 277/300/269 309/333/300
-f 289/317/286 288/302/271 319/334/301
-f 298/319/287 297/335/302 329/336/303
-f 276/321/289 275/337/304 307/338/305
-f 287/339/306 286/305/274 317/340/307
-f 296/304/273 295/341/308 327/342/309
-f 285/322/290 284/308/277 316/343/310
-f 305/323/291 304/309/278 336/344/311
-f 294/307/276 293/345/312 325/346/313
-f 283/325/292 282/347/281 314/348/314
-f 303/326/293 302/313/282 334/349/315
-f 292/311/280 291/314/283 323/350/316
-f 281/327/294 280/315/284 312/351/317
-f 301/328/295 300/331/298 332/352/318
-f 279/329/296 278/316/285 310/353/319
-f 290/330/297 289/317/286 321/354/320
-f 299/299/268 298/355/287 330/356/321
-f 277/300/269 276/321/289 308/357/322
-f 288/302/271 287/339/306 319/334/301
-f 297/335/302 296/304/273 327/342/309
-f 286/305/274 285/322/290 317/340/307
-f 295/341/308 294/307/276 325/346/313
-f 284/308/277 283/325/292 315/358/323
-f 304/309/278 303/326/293 335/359/324
-f 293/345/312 292/311/280 323/350/316
-f 282/312/281 281/327/294 313/360/325
-f 302/313/282 301/328/295 333/361/326
-f 291/314/283 290/330/297 322/362/327
-f 280/315/284 279/329/296 311/363/328
-f 332/352/318 331/332/299 363/364/329
-f 310/353/319 309/333/300 341/365/330
-f 321/354/320 320/366/331 352/367/332
-f 330/356/321 329/368/303 361/369/333
-f 308/357/322 307/338/305 339/370/334
-f 319/334/301 318/371/335 350/372/336
-f 328/373/337 327/342/309 358/374/338
-f 317/340/307 316/343/310 348/375/339
-f 326/376/340 325/346/313 356/377/341
-f 315/358/323 314/348/314 346/378/342
-f 335/359/324 334/349/315 366/379/343
-f 324/380/344 323/350/316 354/381/345
-f 313/360/325 312/351/317 344/382/346
-f 333/361/326 332/352/318 364/383/347
-f 322/362/327 321/354/320 353/384/348
-f 311/363/328 310/353/319 342/385/349
-f 331/332/299 330/356/321 361/369/333
-f 309/333/300 308/357/322 340/386/350
-f 320/366/331 319/334/301 350/372/336
-f 329/336/303 328/373/337 360/387/351
-f 307/338/305 306/388/352 338/389/353
-f 318/371/335 317/340/307 348/375/339
-f 327/342/309 326/376/340 358/374/338
-f 316/343/310 315/358/323 347/390/354
-f 336/344/311 335/359/324 367/391/355
-f 325/346/313 324/380/344 356/377/341
-f 314/348/314 313/392/325 345/393/356
-f 334/349/315 333/361/326 365/394/357
-f 323/350/316 322/362/327 354/381/345
-f 312/351/317 311/363/328 343/395/358
-f 364/383/347 363/364/329 394/396/359
-f 353/384/348 352/367/332 384/397/360
-f 342/385/349 341/365/330 373/398/361
-f 362/399/362 361/369/333 393/400/363
-f 340/386/350 339/370/334 371/401/364
-f 351/402/365 350/372/336 381/403/366
-f 360/387/351 359/404/367 391/405/368
-f 338/389/353 337/406/369 369/407/370
-f 349/408/371 348/375/339 379/409/372
-f 358/374/338 357/410/373 389/411/374
-f 347/390/354 346/378/342 378/412/375
-f 367/391/355 366/379/343 398/413/376
-f 356/377/341 355/414/377 387/415/378
-f 345/393/356 344/416/346 376/417/379
-f 365/394/357 364/383/347 396/418/380
-f 354/381/345 353/384/348 385/419/381
-f 343/395/358 342/385/349 374/420/382
-f 363/364/329 362/399/362 393/400/363
-f 341/365/330 340/386/350 372/421/383
-f 352/367/332 351/402/365 383/422/384
-f 361/369/333 360/423/351 392/424/385
-f 339/370/334 338/389/353 370/425/386
-f 350/372/336 349/408/371 381/403/366
-f 359/404/367 358/374/338 390/426/387
-f 348/375/339 347/390/354 379/409/372
-f 357/410/373 356/377/341 387/415/378
-f 346/378/342 345/393/356 377/427/388
-f 366/379/343 365/394/357 397/428/389
-f 355/414/377 354/381/345 385/419/381
-f 344/382/346 343/395/358 375/429/390
-f 396/418/380 395/430/391 427/431/392
-f 385/419/381 384/397/360 416/432/393
-f 374/420/382 373/398/361 405/433/394
-f 394/396/359 393/400/363 425/434/395
-f 372/421/383 371/401/364 403/435/396
-f 383/422/384 382/436/397 414/437/398
-f 392/424/385 391/438/368 423/439/399
-f 370/425/386 369/407/370 401/440/400
-f 381/403/366 380/441/401 412/442/402
-f 390/426/387 389/411/374 421/443/403
-f 379/409/372 378/412/375 410/444/404
-f 388/445/405 387/415/378 418/446/406
-f 377/427/388 376/417/379 408/447/407
-f 397/428/389 396/418/380 428/448/408
-f 386/449/409 385/419/381 416/432/393
-f 375/429/390 374/420/382 406/450/410
-f 395/430/391 394/396/359 426/451/411
-f 384/397/360 383/422/384 415/452/412
-f 373/398/361 372/421/383 404/453/413
-f 393/400/363 392/424/385 424/454/414
-f 371/401/364 370/425/386 402/455/415
-f 382/436/397 381/403/366 412/442/402
-f 391/405/368 390/426/387 422/456/416
-f 369/407/370 368/457/417 400/458/418
-f 380/441/401 379/409/372 410/444/404
-f 389/411/374 388/445/405 420/459/419
-f 378/412/375 377/427/388 409/460/420
-f 398/413/376 397/428/389 429/461/421
-f 387/415/378 386/449/409 418/446/406
-f 376/417/379 375/462/390 407/463/422
-f 428/448/408 427/431/392 459/464/423
-f 417/465/424 416/432/393 447/466/425
-f 406/450/410 405/433/394 437/467/426
-f 426/451/411 425/434/395 457/468/427
-f 415/452/412 414/437/398 446/469/428
-f 404/453/413 403/435/396 435/470/429
-f 424/454/414 423/439/399 455/471/430
-f 402/455/415 401/440/400 433/472/431
-f 413/473/432 412/442/402 443/474/433
-f 422/475/416 421/476/403 453/477/434
-f 400/458/418 399/478/435 431/479/436
-f 411/480/437 410/444/404 441/481/438
-f 420/459/419 419/482/439 450/483/440
-f 409/460/420 408/447/407 440/484/441
-f 429/461/421 428/448/408 460/485/442
-f 418/446/406 417/465/424 449/486/443
-f 407/463/422 406/487/410 438/488/444
-f 427/431/392 426/451/411 458/489/445
-f 416/432/393 415/452/412 447/466/425
-f 405/433/394 404/453/413 436/490/446
-f 425/434/395 424/454/414 456/491/447
-f 403/435/396 402/455/415 434/492/448
-f 414/437/398 413/473/432 445/493/449
-f 423/439/399 422/475/416 454/494/450
-f 401/440/400 400/458/418 432/495/451
-f 412/442/402 411/480/437 443/474/433
-f 421/443/403 420/459/419 452/496/452
-f 410/444/404 409/460/420 441/481/438
-f 419/482/439 418/446/406 449/486/443
-f 408/447/407 407/463/422 438/488/444
-f 460/485/442 459/464/423 491/497/453
-f 449/486/443 448/498/454 480/499/455
-f 438/488/444 437/500/426 469/501/456
-f 458/489/445 457/468/427 489/502/457
-f 447/466/425 446/469/428 478/503/458
-f 436/490/446 435/470/429 466/504/459
-f 456/491/447 455/471/430 486/505/460
-f 434/492/448 433/472/431 465/506/461
-f 445/493/449 444/507/462 476/508/463
-f 454/494/450 453/477/434 485/509/464
-f 432/495/451 431/479/436 463/510/465
-f 443/474/433 442/511/466 474/512/467
-f 452/496/452 451/513/468 483/514/469
-f 441/481/438 440/484/441 472/515/470
-f 450/483/440 449/486/443 480/499/455
-f 439/516/471 438/488/444 469/501/456
-f 459/464/423 458/489/445 490/517/472
-f 448/498/454 447/466/425 478/503/458
-f 437/467/426 436/490/446 468/518/473
-f 457/468/427 456/491/447 488/519/474
-f 446/469/428 445/493/449 477/520/475
-f 435/470/429 434/492/448 466/504/459
-f 455/471/430 454/494/450 486/505/460
-f 433/472/431 432/495/451 464/521/476
-f 444/507/462 443/474/433 474/512/467
-f 453/477/434 452/522/452 484/523/477
-f 431/479/436 430/524/478 462/525/479
-f 442/511/466 441/481/438 472/515/470
-f 451/513/468 450/483/440 482/526/480
-f 440/484/441 439/516/471 471/527/481
-f 481/528/482 480/499/455 511/529/483
-f 470/530/484 469/501/456 500/531/485
-f 490/517/472 489/502/457 521/532/486
-f 479/533/487 478/503/458 509/534/488
-f 468/518/473 467/535/489 499/536/490
-f 488/519/474 487/537/491 519/538/492
-f 477/520/475 476/508/463 508/539/493
-f 466/504/459 465/506/461 497/540/494
-f 486/505/460 485/509/464 517/541/495
-f 464/521/476 463/510/465 495/542/496
-f 475/543/497 474/512/467 505/544/498
-f 484/523/477 483/545/469 515/546/499
-f 462/525/479 461/547/500 493/548/501
-f 473/549/502 472/515/470 503/550/503
-f 482/526/480 481/528/482 513/551/504
-f 471/527/481 470/530/484 502/552/505
-f 491/497/453 490/517/472 522/553/506
-f 480/499/455 479/533/487 511/529/483
-f 469/501/456 468/554/473 500/531/485
-f 489/502/457 488/519/474 520/555/507
-f 478/503/458 477/520/475 509/534/488
-f 467/535/489 466/504/459 498/556/508
-f 487/537/491 486/505/460 517/541/495
-f 465/506/461 464/521/476 496/557/509
-f 476/508/463 475/543/497 507/558/510
-f 485/509/464 484/523/477 516/559/511
-f 463/510/465 462/525/479 494/560/512
-f 474/512/467 473/549/502 505/544/498
-f 483/514/469 482/526/480 514/561/513
-f 472/515/470 471/527/481 503/550/503
-f 513/551/504 512/562/514 544/563/515
-f 502/552/505 501/564/516 533/565/517
-f 522/553/506 521/532/486 553/566/518
-f 511/529/483 510/567/519 542/568/520
-f 500/569/485 499/536/490 531/570/521
-f 520/555/507 519/538/492 551/571/522
-f 509/534/488 508/539/493 540/572/523
-f 498/556/508 497/540/494 529/573/524
-f 518/574/525 517/541/495 549/575/526
-f 496/557/509 495/542/496 527/576/527
-f 507/558/510 506/577/528 538/578/529
-f 516/559/511 515/546/499 547/579/530
-f 494/560/512 493/548/501 525/580/531
-f 505/544/498 504/581/532 536/582/533
-f 514/561/513 513/551/504 545/583/534
-f 503/550/503 502/552/505 534/584/535
-f 512/562/514 511/529/483 542/568/520
-f 501/564/516 500/531/485 531/585/521
-f 521/532/486 520/555/507 552/586/536
-f 510/567/519 509/534/488 540/572/523
-f 499/536/490 498/556/508 530/587/537
-f 519/538/492 518/574/525 550/588/538
-f 508/539/493 507/558/510 539/589/539
-f 497/540/494 496/557/509 528/590/540
-f 517/541/495 516/559/511 548/591/541
-f 495/542/496 494/560/512 526/592/542
-f 506/577/528 505/544/498 536/582/533
-f 515/546/499 514/593/513 546/594/543
-f 493/548/501 492/595/544 524/596/545
-f 504/581/532 503/550/503 534/584/535
-f 545/597/534 544/598/515 576/599/546
-f 534/584/535 533/565/517 565/600/547
-f 543/601/548 542/568/520 573/602/549
-f 532/603/550 531/585/521 562/604/551
-f 552/586/536 551/571/522 583/605/552
-f 541/606/553 540/572/523 571/607/554
-f 530/587/537 529/573/524 561/608/555
-f 550/588/538 549/575/526 581/609/556
-f 539/589/539 538/578/529 570/610/557
-f 528/590/540 527/576/527 559/611/558
-f 548/591/541 547/579/530 579/612/559
-f 526/592/542 525/580/531 557/613/560
-f 537/614/561 536/582/533 567/615/562
-f 546/594/543 545/597/534 577/616/563
-f 524/596/545 523/617/564 555/618/565
-f 535/619/566 534/584/535 565/600/547
-f 544/563/515 543/601/548 575/620/567
-f 533/565/517 532/603/550 564/621/568
-f 553/566/518 552/586/536 584/622/569
-f 542/568/520 541/606/553 573/602/549
-f 531/570/521 530/587/537 562/623/551
-f 551/571/522 550/588/538 582/624/570
-f 540/572/523 539/589/539 571/607/554
-f 529/573/524 528/590/540 560/625/571
-f 549/575/526 548/591/541 579/612/559
-f 527/576/527 526/592/542 558/626/572
-f 538/578/529 537/614/561 569/627/573
-f 547/579/530 546/594/543 578/628/574
-f 525/580/531 524/596/545 556/629/575
-f 536/582/533 535/619/566 567/615/562
-f 577/616/563 576/599/546 608/630/576
-f 555/618/565 554/631/577 586/632/578
-f 566/633/579 565/600/547 596/634/580
-f 575/620/567 574/635/581 606/636/582
-f 564/637/568 563/638/583 595/639/584
-f 584/622/569 583/605/552 615/640/585
-f 573/602/549 572/641/586 604/642/587
-f 562/623/551 561/608/555 593/643/588
-f 582/624/570 581/609/556 613/644/589
-f 571/607/554 570/610/557 602/645/590
-f 560/625/571 559/611/558 591/646/591
-f 580/647/592 579/612/559 611/648/593
-f 558/626/572 557/613/560 589/649/594
-f 569/627/573 568/650/595 600/651/596
-f 578/628/574 577/616/563 609/652/597
-f 556/629/575 555/618/565 587/653/598
-f 567/615/562 566/633/579 598/654/599
-f 576/599/546 575/655/567 607/656/600
-f 565/657/547 564/637/568 596/658/580
-f 574/659/581 573/660/549 604/661/587
-f 563/638/583 562/662/551 593/663/588
-f 583/605/552 582/624/570 614/664/601
-f 572/641/586 571/607/554 602/645/590
-f 561/608/555 560/625/571 592/665/602
-f 581/609/556 580/647/592 612/666/603
-f 570/610/557 569/627/573 601/667/604
-f 559/611/558 558/626/572 590/668/605
-f 579/612/559 578/628/574 610/669/606
-f 557/613/560 556/629/575 588/670/607
-f 568/650/595 567/615/562 598/654/599
-f 609/652/597 608/630/576 640/671/608
-f 587/653/598 586/632/578 618/672/609
-f 598/673/599 597/674/610 629/675/611
-f 607/656/600 606/676/582 638/677/612
-f 596/658/580 595/639/584 627/678/613
-f 605/679/614 604/661/587 635/680/615
-f 594/681/616 593/663/588 624/682/617
-f 614/664/601 613/644/589 645/683/618
-f 603/684/619 602/685/590 633/686/620
-f 592/665/602 591/646/591 623/687/621
-f 612/666/603 611/648/593 643/688/622
-f 601/689/604 600/690/596 632/691/623
-f 590/668/605 589/649/594 621/692/624
-f 610/669/606 609/652/597 641/693/625
-f 588/670/607 587/653/598 619/694/626
-f 599/695/627 598/673/599 629/675/611
-f 608/630/576 607/656/600 639/696/628
-f 586/632/578 585/697/629 617/698/630
-f 597/674/610 596/658/580 627/678/613
-f 606/699/582 605/679/614 637/700/631
-f 595/639/584 594/681/616 626/701/632
-f 615/640/585 614/664/601 646/702/633
-f 604/661/587 603/684/619 635/680/615
-f 593/643/588 592/665/602 624/703/617
-f 613/644/589 612/666/603 644/704/634
-f 602/685/590 601/689/604 633/686/620
-f 591/646/591 590/668/605 622/705/635
-f 611/648/593 610/669/606 641/693/625
-f 589/649/594 588/670/607 620/706/636
-f 600/690/596 599/695/627 631/707/637
-f 641/693/625 640/671/608 672/708/638
-f 619/694/626 618/672/609 650/709/639
-f 630/710/640 629/675/611 660/711/641
-f 639/696/628 638/677/612 670/712/642
-f 617/698/630 616/713/643 648/714/644
-f 628/715/645 627/678/613 658/716/646
-f 637/700/631 636/717/647 668/718/648
-f 626/701/632 625/719/649 656/720/650
-f 646/702/633 645/683/618 677/721/651
-f 635/680/615 634/722/652 666/723/653
-f 624/703/617 623/687/621 655/724/654
-f 644/704/634 643/688/622 675/725/655
-f 633/686/620 632/691/623 664/726/656
-f 622/705/635 621/692/624 653/727/657
-f 642/728/658 641/693/625 672/708/638
-f 620/706/636 619/694/626 651/729/659
-f 631/707/637 630/710/640 662/730/660
-f 640/671/608 639/696/628 671/731/661
-f 618/672/609 617/698/630 649/732/662
-f 629/675/611 628/715/645 660/711/641
-f 638/733/612 637/700/631 669/734/663
-f 627/678/613 626/701/632 658/716/646
-f 636/717/647 635/680/615 666/723/653
-f 625/719/649 624/682/617 656/720/650
-f 645/683/618 644/704/634 676/735/664
-f 634/722/652 633/686/620 664/726/656
-f 623/687/621 622/705/635 654/736/665
-f 643/688/622 642/728/658 674/737/666
-f 632/691/623 631/707/637 663/738/667
-f 621/692/624 620/706/636 652/739/668
-f 673/740/669 672/708/638 703/741/670
-f 651/729/659 650/709/639 682/742/671
-f 662/730/660 661/743/672 692/744/673
-f 671/731/661 670/712/642 702/745/674
-f 649/732/662 648/714/644 680/746/675
-f 660/711/641 659/747/676 691/748/677
-f 669/734/663 668/718/648 700/749/678
-f 658/716/646 657/750/679 689/751/680
-f 667/752/681 666/723/653 697/753/682
-f 656/720/650 655/754/654 687/755/683
-f 676/735/664 675/725/655 707/756/684
-f 665/757/685 664/726/656 695/758/686
-f 654/736/665 653/727/657 685/759/687
-f 674/737/666 673/740/669 705/760/688
-f 663/738/667 662/730/660 694/761/689
-f 652/739/668 651/729/659 683/762/690
-f 672/708/638 671/731/661 703/741/670
-f 650/709/639 649/732/662 681/763/691
-f 661/743/672 660/711/641 692/744/673
-f 670/712/642 669/764/663 701/765/692
-f 648/714/644 647/766/693 679/767/694
-f 659/747/676 658/716/646 689/751/680
-f 668/718/648 667/752/681 699/768/695
-f 657/750/679 656/720/650 687/755/683
-f 677/721/651 676/735/664 708/769/696
-f 666/723/653 665/757/685 697/753/682
-f 655/754/654 654/770/665 686/771/697
-f 675/725/655 674/737/666 706/772/698
-f 664/726/656 663/738/667 695/758/686
-f 653/727/657 652/739/668 684/773/699
-f 705/760/688 704/774/700 736/775/701
-f 694/761/689 693/776/702 725/777/703
-f 683/762/690 682/742/671 714/778/704
-f 703/741/670 702/745/674 734/779/705
-f 681/763/691 680/746/675 712/780/706
-f 692/744/673 691/748/677 722/781/707
-f 701/765/692 700/782/678 732/783/708
-f 679/767/694 678/784/709 710/785/710
-f 690/786/711 689/751/680 720/787/712
-f 699/768/695 698/788/713 730/789/714
-f 688/790/715 687/755/683 718/791/716
-f 708/769/696 707/756/684 739/792/717
-f 697/753/682 696/793/718 728/794/719
-f 686/771/697 685/795/687 717/796/720
-f 706/772/698 705/760/688 737/797/721
-f 695/758/686 694/761/689 726/798/722
-f 684/773/699 683/762/690 715/799/723
-f 704/774/700 703/741/670 734/779/705
-f 682/742/671 681/763/691 713/800/724
-f 693/776/702 692/744/673 723/801/725
-f 702/745/674 701/765/692 733/802/726
-f 680/746/675 679/767/694 711/803/727
-f 691/748/677 690/786/711 722/781/707
-f 700/749/678 699/768/695 731/804/728
-f 689/751/680 688/790/715 720/787/712
-f 698/788/713 697/753/682 728/794/719
-f 687/755/683 686/771/697 718/791/716
-f 707/756/684 706/772/698 738/805/729
-f 696/793/718 695/758/686 727/806/730
-f 685/759/687 684/773/699 716/807/731
-f 737/797/721 736/775/701 768/808/732
-f 726/798/722 725/777/703 757/809/733
-f 715/799/723 714/778/704 745/810/734
-f 735/811/735 734/779/705 766/812/736
-f 713/800/724 712/780/706 744/813/737
-f 724/814/738 723/801/725 755/815/739
-f 733/802/726 732/783/708 764/816/740
-f 711/803/727 710/785/710 742/817/741
-f 722/781/707 721/818/742 753/819/743
-f 731/804/728 730/789/714 762/820/744
-f 720/787/712 719/821/745 751/822/746
-f 729/823/747 728/794/719 759/824/748
-f 718/791/716 717/796/720 749/825/749
-f 738/805/729 737/797/721 769/826/750
-f 727/806/730 726/798/722 757/809/733
-f 716/807/731 715/799/723 747/827/751
-f 736/775/701 735/811/735 767/828/752
-f 725/777/703 724/814/738 756/829/753
-f 714/778/704 713/800/724 745/810/734
-f 734/779/705 733/802/726 765/830/754
-f 712/780/706 711/803/727 743/831/755
-f 723/801/725 722/781/707 753/819/743
-f 732/783/708 731/832/728 763/833/756
-f 710/785/710 709/834/757 741/835/758
-f 721/818/742 720/787/712 751/822/746
-f 730/789/714 729/823/747 761/836/759
-f 719/821/745 718/791/716 749/825/749
-f 739/792/717 738/805/729 770/837/760
-f 728/794/719 727/806/730 759/824/748
-f 717/796/720 716/838/731 748/839/761
-f 769/826/750 768/808/732 800/840/762
-f 758/841/763 757/809/733 788/842/764
-f 747/827/751 746/843/765 778/844/766
-f 767/828/752 766/812/736 798/845/767
-f 756/829/753 755/815/739 787/846/768
-f 745/810/734 744/813/737 776/847/769
-f 765/830/754 764/816/740 796/848/770
-f 743/831/755 742/817/741 774/849/771
-f 754/850/772 753/819/743 784/851/773
-f 763/852/756 762/820/744 794/853/774
-f 741/835/758 740/854/775 772/855/776
-f 752/856/777 751/822/746 782/857/778
-f 761/836/759 760/858/779 792/859/780
-f 750/860/781 749/825/749 780/861/782
-f 770/837/760 769/826/750 801/862/783
-f 759/824/748 758/841/763 790/863/784
-f 748/839/761 747/864/751 779/865/785
-f 768/808/732 767/828/752 799/866/786
-f 757/809/733 756/829/753 788/842/764
-f 746/843/765 745/810/734 776/847/769
-f 766/812/736 765/830/754 797/867/787
-f 744/813/737 743/831/755 775/868/788
-f 755/815/739 754/850/772 786/869/789
-f 764/816/740 763/833/756 795/870/790
-f 742/817/741 741/835/758 773/871/791
-f 753/819/743 752/856/777 784/851/773
-f 762/820/744 761/836/759 793/872/792
-f 751/822/746 750/860/781 782/857/778
-f 760/858/779 759/824/748 790/863/784
-f 749/825/749 748/839/761 780/861/782
-f 801/862/783 800/840/762 832/873/793
-f 790/863/784 789/874/794 821/875/795
-f 779/865/785 778/876/766 810/877/796
-f 799/866/786 798/845/767 830/878/797
-f 788/842/764 787/846/768 819/879/798
-f 777/880/799 776/847/769 807/881/800
-f 797/867/787 796/848/770 828/882/801
-f 775/868/788 774/849/771 806/883/802
-f 786/869/789 785/884/803 817/885/804
-f 795/870/790 794/886/774 826/887/805
-f 773/871/791 772/855/776 804/888/806
-f 784/851/773 783/889/807 815/890/808
-f 793/872/792 792/859/780 824/891/809
-f 782/857/778 781/892/810 813/893/811
-f 791/894/812 790/863/784 821/875/795
-f 780/861/782 779/865/785 811/895/813
-f 800/840/762 799/866/786 831/896/814
-f 789/874/794 788/842/764 819/879/798
-f 778/844/766 777/880/799 809/897/815
-f 798/845/767 797/867/787 829/898/816
-f 787/846/768 786/869/789 818/899/817
-f 776/847/769 775/868/788 807/881/800
-f 796/848/770 795/870/790 827/900/818
-f 774/849/771 773/871/791 805/901/819
-f 785/884/803 784/851/773 815/890/808
-f 794/853/774 793/872/792 825/902/820
-f 772/855/776 771/903/821 803/904/822
-f 783/889/807 782/857/778 813/893/811
-f 792/859/780 791/894/812 823/905/823
-f 781/892/810 780/861/782 811/895/813
-f 822/906/824 821/875/795 852/907/825
-f 811/895/813 810/877/796 842/908/826
-f 831/896/814 830/878/797 862/909/827
-f 820/910/828 819/879/798 850/911/829
-f 809/897/815 808/912/830 840/913/831
-f 829/898/816 828/882/801 860/914/832
-f 818/899/817 817/885/804 849/915/833
-f 807/881/800 806/883/802 838/916/834
-f 827/900/818 826/887/805 858/917/835
-f 805/901/819 804/888/806 836/918/836
-f 816/919/837 815/890/808 846/920/838
-f 825/902/820 824/891/809 856/921/839
-f 803/904/822 802/922/840 834/923/841
-f 814/924/842 813/893/811 844/925/843
-f 823/905/823 822/906/824 854/926/844
-f 812/927/845 811/895/813 842/908/826
-f 832/873/793 831/896/814 863/928/846
-f 821/875/795 820/910/828 852/907/825
-f 810/877/796 809/929/815 841/930/847
-f 830/878/797 829/898/816 861/931/848
-f 819/879/798 818/899/817 850/911/829
-f 808/912/830 807/881/800 838/916/834
-f 828/882/801 827/900/818 859/932/849
-f 806/883/802 805/901/819 837/933/850
-f 817/885/804 816/919/837 847/934/851
-f 826/887/805 825/935/820 857/936/852
-f 804/888/806 803/904/822 835/937/853
-f 815/890/808 814/924/842 846/920/838
-f 824/891/809 823/905/823 855/938/854
-f 813/893/811 812/927/845 844/925/843
-f 854/926/844 853/939/855 885/940/856
-f 843/941/857 842/908/826 873/942/858
-f 863/928/846 862/909/827 894/943/859
-f 852/907/825 851/944/860 883/945/861
-f 841/930/847 840/946/831 872/947/862
-f 861/931/848 860/914/832 892/948/863
-f 850/911/829 849/915/833 881/949/864
-f 839/950/865 838/916/834 870/951/866
-f 859/932/849 858/917/835 890/952/867
-f 837/933/850 836/918/836 868/953/868
-f 848/954/869 847/934/851 878/955/870
-f 857/936/852 856/956/839 888/957/871
-f 835/937/853 834/923/841 866/958/872
-f 846/920/838 845/959/873 877/960/874
-f 855/938/854 854/926/844 886/961/875
-f 844/925/843 843/941/857 875/962/876
-f 853/939/855 852/907/825 883/945/861
-f 842/908/826 841/930/847 873/942/858
-f 862/909/827 861/931/848 893/963/877
-f 851/944/860 850/911/829 881/949/864
-f 840/913/831 839/950/865 871/964/878
-f 860/914/832 859/932/849 891/965/879
-f 849/915/833 848/954/869 880/966/880
-f 838/916/834 837/933/850 869/967/881
-f 858/917/835 857/936/852 889/968/882
-f 836/918/836 835/937/853 867/969/883
-f 847/934/851 846/920/838 877/960/874
-f 856/921/839 855/938/854 887/970/884
-f 834/923/841 833/971/885 865/972/886
-f 845/959/873 844/925/843 875/962/876
-f 886/961/875 885/940/856 917/973/887
-f 875/962/876 874/974/888 906/975/889
-f 884/976/890 883/945/861 914/977/891
-f 873/942/858 872/947/862 904/978/892
-f 893/963/877 892/948/863 924/979/893
-f 882/980/894 881/949/864 912/981/895
-f 871/964/878 870/951/866 902/982/896
-f 891/965/879 890/952/867 922/983/897
-f 880/966/880 879/984/898 911/985/899
-f 869/967/881 868/953/868 900/986/900
-f 889/968/882 888/957/871 920/987/901
-f 867/969/883 866/958/872 898/988/902
-f 878/955/870 877/960/874 908/989/903
-f 887/970/884 886/961/875 918/990/904
-f 865/972/886 864/991/905 896/992/906
-f 876/993/907 875/962/876 906/975/889
-f 885/940/856 884/976/890 916/994/908
-f 874/974/888 873/942/858 904/978/892
-f 894/943/859 893/963/877 925/995/909
-f 883/945/861 882/980/894 914/977/891
-f 872/947/862 871/996/878 903/997/910
-f 892/948/863 891/965/879 923/998/911
-f 881/949/864 880/966/880 912/981/895
-f 870/951/866 869/967/881 901/999/912
-f 890/952/867 889/968/882 920/987/901
-f 868/953/868 867/969/883 899/1000/913
-f 879/984/898 878/955/870 909/1001/914
-f 888/957/871 887/1002/884 919/1003/915
-f 866/958/872 865/972/886 897/1004/916
-f 877/960/874 876/993/907 908/989/903
-f 918/990/904 917/973/887 948/1005/917
-f 896/992/906 895/1006/918 927/1007/919
-f 907/1008/920 906/975/889 937/1009/921
-f 916/994/908 915/1010/922 947/1011/923
-f 905/1012/924 904/978/892 935/1013/925
-f 925/995/909 924/979/893 956/1014/926
-f 914/977/891 913/1015/927 945/1016/928
-f 903/997/910 902/1017/896 934/1018/929
-f 923/998/911 922/983/897 954/1019/930
-f 912/981/895 911/985/899 943/1020/931
-f 901/999/912 900/986/900 931/1021/932
-f 921/1022/933 920/987/901 951/1023/934
-f 899/1000/913 898/988/902 930/1024/935
-f 910/1025/936 909/1001/914 940/1026/937
-f 919/1003/915 918/1027/904 950/1028/938
-f 897/1004/916 896/992/906 928/1029/939
-f 908/989/903 907/1008/920 939/1030/940
-f 917/973/887 916/994/908 948/1005/917
-f 906/975/889 905/1012/924 937/1009/921
-f 915/1010/922 914/977/891 945/1016/928
-f 904/978/892 903/997/910 935/1013/925
-f 924/979/893 923/998/911 955/1031/941
-f 913/1015/927 912/981/895 943/1020/931
-f 902/982/896 901/999/912 933/1032/942
-f 922/983/897 921/1022/933 953/1033/943
-f 911/985/899 910/1025/936 942/1034/944
-f 900/986/900 899/1000/913 931/1021/932
-f 920/987/901 919/1003/915 951/1023/934
-f 898/988/902 897/1004/916 929/1035/945
-f 909/1001/914 908/989/903 939/1030/940
-f 950/1028/938 949/1036/946 981/1037/947
-f 928/1029/939 927/1007/919 959/1038/948
-f 939/1030/940 938/1039/949 970/1040/950
-f 948/1005/917 947/1011/923 979/1041/951
-f 937/1009/921 936/1042/952 968/1043/953
-f 946/1044/954 945/1016/928 976/1045/955
-f 935/1013/925 934/1018/929 966/1046/956
-f 955/1031/941 954/1019/930 986/1047/957
-f 944/1048/958 943/1020/931 974/1049/959
-f 933/1032/942 932/1050/960 964/1051/961
-f 953/1033/943 952/1052/962 984/1053/963
-f 942/1034/944 941/1054/964 973/1055/965
-f 931/1021/932 930/1024/935 962/1056/966
-f 951/1023/934 950/1028/938 982/1057/967
-f 929/1035/945 928/1029/939 960/1058/968
-f 940/1026/937 939/1030/940 970/1040/950
-f 949/1036/946 948/1059/917 979/1060/951
-f 927/1007/919 926/1061/969 958/1062/970
-f 938/1039/949 937/1009/921 968/1043/953
-f 947/1011/923 946/1044/954 978/1063/971
-f 936/1042/952 935/1013/925 966/1046/956
-f 956/1014/926 955/1031/941 987/1064/972
-f 945/1016/928 944/1048/958 976/1045/955
-f 934/1018/929 933/1065/942 965/1066/973
-f 954/1019/930 953/1033/943 985/1067/974
-f 943/1020/931 942/1034/944 974/1049/959
-f 932/1050/960 931/1021/932 962/1056/966
-f 952/1052/962 951/1023/934 983/1068/975
-f 930/1024/935 929/1035/945 961/1069/976
-f 941/1054/964 940/1026/937 971/1070/977
-f 982/1057/967 981/1037/947 1013/1071/978
-f 960/1058/968 959/1038/948 991/1072/979
-f 971/1070/977 970/1040/950 1001/1073/980
-f 980/1074/981 979/1060/951 1010/1075/982
-f 958/1062/970 957/1076/983 989/1077/984
-f 969/1078/985 968/1043/953 999/1079/986
-f 978/1063/971 977/1080/987 1009/1081/988
-f 967/1082/989 966/1046/956 997/1083/990
-f 987/1064/972 986/1047/957 1018/1084/991
-f 976/1045/955 975/1085/992 1007/1086/993
-f 965/1066/973 964/1087/961 996/1088/994
-f 985/1067/974 984/1053/963 1016/1089/995
-f 974/1049/959 973/1055/965 1005/1090/996
-f 963/1091/997 962/1056/966 993/1092/998
-f 983/1068/975 982/1057/967 1013/1071/978
-f 961/1069/976 960/1058/968 992/1093/999
-f 972/1094/1000 971/1070/977 1002/1095/1001
-f 981/1037/947 980/1074/981 1012/1096/1002
-f 959/1038/948 958/1062/970 990/1097/1003
-f 970/1040/950 969/1078/985 1001/1073/980
-f 979/1041/951 978/1063/971 1010/1098/982
-f 968/1043/953 967/1082/989 999/1079/986
-f 977/1080/987 976/1045/955 1007/1086/993
-f 966/1046/956 965/1066/973 997/1083/990
-f 986/1047/957 985/1067/974 1017/1099/1004
-f 975/1085/992 974/1049/959 1005/1090/996
-f 964/1051/961 963/1091/997 995/1100/1005
-f 984/1053/963 983/1068/975 1015/1101/1006
-f 973/1055/965 972/1094/1000 1004/1102/1007
-f 962/1056/966 961/1069/976 993/1092/998
-f 1012/1096/1002 1011/1103/1008 1043/1104/1009
-f 990/1097/1003 989/1077/984 1021/1105/1010
-f 1001/1073/980 1000/1106/1011 1032/1107/1012
-f 1010/1098/982 1009/1081/988 1041/1108/1013
-f 999/1079/986 998/1109/1014 1030/1110/1015
-f 1008/1111/1016 1007/1086/993 1038/1112/1017
-f 997/1083/990 996/1088/994 1028/1113/1018
-f 1017/1099/1004 1016/1089/995 1048/1114/1019
-f 1006/1115/1020 1005/1090/996 1036/1116/1021
-f 995/1100/1005 994/1117/1022 1026/1118/1023
-f 1015/1101/1006 1014/1119/1024 1046/1120/1025
-f 1004/1102/1007 1003/1121/1026 1035/1122/1027
-f 993/1092/998 992/1093/999 1024/1123/1028
-f 1013/1071/978 1012/1096/1002 1044/1124/1029
-f 991/1072/979 990/1097/1003 1022/1125/1030
-f 1002/1095/1001 1001/1073/980 1032/1107/1012
-f 1011/1103/1008 1010/1075/982 1041/1126/1013
-f 989/1077/984 988/1127/1031 1020/1128/1032
-f 1000/1106/1011 999/1079/986 1030/1110/1015
-f 1009/1081/988 1008/1111/1016 1040/1129/1033
-f 998/1109/1014 997/1083/990 1028/1113/1018
-f 1018/1084/991 1017/1099/1004 1049/1130/1034
-f 1007/1086/993 1006/1115/1020 1038/1112/1017
-f 996/1131/994 995/1100/1005 1027/1132/1035
-f 1016/1089/995 1015/1101/1006 1047/1133/1036
-f 1005/1090/996 1004/1102/1007 1036/1116/1021
-f 994/1117/1022 993/1092/998 1024/1123/1028
-f 1014/1119/1024 1013/1071/978 1045/1134/1037
-f 992/1093/999 991/1072/979 1023/1135/1038
-f 1003/1121/1026 1002/1095/1001 1033/1136/1039
-f 1044/1124/1029 1043/1104/1009 1075/1137/1040
-f 1022/1125/1030 1021/1105/1010 1053/1138/1041
-f 1033/1136/1039 1032/1107/1012 1063/1139/1042
-f 1042/1140/1043 1041/1126/1013 1073/1141/1044
-f 1020/1128/1032 1019/1142/1045 1051/1143/1046
-f 1031/1144/1047 1030/1110/1015 1061/1145/1048
-f 1040/1129/1033 1039/1146/1049 1071/1147/1050
-f 1029/1148/1051 1028/1113/1018 1059/1149/1052
-f 1049/1130/1034 1048/1114/1019 1080/1150/1053
-f 1038/1112/1017 1037/1151/1054 1069/1152/1055
-f 1027/1132/1035 1026/1118/1023 1058/1153/1056
-f 1047/1133/1036 1046/1120/1025 1078/1154/1057
-f 1036/1116/1021 1035/1122/1027 1067/1155/1058
-f 1025/1156/1059 1024/1123/1028 1055/1157/1060
-f 1045/1134/1037 1044/1124/1029 1075/1137/1040
-f 1023/1135/1038 1022/1125/1030 1054/1158/1061
-f 1034/1159/1062 1033/1136/1039 1064/1160/1063
-f 1043/1104/1009 1042/1140/1043 1074/1161/1064
-f 1021/1105/1010 1020/1128/1032 1052/1162/1065
-f 1032/1107/1012 1031/1144/1047 1063/1139/1042
-f 1041/1108/1013 1040/1129/1033 1072/1163/1066
-f 1030/1110/1015 1029/1148/1051 1061/1145/1048
-f 1039/1146/1049 1038/1112/1017 1069/1152/1055
-f 1028/1113/1018 1027/1164/1035 1059/1149/1052
-f 1048/1114/1019 1047/1133/1036 1079/1165/1067
-f 1037/1151/1054 1036/1116/1021 1067/1155/1058
-f 1026/1118/1023 1025/1156/1059 1057/1166/1068
-f 1046/1120/1025 1045/1134/1037 1077/1167/1069
-f 1035/1122/1027 1034/1159/1062 1066/1168/1070
-f 1024/1123/1028 1023/1135/1038 1055/1157/1060
-f 1076/1169/1071 1075/1137/1040 1106/1170/1072
-f 1054/1158/1061 1053/1138/1041 1085/1171/1073
-f 1065/1172/1074 1064/1160/1063 1095/1173/1075
-f 1074/1161/1064 1073/1141/1044 1105/1174/1076
-f 1052/1162/1065 1051/1143/1046 1083/1175/1077
-f 1063/1139/1042 1062/1176/1078 1094/1177/1079
-f 1072/1178/1066 1071/1179/1050 1103/1180/1080
-f 1061/1145/1048 1060/1181/1081 1092/1182/1082
-f 1070/1183/1083 1069/1184/1055 1100/1185/1084
-f 1059/1186/1052 1058/1153/1056 1090/1187/1085
-f 1079/1165/1067 1078/1154/1057 1110/1188/1086
-f 1068/1189/1087 1067/1190/1058 1098/1191/1088
-f 1057/1166/1068 1056/1192/1089 1088/1193/1090
-f 1077/1167/1069 1076/1169/1071 1108/1194/1091
-f 1066/1195/1070 1065/1196/1074 1097/1197/1092
-f 1055/1157/1060 1054/1158/1061 1086/1198/1093
-f 1075/1137/1040 1074/1161/1064 1106/1170/1072
-f 1053/1138/1041 1052/1162/1065 1084/1199/1094
-f 1064/1160/1063 1063/1139/1042 1094/1177/1079
-f 1073/1141/1044 1072/1200/1066 1103/1201/1080
-f 1051/1143/1046 1050/1202/1095 1082/1203/1096
-f 1062/1176/1078 1061/1145/1048 1092/1182/1082
-f 1071/1179/1050 1070/1183/1083 1102/1204/1097
-f 1060/1181/1081 1059/1149/1052 1090/1205/1085
-f 1080/1150/1053 1079/1165/1067 1111/1206/1098
-f 1069/1184/1055 1068/1189/1087 1100/1185/1084
-f 1058/1153/1056 1057/1166/1068 1089/1207/1099
-f 1078/1154/1057 1077/1167/1069 1109/1208/1100
-f 1067/1190/1058 1066/1195/1070 1098/1191/1088
-f 1056/1192/1089 1055/1157/1060 1086/1198/1093
-f 1108/1194/1091 1107/1209/1101 1139/1210/1102
-f 1097/1197/1092 1096/1211/1103 1128/1212/1104
-f 1086/1198/1093 1085/1171/1073 1117/1213/1105
-f 1106/1170/1072 1105/1174/1076 1137/1214/1106
-f 1084/1199/1094 1083/1175/1077 1115/1215/1107
-f 1095/1216/1075 1094/1217/1079 1125/1218/1108
-f 1104/1219/1109 1103/1201/1080 1134/1220/1110
-f 1082/1203/1096 1081/1221/1111 1113/1222/1112
-f 1093/1223/1113 1092/1224/1082 1123/1225/1114
-f 1102/1204/1097 1101/1226/1115 1133/1227/1116
-f 1091/1228/1117 1090/1229/1085 1121/1230/1118
-f 1111/1206/1098 1110/1188/1086 1142/1231/1119
-f 1100/1185/1084 1099/1232/1120 1131/1233/1121
-f 1089/1207/1099 1088/1193/1090 1120/1234/1122
-f 1109/1208/1100 1108/1194/1091 1140/1235/1123
-f 1098/1191/1088 1097/1197/1092 1129/1236/1124
-f 1087/1237/1125 1086/1198/1093 1117/1213/1105
-f 1107/1209/1101 1106/1170/1072 1137/1214/1106
-f 1085/1171/1073 1084/1199/1094 1116/1238/1126
-f 1096/1211/1103 1095/1216/1075 1127/1239/1127
-f 1105/1174/1076 1104/1219/1109 1136/1240/1128
-f 1083/1175/1077 1082/1203/1096 1114/1241/1129
-f 1094/1217/1079 1093/1223/1113 1125/1218/1108
-f 1103/1180/1080 1102/1204/1097 1134/1242/1110
-f 1092/1224/1082 1091/1228/1117 1123/1225/1114
-f 1101/1226/1115 1100/1185/1084 1131/1233/1121
-f 1090/1187/1085 1089/1207/1099 1121/1243/1118
-f 1110/1188/1086 1109/1208/1100 1141/1244/1130
-f 1099/1232/1120 1098/1191/1088 1129/1236/1124
-f 1088/1193/1090 1087/1237/1125 1119/1245/1131
-f 1140/1235/1123 1139/1210/1102 1171/1246/1132
-f 1129/1236/1124 1128/1212/1104 1160/1247/1133
-f 1118/1248/1134 1117/1213/1105 1148/1249/1135
-f 1138/1250/1136 1137/1214/1106 1168/1251/1137
-f 1116/1238/1126 1115/1215/1107 1147/1252/1138
-f 1127/1239/1127 1126/1253/1139 1157/1254/1140
-f 1136/1240/1128 1135/1255/1141 1167/1256/1142
-f 1114/1241/1129 1113/1222/1112 1145/1257/1143
-f 1125/1218/1108 1124/1258/1144 1156/1259/1145
-f 1134/1242/1110 1133/1227/1116 1165/1260/1146
-f 1123/1225/1114 1122/1261/1147 1154/1262/1148
-f 1132/1263/1149 1131/1233/1121 1162/1264/1150
-f 1121/1230/1118 1120/1265/1122 1152/1266/1151
-f 1141/1244/1130 1140/1235/1123 1172/1267/1152
-f 1130/1268/1153 1129/1236/1124 1160/1247/1133
-f 1119/1245/1131 1118/1248/1134 1150/1269/1154
-f 1139/1210/1102 1138/1250/1136 1170/1270/1155
-f 1128/1212/1104 1127/1239/1127 1159/1271/1156
-f 1117/1213/1105 1116/1238/1126 1148/1249/1135
-f 1137/1214/1106 1136/1240/1128 1168/1251/1137
-f 1115/1215/1107 1114/1241/1129 1146/1272/1157
-f 1126/1253/1139 1125/1218/1108 1156/1259/1145
-f 1135/1255/1141 1134/1220/1110 1165/1273/1146
-f 1113/1222/1112 1112/1274/1158 1144/1275/1159
-f 1124/1258/1144 1123/1225/1114 1154/1262/1148
-f 1133/1227/1116 1132/1263/1149 1164/1276/1160
-f 1122/1261/1147 1121/1230/1118 1152/1266/1151
-f 1142/1231/1119 1141/1244/1130 1173/1277/1161
-f 1131/1233/1121 1130/1268/1153 1162/1264/1150
-f 1120/1234/1122 1119/1245/1131 1151/1278/1162
-f 1172/1267/1152 1171/1246/1132 1203/1279/1163
-f 1161/1280/1164 1160/1247/1133 1191/1281/1165
-f 1150/1269/1154 1149/1282/1166 1181/1283/1167
-f 1170/1270/1155 1169/1284/1168 1201/1285/1169
-f 1159/1271/1156 1158/1286/1170 1190/1287/1171
-f 1148/1249/1135 1147/1252/1138 1179/1288/1172
-f 1168/1251/1137 1167/1256/1142 1199/1289/1173
-f 1146/1272/1157 1145/1257/1143 1177/1290/1174
-f 1157/1254/1140 1156/1259/1145 1187/1291/1175
-f 1166/1292/1176 1165/1260/1146 1197/1293/1177
-f 1144/1275/1159 1143/1294/1178 1175/1295/1179
-f 1155/1296/1180 1154/1262/1148 1185/1297/1181
-f 1164/1276/1160 1163/1298/1182 1195/1299/1183
-f 1153/1300/1184 1152/1266/1151 1183/1301/1185
-f 1173/1277/1161 1172/1267/1152 1204/1302/1186
-f 1162/1264/1150 1161/1280/1164 1193/1303/1187
-f 1151/1278/1162 1150/1269/1154 1182/1304/1188
-f 1171/1246/1132 1170/1270/1155 1202/1305/1189
-f 1160/1247/1133 1159/1271/1156 1191/1281/1165
-f 1149/1282/1166 1148/1249/1135 1179/1288/1172
-f 1169/1284/1168 1168/1251/1137 1199/1289/1173
-f 1147/1252/1138 1146/1272/1157 1178/1306/1190
-f 1158/1286/1170 1157/1254/1140 1188/1307/1191
-f 1167/1256/1142 1166/1308/1176 1198/1309/1192
-f 1145/1257/1143 1144/1275/1159 1176/1310/1193
-f 1156/1259/1145 1155/1296/1180 1187/1291/1175
-f 1165/1260/1146 1164/1276/1160 1196/1311/1194
-f 1154/1262/1148 1153/1300/1184 1185/1297/1181
-f 1163/1298/1182 1162/1264/1150 1193/1303/1187
-f 1152/1266/1151 1151/1312/1162 1183/1301/1185
-f 1204/1302/1186 1203/1279/1163 1235/1313/1195
-f 1193/1303/1187 1192/1314/1196 1224/1315/1197
-f 1182/1304/1188 1181/1283/1167 1213/1316/1198
-f 1202/1305/1189 1201/1285/1169 1233/1317/1199
-f 1191/1281/1165 1190/1287/1171 1222/1318/1200
-f 1180/1319/1201 1179/1288/1172 1210/1320/1202
-f 1200/1321/1203 1199/1289/1173 1231/1322/1204
-f 1178/1306/1190 1177/1290/1174 1209/1323/1205
-f 1189/1324/1206 1188/1307/1191 1219/1325/1207
-f 1198/1309/1192 1197/1326/1177 1228/1327/1208
-f 1176/1310/1193 1175/1295/1179 1207/1328/1209
-f 1187/1291/1175 1186/1329/1210 1218/1330/1211
-f 1196/1311/1194 1195/1299/1183 1227/1331/1212
-f 1185/1297/1181 1184/1332/1213 1216/1333/1214
-f 1194/1334/1215 1193/1303/1187 1224/1315/1197
-f 1183/1301/1185 1182/1335/1188 1214/1336/1216
-f 1203/1279/1163 1202/1305/1189 1234/1337/1217
-f 1192/1314/1196 1191/1281/1165 1222/1318/1200
-f 1181/1283/1167 1180/1319/1201 1212/1338/1218
-f 1201/1285/1169 1200/1321/1203 1232/1339/1219
-f 1190/1287/1171 1189/1324/1206 1221/1340/1220
-f 1179/1288/1172 1178/1306/1190 1210/1320/1202
-f 1199/1289/1173 1198/1309/1192 1230/1341/1221
-f 1177/1290/1174 1176/1310/1193 1208/1342/1222
-f 1188/1307/1191 1187/1291/1175 1219/1325/1207
-f 1197/1293/1177 1196/1311/1194 1228/1343/1208
-f 1175/1295/1179 1174/1344/1223 1206/1345/1224
-f 1186/1329/1210 1185/1297/1181 1216/1333/1214
-f 1195/1299/1183 1194/1334/1215 1226/1346/1225
-f 1184/1332/1213 1183/1301/1185 1214/1336/1216
-f 1225/1347/1226 1224/1315/1197 1255/1348/1227
-f 1214/1336/1216 1213/1349/1198 1245/1350/1228
-f 1234/1337/1217 1233/1317/1199 1265/1351/1229
-f 1223/1352/1230 1222/1318/1200 1253/1353/1231
-f 1212/1338/1218 1211/1354/1232 1243/1355/1233
-f 1232/1339/1219 1231/1322/1204 1263/1356/1234
-f 1221/1340/1220 1220/1357/1235 1252/1358/1236
-f 1210/1320/1202 1209/1323/1205 1241/1359/1237
-f 1230/1341/1221 1229/1360/1238 1261/1361/1239
-f 1208/1342/1222 1207/1328/1209 1239/1362/1240
-f 1219/1325/1207 1218/1330/1211 1250/1363/1241
-f 1228/1343/1208 1227/1331/1212 1259/1364/1242
-f 1206/1345/1224 1205/1365/1243 1237/1366/1244
-f 1217/1367/1245 1216/1333/1214 1247/1368/1246
-f 1226/1346/1225 1225/1347/1226 1257/1369/1247
-f 1215/1370/1248 1214/1336/1216 1245/1350/1228
-f 1235/1313/1195 1234/1337/1217 1266/1371/1249
-f 1224/1315/1197 1223/1352/1230 1255/1348/1227
-f 1213/1316/1198 1212/1338/1218 1244/1372/1250
-f 1233/1317/1199 1232/1339/1219 1264/1373/1251
-f 1222/1318/1200 1221/1340/1220 1253/1353/1231
-f 1211/1354/1232 1210/1320/1202 1241/1359/1237
-f 1231/1322/1204 1230/1341/1221 1261/1361/1239
-f 1209/1323/1205 1208/1342/1222 1240/1374/1252
-f 1220/1357/1235 1219/1325/1207 1250/1363/1241
-f 1229/1360/1238 1228/1327/1208 1260/1375/1253
-f 1207/1328/1209 1206/1345/1224 1238/1376/1254
-f 1218/1330/1211 1217/1367/1245 1249/1377/1255
-f 1227/1331/1212 1226/1346/1225 1258/1378/1256
-f 1216/1333/1214 1215/1370/1248 1247/1368/1246
-f 1257/1369/1247 1256/1379/1257 1288/1380/1258
-f 1246/1381/1259 1245/1350/1228 1276/1382/1260
-f 1266/1371/1249 1265/1351/1229 1297/1383/1261
-f 1255/1348/1227 1254/1384/1262 1286/1385/1263
-f 1244/1386/1250 1243/1387/1233 1275/1388/1264
-f 1264/1373/1251 1263/1356/1234 1295/1389/1265
-f 1253/1353/1231 1252/1358/1236 1284/1390/1266
-f 1242/1391/1267 1241/1359/1237 1272/1392/1268
-f 1262/1393/1269 1261/1361/1239 1292/1394/1270
-f 1240/1374/1252 1239/1362/1240 1271/1395/1271
-f 1251/1396/1272 1250/1363/1241 1281/1397/1273
-f 1260/1375/1253 1259/1398/1242 1291/1399/1274
-f 1238/1376/1254 1237/1366/1244 1269/1400/1275
-f 1249/1377/1255 1248/1401/1276 1280/1402/1277
-f 1258/1378/1256 1257/1369/1247 1289/1403/1278
-f 1247/1368/1246 1246/1381/1259 1278/1404/1279
-f 1256/1379/1257 1255/1348/1227 1286/1385/1263
-f 1245/1350/1228 1244/1386/1250 1276/1382/1260
-f 1265/1351/1229 1264/1373/1251 1296/1405/1280
-f 1254/1384/1262 1253/1353/1231 1284/1390/1266
-f 1243/1355/1233 1242/1391/1267 1274/1406/1281
-f 1263/1356/1234 1262/1393/1269 1294/1407/1282
-f 1252/1358/1236 1251/1396/1272 1283/1408/1283
-f 1241/1359/1237 1240/1374/1252 1272/1392/1268
-f 1261/1361/1239 1260/1375/1253 1292/1394/1270
-f 1239/1362/1240 1238/1376/1254 1270/1409/1284
-f 1250/1363/1241 1249/1377/1255 1281/1397/1273
-f 1259/1364/1242 1258/1378/1256 1290/1410/1285
-f 1237/1366/1244 1236/1411/1286 1268/1412/1287
-f 1248/1401/1276 1247/1368/1246 1278/1404/1279
-f 1289/1403/1278 1288/1380/1258 1320/1413/1288
-f 1278/1404/1279 1277/1414/1289 1309/1415/1290
-f 1287/1416/1291 1286/1385/1263 1317/1417/1292
-f 1276/1382/1260 1275/1388/1264 1307/1418/1293
-f 1296/1405/1280 1295/1389/1265 1327/1419/1294
-f 1285/1420/1295 1284/1390/1266 1315/1421/1296
-f 1274/1406/1281 1273/1422/1297 1305/1423/1298
-f 1294/1407/1282 1293/1424/1299 1325/1425/1300
-f 1283/1408/1283 1282/1426/1301 1314/1427/1302
-f 1272/1392/1268 1271/1395/1271 1303/1428/1303
-f 1292/1394/1270 1291/1399/1274 1323/1429/1304
-f 1270/1409/1284 1269/1400/1275 1301/1430/1305
-f 1281/1397/1273 1280/1402/1277 1311/1431/1306
-f 1290/1410/1285 1289/1403/1278 1321/1432/1307
-f 1268/1412/1287 1267/1433/1308 1299/1434/1309
-f 1279/1435/1310 1278/1404/1279 1309/1415/1290
-f 1288/1380/1258 1287/1416/1291 1319/1436/1311
-f 1277/1414/1289 1276/1382/1260 1307/1418/1293
-f 1297/1383/1261 1296/1405/1280 1328/1437/1312
-f 1286/1385/1263 1285/1420/1295 1317/1417/1292
-f 1275/1388/1264 1274/1438/1281 1306/1439/1313
-f 1295/1389/1265 1294/1407/1282 1326/1440/1314
-f 1284/1390/1266 1283/1408/1283 1315/1421/1296
-f 1273/1422/1297 1272/1392/1268 1303/1428/1303
-f 1293/1424/1299 1292/1394/1270 1323/1429/1304
-f 1271/1395/1271 1270/1409/1284 1302/1441/1315
-f 1282/1426/1301 1281/1397/1273 1312/1442/1316
-f 1291/1399/1274 1290/1443/1285 1322/1444/1317
-f 1269/1400/1275 1268/1412/1287 1300/1445/1318
-f 1280/1402/1277 1279/1435/1310 1311/1431/1306
-f 1321/1432/1307 1320/1413/1288 1352/1446/1319
-f 1299/1434/1309 1298/1447/1320 1330/1448/1321
-f 1310/1449/1322 1309/1415/1290 1340/1450/1323
-f 1319/1436/1311 1318/1451/1324 1350/1452/1325
-f 1308/1453/1326 1307/1418/1293 1338/1454/1327
-f 1328/1437/1312 1327/1419/1294 1359/1455/1328
-f 1317/1417/1292 1316/1456/1329 1348/1457/1330
-f 1306/1439/1313 1305/1458/1298 1337/1459/1331
-f 1326/1440/1314 1325/1425/1300 1357/1460/1332
-f 1315/1421/1296 1314/1427/1302 1346/1461/1333
-f 1304/1462/1334 1303/1428/1303 1334/1463/1335
-f 1324/1464/1336 1323/1429/1304 1354/1465/1337
-f 1302/1441/1315 1301/1430/1305 1333/1466/1338
-f 1313/1467/1339 1312/1442/1316 1343/1468/1340
-f 1322/1444/1317 1321/1469/1307 1353/1470/1341
-f 1300/1445/1318 1299/1434/1309 1331/1471/1342
-f 1311/1431/1306 1310/1449/1322 1342/1472/1343
-f 1320/1413/1288 1319/1436/1311 1351/1473/1344
-f 1309/1415/1290 1308/1453/1326 1340/1450/1323
-f 1318/1451/1324 1317/1417/1292 1348/1457/1330
-f 1307/1418/1293 1306/1439/1313 1338/1454/1327
-f 1327/1419/1294 1326/1440/1314 1358/1474/1345
-f 1316/1456/1329 1315/1421/1296 1346/1461/1333
-f 1305/1423/1298 1304/1462/1334 1336/1475/1346
-f 1325/1425/1300 1324/1464/1336 1356/1476/1347
-f 1314/1427/1302 1313/1467/1339 1345/1477/1348
-f 1303/1428/1303 1302/1441/1315 1334/1463/1335
-f 1323/1429/1304 1322/1444/1317 1354/1465/1337
-f 1301/1430/1305 1300/1445/1318 1332/1478/1349
-f 1312/1442/1316 1311/1431/1306 1343/1468/1340
-f 1353/1470/1341 1352/1479/1319 1384/1480/1350
-f 1331/1471/1342 1330/1448/1321 1362/1481/1351
-f 1342/1472/1343 1341/1482/1352 1373/1483/1353
-f 1351/1473/1344 1350/1452/1325 1382/1484/1354
-f 1340/1450/1323 1339/1485/1355 1371/1486/1356
-f 1349/1487/1357 1348/1457/1330 1379/1488/1358
-f 1338/1454/1327 1337/1459/1331 1369/1489/1359
-f 1358/1474/1345 1357/1460/1332 1389/1490/1360
-f 1347/1491/1361 1346/1461/1333 1377/1492/1362
-f 1336/1475/1346 1335/1493/1363 1367/1494/1364
-f 1356/1476/1347 1355/1495/1365 1387/1496/1366
-f 1345/1477/1348 1344/1497/1367 1376/1498/1368
-f 1334/1463/1335 1333/1466/1338 1365/1499/1369
-f 1354/1465/1337 1353/1470/1341 1385/1500/1370
-f 1332/1478/1349 1331/1471/1342 1363/1501/1371
-f 1343/1468/1340 1342/1472/1343 1373/1483/1353
-f 1352/1446/1319 1351/1473/1344 1383/1502/1372
-f 1330/1448/1321 1329/1503/1373 1361/1504/1374
-f 1341/1482/1352 1340/1450/1323 1371/1486/1356
-f 1350/1452/1325 1349/1487/1357 1381/1505/1375
-f 1339/1485/1355 1338/1454/1327 1369/1489/1359
-f 1359/1455/1328 1358/1474/1345 1390/1506/1376
-f 1348/1457/1330 1347/1491/1361 1379/1488/1358
-f 1337/1459/1331 1336/1507/1346 1368/1508/1377
-f 1357/1460/1332 1356/1476/1347 1388/1509/1378
-f 1346/1461/1333 1345/1477/1348 1377/1492/1362
-f 1335/1493/1363 1334/1463/1335 1365/1499/1369
-f 1355/1495/1365 1354/1465/1337 1385/1500/1370
-f 1333/1466/1338 1332/1478/1349 1364/1510/1379
-f 1344/1497/1367 1343/1468/1340 1374/1511/1380
-f 1385/1500/1370 1384/1480/1350 1416/1512/1381
-f 1363/1501/1371 1362/1481/1351 1394/1513/1382
-f 1374/1511/1380 1373/1483/1353 1404/1514/1383
-f 1383/1502/1372 1382/1484/1354 1414/1515/1384
-f 1361/1504/1374 1360/1516/1385 1392/1517/1386
-f 1372/1518/1387 1371/1486/1356 1402/1519/1388
-f 1381/1505/1375 1380/1520/1389 1412/1521/1390
-f 1370/1522/1391 1369/1489/1359 1400/1523/1392
-f 1390/1506/1376 1389/1490/1360 1421/1524/1393
-f 1379/1488/1358 1378/1525/1394 1410/1526/1395
-f 1368/1508/1377 1367/1527/1364 1399/1528/1396
-f 1388/1509/1378 1387/1496/1366 1419/1529/1397
-f 1377/1492/1362 1376/1498/1368 1408/1530/1398
-f 1366/1531/1399 1365/1499/1369 1396/1532/1400
-f 1386/1533/1401 1385/1500/1370 1416/1512/1381
-f 1364/1510/1379 1363/1501/1371 1395/1534/1402
-f 1375/1535/1403 1374/1511/1380 1406/1536/1404
-f 1384/1480/1350 1383/1537/1372 1415/1538/1405
-f 1362/1481/1351 1361/1504/1374 1393/1539/1406
-f 1373/1483/1353 1372/1518/1387 1404/1514/1383
-f 1382/1484/1354 1381/1505/1375 1413/1540/1407
-f 1371/1486/1356 1370/1522/1391 1402/1519/1388
-f 1380/1520/1389 1379/1488/1358 1410/1526/1395
-f 1369/1489/1359 1368/1508/1377 1400/1523/1392
-f 1389/1490/1360 1388/1509/1378 1419/1529/1397
-f 1378/1525/1394 1377/1492/1362 1408/1530/1398
-f 1367/1494/1364 1366/1531/1399 1398/1541/1408
-f 1387/1496/1366 1386/1533/1401 1418/1542/1409
-f 1376/1498/1368 1375/1535/1403 1407/1543/1410
-f 1365/1499/1369 1364/1510/1379 1396/1532/1400
-f 1417/1544/1411 1416/1512/1381 1447/1545/1412
-f 1395/1534/1402 1394/1513/1382 1426/1546/1413
-f 1406/1536/1404 1405/1547/1414 1437/1548/1415
-f 1415/1538/1405 1414/1549/1384 1446/1550/1416
-f 1393/1539/1406 1392/1517/1386 1424/1551/1417
-f 1404/1514/1383 1403/1552/1418 1435/1553/1419
-f 1413/1540/1407 1412/1521/1390 1444/1554/1420
-f 1402/1519/1388 1401/1555/1421 1433/1556/1422
-f 1411/1557/1423 1410/1526/1395 1441/1558/1424
-f 1400/1523/1392 1399/1528/1396 1431/1559/1425
-f 1420/1560/1426 1419/1529/1397 1451/1561/1427
-f 1409/1562/1428 1408/1530/1398 1439/1563/1429
-f 1398/1541/1408 1397/1564/1430 1429/1565/1431
-f 1418/1542/1409 1417/1544/1411 1449/1566/1432
-f 1407/1543/1410 1406/1536/1404 1438/1567/1433
-f 1396/1532/1400 1395/1534/1402 1427/1568/1434
-f 1416/1512/1381 1415/1538/1405 1447/1545/1412
-f 1394/1513/1382 1393/1539/1406 1425/1569/1435
-f 1405/1547/1414 1404/1514/1383 1435/1553/1419
-f 1414/1515/1384 1413/1540/1407 1445/1570/1436
-f 1392/1517/1386 1391/1571/1437 1423/1572/1438
-f 1403/1552/1418 1402/1519/1388 1433/1556/1422
-f 1412/1521/1390 1411/1557/1423 1443/1573/1439
-f 1401/1555/1421 1400/1523/1392 1431/1559/1425
-f 1421/1524/1393 1420/1560/1426 1452/1574/1440
-f 1410/1526/1395 1409/1562/1428 1441/1558/1424
-f 1399/1575/1396 1398/1541/1408 1430/1576/1441
-f 1419/1529/1397 1418/1542/1409 1450/1577/1442
-f 1408/1530/1398 1407/1543/1410 1439/1563/1429
-f 1397/1564/1430 1396/1532/1400 1427/1568/1434
-f 1449/1566/1432 1448/1578/1443 1480/1579/1444
-f 1438/1567/1433 1437/1548/1415 1469/1580/1445
-f 1427/1568/1434 1426/1546/1413 1458/1581/1446
-f 1447/1545/1412 1446/1550/1416 1478/1582/1447
-f 1425/1569/1435 1424/1551/1417 1456/1583/1448
-f 1436/1584/1449 1435/1553/1419 1466/1585/1450
-f 1445/1570/1436 1444/1554/1420 1476/1586/1451
-f 1423/1572/1438 1422/1587/1452 1454/1588/1453
-f 1434/1589/1454 1433/1556/1422 1464/1590/1455
-f 1443/1573/1439 1442/1591/1456 1474/1592/1457
-f 1432/1593/1458 1431/1559/1425 1462/1594/1459
-f 1452/1574/1440 1451/1561/1427 1483/1595/1460
-f 1441/1558/1424 1440/1596/1461 1472/1597/1462
-f 1430/1576/1441 1429/1565/1431 1461/1598/1463
-f 1450/1577/1442 1449/1566/1432 1481/1599/1464
-f 1439/1563/1429 1438/1567/1433 1470/1600/1465
-f 1428/1601/1466 1427/1568/1434 1458/1581/1446
-f 1448/1578/1443 1447/1545/1412 1478/1582/1447
-f 1426/1546/1413 1425/1569/1435 1457/1602/1467
-f 1437/1548/1415 1436/1584/1449 1467/1603/1468
-f 1446/1550/1416 1445/1604/1436 1477/1605/1469
-f 1424/1551/1417 1423/1572/1438 1455/1606/1470
-f 1435/1553/1419 1434/1589/1454 1466/1585/1450
-f 1444/1554/1420 1443/1573/1439 1475/1607/1471
-f 1433/1556/1422 1432/1593/1458 1464/1590/1455
-f 1442/1591/1456 1441/1558/1424 1472/1597/1462
-f 1431/1559/1425 1430/1608/1441 1462/1594/1459
-f 1451/1561/1427 1450/1577/1442 1482/1609/1472
-f 1440/1596/1461 1439/1563/1429 1470/1600/1465
-f 1429/1565/1431 1428/1601/1466 1460/1610/1473
-f 1481/1599/1464 1480/1579/1444 1512/1611/1474
-f 1470/1600/1465 1469/1580/1445 1501/1612/1475
-f 1459/1613/1476 1458/1581/1446 1489/1614/1477
-f 1479/1615/1478 1478/1582/1447 1509/1616/1479
-f 1457/1602/1467 1456/1583/1448 1488/1617/1480
-f 1468/1618/1481 1467/1603/1468 1498/1619/1482
-f 1477/1605/1469 1476/1620/1451 1508/1621/1483
-f 1455/1606/1470 1454/1588/1453 1486/1622/1484
-f 1466/1585/1450 1465/1623/1485 1497/1624/1486
-f 1475/1607/1471 1474/1592/1457 1506/1625/1487
-f 1464/1590/1455 1463/1626/1488 1495/1627/1489
-f 1473/1628/1490 1472/1597/1462 1503/1629/1491
-f 1462/1594/1459 1461/1630/1463 1493/1631/1492
-f 1482/1609/1472 1481/1599/1464 1513/1632/1493
-f 1471/1633/1494 1470/1600/1465 1501/1612/1475
-f 1460/1610/1473 1459/1613/1476 1491/1634/1495
-f 1480/1579/1444 1479/1615/1478 1511/1635/1496
-f 1469/1580/1445 1468/1618/1481 1500/1636/1497
-f 1458/1581/1446 1457/1602/1467 1489/1614/1477
-f 1478/1582/1447 1477/1605/1469 1509/1616/1479
-f 1456/1583/1448 1455/1606/1470 1487/1637/1498
-f 1467/1603/1468 1466/1585/1450 1497/1624/1486
-f 1476/1586/1451 1475/1607/1471 1507/1638/1499
-f 1454/1588/1453 1453/1639/1500 1485/1640/1501
-f 1465/1623/1485 1464/1590/1455 1495/1627/1489
-f 1474/1592/1457 1473/1628/1490 1505/1641/1502
-f 1463/1626/1488 1462/1594/1459 1493/1631/1492
-f 1483/1595/1460 1482/1609/1472 1514/1642/1503
-f 1472/1597/1462 1471/1633/1494 1503/1629/1491
-f 1461/1598/1463 1460/1610/1473 1492/1643/1504
-f 1514/1642/1503 1513/1632/1493 1545/1644/1505
-f 1503/1629/1491 1502/1645/1506 1534/1646/1507
-f 1492/1643/1504 1491/1634/1495 1523/1647/1508
-f 1512/1611/1474 1511/1635/1496 1543/1648/1509
-f 1501/1612/1475 1500/1636/1497 1532/1649/1510
-f 1490/1650/1511 1489/1614/1477 1520/1651/1512
-f 1510/1652/1513 1509/1616/1479 1540/1653/1514
-f 1488/1617/1480 1487/1637/1498 1519/1654/1515
-f 1499/1655/1516 1498/1619/1482 1529/1656/1517
-f 1508/1621/1483 1507/1657/1499 1539/1658/1518
-f 1486/1622/1484 1485/1640/1501 1517/1659/1519
-f 1497/1624/1486 1496/1660/1520 1528/1661/1521
-f 1506/1625/1487 1505/1641/1502 1537/1662/1522
-f 1495/1627/1489 1494/1663/1523 1526/1664/1524
-f 1504/1665/1525 1503/1629/1491 1534/1646/1507
-f 1493/1631/1492 1492/1666/1504 1524/1667/1526
-f 1513/1632/1493 1512/1611/1474 1544/1668/1527
-f 1502/1645/1506 1501/1612/1475 1532/1649/1510
-f 1491/1634/1495 1490/1650/1511 1522/1669/1528
-f 1511/1635/1496 1510/1652/1513 1542/1670/1529
-f 1500/1636/1497 1499/1655/1516 1531/1671/1530
-f 1489/1614/1477 1488/1617/1480 1520/1651/1512
-f 1509/1616/1479 1508/1621/1483 1540/1653/1514
-f 1487/1637/1498 1486/1622/1484 1518/1672/1531
-f 1498/1619/1482 1497/1624/1486 1528/1661/1521
-f 1507/1657/1499 1506/1673/1487 1538/1674/1532
-f 1485/1640/1501 1484/1675/1533 1516/1676/1534
-f 1496/1660/1520 1495/1627/1489 1526/1664/1524
-f 1505/1641/1502 1504/1665/1525 1536/1677/1535
-f 1494/1663/1523 1493/1631/1492 1524/1667/1526
-f 1535/1678/1536 1534/1646/1507 1565/1679/1537
-f 1524/1680/1526 1523/1647/1508 1555/1681/1538
-f 1544/1668/1527 1543/1648/1509 1575/1682/1539
-f 1533/1683/1540 1532/1649/1510 1563/1684/1541
-f 1522/1669/1528 1521/1685/1542 1553/1686/1543
-f 1542/1670/1529 1541/1687/1544 1573/1688/1545
-f 1531/1671/1530 1530/1689/1546 1562/1690/1547
-f 1520/1651/1512 1519/1654/1515 1551/1691/1548
-f 1540/1653/1514 1539/1658/1518 1571/1692/1549
-f 1518/1672/1531 1517/1659/1519 1549/1693/1550
-f 1529/1656/1517 1528/1661/1521 1559/1694/1551
-f 1538/1674/1532 1537/1695/1522 1568/1696/1552
-f 1516/1676/1534 1515/1697/1553 1547/1698/1554
-f 1527/1699/1555 1526/1664/1524 1557/1700/1556
-f 1536/1677/1535 1535/1678/1536 1567/1701/1557
-f 1525/1702/1558 1524/1667/1526 1555/1703/1538
-f 1545/1644/1505 1544/1668/1527 1576/1704/1559
-f 1534/1646/1507 1533/1683/1540 1565/1679/1537
-f 1523/1647/1508 1522/1669/1528 1554/1705/1560
-f 1543/1648/1509 1542/1670/1529 1574/1706/1561
-f 1532/1649/1510 1531/1671/1530 1563/1684/1541
-f 1521/1685/1542 1520/1651/1512 1551/1691/1548
-f 1541/1687/1544 1540/1653/1514 1571/1692/1549
-f 1519/1654/1515 1518/1672/1531 1550/1707/1562
-f 1530/1689/1546 1529/1656/1517 1560/1708/1563
-f 1539/1658/1518 1538/1674/1532 1570/1709/1564
-f 1517/1659/1519 1516/1676/1534 1548/1710/1565
-f 1528/1661/1521 1527/1699/1555 1559/1694/1551
-f 1537/1662/1522 1536/1677/1535 1568/1711/1552
-f 1526/1664/1524 1525/1702/1558 1557/1700/1556
-f 1567/1712/1557 1566/1713/1566 1598/1714/1567
-f 1556/1715/1568 1555/1716/1538 1586/1717/1569
-f 1576/1704/1559 1575/1682/1539 1607/1718/1570
-f 1565/1679/1537 1564/1719/1571 1596/1720/1572
-f 1554/1705/1560 1553/1686/1543 1585/1721/1573
-f 1574/1706/1561 1573/1688/1545 1605/1722/1574
-f 1563/1684/1541 1562/1690/1547 1594/1723/1575
-f 1552/1724/1576 1551/1691/1548 1582/1725/1577
-f 1572/1726/1578 1571/1692/1549 1602/1727/1579
-f 1550/1707/1562 1549/1693/1550 1581/1728/1580
-f 1561/1729/1581 1560/1730/1563 1592/1731/1582
-f 1570/1709/1564 1569/1732/1583 1601/1733/1584
-f 1548/1710/1565 1547/1698/1554 1579/1734/1585
-f 1559/1694/1551 1558/1735/1586 1590/1736/1587
-f 1568/1737/1552 1567/1712/1557 1599/1738/1588
-f 1557/1700/1556 1556/1739/1568 1588/1740/1589
-f 1566/1741/1566 1565/1679/1537 1596/1720/1572
-f 1555/1681/1538 1554/1705/1560 1586/1742/1569
-f 1575/1682/1539 1574/1706/1561 1606/1743/1590
-f 1564/1719/1571 1563/1684/1541 1594/1723/1575
-f 1553/1686/1543 1552/1724/1576 1584/1744/1591
-f 1573/1688/1545 1572/1726/1578 1604/1745/1592
-f 1562/1746/1547 1561/1729/1581 1593/1747/1593
-f 1551/1691/1548 1550/1707/1562 1582/1725/1577
-f 1571/1692/1549 1570/1709/1564 1602/1727/1579
-f 1549/1693/1550 1548/1710/1565 1580/1748/1594
-f 1560/1708/1563 1559/1694/1551 1590/1736/1587
-f 1569/1732/1583 1568/1696/1552 1599/1749/1588
-f 1547/1698/1554 1546/1750/1595 1578/1751/1596
-f 1558/1735/1586 1557/1700/1556 1588/1740/1589
-f 1599/1738/1588 1598/1714/1567 1631/1752/1597
-f 1588/1753/1589 1587/1754/1598 1620/1755/1599
-f 1597/1756/1600 1596/1757/1572 1628/1758/1601
-f 1586/1742/1569 1585/1721/1573 1618/1759/1602
-f 1606/1743/1590 1605/1722/1574 1638/1760/1603
-f 1595/1761/1604 1594/1762/1575 1626/1763/1605
-f 1584/1744/1591 1583/1764/1606 1616/1765/1607
-f 1604/1745/1592 1603/1766/1608 1636/1767/1609
-f 1593/1747/1593 1592/1731/1582 1625/1768/1610
-f 1582/1725/1577 1581/1728/1580 1614/1769/1611
-f 1602/1727/1579 1601/1733/1584 1634/1770/1612
-f 1580/1748/1594 1579/1734/1585 1612/1771/1613
-f 1591/1772/1614 1590/1773/1587 1622/1774/1615
-f 1600/1775/1616 1599/1749/1588 1632/1776/1617
-f 1578/1751/1596 1577/1777/1618 1610/1778/1619
-f 1589/1779/1620 1588/1753/1589 1620/1755/1599
-f 1598/1714/1567 1597/1756/1600 1630/1780/1621
-f 1587/1754/1598 1586/1717/1569 1618/1781/1602
-f 1607/1718/1570 1606/1743/1590 1639/1782/1622
-f 1596/1757/1572 1595/1761/1604 1628/1758/1601
-f 1585/1721/1573 1584/1744/1591 1617/1783/1623
-f 1605/1722/1574 1604/1745/1592 1637/1784/1624
-f 1594/1762/1575 1593/1747/1593 1626/1763/1605
-f 1583/1764/1606 1582/1725/1577 1614/1769/1611
-f 1603/1766/1608 1602/1727/1579 1634/1770/1612
-f 1581/1728/1580 1580/1748/1594 1613/1785/1625
-f 1592/1731/1582 1591/1772/1614 1624/1786/1626
-f 1601/1733/1584 1600/1775/1616 1633/1787/1627
-f 1579/1734/1585 1578/1751/1596 1611/1788/1628
-f 1590/1773/1587 1589/1779/1620 1622/1774/1615
-f 1632/1776/1617 1631/1789/1597 1663/1790/1629
-f 1610/1778/1619 1609/1791/1630 1641/1792/1631
-f 1621/1793/1632 1620/1755/1599 1651/1794/1633
-f 1630/1780/1621 1629/1795/1634 1661/1796/1635
-f 1619/1797/1636 1618/1781/1602 1649/1798/1637
-f 1639/1782/1622 1638/1760/1603 1670/1799/1638
-f 1628/1758/1601 1627/1800/1639 1659/1801/1640
-f 1617/1783/1623 1616/1765/1607 1648/1802/1641
-f 1637/1784/1624 1636/1767/1609 1668/1803/1642
-f 1626/1763/1605 1625/1768/1610 1657/1804/1643
-f 1615/1805/1644 1614/1769/1611 1645/1806/1645
-f 1635/1807/1646 1634/1770/1612 1665/1808/1647
-f 1613/1785/1625 1612/1771/1613 1644/1809/1648
-f 1624/1786/1626 1623/1810/1649 1654/1811/1650
-f 1633/1787/1627 1632/1776/1617 1664/1812/1651
-f 1611/1788/1628 1610/1778/1619 1642/1813/1652
-f 1622/1774/1615 1621/1793/1632 1653/1814/1653
-f 1631/1752/1597 1630/1780/1621 1662/1815/1654
-f 1620/1755/1599 1619/1797/1636 1651/1794/1633
-f 1629/1795/1634 1628/1758/1601 1659/1801/1640
-f 1618/1781/1602 1617/1816/1623 1649/1798/1637
-f 1638/1760/1603 1637/1784/1624 1668/1803/1642
-f 1627/1800/1639 1626/1763/1605 1657/1804/1643
-f 1616/1765/1607 1615/1805/1644 1647/1817/1655
-f 1636/1767/1609 1635/1807/1646 1667/1818/1656
-f 1625/1768/1610 1624/1786/1626 1656/1819/1657
-f 1614/1769/1611 1613/1785/1625 1645/1806/1645
-f 1634/1770/1612 1633/1787/1627 1665/1808/1647
-f 1612/1771/1613 1611/1788/1628 1643/1820/1658
-f 1623/1810/1649 1622/1774/1615 1654/1811/1650
-f 1664/1812/1651 1663/1790/1629 1695/1821/1659
-f 1642/1813/1652 1641/1792/1631 1673/1822/1660
-f 1653/1814/1653 1652/1823/1661 1684/1824/1662
-f 1662/1815/1654 1661/1796/1635 1693/1825/1663
-f 1651/1794/1633 1650/1826/1664 1682/1827/1665
-f 1660/1828/1666 1659/1801/1640 1690/1829/1667
-f 1649/1798/1637 1648/1830/1641 1680/1831/1668
-f 1669/1832/1669 1668/1803/1642 1700/1833/1670
-f 1658/1834/1671 1657/1804/1643 1688/1835/1672
-f 1647/1817/1655 1646/1836/1673 1678/1837/1674
-f 1667/1818/1656 1666/1838/1675 1698/1839/1676
-f 1656/1819/1657 1655/1840/1677 1687/1841/1678
-f 1645/1806/1645 1644/1809/1648 1676/1842/1679
-f 1665/1808/1647 1664/1812/1651 1696/1843/1680
-f 1643/1820/1658 1642/1813/1652 1674/1844/1681
-f 1654/1811/1650 1653/1814/1653 1685/1845/1682
-f 1663/1846/1629 1662/1815/1654 1694/1847/1683
-f 1641/1792/1631 1640/1848/1684 1672/1849/1685
-f 1652/1823/1661 1651/1794/1633 1682/1827/1665
-f 1661/1796/1635 1660/1828/1666 1692/1850/1686
-f 1650/1826/1664 1649/1798/1637 1680/1831/1668
-f 1670/1799/1638 1669/1832/1669 1701/1851/1687
-f 1659/1801/1640 1658/1834/1671 1690/1829/1667
-f 1648/1802/1641 1647/1817/1655 1678/1837/1674
-f 1668/1803/1642 1667/1818/1656 1699/1852/1688
-f 1657/1804/1643 1656/1819/1657 1688/1835/1672
-f 1646/1836/1673 1645/1806/1645 1676/1842/1679
-f 1666/1838/1675 1665/1808/1647 1696/1843/1680
-f 1644/1809/1648 1643/1820/1658 1675/1853/1689
-f 1655/1840/1677 1654/1811/1650 1685/1845/1682
-f 1696/1843/1680 1695/1821/1659 1727/1854/1690
-f 1674/1844/1681 1673/1822/1660 1705/1855/1691
-f 1685/1845/1682 1684/1824/1662 1716/1856/1692
-f 1694/1847/1683 1693/1825/1663 1725/1857/1693
-f 1672/1849/1685 1671/1858/1694 1703/1859/1695
-f 1683/1860/1696 1682/1827/1665 1713/1861/1697
-f 1692/1850/1686 1691/1862/1698 1723/1863/1699
-f 1681/1864/1700 1680/1831/1668 1711/1865/1701
-f 1701/1851/1687 1700/1833/1670 1732/1866/1702
-f 1690/1829/1667 1689/1867/1703 1721/1868/1704
-f 1679/1869/1705 1678/1837/1674 1709/1870/1706
-f 1699/1852/1688 1698/1839/1676 1730/1871/1707
-f 1688/1835/1672 1687/1841/1678 1719/1872/1708
-f 1677/1873/1709 1676/1842/1679 1707/1874/1710
-f 1697/1875/1711 1696/1843/1680 1727/1854/1690
-f 1675/1853/1689 1674/1844/1681 1706/1876/1712
-f 1686/1877/1713 1685/1845/1682 1716/1856/1692
-f 1695/1821/1659 1694/1878/1683 1726/1879/1714
-f 1673/1822/1660 1672/1849/1685 1704/1880/1715
-f 1684/1824/1662 1683/1860/1696 1715/1881/1716
-f 1693/1825/1663 1692/1850/1686 1724/1882/1717
-f 1682/1827/1665 1681/1864/1700 1713/1861/1697
-f 1691/1862/1698 1690/1829/1667 1721/1868/1704
-f 1680/1831/1668 1679/1883/1705 1711/1865/1701
-f 1700/1833/1670 1699/1852/1688 1731/1884/1718
-f 1689/1867/1703 1688/1835/1672 1719/1872/1708
-f 1678/1837/1674 1677/1873/1709 1709/1870/1706
-f 1698/1839/1676 1697/1875/1711 1729/1885/1719
-f 1687/1841/1678 1686/1877/1713 1718/1886/1720
-f 1676/1842/1679 1675/1853/1689 1707/1874/1710
-f 1728/1887/1721 1727/1854/1690 1758/1888/1722
-f 1706/1876/1712 1705/1855/1691 1737/1889/1723
-f 1717/1890/1724 1716/1856/1692 1747/1891/1725
-f 1726/1879/1714 1725/1892/1693 1757/1893/1726
-f 1704/1880/1715 1703/1859/1695 1735/1894/1727
-f 1715/1881/1716 1714/1895/1728 1746/1896/1729
-f 1724/1882/1717 1723/1863/1699 1755/1897/1730
-f 1713/1861/1697 1712/1898/1731 1744/1899/1732
-f 1722/1900/1733 1721/1868/1704 1752/1901/1734
-f 1711/1865/1701 1710/1902/1735 1742/1903/1736
-f 1731/1884/1718 1730/1871/1707 1762/1904/1737
-f 1720/1905/1738 1719/1872/1708 1750/1906/1739
-f 1709/1870/1706 1708/1907/1740 1740/1908/1741
-f 1729/1885/1719 1728/1887/1721 1760/1909/1742
-f 1718/1886/1720 1717/1890/1724 1749/1910/1743
-f 1707/1874/1710 1706/1876/1712 1738/1911/1744
-f 1727/1854/1690 1726/1879/1714 1758/1888/1722
-f 1705/1855/1691 1704/1880/1715 1736/1912/1745
-f 1716/1856/1692 1715/1881/1716 1747/1891/1725
-f 1725/1857/1693 1724/1882/1717 1756/1913/1746
-f 1703/1859/1695 1702/1914/1747 1734/1915/1748
-f 1714/1895/1728 1713/1861/1697 1744/1899/1732
-f 1723/1863/1699 1722/1900/1733 1754/1916/1749
-f 1712/1898/1731 1711/1865/1701 1742/1903/1736
-f 1732/1866/1702 1731/1884/1718 1763/1917/1750
-f 1721/1868/1704 1720/1905/1738 1752/1901/1734
-f 1710/1918/1735 1709/1870/1706 1740/1908/1741
-f 1730/1871/1707 1729/1885/1719 1761/1919/1751
-f 1719/1872/1708 1718/1886/1720 1750/1906/1739
-f 1708/1907/1740 1707/1874/1710 1738/1911/1744
-f 1760/1909/1742 1759/1920/1752 1791/1921/1753
-f 1749/1910/1743 1748/1922/1754 1780/1923/1755
-f 1738/1911/1744 1737/1889/1723 1769/1924/1756
-f 1758/1888/1722 1757/1893/1726 1789/1925/1757
-f 1736/1912/1745 1735/1894/1727 1767/1926/1758
-f 1747/1891/1725 1746/1896/1729 1778/1927/1759
-f 1756/1913/1746 1755/1897/1730 1787/1928/1760
-f 1734/1915/1748 1733/1929/1761 1765/1930/1762
-f 1745/1931/1763 1744/1899/1732 1775/1932/1764
-f 1754/1916/1749 1753/1933/1765 1785/1934/1766
-f 1743/1935/1767 1742/1903/1736 1773/1936/1768
-f 1763/1917/1750 1762/1904/1737 1794/1937/1769
-f 1752/1901/1734 1751/1938/1770 1783/1939/1771
-f 1741/1940/1772 1740/1941/1741 1771/1942/1773
-f 1761/1919/1751 1760/1909/1742 1792/1943/1774
-f 1750/1906/1739 1749/1910/1743 1781/1944/1775
-f 1739/1945/1776 1738/1911/1744 1769/1924/1756
-f 1759/1920/1752 1758/1888/1722 1789/1925/1757
-f 1737/1889/1723 1736/1912/1745 1768/1946/1777
-f 1748/1922/1754 1747/1891/1725 1778/1927/1759
-f 1757/1893/1726 1756/1947/1746 1788/1948/1778
-f 1735/1894/1727 1734/1915/1748 1766/1949/1779
-f 1746/1896/1729 1745/1931/1763 1777/1950/1780
-f 1755/1897/1730 1754/1916/1749 1786/1951/1781
-f 1744/1899/1732 1743/1935/1767 1775/1932/1764
-f 1753/1933/1765 1752/1901/1734 1783/1939/1771
-f 1742/1903/1736 1741/1940/1772 1773/1936/1768
-f 1762/1904/1737 1761/1919/1751 1793/1952/1782
-f 1751/1938/1770 1750/1906/1739 1781/1944/1775
-f 1740/1908/1741 1739/1945/1776 1771/1953/1773
-f 1792/1943/1774 1791/1921/1753 1823/1954/1783
-f 1781/1944/1775 1780/1923/1755 1812/1955/1784
-f 1770/1956/1785 1769/1924/1756 1800/1957/1786
-f 1790/1958/1787 1789/1925/1757 1820/1959/1788
-f 1768/1946/1777 1767/1926/1758 1799/1960/1789
-f 1779/1961/1790 1778/1927/1759 1809/1962/1791
-f 1788/1948/1778 1787/1963/1760 1819/1964/1792
-f 1766/1949/1779 1765/1930/1762 1797/1965/1793
-f 1777/1950/1780 1776/1966/1794 1808/1967/1795
-f 1786/1951/1781 1785/1934/1766 1817/1968/1796
-f 1775/1932/1764 1774/1969/1797 1806/1970/1798
-f 1784/1971/1799 1783/1939/1771 1814/1972/1800
-f 1773/1936/1768 1772/1973/1801 1804/1974/1802
-f 1793/1952/1782 1792/1943/1774 1824/1975/1803
-f 1782/1976/1804 1781/1944/1775 1812/1955/1784
-f 1771/1953/1773 1770/1956/1785 1802/1977/1805
-f 1791/1921/1753 1790/1958/1787 1822/1978/1806
-f 1780/1923/1755 1779/1961/1790 1811/1979/1807
-f 1769/1924/1756 1768/1946/1777 1800/1957/1786
-f 1789/1925/1757 1788/1948/1778 1820/1959/1788
-f 1767/1926/1758 1766/1949/1779 1798/1980/1808
-f 1778/1927/1759 1777/1950/1780 1808/1967/1795
-f 1787/1928/1760 1786/1951/1781 1818/1981/1809
-f 1765/1930/1762 1764/1982/1810 1796/1983/1811
-f 1776/1966/1794 1775/1932/1764 1806/1970/1798
-f 1785/1934/1766 1784/1971/1799 1816/1984/1812
-f 1774/1969/1797 1773/1936/1768 1804/1974/1802
-f 1794/1937/1769 1793/1952/1782 1825/1985/1813
-f 1783/1939/1771 1782/1976/1804 1814/1972/1800
-f 1772/1973/1801 1771/1942/1773 1802/1986/1805
-f 1824/1975/1803 1823/1954/1783 1855/1987/1814
-f 1813/1988/1815 1812/1955/1784 1843/1989/1816
-f 1802/1977/1805 1801/1990/1817 1833/1991/1818
-f 1822/1978/1806 1821/1992/1819 1853/1993/1820
-f 1811/1979/1807 1810/1994/1821 1842/1995/1822
-f 1800/1957/1786 1799/1960/1789 1831/1996/1823
-f 1820/1959/1788 1819/1964/1792 1851/1997/1824
-f 1798/1980/1808 1797/1965/1793 1829/1998/1825
-f 1809/1962/1791 1808/1967/1795 1839/1999/1826
-f 1818/1981/1809 1817/1968/1796 1849/2000/1827
-f 1796/1983/1811 1795/2001/1828 1827/2002/1829
-f 1807/2003/1830 1806/1970/1798 1837/2004/1831
-f 1816/1984/1812 1815/2005/1832 1847/2006/1833
-f 1805/2007/1834 1804/1974/1802 1835/2008/1835
-f 1825/1985/1813 1824/1975/1803 1856/2009/1836
-f 1814/1972/1800 1813/1988/1815 1845/2010/1837
-f 1803/2011/1838 1802/1986/1805 1833/2012/1818
-f 1823/1954/1783 1822/1978/1806 1854/2013/1839
-f 1812/1955/1784 1811/1979/1807 1843/1989/1816
-f 1801/1990/1817 1800/1957/1786 1831/1996/1823
-f 1821/1992/1819 1820/1959/1788 1851/1997/1824
-f 1799/1960/1789 1798/1980/1808 1830/2014/1840
-f 1810/1994/1821 1809/1962/1791 1841/2015/1841
-f 1819/1964/1792 1818/2016/1809 1850/2017/1842
-f 1797/1965/1793 1796/1983/1811 1828/2018/1843
-f 1808/1967/1795 1807/2003/1830 1839/1999/1826
-f 1817/1968/1796 1816/1984/1812 1848/2019/1844
-f 1806/1970/1798 1805/2007/1834 1837/2004/1831
-f 1815/2005/1832 1814/1972/1800 1845/2010/1837
-f 1804/1974/1802 1803/2011/1838 1835/2008/1835
-f 1856/2009/1836 1855/1987/1814 1887/2020/1845
-f 1845/2010/1837 1844/2021/1846 1876/2022/1847
-f 1834/2023/1848 1833/2012/1818 1864/2024/1849
-f 1854/2013/1839 1853/1993/1820 1885/2025/1850
-f 1843/1989/1816 1842/1995/1822 1874/2026/1851
-f 1832/2027/1852 1831/1996/1823 1862/2028/1853
-f 1852/2029/1854 1851/1997/1824 1882/2030/1855
-f 1830/2014/1840 1829/1998/1825 1861/2031/1856
-f 1841/2015/1841 1840/2032/1857 1872/2033/1858
-f 1850/2017/1842 1849/2034/1827 1881/2035/1859
-f 1828/2018/1843 1827/2002/1829 1859/2036/1860
-f 1839/1999/1826 1838/2037/1861 1870/2038/1862
-f 1848/2019/1844 1847/2006/1833 1879/2039/1863
-f 1837/2004/1831 1836/2040/1864 1868/2041/1865
-f 1846/2042/1866 1845/2010/1837 1876/2022/1847
-f 1835/2008/1835 1834/2023/1848 1866/2043/1867
-f 1855/1987/1814 1854/2013/1839 1886/2044/1868
-f 1844/2021/1846 1843/1989/1816 1874/2026/1851
-f 1833/1991/1818 1832/2027/1852 1864/2045/1849
-f 1853/1993/1820 1852/2029/1854 1884/2046/1869
-f 1842/1995/1822 1841/2015/1841 1873/2047/1870
-f 1831/1996/1823 1830/2014/1840 1862/2028/1853
-f 1851/1997/1824 1850/2017/1842 1882/2030/1855
-f 1829/1998/1825 1828/2018/1843 1860/2048/1871
-f 1840/2032/1857 1839/1999/1826 1870/2038/1862
-f 1849/2000/1827 1848/2019/1844 1880/2049/1872
-f 1827/2002/1829 1826/2050/1873 1858/2051/1874
-f 1838/2037/1861 1837/2004/1831 1868/2041/1865
-f 1847/2006/1833 1846/2042/1866 1878/2052/1875
-f 1836/2040/1864 1835/2008/1835 1866/2043/1867
-f 1877/2053/1876 1876/2022/1847 1907/2054/1877
-f 1866/2043/1867 1865/2055/1878 1897/2056/1879
-f 1886/2044/1868 1885/2025/1850 1917/2057/1880
-f 1875/2058/1881 1874/2026/1851 1905/2059/1882
-f 1864/2045/1849 1863/2060/1883 1895/2061/1884
-f 1884/2046/1869 1883/2062/1885 1915/2063/1886
-f 1873/2047/1870 1872/2033/1858 1904/2064/1887
-f 1862/2028/1853 1861/2031/1856 1893/2065/1888
-f 1882/2030/1855 1881/2035/1859 1913/2066/1889
-f 1860/2048/1871 1859/2036/1860 1891/2067/1890
-f 1871/2068/1891 1870/2038/1862 1901/2069/1892
-f 1880/2049/1872 1879/2039/1863 1910/2070/1893
-f 1858/2051/1874 1857/2071/1894 1889/2072/1895
-f 1869/2073/1896 1868/2041/1865 1899/2074/1897
-f 1878/2052/1875 1877/2053/1876 1909/2075/1898
-f 1867/2076/1899 1866/2043/1867 1897/2056/1879
-f 1887/2020/1845 1886/2044/1868 1918/2077/1900
-f 1876/2022/1847 1875/2058/1881 1907/2054/1877
-f 1865/2055/1878 1864/2024/1849 1895/2078/1884
-f 1885/2025/1850 1884/2046/1869 1916/2079/1901
-f 1874/2026/1851 1873/2047/1870 1905/2059/1882
-f 1863/2060/1883 1862/2028/1853 1893/2065/1888
-f 1883/2062/1885 1882/2030/1855 1913/2066/1889
-f 1861/2031/1856 1860/2048/1871 1892/2080/1902
-f 1872/2033/1858 1871/2068/1891 1903/2081/1903
-f 1881/2035/1859 1880/2082/1872 1912/2083/1904
-f 1859/2036/1860 1858/2051/1874 1890/2084/1905
-f 1870/2038/1862 1869/2073/1896 1901/2069/1892
-f 1879/2039/1863 1878/2052/1875 1910/2070/1893
-f 1868/2041/1865 1867/2076/1899 1899/2074/1897
-f 1909/2075/1898 1908/2085/1906 1940/2086/1907
-f 1898/2087/1908 1897/2056/1879 1928/2088/1909
-f 1918/2077/1900 1917/2057/1880 1949/2089/1910
-f 1907/2054/1877 1906/2090/1911 1938/2091/1912
-f 1896/2092/1913 1895/2078/1884 1926/2093/1914
-f 1916/2079/1901 1915/2063/1886 1947/2094/1915
-f 1905/2059/1882 1904/2064/1887 1936/2095/1916
-f 1894/2096/1917 1893/2065/1888 1924/2097/1918
-f 1914/2098/1919 1913/2066/1889 1944/2099/1920
-f 1892/2080/1902 1891/2067/1890 1923/2100/1921
-f 1903/2081/1903 1902/2101/1922 1934/2102/1923
-f 1912/2083/1904 1911/2103/1924 1943/2104/1925
-f 1890/2084/1905 1889/2072/1895 1921/2105/1926
-f 1901/2069/1892 1900/2106/1927 1932/2107/1928
-f 1910/2070/1893 1909/2075/1898 1941/2108/1929
-f 1899/2074/1897 1898/2087/1908 1930/2109/1930
-f 1908/2085/1906 1907/2054/1877 1938/2091/1912
-f 1897/2056/1879 1896/2092/1913 1928/2088/1909
-f 1917/2057/1880 1916/2079/1901 1948/2110/1931
-f 1906/2090/1911 1905/2059/1882 1936/2095/1916
-f 1895/2061/1884 1894/2096/1917 1926/2111/1914
-f 1915/2063/1886 1914/2098/1919 1946/2112/1932
-f 1904/2064/1887 1903/2081/1903 1935/2113/1933
-f 1893/2065/1888 1892/2080/1902 1924/2097/1918
-f 1913/2066/1889 1912/2083/1904 1944/2099/1920
-f 1891/2067/1890 1890/2084/1905 1922/2114/1934
-f 1902/2101/1922 1901/2069/1892 1932/2107/1928
-f 1911/2115/1924 1910/2070/1893 1941/2108/1929
-f 1889/2072/1895 1888/2116/1935 1920/2117/1936
-f 1900/2106/1927 1899/2074/1897 1930/2109/1930
-f 1941/2108/1929 1940/2086/1907 1972/2118/1937
-f 1930/2109/1930 1929/2119/1938 1961/2120/1939
-f 1939/2121/1940 1938/2091/1912 1969/2122/1941
-f 1928/2088/1909 1927/2123/1942 1959/2124/1943
-f 1948/2110/1931 1947/2094/1915 1979/2125/1944
-f 1937/2126/1945 1936/2095/1916 1967/2127/1946
-f 1926/2111/1914 1925/2128/1947 1957/2129/1948
-f 1946/2112/1932 1945/2130/1949 1977/2131/1950
-f 1935/2113/1933 1934/2102/1923 1966/2132/1951
-f 1924/2097/1918 1923/2100/1921 1955/2133/1952
-f 1944/2099/1920 1943/2104/1925 1975/2134/1953
-f 1922/2114/1934 1921/2105/1926 1953/2135/1954
-f 1933/2136/1955 1932/2107/1928 1963/2137/1956
-f 1942/2138/1957 1941/2108/1929 1972/2118/1937
-f 1920/2117/1936 1919/2139/1958 1951/2140/1959
-f 1931/2141/1960 1930/2109/1930 1961/2120/1939
-f 1940/2086/1907 1939/2121/1940 1971/2142/1961
-f 1929/2119/1938 1928/2088/1909 1959/2124/1943
-f 1949/2089/1910 1948/2110/1931 1980/2143/1962
-f 1938/2091/1912 1937/2126/1945 1969/2122/1941
-f 1927/2144/1942 1926/2111/1914 1957/2129/1948
-f 1947/2094/1915 1946/2112/1932 1978/2145/1963
-f 1936/2095/1916 1935/2113/1933 1967/2127/1946
-f 1925/2128/1947 1924/2097/1918 1955/2133/1952
-f 1945/2130/1949 1944/2099/1920 1975/2134/1953
-f 1923/2100/1921 1922/2114/1934 1954/2146/1964
-f 1934/2102/1923 1933/2136/1955 1965/2147/1965
-f 1943/2104/1925 1942/2148/1957 1974/2149/1966
-f 1921/2105/1926 1920/2117/1936 1952/2150/1967
-f 1932/2107/1928 1931/2141/1960 1963/2137/1956
-f 1967/2127/1946 1966/2132/1951 1985/2151/1968
-f 1964/2152/1969 1963/2137/1956 1982/2153/1970
-f 1984/2154/1971 13/2155/1972 43/49/47
-f 1983/2156/1973 1982/2153/1970 40/59/57
-f 16/40/39 1986/2157/1974 48/61/59
-f 1981/2158/1975 10/42/41 37/64/62
-f 1985/2151/1968 1984/2154/1971 44/48/46
-f 13/2155/1972 1983/2156/1973 41/55/53
-f 1982/2153/1970 12/19/19 40/59/57
-f 1/17/17 1608/2159/1976 27/82/78
-f 11/20/20 1981/2158/1975 38/63/61
-f 26/2160/1977 25/22/22 57/24/24
-f 1986/2157/1974 15/25/25 47/66/64
-f 14/26/26 1985/2151/1968 44/48/46
-f 27/82/78 1608/2159/1976 58/103/96
-f 26/2160/1977 57/24/24 88/87/83
-f 58/103/96 1608/2159/1976 89/164/143
-f 26/2160/1977 88/87/83 119/112/101
-f 89/164/143 1608/2159/1976 120/183/160
-f 26/2160/1977 119/112/101 150/131/117
-f 26/2160/1977 150/131/117 181/188/165
-f 120/183/160 1608/2159/1976 151/233/206
-f 151/233/206 1608/2159/1976 182/251/223
-f 26/2160/1977 181/188/165 212/203/179
-f 182/251/223 1608/2159/1976 213/269/239
-f 26/2160/1977 212/203/179 243/256/228
-f 213/269/239 1608/2159/1976 244/320/288
-f 26/2160/1977 243/256/228 274/276/246
-f 244/320/288 1608/2159/1976 275/337/304
-f 26/2160/1977 274/276/246 305/323/291
-f 275/337/304 1608/2159/1976 306/388/352
-f 26/2160/1977 305/323/291 336/344/311
-f 306/388/352 1608/2159/1976 337/406/369
-f 26/2160/1977 336/344/311 367/391/355
-f 337/406/369 1608/2159/1976 368/457/417
-f 26/2160/1977 367/391/355 398/413/376
-f 368/457/417 1608/2159/1976 399/478/435
-f 26/2160/1977 398/413/376 429/461/421
-f 399/478/435 1608/2159/1976 430/524/478
-f 26/2160/1977 429/461/421 460/485/442
-f 430/524/478 1608/2159/1976 461/547/500
-f 26/2160/1977 460/485/442 491/497/453
-f 26/2160/1977 491/497/453 522/553/506
-f 461/547/500 1608/2159/1976 492/595/544
-f 492/595/544 1608/2159/1976 523/617/564
-f 26/2160/1977 522/553/506 553/566/518
-f 523/617/564 1608/2159/1976 554/631/577
-f 26/2160/1977 553/566/518 584/622/569
-f 554/631/577 1608/2159/1976 585/697/629
-f 26/2160/1977 584/622/569 615/640/585
-f 585/697/629 1608/2159/1976 616/713/643
-f 26/2160/1977 615/640/585 646/702/633
-f 616/713/643 1608/2159/1976 647/766/693
-f 26/2160/1977 646/702/633 677/721/651
-f 647/766/693 1608/2159/1976 678/784/709
-f 26/2160/1977 677/721/651 708/769/696
-f 678/784/709 1608/2159/1976 709/834/757
-f 26/2160/1977 708/769/696 739/792/717
-f 709/834/757 1608/2159/1976 740/854/775
-f 26/2160/1977 739/792/717 770/837/760
-f 740/854/775 1608/2159/1976 771/903/821
-f 26/2160/1977 770/837/760 801/862/783
-f 771/903/821 1608/2159/1976 802/922/840
-f 26/2160/1977 801/862/783 832/873/793
-f 26/2160/1977 832/873/793 863/928/846
-f 802/922/840 1608/2159/1976 833/971/885
-f 833/971/885 1608/2159/1976 864/991/905
-f 26/2160/1977 863/928/846 894/943/859
-f 864/991/905 1608/2159/1976 895/1006/918
-f 26/2160/1977 894/943/859 925/995/909
-f 895/1006/918 1608/2159/1976 926/1061/969
-f 26/2160/1977 925/995/909 956/1014/926
-f 926/1061/969 1608/2159/1976 957/1076/983
-f 26/2160/1977 956/1014/926 987/1064/972
-f 957/1076/983 1608/2159/1976 988/1127/1031
-f 26/2160/1977 987/1064/972 1018/1084/991
-f 988/1127/1031 1608/2159/1976 1019/1142/1045
-f 26/2160/1977 1018/1084/991 1049/1130/1034
-f 1019/1142/1045 1608/2159/1976 1050/1202/1095
-f 26/2160/1977 1049/1130/1034 1080/1150/1053
-f 1050/1202/1095 1608/2159/1976 1081/1221/1111
-f 26/2160/1977 1080/1150/1053 1111/1206/1098
-f 1081/1221/1111 1608/2159/1976 1112/1274/1158
-f 26/2160/1977 1111/1206/1098 1142/1231/1119
-f 1112/1274/1158 1608/2159/1976 1143/1294/1178
-f 26/2160/1977 1142/1231/1119 1173/1277/1161
-f 1143/1294/1178 1608/2159/1976 1174/1344/1223
-f 26/2160/1977 1173/1277/1161 1204/1302/1186
-f 1174/1344/1223 1608/2159/1976 1205/1365/1243
-f 26/2160/1977 1204/1302/1186 1235/1313/1195
-f 26/2160/1977 1235/1313/1195 1266/1371/1249
-f 1205/1365/1243 1608/2159/1976 1236/1411/1286
-f 1236/1411/1286 1608/2159/1976 1267/1433/1308
-f 26/2160/1977 1266/1371/1249 1297/1383/1261
-f 1267/1433/1308 1608/2159/1976 1298/1447/1320
-f 26/2160/1977 1297/1383/1261 1328/1437/1312
-f 1298/1447/1320 1608/2159/1976 1329/1503/1373
-f 26/2160/1977 1328/1437/1312 1359/1455/1328
-f 1329/1503/1373 1608/2159/1976 1360/1516/1385
-f 26/2160/1977 1359/1455/1328 1390/1506/1376
-f 1360/1516/1385 1608/2159/1976 1391/1571/1437
-f 26/2160/1977 1390/1506/1376 1421/1524/1393
-f 1391/1571/1437 1608/2159/1976 1422/1587/1452
-f 26/2160/1977 1421/1524/1393 1452/1574/1440
-f 1422/1587/1452 1608/2159/1976 1453/1639/1500
-f 26/2160/1977 1452/1574/1440 1483/1595/1460
-f 1453/1639/1500 1608/2159/1976 1484/1675/1533
-f 26/2160/1977 1483/1595/1460 1514/1642/1503
-f 1484/1675/1533 1608/2159/1976 1515/1697/1553
-f 26/2160/1977 1514/1642/1503 1545/1644/1505
-f 26/2160/1977 1545/1644/1505 1576/1704/1559
-f 1515/1697/1553 1608/2159/1976 1546/1750/1595
-f 1546/1750/1595 1608/2159/1976 1577/1777/1618
-f 26/2160/1977 1576/1704/1559 1607/1718/1570
-f 1577/1777/1618 1608/2159/1976 1609/1791/1630
-f 26/2160/1977 1607/1718/1570 1639/1782/1622
-f 1609/1791/1630 1608/2159/1976 1640/1848/1684
-f 26/2160/1977 1639/1782/1622 1670/1799/1638
-f 1640/1848/1684 1608/2159/1976 1671/1858/1694
-f 26/2160/1977 1670/1799/1638 1701/1851/1687
-f 1671/1858/1694 1608/2159/1976 1702/1914/1747
-f 26/2160/1977 1701/1851/1687 1732/1866/1702
-f 1702/1914/1747 1608/2159/1976 1733/1929/1761
-f 26/2160/1977 1732/1866/1702 1763/1917/1750
-f 1733/1929/1761 1608/2159/1976 1764/1982/1810
-f 26/2160/1977 1763/1917/1750 1794/1937/1769
-f 1764/1982/1810 1608/2159/1976 1795/2001/1828
-f 26/2160/1977 1794/1937/1769 1825/1985/1813
-f 1795/2001/1828 1608/2159/1976 1826/2050/1873
-f 26/2160/1977 1825/1985/1813 1856/2009/1836
-f 1826/2050/1873 1608/2159/1976 1857/2071/1894
-f 26/2160/1977 1856/2009/1836 1887/2020/1845
-f 26/2160/1977 1887/2020/1845 1918/2077/1900
-f 1857/2071/1894 1608/2159/1976 1888/2116/1935
-f 1888/2116/1935 1608/2159/1976 1919/2139/1958
-f 26/2160/1977 1918/2077/1900 1949/2089/1910
-f 1919/2139/1958 1608/2159/1976 1950/2161/1978
-f 26/2160/1977 1949/2089/1910 1980/2143/1962
-f 26/2160/1977 1980/2143/1962 25/22/22
-f 1973/2162/1979 1972/2118/1937 17/39/14
-f 1951/2140/1959 1950/2161/1978 2/16/16
-f 1962/2163/1980 1961/2120/1939 12/19/19
-f 1971/2142/1961 1970/2164/1981 16/40/39
-f 1960/2165/1982 1959/2124/1943 1981/2158/1975
-f 1969/2122/1941 1968/2166/1983 15/25/25
-f 1958/2167/1984 1957/2129/1948 9/28/28
-f 1978/2145/1963 1977/2131/1950 22/1/1
-f 1956/2168/1985 1955/2133/1952 7/33/33
-f 1976/2169/1986 1975/2134/1953 20/7/7
-f 1954/2146/1964 1953/2135/1954 5/5/5
-f 1965/2147/1965 1964/2152/1969 13/2155/1972
-f 1974/2149/1966 1973/2170/1979 18/13/13
-f 1952/2150/1967 1951/2140/1959 3/11/11
-f 1963/2137/1956 1962/2163/1980 1982/2153/1970
-f 1980/2143/1962 1979/2125/1944 24/23/23
-f 1972/2118/1937 1971/2142/1961 16/40/39
-f 1950/2161/1978 1608/2159/1976 1/17/17
-f 1961/2120/1939 1960/2165/1982 11/20/20
-f 1970/2164/1981 1969/2122/1941 15/25/25
-f 1959/2124/1943 1958/2171/1984 10/42/41
-f 1979/2125/1944 1978/2145/1963 23/31/31
-f 1968/2166/1983 1967/2127/1946 1985/2151/1968
-f 1957/2129/1948 1956/2168/1985 8/29/29
-f 1977/2131/1950 1976/2169/1986 21/2/2
-f 1966/2132/1951 1965/2147/1965 1984/2154/1971
-f 1955/2133/1952 1954/2146/1964 6/4/4
-f 1975/2134/1953 1974/2149/1966 19/8/8
-f 1953/2135/1954 1952/2150/1967 4/10/10
-f 21/2/2 53/35/35 54/3/3
-f 5/5/5 31/36/36 32/6/6
-f 19/8/8 51/37/37 52/9/9
-f 3/11/11 29/38/38 30/12/12
-f 17/14/14 49/80/40 50/15/15
-f 1/17/17 27/82/78 28/18/18
-f 11/20/20 38/63/61 39/21/21
-f 24/23/23 56/45/43 57/24/24
-f 14/26/26 45/71/68 46/27/27
-f 8/29/29 34/46/44 35/30/30
-f 22/1/1 54/3/3 55/32/32
-f 6/4/4 32/6/6 33/34/34
-f 20/7/7 52/9/9 53/35/35
-f 4/10/10 30/12/12 31/36/36
-f 18/13/13 50/15/15 51/37/37
-f 2/16/16 28/18/18 29/38/38
-f 16/40/39 48/61/59 49/41/40
-f 9/43/28 35/68/30 36/44/42
-f 23/31/31 55/32/32 56/45/43
-f 7/33/33 33/34/34 34/46/44
-f 54/3/3 85/74/71 86/47/45
-f 43/49/47 74/75/72 75/50/48
-f 32/6/6 63/76/73 64/51/49
-f 52/9/9 83/77/74 84/52/50
-f 30/12/12 61/78/75 62/53/51
-f 41/55/53 72/79/76 73/56/54
-f 50/15/15 81/81/77 82/57/55
-f 28/18/18 59/83/79 60/58/56
-f 39/21/21 70/84/80 71/60/58
-f 48/61/59 79/85/81 80/62/60
-f 37/64/62 68/86/82 69/65/63
-f 46/27/27 77/88/84 78/67/65
-f 35/68/30 66/2172/85 67/69/66
-f 55/32/32 86/47/45 87/70/67
-f 44/48/46 75/50/48 76/72/69
-f 33/34/34 64/51/49 65/73/70
-f 53/35/35 84/52/50 85/74/71
-f 42/54/52 73/56/54 74/75/72
-f 31/36/36 62/53/51 63/76/73
-f 51/37/37 82/57/55 83/77/74
-f 29/38/38 60/58/56 61/78/75
-f 40/59/57 71/60/58 72/79/76
-f 49/80/40 80/101/60 81/81/77
-f 27/82/78 58/103/96 59/83/79
-f 38/63/61 69/65/63 70/84/80
-f 47/66/64 78/67/65 79/85/81
-f 36/44/42 67/69/66 68/86/82
-f 56/45/43 87/70/67 88/87/83
-f 45/71/68 76/72/69 77/88/84
-f 34/46/44 65/73/70 66/89/85
-f 86/47/45 117/115/104 118/90/86
-f 75/50/48 106/116/105 107/91/87
-f 64/51/49 95/117/106 96/92/88
-f 84/52/50 115/118/107 116/93/89
-f 73/56/54 104/2173/109 105/94/90
-f 62/53/51 93/119/108 94/95/91
-f 82/57/55 113/122/110 114/96/92
-f 60/58/56 91/123/111 92/97/93
-f 71/99/58 102/124/112 103/100/94
-f 80/101/60 111/126/113 112/102/95
-f 58/103/96 89/164/143 90/104/97
-f 69/106/63 100/127/114 101/107/98
-f 78/67/65 109/128/115 110/108/99
-f 67/110/66 98/130/116 99/111/100
-f 87/70/67 118/90/86 119/112/101
-f 76/72/69 107/91/87 108/113/102
-f 65/73/70 96/92/88 97/114/103
-f 85/74/71 116/93/89 117/115/104
-f 74/75/72 105/94/90 106/116/105
-f 63/76/73 94/95/91 95/117/106
-f 83/77/74 114/96/92 115/118/107
-f 61/78/75 92/97/93 93/119/108
-f 72/98/76 103/100/94 104/121/109
-f 81/81/77 112/102/95 113/122/110
-f 59/83/79 90/104/97 91/123/111
-f 70/105/80 101/107/98 102/124/112
-f 79/125/81 110/147/99 111/126/113
-f 68/109/82 99/111/100 100/127/114
-f 77/88/84 108/113/102 109/128/115
-f 66/129/85 97/152/103 98/130/116
-f 118/90/86 149/154/133 150/131/117
-f 107/133/87 138/155/134 139/134/118
-f 96/92/88 127/156/135 128/135/119
-f 116/93/89 147/157/136 148/136/120
-f 105/138/90 136/158/137 137/139/121
-f 94/95/91 125/159/138 126/140/122
-f 114/96/92 145/160/139 146/141/123
-f 92/97/93 123/161/140 124/142/124
-f 103/100/94 134/162/141 135/143/125
-f 112/102/95 143/163/142 144/144/126
-f 90/104/97 121/165/144 122/145/127
-f 101/107/98 132/166/145 133/146/128
-f 110/147/99 141/2174/146 142/148/129
-f 99/111/100 130/169/147 131/149/130
-f 108/132/102 139/134/118 140/151/131
-f 97/152/103 128/171/119 129/153/132
-f 117/115/104 148/136/120 149/154/133
-f 106/137/105 137/139/121 138/155/134
-f 95/117/106 126/140/122 127/156/135
-f 115/118/107 146/141/123 147/157/136
-f 104/121/109 135/143/125 136/158/137
-f 93/119/108 124/142/124 125/159/138
-f 113/122/110 144/144/126 145/160/139
-f 91/123/111 122/145/127 123/161/140
-f 102/124/112 133/146/128 134/162/141
-f 111/126/113 142/148/129 143/163/142
-f 89/164/143 120/183/160 121/165/144
-f 100/127/114 131/149/130 132/166/145
-f 109/150/115 140/151/131 141/168/146
-f 98/130/116 129/153/132 130/169/147
-f 171/200/176 140/151/131 170/170/148
-f 128/171/119 159/205/166 160/172/149
-f 148/136/120 179/190/167 180/173/150
-f 137/139/121 168/191/168 169/174/151
-f 126/140/122 157/210/184 158/175/152
-f 146/141/123 177/192/169 178/176/153
-f 135/143/125 166/194/171 167/177/154
-f 124/142/124 155/193/170 156/178/155
-f 144/144/126 175/195/172 176/179/156
-f 122/145/127 153/196/173 154/180/157
-f 133/146/128 164/197/174 165/181/158
-f 142/148/129 173/231/175 174/182/159
-f 120/183/160 151/233/206 152/184/161
-f 163/217/191 132/166/145 162/185/162
-f 140/151/131 171/200/176 172/186/163
-f 129/153/132 160/172/149 161/187/164
-f 149/154/133 180/173/150 181/188/165
-f 138/155/134 169/174/151 170/170/148
-f 127/156/135 158/175/152 159/189/166
-f 147/157/136 178/176/153 179/190/167
-f 136/158/137 167/177/154 168/191/168
-f 157/210/184 126/140/122 156/178/155
-f 145/160/139 176/179/156 177/192/169
-f 123/161/140 154/180/157 155/193/170
-f 134/162/141 165/181/158 166/194/171
-f 143/163/142 174/182/159 175/195/172
-f 121/165/144 152/184/161 153/196/173
-f 132/166/145 163/217/191 164/197/174
-f 141/168/146 172/186/163 173/199/175
-f 130/169/147 161/187/164 162/185/162
-f 171/200/176 202/237/210 203/201/177
-f 160/172/149 191/221/195 192/202/178
-f 180/173/150 211/222/196 212/203/179
-f 169/174/151 200/223/197 201/204/180
-f 158/206/152 189/257/198 190/207/181
-f 178/176/153 209/225/199 210/208/182
-f 167/177/154 198/226/200 199/209/183
-f 156/178/155 187/227/201 188/211/185
-f 176/179/156 207/228/202 208/212/186
-f 154/180/157 185/229/203 186/213/187
-f 165/181/158 196/230/204 197/214/188
-f 174/182/159 205/232/205 206/215/189
-f 152/184/161 183/234/207 184/216/190
-f 163/217/191 194/253/225 195/218/192
-f 172/186/163 203/201/177 204/219/193
-f 161/187/164 192/202/178 193/220/194
-f 202/237/210 171/200/176 201/204/180
-f 159/205/166 190/207/181 191/221/195
-f 179/190/167 210/208/182 211/222/196
-f 168/191/168 199/209/183 200/223/197
-f 157/210/184 188/211/185 189/224/198
-f 177/192/169 208/212/186 209/225/199
-f 166/194/171 197/214/188 198/226/200
-f 155/193/170 186/213/187 187/227/201
-f 175/195/172 206/215/189 207/228/202
-f 153/196/173 184/216/190 185/229/203
-f 164/197/174 195/218/192 196/230/204
-f 173/231/175 204/249/193 205/232/205
-f 151/233/206 182/251/223 183/234/207
-f 194/253/225 163/217/191 193/220/194
-f 203/201/177 234/273/243 235/235/208
-f 192/202/178 223/255/227 224/236/209
-f 233/254/226 202/237/210 232/238/211
-f 190/207/181 221/258/229 222/239/212
-f 210/208/182 241/259/230 242/240/213
-f 199/209/183 230/260/231 231/241/214
-f 188/211/185 219/261/232 220/242/215
-f 208/212/186 239/262/233 240/243/216
-f 197/214/188 228/264/235 229/244/217
-f 186/213/187 217/263/234 218/245/218
-f 206/215/189 237/286/255 238/246/219
-f 184/216/190 215/265/236 216/247/220
-f 195/218/192 226/266/237 227/248/221
-f 204/249/193 235/267/208 236/250/222
-f 182/251/223 213/269/239 214/252/224
-f 225/271/241 194/253/225 224/236/209
-f 234/273/243 203/201/177 233/254/226
-f 191/221/195 222/239/212 223/255/227
-f 211/222/196 242/240/213 243/256/228
-f 200/223/197 231/241/214 232/238/211
-f 189/257/198 220/278/215 221/258/229
-f 209/225/199 240/243/216 241/259/230
-f 198/226/200 229/244/217 230/260/231
-f 187/227/201 218/245/218 219/261/232
-f 207/228/202 238/246/219 239/262/233
-f 185/229/203 216/247/220 217/263/234
-f 196/230/204 227/248/221 228/264/235
-f 237/286/255 206/215/189 236/250/222
-f 183/234/207 214/252/224 215/265/236
-f 194/253/225 225/271/241 226/266/237
-f 235/267/208 266/2175/272 267/268/238
-f 213/269/239 244/320/288 245/270/240
-f 256/301/270 225/271/241 255/272/242
-f 233/254/226 264/306/275 265/274/244
-f 222/239/212 253/290/259 254/275/245
-f 242/240/213 273/291/260 274/276/246
-f 231/241/214 262/310/279 263/277/247
-f 220/278/215 251/324/261 252/279/248
-f 240/243/216 271/293/262 272/280/249
-f 229/244/217 260/294/263 261/281/250
-f 218/245/218 249/295/264 250/282/251
-f 238/246/219 269/296/265 270/283/252
-f 216/247/220 247/297/266 248/284/253
-f 227/248/221 258/298/267 259/285/254
-f 236/250/222 267/268/238 268/287/256
-f 214/252/224 245/270/240 246/288/257
-f 225/271/241 256/301/270 257/289/258
-f 266/303/272 235/235/208 265/274/244
-f 223/255/227 254/275/245 255/272/242
-f 264/306/275 233/254/226 263/277/247
-f 221/258/229 252/279/248 253/290/259
-f 241/259/230 272/280/249 273/291/260
-f 262/310/279 231/241/214 261/281/250
-f 219/261/232 250/282/251 251/292/261
-f 239/262/233 270/283/252 271/293/262
-f 228/264/235 259/285/254 260/294/263
-f 217/263/234 248/284/253 249/295/264
-f 237/286/255 268/287/256 269/296/265
-f 215/265/236 246/288/257 247/297/266
-f 226/266/237 257/289/258 258/298/267
-f 267/268/238 298/355/287 299/299/268
-f 245/270/240 276/321/289 277/300/269
-f 256/301/270 287/339/306 288/302/271
-f 297/335/302 266/303/272 296/304/273
-f 254/275/245 285/322/290 286/305/274
-f 295/341/308 264/306/275 294/307/276
-f 252/279/248 283/325/292 284/308/277
-f 272/280/249 303/326/293 304/309/278
-f 293/345/312 262/310/279 292/311/280
-f 250/282/251 281/327/294 282/312/281
-f 270/283/252 301/328/295 302/313/282
-f 259/285/254 290/330/297 291/314/283
-f 248/284/253 279/329/296 280/315/284
-f 300/331/298 269/296/265 299/299/268
-f 246/288/257 277/300/269 278/316/285
-f 257/289/258 288/302/271 289/317/286
-f 266/303/272 297/335/302 298/319/287
-f 244/320/288 275/337/304 276/321/289
-f 287/339/306 256/301/270 286/305/274
-f 264/306/275 295/341/308 296/304/273
-f 253/290/259 284/308/277 285/322/290
-f 273/291/260 304/309/278 305/323/291
-f 262/310/279 293/345/312 294/307/276
-f 251/324/261 282/347/281 283/325/292
-f 271/293/262 302/313/282 303/326/293
-f 260/294/263 291/314/283 292/311/280
-f 249/295/264 280/315/284 281/327/294
-f 269/296/265 300/331/298 301/328/295
-f 247/297/266 278/316/285 279/329/296
-f 258/298/267 289/317/286 290/330/297
-f 299/299/268 330/356/321 331/332/299
-f 277/300/269 308/357/322 309/333/300
-f 320/366/331 289/317/286 319/334/301
-f 297/335/302 328/373/337 329/336/303
-f 275/337/304 306/388/352 307/338/305
-f 318/371/335 287/339/306 317/340/307
-f 295/341/308 326/376/340 327/342/309
-f 284/308/277 315/358/323 316/343/310
-f 304/309/278 335/359/324 336/344/311
-f 293/345/312 324/380/344 325/346/313
-f 282/347/281 313/392/325 314/348/314
-f 302/313/282 333/361/326 334/349/315
-f 291/314/283 322/362/327 323/350/316
-f 280/315/284 311/363/328 312/351/317
-f 300/331/298 331/332/299 332/352/318
-f 278/316/285 309/333/300 310/353/319
-f 289/317/286 320/366/331 321/354/320
-f 298/355/287 329/368/303 330/356/321
-f 276/321/289 307/338/305 308/357/322
-f 287/339/306 318/371/335 319/334/301
-f 328/373/337 297/335/302 327/342/309
-f 285/322/290 316/343/310 317/340/307
-f 326/376/340 295/341/308 325/346/313
-f 283/325/292 314/348/314 315/358/323
-f 303/326/293 334/349/315 335/359/324
-f 324/380/344 293/345/312 323/350/316
-f 281/327/294 312/351/317 313/360/325
-f 301/328/295 332/352/318 333/361/326
-f 290/330/297 321/354/320 322/362/327
-f 279/329/296 310/353/319 311/363/328
-f 331/332/299 362/399/362 363/364/329
-f 309/333/300 340/386/350 341/365/330
-f 320/366/331 351/402/365 352/367/332
-f 329/368/303 360/423/351 361/369/333
-f 307/338/305 338/389/353 339/370/334
-f 318/371/335 349/408/371 350/372/336
-f 359/404/367 328/373/337 358/374/338
-f 316/343/310 347/390/354 348/375/339
-f 357/410/373 326/376/340 356/377/341
-f 314/348/314 345/393/356 346/378/342
-f 334/349/315 365/394/357 366/379/343
-f 355/414/377 324/380/344 354/381/345
-f 312/351/317 343/395/358 344/382/346
-f 332/352/318 363/364/329 364/383/347
-f 321/354/320 352/367/332 353/384/348
-f 310/353/319 341/365/330 342/385/349
-f 362/399/362 331/332/299 361/369/333
-f 308/357/322 339/370/334 340/386/350
-f 351/402/365 320/366/331 350/372/336
-f 328/373/337 359/404/367 360/387/351
-f 306/388/352 337/406/369 338/389/353
-f 349/408/371 318/371/335 348/375/339
-f 326/376/340 357/410/373 358/374/338
-f 315/358/323 346/378/342 347/390/354
-f 335/359/324 366/379/343 367/391/355
-f 324/380/344 355/414/377 356/377/341
-f 313/392/325 344/416/346 345/393/356
-f 333/361/326 364/383/347 365/394/357
-f 322/362/327 353/384/348 354/381/345
-f 311/363/328 342/385/349 343/395/358
-f 395/430/391 364/383/347 394/396/359
-f 352/367/332 383/422/384 384/397/360
-f 341/365/330 372/421/383 373/398/361
-f 361/369/333 392/424/385 393/400/363
-f 339/370/334 370/425/386 371/401/364
-f 382/436/397 351/402/365 381/403/366
-f 359/404/367 390/426/387 391/405/368
-f 337/406/369 368/457/417 369/407/370
-f 380/441/401 349/408/371 379/409/372
-f 357/410/373 388/445/405 389/411/374
-f 346/378/342 377/427/388 378/412/375
-f 366/379/343 397/428/389 398/413/376
-f 355/414/377 386/449/409 387/415/378
-f 344/416/346 375/462/390 376/417/379
-f 364/383/347 395/430/391 396/418/380
-f 353/384/348 384/397/360 385/419/381
-f 342/385/349 373/398/361 374/420/382
-f 394/396/359 363/364/329 393/400/363
-f 340/386/350 371/401/364 372/421/383
-f 351/402/365 382/436/397 383/422/384
-f 360/423/351 391/438/368 392/424/385
-f 338/389/353 369/407/370 370/425/386
-f 349/408/371 380/441/401 381/403/366
-f 358/374/338 389/411/374 390/426/387
-f 347/390/354 378/412/375 379/409/372
-f 388/445/405 357/410/373 387/415/378
-f 345/393/356 376/417/379 377/427/388
-f 365/394/357 396/418/380 397/428/389
-f 386/449/409 355/414/377 385/419/381
-f 343/395/358 374/420/382 375/429/390
-f 395/430/391 426/451/411 427/431/392
-f 384/397/360 415/452/412 416/432/393
-f 373/398/361 404/453/413 405/433/394
-f 393/400/363 424/454/414 425/434/395
-f 371/401/364 402/455/415 403/435/396
-f 382/436/397 413/473/432 414/437/398
-f 391/438/368 422/475/416 423/439/399
-f 369/407/370 400/458/418 401/440/400
-f 380/441/401 411/480/437 412/442/402
-f 389/411/374 420/459/419 421/443/403
-f 378/412/375 409/460/420 410/444/404
-f 419/482/439 388/445/405 418/446/406
-f 376/417/379 407/463/422 408/447/407
-f 396/418/380 427/431/392 428/448/408
-f 417/465/424 386/449/409 416/432/393
-f 374/420/382 405/433/394 406/450/410
-f 394/396/359 425/434/395 426/451/411
-f 383/422/384 414/437/398 415/452/412
-f 372/421/383 403/435/396 404/453/413
-f 392/424/385 423/439/399 424/454/414
-f 370/425/386 401/440/400 402/455/415
-f 413/473/432 382/436/397 412/442/402
-f 390/426/387 421/443/403 422/456/416
-f 368/457/417 399/478/435 400/458/418
-f 411/480/437 380/441/401 410/444/404
-f 388/445/405 419/482/439 420/459/419
-f 377/427/388 408/447/407 409/460/420
-f 397/428/389 428/448/408 429/461/421
-f 386/449/409 417/465/424 418/446/406
-f 375/462/390 406/487/410 407/463/422
-f 427/431/392 458/489/445 459/464/423
-f 448/498/454 417/465/424 447/466/425
-f 405/433/394 436/490/446 437/467/426
-f 425/434/395 456/491/447 457/468/427
-f 414/437/398 445/493/449 446/469/428
-f 403/435/396 434/492/448 435/470/429
-f 423/439/399 454/494/450 455/471/430
-f 401/440/400 432/495/451 433/472/431
-f 444/507/462 413/473/432 443/474/433
-f 421/476/403 452/522/452 453/477/434
-f 399/478/435 430/524/478 431/479/436
-f 442/511/466 411/480/437 441/481/438
-f 451/513/468 420/459/419 450/483/440
-f 408/447/407 439/516/471 440/484/441
-f 428/448/408 459/464/423 460/485/442
-f 417/465/424 448/498/454 449/486/443
-f 406/487/410 437/500/426 438/488/444
-f 426/451/411 457/468/427 458/489/445
-f 415/452/412 446/469/428 447/466/425
-f 404/453/413 435/470/429 436/490/446
-f 424/454/414 455/471/430 456/491/447
-f 402/455/415 433/472/431 434/492/448
-f 413/473/432 444/507/462 445/493/449
-f 422/475/416 453/477/434 454/494/450
-f 400/458/418 431/479/436 432/495/451
-f 411/480/437 442/511/466 443/474/433
-f 420/459/419 451/513/468 452/496/452
-f 409/460/420 440/484/441 441/481/438
-f 450/483/440 419/482/439 449/486/443
-f 439/516/471 408/447/407 438/488/444
-f 459/464/423 490/517/472 491/497/453
-f 448/498/454 479/533/487 480/499/455
-f 437/500/426 468/554/473 469/501/456
-f 457/468/427 488/519/474 489/502/457
-f 446/469/428 477/520/475 478/503/458
-f 467/535/489 436/490/446 466/504/459
-f 487/537/491 456/491/447 486/505/460
-f 433/472/431 464/521/476 465/506/461
-f 444/507/462 475/543/497 476/508/463
-f 453/477/434 484/523/477 485/509/464
-f 431/479/436 462/525/479 463/510/465
-f 442/511/466 473/549/502 474/512/467
-f 451/513/468 482/526/480 483/514/469
-f 440/484/441 471/527/481 472/515/470
-f 481/528/482 450/483/440 480/499/455
-f 470/530/484 439/516/471 469/501/456
-f 458/489/445 489/502/457 490/517/472
-f 479/533/487 448/498/454 478/503/458
-f 436/490/446 467/535/489 468/518/473
-f 456/491/447 487/537/491 488/519/474
-f 445/493/449 476/508/463 477/520/475
-f 434/492/448 465/506/461 466/504/459
-f 454/494/450 485/509/464 486/505/460
-f 432/495/451 463/510/465 464/521/476
-f 475/543/497 444/507/462 474/512/467
-f 452/522/452 483/545/469 484/523/477
-f 430/524/478 461/547/500 462/525/479
-f 473/549/502 442/511/466 472/515/470
-f 450/483/440 481/528/482 482/526/480
-f 439/516/471 470/530/484 471/527/481
-f 512/562/514 481/528/482 511/529/483
-f 501/564/516 470/530/484 500/531/485
-f 489/502/457 520/555/507 521/532/486
-f 510/567/519 479/533/487 509/534/488
-f 467/535/489 498/556/508 499/536/490
-f 487/537/491 518/574/525 519/538/492
-f 476/508/463 507/558/510 508/539/493
-f 465/506/461 496/557/509 497/540/494
-f 485/509/464 516/559/511 517/541/495
-f 463/510/465 494/560/512 495/542/496
-f 506/577/528 475/543/497 505/544/498
-f 483/545/469 514/593/513 515/546/499
-f 461/547/500 492/595/544 493/548/501
-f 504/581/532 473/549/502 503/550/503
-f 481/528/482 512/562/514 513/551/504
-f 470/530/484 501/564/516 502/552/505
-f 490/517/472 521/532/486 522/553/506
-f 479/533/487 510/567/519 511/529/483
-f 468/554/473 499/2176/490 500/531/485
-f 488/519/474 519/538/492 520/555/507
-f 477/520/475 508/539/493 509/534/488
-f 466/504/459 497/540/494 498/556/508
-f 518/574/525 487/537/491 517/541/495
-f 464/521/476 495/542/496 496/557/509
-f 475/543/497 506/577/528 507/558/510
-f 484/523/477 515/546/499 516/559/511
-f 462/525/479 493/548/501 494/560/512
-f 473/549/502 504/581/532 505/544/498
-f 482/526/480 513/551/504 514/561/513
-f 471/527/481 502/552/505 503/550/503
-f 512/562/514 543/601/548 544/563/515
-f 501/564/516 532/603/550 533/565/517
-f 521/532/486 552/586/536 553/566/518
-f 510/567/519 541/606/553 542/568/520
-f 499/536/490 530/587/537 531/570/521
-f 519/538/492 550/588/538 551/571/522
-f 508/539/493 539/589/539 540/572/523
-f 497/540/494 528/590/540 529/573/524
-f 517/541/495 548/591/541 549/575/526
-f 495/542/496 526/592/542 527/576/527
-f 506/577/528 537/614/561 538/578/529
-f 515/546/499 546/594/543 547/579/530
-f 493/548/501 524/596/545 525/580/531
-f 504/581/532 535/619/566 536/582/533
-f 513/551/504 544/563/515 545/583/534
-f 502/552/505 533/565/517 534/584/535
-f 543/601/548 512/562/514 542/568/520
-f 532/603/550 501/564/516 531/585/521
-f 520/555/507 551/571/522 552/586/536
-f 541/606/553 510/567/519 540/572/523
-f 498/556/508 529/573/524 530/587/537
-f 518/574/525 549/575/526 550/588/538
-f 507/558/510 538/578/529 539/589/539
-f 496/557/509 527/576/527 528/590/540
-f 516/559/511 547/579/530 548/591/541
-f 494/560/512 525/580/531 526/592/542
-f 537/614/561 506/577/528 536/582/533
-f 514/593/513 545/597/534 546/594/543
-f 492/595/544 523/617/564 524/596/545
-f 535/619/566 504/581/532 534/584/535
-f 544/598/515 575/655/567 576/599/546
-f 533/565/517 564/621/568 565/600/547
-f 574/635/581 543/601/548 573/602/549
-f 563/2177/583 532/603/550 562/604/551
-f 551/571/522 582/624/570 583/605/552
-f 572/641/586 541/606/553 571/607/554
-f 529/573/524 560/625/571 561/608/555
-f 549/575/526 580/647/592 581/609/556
-f 538/578/529 569/627/573 570/610/557
-f 527/576/527 558/626/572 559/611/558
-f 547/579/530 578/628/574 579/612/559
-f 525/580/531 556/629/575 557/613/560
-f 568/650/595 537/614/561 567/615/562
-f 545/597/534 576/599/546 577/616/563
-f 523/617/564 554/631/577 555/618/565
-f 566/633/579 535/619/566 565/600/547
-f 543/601/548 574/635/581 575/620/567
-f 532/603/550 563/2177/583 564/621/568
-f 552/586/536 583/605/552 584/622/569
-f 541/606/553 572/641/586 573/602/549
-f 530/587/537 561/608/555 562/623/551
-f 550/588/538 581/609/556 582/624/570
-f 539/589/539 570/610/557 571/607/554
-f 528/590/540 559/611/558 560/625/571
-f 580/647/592 549/575/526 579/612/559
-f 526/592/542 557/613/560 558/626/572
-f 537/614/561 568/650/595 569/627/573
-f 546/594/543 577/616/563 578/628/574
-f 524/596/545 555/618/565 556/629/575
-f 535/619/566 566/633/579 567/615/562
-f 576/599/546 607/656/600 608/630/576
-f 554/631/577 585/697/629 586/632/578
-f 597/2178/610 566/633/579 596/634/580
-f 574/635/581 605/2179/614 606/636/582
-f 563/638/583 594/681/616 595/639/584
-f 583/605/552 614/664/601 615/640/585
-f 572/641/586 603/2180/619 604/642/587
-f 561/608/555 592/665/602 593/643/588
-f 581/609/556 612/666/603 613/644/589
-f 570/610/557 601/667/604 602/645/590
-f 559/611/558 590/668/605 591/646/591
-f 579/612/559 610/669/606 611/648/593
-f 557/613/560 588/670/607 589/649/594
-f 568/650/595 599/2181/627 600/651/596
-f 577/616/563 608/630/576 609/652/597
-f 555/618/565 586/632/578 587/653/598
-f 566/633/579 597/2178/610 598/654/599
-f 575/655/567 606/676/582 607/656/600
-f 564/637/568 595/639/584 596/658/580
-f 605/679/614 574/659/581 604/661/587
-f 594/681/616 563/638/583 593/663/588
-f 582/624/570 613/644/589 614/664/601
-f 603/2180/619 572/641/586 602/645/590
-f 560/625/571 591/646/591 592/665/602
-f 580/647/592 611/648/593 612/666/603
-f 569/627/573 600/651/596 601/667/604
-f 558/626/572 589/649/594 590/668/605
-f 578/628/574 609/652/597 610/669/606
-f 556/629/575 587/653/598 588/670/607
-f 599/2181/627 568/650/595 598/654/599
-f 608/630/576 639/696/628 640/671/608
-f 586/632/578 617/698/630 618/672/609
-f 597/674/610 628/715/645 629/675/611
-f 606/676/582 637/2182/631 638/677/612
-f 595/639/584 626/701/632 627/678/613
-f 636/717/647 605/679/614 635/680/615
-f 625/719/649 594/681/616 624/682/617
-f 613/644/589 644/704/634 645/683/618
-f 634/722/652 603/684/619 633/686/620
-f 591/646/591 622/705/635 623/687/621
-f 611/648/593 642/728/658 643/688/622
-f 600/690/596 631/707/637 632/691/623
-f 589/649/594 620/706/636 621/692/624
-f 609/652/597 640/671/608 641/693/625
-f 587/653/598 618/672/609 619/694/626
-f 630/710/640 599/695/627 629/675/611
-f 607/656/600 638/677/612 639/696/628
-f 585/697/629 616/713/643 617/698/630
-f 628/715/645 597/674/610 627/678/613
-f 605/679/614 636/717/647 637/700/631
-f 594/681/616 625/719/649 626/701/632
-f 614/664/601 645/683/618 646/702/633
-f 603/684/619 634/722/652 635/680/615
-f 592/665/602 623/687/621 624/703/617
-f 612/666/603 643/688/622 644/704/634
-f 601/689/604 632/691/623 633/686/620
-f 590/668/605 621/692/624 622/705/635
-f 642/728/658 611/648/593 641/693/625
-f 588/670/607 619/694/626 620/706/636
-f 599/695/627 630/710/640 631/707/637
-f 640/671/608 671/731/661 672/708/638
-f 618/672/609 649/732/662 650/709/639
-f 661/743/672 630/710/640 660/711/641
-f 638/677/612 669/764/663 670/712/642
-f 616/713/643 647/766/693 648/714/644
-f 659/747/676 628/715/645 658/716/646
-f 636/717/647 667/752/681 668/718/648
-f 657/750/679 626/701/632 656/720/650
-f 645/683/618 676/735/664 677/721/651
-f 634/722/652 665/757/685 666/723/653
-f 623/687/621 654/736/665 655/724/654
-f 643/688/622 674/737/666 675/725/655
-f 632/691/623 663/738/667 664/726/656
-f 621/692/624 652/739/668 653/727/657
-f 673/740/669 642/728/658 672/708/638
-f 619/694/626 650/709/639 651/729/659
-f 630/710/640 661/743/672 662/730/660
-f 639/696/628 670/712/642 671/731/661
-f 617/698/630 648/714/644 649/732/662
-f 628/715/645 659/747/676 660/711/641
-f 637/700/631 668/718/648 669/734/663
-f 626/701/632 657/750/679 658/716/646
-f 667/752/681 636/717/647 666/723/653
-f 624/682/617 655/754/654 656/720/650
-f 644/704/634 675/725/655 676/735/664
-f 665/757/685 634/722/652 664/726/656
-f 622/705/635 653/727/657 654/736/665
-f 642/728/658 673/740/669 674/737/666
-f 631/707/637 662/730/660 663/738/667
-f 620/706/636 651/729/659 652/739/668
-f 704/774/700 673/740/669 703/741/670
-f 650/709/639 681/763/691 682/742/671
-f 693/776/702 662/730/660 692/744/673
-f 670/712/642 701/765/692 702/745/674
-f 648/714/644 679/767/694 680/746/675
-f 659/747/676 690/786/711 691/748/677
-f 668/718/648 699/768/695 700/749/678
-f 657/750/679 688/790/715 689/751/680
-f 698/788/713 667/752/681 697/753/682
-f 655/754/654 686/771/697 687/755/683
-f 675/725/655 706/772/698 707/756/684
-f 696/793/718 665/757/685 695/758/686
-f 653/727/657 684/773/699 685/759/687
-f 673/740/669 704/774/700 705/760/688
-f 662/730/660 693/776/702 694/761/689
-f 651/729/659 682/742/671 683/762/690
-f 671/731/661 702/745/674 703/741/670
-f 649/732/662 680/746/675 681/763/691
-f 660/711/641 691/748/677 692/744/673
-f 669/764/663 700/782/678 701/765/692
-f 647/766/693 678/784/709 679/767/694
-f 690/786/711 659/747/676 689/751/680
-f 667/752/681 698/788/713 699/768/695
-f 688/790/715 657/750/679 687/755/683
-f 676/735/664 707/756/684 708/769/696
-f 665/757/685 696/793/718 697/753/682
-f 654/770/665 685/795/687 686/771/697
-f 674/737/666 705/760/688 706/772/698
-f 663/738/667 694/761/689 695/758/686
-f 652/739/668 683/762/690 684/773/699
-f 704/774/700 735/811/735 736/775/701
-f 693/776/702 724/814/738 725/777/703
-f 682/742/671 713/800/724 714/778/704
-f 702/745/674 733/802/726 734/779/705
-f 680/746/675 711/803/727 712/780/706
-f 723/801/725 692/744/673 722/781/707
-f 700/782/678 731/832/728 732/783/708
-f 678/784/709 709/834/757 710/785/710
-f 721/818/742 690/786/711 720/787/712
-f 698/788/713 729/823/747 730/789/714
-f 719/821/745 688/790/715 718/791/716
-f 707/756/684 738/805/729 739/792/717
-f 696/793/718 727/806/730 728/794/719
-f 685/795/687 716/838/731 717/796/720
-f 705/760/688 736/775/701 737/797/721
-f 694/761/689 725/777/703 726/798/722
-f 683/762/690 714/778/704 715/799/723
-f 735/811/735 704/774/700 734/779/705
-f 681/763/691 712/780/706 713/800/724
-f 724/814/738 693/776/702 723/801/725
-f 701/765/692 732/783/708 733/802/726
-f 679/767/694 710/785/710 711/803/727
-f 690/786/711 721/818/742 722/781/707
-f 699/768/695 730/789/714 731/804/728
-f 688/790/715 719/821/745 720/787/712
-f 729/823/747 698/788/713 728/794/719
-f 686/771/697 717/796/720 718/791/716
-f 706/772/698 737/797/721 738/805/729
-f 695/758/686 726/798/722 727/806/730
-f 684/773/699 715/799/723 716/807/731
-f 736/775/701 767/828/752 768/808/732
-f 725/777/703 756/829/753 757/809/733
-f 746/843/765 715/799/723 745/810/734
-f 734/779/705 765/830/754 766/812/736
-f 712/780/706 743/831/755 744/813/737
-f 723/801/725 754/850/772 755/815/739
-f 732/783/708 763/833/756 764/816/740
-f 710/785/710 741/835/758 742/817/741
-f 721/818/742 752/856/777 753/819/743
-f 730/789/714 761/836/759 762/820/744
-f 719/821/745 750/860/781 751/822/746
-f 760/858/779 729/823/747 759/824/748
-f 717/796/720 748/839/761 749/825/749
-f 737/797/721 768/808/732 769/826/750
-f 758/841/763 727/806/730 757/809/733
-f 715/799/723 746/843/765 747/827/751
-f 735/811/735 766/812/736 767/828/752
-f 724/814/738 755/815/739 756/829/753
-f 713/800/724 744/813/737 745/810/734
-f 733/802/726 764/816/740 765/830/754
-f 711/803/727 742/817/741 743/831/755
-f 754/850/772 723/801/725 753/819/743
-f 731/832/728 762/2183/744 763/833/756
-f 709/834/757 740/854/775 741/835/758
-f 752/856/777 721/818/742 751/822/746
-f 729/823/747 760/858/779 761/836/759
-f 750/860/781 719/821/745 749/825/749
-f 738/805/729 769/826/750 770/837/760
-f 727/806/730 758/841/763 759/824/748
-f 716/838/731 747/864/751 748/839/761
-f 768/808/732 799/866/786 800/840/762
-f 789/874/794 758/841/763 788/842/764
-f 746/843/765 777/880/799 778/844/766
-f 766/812/736 797/867/787 798/845/767
-f 755/815/739 786/869/789 787/846/768
-f 744/813/737 775/868/788 776/847/769
-f 764/816/740 795/870/790 796/848/770
-f 742/817/741 773/871/791 774/849/771
-f 785/884/803 754/850/772 784/851/773
-f 762/820/744 793/872/792 794/853/774
-f 740/854/775 771/903/821 772/855/776
-f 783/889/807 752/856/777 782/857/778
-f 760/858/779 791/894/812 792/859/780
-f 781/892/810 750/860/781 780/861/782
-f 769/826/750 800/840/762 801/862/783
-f 758/841/763 789/874/794 790/863/784
-f 747/864/751 778/876/766 779/865/785
-f 767/828/752 798/845/767 799/866/786
-f 756/829/753 787/846/768 788/842/764
-f 777/880/799 746/843/765 776/847/769
-f 765/830/754 796/848/770 797/867/787
-f 743/831/755 774/849/771 775/868/788
-f 754/850/772 785/884/803 786/869/789
-f 763/833/756 794/886/774 795/870/790
-f 741/835/758 772/855/776 773/871/791
-f 752/856/777 783/889/807 784/851/773
-f 761/836/759 792/859/780 793/872/792
-f 750/860/781 781/892/810 782/857/778
-f 791/894/812 760/858/779 790/863/784
-f 748/839/761 779/865/785 780/861/782
-f 800/840/762 831/896/814 832/873/793
-f 789/874/794 820/910/828 821/875/795
-f 778/876/766 809/929/815 810/877/796
-f 798/845/767 829/898/816 830/878/797
-f 787/846/768 818/899/817 819/879/798
-f 808/912/830 777/880/799 807/881/800
-f 796/848/770 827/900/818 828/882/801
-f 774/849/771 805/901/819 806/883/802
-f 785/884/803 816/919/837 817/885/804
-f 794/886/774 825/935/820 826/887/805
-f 772/855/776 803/904/822 804/888/806
-f 783/889/807 814/924/842 815/890/808
-f 792/859/780 823/905/823 824/891/809
-f 781/892/810 812/927/845 813/893/811
-f 822/906/824 791/894/812 821/875/795
-f 779/865/785 810/877/796 811/895/813
-f 799/866/786 830/878/797 831/896/814
-f 820/910/828 789/874/794 819/879/798
-f 777/880/799 808/912/830 809/897/815
-f 797/867/787 828/882/801 829/898/816
-f 786/869/789 817/885/804 818/899/817
-f 775/868/788 806/883/802 807/881/800
-f 795/870/790 826/887/805 827/900/818
-f 773/871/791 804/888/806 805/901/819
-f 816/919/837 785/884/803 815/890/808
-f 793/872/792 824/891/809 825/902/820
-f 771/903/821 802/922/840 803/904/822
-f 814/924/842 783/889/807 813/893/811
-f 791/894/812 822/906/824 823/905/823
-f 812/927/845 781/892/810 811/895/813
-f 853/939/855 822/906/824 852/907/825
-f 810/877/796 841/930/847 842/908/826
-f 830/878/797 861/931/848 862/909/827
-f 851/944/860 820/910/828 850/911/829
-f 808/912/830 839/950/865 840/913/831
-f 828/882/801 859/932/849 860/914/832
-f 817/885/804 848/954/869 849/915/833
-f 806/883/802 837/933/850 838/916/834
-f 826/887/805 857/936/852 858/917/835
-f 804/888/806 835/937/853 836/918/836
-f 847/934/851 816/919/837 846/920/838
-f 824/891/809 855/938/854 856/921/839
-f 802/922/840 833/971/885 834/923/841
-f 845/959/873 814/924/842 844/925/843
-f 822/906/824 853/939/855 854/926/844
-f 843/941/857 812/927/845 842/908/826
-f 831/896/814 862/909/827 863/928/846
-f 820/910/828 851/944/860 852/907/825
-f 809/929/815 840/946/831 841/930/847
-f 829/898/816 860/914/832 861/931/848
-f 818/899/817 849/915/833 850/911/829
-f 839/950/865 808/912/830 838/916/834
-f 827/900/818 858/917/835 859/932/849
-f 805/901/819 836/918/836 837/933/850
-f 848/954/869 817/885/804 847/934/851
-f 825/935/820 856/956/839 857/936/852
-f 803/904/822 834/923/841 835/937/853
-f 814/924/842 845/959/873 846/920/838
-f 823/905/823 854/926/844 855/938/854
-f 812/927/845 843/941/857 844/925/843
-f 853/939/855 884/976/890 885/940/856
-f 874/974/888 843/941/857 873/942/858
-f 862/909/827 893/963/877 894/943/859
-f 851/944/860 882/980/894 883/945/861
-f 840/946/831 871/996/878 872/947/862
-f 860/914/832 891/965/879 892/948/863
-f 849/915/833 880/966/880 881/949/864
-f 838/916/834 869/967/881 870/951/866
-f 858/917/835 889/968/882 890/952/867
-f 836/918/836 867/969/883 868/953/868
-f 879/984/898 848/954/869 878/955/870
-f 856/956/839 887/1002/884 888/957/871
-f 834/923/841 865/972/886 866/958/872
-f 845/959/873 876/993/907 877/960/874
-f 854/926/844 885/940/856 886/961/875
-f 843/941/857 874/974/888 875/962/876
-f 884/976/890 853/939/855 883/945/861
-f 841/930/847 872/947/862 873/942/858
-f 861/931/848 892/948/863 893/963/877
-f 882/980/894 851/944/860 881/949/864
-f 839/950/865 870/951/866 871/964/878
-f 859/932/849 890/952/867 891/965/879
-f 848/954/869 879/984/898 880/966/880
-f 837/933/850 868/953/868 869/967/881
-f 857/936/852 888/957/871 889/968/882
-f 835/937/853 866/958/872 867/969/883
-f 878/955/870 847/934/851 877/960/874
-f 855/938/854 886/961/875 887/970/884
-f 833/971/885 864/991/905 865/972/886
-f 876/993/907 845/959/873 875/962/876
-f 885/940/856 916/994/908 917/973/887
-f 874/974/888 905/1012/924 906/975/889
-f 915/1010/922 884/976/890 914/977/891
-f 872/947/862 903/997/910 904/978/892
-f 892/948/863 923/998/911 924/979/893
-f 913/1015/927 882/980/894 912/981/895
-f 870/951/866 901/999/912 902/982/896
-f 890/952/867 921/1022/933 922/983/897
-f 879/984/898 910/1025/936 911/985/899
-f 868/953/868 899/1000/913 900/986/900
-f 888/957/871 919/1003/915 920/987/901
-f 866/958/872 897/1004/916 898/988/902
-f 909/1001/914 878/955/870 908/989/903
-f 886/961/875 917/973/887 918/990/904
-f 864/991/905 895/1006/918 896/992/906
-f 907/1008/920 876/993/907 906/975/889
-f 884/976/890 915/1010/922 916/994/908
-f 905/1012/924 874/974/888 904/978/892
-f 893/963/877 924/979/893 925/995/909
-f 882/980/894 913/1015/927 914/977/891
-f 871/996/878 902/1017/896 903/997/910
-f 891/965/879 922/983/897 923/998/911
-f 880/966/880 911/985/899 912/981/895
-f 869/967/881 900/986/900 901/999/912
-f 921/1022/933 890/952/867 920/987/901
-f 867/969/883 898/988/902 899/1000/913
-f 910/1025/936 879/984/898 909/1001/914
-f 887/1002/884 918/1027/904 919/1003/915
-f 865/972/886 896/992/906 897/1004/916
-f 876/993/907 907/1008/920 908/989/903
-f 949/2184/946 918/990/904 948/1005/917
-f 895/1006/918 926/1061/969 927/1007/919
-f 938/1039/949 907/1008/920 937/1009/921
-f 915/1010/922 946/1044/954 947/1011/923
-f 936/1042/952 905/1012/924 935/1013/925
-f 924/979/893 955/1031/941 956/1014/926
-f 913/1015/927 944/1048/958 945/1016/928
-f 902/1017/896 933/1065/942 934/1018/929
-f 922/983/897 953/1033/943 954/1019/930
-f 911/985/899 942/1034/944 943/1020/931
-f 932/1050/960 901/999/912 931/1021/932
-f 952/1052/962 921/1022/933 951/1023/934
-f 898/988/902 929/1035/945 930/1024/935
-f 941/1054/964 910/1025/936 940/1026/937
-f 918/1027/904 949/1036/946 950/1028/938
-f 896/992/906 927/1007/919 928/1029/939
-f 907/1008/920 938/1039/949 939/1030/940
-f 916/994/908 947/1011/923 948/1005/917
-f 905/1012/924 936/1042/952 937/1009/921
-f 946/1044/954 915/1010/922 945/1016/928
-f 903/997/910 934/1018/929 935/1013/925
-f 923/998/911 954/1019/930 955/1031/941
-f 944/1048/958 913/1015/927 943/1020/931
-f 901/999/912 932/1050/960 933/1032/942
-f 921/1022/933 952/1052/962 953/1033/943
-f 910/1025/936 941/1054/964 942/1034/944
-f 899/1000/913 930/1024/935 931/1021/932
-f 919/1003/915 950/1028/938 951/1023/934
-f 897/1004/916 928/1029/939 929/1035/945
-f 940/1026/937 909/1001/914 939/1030/940
-f 949/1036/946 980/1074/981 981/1037/947
-f 927/1007/919 958/1062/970 959/1038/948
-f 938/1039/949 969/1078/985 970/1040/950
-f 947/1011/923 978/1063/971 979/1041/951
-f 936/1042/952 967/1082/989 968/1043/953
-f 977/1080/987 946/1044/954 976/1045/955
-f 934/1018/929 965/1066/973 966/1046/956
-f 954/1019/930 985/1067/974 986/1047/957
-f 975/1085/992 944/1048/958 974/1049/959
-f 932/1050/960 963/1091/997 964/1051/961
-f 952/1052/962 983/1068/975 984/1053/963
-f 941/1054/964 972/1094/1000 973/1055/965
-f 930/1024/935 961/1069/976 962/1056/966
-f 950/1028/938 981/1037/947 982/1057/967
-f 928/1029/939 959/1038/948 960/1058/968
-f 971/1070/977 940/1026/937 970/1040/950
-f 980/1074/981 949/1036/946 979/1060/951
-f 926/1061/969 957/1076/983 958/1062/970
-f 969/1078/985 938/1039/949 968/1043/953
-f 946/1044/954 977/1080/987 978/1063/971
-f 967/1082/989 936/1042/952 966/1046/956
-f 955/1031/941 986/1047/957 987/1064/972
-f 944/1048/958 975/1085/992 976/1045/955
-f 933/1065/942 964/1087/961 965/1066/973
-f 953/1033/943 984/1053/963 985/1067/974
-f 942/1034/944 973/1055/965 974/1049/959
-f 963/1091/997 932/1050/960 962/1056/966
-f 951/1023/934 982/1057/967 983/1068/975
-f 929/1035/945 960/1058/968 961/1069/976
-f 972/1094/1000 941/1054/964 971/1070/977
-f 981/1037/947 1012/1096/1002 1013/1071/978
-f 959/1038/948 990/1097/1003 991/1072/979
-f 1002/1095/1001 971/1070/977 1001/1073/980
-f 1011/1103/1008 980/1074/981 1010/1075/982
-f 957/1076/983 988/1127/1031 989/1077/984
-f 1000/1106/1011 969/1078/985 999/1079/986
-f 977/1080/987 1008/1111/1016 1009/1081/988
-f 998/1109/1014 967/1082/989 997/1083/990
-f 986/1047/957 1017/1099/1004 1018/1084/991
-f 975/1085/992 1006/1115/1020 1007/1086/993
-f 964/1087/961 995/2185/1005 996/1088/994
-f 984/1053/963 1015/1101/1006 1016/1089/995
-f 973/1055/965 1004/1102/1007 1005/1090/996
-f 994/1117/1022 963/1091/997 993/1092/998
-f 1014/1119/1024 983/1068/975 1013/1071/978
-f 960/1058/968 991/1072/979 992/1093/999
-f 1003/1121/1026 972/1094/1000 1002/1095/1001
-f 980/1074/981 1011/1103/1008 1012/1096/1002
-f 958/1062/970 989/1077/984 990/1097/1003
-f 969/1078/985 1000/1106/1011 1001/1073/980
-f 978/1063/971 1009/1081/988 1010/1098/982
-f 967/1082/989 998/1109/1014 999/1079/986
-f 1008/1111/1016 977/1080/987 1007/1086/993
-f 965/1066/973 996/1088/994 997/1083/990
-f 985/1067/974 1016/1089/995 1017/1099/1004
-f 1006/1115/1020 975/1085/992 1005/1090/996
-f 963/1091/997 994/1117/1022 995/1100/1005
-f 983/1068/975 1014/1119/1024 1015/1101/1006
-f 972/1094/1000 1003/1121/1026 1004/1102/1007
-f 961/1069/976 992/1093/999 993/1092/998
-f 1011/1103/1008 1042/1140/1043 1043/1104/1009
-f 989/1077/984 1020/1128/1032 1021/1105/1010
-f 1000/1106/1011 1031/1144/1047 1032/1107/1012
-f 1009/1081/988 1040/1129/1033 1041/1108/1013
-f 998/1109/1014 1029/1148/1051 1030/1110/1015
-f 1039/1146/1049 1008/1111/1016 1038/1112/1017
-f 996/1088/994 1027/1164/1035 1028/1113/1018
-f 1016/1089/995 1047/1133/1036 1048/1114/1019
-f 1037/1151/1054 1006/1115/1020 1036/1116/1021
-f 994/1117/1022 1025/1156/1059 1026/1118/1023
-f 1014/1119/1024 1045/1134/1037 1046/1120/1025
-f 1003/1121/1026 1034/1159/1062 1035/1122/1027
-f 992/1093/999 1023/1135/1038 1024/1123/1028
-f 1012/1096/1002 1043/1104/1009 1044/1124/1029
-f 990/1097/1003 1021/1105/1010 1022/1125/1030
-f 1033/1136/1039 1002/1095/1001 1032/1107/1012
-f 1042/1140/1043 1011/1103/1008 1041/1126/1013
-f 988/1127/1031 1019/1142/1045 1020/1128/1032
-f 1031/1144/1047 1000/1106/1011 1030/1110/1015
-f 1008/1111/1016 1039/1146/1049 1040/1129/1033
-f 1029/1148/1051 998/1109/1014 1028/1113/1018
-f 1017/1099/1004 1048/1114/1019 1049/1130/1034
-f 1006/1115/1020 1037/1151/1054 1038/1112/1017
-f 995/1100/1005 1026/1118/1023 1027/1132/1035
-f 1015/1101/1006 1046/1120/1025 1047/1133/1036
-f 1004/1102/1007 1035/1122/1027 1036/1116/1021
-f 1025/1156/1059 994/1117/1022 1024/1123/1028
-f 1013/1071/978 1044/1124/1029 1045/1134/1037
-f 991/1072/979 1022/1125/1030 1023/1135/1038
-f 1034/1159/1062 1003/1121/1026 1033/1136/1039
-f 1043/1104/1009 1074/1161/1064 1075/1137/1040
-f 1021/1105/1010 1052/1162/1065 1053/1138/1041
-f 1064/1160/1063 1033/1136/1039 1063/1139/1042
-f 1041/1126/1013 1072/1200/1066 1073/1141/1044
-f 1019/1142/1045 1050/1202/1095 1051/1143/1046
-f 1062/1176/1078 1031/1144/1047 1061/1145/1048
-f 1039/1146/1049 1070/2186/1083 1071/1147/1050
-f 1060/1181/1081 1029/1148/1051 1059/1149/1052
-f 1048/1114/1019 1079/1165/1067 1080/1150/1053
-f 1037/1151/1054 1068/2187/1087 1069/1152/1055
-f 1026/1118/1023 1057/1166/1068 1058/1153/1056
-f 1046/1120/1025 1077/1167/1069 1078/1154/1057
-f 1035/1122/1027 1066/1168/1070 1067/1155/1058
-f 1056/1192/1089 1025/1156/1059 1055/1157/1060
-f 1076/1169/1071 1045/1134/1037 1075/1137/1040
-f 1022/1125/1030 1053/1138/1041 1054/1158/1061
-f 1065/1172/1074 1034/1159/1062 1064/1160/1063
-f 1042/1140/1043 1073/1141/1044 1074/1161/1064
-f 1020/1128/1032 1051/1143/1046 1052/1162/1065
-f 1031/1144/1047 1062/1176/1078 1063/1139/1042
-f 1040/1129/1033 1071/1147/1050 1072/1163/1066
-f 1029/1148/1051 1060/1181/1081 1061/1145/1048
-f 1070/2186/1083 1039/1146/1049 1069/1152/1055
-f 1027/1164/1035 1058/2188/1056 1059/1149/1052
-f 1047/1133/1036 1078/1154/1057 1079/1165/1067
-f 1068/2187/1087 1037/1151/1054 1067/1155/1058
-f 1025/1156/1059 1056/1192/1089 1057/1166/1068
-f 1045/1134/1037 1076/1169/1071 1077/1167/1069
-f 1034/1159/1062 1065/1172/1074 1066/1168/1070
-f 1023/1135/1038 1054/1158/1061 1055/1157/1060
-f 1107/1209/1101 1076/1169/1071 1106/1170/1072
-f 1053/1138/1041 1084/1199/1094 1085/1171/1073
-f 1096/2189/1103 1065/1172/1074 1095/1173/1075
-f 1073/1141/1044 1104/1219/1109 1105/1174/1076
-f 1051/1143/1046 1082/1203/1096 1083/1175/1077
-f 1062/1176/1078 1093/2190/1113 1094/1177/1079
-f 1071/1179/1050 1102/1204/1097 1103/1180/1080
-f 1060/1181/1081 1091/2191/1117 1092/1182/1082
-f 1101/1226/1115 1070/1183/1083 1100/1185/1084
-f 1058/1153/1056 1089/1207/1099 1090/1187/1085
-f 1078/1154/1057 1109/1208/1100 1110/1188/1086
-f 1099/1232/1120 1068/1189/1087 1098/1191/1088
-f 1056/1192/1089 1087/1237/1125 1088/1193/1090
-f 1076/1169/1071 1107/1209/1101 1108/1194/1091
-f 1065/1196/1074 1096/1211/1103 1097/1197/1092
-f 1054/1158/1061 1085/1171/1073 1086/1198/1093
-f 1074/1161/1064 1105/1174/1076 1106/1170/1072
-f 1052/1162/1065 1083/1175/1077 1084/1199/1094
-f 1095/1173/1075 1064/1160/1063 1094/1177/1079
-f 1104/1219/1109 1073/1141/1044 1103/1201/1080
-f 1050/1202/1095 1081/1221/1111 1082/1203/1096
-f 1093/2190/1113 1062/1176/1078 1092/1182/1082
-f 1070/1183/1083 1101/1226/1115 1102/1204/1097
-f 1091/2191/1117 1060/1181/1081 1090/1205/1085
-f 1079/1165/1067 1110/1188/1086 1111/1206/1098
-f 1068/1189/1087 1099/1232/1120 1100/1185/1084
-f 1057/1166/1068 1088/1193/1090 1089/1207/1099
-f 1077/1167/1069 1108/1194/1091 1109/1208/1100
-f 1066/1195/1070 1097/1197/1092 1098/1191/1088
-f 1087/1237/1125 1056/1192/1089 1086/1198/1093
-f 1107/1209/1101 1138/1250/1136 1139/1210/1102
-f 1096/1211/1103 1127/1239/1127 1128/1212/1104
-f 1085/1171/1073 1116/1238/1126 1117/1213/1105
-f 1105/1174/1076 1136/1240/1128 1137/1214/1106
-f 1083/1175/1077 1114/1241/1129 1115/1215/1107
-f 1126/1253/1139 1095/1216/1075 1125/1218/1108
-f 1135/1255/1141 1104/1219/1109 1134/1220/1110
-f 1081/1221/1111 1112/1274/1158 1113/1222/1112
-f 1124/1258/1144 1093/1223/1113 1123/1225/1114
-f 1101/1226/1115 1132/1263/1149 1133/1227/1116
-f 1122/1261/1147 1091/1228/1117 1121/1230/1118
-f 1110/1188/1086 1141/1244/1130 1142/1231/1119
-f 1099/1232/1120 1130/1268/1153 1131/1233/1121
-f 1088/1193/1090 1119/1245/1131 1120/1234/1122
-f 1108/1194/1091 1139/1210/1102 1140/1235/1123
-f 1097/1197/1092 1128/1212/1104 1129/1236/1124
-f 1118/1248/1134 1087/1237/1125 1117/1213/1105
-f 1138/1250/1136 1107/1209/1101 1137/1214/1106
-f 1084/1199/1094 1115/1215/1107 1116/1238/1126
-f 1095/1216/1075 1126/1253/1139 1127/1239/1127
-f 1104/1219/1109 1135/1255/1141 1136/1240/1128
-f 1082/1203/1096 1113/1222/1112 1114/1241/1129
-f 1093/1223/1113 1124/1258/1144 1125/1218/1108
-f 1102/1204/1097 1133/1227/1116 1134/1242/1110
-f 1091/1228/1117 1122/1261/1147 1123/1225/1114
-f 1132/1263/1149 1101/1226/1115 1131/1233/1121
-f 1089/1207/1099 1120/1234/1122 1121/1243/1118
-f 1109/1208/1100 1140/1235/1123 1141/1244/1130
-f 1130/1268/1153 1099/1232/1120 1129/1236/1124
-f 1087/1237/1125 1118/1248/1134 1119/1245/1131
-f 1139/1210/1102 1170/1270/1155 1171/1246/1132
-f 1128/1212/1104 1159/1271/1156 1160/1247/1133
-f 1149/1282/1166 1118/1248/1134 1148/1249/1135
-f 1169/1284/1168 1138/1250/1136 1168/1251/1137
-f 1115/1215/1107 1146/1272/1157 1147/1252/1138
-f 1158/1286/1170 1127/1239/1127 1157/1254/1140
-f 1135/1255/1141 1166/1308/1176 1167/1256/1142
-f 1113/1222/1112 1144/1275/1159 1145/1257/1143
-f 1124/1258/1144 1155/1296/1180 1156/1259/1145
-f 1133/1227/1116 1164/1276/1160 1165/1260/1146
-f 1122/1261/1147 1153/1300/1184 1154/1262/1148
-f 1163/1298/1182 1132/1263/1149 1162/1264/1150
-f 1120/1265/1122 1151/1312/1162 1152/1266/1151
-f 1140/1235/1123 1171/1246/1132 1172/1267/1152
-f 1161/1280/1164 1130/1268/1153 1160/1247/1133
-f 1118/1248/1134 1149/1282/1166 1150/1269/1154
-f 1138/1250/1136 1169/1284/1168 1170/1270/1155
-f 1127/1239/1127 1158/1286/1170 1159/1271/1156
-f 1116/1238/1126 1147/1252/1138 1148/1249/1135
-f 1136/1240/1128 1167/1256/1142 1168/1251/1137
-f 1114/1241/1129 1145/1257/1143 1146/1272/1157
-f 1157/1254/1140 1126/1253/1139 1156/1259/1145
-f 1166/1308/1176 1135/1255/1141 1165/1273/1146
-f 1112/1274/1158 1143/1294/1178 1144/1275/1159
-f 1155/1296/1180 1124/1258/1144 1154/1262/1148
-f 1132/1263/1149 1163/1298/1182 1164/1276/1160
-f 1153/1300/1184 1122/1261/1147 1152/1266/1151
-f 1141/1244/1130 1172/1267/1152 1173/1277/1161
-f 1130/1268/1153 1161/1280/1164 1162/1264/1150
-f 1119/1245/1131 1150/1269/1154 1151/1278/1162
-f 1171/1246/1132 1202/1305/1189 1203/1279/1163
-f 1192/1314/1196 1161/1280/1164 1191/1281/1165
-f 1149/1282/1166 1180/1319/1201 1181/1283/1167
-f 1169/1284/1168 1200/1321/1203 1201/1285/1169
-f 1158/1286/1170 1189/1324/1206 1190/1287/1171
-f 1147/1252/1138 1178/1306/1190 1179/1288/1172
-f 1167/1256/1142 1198/1309/1192 1199/1289/1173
-f 1145/1257/1143 1176/1310/1193 1177/1290/1174
-f 1188/1307/1191 1157/1254/1140 1187/1291/1175
-f 1165/1260/1146 1196/1311/1194 1197/1293/1177
-f 1143/1294/1178 1174/1344/1223 1175/1295/1179
-f 1186/1329/1210 1155/1296/1180 1185/1297/1181
-f 1163/1298/1182 1194/1334/1215 1195/1299/1183
-f 1184/1332/1213 1153/1300/1184 1183/1301/1185
-f 1172/1267/1152 1203/1279/1163 1204/1302/1186
-f 1161/1280/1164 1192/1314/1196 1193/1303/1187
-f 1150/1269/1154 1181/1283/1167 1182/1304/1188
-f 1170/1270/1155 1201/1285/1169 1202/1305/1189
-f 1159/1271/1156 1190/1287/1171 1191/1281/1165
-f 1180/1319/1201 1149/1282/1166 1179/1288/1172
-f 1200/1321/1203 1169/1284/1168 1199/1289/1173
-f 1146/1272/1157 1177/1290/1174 1178/1306/1190
-f 1189/1324/1206 1158/1286/1170 1188/1307/1191
-f 1166/1308/1176 1197/1326/1177 1198/1309/1192
-f 1144/1275/1159 1175/1295/1179 1176/1310/1193
-f 1155/1296/1180 1186/1329/1210 1187/1291/1175
-f 1164/1276/1160 1195/1299/1183 1196/1311/1194
-f 1153/1300/1184 1184/1332/1213 1185/1297/1181
-f 1194/1334/1215 1163/1298/1182 1193/1303/1187
-f 1151/1312/1162 1182/1335/1188 1183/1301/1185
-f 1203/1279/1163 1234/1337/1217 1235/1313/1195
-f 1192/1314/1196 1223/1352/1230 1224/1315/1197
-f 1181/1283/1167 1212/1338/1218 1213/1316/1198
-f 1201/1285/1169 1232/1339/1219 1233/1317/1199
-f 1190/1287/1171 1221/1340/1220 1222/1318/1200
-f 1211/1354/1232 1180/1319/1201 1210/1320/1202
-f 1199/1289/1173 1230/1341/1221 1231/1322/1204
-f 1177/1290/1174 1208/1342/1222 1209/1323/1205
-f 1220/1357/1235 1189/1324/1206 1219/1325/1207
-f 1229/1360/1238 1198/1309/1192 1228/1327/1208
-f 1175/1295/1179 1206/1345/1224 1207/1328/1209
-f 1186/1329/1210 1217/1367/1245 1218/1330/1211
-f 1195/1299/1183 1226/1346/1225 1227/1331/1212
-f 1184/1332/1213 1215/1370/1248 1216/1333/1214
-f 1225/1347/1226 1194/1334/1215 1224/1315/1197
-f 1182/1335/1188 1213/1349/1198 1214/1336/1216
-f 1202/1305/1189 1233/1317/1199 1234/1337/1217
-f 1223/1352/1230 1192/1314/1196 1222/1318/1200
-f 1180/1319/1201 1211/1354/1232 1212/1338/1218
-f 1200/1321/1203 1231/1322/1204 1232/1339/1219
-f 1189/1324/1206 1220/1357/1235 1221/1340/1220
-f 1178/1306/1190 1209/1323/1205 1210/1320/1202
-f 1198/1309/1192 1229/1360/1238 1230/1341/1221
-f 1176/1310/1193 1207/1328/1209 1208/1342/1222
-f 1187/1291/1175 1218/1330/1211 1219/1325/1207
-f 1196/1311/1194 1227/1331/1212 1228/1343/1208
-f 1174/1344/1223 1205/1365/1243 1206/1345/1224
-f 1217/1367/1245 1186/1329/1210 1216/1333/1214
-f 1194/1334/1215 1225/1347/1226 1226/1346/1225
-f 1215/1370/1248 1184/1332/1213 1214/1336/1216
-f 1256/1379/1257 1225/1347/1226 1255/1348/1227
-f 1213/1349/1198 1244/1386/1250 1245/1350/1228
-f 1233/1317/1199 1264/1373/1251 1265/1351/1229
-f 1254/1384/1262 1223/1352/1230 1253/1353/1231
-f 1211/1354/1232 1242/1391/1267 1243/1355/1233
-f 1231/1322/1204 1262/1393/1269 1263/1356/1234
-f 1220/1357/1235 1251/1396/1272 1252/1358/1236
-f 1209/1323/1205 1240/1374/1252 1241/1359/1237
-f 1229/1360/1238 1260/1375/1253 1261/1361/1239
-f 1207/1328/1209 1238/1376/1254 1239/1362/1240
-f 1218/1330/1211 1249/1377/1255 1250/1363/1241
-f 1227/1331/1212 1258/1378/1256 1259/1364/1242
-f 1205/1365/1243 1236/1411/1286 1237/1366/1244
-f 1248/1401/1276 1217/1367/1245 1247/1368/1246
-f 1225/1347/1226 1256/1379/1257 1257/1369/1247
-f 1246/1381/1259 1215/1370/1248 1245/1350/1228
-f 1234/1337/1217 1265/1351/1229 1266/1371/1249
-f 1223/1352/1230 1254/1384/1262 1255/1348/1227
-f 1212/1338/1218 1243/1355/1233 1244/1372/1250
-f 1232/1339/1219 1263/1356/1234 1264/1373/1251
-f 1221/1340/1220 1252/1358/1236 1253/1353/1231
-f 1242/1391/1267 1211/1354/1232 1241/1359/1237
-f 1262/1393/1269 1231/1322/1204 1261/1361/1239
-f 1208/1342/1222 1239/1362/1240 1240/1374/1252
-f 1251/1396/1272 1220/1357/1235 1250/1363/1241
-f 1228/1327/1208 1259/1398/1242 1260/1375/1253
-f 1206/1345/1224 1237/1366/1244 1238/1376/1254
-f 1217/1367/1245 1248/1401/1276 1249/1377/1255
-f 1226/1346/1225 1257/1369/1247 1258/1378/1256
-f 1215/1370/1248 1246/1381/1259 1247/1368/1246
-f 1256/1379/1257 1287/1416/1291 1288/1380/1258
-f 1277/1414/1289 1246/1381/1259 1276/1382/1260
-f 1265/1351/1229 1296/1405/1280 1297/1383/1261
-f 1254/1384/1262 1285/1420/1295 1286/1385/1263
-f 1243/1387/1233 1274/1438/1281 1275/1388/1264
-f 1263/1356/1234 1294/1407/1282 1295/1389/1265
-f 1252/1358/1236 1283/1408/1283 1284/1390/1266
-f 1273/1422/1297 1242/1391/1267 1272/1392/1268
-f 1293/1424/1299 1262/1393/1269 1292/1394/1270
-f 1239/1362/1240 1270/1409/1284 1271/1395/1271
-f 1282/1426/1301 1251/1396/1272 1281/1397/1273
-f 1259/1398/1242 1290/1443/1285 1291/1399/1274
-f 1237/1366/1244 1268/1412/1287 1269/1400/1275
-f 1248/1401/1276 1279/1435/1310 1280/1402/1277
-f 1257/1369/1247 1288/1380/1258 1289/1403/1278
-f 1246/1381/1259 1277/1414/1289 1278/1404/1279
-f 1287/1416/1291 1256/1379/1257 1286/1385/1263
-f 1244/1386/1250 1275/1388/1264 1276/1382/1260
-f 1264/1373/1251 1295/1389/1265 1296/1405/1280
-f 1285/1420/1295 1254/1384/1262 1284/1390/1266
-f 1242/1391/1267 1273/1422/1297 1274/1406/1281
-f 1262/1393/1269 1293/1424/1299 1294/1407/1282
-f 1251/1396/1272 1282/1426/1301 1283/1408/1283
-f 1240/1374/1252 1271/1395/1271 1272/1392/1268
-f 1260/1375/1253 1291/1399/1274 1292/1394/1270
-f 1238/1376/1254 1269/1400/1275 1270/1409/1284
-f 1249/1377/1255 1280/1402/1277 1281/1397/1273
-f 1258/1378/1256 1289/1403/1278 1290/1410/1285
-f 1236/1411/1286 1267/1433/1308 1268/1412/1287
-f 1279/1435/1310 1248/1401/1276 1278/1404/1279
-f 1288/1380/1258 1319/1436/1311 1320/1413/1288
-f 1277/1414/1289 1308/1453/1326 1309/1415/1290
-f 1318/1451/1324 1287/1416/1291 1317/1417/1292
-f 1275/1388/1264 1306/1439/1313 1307/1418/1293
-f 1295/1389/1265 1326/1440/1314 1327/1419/1294
-f 1316/1456/1329 1285/1420/1295 1315/1421/1296
-f 1273/1422/1297 1304/1462/1334 1305/1423/1298
-f 1293/1424/1299 1324/1464/1336 1325/1425/1300
-f 1282/1426/1301 1313/1467/1339 1314/1427/1302
-f 1271/1395/1271 1302/1441/1315 1303/1428/1303
-f 1291/1399/1274 1322/1444/1317 1323/1429/1304
-f 1269/1400/1275 1300/1445/1318 1301/1430/1305
-f 1312/1442/1316 1281/1397/1273 1311/1431/1306
-f 1289/1403/1278 1320/1413/1288 1321/1432/1307
-f 1267/1433/1308 1298/1447/1320 1299/1434/1309
-f 1310/1449/1322 1279/1435/1310 1309/1415/1290
-f 1287/1416/1291 1318/1451/1324 1319/1436/1311
-f 1308/1453/1326 1277/1414/1289 1307/1418/1293
-f 1296/1405/1280 1327/1419/1294 1328/1437/1312
-f 1285/1420/1295 1316/1456/1329 1317/1417/1292
-f 1274/1438/1281 1305/1458/1298 1306/1439/1313
-f 1294/1407/1282 1325/1425/1300 1326/1440/1314
-f 1283/1408/1283 1314/1427/1302 1315/1421/1296
-f 1304/1462/1334 1273/1422/1297 1303/1428/1303
-f 1324/1464/1336 1293/1424/1299 1323/1429/1304
-f 1270/1409/1284 1301/1430/1305 1302/1441/1315
-f 1313/1467/1339 1282/1426/1301 1312/1442/1316
-f 1290/1443/1285 1321/1469/1307 1322/1444/1317
-f 1268/1412/1287 1299/1434/1309 1300/1445/1318
-f 1279/1435/1310 1310/1449/1322 1311/1431/1306
-f 1320/1413/1288 1351/1473/1344 1352/1446/1319
-f 1298/1447/1320 1329/1503/1373 1330/1448/1321
-f 1341/1482/1352 1310/1449/1322 1340/1450/1323
-f 1318/1451/1324 1349/1487/1357 1350/1452/1325
-f 1339/1485/1355 1308/1453/1326 1338/1454/1327
-f 1327/1419/1294 1358/1474/1345 1359/1455/1328
-f 1316/1456/1329 1347/1491/1361 1348/1457/1330
-f 1305/1458/1298 1336/1507/1346 1337/1459/1331
-f 1325/1425/1300 1356/1476/1347 1357/1460/1332
-f 1314/1427/1302 1345/1477/1348 1346/1461/1333
-f 1335/1493/1363 1304/1462/1334 1334/1463/1335
-f 1355/1495/1365 1324/1464/1336 1354/1465/1337
-f 1301/1430/1305 1332/1478/1349 1333/1466/1338
-f 1344/1497/1367 1313/1467/1339 1343/1468/1340
-f 1321/1469/1307 1352/1479/1319 1353/1470/1341
-f 1299/1434/1309 1330/1448/1321 1331/1471/1342
-f 1310/1449/1322 1341/1482/1352 1342/1472/1343
-f 1319/1436/1311 1350/1452/1325 1351/1473/1344
-f 1308/1453/1326 1339/1485/1355 1340/1450/1323
-f 1349/1487/1357 1318/1451/1324 1348/1457/1330
-f 1306/1439/1313 1337/1459/1331 1338/1454/1327
-f 1326/1440/1314 1357/1460/1332 1358/1474/1345
-f 1347/1491/1361 1316/1456/1329 1346/1461/1333
-f 1304/1462/1334 1335/1493/1363 1336/1475/1346
-f 1324/1464/1336 1355/1495/1365 1356/1476/1347
-f 1313/1467/1339 1344/1497/1367 1345/1477/1348
-f 1302/1441/1315 1333/1466/1338 1334/1463/1335
-f 1322/1444/1317 1353/1470/1341 1354/1465/1337
-f 1300/1445/1318 1331/1471/1342 1332/1478/1349
-f 1311/1431/1306 1342/1472/1343 1343/1468/1340
-f 1352/1479/1319 1383/1537/1372 1384/1480/1350
-f 1330/1448/1321 1361/1504/1374 1362/1481/1351
-f 1341/1482/1352 1372/1518/1387 1373/1483/1353
-f 1350/1452/1325 1381/1505/1375 1382/1484/1354
-f 1339/1485/1355 1370/1522/1391 1371/1486/1356
-f 1380/1520/1389 1349/1487/1357 1379/1488/1358
-f 1337/1459/1331 1368/1508/1377 1369/1489/1359
-f 1357/1460/1332 1388/1509/1378 1389/1490/1360
-f 1378/1525/1394 1347/1491/1361 1377/1492/1362
-f 1335/1493/1363 1366/1531/1399 1367/1494/1364
-f 1355/1495/1365 1386/1533/1401 1387/1496/1366
-f 1344/1497/1367 1375/1535/1403 1376/1498/1368
-f 1333/1466/1338 1364/1510/1379 1365/1499/1369
-f 1353/1470/1341 1384/1480/1350 1385/1500/1370
-f 1331/1471/1342 1362/1481/1351 1363/1501/1371
-f 1374/1511/1380 1343/1468/1340 1373/1483/1353
-f 1351/1473/1344 1382/1484/1354 1383/1502/1372
-f 1329/1503/1373 1360/1516/1385 1361/1504/1374
-f 1372/1518/1387 1341/1482/1352 1371/1486/1356
-f 1349/1487/1357 1380/1520/1389 1381/1505/1375
-f 1370/1522/1391 1339/1485/1355 1369/1489/1359
-f 1358/1474/1345 1389/1490/1360 1390/1506/1376
-f 1347/1491/1361 1378/1525/1394 1379/1488/1358
-f 1336/1507/1346 1367/1527/1364 1368/1508/1377
-f 1356/1476/1347 1387/1496/1366 1388/1509/1378
-f 1345/1477/1348 1376/1498/1368 1377/1492/1362
-f 1366/1531/1399 1335/1493/1363 1365/1499/1369
-f 1386/1533/1401 1355/1495/1365 1385/1500/1370
-f 1332/1478/1349 1363/1501/1371 1364/1510/1379
-f 1375/1535/1403 1344/1497/1367 1374/1511/1380
-f 1384/1480/1350 1415/1538/1405 1416/1512/1381
-f 1362/1481/1351 1393/1539/1406 1394/1513/1382
-f 1405/1547/1414 1374/1511/1380 1404/1514/1383
-f 1382/1484/1354 1413/1540/1407 1414/1515/1384
-f 1360/1516/1385 1391/1571/1437 1392/1517/1386
-f 1403/1552/1418 1372/1518/1387 1402/1519/1388
-f 1380/1520/1389 1411/1557/1423 1412/1521/1390
-f 1401/1555/1421 1370/1522/1391 1400/1523/1392
-f 1389/1490/1360 1420/1560/1426 1421/1524/1393
-f 1378/1525/1394 1409/1562/1428 1410/1526/1395
-f 1367/1527/1364 1398/2192/1408 1399/1528/1396
-f 1387/1496/1366 1418/1542/1409 1419/1529/1397
-f 1376/1498/1368 1407/1543/1410 1408/1530/1398
-f 1397/1564/1430 1366/1531/1399 1396/1532/1400
-f 1417/1544/1411 1386/1533/1401 1416/1512/1381
-f 1363/1501/1371 1394/1513/1382 1395/1534/1402
-f 1374/1511/1380 1405/1547/1414 1406/1536/1404
-f 1383/1537/1372 1414/1549/1384 1415/1538/1405
-f 1361/1504/1374 1392/1517/1386 1393/1539/1406
-f 1372/1518/1387 1403/1552/1418 1404/1514/1383
-f 1381/1505/1375 1412/1521/1390 1413/1540/1407
-f 1370/1522/1391 1401/1555/1421 1402/1519/1388
-f 1411/1557/1423 1380/1520/1389 1410/1526/1395
-f 1368/1508/1377 1399/1528/1396 1400/1523/1392
-f 1420/1560/1426 1389/1490/1360 1419/1529/1397
-f 1409/1562/1428 1378/1525/1394 1408/1530/1398
-f 1366/1531/1399 1397/1564/1430 1398/1541/1408
-f 1386/1533/1401 1417/1544/1411 1418/1542/1409
-f 1375/1535/1403 1406/1536/1404 1407/1543/1410
-f 1364/1510/1379 1395/1534/1402 1396/1532/1400
-f 1448/1578/1443 1417/1544/1411 1447/1545/1412
-f 1394/1513/1382 1425/1569/1435 1426/1546/1413
-f 1405/1547/1414 1436/1584/1449 1437/1548/1415
-f 1414/1549/1384 1445/1604/1436 1446/1550/1416
-f 1392/1517/1386 1423/1572/1438 1424/1551/1417
-f 1403/1552/1418 1434/1589/1454 1435/1553/1419
-f 1412/1521/1390 1443/1573/1439 1444/1554/1420
-f 1401/1555/1421 1432/1593/1458 1433/1556/1422
-f 1442/1591/1456 1411/1557/1423 1441/1558/1424
-f 1399/1528/1396 1430/1608/1441 1431/1559/1425
-f 1419/1529/1397 1450/1577/1442 1451/1561/1427
-f 1440/1596/1461 1409/1562/1428 1439/1563/1429
-f 1397/1564/1430 1428/1601/1466 1429/1565/1431
-f 1417/1544/1411 1448/1578/1443 1449/1566/1432
-f 1406/1536/1404 1437/1548/1415 1438/1567/1433
-f 1395/1534/1402 1426/1546/1413 1427/1568/1434
-f 1415/1538/1405 1446/1550/1416 1447/1545/1412
-f 1393/1539/1406 1424/1551/1417 1425/1569/1435
-f 1436/1584/1449 1405/1547/1414 1435/1553/1419
-f 1413/1540/1407 1444/1554/1420 1445/1570/1436
-f 1391/1571/1437 1422/1587/1452 1423/1572/1438
-f 1434/1589/1454 1403/1552/1418 1433/1556/1422
-f 1411/1557/1423 1442/1591/1456 1443/1573/1439
-f 1432/1593/1458 1401/1555/1421 1431/1559/1425
-f 1420/1560/1426 1451/1561/1427 1452/1574/1440
-f 1409/1562/1428 1440/1596/1461 1441/1558/1424
-f 1398/1541/1408 1429/1565/1431 1430/1576/1441
-f 1418/1542/1409 1449/1566/1432 1450/1577/1442
-f 1407/1543/1410 1438/1567/1433 1439/1563/1429
-f 1428/1601/1466 1397/1564/1430 1427/1568/1434
-f 1448/1578/1443 1479/1615/1478 1480/1579/1444
-f 1437/1548/1415 1468/1618/1481 1469/1580/1445
-f 1426/1546/1413 1457/1602/1467 1458/1581/1446
-f 1446/1550/1416 1477/1605/1469 1478/1582/1447
-f 1424/1551/1417 1455/1606/1470 1456/1583/1448
-f 1467/1603/1468 1436/1584/1449 1466/1585/1450
-f 1444/1554/1420 1475/1607/1471 1476/1586/1451
-f 1422/1587/1452 1453/1639/1500 1454/1588/1453
-f 1465/1623/1485 1434/1589/1454 1464/1590/1455
-f 1442/1591/1456 1473/1628/1490 1474/1592/1457
-f 1463/1626/1488 1432/1593/1458 1462/1594/1459
-f 1451/1561/1427 1482/1609/1472 1483/1595/1460
-f 1440/1596/1461 1471/1633/1494 1472/1597/1462
-f 1429/1565/1431 1460/1610/1473 1461/1598/1463
-f 1449/1566/1432 1480/1579/1444 1481/1599/1464
-f 1438/1567/1433 1469/1580/1445 1470/1600/1465
-f 1459/1613/1476 1428/1601/1466 1458/1581/1446
-f 1479/1615/1478 1448/1578/1443 1478/1582/1447
-f 1425/1569/1435 1456/1583/1448 1457/1602/1467
-f 1468/1618/1481 1437/1548/1415 1467/1603/1468
-f 1445/1604/1436 1476/1620/1451 1477/1605/1469
-f 1423/1572/1438 1454/1588/1453 1455/1606/1470
-f 1434/1589/1454 1465/1623/1485 1466/1585/1450
-f 1443/1573/1439 1474/1592/1457 1475/1607/1471
-f 1432/1593/1458 1463/1626/1488 1464/1590/1455
-f 1473/1628/1490 1442/1591/1456 1472/1597/1462
-f 1430/1608/1441 1461/1630/1463 1462/1594/1459
-f 1450/1577/1442 1481/1599/1464 1482/1609/1472
-f 1471/1633/1494 1440/1596/1461 1470/1600/1465
-f 1428/1601/1466 1459/1613/1476 1460/1610/1473
-f 1480/1579/1444 1511/1635/1496 1512/1611/1474
-f 1469/1580/1445 1500/1636/1497 1501/1612/1475
-f 1490/1650/1511 1459/1613/1476 1489/1614/1477
-f 1510/1652/1513 1479/1615/1478 1509/1616/1479
-f 1456/1583/1448 1487/1637/1498 1488/1617/1480
-f 1499/1655/1516 1468/1618/1481 1498/1619/1482
-f 1476/1620/1451 1507/1657/1499 1508/1621/1483
-f 1454/1588/1453 1485/1640/1501 1486/1622/1484
-f 1465/1623/1485 1496/1660/1520 1497/1624/1486
-f 1474/1592/1457 1505/1641/1502 1506/1625/1487
-f 1463/1626/1488 1494/1663/1523 1495/1627/1489
-f 1504/1665/1525 1473/1628/1490 1503/1629/1491
-f 1461/1630/1463 1492/1666/1504 1493/1631/1492
-f 1481/1599/1464 1512/1611/1474 1513/1632/1493
-f 1502/1645/1506 1471/1633/1494 1501/1612/1475
-f 1459/1613/1476 1490/1650/1511 1491/1634/1495
-f 1479/1615/1478 1510/1652/1513 1511/1635/1496
-f 1468/1618/1481 1499/1655/1516 1500/1636/1497
-f 1457/1602/1467 1488/1617/1480 1489/1614/1477
-f 1477/1605/1469 1508/1621/1483 1509/1616/1479
-f 1455/1606/1470 1486/1622/1484 1487/1637/1498
-f 1498/1619/1482 1467/1603/1468 1497/1624/1486
-f 1475/1607/1471 1506/1625/1487 1507/1638/1499
-f 1453/1639/1500 1484/1675/1533 1485/1640/1501
-f 1496/1660/1520 1465/1623/1485 1495/1627/1489
-f 1473/1628/1490 1504/1665/1525 1505/1641/1502
-f 1494/1663/1523 1463/1626/1488 1493/1631/1492
-f 1482/1609/1472 1513/1632/1493 1514/1642/1503
-f 1471/1633/1494 1502/1645/1506 1503/1629/1491
-f 1460/1610/1473 1491/1634/1495 1492/1643/1504
-f 1513/1632/1493 1544/1668/1527 1545/1644/1505
-f 1502/1645/1506 1533/1683/1540 1534/1646/1507
-f 1491/1634/1495 1522/1669/1528 1523/1647/1508
-f 1511/1635/1496 1542/1670/1529 1543/1648/1509
-f 1500/1636/1497 1531/1671/1530 1532/1649/1510
-f 1521/1685/1542 1490/1650/1511 1520/1651/1512
-f 1541/1687/1544 1510/1652/1513 1540/1653/1514
-f 1487/1637/1498 1518/1672/1531 1519/1654/1515
-f 1530/1689/1546 1499/1655/1516 1529/1656/1517
-f 1507/1657/1499 1538/1674/1532 1539/1658/1518
-f 1485/1640/1501 1516/1676/1534 1517/1659/1519
-f 1496/1660/1520 1527/1699/1555 1528/1661/1521
-f 1505/1641/1502 1536/1677/1535 1537/1662/1522
-f 1494/1663/1523 1525/1702/1558 1526/1664/1524
-f 1535/1678/1536 1504/1665/1525 1534/1646/1507
-f 1492/1666/1504 1523/2193/1508 1524/1667/1526
-f 1512/1611/1474 1543/1648/1509 1544/1668/1527
-f 1533/1683/1540 1502/1645/1506 1532/1649/1510
-f 1490/1650/1511 1521/1685/1542 1522/1669/1528
-f 1510/1652/1513 1541/1687/1544 1542/1670/1529
-f 1499/1655/1516 1530/1689/1546 1531/1671/1530
-f 1488/1617/1480 1519/1654/1515 1520/1651/1512
-f 1508/1621/1483 1539/1658/1518 1540/1653/1514
-f 1486/1622/1484 1517/1659/1519 1518/1672/1531
-f 1529/1656/1517 1498/1619/1482 1528/1661/1521
-f 1506/1673/1487 1537/1695/1522 1538/1674/1532
-f 1484/1675/1533 1515/1697/1553 1516/1676/1534
-f 1527/1699/1555 1496/1660/1520 1526/1664/1524
-f 1504/1665/1525 1535/1678/1536 1536/1677/1535
-f 1525/1702/1558 1494/1663/1523 1524/1667/1526
-f 1566/1741/1566 1535/1678/1536 1565/1679/1537
-f 1523/1647/1508 1554/1705/1560 1555/1681/1538
-f 1543/1648/1509 1574/1706/1561 1575/1682/1539
-f 1564/1719/1571 1533/1683/1540 1563/1684/1541
-f 1521/1685/1542 1552/1724/1576 1553/1686/1543
-f 1541/1687/1544 1572/1726/1578 1573/1688/1545
-f 1530/1689/1546 1561/2194/1581 1562/1690/1547
-f 1519/1654/1515 1550/1707/1562 1551/1691/1548
-f 1539/1658/1518 1570/1709/1564 1571/1692/1549
-f 1517/1659/1519 1548/1710/1565 1549/1693/1550
-f 1560/1708/1563 1529/1656/1517 1559/1694/1551
-f 1569/1732/1583 1538/1674/1532 1568/1696/1552
-f 1515/1697/1553 1546/1750/1595 1547/1698/1554
-f 1558/1735/1586 1527/1699/1555 1557/1700/1556
-f 1535/1678/1536 1566/1741/1566 1567/1701/1557
-f 1556/1739/1568 1525/1702/1558 1555/1703/1538
-f 1544/1668/1527 1575/1682/1539 1576/1704/1559
-f 1533/1683/1540 1564/1719/1571 1565/1679/1537
-f 1522/1669/1528 1553/1686/1543 1554/1705/1560
-f 1542/1670/1529 1573/1688/1545 1574/1706/1561
-f 1531/1671/1530 1562/1690/1547 1563/1684/1541
-f 1552/1724/1576 1521/1685/1542 1551/1691/1548
-f 1572/1726/1578 1541/1687/1544 1571/1692/1549
-f 1518/1672/1531 1549/1693/1550 1550/1707/1562
-f 1561/2194/1581 1530/1689/1546 1560/1708/1563
-f 1538/1674/1532 1569/1732/1583 1570/1709/1564
-f 1516/1676/1534 1547/1698/1554 1548/1710/1565
-f 1527/1699/1555 1558/1735/1586 1559/1694/1551
-f 1536/1677/1535 1567/1701/1557 1568/1711/1552
-f 1525/1702/1558 1556/1739/1568 1557/1700/1556
-f 1566/1713/1566 1597/1756/1600 1598/1714/1567
-f 1587/1754/1598 1556/1715/1568 1586/1717/1569
-f 1575/1682/1539 1606/1743/1590 1607/1718/1570
-f 1564/1719/1571 1595/2195/1604 1596/1720/1572
-f 1553/1686/1543 1584/1744/1591 1585/1721/1573
-f 1573/1688/1545 1604/1745/1592 1605/1722/1574
-f 1562/1690/1547 1593/2196/1593 1594/1723/1575
-f 1583/1764/1606 1552/1724/1576 1582/1725/1577
-f 1603/1766/1608 1572/1726/1578 1602/1727/1579
-f 1549/1693/1550 1580/1748/1594 1581/1728/1580
-f 1560/1730/1563 1591/1772/1614 1592/1731/1582
-f 1569/1732/1583 1600/1775/1616 1601/1733/1584
-f 1547/1698/1554 1578/1751/1596 1579/1734/1585
-f 1558/1735/1586 1589/2197/1620 1590/1736/1587
-f 1567/1712/1557 1598/1714/1567 1599/1738/1588
-f 1556/1739/1568 1587/2198/1598 1588/1740/1589
-f 1597/2199/1600 1566/1741/1566 1596/1720/1572
-f 1554/1705/1560 1585/1721/1573 1586/1742/1569
-f 1574/1706/1561 1605/1722/1574 1606/1743/1590
-f 1595/2195/1604 1564/1719/1571 1594/1723/1575
-f 1552/1724/1576 1583/1764/1606 1584/1744/1591
-f 1572/1726/1578 1603/1766/1608 1604/1745/1592
-f 1561/1729/1581 1592/1731/1582 1593/1747/1593
-f 1550/1707/1562 1581/1728/1580 1582/1725/1577
-f 1570/1709/1564 1601/1733/1584 1602/1727/1579
-f 1548/1710/1565 1579/1734/1585 1580/1748/1594
-f 1591/2200/1614 1560/1708/1563 1590/1736/1587
-f 1600/1775/1616 1569/1732/1583 1599/1749/1588
-f 1546/1750/1595 1577/1777/1618 1578/1751/1596
-f 1589/2197/1620 1558/1735/1586 1588/1740/1589
-f 1598/1714/1567 1630/1780/1621 1631/1752/1597
-f 1587/1754/1598 1619/1797/1636 1620/1755/1599
-f 1629/1795/1634 1597/1756/1600 1628/1758/1601
-f 1585/1721/1573 1617/1783/1623 1618/1759/1602
-f 1605/1722/1574 1637/1784/1624 1638/1760/1603
-f 1627/1800/1639 1595/1761/1604 1626/1763/1605
-f 1583/1764/1606 1615/1805/1644 1616/1765/1607
-f 1603/1766/1608 1635/1807/1646 1636/1767/1609
-f 1592/1731/1582 1624/1786/1626 1625/1768/1610
-f 1581/1728/1580 1613/1785/1625 1614/1769/1611
-f 1601/1733/1584 1633/1787/1627 1634/1770/1612
-f 1579/1734/1585 1611/1788/1628 1612/1771/1613
-f 1623/1810/1649 1591/1772/1614 1622/1774/1615
-f 1599/1749/1588 1631/1789/1597 1632/1776/1617
-f 1577/1777/1618 1609/1791/1630 1610/1778/1619
-f 1621/1793/1632 1589/1779/1620 1620/1755/1599
-f 1597/1756/1600 1629/1795/1634 1630/1780/1621
-f 1619/1797/1636 1587/1754/1598 1618/1781/1602
-f 1606/1743/1590 1638/1760/1603 1639/1782/1622
-f 1595/1761/1604 1627/1800/1639 1628/1758/1601
-f 1584/1744/1591 1616/1765/1607 1617/1783/1623
-f 1604/1745/1592 1636/1767/1609 1637/1784/1624
-f 1593/1747/1593 1625/1768/1610 1626/1763/1605
-f 1615/1805/1644 1583/1764/1606 1614/1769/1611
-f 1635/1807/1646 1603/1766/1608 1634/1770/1612
-f 1580/1748/1594 1612/1771/1613 1613/1785/1625
-f 1591/1772/1614 1623/1810/1649 1624/1786/1626
-f 1600/1775/1616 1632/1776/1617 1633/1787/1627
-f 1578/1751/1596 1610/1778/1619 1611/1788/1628
-f 1589/1779/1620 1621/1793/1632 1622/1774/1615
-f 1631/1789/1597 1662/2201/1654 1663/1790/1629
-f 1609/1791/1630 1640/1848/1684 1641/1792/1631
-f 1652/1823/1661 1621/1793/1632 1651/1794/1633
-f 1629/1795/1634 1660/1828/1666 1661/1796/1635
-f 1650/1826/1664 1619/1797/1636 1649/1798/1637
-f 1638/1760/1603 1669/1832/1669 1670/1799/1638
-f 1627/1800/1639 1658/1834/1671 1659/1801/1640
-f 1616/1765/1607 1647/1817/1655 1648/1802/1641
-f 1636/1767/1609 1667/1818/1656 1668/1803/1642
-f 1625/1768/1610 1656/1819/1657 1657/1804/1643
-f 1646/1836/1673 1615/1805/1644 1645/1806/1645
-f 1666/1838/1675 1635/1807/1646 1665/1808/1647
-f 1612/1771/1613 1643/1820/1658 1644/1809/1648
-f 1655/1840/1677 1624/1786/1626 1654/1811/1650
-f 1632/1776/1617 1663/1790/1629 1664/1812/1651
-f 1610/1778/1619 1641/1792/1631 1642/1813/1652
-f 1621/1793/1632 1652/1823/1661 1653/1814/1653
-f 1630/1780/1621 1661/1796/1635 1662/1815/1654
-f 1619/1797/1636 1650/1826/1664 1651/1794/1633
-f 1660/1828/1666 1629/1795/1634 1659/1801/1640
-f 1617/1816/1623 1648/1830/1641 1649/1798/1637
-f 1669/1832/1669 1638/1760/1603 1668/1803/1642
-f 1658/1834/1671 1627/1800/1639 1657/1804/1643
-f 1615/1805/1644 1646/1836/1673 1647/1817/1655
-f 1635/1807/1646 1666/1838/1675 1667/1818/1656
-f 1624/1786/1626 1655/1840/1677 1656/1819/1657
-f 1613/1785/1625 1644/1809/1648 1645/1806/1645
-f 1633/1787/1627 1664/1812/1651 1665/1808/1647
-f 1611/1788/1628 1642/1813/1652 1643/1820/1658
-f 1622/1774/1615 1653/1814/1653 1654/1811/1650
-f 1663/1790/1629 1694/1878/1683 1695/1821/1659
-f 1641/1792/1631 1672/1849/1685 1673/1822/1660
-f 1652/1823/1661 1683/1860/1696 1684/1824/1662
-f 1661/1796/1635 1692/1850/1686 1693/1825/1663
-f 1650/1826/1664 1681/1864/1700 1682/1827/1665
-f 1691/1862/1698 1660/1828/1666 1690/1829/1667
-f 1648/1830/1641 1679/1883/1705 1680/1831/1668
-f 1668/1803/1642 1699/1852/1688 1700/1833/1670
-f 1689/1867/1703 1658/1834/1671 1688/1835/1672
-f 1646/1836/1673 1677/1873/1709 1678/1837/1674
-f 1666/1838/1675 1697/1875/1711 1698/1839/1676
-f 1655/1840/1677 1686/1877/1713 1687/1841/1678
-f 1644/1809/1648 1675/1853/1689 1676/1842/1679
-f 1664/1812/1651 1695/1821/1659 1696/1843/1680
-f 1642/1813/1652 1673/1822/1660 1674/1844/1681
-f 1653/1814/1653 1684/1824/1662 1685/1845/1682
-f 1662/1815/1654 1693/1825/1663 1694/1847/1683
-f 1640/1848/1684 1671/1858/1694 1672/1849/1685
-f 1683/1860/1696 1652/1823/1661 1682/1827/1665
-f 1660/1828/1666 1691/1862/1698 1692/1850/1686
-f 1681/1864/1700 1650/1826/1664 1680/1831/1668
-f 1669/1832/1669 1700/1833/1670 1701/1851/1687
-f 1658/1834/1671 1689/1867/1703 1690/1829/1667
-f 1679/1869/1705 1648/1802/1641 1678/1837/1674
-f 1667/1818/1656 1698/1839/1676 1699/1852/1688
-f 1656/1819/1657 1687/1841/1678 1688/1835/1672
-f 1677/1873/1709 1646/1836/1673 1676/1842/1679
-f 1697/1875/1711 1666/1838/1675 1696/1843/1680
-f 1643/1820/1658 1674/1844/1681 1675/1853/1689
-f 1686/1877/1713 1655/1840/1677 1685/1845/1682
-f 1695/1821/1659 1726/1879/1714 1727/1854/1690
-f 1673/1822/1660 1704/1880/1715 1705/1855/1691
-f 1684/1824/1662 1715/1881/1716 1716/1856/1692
-f 1693/1825/1663 1724/1882/1717 1725/1857/1693
-f 1671/1858/1694 1702/1914/1747 1703/1859/1695
-f 1714/1895/1728 1683/1860/1696 1713/1861/1697
-f 1691/1862/1698 1722/1900/1733 1723/1863/1699
-f 1712/1898/1731 1681/1864/1700 1711/1865/1701
-f 1700/1833/1670 1731/1884/1718 1732/1866/1702
-f 1689/1867/1703 1720/1905/1738 1721/1868/1704
-f 1710/1918/1735 1679/1869/1705 1709/1870/1706
-f 1698/1839/1676 1729/1885/1719 1730/1871/1707
-f 1687/1841/1678 1718/1886/1720 1719/1872/1708
-f 1708/1907/1740 1677/1873/1709 1707/1874/1710
-f 1728/1887/1721 1697/1875/1711 1727/1854/1690
-f 1674/1844/1681 1705/1855/1691 1706/1876/1712
-f 1717/1890/1724 1686/1877/1713 1716/1856/1692
-f 1694/1878/1683 1725/1892/1693 1726/1879/1714
-f 1672/1849/1685 1703/1859/1695 1704/1880/1715
-f 1683/1860/1696 1714/1895/1728 1715/1881/1716
-f 1692/1850/1686 1723/1863/1699 1724/1882/1717
-f 1681/1864/1700 1712/1898/1731 1713/1861/1697
-f 1722/1900/1733 1691/1862/1698 1721/1868/1704
-f 1679/1883/1705 1710/1902/1735 1711/1865/1701
-f 1699/1852/1688 1730/1871/1707 1731/1884/1718
-f 1720/1905/1738 1689/1867/1703 1719/1872/1708
-f 1677/1873/1709 1708/1907/1740 1709/1870/1706
-f 1697/1875/1711 1728/1887/1721 1729/1885/1719
-f 1686/1877/1713 1717/1890/1724 1718/1886/1720
-f 1675/1853/1689 1706/1876/1712 1707/1874/1710
-f 1759/1920/1752 1728/1887/1721 1758/1888/1722
-f 1705/1855/1691 1736/1912/1745 1737/1889/1723
-f 1748/1922/1754 1717/1890/1724 1747/1891/1725
-f 1725/1892/1693 1756/1947/1746 1757/1893/1726
-f 1703/1859/1695 1734/1915/1748 1735/1894/1727
-f 1714/1895/1728 1745/1931/1763 1746/1896/1729
-f 1723/1863/1699 1754/1916/1749 1755/1897/1730
-f 1712/1898/1731 1743/1935/1767 1744/1899/1732
-f 1753/1933/1765 1722/1900/1733 1752/1901/1734
-f 1710/1902/1735 1741/1940/1772 1742/1903/1736
-f 1730/1871/1707 1761/1919/1751 1762/1904/1737
-f 1751/1938/1770 1720/1905/1738 1750/1906/1739
-f 1708/1907/1740 1739/1945/1776 1740/1908/1741
-f 1728/1887/1721 1759/1920/1752 1760/1909/1742
-f 1717/1890/1724 1748/1922/1754 1749/1910/1743
-f 1706/1876/1712 1737/1889/1723 1738/1911/1744
-f 1726/1879/1714 1757/1893/1726 1758/1888/1722
-f 1704/1880/1715 1735/1894/1727 1736/1912/1745
-f 1715/1881/1716 1746/1896/1729 1747/1891/1725
-f 1724/1882/1717 1755/1897/1730 1756/1913/1746
-f 1702/1914/1747 1733/1929/1761 1734/1915/1748
-f 1745/1931/1763 1714/1895/1728 1744/1899/1732
-f 1722/1900/1733 1753/1933/1765 1754/1916/1749
-f 1743/1935/1767 1712/1898/1731 1742/1903/1736
-f 1731/1884/1718 1762/1904/1737 1763/1917/1750
-f 1720/1905/1738 1751/1938/1770 1752/1901/1734
-f 1741/2202/1772 1710/1918/1735 1740/1908/1741
-f 1729/1885/1719 1760/1909/1742 1761/1919/1751
-f 1718/1886/1720 1749/1910/1743 1750/1906/1739
-f 1739/1945/1776 1708/1907/1740 1738/1911/1744
-f 1759/1920/1752 1790/1958/1787 1791/1921/1753
-f 1748/1922/1754 1779/1961/1790 1780/1923/1755
-f 1737/1889/1723 1768/1946/1777 1769/1924/1756
-f 1757/1893/1726 1788/1948/1778 1789/1925/1757
-f 1735/1894/1727 1766/1949/1779 1767/1926/1758
-f 1746/1896/1729 1777/1950/1780 1778/1927/1759
-f 1755/1897/1730 1786/1951/1781 1787/1928/1760
-f 1733/1929/1761 1764/1982/1810 1765/1930/1762
-f 1776/1966/1794 1745/1931/1763 1775/1932/1764
-f 1753/1933/1765 1784/1971/1799 1785/1934/1766
-f 1774/1969/1797 1743/1935/1767 1773/1936/1768
-f 1762/1904/1737 1793/1952/1782 1794/1937/1769
-f 1751/1938/1770 1782/1976/1804 1783/1939/1771
-f 1772/1973/1801 1741/1940/1772 1771/1942/1773
-f 1760/1909/1742 1791/1921/1753 1792/1943/1774
-f 1749/1910/1743 1780/1923/1755 1781/1944/1775
-f 1770/1956/1785 1739/1945/1776 1769/1924/1756
-f 1790/1958/1787 1759/1920/1752 1789/1925/1757
-f 1736/1912/1745 1767/1926/1758 1768/1946/1777
-f 1779/1961/1790 1748/1922/1754 1778/1927/1759
-f 1756/1947/1746 1787/1963/1760 1788/1948/1778
-f 1734/1915/1748 1765/1930/1762 1766/1949/1779
-f 1745/1931/1763 1776/1966/1794 1777/1950/1780
-f 1754/1916/1749 1785/1934/1766 1786/1951/1781
-f 1743/1935/1767 1774/1969/1797 1775/1932/1764
-f 1784/1971/1799 1753/1933/1765 1783/1939/1771
-f 1741/1940/1772 1772/1973/1801 1773/1936/1768
-f 1761/1919/1751 1792/1943/1774 1793/1952/1782
-f 1782/1976/1804 1751/1938/1770 1781/1944/1775
-f 1739/1945/1776 1770/1956/1785 1771/1953/1773
-f 1791/1921/1753 1822/1978/1806 1823/1954/1783
-f 1780/1923/1755 1811/1979/1807 1812/1955/1784
-f 1801/1990/1817 1770/1956/1785 1800/1957/1786
-f 1821/1992/1819 1790/1958/1787 1820/1959/1788
-f 1767/1926/1758 1798/1980/1808 1799/1960/1789
-f 1810/1994/1821 1779/1961/1790 1809/1962/1791
-f 1787/1963/1760 1818/2016/1809 1819/1964/1792
-f 1765/1930/1762 1796/1983/1811 1797/1965/1793
-f 1776/1966/1794 1807/2003/1830 1808/1967/1795
-f 1785/1934/1766 1816/1984/1812 1817/1968/1796
-f 1774/1969/1797 1805/2007/1834 1806/1970/1798
-f 1815/2005/1832 1784/1971/1799 1814/1972/1800
-f 1772/1973/1801 1803/2011/1838 1804/1974/1802
-f 1792/1943/1774 1823/1954/1783 1824/1975/1803
-f 1813/1988/1815 1782/1976/1804 1812/1955/1784
-f 1770/1956/1785 1801/1990/1817 1802/1977/1805
-f 1790/1958/1787 1821/1992/1819 1822/1978/1806
-f 1779/1961/1790 1810/1994/1821 1811/1979/1807
-f 1768/1946/1777 1799/1960/1789 1800/1957/1786
-f 1788/1948/1778 1819/1964/1792 1820/1959/1788
-f 1766/1949/1779 1797/1965/1793 1798/1980/1808
-f 1809/1962/1791 1778/1927/1759 1808/1967/1795
-f 1786/1951/1781 1817/1968/1796 1818/1981/1809
-f 1764/1982/1810 1795/2001/1828 1796/1983/1811
-f 1807/2003/1830 1776/1966/1794 1806/1970/1798
-f 1784/1971/1799 1815/2005/1832 1816/1984/1812
-f 1805/2007/1834 1774/1969/1797 1804/1974/1802
-f 1793/1952/1782 1824/1975/1803 1825/1985/1813
-f 1782/1976/1804 1813/1988/1815 1814/1972/1800
-f 1803/2011/1838 1772/1973/1801 1802/1986/1805
-f 1823/1954/1783 1854/2013/1839 1855/1987/1814
-f 1844/2021/1846 1813/1988/1815 1843/1989/1816
-f 1801/1990/1817 1832/2027/1852 1833/1991/1818
-f 1821/1992/1819 1852/2029/1854 1853/1993/1820
-f 1810/1994/1821 1841/2015/1841 1842/1995/1822
-f 1799/1960/1789 1830/2014/1840 1831/1996/1823
-f 1819/1964/1792 1850/2017/1842 1851/1997/1824
-f 1797/1965/1793 1828/2018/1843 1829/1998/1825
-f 1840/2032/1857 1809/1962/1791 1839/1999/1826
-f 1817/1968/1796 1848/2019/1844 1849/2000/1827
-f 1795/2001/1828 1826/2050/1873 1827/2002/1829
-f 1838/2037/1861 1807/2003/1830 1837/2004/1831
-f 1815/2005/1832 1846/2042/1866 1847/2006/1833
-f 1836/2040/1864 1805/2007/1834 1835/2008/1835
-f 1824/1975/1803 1855/1987/1814 1856/2009/1836
-f 1813/1988/1815 1844/2021/1846 1845/2010/1837
-f 1834/2023/1848 1803/2011/1838 1833/2012/1818
-f 1822/1978/1806 1853/1993/1820 1854/2013/1839
-f 1811/1979/1807 1842/1995/1822 1843/1989/1816
-f 1832/2027/1852 1801/1990/1817 1831/1996/1823
-f 1852/2029/1854 1821/1992/1819 1851/1997/1824
-f 1798/1980/1808 1829/1998/1825 1830/2014/1840
-f 1809/1962/1791 1840/2032/1857 1841/2015/1841
-f 1818/2016/1809 1849/2034/1827 1850/2017/1842
-f 1796/1983/1811 1827/2002/1829 1828/2018/1843
-f 1807/2003/1830 1838/2037/1861 1839/1999/1826
-f 1816/1984/1812 1847/2006/1833 1848/2019/1844
-f 1805/2007/1834 1836/2040/1864 1837/2004/1831
-f 1846/2042/1866 1815/2005/1832 1845/2010/1837
-f 1803/2011/1838 1834/2023/1848 1835/2008/1835
-f 1855/1987/1814 1886/2044/1868 1887/2020/1845
-f 1844/2021/1846 1875/2058/1881 1876/2022/1847
-f 1865/2055/1878 1834/2023/1848 1864/2024/1849
-f 1853/1993/1820 1884/2046/1869 1885/2025/1850
-f 1842/1995/1822 1873/2047/1870 1874/2026/1851
-f 1863/2060/1883 1832/2027/1852 1862/2028/1853
-f 1883/2062/1885 1852/2029/1854 1882/2030/1855
-f 1829/1998/1825 1860/2048/1871 1861/2031/1856
-f 1840/2032/1857 1871/2068/1891 1872/2033/1858
-f 1849/2034/1827 1880/2082/1872 1881/2035/1859
-f 1827/2002/1829 1858/2051/1874 1859/2036/1860
-f 1838/2037/1861 1869/2073/1896 1870/2038/1862
-f 1847/2006/1833 1878/2052/1875 1879/2039/1863
-f 1836/2040/1864 1867/2076/1899 1868/2041/1865
-f 1877/2053/1876 1846/2042/1866 1876/2022/1847
-f 1834/2023/1848 1865/2055/1878 1866/2043/1867
-f 1854/2013/1839 1885/2025/1850 1886/2044/1868
-f 1875/2058/1881 1844/2021/1846 1874/2026/1851
-f 1832/2027/1852 1863/2060/1883 1864/2045/1849
-f 1852/2029/1854 1883/2062/1885 1884/2046/1869
-f 1841/2015/1841 1872/2033/1858 1873/2047/1870
-f 1830/2014/1840 1861/2031/1856 1862/2028/1853
-f 1850/2017/1842 1881/2035/1859 1882/2030/1855
-f 1828/2018/1843 1859/2036/1860 1860/2048/1871
-f 1871/2068/1891 1840/2032/1857 1870/2038/1862
-f 1848/2019/1844 1879/2039/1863 1880/2049/1872
-f 1826/2050/1873 1857/2071/1894 1858/2051/1874
-f 1869/2073/1896 1838/2037/1861 1868/2041/1865
-f 1846/2042/1866 1877/2053/1876 1878/2052/1875
-f 1867/2076/1899 1836/2040/1864 1866/2043/1867
-f 1908/2085/1906 1877/2053/1876 1907/2054/1877
-f 1865/2055/1878 1896/2092/1913 1897/2056/1879
-f 1885/2025/1850 1916/2079/1901 1917/2057/1880
-f 1906/2090/1911 1875/2058/1881 1905/2059/1882
-f 1863/2060/1883 1894/2096/1917 1895/2061/1884
-f 1883/2062/1885 1914/2098/1919 1915/2063/1886
-f 1872/2033/1858 1903/2081/1903 1904/2064/1887
-f 1861/2031/1856 1892/2080/1902 1893/2065/1888
-f 1881/2035/1859 1912/2083/1904 1913/2066/1889
-f 1859/2036/1860 1890/2084/1905 1891/2067/1890
-f 1902/2101/1922 1871/2068/1891 1901/2069/1892
-f 1911/2115/1924 1880/2049/1872 1910/2070/1893
-f 1857/2071/1894 1888/2116/1935 1889/2072/1895
-f 1900/2106/1927 1869/2073/1896 1899/2074/1897
-f 1877/2053/1876 1908/2085/1906 1909/2075/1898
-f 1898/2087/1908 1867/2076/1899 1897/2056/1879
-f 1886/2044/1868 1917/2057/1880 1918/2077/1900
-f 1875/2058/1881 1906/2090/1911 1907/2054/1877
-f 1896/2092/1913 1865/2055/1878 1895/2078/1884
-f 1884/2046/1869 1915/2063/1886 1916/2079/1901
-f 1873/2047/1870 1904/2064/1887 1905/2059/1882
-f 1894/2096/1917 1863/2060/1883 1893/2065/1888
-f 1914/2098/1919 1883/2062/1885 1913/2066/1889
-f 1860/2048/1871 1891/2067/1890 1892/2080/1902
-f 1871/2068/1891 1902/2101/1922 1903/2081/1903
-f 1880/2082/1872 1911/2103/1924 1912/2083/1904
-f 1858/2051/1874 1889/2072/1895 1890/2084/1905
-f 1869/2073/1896 1900/2106/1927 1901/2069/1892
-f 1878/2052/1875 1909/2075/1898 1910/2070/1893
-f 1867/2076/1899 1898/2087/1908 1899/2074/1897
-f 1908/2085/1906 1939/2121/1940 1940/2086/1907
-f 1929/2119/1938 1898/2087/1908 1928/2088/1909
-f 1917/2057/1880 1948/2110/1931 1949/2089/1910
-f 1906/2090/1911 1937/2126/1945 1938/2091/1912
-f 1927/2123/1942 1896/2092/1913 1926/2093/1914
-f 1915/2063/1886 1946/2112/1932 1947/2094/1915
-f 1904/2064/1887 1935/2113/1933 1936/2095/1916
-f 1925/2128/1947 1894/2096/1917 1924/2097/1918
-f 1945/2130/1949 1914/2098/1919 1944/2099/1920
-f 1891/2067/1890 1922/2114/1934 1923/2100/1921
-f 1902/2101/1922 1933/2136/1955 1934/2102/1923
-f 1911/2103/1924 1942/2148/1957 1943/2104/1925
-f 1889/2072/1895 1920/2117/1936 1921/2105/1926
-f 1900/2106/1927 1931/2141/1960 1932/2107/1928
-f 1909/2075/1898 1940/2086/1907 1941/2108/1929
-f 1898/2087/1908 1929/2119/1938 1930/2109/1930
-f 1939/2121/1940 1908/2085/1906 1938/2091/1912
-f 1896/2092/1913 1927/2123/1942 1928/2088/1909
-f 1916/2079/1901 1947/2094/1915 1948/2110/1931
-f 1937/2126/1945 1906/2090/1911 1936/2095/1916
-f 1894/2096/1917 1925/2128/1947 1926/2111/1914
-f 1914/2098/1919 1945/2130/1949 1946/2112/1932
-f 1903/2081/1903 1934/2102/1923 1935/2113/1933
-f 1892/2080/1902 1923/2100/1921 1924/2097/1918
-f 1912/2083/1904 1943/2104/1925 1944/2099/1920
-f 1890/2084/1905 1921/2105/1926 1922/2114/1934
-f 1933/2136/1955 1902/2101/1922 1932/2107/1928
-f 1942/2138/1957 1911/2115/1924 1941/2108/1929
-f 1888/2116/1935 1919/2139/1958 1920/2117/1936
-f 1931/2141/1960 1900/2106/1927 1930/2109/1930
-f 1940/2086/1907 1971/2142/1961 1972/2118/1937
-f 1929/2119/1938 1960/2165/1982 1961/2120/1939
-f 1970/2164/1981 1939/2121/1940 1969/2122/1941
-f 1927/2123/1942 1958/2171/1984 1959/2124/1943
-f 1947/2094/1915 1978/2145/1963 1979/2125/1944
-f 1968/2166/1983 1937/2126/1945 1967/2127/1946
-f 1925/2128/1947 1956/2168/1985 1957/2129/1948
-f 1945/2130/1949 1976/2169/1986 1977/2131/1950
-f 1934/2102/1923 1965/2147/1965 1966/2132/1951
-f 1923/2100/1921 1954/2146/1964 1955/2133/1952
-f 1943/2104/1925 1974/2149/1966 1975/2134/1953
-f 1921/2105/1926 1952/2150/1967 1953/2135/1954
-f 1964/2152/1969 1933/2136/1955 1963/2137/1956
-f 1973/2162/1979 1942/2138/1957 1972/2118/1937
-f 1919/2139/1958 1950/2161/1978 1951/2140/1959
-f 1962/2163/1980 1931/2141/1960 1961/2120/1939
-f 1939/2121/1940 1970/2164/1981 1971/2142/1961
-f 1960/2165/1982 1929/2119/1938 1959/2124/1943
-f 1948/2110/1931 1979/2125/1944 1980/2143/1962
-f 1937/2126/1945 1968/2166/1983 1969/2122/1941
-f 1958/2167/1984 1927/2144/1942 1957/2129/1948
-f 1946/2112/1932 1977/2131/1950 1978/2145/1963
-f 1935/2113/1933 1966/2132/1951 1967/2127/1946
-f 1956/2168/1985 1925/2128/1947 1955/2133/1952
-f 1976/2169/1986 1945/2130/1949 1975/2134/1953
-f 1922/2114/1934 1953/2135/1954 1954/2146/1964
-f 1933/2136/1955 1964/2152/1969 1965/2147/1965
-f 1942/2148/1957 1973/2170/1979 1974/2149/1966
-f 1920/2117/1936 1951/2140/1959 1952/2150/1967
-f 1931/2141/1960 1962/2163/1980 1963/2137/1956
-f 1966/2132/1951 1984/2154/1971 1985/2151/1968
-f 1983/2156/1973 1964/2152/1969 1982/2153/1970
-f 13/2155/1972 42/54/52 43/49/47
-f 41/55/53 1983/2156/1973 40/59/57
-f 1986/2157/1974 47/66/64 48/61/59
-f 10/42/41 36/44/42 37/64/62
-f 1984/2154/1971 43/49/47 44/48/46
-f 42/54/52 13/2155/1972 41/55/53
-f 12/19/19 39/21/21 40/59/57
-f 1981/2158/1975 37/64/62 38/63/61
-f 15/25/25 46/27/27 47/66/64
-f 45/71/68 14/26/26 44/48/46
-f 18/2203/13 1973/2162/1979 17/39/14
-f 1950/2161/1978 1/17/17 2/16/16
-f 1961/2120/1939 11/20/20 12/19/19
-f 1970/2164/1981 1986/2157/1974 16/40/39
-f 1959/2124/1943 10/42/41 1981/2158/1975
-f 1968/2166/1983 14/26/26 15/25/25
-f 1957/2129/1948 8/29/29 9/28/28
-f 23/31/31 1978/2145/1963 22/1/1
-f 1955/2133/1952 6/4/4 7/33/33
-f 21/2/2 1976/2169/1986 20/7/7
-f 1953/2135/1954 4/10/10 5/5/5
-f 1964/2152/1969 1983/2156/1973 13/2155/1972
-f 19/8/8 1974/2149/1966 18/13/13
-f 1951/2140/1959 2/16/16 3/11/11
-f 1962/2163/1980 12/19/19 1982/2153/1970
-f 25/22/22 1980/2143/1962 24/23/23
-f 17/39/14 1972/2118/1937 16/40/39
-f 1960/2165/1982 1981/2158/1975 11/20/20
-f 1986/2157/1974 1970/2164/1981 15/25/25
-f 1958/2171/1984 9/43/28 10/42/41
-f 24/23/23 1979/2125/1944 23/31/31
-f 14/26/26 1968/2166/1983 1985/2151/1968
-f 1956/2168/1985 7/33/33 8/29/29
-f 22/1/1 1977/2131/1950 21/2/2
-f 1965/2147/1965 13/2155/1972 1984/2154/1971
-f 1954/2146/1964 5/5/5 6/4/4
-f 20/7/7 1975/2134/1953 19/8/8
-f 1952/2150/1967 3/11/11 4/10/10
diff --git a/examples/qt3d/playground-qml/assets/cube.obj b/examples/qt3d/playground-qml/assets/cube.obj
deleted file mode 100644
index 81547f180..000000000
--- a/examples/qt3d/playground-qml/assets/cube.obj
+++ /dev/null
@@ -1,20 +0,0 @@
-# Blender v2.70 (sub 0) OBJ File: ''
-# www.blender.org
-mtllib cube.mtl
-o Cube
-v 1.000000 -1.000000 -1.000000
-v 1.000000 -1.000000 1.000000
-v -1.000000 -1.000000 1.000000
-v -1.000000 -1.000000 -1.000000
-v 1.000000 1.000000 -0.999999
-v 0.999999 1.000000 1.000001
-v -1.000000 1.000000 1.000000
-v -1.000000 1.000000 -1.000000
-usemtl Material
-s off
-f 1 2 3 4
-f 5 8 7 6
-f 1 5 6 2
-f 2 6 7 3
-f 3 7 8 4
-f 5 1 4 8
diff --git a/examples/qt3d/playground-qml/assets/test_scene.dae b/examples/qt3d/playground-qml/assets/test_scene.dae
deleted file mode 100644
index 23dabfe28..000000000
--- a/examples/qt3d/playground-qml/assets/test_scene.dae
+++ /dev/null
@@ -1,319 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
- <asset>
- <contributor>
- <author>Blender User</author>
- <authoring_tool>Blender 2.67.0 runknown</authoring_tool>
- </contributor>
- <created>2014-03-02T18:44:03</created>
- <modified>2014-03-02T18:44:03</modified>
- <unit name="meter" meter="1"/>
- <up_axis>Z_UP</up_axis>
- </asset>
- <library_cameras>
- <camera id="Camera-camera" name="Camera">
- <optics>
- <technique_common>
- <perspective>
- <xfov sid="xfov">39.14625</xfov>
- <aspect_ratio>1.777778</aspect_ratio>
- <znear sid="znear">0.1</znear>
- <zfar sid="zfar">1000</zfar>
- </perspective>
- </technique_common>
- </optics>
- </camera>
- </library_cameras>
- <library_lights>
- <light id="Lamp-light" name="Lamp">
- <technique_common>
- <point>
- <color sid="color">1 1 1</color>
- <constant_attenuation>1</constant_attenuation>
- <linear_attenuation>0</linear_attenuation>
- <quadratic_attenuation>0.00111109</quadratic_attenuation>
- </point>
- </technique_common>
- <extra>
- <technique profile="blender">
- <adapt_thresh>0.000999987</adapt_thresh>
- <area_shape>1</area_shape>
- <area_size>0.1</area_size>
- <area_sizey>0.1</area_sizey>
- <area_sizez>1</area_sizez>
- <atm_distance_factor>1</atm_distance_factor>
- <atm_extinction_factor>1</atm_extinction_factor>
- <atm_turbidity>2</atm_turbidity>
- <att1>0</att1>
- <att2>1</att2>
- <backscattered_light>1</backscattered_light>
- <bias>1</bias>
- <blue>1</blue>
- <buffers>1</buffers>
- <bufflag>0</bufflag>
- <bufsize>2880</bufsize>
- <buftype>2</buftype>
- <clipend>30.002</clipend>
- <clipsta>1.000799</clipsta>
- <compressthresh>0.04999995</compressthresh>
- <dist sid="blender_dist">29.99998</dist>
- <energy sid="blender_energy">1</energy>
- <falloff_type>2</falloff_type>
- <filtertype>0</filtertype>
- <flag>0</flag>
- <gamma sid="blender_gamma">1</gamma>
- <green>1</green>
- <halo_intensity sid="blnder_halo_intensity">1</halo_intensity>
- <horizon_brightness>1</horizon_brightness>
- <mode>8192</mode>
- <ray_samp>1</ray_samp>
- <ray_samp_method>1</ray_samp_method>
- <ray_samp_type>0</ray_samp_type>
- <ray_sampy>1</ray_sampy>
- <ray_sampz>1</ray_sampz>
- <red>1</red>
- <samp>3</samp>
- <shadhalostep>0</shadhalostep>
- <shadow_b sid="blender_shadow_b">0</shadow_b>
- <shadow_g sid="blender_shadow_g">0</shadow_g>
- <shadow_r sid="blender_shadow_r">0</shadow_r>
- <shadspotsize>45</shadspotsize>
- <sky_colorspace>0</sky_colorspace>
- <sky_exposure>1</sky_exposure>
- <skyblendfac>1</skyblendfac>
- <skyblendtype>1</skyblendtype>
- <soft>3</soft>
- <spotblend>0.15</spotblend>
- <spotsize>75</spotsize>
- <spread>1</spread>
- <sun_brightness>1</sun_brightness>
- <sun_effect_type>0</sun_effect_type>
- <sun_intensity>1</sun_intensity>
- <sun_size>1</sun_size>
- <type>0</type>
- </technique>
- </extra>
- </light>
- </library_lights>
- <library_images/>
- <library_effects>
- <effect id="Material_001-effect">
- <profile_COMMON>
- <technique sid="common">
- <phong>
- <emission>
- <color sid="emission">0 0 0 1</color>
- </emission>
- <ambient>
- <color sid="ambient">0 0 0 1</color>
- </ambient>
- <diffuse>
- <color sid="diffuse">0.64 0.1175836 0 1</color>
- </diffuse>
- <specular>
- <color sid="specular">0.5 0.4080505 0.04213053 1</color>
- </specular>
- <shininess>
- <float sid="shininess">50</float>
- </shininess>
- <index_of_refraction>
- <float sid="index_of_refraction">1</float>
- </index_of_refraction>
- </phong>
- </technique>
- <extra>
- <technique profile="GOOGLEEARTH">
- <double_sided>1</double_sided>
- </technique>
- </extra>
- </profile_COMMON>
- <extra><technique profile="MAX3D"><double_sided>1</double_sided></technique></extra>
- </effect>
- <effect id="Material_002-effect">
- <profile_COMMON>
- <technique sid="common">
- <phong>
- <emission>
- <color sid="emission">0 0 0 1</color>
- </emission>
- <ambient>
- <color sid="ambient">0 0 0 1</color>
- </ambient>
- <diffuse>
- <color sid="diffuse">0.64 0.64 0.64 1</color>
- </diffuse>
- <specular>
- <color sid="specular">0.5 0.5 0.5 1</color>
- </specular>
- <shininess>
- <float sid="shininess">50</float>
- </shininess>
- <index_of_refraction>
- <float sid="index_of_refraction">1</float>
- </index_of_refraction>
- </phong>
- </technique>
- <extra>
- <technique profile="GOOGLEEARTH">
- <double_sided>1</double_sided>
- </technique>
- </extra>
- </profile_COMMON>
- <extra><technique profile="MAX3D"><double_sided>1</double_sided></technique></extra>
- </effect>
- </library_effects>
- <library_materials>
- <material id="Material_001-material" name="Material_001">
- <instance_effect url="#Material_001-effect"/>
- </material>
- <material id="Material_002-material" name="Material_002">
- <instance_effect url="#Material_002-effect"/>
- </material>
- </library_materials>
- <library_geometries>
- <geometry id="Cube-mesh" name="Cube">
- <mesh>
- <source id="Cube-mesh-positions">
- <float_array id="Cube-mesh-positions-array" count="24">1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1</float_array>
- <technique_common>
- <accessor source="#Cube-mesh-positions-array" count="8" stride="3">
- <param name="X" type="float"/>
- <param name="Y" type="float"/>
- <param name="Z" type="float"/>
- </accessor>
- </technique_common>
- </source>
- <source id="Cube-mesh-normals">
- <float_array id="Cube-mesh-normals-array" count="36">0 0 -1 0 0 1 1 -5.66244e-7 -2.38419e-7 0 -1 -2.98023e-7 -1 2.38419e-7 -1.19209e-7 2.08616e-7 1 2.38419e-7 0 0 -1 0 0 1 1 0 3.27826e-7 -4.76837e-7 -1 0 -1 2.08616e-7 -1.49012e-7 2.68221e-7 1 1.78814e-7</float_array>
- <technique_common>
- <accessor source="#Cube-mesh-normals-array" count="12" stride="3">
- <param name="X" type="float"/>
- <param name="Y" type="float"/>
- <param name="Z" type="float"/>
- </accessor>
- </technique_common>
- </source>
- <vertices id="Cube-mesh-vertices">
- <input semantic="POSITION" source="#Cube-mesh-positions"/>
- </vertices>
- <polylist material="Material_001-material" count="12">
- <input semantic="VERTEX" source="#Cube-mesh-vertices" offset="0"/>
- <input semantic="NORMAL" source="#Cube-mesh-normals" offset="1"/>
- <vcount>3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
- <p>0 0 1 0 3 0 4 1 7 1 6 1 0 2 4 2 5 2 1 3 5 3 2 3 2 4 6 4 3 4 4 5 0 5 3 5 1 6 2 6 3 6 5 7 4 7 6 7 1 8 0 8 5 8 5 9 6 9 2 9 6 10 7 10 3 10 7 11 4 11 3 11</p>
- </polylist>
- </mesh>
- <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>
- </geometry>
- <geometry id="Torus-mesh" name="Torus">
- <mesh>
- <source id="Torus-mesh-positions">
- <float_array id="Torus-mesh-positions-array" count="1728">1.25 0 0 1.216506 0 0.125 1.125 0 0.2165063 1 0 0.25 0.875 0 0.2165063 0.7834936 0 0.125 0.75 0 0 0.7834936 0 -0.125 0.875 0 -0.2165063 1 0 -0.25 1.125 0 -0.2165063 1.216506 0 -0.125 1.239306 0.1631577 0 1.206099 0.1587859 0.125 1.115375 0.1468419 0.2165063 0.9914449 0.1305261 0.25 0.8675143 0.1142104 0.2165063 0.7767907 0.1022664 0.125 0.7435837 0.0978946 0 0.7767907 0.1022664 -0.125 0.8675143 0.1142104 -0.2165063 0.9914449 0.1305261 -0.25 1.115375 0.1468419 -0.2165063 1.206099 0.1587859 -0.125 1.207407 0.3235238 0 1.175055 0.314855 0.125 1.086667 0.2911714 0.2165063 0.9659259 0.258819 0.25 0.8451852 0.2264666 0.2165063 0.7567967 0.202783 0.125 0.7244445 0.1941142 0 0.7567967 0.202783 -0.125 0.8451852 0.2264666 -0.2165063 0.9659259 0.258819 -0.25 1.086667 0.2911714 -0.2165063 1.175055 0.314855 -0.125 1.15485 0.4783542 0 1.123905 0.4655367 0.125 1.039365 0.4305188 0.2165063 0.9238796 0.3826833 0.25 0.8083947 0.3348479 0.2165063 0.7238538 0.29983 0.125 0.6929097 0.2870125 0 0.7238538 0.29983 -0.125 0.8083947 0.3348479 -0.2165063 0.9238796 0.3826833 -0.25 1.039365 0.4305188 -0.2165063 1.123905 0.4655367 -0.125 1.082532 0.6250001 0 1.053525 0.6082534 0.125 0.9742786 0.5625001 0.2165063 0.8660253 0.5000001 0.25 0.7577722 0.4375001 0.2165063 0.6785253 0.3917469 0.125 0.649519 0.3750001 0 0.6785253 0.3917469 -0.125 0.7577722 0.4375001 -0.2165063 0.8660253 0.5000001 -0.25 0.9742786 0.5625001 -0.2165063 1.053525 0.6082534 -0.125 0.9916918 0.7609516 0 0.9651195 0.740562 0.125 0.8925226 0.6848565 0.2165063 0.7933534 0.6087614 0.25 0.6941843 0.5326662 0.2165063 0.6215874 0.4769607 0.125 0.5950151 0.4565711 0 0.6215874 0.4769607 -0.125 0.6941843 0.5326662 -0.2165063 0.7933534 0.6087614 -0.25 0.8925226 0.6848565 -0.2165063 0.9651195 0.740562 -0.125 0.8838835 0.8838835 0 0.8601998 0.8601999 0.125 0.795495 0.7954952 0.2165063 0.7071067 0.7071068 0.25 0.6187183 0.6187185 0.2165063 0.5540136 0.5540137 0.125 0.53033 0.5303301 0 0.5540136 0.5540137 -0.125 0.6187183 0.6187185 -0.2165063 0.7071067 0.7071068 -0.25 0.795495 0.7954952 -0.2165063 0.8601998 0.8601999 -0.125 0.7609519 0.9916915 0 0.7405623 0.9651193 0.125 0.6848567 0.8925223 0.2165063 0.6087616 0.7933532 0.25 0.5326663 0.6941841 0.2165063 0.4769608 0.6215872 0.125 0.4565712 0.5950149 0 0.4769608 0.6215872 -0.125 0.5326663 0.6941841 -0.2165063 0.6087616 0.7933532 -0.25 0.6848567 0.8925223 -0.2165063 0.7405623 0.9651193 -0.125 0.625 1.082532 0 0.6082533 1.053525 0.125 0.5625 0.9742786 0.2165063 0.5 0.8660254 0.25 0.4375 0.7577722 0.2165063 0.3917468 0.6785254 0.125 0.375 0.649519 0 0.3917468 0.6785254 -0.125 0.4375 0.7577722 -0.2165063 0.5 0.8660254 -0.25 0.5625 0.9742786 -0.2165063 0.6082533 1.053525 -0.125 0.4783545 1.154849 0 0.465537 1.123905 0.125 0.4305191 1.039364 0.2165063 0.3826836 0.9238794 0.25 0.3348482 0.8083945 0.2165063 0.2998301 0.7238536 0.125 0.2870127 0.6929096 0 0.2998301 0.7238536 -0.125 0.3348482 0.8083945 -0.2165063 0.3826836 0.9238794 -0.25 0.4305191 1.039364 -0.2165063 0.465537 1.123905 -0.125 0.3235238 1.207407 0 0.314855 1.175055 0.125 0.2911714 1.086666 0.2165063 0.258819 0.9659258 0.25 0.2264666 0.8451851 0.2165063 0.202783 0.7567967 0.125 0.1941142 0.7244443 0 0.202783 0.7567967 -0.125 0.2264666 0.8451851 -0.2165063 0.258819 0.9659258 -0.25 0.2911714 1.086666 -0.2165063 0.314855 1.175055 -0.125 0.1631575 1.239306 0 0.1587857 1.206099 0.125 0.1468418 1.115375 0.2165063 0.130526 0.9914449 0.25 0.1142103 0.8675143 0.2165063 0.1022663 0.7767907 0.125 0.09789454 0.7435837 0 0.1022663 0.7767907 -0.125 0.1142103 0.8675143 -0.2165063 0.130526 0.9914449 -0.25 0.1468418 1.115375 -0.2165063 0.1587857 1.206099 -0.125 0 1.25 0 1.19209e-7 1.216506 0.125 1.19209e-7 1.125 0.2165063 0 1 0.25 0 0.8750001 0.2165063 0 0.7834937 0.125 0 0.75 0 0 0.7834937 -0.125 0 0.8750001 -0.2165063 0 1 -0.25 1.19209e-7 1.125 -0.2165063 1.19209e-7 1.216506 -0.125 -0.1631579 1.239306 0 -0.1587861 1.206099 0.125 -0.1468421 1.115375 0.2165063 -0.1305264 0.9914448 0.25 -0.1142106 0.8675143 0.2165063 -0.1022665 0.7767907 0.125 -0.09789478 0.7435836 0 -0.1022665 0.7767907 -0.125 -0.1142106 0.8675143 -0.2165063 -0.1305264 0.9914448 -0.25 -0.1468421 1.115375 -0.2165063 -0.1587861 1.206099 -0.125 -0.3235237 1.207407 0 -0.3148549 1.175055 0.125 -0.2911713 1.086667 0.2165063 -0.2588189 0.9659259 0.25 -0.2264665 0.8451852 0.2165063 -0.202783 0.7567968 0.125 -0.1941142 0.7244444 0 -0.202783 0.7567968 -0.125 -0.2264665 0.8451852 -0.2165063 -0.2588189 0.9659259 -0.25 -0.2911713 1.086667 -0.2165063 -0.3148549 1.175055 -0.125 -0.4783545 1.154849 0 -0.465537 1.123905 0.125 -0.430519 1.039364 0.2165063 -0.3826835 0.9238795 0.25 -0.3348481 0.8083946 0.2165063 -0.2998301 0.7238537 0.125 -0.2870126 0.6929097 0 -0.2998301 0.7238537 -0.125 -0.3348481 0.8083946 -0.2165063 -0.3826835 0.9238795 -0.25 -0.430519 1.039364 -0.2165063 -0.465537 1.123905 -0.125 -0.6249999 1.082532 0 -0.6082531 1.053525 0.125 -0.5625 0.9742787 0.2165063 -0.5 0.8660255 0.25 -0.4374999 0.7577723 0.2165063 -0.3917467 0.6785255 0.125 -0.3749999 0.6495191 0 -0.3917467 0.6785255 -0.125 -0.4374999 0.7577723 -0.2165063 -0.5 0.8660255 -0.25 -0.5625 0.9742787 -0.2165063 -0.6082531 1.053525 -0.125 -0.7609518 0.9916917 0 -0.7405623 0.9651194 0.125 -0.6848567 0.8925225 0.2165063 -0.6087615 0.7933533 0.25 -0.5326663 0.6941842 0.2165063 -0.4769608 0.6215873 0.125 -0.4565711 0.595015 0 -0.4769608 0.6215873 -0.125 -0.5326663 0.6941842 -0.2165063 -0.6087615 0.7933533 -0.25 -0.6848567 0.8925225 -0.2165063 -0.7405623 0.9651194 -0.125 -0.8838836 0.8838832 0 -0.8602001 0.8601997 0.125 -0.7954953 0.7954949 0.2165063 -0.707107 0.7071066 0.25 -0.6187186 0.6187183 0.2165063 -0.5540138 0.5540135 0.125 -0.5303302 0.53033 0 -0.5540138 0.5540135 -0.125 -0.6187186 0.6187183 -0.2165063 -0.707107 0.7071066 -0.25 -0.7954953 0.7954949 -0.2165063 -0.8602001 0.8601997 -0.125 -0.9916916 0.7609518 0 -0.9651194 0.7405622 0.125 -0.8925225 0.6848567 0.2165063 -0.7933533 0.6087614 0.25 -0.6941842 0.5326663 0.2165063 -0.6215873 0.4769607 0.125 -0.595015 0.4565711 0 -0.6215873 0.4769607 -0.125 -0.6941842 0.5326663 -0.2165063 -0.7933533 0.6087614 -0.25 -0.8925225 0.6848567 -0.2165063 -0.9651194 0.7405622 -0.125 -1.082532 0.6250004 0 -1.053525 0.6082535 0.125 -0.9742786 0.5625004 0.2165063 -0.8660253 0.5000003 0.25 -0.7577722 0.4375002 0.2165063 -0.6785253 0.3917471 0.125 -0.649519 0.3750002 0 -0.6785253 0.3917471 -0.125 -0.7577722 0.4375002 -0.2165063 -0.8660253 0.5000003 -0.25 -0.9742786 0.5625004 -0.2165063 -1.053525 0.6082535 -0.125 -1.154849 0.4783543 0 -1.123905 0.4655369 0.125 -1.039364 0.4305189 0.2165063 -0.9238795 0.3826835 0.25 -0.8083945 0.3348481 0.2165063 -0.7238537 0.2998301 0.125 -0.6929095 0.2870126 0 -0.7238537 0.2998301 -0.125 -0.8083945 0.3348481 -0.2165063 -0.9238795 0.3826835 -0.25 -1.039364 0.4305189 -0.2165063 -1.123905 0.4655369 -0.125 -1.207407 0.3235237 0 -1.175055 0.3148549 0.125 -1.086667 0.2911713 0.2165063 -0.9659259 0.2588189 0.25 -0.8451852 0.2264665 0.2165063 -0.7567967 0.2027829 0.125 -0.7244445 0.1941142 0 -0.7567967 0.2027829 -0.125 -0.8451852 0.2264665 -0.2165063 -0.9659259 0.2588189 -0.25 -1.086667 0.2911713 -0.2165063 -1.175055 0.3148549 -0.125 -1.239306 0.1631579 0 -1.206099 0.1587861 0.125 -1.115375 0.1468421 0.2165063 -0.9914449 0.1305263 0.25 -0.8675143 0.1142105 0.2165063 -0.7767907 0.1022665 0.125 -0.7435837 0.09789472 0 -0.7767907 0.1022665 -0.125 -0.8675143 0.1142105 -0.2165063 -0.9914449 0.1305263 -0.25 -1.115375 0.1468421 -0.2165063 -1.206099 0.1587861 -0.125 -1.25 0 0 -1.216506 0 0.125 -1.125 0 0.2165063 -1 0 0.25 -0.875 0 0.2165063 -0.7834936 0 0.125 -0.75 0 0 -0.7834936 0 -0.125 -0.875 0 -0.2165063 -1 0 -0.25 -1.125 0 -0.2165063 -1.216506 0 -0.125 -1.239306 -0.1631579 0 -1.206099 -0.1587861 0.125 -1.115375 -0.1468421 0.2165063 -0.9914449 -0.1305263 0.25 -0.8675143 -0.1142105 0.2165063 -0.7767907 -0.1022665 0.125 -0.7435837 -0.09789472 0 -0.7767907 -0.1022665 -0.125 -0.8675143 -0.1142105 -0.2165063 -0.9914449 -0.1305263 -0.25 -1.115375 -0.1468421 -0.2165063 -1.206099 -0.1587861 -0.125 -1.207407 -0.3235237 0 -1.175055 -0.3148549 0.125 -1.086667 -0.2911713 0.2165063 -0.9659259 -0.2588189 0.25 -0.8451852 -0.2264665 0.2165063 -0.7567967 -0.2027829 0.125 -0.7244445 -0.1941142 0 -0.7567967 -0.2027829 -0.125 -0.8451852 -0.2264665 -0.2165063 -0.9659259 -0.2588189 -0.25 -1.086667 -0.2911713 -0.2165063 -1.175055 -0.3148549 -0.125 -1.15485 -0.4783538 0 -1.123906 -0.4655364 0.125 -1.039365 -0.4305185 0.2165063 -0.9238796 -0.382683 0.25 -0.8083947 -0.3348477 0.2165063 -0.7238538 -0.2998297 0.125 -0.6929097 -0.2870123 0 -0.7238538 -0.2998297 -0.125 -0.8083947 -0.3348477 -0.2165063 -0.9238796 -0.382683 -0.25 -1.039365 -0.4305185 -0.2165063 -1.123906 -0.4655364 -0.125 -1.082532 -0.6249998 0 -1.053526 -0.608253 0.125 -0.9742787 -0.5624998 0.2165063 -0.8660255 -0.4999998 0.25 -0.7577724 -0.4374999 0.2165063 -0.6785255 -0.3917467 0.125 -0.6495192 -0.3749999 0 -0.6785255 -0.3917467 -0.125 -0.7577724 -0.4374999 -0.2165063 -0.8660255 -0.4999998 -0.25 -0.9742787 -0.5624998 -0.2165063 -1.053526 -0.608253 -0.125 -0.9916916 -0.7609518 0 -0.9651194 -0.7405622 0.125 -0.8925225 -0.6848567 0.2165063 -0.7933533 -0.6087614 0.25 -0.6941842 -0.5326663 0.2165063 -0.6215873 -0.4769607 0.125 -0.595015 -0.4565711 0 -0.6215873 -0.4769607 -0.125 -0.6941842 -0.5326663 -0.2165063 -0.7933533 -0.6087614 -0.25 -0.8925225 -0.6848567 -0.2165063 -0.9651194 -0.7405622 -0.125 -0.8838836 -0.8838832 0 -0.8602001 -0.8601997 0.125 -0.7954953 -0.7954949 0.2165063 -0.707107 -0.7071066 0.25 -0.6187186 -0.6187183 0.2165063 -0.5540138 -0.5540135 0.125 -0.5303302 -0.53033 0 -0.5540138 -0.5540135 -0.125 -0.6187186 -0.6187183 -0.2165063 -0.707107 -0.7071066 -0.25 -0.7954953 -0.7954949 -0.2165063 -0.8602001 -0.8601997 -0.125 -0.7609524 -0.9916914 0 -0.7405627 -0.965119 0.125 -0.6848571 -0.8925222 0.2165063 -0.6087619 -0.793353 0.25 -0.5326666 -0.694184 0.2165063 -0.476961 -0.621587 0.125 -0.4565714 -0.5950148 0 -0.476961 -0.621587 -0.125 -0.5326666 -0.694184 -0.2165063 -0.6087619 -0.793353 -0.25 -0.6848571 -0.8925222 -0.2165063 -0.7405627 -0.965119 -0.125 -0.6249999 -1.082532 0 -0.6082531 -1.053525 0.125 -0.5625 -0.9742787 0.2165063 -0.5 -0.8660255 0.25 -0.4374999 -0.7577723 0.2165063 -0.3917467 -0.6785255 0.125 -0.3749999 -0.6495191 0 -0.3917467 -0.6785255 -0.125 -0.4374999 -0.7577723 -0.2165063 -0.5 -0.8660255 -0.25 -0.5625 -0.9742787 -0.2165063 -0.6082531 -1.053525 -0.125 -0.4783545 -1.154849 0 -0.465537 -1.123905 0.125 -0.430519 -1.039364 0.2165063 -0.3826835 -0.9238795 0.25 -0.3348481 -0.8083946 0.2165063 -0.2998301 -0.7238537 0.125 -0.2870126 -0.6929097 0 -0.2998301 -0.7238537 -0.125 -0.3348481 -0.8083946 -0.2165063 -0.3826835 -0.9238795 -0.25 -0.430519 -1.039364 -0.2165063 -0.465537 -1.123905 -0.125 -0.3235242 -1.207407 0 -0.3148553 -1.175055 0.125 -0.2911717 -1.086666 0.2165063 -0.2588194 -0.9659258 0.25 -0.2264668 -0.8451851 0.2165063 -0.2027833 -0.7567967 0.125 -0.1941145 -0.7244443 0 -0.2027833 -0.7567967 -0.125 -0.2264668 -0.8451851 -0.2165063 -0.2588194 -0.9659258 -0.25 -0.2911717 -1.086666 -0.2165063 -0.3148553 -1.175055 -0.125 -0.1631585 -1.239306 0 -0.1587867 -1.206099 0.125 -0.1468426 -1.115375 0.2165063 -0.1305268 -0.9914447 0.25 -0.1142109 -0.8675141 0.2165063 -0.1022669 -0.7767906 0.125 -0.09789508 -0.7435835 0 -0.1022669 -0.7767906 -0.125 -0.1142109 -0.8675141 -0.2165063 -0.1305268 -0.9914447 -0.25 -0.1468426 -1.115375 -0.2165063 -0.1587867 -1.206099 -0.125 0 -1.25 0 1.19209e-7 -1.216506 0.125 1.19209e-7 -1.125 0.2165063 0 -1 0.25 0 -0.8750001 0.2165063 0 -0.7834937 0.125 0 -0.75 0 0 -0.7834937 -0.125 0 -0.8750001 -0.2165063 0 -1 -0.25 1.19209e-7 -1.125 -0.2165063 1.19209e-7 -1.216506 -0.125 0.1631575 -1.239306 0 0.1587857 -1.206099 0.125 0.1468418 -1.115375 0.2165063 0.130526 -0.9914449 0.25 0.1142103 -0.8675143 0.2165063 0.1022663 -0.7767907 0.125 0.09789454 -0.7435837 0 0.1022663 -0.7767907 -0.125 0.1142103 -0.8675143 -0.2165063 0.130526 -0.9914449 -0.25 0.1468418 -1.115375 -0.2165063 0.1587857 -1.206099 -0.125 0.3235232 -1.207407 0 0.3148545 -1.175055 0.125 0.2911709 -1.086667 0.2165063 0.2588186 -0.9659259 0.25 0.2264662 -0.8451852 0.2165063 0.2027827 -0.7567968 0.125 0.1941139 -0.7244445 0 0.2027827 -0.7567968 -0.125 0.2264662 -0.8451852 -0.2165063 0.2588186 -0.9659259 -0.25 0.2911709 -1.086667 -0.2165063 0.3148545 -1.175055 -0.125 0.4783545 -1.154849 0 0.465537 -1.123905 0.125 0.4305191 -1.039364 0.2165063 0.3826836 -0.9238794 0.25 0.3348482 -0.8083945 0.2165063 0.2998301 -0.7238536 0.125 0.2870127 -0.6929096 0 0.2998301 -0.7238536 -0.125 0.3348482 -0.8083945 -0.2165063 0.3826836 -0.9238794 -0.25 0.4305191 -1.039364 -0.2165063 0.465537 -1.123905 -0.125 0.625 -1.082532 0 0.6082533 -1.053525 0.125 0.5625 -0.9742786 0.2165063 0.5 -0.8660254 0.25 0.4375 -0.7577722 0.2165063 0.3917468 -0.6785254 0.125 0.375 -0.649519 0 0.3917468 -0.6785254 -0.125 0.4375 -0.7577722 -0.2165063 0.5 -0.8660254 -0.25 0.5625 -0.9742786 -0.2165063 0.6082533 -1.053525 -0.125 0.7609515 -0.991692 0 0.740562 -0.9651196 0.125 0.6848564 -0.8925228 0.2165063 0.6087613 -0.7933536 0.25 0.5326662 -0.6941843 0.2165063 0.4769605 -0.6215875 0.125 0.4565709 -0.5950151 0 0.4769605 -0.6215875 -0.125 0.5326662 -0.6941843 -0.2165063 0.6087613 -0.7933536 -0.25 0.6848564 -0.8925228 -0.2165063 0.740562 -0.9651196 -0.125 0.883883 -0.883884 0 0.8601993 -0.8602004 0.125 0.7954947 -0.7954956 0.2165063 0.7071064 -0.7071072 0.25 0.6187182 -0.6187188 0.2165063 0.5540134 -0.554014 0.125 0.5303298 -0.5303304 0 0.5540134 -0.554014 -0.125 0.6187182 -0.6187188 -0.2165063 0.7071064 -0.7071072 -0.25 0.7954947 -0.7954956 -0.2165063 0.8601993 -0.8602004 -0.125 0.9916918 -0.7609516 0 0.9651195 -0.740562 0.125 0.8925226 -0.6848565 0.2165063 0.7933534 -0.6087614 0.25 0.6941843 -0.5326662 0.2165063 0.6215874 -0.4769607 0.125 0.5950151 -0.4565711 0 0.6215874 -0.4769607 -0.125 0.6941843 -0.5326662 -0.2165063 0.7933534 -0.6087614 -0.25 0.8925226 -0.6848565 -0.2165063 0.9651195 -0.740562 -0.125 1.082532 -0.6250001 0 1.053525 -0.6082534 0.125 0.9742786 -0.5625001 0.2165063 0.8660253 -0.5000001 0.25 0.7577722 -0.4375001 0.2165063 0.6785253 -0.3917469 0.125 0.649519 -0.3750001 0 0.6785253 -0.3917469 -0.125 0.7577722 -0.4375001 -0.2165063 0.8660253 -0.5000001 -0.25 0.9742786 -0.5625001 -0.2165063 1.053525 -0.6082534 -0.125 1.154849 -0.4783548 0 1.123905 -0.4655373 0.125 1.039364 -0.4305193 0.2165063 0.9238794 -0.3826838 0.25 0.8083944 -0.3348483 0.2165063 0.7238536 -0.2998303 0.125 0.6929095 -0.2870128 0 0.7238536 -0.2998303 -0.125 0.8083944 -0.3348483 -0.2165063 0.9238794 -0.3826838 -0.25 1.039364 -0.4305193 -0.2165063 1.123905 -0.4655373 -0.125 1.207407 -0.3235235 0 1.175055 -0.3148547 0.125 1.086667 -0.2911711 0.2165063 0.9659259 -0.2588188 0.25 0.8451852 -0.2264664 0.2165063 0.7567968 -0.2027828 0.125 0.7244445 -0.194114 0 0.7567968 -0.2027828 -0.125 0.8451852 -0.2264664 -0.2165063 0.9659259 -0.2588188 -0.25 1.086667 -0.2911711 -0.2165063 1.175055 -0.3148547 -0.125 1.239306 -0.1631577 0 1.206099 -0.1587859 0.125 1.115375 -0.1468419 0.2165063 0.9914449 -0.1305261 0.25 0.8675143 -0.1142104 0.2165063 0.7767907 -0.1022664 0.125 0.7435837 -0.0978946 0 0.7767907 -0.1022664 -0.125 0.8675143 -0.1142104 -0.2165063 0.9914449 -0.1305261 -0.25 1.115375 -0.1468419 -0.2165063 1.206099 -0.1587859 -0.125</float_array>
- <technique_common>
- <accessor source="#Torus-mesh-positions-array" count="576" stride="3">
- <param name="X" type="float"/>
- <param name="Y" type="float"/>
- <param name="Z" type="float"/>
- </accessor>
- </technique_common>
- </source>
- <source id="Torus-mesh-normals">
- <float_array id="Torus-mesh-normals-array" count="1728">1 0 0 0.9914243 0.1304971 0 0.8612323 0.1133762 0.4953764 0.8686484 0 0.4953764 0.503647 0.0662862 0.8613544 0.5079806 0 0.8613544 0.01068145 0.001403808 0.999939 0.010773 0 0.999939 -0.4918058 0 0.8706626 -0.4875942 -0.06418043 0.8706626 -0.8632771 0 0.5047151 -0.8558916 -0.1126743 0.5047151 -0.9999695 0 0 -0.9914243 -0.1304971 0 -0.8632771 0 -0.5047151 -0.8558916 -0.1126743 -0.5047151 -0.4918058 0 -0.8706626 -0.4875942 -0.06418043 -0.8706626 0.010773 0 -0.999939 0.01068145 0.001403808 -0.999939 0.503647 0.0662862 -0.8613544 0.5079806 0 -0.8613544 0.8612323 0.1133762 -0.4953764 0.8686484 0 -0.4953764 0.9659109 0.2587969 0 0.8390454 0.2247993 0.4953764 0.4906766 0.1314737 0.8613544 0.01040679 0.002777159 0.999939 -0.4750511 -0.1272927 0.8706626 -0.8338572 -0.223426 0.5047151 -0.9659109 -0.2587969 0 -0.8338572 -0.223426 -0.5047151 -0.4750511 -0.1272927 -0.8706626 0.01040679 0.002777159 -0.999939 0.4906766 0.1314737 -0.8613544 0.8390454 0.2247993 -0.4953764 0.9238563 0.3826716 0 0.8025453 0.3324076 0.4953764 0.4693136 0.1944029 0.8613544 0.009949028 0.004119992 0.999939 -0.4543595 -0.1882076 0.8706626 -0.7975402 -0.3303629 0.5047151 -0.9238563 -0.3826716 0 -0.7975402 -0.3303629 -0.5047151 -0.4543595 -0.1882076 -0.8706626 0.009949028 0.004119992 -0.999939 0.4693136 0.1944029 -0.8613544 0.8025453 0.3324076 -0.4953764 0.8660237 0.4999848 0 0.7522813 0.4343089 0.4953764 0.4399243 0.253975 0.8613544 0.009308099 0.005371212 0.999939 -0.4259163 -0.2458876 0.8706626 -0.7476119 -0.4316233 0.5047151 -0.8660237 -0.4999848 0 -0.7476119 -0.4316233 -0.5047151 -0.4259163 -0.2458876 -0.8706626 0.009308099 0.005371212 -0.999939 0.4399243 0.253975 -0.8613544 0.7522813 0.4343089 -0.4953764 0.7933287 0.6087527 0 0.6891385 0.5287942 0.4953764 0.4029969 0.309244 0.8613544 0.00854516 0.006561458 0.999939 -0.3901792 -0.2993866 0.8706626 -0.6848659 -0.5255287 0.5047151 -0.7933287 -0.6087527 0 -0.6848659 -0.5255287 -0.5047151 -0.3901792 -0.2993866 -0.8706626 0.00854516 0.006561458 -0.999939 0.4029969 0.309244 -0.8613544 0.6891385 0.5287942 -0.4953764 0.7070834 0.7070834 0 0.6142155 0.6142155 0.4953764 0.3592029 0.3592029 0.8613544 0.007599055 0.007599055 0.999939 -0.3477584 -0.3477584 0.8706626 -0.6104313 -0.6104313 0.5047151 -0.7070834 -0.7070834 0 -0.6104313 -0.6104313 -0.5047151 -0.3477584 -0.3477584 -0.8706626 0.007599055 0.007599055 -0.999939 0.3592029 0.3592029 -0.8613544 0.6142155 0.6142155 -0.4953764 0.6087527 0.7933287 0 0.5287942 0.6891385 0.4953764 0.309244 0.4029969 0.8613544 0.006561458 0.00854516 0.999939 -0.2993866 -0.3901792 0.8706626 -0.5255287 -0.6848659 0.5047151 -0.6087527 -0.7933287 0 -0.5255287 -0.6848659 -0.5047151 -0.2993866 -0.3901792 -0.8706626 0.006561458 0.00854516 -0.999939 0.309244 0.4029969 -0.8613544 0.5287942 0.6891385 -0.4953764 0.4999848 0.8660237 0 0.4343089 0.7522813 0.4953764 0.253975 0.4399243 0.8613544 0.005371212 0.009308099 0.999939 -0.2458876 -0.4259163 0.8706626 -0.4316233 -0.7476119 0.5047151 -0.4999848 -0.8660237 0 -0.4316233 -0.7476119 -0.5047151 -0.2458876 -0.4259163 -0.8706626 0.005371212 0.009308099 -0.999939 0.253975 0.4399243 -0.8613544 0.4343089 0.7522813 -0.4953764 0.3826716 0.9238563 0 0.3324076 0.8025453 0.4953764 0.1944029 0.4693136 0.8613544 0.004119992 0.009949028 0.999939 -0.1882076 -0.4543595 0.8706626 -0.3303629 -0.7975402 0.5047151 -0.3826716 -0.9238563 0 -0.3303629 -0.7975402 -0.5047151 -0.1882076 -0.4543595 -0.8706626 0.004119992 0.009949028 -0.999939 0.1944029 0.4693136 -0.8613544 0.3324076 0.8025453 -0.4953764 0.2587969 0.9659109 0 0.2247993 0.8390454 0.4953764 0.1314737 0.4906766 0.8613544 0.002777159 0.01040679 0.999939 -0.1272927 -0.4750511 0.8706626 -0.223426 -0.8338572 0.5047151 -0.2587969 -0.9659109 0 -0.223426 -0.8338572 -0.5047151 -0.1272927 -0.4750511 -0.8706626 0.002777159 0.01040679 -0.999939 0.1314737 0.4906766 -0.8613544 0.2247993 0.8390454 -0.4953764 0.1304971 0.9914243 0 0.1133762 0.8612323 0.4953764 0.0662862 0.503647 0.8613544 0.001403808 0.01068145 0.999939 -0.06418043 -0.4875942 0.8706626 -0.1126743 -0.8558916 0.5047151 -0.1304971 -0.9914243 0 -0.1126743 -0.8558916 -0.5047151 -0.06418043 -0.4875942 -0.8706626 0.001403808 0.01068145 -0.999939 0.0662862 0.503647 -0.8613544 0.1133762 0.8612323 -0.4953764 0 1 0 0 0.8686484 0.4953764 0 0.5079806 0.8613544 0 0.010773 0.999939 0 -0.4918058 0.8706626 0 -0.8632771 0.5047151 0 -0.9999695 0 0 -0.8632771 -0.5047151 0 -0.4918058 -0.8706626 0 0.010773 -0.999939 0 0.5079806 -0.8613544 0 0.8686484 -0.4953764 -0.1304971 0.9914243 0 -0.1133762 0.8612323 0.4953764 -0.0662862 0.503647 0.8613544 -0.001403808 0.01068145 0.999939 0.06418043 -0.4875942 0.8706626 0.1126743 -0.8558916 0.5047151 0.1304971 -0.9914243 0 0.1126743 -0.8558916 -0.5047151 0.06418043 -0.4875942 -0.8706626 -0.001403808 0.01068145 -0.999939 -0.0662862 0.503647 -0.8613544 -0.1133762 0.8612323 -0.4953764 -0.2587969 0.9659109 0 -0.2247993 0.8390454 0.4953764 -0.1314737 0.4906766 0.8613544 -0.002777159 0.01040679 0.999939 0.1272927 -0.4750511 0.8706626 0.223426 -0.8338572 0.5047151 0.2587969 -0.9659109 0 0.223426 -0.8338572 -0.5047151 0.1272927 -0.4750511 -0.8706626 -0.002777159 0.01040679 -0.999939 -0.1314737 0.4906766 -0.8613544 -0.2247993 0.8390454 -0.4953764 -0.3826716 0.9238563 0 -0.3324076 0.8025453 0.4953764 -0.1944029 0.4693136 0.8613544 -0.004119992 0.009949028 0.999939 0.1882076 -0.4543595 0.8706626 0.3303629 -0.7975402 0.5047151 0.3826716 -0.9238563 0 0.3303629 -0.7975402 -0.5047151 0.1882076 -0.4543595 -0.8706626 -0.004119992 0.009949028 -0.999939 -0.1944029 0.4693136 -0.8613544 -0.3324076 0.8025453 -0.4953764 -0.4999848 0.8660237 0 -0.4343089 0.7522813 0.4953764 -0.253975 0.4399243 0.8613544 -0.005371212 0.009308099 0.999939 0.2458876 -0.4259163 0.8706626 0.4316233 -0.7476119 0.5047151 0.4999848 -0.8660237 0 0.4316233 -0.7476119 -0.5047151 0.2458876 -0.4259163 -0.8706626 -0.005371212 0.009308099 -0.999939 -0.253975 0.4399243 -0.8613544 -0.4343089 0.7522813 -0.4953764 -0.6087527 0.7933287 0 -0.5287942 0.6891385 0.4953764 -0.309244 0.4029969 0.8613544 -0.006561458 0.00854516 0.999939 0.2993866 -0.3901792 0.8706626 0.5255287 -0.6848659 0.5047151 0.6087527 -0.7933287 0 0.5255287 -0.6848659 -0.5047151 0.2993866 -0.3901792 -0.8706626 -0.006561458 0.00854516 -0.999939 -0.309244 0.4029969 -0.8613544 -0.5287942 0.6891385 -0.4953764 -0.7070834 0.7070834 0 -0.6142155 0.6142155 0.4953764 -0.3592029 0.3592029 0.8613544 -0.007599055 0.007599055 0.999939 0.3477584 -0.3477584 0.8706626 0.6104313 -0.6104313 0.5047151 0.7070834 -0.7070834 0 0.6104313 -0.6104313 -0.5047151 0.3477584 -0.3477584 -0.8706626 -0.007599055 0.007599055 -0.999939 -0.3592029 0.3592029 -0.8613544 -0.6142155 0.6142155 -0.4953764 -0.7933287 0.6087527 0 -0.6891385 0.5287942 0.4953764 -0.4029969 0.309244 0.8613544 -0.00854516 0.006561458 0.999939 0.3901792 -0.2993866 0.8706626 0.6848659 -0.5255287 0.5047151 0.7933287 -0.6087527 0 0.6848659 -0.5255287 -0.5047151 0.3901792 -0.2993866 -0.8706626 -0.00854516 0.006561458 -0.999939 -0.4029969 0.309244 -0.8613544 -0.6891385 0.5287942 -0.4953764 -0.8660237 0.4999848 0 -0.7522813 0.4343089 0.4953764 -0.4399243 0.253975 0.8613544 -0.009308099 0.005371212 0.999939 0.4259163 -0.2458876 0.8706626 0.7476119 -0.4316233 0.5047151 0.8660237 -0.4999848 0 0.7476119 -0.4316233 -0.5047151 0.4259163 -0.2458876 -0.8706626 -0.009308099 0.005371212 -0.999939 -0.4399243 0.253975 -0.8613544 -0.7522813 0.4343089 -0.4953764 -0.9238563 0.3826716 0 -0.8025453 0.3324076 0.4953764 -0.4693136 0.1944029 0.8613544 -0.009949028 0.004119992 0.999939 0.4543595 -0.1882076 0.8706626 0.7975402 -0.3303629 0.5047151 0.9238563 -0.3826716 0 0.7975402 -0.3303629 -0.5047151 0.4543595 -0.1882076 -0.8706626 -0.009949028 0.004119992 -0.999939 -0.4693136 0.1944029 -0.8613544 -0.8025453 0.3324076 -0.4953764 -0.9659109 0.2587969 0 -0.8390454 0.2247993 0.4953764 -0.4906766 0.1314737 0.8613544 -0.01040679 0.002777159 0.999939 0.4750511 -0.1272927 0.8706626 0.8338572 -0.223426 0.5047151 0.9659109 -0.2587969 0 0.8338572 -0.223426 -0.5047151 0.4750511 -0.1272927 -0.8706626 -0.01040679 0.002777159 -0.999939 -0.4906766 0.1314737 -0.8613544 -0.8390454 0.2247993 -0.4953764 -0.9914243 0.1304971 0 -0.8612323 0.1133762 0.4953764 -0.503647 0.0662862 0.8613544 -0.01068145 0.001403808 0.999939 0.4875942 -0.06418043 0.8706626 0.8558916 -0.1126743 0.5047151 0.9914243 -0.1304971 0 0.8558916 -0.1126743 -0.5047151 0.4875942 -0.06418043 -0.8706626 -0.01068145 0.001403808 -0.999939 -0.503647 0.0662862 -0.8613544 -0.8612323 0.1133762 -0.4953764 -1 0 0 -0.8686484 0 0.4953764 -0.5079806 0 0.8613544 -0.010773 0 0.999939 0.4918058 0 0.8706626 0.8632771 0 0.5047151 0.9999695 0 0 0.8632771 0 -0.5047151 0.4918058 0 -0.8706626 -0.010773 0 -0.999939 -0.5079806 0 -0.8613544 -0.8686484 0 -0.4953764 -0.9914243 -0.1304971 0 -0.8612323 -0.1133762 0.4953764 -0.503647 -0.0662862 0.8613544 -0.01068145 -0.001403808 0.999939 0.4875942 0.06418043 0.8706626 0.8558916 0.1126743 0.5047151 0.9914243 0.1304971 0 0.8558916 0.1126743 -0.5047151 0.4875942 0.06418043 -0.8706626 -0.01068145 -0.001403808 -0.999939 -0.503647 -0.0662862 -0.8613544 -0.8612323 -0.1133762 -0.4953764 -0.9659109 -0.2587969 0 -0.8390454 -0.2247993 0.4953764 -0.4906766 -0.1314737 0.8613544 -0.01040679 -0.002777159 0.999939 0.4750511 0.1272927 0.8706626 0.8338572 0.223426 0.5047151 0.9659109 0.2587969 0 0.8338572 0.223426 -0.5047151 0.4750511 0.1272927 -0.8706626 -0.01040679 -0.002777159 -0.999939 -0.4906766 -0.1314737 -0.8613544 -0.8390454 -0.2247993 -0.4953764 -0.9238563 -0.3826716 0 -0.8025453 -0.3324076 0.4953764 -0.4693136 -0.1944029 0.8613544 -0.009949028 -0.004119992 0.999939 0.4543595 0.1882076 0.8706626 0.7975402 0.3303323 0.5047151 0.9238563 0.3826716 0 0.7975402 0.3303323 -0.5047151 0.4543595 0.1882076 -0.8706626 -0.009949028 -0.004119992 -0.999939 -0.4693136 -0.1944029 -0.8613544 -0.8025453 -0.3324076 -0.4953764 -0.8660237 -0.4999848 0 -0.7522813 -0.4343089 0.4953764 -0.4399243 -0.253975 0.8613544 -0.009308099 -0.005371212 0.999939 0.4259163 0.2458876 0.8706626 0.7476119 0.4316233 0.5047151 0.8660237 0.4999848 0 0.7476119 0.4316233 -0.5047151 0.4259163 0.2458876 -0.8706626 -0.009308099 -0.005371212 -0.999939 -0.4399243 -0.253975 -0.8613544 -0.7522813 -0.4343089 -0.4953764 -0.7933287 -0.6087527 0 -0.6891385 -0.5287942 0.4953764 -0.4029969 -0.309244 0.8613544 -0.00854516 -0.006561458 0.999939 0.3901792 0.2993866 0.8706626 0.6848659 0.5255287 0.5047151 0.7933287 0.6087527 0 0.6848659 0.5255287 -0.5047151 0.3901792 0.2993866 -0.8706626 -0.00854516 -0.006561458 -0.999939 -0.4029969 -0.309244 -0.8613544 -0.6891385 -0.5287942 -0.4953764 -0.7070834 -0.7070834 0 -0.6142155 -0.6142155 0.4953764 -0.3592029 -0.3592029 0.8613544 -0.007599055 -0.007599055 0.999939 0.3477584 0.3477584 0.8706626 0.6104313 0.6104313 0.5047151 0.7070834 0.7070834 0 0.6104313 0.6104313 -0.5047151 0.3477584 0.3477584 -0.8706626 -0.007599055 -0.007599055 -0.999939 -0.3592029 -0.3592029 -0.8613544 -0.6142155 -0.6142155 -0.4953764 -0.6087527 -0.7933287 0 -0.5287942 -0.6891385 0.4953764 -0.309244 -0.4029969 0.8613544 -0.006561458 -0.00854516 0.999939 0.2993866 0.3901792 0.8706626 0.5255287 0.6848659 0.5047151 0.6087527 0.7933287 0 0.5255287 0.6848659 -0.5047151 0.2993866 0.3901792 -0.8706626 -0.006561458 -0.00854516 -0.999939 -0.309244 -0.4029969 -0.8613544 -0.5287942 -0.6891385 -0.4953764 -0.4999848 -0.8660237 0 -0.4343089 -0.7522813 0.4953764 -0.253975 -0.4399243 0.8613544 -0.005371212 -0.009308099 0.999939 0.2458876 0.4259163 0.8706626 0.4316233 0.7476119 0.5047151 0.4999848 0.8660237 0 0.4316233 0.7476119 -0.5047151 0.2458876 0.4259163 -0.8706626 -0.005371212 -0.009308099 -0.999939 -0.253975 -0.4399243 -0.8613544 -0.4343089 -0.7522813 -0.4953764 -0.3826716 -0.9238563 0 -0.3324076 -0.8025453 0.4953764 -0.1944029 -0.4693136 0.8613544 -0.004119992 -0.009949028 0.999939 0.1882076 0.4543595 0.8706626 0.3303629 0.7975402 0.5047151 0.3826716 0.9238563 0 0.3303629 0.7975402 -0.5047151 0.1882076 0.4543595 -0.8706626 -0.004119992 -0.009949028 -0.999939 -0.1944029 -0.4693136 -0.8613544 -0.3324076 -0.8025453 -0.4953764 -0.2587969 -0.9659109 0 -0.2247993 -0.8390454 0.4953764 -0.1314737 -0.4906766 0.8613544 -0.002777159 -0.01040679 0.999939 0.1272927 0.4750511 0.8706626 0.223426 0.8338572 0.5047151 0.2587969 0.9659109 0 0.223426 0.8338572 -0.5047151 0.1272927 0.4750511 -0.8706626 -0.002777159 -0.01040679 -0.999939 -0.1314737 -0.4906766 -0.8613544 -0.2247993 -0.8390454 -0.4953764 -0.1304971 -0.9914243 0 -0.1133762 -0.8612323 0.4953764 -0.0662862 -0.503647 0.8613544 -0.001403808 -0.01068145 0.999939 0.06418043 0.4875942 0.8706626 0.1126743 0.8558916 0.5047151 0.1304971 0.9914243 0 0.1126743 0.8558916 -0.5047151 0.06418043 0.4875942 -0.8706626 -0.001403808 -0.01068145 -0.999939 -0.0662862 -0.503647 -0.8613544 -0.1133762 -0.8612323 -0.4953764 0 -1 0 0 -0.8686484 0.4953764 0 -0.5079806 0.8613544 0 -0.010773 0.999939 0 0.4918058 0.8706626 0 0.8632771 0.5047151 0 0.9999695 0 0 0.8632771 -0.5047151 0 0.4918058 -0.8706626 0 -0.010773 -0.999939 0 -0.5079806 -0.8613544 0 -0.8686484 -0.4953764 0.1304971 -0.9914243 0 0.1133762 -0.8612323 0.4953764 0.0662862 -0.503647 0.8613544 0.001403808 -0.01068145 0.999939 -0.06418043 0.4875942 0.8706626 -0.1126743 0.8558916 0.5047151 -0.1304971 0.9914243 0 -0.1126743 0.8558916 -0.5047151 -0.06418043 0.4875942 -0.8706626 0.001403808 -0.01068145 -0.999939 0.0662862 -0.503647 -0.8613544 0.1133762 -0.8612323 -0.4953764 0.2587969 -0.9659109 0 0.2247993 -0.8390454 0.4953764 0.1314737 -0.4906766 0.8613544 0.002777159 -0.01040679 0.999939 -0.1272927 0.4750511 0.8706626 -0.223426 0.8338572 0.5047151 -0.2587969 0.9659109 0 -0.223426 0.8338572 -0.5047151 -0.1272927 0.4750511 -0.8706626 0.002777159 -0.01040679 -0.999939 0.1314737 -0.4906766 -0.8613544 0.2247993 -0.8390454 -0.4953764 0.3826716 -0.9238563 0 0.3324076 -0.8025453 0.4953764 0.1944029 -0.4693136 0.8613544 0.004119992 -0.009949028 0.999939 -0.1882076 0.4543595 0.8706626 -0.3303629 0.7975402 0.5047151 -0.3826716 0.9238563 0 -0.3303629 0.7975402 -0.5047151 -0.1882076 0.4543595 -0.8706626 0.004119992 -0.009949028 -0.999939 0.1944029 -0.4693136 -0.8613544 0.3324076 -0.8025453 -0.4953764 0.4999848 -0.8660237 0 0.4343089 -0.7522813 0.4953764 0.253975 -0.4399243 0.8613544 0.005371212 -0.009308099 0.999939 -0.2458876 0.4259163 0.8706626 -0.4316233 0.7476119 0.5047151 -0.4999848 0.8660237 0 -0.4316233 0.7476119 -0.5047151 -0.2458876 0.4259163 -0.8706626 0.005371212 -0.009308099 -0.999939 0.253975 -0.4399243 -0.8613544 0.4343089 -0.7522813 -0.4953764 0.6087527 -0.7933287 0 0.5287942 -0.6891385 0.4953764 0.309244 -0.4029969 0.8613544 0.006561458 -0.00854516 0.999939 -0.2993866 0.3901792 0.8706626 -0.5255287 0.6848659 0.5047151 -0.6087527 0.7933287 0 -0.5255287 0.6848659 -0.5047151 -0.2993866 0.3901792 -0.8706626 0.006561458 -0.00854516 -0.999939 0.309244 -0.4029969 -0.8613544 0.5287942 -0.6891385 -0.4953764 0.7070834 -0.7070834 0 0.6142155 -0.6142155 0.4953764 0.3592029 -0.3592029 0.8613544 0.007599055 -0.007599055 0.999939 -0.3477584 0.3477584 0.8706626 -0.6104007 0.6104313 0.5047151 -0.7070834 0.7070834 0 -0.6104007 0.6104313 -0.5047151 -0.3477584 0.3477584 -0.8706626 0.007599055 -0.007599055 -0.999939 0.3592029 -0.3592029 -0.8613544 0.6142155 -0.6142155 -0.4953764 0.7933287 -0.6087527 0 0.6891385 -0.5287942 0.4953764 0.4029969 -0.309244 0.8613544 0.00854516 -0.006561458 0.999939 -0.3901792 0.2993866 0.8706626 -0.6848659 0.5255287 0.5047151 -0.7933287 0.6087527 0 -0.6848659 0.5255287 -0.5047151 -0.3901792 0.2993866 -0.8706626 0.00854516 -0.006561458 -0.999939 0.4029969 -0.309244 -0.8613544 0.6891385 -0.5287942 -0.4953764 0.8660237 -0.4999848 0 0.7522813 -0.4343089 0.4953764 0.4399243 -0.253975 0.8613544 0.009308099 -0.005371212 0.999939 -0.4259163 0.2458876 0.8706626 -0.7476119 0.4316233 0.5047151 -0.8660237 0.4999848 0 -0.7476119 0.4316233 -0.5047151 -0.4259163 0.2458876 -0.8706626 0.009308099 -0.005371212 -0.999939 0.4399243 -0.253975 -0.8613544 0.7522813 -0.4343089 -0.4953764 0.9238563 -0.3826716 0 0.8025453 -0.3324076 0.4953764 0.4693136 -0.1944029 0.8613544 0.009949028 -0.004119992 0.999939 -0.4543595 0.1882076 0.8706626 -0.7975402 0.3303629 0.5047151 -0.9238563 0.3826716 0 -0.7975402 0.3303629 -0.5047151 -0.4543595 0.1882076 -0.8706626 0.009949028 -0.004119992 -0.999939 0.4693136 -0.1944029 -0.8613544 0.8025453 -0.3324076 -0.4953764 0.9659109 -0.2587969 0 0.8390454 -0.2247993 0.4953764 0.4906766 -0.1314737 0.8613544 0.01040679 -0.002777159 0.999939 -0.4750511 0.1272927 0.8706626 -0.8338572 0.223426 0.5047151 -0.9659109 0.2587969 0 -0.8338572 0.223426 -0.5047151 -0.4750511 0.1272927 -0.8706626 0.01040679 -0.002777159 -0.999939 0.4906766 -0.1314737 -0.8613544 0.8390454 -0.2247993 -0.4953764 0.9914243 -0.1304971 0 0.8612323 -0.1133762 0.4953764 0.503647 -0.0662862 0.8613544 0.01068145 -0.001403808 0.999939 -0.4875942 0.06418043 0.8706626 -0.8558916 0.1126743 0.5047151 -0.9914243 0.1304971 0 -0.8558916 0.1126743 -0.5047151 -0.4875942 0.06418043 -0.8706626 0.01068145 -0.001403808 -0.999939 0.503647 -0.0662862 -0.8613544 0.8612323 -0.1133762 -0.4953764</float_array>
- <technique_common>
- <accessor source="#Torus-mesh-normals-array" count="576" stride="3">
- <param name="X" type="float"/>
- <param name="Y" type="float"/>
- <param name="Z" type="float"/>
- </accessor>
- </technique_common>
- </source>
- <vertices id="Torus-mesh-vertices">
- <input semantic="POSITION" source="#Torus-mesh-positions"/>
- </vertices>
- <polylist material="Material_002-material" count="1152">
- <input semantic="VERTEX" source="#Torus-mesh-vertices" offset="0"/>
- <input semantic="NORMAL" source="#Torus-mesh-normals" offset="1"/>
- <vcount>3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
- <p>0 0 12 1 13 2 1 3 13 2 14 4 2 5 14 4 15 6 3 7 15 6 4 8 4 8 16 9 5 10 5 10 17 11 6 12 6 12 18 13 7 14 7 14 19 15 8 16 8 16 20 17 9 18 9 18 21 19 22 20 10 21 22 20 23 22 0 0 11 23 23 22 12 1 24 24 25 25 13 2 25 25 26 26 14 4 26 26 27 27 15 6 27 27 16 9 16 9 28 28 17 11 17 11 29 29 18 13 18 13 30 30 19 15 19 15 31 31 20 17 20 17 32 32 21 19 21 19 33 33 34 34 22 20 34 34 35 35 23 22 35 35 24 24 24 24 36 36 37 37 25 25 37 37 38 38 26 26 38 38 39 39 27 27 39 39 28 28 28 28 40 40 29 29 29 29 41 41 30 30 30 30 42 42 31 31 31 31 43 43 32 32 32 32 44 44 33 33 33 33 45 45 46 46 34 34 46 46 47 47 35 35 47 47 36 36 36 36 48 48 49 49 37 37 49 49 50 50 38 38 50 50 51 51 39 39 51 51 40 40 40 40 52 52 41 41 41 41 53 53 42 42 42 42 54 54 43 43 43 43 55 55 44 44 44 44 56 56 45 45 45 45 57 57 58 58 46 46 58 58 59 59 47 47 59 59 48 48 48 48 60 60 61 61 49 49 61 61 62 62 50 50 62 62 63 63 51 51 63 63 52 52 52 52 64 64 53 53 53 53 65 65 54 54 54 54 66 66 55 55 55 55 67 67 56 56 56 56 68 68 69 69 57 57 69 69 70 70 58 58 70 70 71 71 59 59 71 71 60 60 60 60 72 72 73 73 61 61 73 73 74 74 62 62 74 74 75 75 63 63 75 75 76 76 64 64 76 76 77 77 65 65 77 77 66 66 66 66 78 78 67 67 67 67 79 79 68 68 68 68 80 80 69 69 69 69 81 81 82 82 70 70 82 82 83 83 71 71 83 83 72 72 72 72 84 84 85 85 73 73 85 85 86 86 74 74 86 86 87 87 75 75 87 87 76 76 76 76 88 88 77 77 77 77 89 89 78 78 78 78 90 90 79 79 79 79 91 91 80 80 80 80 92 92 81 81 81 81 93 93 94 94 82 82 94 94 95 95 83 83 95 95 84 84 84 84 96 96 97 97 85 85 97 97 98 98 86 86 98 98 99 99 87 87 99 99 88 88 88 88 100 100 89 89 89 89 101 101 90 90 90 90 102 102 91 91 91 91 103 103 92 92 92 92 104 104 93 93 93 93 105 105 106 106 94 94 106 106 107 107 95 95 107 107 96 96 96 96 108 108 109 109 97 97 109 109 98 98 98 98 110 110 111 111 99 99 111 111 100 100 100 100 112 112 101 101 101 101 113 113 102 102 102 102 114 114 103 103 103 103 115 115 104 104 104 104 116 116 105 105 105 105 117 117 118 118 106 106 118 118 119 119 107 107 119 119 108 108 108 108 120 120 121 121 109 109 121 121 122 122 110 110 122 122 123 123 111 111 123 123 112 112 112 112 124 124 113 113 113 113 125 125 114 114 114 114 126 126 115 115 115 115 127 127 116 116 116 116 128 128 117 117 117 117 129 129 130 130 118 118 130 130 131 131 119 119 131 131 120 120 120 120 132 132 133 133 121 121 133 133 134 134 122 122 134 134 135 135 123 123 135 135 124 124 124 124 136 136 125 125 125 125 137 137 126 126 126 126 138 138 127 127 127 127 139 139 128 128 128 128 140 140 129 129 129 129 141 141 130 130 130 130 142 142 143 143 131 131 143 143 132 132 132 132 144 144 145 145 133 133 145 145 146 146 134 134 146 146 147 147 135 135 147 147 136 136 136 136 148 148 137 137 137 137 149 149 138 138 138 138 150 150 139 139 139 139 151 151 152 152 140 140 152 152 141 141 141 141 153 153 154 154 142 142 154 154 155 155 143 143 155 155 144 144 144 144 156 156 145 145 145 145 157 157 146 146 146 146 158 158 147 147 147 147 159 159 160 160 148 148 160 160 161 161 149 149 161 161 162 162 150 150 162 162 163 163 151 151 163 163 164 164 152 152 164 164 165 165 153 153 165 165 154 154 154 154 166 166 155 155 155 155 167 167 144 144 156 156 168 168 157 157 157 157 169 169 158 158 158 158 170 170 159 159 159 159 171 171 172 172 160 160 172 172 173 173 161 161 173 173 174 174 162 162 174 174 175 175 163 163 175 175 176 176 164 164 176 176 177 177 165 165 177 177 166 166 166 166 178 178 167 167 167 167 179 179 156 156 168 168 180 180 169 169 169 169 181 181 170 170 170 170 182 182 171 171 171 171 183 183 172 172 172 172 184 184 185 185 173 173 185 185 186 186 174 174 186 186 187 187 175 175 187 187 188 188 176 176 188 188 189 189 177 177 189 189 178 178 178 178 190 190 179 179 179 179 191 191 168 168 180 180 192 192 181 181 181 181 193 193 182 182 182 182 194 194 183 183 183 183 195 195 196 196 184 184 196 196 197 197 185 185 197 197 198 198 186 186 198 198 199 199 187 187 199 199 200 200 188 188 200 200 201 201 189 189 201 201 190 190 190 190 202 202 203 203 191 191 203 203 180 180 192 192 204 204 205 205 193 193 205 205 194 194 194 194 206 206 195 195 195 195 207 207 208 208 196 196 208 208 209 209 197 197 209 209 210 210 198 198 210 210 211 211 199 199 211 211 212 212 200 200 212 212 213 213 201 201 213 213 202 202 202 202 214 214 203 203 203 203 215 215 192 192 204 204 216 216 217 217 205 205 217 217 206 206 206 206 218 218 207 207 207 207 219 219 220 220 208 208 220 220 209 209 209 209 221 221 222 222 210 210 222 222 223 223 211 211 223 223 224 224 212 212 224 224 225 225 213 213 225 225 214 214 214 214 226 226 215 215 215 215 227 227 204 204 216 216 228 228 217 217 217 217 229 229 218 218 218 218 230 230 219 219 219 219 231 231 232 232 220 220 232 232 233 233 221 221 233 233 234 234 222 222 234 234 235 235 223 223 235 235 236 236 224 224 236 236 237 237 225 225 237 237 226 226 226 226 238 238 239 239 227 227 239 239 216 216 228 228 240 240 229 229 229 229 241 241 230 230 230 230 242 242 231 231 231 231 243 243 244 244 232 232 244 244 245 245 233 233 245 245 246 246 234 234 246 246 247 247 235 235 247 247 236 236 236 236 248 248 249 249 237 237 249 249 250 250 238 238 250 250 251 251 239 239 251 251 228 228 240 240 252 252 253 253 241 241 253 253 254 254 242 242 254 254 255 255 243 243 255 255 244 244 244 244 256 256 245 245 245 245 257 257 258 258 246 246 258 258 259 259 247 247 259 259 260 260 248 248 260 260 261 261 249 249 261 261 250 250 250 250 262 262 251 251 251 251 263 263 240 240 252 252 264 264 253 253 253 253 265 265 254 254 254 254 266 266 255 255 255 255 267 267 268 268 256 256 268 268 269 269 257 257 269 269 270 270 258 258 270 270 271 271 259 259 271 271 260 260 260 260 272 272 261 261 261 261 273 273 274 274 262 262 274 274 275 275 263 263 275 275 252 252 264 264 276 276 265 265 265 265 277 277 266 266 266 266 278 278 267 267 267 267 279 279 280 280 268 268 280 280 281 281 269 269 281 281 282 282 270 270 282 282 283 283 271 271 283 283 284 284 272 272 284 284 285 285 273 273 285 285 274 274 274 274 286 286 275 275 275 275 287 287 264 264 276 276 288 288 277 277 277 277 289 289 278 278 278 278 290 290 279 279 279 279 291 291 292 292 280 280 292 292 293 293 281 281 293 293 294 294 282 282 294 294 295 295 283 283 295 295 296 296 284 284 296 296 297 297 285 285 297 297 286 286 286 286 298 298 287 287 287 287 299 299 276 276 288 288 300 300 289 289 289 289 301 301 290 290 290 290 302 302 291 291 291 291 303 303 304 304 292 292 304 304 305 305 293 293 305 305 306 306 294 294 306 306 307 307 295 295 307 307 308 308 296 296 308 308 309 309 297 297 309 309 298 298 298 298 310 310 299 299 299 299 311 311 288 288 300 300 312 312 301 301 301 301 313 313 302 302 302 302 314 314 303 303 303 303 315 315 316 316 304 304 316 316 317 317 305 305 317 317 318 318 306 306 318 318 319 319 307 307 319 319 320 320 308 308 320 320 321 321 309 309 321 321 310 310 310 310 322 322 311 311 311 311 323 323 300 300 312 312 324 324 313 313 313 313 325 325 326 326 314 314 326 326 327 327 315 315 327 327 316 316 316 316 328 328 329 329 317 317 329 329 330 330 318 318 330 330 331 331 319 319 331 331 332 332 320 320 332 332 333 333 321 321 333 333 322 322 322 322 334 334 323 323 323 323 335 335 312 312 324 324 336 336 325 325 325 325 337 337 326 326 326 326 338 338 327 327 327 327 339 339 340 340 328 328 340 340 341 341 329 329 341 341 342 342 330 330 342 342 343 343 331 331 343 343 332 332 332 332 344 344 333 333 333 333 345 345 334 334 334 334 346 346 335 335 335 335 347 347 336 336 336 336 348 348 337 337 337 337 349 349 338 338 338 338 350 350 339 339 339 339 351 351 352 352 340 340 352 352 341 341 341 341 353 353 354 354 342 342 354 354 355 355 343 343 355 355 356 356 344 344 356 356 357 357 345 345 357 357 346 346 346 346 358 358 347 347 347 347 359 359 336 336 348 348 360 360 349 349 349 349 361 361 362 362 350 350 362 362 351 351 351 351 363 363 364 364 352 352 364 364 365 365 353 353 365 365 366 366 354 354 366 366 367 367 355 355 367 367 368 368 356 356 368 368 369 369 357 357 369 369 358 358 358 358 370 370 359 359 359 359 371 371 348 348 360 360 372 372 361 361 361 361 373 373 362 362 362 362 374 374 363 363 363 363 375 375 376 376 364 364 376 376 377 377 365 365 377 377 378 378 366 366 378 378 379 379 367 367 379 379 380 380 368 368 380 380 381 381 369 369 381 381 382 382 370 370 382 382 371 371 371 371 383 383 360 360 372 372 384 384 373 373 373 373 385 385 374 374 374 374 386 386 375 375 375 375 387 387 376 376 376 376 388 388 389 389 377 377 389 389 390 390 378 378 390 390 391 391 379 379 391 391 392 392 380 380 392 392 393 393 381 381 393 393 382 382 382 382 394 394 383 383 383 383 395 395 372 372 384 384 396 396 385 385 385 385 397 397 398 398 386 386 398 398 387 387 387 387 399 399 400 400 388 388 400 400 401 401 389 389 401 401 402 402 390 390 402 402 403 403 391 391 403 403 404 404 392 392 404 404 405 405 393 393 405 405 394 394 394 394 406 406 395 395 395 395 407 407 384 384 396 396 408 408 397 397 397 397 409 409 398 398 398 398 410 410 399 399 399 399 411 411 412 412 400 400 412 412 413 413 401 401 413 413 414 414 402 402 414 414 415 415 403 403 415 415 416 416 404 404 416 416 417 417 405 405 417 417 406 406 406 406 418 418 407 407 407 407 419 419 396 396 408 408 420 420 409 409 409 409 421 421 410 410 410 410 422 422 423 423 411 411 423 423 412 412 412 412 424 424 425 425 413 413 425 425 426 426 414 414 426 426 427 427 415 415 427 427 428 428 416 416 428 428 429 429 417 417 429 429 418 418 418 418 430 430 419 419 419 419 431 431 408 408 420 420 432 432 421 421 421 421 433 433 422 422 422 422 434 434 423 423 423 423 435 435 436 436 424 424 436 436 437 437 425 425 437 437 438 438 426 426 438 438 439 439 427 427 439 439 428 428 428 428 440 440 429 429 429 429 441 441 442 442 430 430 442 442 431 431 431 431 443 443 420 420 432 432 444 444 445 445 433 433 445 445 446 446 434 434 446 446 447 447 435 435 447 447 436 436 436 436 448 448 449 449 437 437 449 449 438 438 438 438 450 450 439 439 439 439 451 451 440 440 440 440 452 452 441 441 441 441 453 453 454 454 442 442 454 454 455 455 443 443 455 455 444 444 444 444 456 456 457 457 445 445 457 457 458 458 446 446 458 458 459 459 447 447 459 459 448 448 448 448 460 460 449 449 449 449 461 461 450 450 450 450 462 462 451 451 451 451 463 463 452 452 452 452 464 464 453 453 453 453 465 465 466 466 454 454 466 466 467 467 455 455 467 467 456 456 456 456 468 468 469 469 457 457 469 469 470 470 458 458 470 470 459 459 459 459 471 471 460 460 460 460 472 472 461 461 461 461 473 473 462 462 462 462 474 474 463 463 463 463 475 475 464 464 464 464 476 476 465 465 465 465 477 477 478 478 466 466 478 478 479 479 467 467 479 479 468 468 468 468 480 480 481 481 469 469 481 481 482 482 470 470 482 482 483 483 471 471 483 483 472 472 472 472 484 484 473 473 473 473 485 485 474 474 474 474 486 486 475 475 475 475 487 487 476 476 476 476 488 488 477 477 477 477 489 489 490 490 478 478 490 490 479 479 479 479 491 491 480 480 480 480 492 492 493 493 481 481 493 493 494 494 482 482 494 494 495 495 483 483 495 495 484 484 484 484 496 496 485 485 485 485 497 497 486 486 486 486 498 498 487 487 487 487 499 499 500 500 488 488 500 500 501 501 489 489 501 501 490 490 490 490 502 502 503 503 491 491 503 503 492 492 492 492 504 504 505 505 493 493 505 505 506 506 494 494 506 506 507 507 495 495 507 507 496 496 496 496 508 508 497 497 497 497 509 509 498 498 498 498 510 510 499 499 499 499 511 511 500 500 500 500 512 512 501 501 501 501 513 513 514 514 502 502 514 514 515 515 503 503 515 515 504 504 504 504 516 516 517 517 505 505 517 517 518 518 506 506 518 518 519 519 507 507 519 519 508 508 508 508 520 520 509 509 509 509 521 521 510 510 510 510 522 522 511 511 511 511 523 523 512 512 512 512 524 524 513 513 513 513 525 525 526 526 514 514 526 526 527 527 515 515 527 527 516 516 516 516 528 528 529 529 517 517 529 529 530 530 518 518 530 530 531 531 519 519 531 531 532 532 520 520 532 532 521 521 521 521 533 533 522 522 522 522 534 534 523 523 523 523 535 535 524 524 524 524 536 536 525 525 525 525 537 537 538 538 526 526 538 538 539 539 527 527 539 539 528 528 528 528 540 540 541 541 529 529 541 541 530 530 530 530 542 542 543 543 531 531 543 543 532 532 532 532 544 544 533 533 533 533 545 545 534 534 534 534 546 546 535 535 535 535 547 547 536 536 536 536 548 548 537 537 537 537 549 549 550 550 538 538 550 550 551 551 539 539 551 551 540 540 540 540 552 552 553 553 541 541 553 553 554 554 542 542 554 554 555 555 543 543 555 555 544 544 544 544 556 556 545 545 545 545 557 557 546 546 546 546 558 558 547 547 547 547 559 559 548 548 548 548 560 560 549 549 549 549 561 561 562 562 550 550 562 562 563 563 551 551 563 563 552 552 552 552 564 564 565 565 553 553 565 565 566 566 554 554 566 566 567 567 555 555 567 567 556 556 556 556 568 568 557 557 557 557 569 569 558 558 558 558 570 570 559 559 559 559 571 571 560 560 560 560 572 572 561 561 561 561 573 573 574 574 562 562 574 574 575 575 563 563 575 575 564 564 564 564 0 0 1 3 565 565 1 3 2 5 566 566 2 5 3 7 567 567 3 7 568 568 568 568 4 8 569 569 569 569 5 10 570 570 570 570 6 12 571 571 571 571 7 14 572 572 572 572 8 16 573 573 573 573 9 18 10 21 574 574 10 21 11 23 575 575 11 23 0 0 1 3 0 0 13 2 2 5 1 3 14 4 3 7 2 5 15 6 15 6 16 9 4 8 16 9 17 11 5 10 17 11 18 13 6 12 18 13 19 15 7 14 19 15 20 17 8 16 20 17 21 19 9 18 10 21 9 18 22 20 11 23 10 21 23 22 12 1 0 0 23 22 13 2 12 1 25 25 14 4 13 2 26 26 15 6 14 4 27 27 27 27 28 28 16 9 28 28 29 29 17 11 29 29 30 30 18 13 30 30 31 31 19 15 31 31 32 32 20 17 32 32 33 33 21 19 22 20 21 19 34 34 23 22 22 20 35 35 12 1 23 22 24 24 25 25 24 24 37 37 26 26 25 25 38 38 27 27 26 26 39 39 39 39 40 40 28 28 40 40 41 41 29 29 41 41 42 42 30 30 42 42 43 43 31 31 43 43 44 44 32 32 44 44 45 45 33 33 34 34 33 33 46 46 35 35 34 34 47 47 24 24 35 35 36 36 37 37 36 36 49 49 38 38 37 37 50 50 39 39 38 38 51 51 51 51 52 52 40 40 52 52 53 53 41 41 53 53 54 54 42 42 54 54 55 55 43 43 55 55 56 56 44 44 56 56 57 57 45 45 46 46 45 45 58 58 47 47 46 46 59 59 36 36 47 47 48 48 49 49 48 48 61 61 50 50 49 49 62 62 51 51 50 50 63 63 63 63 64 64 52 52 64 64 65 65 53 53 65 65 66 66 54 54 66 66 67 67 55 55 67 67 68 68 56 56 57 57 56 56 69 69 58 58 57 57 70 70 59 59 58 58 71 71 48 48 59 59 60 60 61 61 60 60 73 73 62 62 61 61 74 74 63 63 62 62 75 75 64 64 63 63 76 76 65 65 64 64 77 77 77 77 78 78 66 66 78 78 79 79 67 67 79 79 80 80 68 68 80 80 81 81 69 69 70 70 69 69 82 82 71 71 70 70 83 83 60 60 71 71 72 72 73 73 72 72 85 85 74 74 73 73 86 86 75 75 74 74 87 87 87 87 88 88 76 76 88 88 89 89 77 77 89 89 90 90 78 78 90 90 91 91 79 79 91 91 92 92 80 80 92 92 93 93 81 81 82 82 81 81 94 94 83 83 82 82 95 95 72 72 83 83 84 84 85 85 84 84 97 97 86 86 85 85 98 98 87 87 86 86 99 99 99 99 100 100 88 88 100 100 101 101 89 89 101 101 102 102 90 90 102 102 103 103 91 91 103 103 104 104 92 92 104 104 105 105 93 93 94 94 93 93 106 106 95 95 94 94 107 107 84 84 95 95 96 96 97 97 96 96 109 109 109 109 110 110 98 98 99 99 98 98 111 111 111 111 112 112 100 100 112 112 113 113 101 101 113 113 114 114 102 102 114 114 115 115 103 103 115 115 116 116 104 104 116 116 117 117 105 105 106 106 105 105 118 118 107 107 106 106 119 119 96 96 107 107 108 108 109 109 108 108 121 121 110 110 109 109 122 122 111 111 110 110 123 123 123 123 124 124 112 112 124 124 125 125 113 113 125 125 126 126 114 114 126 126 127 127 115 115 127 127 128 128 116 116 128 128 129 129 117 117 118 118 117 117 130 130 119 119 118 118 131 131 108 108 119 119 120 120 121 121 120 120 133 133 122 122 121 121 134 134 123 123 122 122 135 135 135 135 136 136 124 124 136 136 137 137 125 125 137 137 138 138 126 126 138 138 139 139 127 127 139 139 140 140 128 128 140 140 141 141 129 129 141 141 142 142 130 130 131 131 130 130 143 143 120 120 131 131 132 132 133 133 132 132 145 145 134 134 133 133 146 146 135 135 134 134 147 147 147 147 148 148 136 136 148 148 149 149 137 137 149 149 150 150 138 138 150 150 151 151 139 139 140 140 139 139 152 152 152 152 153 153 141 141 142 142 141 141 154 154 143 143 142 142 155 155 132 132 143 143 144 144 156 156 157 157 145 145 157 157 158 158 146 146 158 158 159 159 147 147 148 148 147 147 160 160 149 149 148 148 161 161 150 150 149 149 162 162 151 151 150 150 163 163 152 152 151 151 164 164 153 153 152 152 165 165 165 165 166 166 154 154 166 166 167 167 155 155 167 167 156 156 144 144 168 168 169 169 157 157 169 169 170 170 158 158 170 170 171 171 159 159 160 160 159 159 172 172 161 161 160 160 173 173 162 162 161 161 174 174 163 163 162 162 175 175 164 164 163 163 176 176 165 165 164 164 177 177 177 177 178 178 166 166 178 178 179 179 167 167 179 179 168 168 156 156 180 180 181 181 169 169 181 181 182 182 170 170 182 182 183 183 171 171 183 183 184 184 172 172 173 173 172 172 185 185 174 174 173 173 186 186 175 175 174 174 187 187 176 176 175 175 188 188 177 177 176 176 189 189 189 189 190 190 178 178 190 190 191 191 179 179 191 191 180 180 168 168 192 192 193 193 181 181 193 193 194 194 182 182 194 194 195 195 183 183 184 184 183 183 196 196 185 185 184 184 197 197 186 186 185 185 198 198 187 187 186 186 199 199 188 188 187 187 200 200 189 189 188 188 201 201 201 201 202 202 190 190 191 191 190 190 203 203 203 203 192 192 180 180 193 193 192 192 205 205 205 205 206 206 194 194 206 206 207 207 195 195 196 196 195 195 208 208 197 197 196 196 209 209 198 198 197 197 210 210 199 199 198 198 211 211 200 200 199 199 212 212 201 201 200 200 213 213 213 213 214 214 202 202 214 214 215 215 203 203 215 215 204 204 192 192 205 205 204 204 217 217 217 217 218 218 206 206 218 218 219 219 207 207 208 208 207 207 220 220 220 220 221 221 209 209 210 210 209 209 222 222 211 211 210 210 223 223 212 212 211 211 224 224 213 213 212 212 225 225 225 225 226 226 214 214 226 226 227 227 215 215 227 227 216 216 204 204 228 228 229 229 217 217 229 229 230 230 218 218 230 230 231 231 219 219 220 220 219 219 232 232 221 221 220 220 233 233 222 222 221 221 234 234 223 223 222 222 235 235 224 224 223 223 236 236 225 225 224 224 237 237 237 237 238 238 226 226 227 227 226 226 239 239 239 239 228 228 216 216 240 240 241 241 229 229 241 241 242 242 230 230 242 242 243 243 231 231 232 232 231 231 244 244 233 233 232 232 245 245 234 234 233 233 246 246 235 235 234 234 247 247 247 247 248 248 236 236 237 237 236 236 249 249 238 238 237 237 250 250 239 239 238 238 251 251 251 251 240 240 228 228 241 241 240 240 253 253 242 242 241 241 254 254 243 243 242 242 255 255 255 255 256 256 244 244 256 256 257 257 245 245 246 246 245 245 258 258 247 247 246 246 259 259 248 248 247 247 260 260 249 249 248 248 261 261 261 261 262 262 250 250 262 262 263 263 251 251 263 263 252 252 240 240 264 264 265 265 253 253 265 265 266 266 254 254 266 266 267 267 255 255 256 256 255 255 268 268 257 257 256 256 269 269 258 258 257 257 270 270 259 259 258 258 271 271 271 271 272 272 260 260 272 272 273 273 261 261 262 262 261 261 274 274 263 263 262 262 275 275 275 275 264 264 252 252 276 276 277 277 265 265 277 277 278 278 266 266 278 278 279 279 267 267 268 268 267 267 280 280 269 269 268 268 281 281 270 270 269 269 282 282 271 271 270 270 283 283 272 272 271 271 284 284 273 273 272 272 285 285 285 285 286 286 274 274 286 286 287 287 275 275 287 287 276 276 264 264 288 288 289 289 277 277 289 289 290 290 278 278 290 290 291 291 279 279 280 280 279 279 292 292 281 281 280 280 293 293 282 282 281 281 294 294 283 283 282 282 295 295 284 284 283 283 296 296 285 285 284 284 297 297 297 297 298 298 286 286 298 298 299 299 287 287 299 299 288 288 276 276 300 300 301 301 289 289 301 301 302 302 290 290 302 302 303 303 291 291 292 292 291 291 304 304 293 293 292 292 305 305 294 294 293 293 306 306 295 295 294 294 307 307 296 296 295 295 308 308 297 297 296 296 309 309 309 309 310 310 298 298 310 310 311 311 299 299 311 311 300 300 288 288 312 312 313 313 301 301 313 313 314 314 302 302 314 314 315 315 303 303 304 304 303 303 316 316 305 305 304 304 317 317 306 306 305 305 318 318 307 307 306 306 319 319 308 308 307 307 320 320 309 309 308 308 321 321 321 321 322 322 310 310 322 322 323 323 311 311 323 323 312 312 300 300 324 324 325 325 313 313 314 314 313 313 326 326 315 315 314 314 327 327 327 327 328 328 316 316 317 317 316 316 329 329 318 318 317 317 330 330 319 319 318 318 331 331 320 320 319 319 332 332 321 321 320 320 333 333 333 333 334 334 322 322 334 334 335 335 323 323 335 335 324 324 312 312 336 336 337 337 325 325 337 337 338 338 326 326 338 338 339 339 327 327 328 328 327 327 340 340 329 329 328 328 341 341 330 330 329 329 342 342 331 331 330 330 343 343 343 343 344 344 332 332 344 344 345 345 333 333 345 345 346 346 334 334 346 346 347 347 335 335 324 324 335 335 336 336 348 348 349 349 337 337 349 349 350 350 338 338 350 350 351 351 339 339 340 340 339 339 352 352 352 352 353 353 341 341 342 342 341 341 354 354 343 343 342 342 355 355 344 344 343 343 356 356 345 345 344 344 357 357 357 357 358 358 346 346 358 358 359 359 347 347 359 359 348 348 336 336 360 360 361 361 349 349 350 350 349 349 362 362 362 362 363 363 351 351 352 352 351 351 364 364 353 353 352 352 365 365 354 354 353 353 366 366 355 355 354 354 367 367 356 356 355 355 368 368 357 357 356 356 369 369 369 369 370 370 358 358 370 370 371 371 359 359 371 371 360 360 348 348 372 372 373 373 361 361 373 373 374 374 362 362 374 374 375 375 363 363 364 364 363 363 376 376 365 365 364 364 377 377 366 366 365 365 378 378 367 367 366 366 379 379 368 368 367 367 380 380 369 369 368 368 381 381 370 370 369 369 382 382 382 382 383 383 371 371 383 383 372 372 360 360 384 384 385 385 373 373 385 385 386 386 374 374 386 386 387 387 375 375 387 387 388 388 376 376 377 377 376 376 389 389 378 378 377 377 390 390 379 379 378 378 391 391 380 380 379 379 392 392 381 381 380 380 393 393 393 393 394 394 382 382 394 394 395 395 383 383 395 395 384 384 372 372 396 396 397 397 385 385 386 386 385 385 398 398 398 398 399 399 387 387 388 388 387 387 400 400 389 389 388 388 401 401 390 390 389 389 402 402 391 391 390 390 403 403 392 392 391 391 404 404 393 393 392 392 405 405 405 405 406 406 394 394 406 406 407 407 395 395 407 407 396 396 384 384 408 408 409 409 397 397 409 409 410 410 398 398 410 410 411 411 399 399 400 400 399 399 412 412 401 401 400 400 413 413 402 402 401 401 414 414 403 403 402 402 415 415 404 404 403 403 416 416 405 405 404 404 417 417 417 417 418 418 406 406 418 418 419 419 407 407 419 419 408 408 396 396 420 420 421 421 409 409 421 421 422 422 410 410 411 411 410 410 423 423 423 423 424 424 412 412 413 413 412 412 425 425 414 414 413 413 426 426 415 415 414 414 427 427 416 416 415 415 428 428 417 417 416 416 429 429 429 429 430 430 418 418 430 430 431 431 419 419 431 431 420 420 408 408 432 432 433 433 421 421 433 433 434 434 422 422 434 434 435 435 423 423 424 424 423 423 436 436 425 425 424 424 437 437 426 426 425 425 438 438 427 427 426 426 439 439 439 439 440 440 428 428 440 440 441 441 429 429 430 430 429 429 442 442 442 442 443 443 431 431 443 443 432 432 420 420 433 433 432 432 445 445 434 434 433 433 446 446 435 435 434 434 447 447 447 447 448 448 436 436 437 437 436 436 449 449 449 449 450 450 438 438 450 450 451 451 439 439 451 451 452 452 440 440 452 452 453 453 441 441 442 442 441 441 454 454 443 443 442 442 455 455 432 432 443 443 444 444 445 445 444 444 457 457 446 446 445 445 458 458 447 447 446 446 459 459 459 459 460 460 448 448 460 460 461 461 449 449 461 461 462 462 450 450 462 462 463 463 451 451 463 463 464 464 452 452 464 464 465 465 453 453 454 454 453 453 466 466 455 455 454 454 467 467 444 444 455 455 456 456 457 457 456 456 469 469 458 458 457 457 470 470 470 470 471 471 459 459 471 471 472 472 460 460 472 472 473 473 461 461 473 473 474 474 462 462 474 474 475 475 463 463 475 475 476 476 464 464 476 476 477 477 465 465 466 466 465 465 478 478 467 467 466 466 479 479 456 456 467 467 468 468 469 469 468 468 481 481 470 470 469 469 482 482 471 471 470 470 483 483 483 483 484 484 472 472 484 484 485 485 473 473 485 485 486 486 474 474 486 486 487 487 475 475 487 487 488 488 476 476 488 488 489 489 477 477 478 478 477 477 490 490 490 490 491 491 479 479 468 468 479 479 480 480 481 481 480 480 493 493 482 482 481 481 494 494 483 483 482 482 495 495 495 495 496 496 484 484 496 496 497 497 485 485 497 497 498 498 486 486 498 498 499 499 487 487 488 488 487 487 500 500 489 489 488 488 501 501 501 501 502 502 490 490 491 491 490 490 503 503 480 480 491 491 492 492 493 493 492 492 505 505 494 494 493 493 506 506 495 495 494 494 507 507 507 507 508 508 496 496 508 508 509 509 497 497 509 509 510 510 498 498 510 510 511 511 499 499 511 511 512 512 500 500 512 512 513 513 501 501 502 502 501 501 514 514 503 503 502 502 515 515 492 492 503 503 504 504 505 505 504 504 517 517 506 506 505 505 518 518 507 507 506 506 519 519 519 519 520 520 508 508 520 520 521 521 509 509 521 521 522 522 510 510 522 522 523 523 511 511 523 523 524 524 512 512 524 524 525 525 513 513 514 514 513 513 526 526 515 515 514 514 527 527 504 504 515 515 516 516 517 517 516 516 529 529 518 518 517 517 530 530 519 519 518 518 531 531 520 520 519 519 532 532 532 532 533 533 521 521 533 533 534 534 522 522 534 534 535 535 523 523 535 535 536 536 524 524 536 536 537 537 525 525 526 526 525 525 538 538 527 527 526 526 539 539 516 516 527 527 528 528 529 529 528 528 541 541 541 541 542 542 530 530 531 531 530 530 543 543 543 543 544 544 532 532 544 544 545 545 533 533 545 545 546 546 534 534 546 546 547 547 535 535 547 547 548 548 536 536 548 548 549 549 537 537 538 538 537 537 550 550 539 539 538 538 551 551 528 528 539 539 540 540 541 541 540 540 553 553 542 542 541 541 554 554 543 543 542 542 555 555 555 555 556 556 544 544 556 556 557 557 545 545 557 557 558 558 546 546 558 558 559 559 547 547 559 559 560 560 548 548 560 560 561 561 549 549 550 550 549 549 562 562 551 551 550 550 563 563 540 540 551 551 552 552 553 553 552 552 565 565 554 554 553 553 566 566 555 555 554 554 567 567 567 567 568 568 556 556 568 568 569 569 557 557 569 569 570 570 558 558 570 570 571 571 559 559 571 571 572 572 560 560 572 572 573 573 561 561 562 562 561 561 574 574 563 563 562 562 575 575 552 552 563 563 564 564 565 565 564 564 1 3 566 566 565 565 2 5 567 567 566 566 3 7 3 7 4 8 568 568 4 8 5 10 569 569 5 10 6 12 570 570 6 12 7 14 571 571 7 14 8 16 572 572 8 16 9 18 573 573 574 574 573 573 10 21 575 575 574 574 11 23 564 564 575 575 0 0</p>
- </polylist>
- </mesh>
- <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>
- </geometry>
- <geometry id="Suzanne-mesh" name="Suzanne">
- <mesh>
- <source id="Suzanne-mesh-positions">
- <float_array id="Suzanne-mesh-positions-array" count="1521">0.4375 0.1640625 0.765625 -0.4375 0.1640625 0.765625 0.5 0.09375 0.6875 -0.5 0.09375 0.6875 0.546875 0.0546875 0.578125 -0.546875 0.0546875 0.578125 0.3515625 -0.0234375 0.6171875 -0.3515625 -0.0234375 0.6171875 0.3515625 0.03125 0.71875 -0.3515625 0.03125 0.71875 0.3515625 0.1328125 0.78125 -0.3515625 0.1328125 0.78125 0.2734375 0.1640625 0.796875 -0.2734375 0.1640625 0.796875 0.203125 0.09375 0.7421875 -0.203125 0.09375 0.7421875 0.15625 0.0546875 0.6484375 -0.15625 0.0546875 0.6484375 0.078125 0.2421875 0.65625 -0.078125 0.2421875 0.65625 0.140625 0.2421875 0.7421875 -0.140625 0.2421875 0.7421875 0.2421875 0.2421875 0.796875 -0.2421875 0.2421875 0.796875 0.2734375 0.328125 0.796875 -0.2734375 0.328125 0.796875 0.203125 0.390625 0.7421875 -0.203125 0.390625 0.7421875 0.15625 0.4375 0.6484375 -0.15625 0.4375 0.6484375 0.3515625 0.515625 0.6171875 -0.3515625 0.515625 0.6171875 0.3515625 0.453125 0.71875 -0.3515625 0.453125 0.71875 0.3515625 0.359375 0.78125 -0.3515625 0.359375 0.78125 0.4375 0.328125 0.765625 -0.4375 0.328125 0.765625 0.5 0.390625 0.6875 -0.5 0.390625 0.6875 0.546875 0.4375 0.578125 -0.546875 0.4375 0.578125 0.625 0.2421875 0.5625 -0.625 0.2421875 0.5625 0.5625 0.2421875 0.671875 -0.5625 0.2421875 0.671875 0.46875 0.2421875 0.7578125 -0.46875 0.2421875 0.7578125 0.4765625 0.2421875 0.7734375 -0.4765625 0.2421875 0.7734375 0.4453125 0.3359375 0.78125 -0.4453125 0.3359375 0.78125 0.3515625 0.375 0.8046875 -0.3515625 0.375 0.8046875 0.265625 0.3359375 0.8203125 -0.265625 0.3359375 0.8203125 0.2265625 0.2421875 0.8203125 -0.2265625 0.2421875 0.8203125 0.265625 0.15625 0.8203125 -0.265625 0.15625 0.8203125 0.3515625 0.2421875 0.828125 -0.3515625 0.2421875 0.828125 0.3515625 0.1171875 0.8046875 -0.3515625 0.1171875 0.8046875 0.4453125 0.15625 0.78125 -0.4453125 0.15625 0.78125 0 0.4296875 0.7421875 0 0.3515625 0.8203125 0 -0.6796875 0.734375 0 -0.3203125 0.78125 0 -0.1875 0.796875 0 -0.7734375 0.71875 0 0.40625 0.6015625 0 0.5703125 0.5703125 0 0.8984375 -0.546875 0 0.5625 -0.8515625 0 0.0703125 -0.828125 0 -0.3828125 -0.3515625 0.203125 -0.1875 0.5625 -0.203125 -0.1875 0.5625 0.3125 -0.4375 0.5703125 -0.3125 -0.4375 0.5703125 0.3515625 -0.6953125 0.5703125 -0.3515625 -0.6953125 0.5703125 0.3671875 -0.890625 0.53125 -0.3671875 -0.890625 0.53125 0.328125 -0.9453125 0.5234375 -0.328125 -0.9453125 0.5234375 0.1796875 -0.96875 0.5546875 -0.1796875 -0.96875 0.5546875 0 -0.984375 0.578125 0.4375 -0.140625 0.53125 -0.4375 -0.140625 0.53125 0.6328125 -0.0390625 0.5390625 -0.6328125 -0.0390625 0.5390625 0.828125 0.1484375 0.4453125 -0.828125 0.1484375 0.4453125 0.859375 0.4296875 0.59375 -0.859375 0.4296875 0.59375 0.7109375 0.484375 0.625 -0.7109375 0.484375 0.625 0.4921875 0.6015625 0.6875 -0.4921875 0.6015625 0.6875 0.3203125 0.7578125 0.734375 -0.3203125 0.7578125 0.734375 0.15625 0.71875 0.7578125 -0.15625 0.71875 0.7578125 0.0625 0.4921875 0.75 -0.0625 0.4921875 0.75 0.1640625 0.4140625 0.7734375 -0.1640625 0.4140625 0.7734375 0.125 0.3046875 0.765625 -0.125 0.3046875 0.765625 0.203125 0.09375 0.7421875 -0.203125 0.09375 0.7421875 0.375 0.015625 0.703125 -0.375 0.015625 0.703125 0.4921875 0.0625 0.671875 -0.4921875 0.0625 0.671875 0.625 0.1875 0.6484375 -0.625 0.1875 0.6484375 0.640625 0.296875 0.6484375 -0.640625 0.296875 0.6484375 0.6015625 0.375 0.6640625 -0.6015625 0.375 0.6640625 0.4296875 0.4375 0.71875 -0.4296875 0.4375 0.71875 0.25 0.46875 0.7578125 -0.25 0.46875 0.7578125 0 -0.765625 0.734375 0.109375 -0.71875 0.734375 -0.109375 -0.71875 0.734375 0.1171875 -0.8359375 0.7109375 -0.1171875 -0.8359375 0.7109375 0.0625 -0.8828125 0.6953125 -0.0625 -0.8828125 0.6953125 0 -0.890625 0.6875 0 -0.1953125 0.75 0 -0.140625 0.7421875 0.1015625 -0.1484375 0.7421875 -0.1015625 -0.1484375 0.7421875 0.125 -0.2265625 0.75 -0.125 -0.2265625 0.75 0.0859375 -0.2890625 0.7421875 -0.0859375 -0.2890625 0.7421875 0.3984375 -0.046875 0.671875 -0.3984375 -0.046875 0.671875 0.6171875 0.0546875 0.625 -0.6171875 0.0546875 0.625 0.7265625 0.203125 0.6015625 -0.7265625 0.203125 0.6015625 0.7421875 0.375 0.65625 -0.7421875 0.375 0.65625 0.6875 0.4140625 0.7265625 -0.6875 0.4140625 0.7265625 0.4375 0.546875 0.796875 -0.4375 0.546875 0.796875 0.3125 0.640625 0.8359375 -0.3125 0.640625 0.8359375 0.203125 0.6171875 0.8515625 -0.203125 0.6171875 0.8515625 0.1015625 0.4296875 0.84375 -0.1015625 0.4296875 0.84375 0.125 -0.1015625 0.8125 -0.125 -0.1015625 0.8125 0.2109375 -0.4453125 0.7109375 -0.2109375 -0.4453125 0.7109375 0.25 -0.703125 0.6875 -0.25 -0.703125 0.6875 0.265625 -0.8203125 0.6640625 -0.265625 -0.8203125 0.6640625 0.234375 -0.9140625 0.6328125 -0.234375 -0.9140625 0.6328125 0.1640625 -0.9296875 0.6328125 -0.1640625 -0.9296875 0.6328125 0 -0.9453125 0.640625 0 0.046875 0.7265625 0 0.2109375 0.765625 0.328125 0.4765625 0.7421875 -0.328125 0.4765625 0.7421875 0.1640625 0.140625 0.75 -0.1640625 0.140625 0.75 0.1328125 0.2109375 0.7578125 -0.1328125 0.2109375 0.7578125 0.1171875 -0.6875 0.734375 -0.1171875 -0.6875 0.734375 0.078125 -0.4453125 0.75 -0.078125 -0.4453125 0.75 0 -0.4453125 0.75 0 -0.328125 0.7421875 0.09375 -0.2734375 0.78125 -0.09375 -0.2734375 0.78125 0.1328125 -0.2265625 0.796875 -0.1328125 -0.2265625 0.796875 0.109375 -0.1328125 0.78125 -0.109375 -0.1328125 0.78125 0.0390625 -0.125 0.78125 -0.0390625 -0.125 0.78125 0 -0.203125 0.828125 0.046875 -0.1484375 0.8125 -0.046875 -0.1484375 0.8125 0.09375 -0.15625 0.8125 -0.09375 -0.15625 0.8125 0.109375 -0.2265625 0.828125 -0.109375 -0.2265625 0.828125 0.078125 -0.25 0.8046875 -0.078125 -0.25 0.8046875 0 -0.2890625 0.8046875 0.2578125 -0.3125 0.5546875 -0.2578125 -0.3125 0.5546875 0.1640625 -0.2421875 0.7109375 -0.1640625 -0.2421875 0.7109375 0.1796875 -0.3125 0.7109375 -0.1796875 -0.3125 0.7109375 0.234375 -0.25 0.5546875 -0.234375 -0.25 0.5546875 0 -0.875 0.6875 0.046875 -0.8671875 0.6875 -0.046875 -0.8671875 0.6875 0.09375 -0.8203125 0.7109375 -0.09375 -0.8203125 0.7109375 0.09375 -0.7421875 0.7265625 -0.09375 -0.7421875 0.7265625 0 -0.78125 0.65625 0.09375 -0.75 0.6640625 -0.09375 -0.75 0.6640625 0.09375 -0.8125 0.640625 -0.09375 -0.8125 0.640625 0.046875 -0.8515625 0.6328125 -0.046875 -0.8515625 0.6328125 0 -0.859375 0.6328125 0.171875 0.21875 0.78125 -0.171875 0.21875 0.78125 0.1875 0.15625 0.7734375 -0.1875 0.15625 0.7734375 0.3359375 0.4296875 0.7578125 -0.3359375 0.4296875 0.7578125 0.2734375 0.421875 0.7734375 -0.2734375 0.421875 0.7734375 0.421875 0.3984375 0.7734375 -0.421875 0.3984375 0.7734375 0.5625 0.3515625 0.6953125 -0.5625 0.3515625 0.6953125 0.5859375 0.2890625 0.6875 -0.5859375 0.2890625 0.6875 0.578125 0.1953125 0.6796875 -0.578125 0.1953125 0.6796875 0.4765625 0.1015625 0.71875 -0.4765625 0.1015625 0.71875 0.375 0.0625 0.7421875 -0.375 0.0625 0.7421875 0.2265625 0.109375 0.78125 -0.2265625 0.109375 0.78125 0.1796875 0.296875 0.78125 -0.1796875 0.296875 0.78125 0.2109375 0.375 0.78125 -0.2109375 0.375 0.78125 0.234375 0.359375 0.7578125 -0.234375 0.359375 0.7578125 0.1953125 0.296875 0.7578125 -0.1953125 0.296875 0.7578125 0.2421875 0.125 0.7578125 -0.2421875 0.125 0.7578125 0.375 0.0859375 0.7265625 -0.375 0.0859375 0.7265625 0.4609375 0.1171875 0.703125 -0.4609375 0.1171875 0.703125 0.546875 0.2109375 0.671875 -0.546875 0.2109375 0.671875 0.5546875 0.28125 0.671875 -0.5546875 0.28125 0.671875 0.53125 0.3359375 0.6796875 -0.53125 0.3359375 0.6796875 0.4140625 0.390625 0.75 -0.4140625 0.390625 0.75 0.28125 0.3984375 0.765625 -0.28125 0.3984375 0.765625 0.3359375 0.40625 0.75 -0.3359375 0.40625 0.75 0.203125 0.171875 0.75 -0.203125 0.171875 0.75 0.1953125 0.2265625 0.75 -0.1953125 0.2265625 0.75 0.109375 0.4609375 0.609375 -0.109375 0.4609375 0.609375 0.1953125 0.6640625 0.6171875 -0.1953125 0.6640625 0.6171875 0.3359375 0.6875 0.59375 -0.3359375 0.6875 0.59375 0.484375 0.5546875 0.5546875 -0.484375 0.5546875 0.5546875 0.6796875 0.453125 0.4921875 -0.6796875 0.453125 0.4921875 0.796875 0.40625 0.4609375 -0.796875 0.40625 0.4609375 0.7734375 0.1640625 0.375 -0.7734375 0.1640625 0.375 0.6015625 0 0.4140625 -0.6015625 0 0.4140625 0.4375 -0.09375 0.46875 -0.4375 -0.09375 0.46875 0 0.8984375 0.2890625 0 0.984375 -0.078125 0 -0.1953125 -0.671875 0 -0.4609375 0.1875 0 -0.9765625 0.4609375 0 -0.8046875 0.34375 0 -0.5703125 0.3203125 0 -0.484375 0.28125 0.8515625 0.234375 0.0546875 -0.8515625 0.234375 0.0546875 0.859375 0.3203125 -0.046875 -0.859375 0.3203125 -0.046875 0.7734375 0.265625 -0.4375 -0.7734375 0.265625 -0.4375 0.4609375 0.4375 -0.703125 -0.4609375 0.4375 -0.703125 0.734375 -0.046875 0.0703125 -0.734375 -0.046875 0.0703125 0.59375 -0.125 -0.1640625 -0.59375 -0.125 -0.1640625 0.640625 -0.0078125 -0.4296875 -0.640625 -0.0078125 -0.4296875 0.3359375 0.0546875 -0.6640625 -0.3359375 0.0546875 -0.6640625 0.234375 -0.3515625 0.40625 -0.234375 -0.3515625 0.40625 0.1796875 -0.4140625 0.2578125 -0.1796875 -0.4140625 0.2578125 0.2890625 -0.7109375 0.3828125 -0.2890625 -0.7109375 0.3828125 0.25 -0.5 0.390625 -0.25 -0.5 0.390625 0.328125 -0.9140625 0.3984375 -0.328125 -0.9140625 0.3984375 0.140625 -0.7578125 0.3671875 -0.140625 -0.7578125 0.3671875 0.125 -0.5390625 0.359375 -0.125 -0.5390625 0.359375 0.1640625 -0.9453125 0.4375 -0.1640625 -0.9453125 0.4375 0.21875 -0.28125 0.4296875 -0.21875 -0.28125 0.4296875 0.2109375 -0.2265625 0.46875 -0.2109375 -0.2265625 0.46875 0.203125 -0.171875 0.5 -0.203125 -0.171875 0.5 0.2109375 -0.390625 0.1640625 -0.2109375 -0.390625 0.1640625 0.296875 -0.3125 -0.265625 -0.296875 -0.3125 -0.265625 0.34375 -0.1484375 -0.5390625 -0.34375 -0.1484375 -0.5390625 0.453125 0.8671875 -0.3828125 -0.453125 0.8671875 -0.3828125 0.453125 0.9296875 -0.0703125 -0.453125 0.9296875 -0.0703125 0.453125 0.8515625 0.234375 -0.453125 0.8515625 0.234375 0.4609375 0.5234375 0.4296875 -0.4609375 0.5234375 0.4296875 0.7265625 0.40625 0.3359375 -0.7265625 0.40625 0.3359375 0.6328125 0.453125 0.28125 -0.6328125 0.453125 0.28125 0.640625 0.703125 0.0546875 -0.640625 0.703125 0.0546875 0.796875 0.5625 0.125 -0.796875 0.5625 0.125 0.796875 0.6171875 -0.1171875 -0.796875 0.6171875 -0.1171875 0.640625 0.75 -0.1953125 -0.640625 0.75 -0.1953125 0.640625 0.6796875 -0.4453125 -0.640625 0.6796875 -0.4453125 0.796875 0.5390625 -0.359375 -0.796875 0.5390625 -0.359375 0.6171875 0.328125 -0.5859375 -0.6171875 0.328125 -0.5859375 0.484375 0.0234375 -0.546875 -0.484375 0.0234375 -0.546875 0.8203125 0.328125 -0.203125 -0.8203125 0.328125 -0.203125 0.40625 -0.171875 0.1484375 -0.40625 -0.171875 0.1484375 0.4296875 -0.1953125 -0.2109375 -0.4296875 -0.1953125 -0.2109375 0.890625 0.40625 -0.234375 -0.890625 0.40625 -0.234375 0.7734375 -0.140625 -0.125 -0.7734375 -0.140625 -0.125 1.039062 -0.1015625 -0.328125 -1.039062 -0.1015625 -0.328125 1.28125 0.0546875 -0.4296875 -1.28125 0.0546875 -0.4296875 1.351562 0.3203125 -0.421875 -1.351562 0.3203125 -0.421875 1.234375 0.5078125 -0.421875 -1.234375 0.5078125 -0.421875 1.023437 0.4765625 -0.3125 -1.023437 0.4765625 -0.3125 1.015625 0.4140625 -0.2890625 -1.015625 0.4140625 -0.2890625 1.1875 0.4375 -0.390625 -1.1875 0.4375 -0.390625 1.265625 0.2890625 -0.40625 -1.265625 0.2890625 -0.40625 1.210937 0.078125 -0.40625 -1.210937 0.078125 -0.40625 1.03125 -0.0390625 -0.3046875 -1.03125 -0.0390625 -0.3046875 0.828125 -0.0703125 -0.1328125 -0.828125 -0.0703125 -0.1328125 0.921875 0.359375 -0.21875 -0.921875 0.359375 -0.21875 0.9453125 0.3046875 -0.2890625 -0.9453125 0.3046875 -0.2890625 0.8828125 -0.0234375 -0.2109375 -0.8828125 -0.0234375 -0.2109375 1.039062 0 -0.3671875 -1.039062 0 -0.3671875 1.1875 0.09375 -0.4453125 -1.1875 0.09375 -0.4453125 1.234375 0.25 -0.4453125 -1.234375 0.25 -0.4453125 1.171875 0.359375 -0.4375 -1.171875 0.359375 -0.4375 1.023437 0.34375 -0.359375 -1.023437 0.34375 -0.359375 0.84375 0.2890625 -0.2109375 -0.84375 0.2890625 -0.2109375 0.8359375 0.171875 -0.2734375 -0.8359375 0.171875 -0.2734375 0.7578125 0.09375 -0.2734375 -0.7578125 0.09375 -0.2734375 0.8203125 0.0859375 -0.2734375 -0.8203125 0.0859375 -0.2734375 0.84375 0.015625 -0.2734375 -0.84375 0.015625 -0.2734375 0.8125 -0.015625 -0.2734375 -0.8125 -0.015625 -0.2734375 0.7265625 0 -0.0703125 -0.7265625 0 -0.0703125 0.71875 -0.0234375 -0.171875 -0.71875 -0.0234375 -0.171875 0.71875 0.0390625 -0.1875 -0.71875 0.0390625 -0.1875 0.796875 0.203125 -0.2109375 -0.796875 0.203125 -0.2109375 0.890625 0.2421875 -0.265625 -0.890625 0.2421875 -0.265625 0.890625 0.234375 -0.3203125 -0.890625 0.234375 -0.3203125 0.8125 -0.015625 -0.3203125 -0.8125 -0.015625 -0.3203125 0.8515625 0.015625 -0.3203125 -0.8515625 0.015625 -0.3203125 0.828125 0.078125 -0.3203125 -0.828125 0.078125 -0.3203125 0.765625 0.09375 -0.3203125 -0.765625 0.09375 -0.3203125 0.84375 0.171875 -0.3203125 -0.84375 0.171875 -0.3203125 1.039062 0.328125 -0.4140625 -1.039062 0.328125 -0.4140625 1.1875 0.34375 -0.484375 -1.1875 0.34375 -0.484375 1.257812 0.2421875 -0.4921875 -1.257812 0.2421875 -0.4921875 1.210937 0.0859375 -0.484375 -1.210937 0.0859375 -0.484375 1.046875 0 -0.421875 -1.046875 0 -0.421875 0.8828125 -0.015625 -0.265625 -0.8828125 -0.015625 -0.265625 0.953125 0.2890625 -0.34375 -0.953125 0.2890625 -0.34375 0.890625 0.109375 -0.328125 -0.890625 0.109375 -0.328125 0.9375 0.0625 -0.3359375 -0.9375 0.0625 -0.3359375 1 0.125 -0.3671875 -1 0.125 -0.3671875 0.9609375 0.171875 -0.3515625 -0.9609375 0.171875 -0.3515625 1.015625 0.234375 -0.375 -1.015625 0.234375 -0.375 1.054687 0.1875 -0.3828125 -1.054687 0.1875 -0.3828125 1.109375 0.2109375 -0.390625 -1.109375 0.2109375 -0.390625 1.085937 0.2734375 -0.390625 -1.085937 0.2734375 -0.390625 1.023437 0.4375 -0.484375 -1.023437 0.4375 -0.484375 1.25 0.46875 -0.546875 -1.25 0.46875 -0.546875 1.367187 0.296875 -0.5 -1.367187 0.296875 -0.5 1.3125 0.0546875 -0.53125 -1.3125 0.0546875 -0.53125 1.039062 -0.0859375 -0.4921875 -1.039062 -0.0859375 -0.4921875 0.7890625 -0.125 -0.328125 -0.7890625 -0.125 -0.328125 0.859375 0.3828125 -0.3828125 -0.859375 0.3828125 -0.3828125</float_array>
- <technique_common>
- <accessor source="#Suzanne-mesh-positions-array" count="507" stride="3">
- <param name="X" type="float"/>
- <param name="Y" type="float"/>
- <param name="Z" type="float"/>
- </accessor>
- </technique_common>
- </source>
- <source id="Suzanne-mesh-normals">
- <float_array id="Suzanne-mesh-normals-array" count="1521">0.977691 -0.01101714 0.2097232 0.7276834 -0.6545 0.2050843 0.6040223 -0.510239 0.6121708 -0.6040223 -0.510239 0.6121708 -0.7276834 -0.6545 0.2050843 -0.802057 -0.00338751 0.5971862 0.802057 -0.00338751 0.5971862 0.6829432 -0.5474715 0.4835352 -0.6829432 -0.5474715 0.4835352 -0.8684042 -0.00326544 0.4957732 0.09820854 -0.7509689 0.652974 0.1158788 -0.8669698 0.4846644 -0.1158788 -0.8669698 0.4846644 -0.09820854 -0.7509689 0.652974 0.03750723 -0.9650563 0.2592242 -0.03750723 -0.9650563 0.2592242 -0.6553545 -0.6928007 0.300821 0.4513688 -0.5393231 0.7108677 0.6553545 -0.6928007 0.300821 -0.4513688 -0.5393231 0.7108677 0.5512253 -0.6357921 0.5402082 -0.6939909 -0.003509581 0.7199317 -0.8147832 -0.003784239 0.5796991 0.8147832 -0.003784239 0.5796991 0.6939909 -0.003509581 0.7199317 -0.9460433 -0.01284825 0.3236793 0.9460433 -0.01284825 0.3236793 -0.6621601 0.6913968 0.2889187 0.4551225 0.525071 0.7191076 0.6621601 0.6913968 0.2889187 -0.4551225 0.525071 0.7191076 -0.5297708 0.6265755 0.5715812 0.5297708 0.6265755 0.5715812 0.1018708 0.7401349 0.6646626 0.1224097 0.8373059 0.5328227 -0.1224097 0.8373059 0.5328227 -0.1018708 0.7401349 0.6646626 0.03207492 0.9710074 0.2368541 -0.03207492 0.9710074 0.2368541 0.7320475 0.6527299 0.1949217 -0.6084476 0.4949187 0.6202887 -0.7320475 0.6527299 0.1949217 0.6084476 0.4949187 0.6202887 -0.6722007 0.5381329 0.5084384 0.6722007 0.5381329 0.5084384 -0.977691 -0.01101714 0.2097232 0.9737236 -0.01220738 0.2272713 -0.7219764 0.6498612 0.237434 0.7219764 0.6498612 0.237434 -0.0374462 0.9335612 0.3563951 -0.6263314 0.6470229 0.4347667 0.6263314 0.6470229 0.4347667 -0.9112522 -0.01226842 0.4116031 0.9112522 -0.01226842 0.4116031 0.6181219 -0.6537675 0.4364147 -0.6181219 -0.6537675 0.4364147 -0.03689682 -0.9350872 0.3523972 0.7150487 -0.6568804 0.2390515 -0.7150487 -0.6568804 0.2390515 -0.9737236 -0.01220738 0.2272713 0.1835993 -0.005310177 0.9829707 -0.1835993 -0.005310177 0.9829707 0.03689682 -0.9350872 0.3523972 0.0374462 0.9335612 0.3563951 0.1576281 -0.9744865 0.1595813 0.1678518 -0.7534715 0.6356395 0 -0.9777215 0.2098147 0 -0.792169 0.6102481 -0.1678518 -0.7534715 0.6356395 -0.1576281 -0.9744865 0.1595813 0.6541032 -0.7417524 0.1479842 0.3629872 -0.6183966 0.6969512 -0.3629872 -0.6183966 0.6969512 -0.6541032 -0.7417524 0.1479842 0.969573 -0.1472823 0.1953794 0.5558947 -0.2159795 0.8026673 -0.5558947 -0.2159795 0.8026673 0.9757683 0.09482097 0.1970275 0.5678274 -0.03295993 0.8224433 -0.5678274 -0.03295993 0.8224433 -0.969573 -0.1472823 0.1953794 0.9651173 0.2189397 0.143498 0.5872067 0.1119114 0.8016297 -0.5872067 0.1119114 0.8016297 -0.9757683 0.09482097 0.1970275 0.9053011 -0.389111 0.1702628 0.3605456 -0.931608 0.04544204 0.380871 -0.5175634 0.7661672 -0.380871 -0.5175634 0.7661672 -0.3605456 -0.931608 0.04544204 -0.06631672 -0.1929075 0.9789422 0.5888852 -0.7907956 0.1667836 -0.4987335 -0.4011353 0.7683035 -0.5888852 -0.7907956 0.1667836 0.9126255 -0.4027222 -0.06979578 0.5489059 -0.3265786 0.7694022 -0.5489059 -0.3265786 0.7694022 -0.9126255 -0.4027222 -0.06979578 0.8801233 0.4238411 0.2137821 -0.4875332 -0.1470382 0.8605915 -0.8801233 0.4238411 0.2137821 0.5099643 0.8330027 0.2143925 0.4875332 -0.1470382 0.8605915 -0.3416852 -0.03250217 0.9392377 -0.5099643 0.8330027 0.2143925 0.5977661 0.7837764 0.1683096 0.3416852 -0.03250217 0.9392377 -0.314127 -0.03036588 0.9488815 -0.5977661 0.7837764 0.1683096 0.2282784 0.9588 0.1689199 0.2711265 0.2130191 0.9386578 -0.2711265 0.2130191 0.9386578 -0.2282784 0.9588 0.1689199 -0.5986816 0.777337 0.192999 -0.1642506 0.1590319 0.9734794 0.1642506 0.1590319 0.9734794 0.5986816 0.777337 0.192999 -0.7917417 0.582873 0.1825617 -0.07293921 -0.02868735 0.9969176 0.07293921 -0.02868735 0.9969176 0.7917417 0.582873 0.1825617 0 0.9595324 0.2815638 0 -0.02404856 0.9996948 0.265389 -0.2039552 0.9422895 0.2660298 -0.1257057 0.9557176 -0.2660298 -0.1257057 0.9557176 -0.265389 -0.2039552 0.9422895 0.1334269 -0.09747612 0.9862362 -0.1334269 -0.09747612 0.9862362 0.197821 -0.0104373 0.980163 0.314127 -0.03036588 0.9488815 0.2413403 -0.306711 0.9206824 -0.197821 -0.0104373 0.980163 0.3629567 -0.2122562 0.9072848 -0.2413403 -0.306711 0.9206824 0.4414502 -0.2058473 0.8733177 -0.3629567 -0.2122562 0.9072848 0.4194464 -0.3797418 0.8245186 0.4987335 -0.4011353 0.7683035 -0.4194464 -0.3797418 0.8245186 0.3106174 -0.3403119 0.8874782 -0.1349223 -0.2145756 0.9673147 0.06631672 -0.1929075 0.9789422 -0.3106174 -0.3403119 0.8874782 -0.3104038 -0.1697439 0.9353008 0 0.0134586 0.9999085 0.3104038 -0.1697439 0.9353008 0.1349223 -0.2145756 0.9673147 0.02838218 -0.1985534 0.9796442 0 -0.2234565 0.9747002 0.162389 -0.1997436 0.9662771 -0.162389 -0.1997436 0.9662771 -0.02520829 -0.4117863 0.9109165 0 -0.3312479 0.9435102 0.08905297 -0.3228858 0.9422284 0.02520829 -0.4117863 0.9109165 0.1558885 -0.170629 0.9728996 -0.08905297 -0.3228858 0.9422284 -0.1558885 -0.170629 0.9728996 0.138615 0.002899229 0.9903256 0.1802423 -0.05783253 0.9819025 -0.1802423 -0.05783253 0.9819025 -0.138615 0.002899229 0.9903256 0.4968718 -0.4355907 0.7505417 0 -0.457564 0.8891568 0 -0.004089474 0.9999695 0 -0.03421121 0.9993897 0 -0.4257332 0.9048433 0.7215491 -0.3646046 0.5885494 0.9245887 -0.2129276 0.3158665 0.5803095 -0.7306436 0.3596606 -0.5803095 -0.7306436 0.3596606 -0.9245887 -0.2129276 0.3158665 -0.4968718 -0.4355907 0.7505417 0.2527848 0.3479415 0.902768 0.6217841 0.7744072 0.1167638 -0.6217841 0.7744072 0.1167638 -0.2527848 0.3479415 0.902768 0 0.5692312 0.8221381 -0.3017975 0.9416181 0.1491745 0.3017975 0.9416181 0.1491745 0 0.7592395 0.6507767 0 0.7850887 0.6193426 0 -0.8574175 0.5145726 0 -0.5285501 0.8488724 -0.2205572 -0.5639516 0.7957701 0 0.1135594 0.9934996 0.1991637 0.6017335 0.7734306 -0.1991637 0.6017335 0.7734306 0.3663747 0.4751427 0.7999817 -0.3663747 0.4751427 0.7999817 -0.4296396 -0.1849421 0.8837855 0.4296396 -0.1849421 0.8837855 0.2205572 -0.5639516 0.7957701 -0.7430341 0.0295419 0.668569 -0.7215491 -0.3646046 0.5885494 0.7430341 0.0295419 0.668569 -0.646382 0.1424298 0.7495651 0.646382 0.1424298 0.7495651 0.9384747 0.3250831 0.1160314 -0.9384747 0.3250831 0.1160314 -0.9651173 0.2189397 0.143498 0.9534288 0.2815943 0.1078829 -0.9534288 0.2815943 0.1078829 -0.1140171 -0.6150701 0.7801446 0 -0.9031037 0.4293954 -0.6502579 0.06149476 0.7571948 0.1140171 -0.6150701 0.7801446 -0.3704642 0.5449995 0.7521287 0.6502579 0.06149476 0.7571948 0 0.6466872 0.7626881 0.3704642 0.5449995 0.7521287 -0.3272194 0.4745018 0.8171331 0.3272194 0.4745018 0.8171331 0 0.5288553 0.8486893 0.6748253 0.1146885 0.7289651 -0.6748253 0.1146885 0.7289651 0.5163426 -0.7040925 0.4874111 -0.5163426 -0.7040925 0.4874111 0 -0.6988434 0.7152623 0.1648915 -0.08966338 0.9822077 0.01702928 -0.06100648 0.9979858 0.235847 -0.10889 0.9656361 -0.1648915 -0.08966338 0.9822077 -0.02838218 -0.1985534 0.9796442 -0.235847 -0.10889 0.9656361 -0.1633045 -0.08359014 0.9830012 0.01287877 -0.1560106 0.98764 -0.01287877 -0.1560106 0.98764 0.1997742 -0.2071901 0.9576708 -0.1997742 -0.2071901 0.9576708 0.2857753 -0.04248172 0.9573351 -0.2857753 -0.04248172 0.9573351 0.2989898 -0.09335607 0.949675 -0.2989898 -0.09335607 0.949675 -0.4414502 -0.2058473 0.8733177 0.1869564 -0.06549268 0.980163 -0.1869564 -0.06549268 0.980163 -0.3062533 0.0341807 0.951323 0.3062533 0.0341807 0.951323 -0.1730399 -0.1109347 0.978637 0.1656849 0.1128879 0.9796747 -0.1656849 0.1128879 0.9796747 0.1828364 0.03665268 0.9824519 -0.1828364 0.03665268 0.9824519 0.1633045 -0.08359014 0.9830012 0.5009613 -0.3838923 0.7756279 -0.5009613 -0.3838923 0.7756279 -0.3062838 -0.3431196 0.8879055 0.3062838 -0.3431196 0.8879055 -0.002105772 -0.4952849 0.8687094 0.1730399 -0.1109347 0.978637 0.002105772 -0.4952849 0.8687094 0.1400799 -0.7620472 0.6321604 -0.1400799 -0.7620472 0.6321604 0.1943113 -0.6160466 0.763329 -0.3548692 -0.128605 0.9259926 0.3548692 -0.128605 0.9259926 0.2548601 0.2241279 0.940611 -0.08310186 0.541612 0.8364818 0.1488693 0.6134831 0.7755059 0.08310186 0.541612 0.8364818 -0.1488693 0.6134831 0.7755059 0.4244514 0.5608997 0.7107761 -0.01702928 -0.06100648 0.9979858 -0.4244514 0.5608997 0.7107761 -0.6874905 0.2974029 0.6624653 0.7464217 -0.2134464 0.6302683 -0.7464217 -0.2134464 0.6302683 0.8052003 0.01495403 0.5927916 -0.8052003 0.01495403 0.5927916 0.6874905 0.2974029 0.6624653 0 0.8793908 0.4760277 0.504593 0.8621784 0.04480117 -0.504593 0.8621784 0.04480117 0.4770043 0.5099643 -0.7157811 0.114597 0.6555071 -0.7464217 -0.114597 0.6555071 -0.7464217 -0.3083896 0.9138157 -0.2641987 0.3083896 0.9138157 -0.2641987 -0.3514512 0.9087496 -0.2249214 0.7392193 0.6004822 -0.3048494 -0.7392193 0.6004822 -0.3048494 -0.9393292 -0.3068026 -0.1532945 0.5768303 -0.8110294 -0.09717088 -0.5768303 -0.8110294 -0.09717088 0.439375 -0.8925138 -0.1015961 -0.439375 -0.8925138 -0.1015961 0 -0.3177892 -0.948149 0 -0.8051088 -0.5930967 0.3374737 -0.2534562 -0.9065523 -0.7259743 -0.5865047 -0.3590808 0 -0.2977996 -0.954619 0.1293069 -0.1788995 -0.9753105 -0.3374737 -0.2534562 -0.9065523 0 -0.850795 -0.5254677 0.09927672 -0.7679373 -0.6327403 -0.1293069 -0.1788995 -0.9753105 -0.09927672 -0.7679373 -0.6327403 -0.5586413 -0.4679098 -0.6847743 0.5586413 -0.4679098 -0.6847743 -0.6057924 0.02081358 -0.7953124 0.6057924 0.02081358 -0.7953124 -0.7766045 -0.009338617 -0.6298715 0.9601429 -0.001647949 -0.2794275 0.7766045 -0.009338617 -0.6298715 0.7259743 -0.5865047 -0.3590808 -0.9601429 -0.001647949 -0.2794275 0.9731132 -0.2302011 1.52593e-4 -0.9537034 -0.1998657 0.2246467 -0.9731132 -0.2302011 1.52593e-4 0.8140202 -0.5543687 0.173162 -0.9053011 -0.389111 0.1702628 -0.8140202 -0.5543687 0.173162 0 -0.3004242 -0.953795 0.423658 -0.324015 -0.845851 0 -0.696646 -0.7173681 -0.5190894 -0.6556292 -0.5482956 -0.423658 -0.324015 -0.845851 0.5190894 -0.6556292 -0.5482956 0 -0.9409772 -0.3384503 -0.5213477 -0.8254647 -0.2162236 0.5213477 -0.8254647 -0.2162236 0.5887326 -0.8080691 -0.0185247 -0.5887326 -0.8080691 -0.0185247 0 -0.9862667 -0.164983 0.9393292 -0.3068026 -0.1532945 0.7152013 -0.694998 0.0736106 -0.7152013 -0.694998 0.0736106 -0.9761956 -0.201941 0.07870721 0 0.314066 -0.9493698 0.4534135 0.1968749 -0.8692587 -0.4534135 0.1968749 -0.8692587 0 0.8266549 0.5626698 0.4610431 0.7337871 0.4989471 0 0.9997254 0.02319401 -0.4197516 0.9069491 0.03485208 -0.4610431 0.7337871 0.4989471 0.4197516 0.9069491 0.03485208 0.4258248 0.8031861 -0.4165471 -0.4258248 0.8031861 -0.4165471 0 0.8325449 -0.5539415 0.3514512 0.9087496 -0.2249214 0.7652211 0.6244087 0.1565294 -0.7652211 0.6244087 0.1565294 -0.4720603 0.7777642 0.4149296 0.4720603 0.7777642 0.4149296 0.6513871 0.6814478 0.3335368 -0.7475204 0.5326091 0.3968627 0.7475204 0.5326091 0.3968627 0.854793 0.5180517 -0.03012174 -0.854793 0.5180517 -0.03012174 -0.6787927 0.7317728 -0.06118959 0.6787927 0.7317728 -0.06118959 0.873867 0.3070162 -0.3768731 -0.873867 0.3070162 -0.3768731 -0.6440321 0.5379498 -0.5438398 0.6259651 -0.02594071 -0.7793817 0.5860164 -0.01547288 -0.8101139 -0.5860164 -0.01547288 -0.8101139 -0.6259651 -0.02594071 -0.7793817 0.6440321 0.5379498 -0.5438398 -0.6513871 0.6814478 0.3335368 0.3916135 0.8280282 0.4011963 -0.3916135 0.8280282 0.4011963 0 0.6203803 0.7842647 -0.4770043 0.5099643 -0.7157811 0.9761956 -0.201941 0.07870721 0.9989318 -0.04550307 0.006164729 -0.9989318 -0.04550307 0.006164729 0.8964507 0.3043611 0.3220008 -0.8964507 0.3043611 0.3220008 0.573046 -0.8037355 0.1600085 -0.5808893 -0.8006836 -0.1463362 0.2744224 -0.9599903 -0.05520796 -0.573046 -0.8037355 0.1600085 0.9537034 -0.1998657 0.2246467 0.4020203 -0.6167181 -0.6767479 -0.5442976 -0.4958648 -0.6766259 -0.4020203 -0.6167181 -0.6767479 0.5808893 -0.8006836 -0.1463362 -0.2744224 -0.9599903 -0.05520796 0.5442976 -0.4958648 -0.6766259 0.01623582 0.8736228 0.4862819 -0.287759 0.7387921 0.6093936 0.5420393 -0.06741535 0.837611 -0.4589679 -0.06308174 0.886166 0.287759 0.7387921 0.6093936 -0.01623582 0.8736228 0.4862819 0.317362 -0.09295934 0.9437239 -0.317362 -0.09295934 0.9437239 -0.5420393 -0.06741535 0.837611 -0.3603625 0.8605304 0.3599963 0.3603625 0.8605304 0.3599963 0.7895749 0.178991 0.5869014 0.1200598 -0.08972442 0.9886776 -0.1200598 -0.08972442 0.9886776 0.6731163 -0.4998322 0.5449995 0.02398753 0.2739036 0.9614246 -0.7895749 0.178991 0.5869014 -0.02398753 0.2739036 0.9614246 0.4718772 -0.7796258 0.4116337 -0.492172 0.273751 0.8263192 -0.6731163 -0.4998322 0.5449995 0.492172 0.273751 0.8263192 0.341319 0.3526719 0.8712424 -0.341319 0.3526719 0.8712424 0.04388558 -0.6481216 0.7602466 -0.1665395 0.9538865 0.2496719 -0.2329783 0.878811 0.416364 0.1665395 0.9538865 0.2496719 -0.7613453 0.6470839 0.03991818 0.7613453 0.6470839 0.03991818 -0.9810175 -0.09335607 0.1698049 0.9810175 -0.09335607 0.1698049 -0.140965 -0.7727897 0.6187933 0.140965 -0.7727897 0.6187933 0.5587329 -0.6582843 0.5044099 -0.5587329 -0.6582843 0.5044099 0.4589679 -0.06308174 0.886166 0.6877956 -0.5533311 0.4698019 -0.6877956 -0.5533311 0.4698019 0.861507 -0.487991 -0.1399579 -0.7450484 0.08545178 0.6614582 -0.04388558 -0.6481216 0.7602466 -0.861507 -0.487991 -0.1399579 0.7426984 -0.2611163 0.616596 -0.7426984 -0.2611163 0.616596 0.2329783 0.878811 0.416364 0.5933104 0.566332 0.5720084 -0.5933104 0.566332 0.5720084 0.8836634 -0.06244087 0.4639118 0.9209876 -0.1749016 0.3480331 -0.9209876 -0.1749016 0.3480331 -0.8836634 -0.06244087 0.4639118 0.8588519 0.03714102 0.5108188 -0.5731071 0.726249 0.3795282 0.7481307 -0.5799127 0.3223975 0.8719748 -0.4240242 0.2446058 -0.8719748 -0.4240242 0.2446058 -0.7481307 -0.5799127 0.3223975 0.6962798 -0.5411847 0.4714194 -0.6962798 -0.5411847 0.4714194 0.7450484 0.08545178 0.6614582 0.6668599 -0.4347667 0.6051821 -0.6668599 -0.4347667 0.6051821 -0.6357921 -0.4091616 0.6544389 -0.5713981 -0.4258553 0.7014985 0.7836848 0.2513504 0.56798 -0.7836848 0.2513504 0.56798 -0.8588519 0.03714102 0.5108188 0.5731071 0.726249 0.3795282 -0.4447157 0.3740043 0.8138066 0.4447157 0.3740043 0.8138066 -0.3738822 0.3687247 0.8510087 0.6600238 0.349498 0.6649678 -0.6600238 0.349498 0.6649678 -0.05069124 0.9518418 0.3023164 0.05069124 0.9518418 0.3023164 0.6357921 -0.4091616 0.6544389 -0.4844203 -0.3373211 0.8071535 0.4844203 -0.3373211 0.8071535 0.2484512 -0.5825983 0.7738273 -0.7433089 -0.09732353 0.6618244 0.7433089 -0.09732353 0.6618244 0.5391705 0.4506363 0.7114475 -0.5391705 0.4506363 0.7114475 -0.08728289 0.7400434 0.6668294 0.3738822 0.3687247 0.8510087 0.1983398 0.005127072 0.980102 -0.3854488 0.1162145 0.9153417 0.3854488 0.1162145 0.9153417 0.3281045 1.83111e-4 0.9446089 -0.4315317 -0.03311258 0.9014558 -0.1983398 0.005127072 0.980102 0.4315317 -0.03311258 0.9014558 0.3447371 -0.07669299 0.9355449 -0.3447371 -0.07669299 0.9355449 -0.3178197 0.0936613 0.9435102 0.3178197 0.0936613 0.9435102 0.3573107 0.2980132 0.8851283 -0.4364757 -0.01358073 0.8995941 -0.3573107 0.2980132 0.8851283 -0.3281045 1.83111e-4 0.9446089 0.5713981 -0.4258553 0.7014985 0.08728289 0.7400434 0.6668294 0.4364757 -0.01358073 0.8995941 -0.2484512 -0.5825983 0.7738273 -0.07974487 -0.8452712 -0.5283059 0.07974487 -0.8452712 -0.5283059 0.04184085 -0.6988739 -0.7140111 -0.04184085 -0.6988739 -0.7140111 -0.4718772 -0.7796258 0.4116337 -0.614948 -0.4905545 -0.6173589 0.9233986 0.08560442 -0.3740959 0.3047578 0.6218757 -0.7213355 -0.9233986 0.08560442 -0.3740959 -0.3047578 0.6218757 -0.7213355 0.4176458 0.5585803 -0.7166051 -0.4176458 0.5585803 -0.7166051 0.6561785 0.5715202 -0.4926603 0.614948 -0.4905545 -0.6173589 -0.6561785 0.5715202 -0.4926603 0.8684042 -0.00326544 0.4957732 -0.5512253 -0.6357921 0.5402082 -0.1943113 -0.6160466 0.763329 -0.2548601 0.2241279 0.940611</float_array>
- <technique_common>
- <accessor source="#Suzanne-mesh-normals-array" count="507" stride="3">
- <param name="X" type="float"/>
- <param name="Y" type="float"/>
- <param name="Z" type="float"/>
- </accessor>
- </technique_common>
- </source>
- <vertices id="Suzanne-mesh-vertices">
- <input semantic="POSITION" source="#Suzanne-mesh-positions"/>
- </vertices>
- <polylist count="968">
- <input semantic="VERTEX" source="#Suzanne-mesh-vertices" offset="0"/>
- <input semantic="NORMAL" source="#Suzanne-mesh-normals" offset="1"/>
- <vcount>3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 </vcount>
- <p>46 0 0 1 2 2 3 3 1 4 45 5 44 6 2 2 4 7 5 8 3 3 43 9 2 2 8 10 6 11 7 12 9 13 5 8 0 1 10 14 8 10 9 13 11 15 3 3 10 14 12 16 8 10 15 17 13 18 11 15 8 10 14 19 6 11 17 20 15 17 9 13 14 19 20 21 18 22 19 23 21 24 17 20 12 16 22 25 20 21 21 24 23 26 15 17 22 25 24 27 20 21 27 28 25 29 23 26 20 21 26 30 28 31 29 32 27 28 19 23 26 30 32 33 30 34 31 35 33 36 29 32 24 27 34 37 32 33 33 36 35 38 27 28 34 37 36 39 32 33 39 40 37 41 35 38 32 33 38 42 30 34 41 43 39 40 33 36 38 42 44 6 40 44 43 9 45 5 39 40 36 39 46 0 38 42 45 5 47 45 37 41 46 0 36 39 48 46 51 47 37 41 47 45 36 39 34 37 50 48 53 49 35 38 37 41 34 37 24 27 54 50 55 51 25 29 53 49 24 27 22 25 56 52 57 53 23 26 55 51 22 25 12 16 56 52 59 54 13 18 23 26 12 16 10 14 58 55 63 56 11 15 13 18 10 14 0 1 64 57 65 58 1 4 63 56 0 1 46 0 48 46 49 59 47 45 65 58 60 60 64 57 48 46 49 59 65 58 61 61 62 62 64 57 60 60 61 61 65 58 63 56 60 60 58 55 62 62 63 56 59 54 61 61 60 60 56 52 58 55 59 54 57 53 61 61 60 60 54 50 56 52 57 53 55 51 61 61 60 60 52 63 54 50 55 51 53 49 61 61 60 60 50 48 52 63 53 49 51 47 61 61 60 60 48 46 50 48 51 47 49 59 61 61 88 64 173 65 90 66 175 67 174 68 89 69 86 70 171 71 88 64 174 68 172 72 87 73 84 74 169 75 171 71 172 72 170 76 87 73 82 77 167 78 169 75 170 76 168 79 85 80 80 81 165 82 167 78 168 79 166 83 83 84 78 85 91 86 145 87 146 88 92 89 164 90 91 86 93 91 145 87 148 92 94 93 92 89 93 91 95 94 149 95 150 96 96 97 148 92 95 94 97 98 149 95 152 99 98 100 96 97 97 98 99 101 151 102 154 103 100 104 98 100 99 101 101 105 153 106 156 107 102 108 100 104 101 105 103 109 157 110 158 111 104 112 156 107 103 109 105 113 159 114 160 115 106 116 158 111 105 113 107 117 161 118 162 119 108 120 160 115 107 117 66 121 67 122 67 122 66 121 162 119 109 123 127 124 161 118 160 115 128 125 110 126 127 124 178 127 157 110 158 111 179 128 160 115 125 129 155 130 178 127 158 111 156 107 179 128 123 131 153 106 125 129 156 107 154 103 126 132 121 133 151 102 123 131 154 103 152 99 124 134 119 135 149 95 121 133 152 99 150 96 122 136 117 137 147 138 119 135 150 96 148 92 118 139 115 140 145 87 147 138 148 92 146 88 118 139 113 141 163 142 145 87 146 88 164 90 116 143 113 141 180 144 176 145 176 145 181 146 114 147 109 123 161 118 111 148 67 122 162 119 110 126 111 148 67 122 177 149 177 149 67 122 183 150 176 145 180 144 182 151 183 150 181 146 177 149 134 152 136 153 175 67 175 67 136 153 174 68 132 154 134 152 173 65 174 68 135 155 172 72 130 156 132 154 169 75 172 72 133 157 131 158 165 82 186 159 184 160 185 161 187 162 168 79 130 156 169 75 167 78 168 79 170 76 185 161 143 163 189 164 186 159 188 165 189 164 187 162 184 160 186 159 188 165 188 165 187 162 68 166 129 167 130 156 68 166 185 161 131 158 68 166 141 168 192 169 190 170 191 171 193 172 144 173 139 174 194 175 141 168 193 172 195 176 140 177 138 178 196 179 139 174 195 176 197 180 138 178 137 181 70 182 196 179 197 180 70 182 138 178 189 164 143 163 69 183 191 171 144 173 189 164 69 183 190 170 207 184 206 185 191 171 69 183 70 182 198 186 196 179 200 187 198 186 70 182 196 179 199 188 201 189 202 190 200 187 195 176 194 175 201 189 192 169 204 191 202 190 195 176 192 169 203 192 205 193 206 185 204 191 191 171 198 186 203 192 199 188 202 190 204 191 198 186 198 186 207 184 203 192 206 185 207 184 204 191 138 178 139 174 163 142 164 90 140 177 138 178 139 174 141 168 163 142 211 194 142 195 164 90 141 168 143 163 210 196 213 197 144 173 142 195 143 163 186 159 212 198 166 83 187 162 144 173 80 81 208 199 165 82 213 197 209 200 81 201 208 199 214 202 212 198 211 194 215 203 209 200 78 85 163 142 210 196 211 194 164 90 215 203 130 156 129 167 221 204 71 205 129 167 131 158 132 154 130 156 219 206 222 207 131 158 133 157 134 152 132 154 217 208 220 209 133 157 135 155 136 153 134 152 216 210 218 211 135 155 136 153 216 210 217 208 228 212 229 213 218 211 230 214 217 208 219 206 228 212 227 215 220 209 218 211 219 206 221 204 226 216 225 217 222 207 220 209 221 204 71 205 224 218 223 219 71 205 222 207 223 219 230 214 228 212 229 213 230 214 225 217 224 218 228 212 226 216 227 215 229 213 225 217 182 151 180 144 231 220 234 221 181 146 183 150 111 148 182 151 253 222 232 223 183 150 112 224 109 123 111 148 253 222 254 225 112 224 256 226 180 144 113 141 251 227 252 228 114 147 234 221 113 141 115 140 249 229 250 230 116 143 114 147 115 140 117 137 247 231 248 232 118 139 250 230 117 137 119 135 245 233 246 234 120 235 248 232 119 135 121 133 243 236 244 237 122 136 246 234 121 133 123 131 243 236 242 238 124 134 122 136 123 131 125 129 241 239 240 240 126 132 124 134 125 129 178 127 235 241 236 242 179 128 126 132 178 127 127 124 237 243 238 244 128 125 236 242 127 124 109 123 237 243 256 226 110 126 128 125 237 243 255 245 257 246 258 247 256 226 276 248 235 241 237 243 275 249 276 248 238 244 278 250 239 251 235 241 277 252 278 250 236 242 274 253 241 239 239 251 273 254 274 253 240 240 272 255 243 236 241 239 269 256 272 255 242 238 244 237 245 233 243 236 269 256 270 257 244 237 268 258 247 231 245 233 265 259 268 258 246 234 248 232 249 229 247 231 263 260 266 261 248 232 264 262 251 227 249 229 261 263 264 262 250 230 252 228 233 264 251 227 261 263 262 265 252 228 280 266 255 245 253 222 259 267 260 268 254 225 258 247 253 222 231 220 281 269 282 270 232 223 260 268 231 220 233 264 279 271 280 266 234 221 282 270 66 121 107 117 72 272 284 273 108 120 66 121 107 117 105 113 283 274 286 275 106 116 108 120 105 113 103 109 287 276 288 277 104 112 286 275 103 109 101 105 287 276 290 278 102 108 104 112 101 105 99 101 289 279 292 280 100 104 102 108 99 101 97 98 293 281 294 282 98 100 292 280 97 98 95 94 293 281 296 283 96 97 98 100 95 94 93 91 297 284 298 285 94 93 296 283 93 91 91 86 299 286 300 287 92 89 298 285 307 288 308 289 337 290 328 291 308 289 307 288 306 292 307 288 335 293 338 294 307 288 306 292 305 295 306 292 339 296 336 297 306 292 305 295 88 64 90 66 305 295 305 295 90 66 340 298 86 70 88 64 339 296 340 298 89 69 334 299 84 74 86 70 333 300 334 299 87 73 330 301 82 77 84 74 329 302 330 301 85 80 332 303 329 302 335 293 337 290 338 294 336 297 332 303 329 302 333 300 339 296 340 298 334 299 336 297 325 304 331 305 327 306 338 294 332 303 326 307 80 81 82 77 331 305 332 303 83 84 326 307 208 199 341 308 214 202 344 309 342 310 209 200 80 81 325 304 208 199 342 310 326 307 81 201 78 85 214 202 345 311 344 309 215 203 79 312 78 85 345 311 91 86 300 287 346 313 79 312 76 314 323 315 303 316 352 317 324 318 76 314 303 316 351 319 77 320 350 321 352 317 303 316 77 320 349 322 347 323 348 324 350 321 304 325 304 325 347 323 327 306 328 291 348 324 308 289 325 304 327 306 341 308 348 324 328 291 326 307 295 326 297 284 317 327 318 328 298 285 310 329 75 330 315 331 76 314 324 318 316 332 75 330 301 333 357 334 302 335 356 336 358 337 301 333 302 335 355 338 353 339 354 340 356 336 74 341 74 341 353 339 315 331 316 332 354 340 75 330 291 342 293 281 361 343 362 344 294 282 364 345 363 346 361 343 365 347 368 348 362 344 364 345 365 347 367 349 369 350 370 351 368 348 372 352 371 353 369 350 375 354 376 355 370 351 374 356 313 357 377 358 375 354 374 356 378 359 314 360 315 331 353 339 373 361 374 356 354 340 378 359 353 339 355 338 371 353 372 352 356 336 374 356 355 338 357 334 365 347 366 362 358 337 372 352 357 334 359 363 363 346 364 345 360 364 366 362 289 279 291 342 359 363 364 345 292 280 290 278 73 365 359 363 301 333 358 337 360 364 73 365 283 274 285 366 287 276 288 277 286 275 290 278 283 274 289 279 359 363 360 364 290 278 73 365 72 272 283 274 73 365 73 365 284 273 72 272 293 281 295 326 361 343 310 329 296 283 294 282 309 367 311 368 367 349 368 348 312 369 362 344 311 368 381 370 369 350 370 351 382 371 368 348 313 357 375 354 381 370 370 351 376 355 314 360 347 323 349 322 383 372 386 373 350 321 348 324 317 327 383 372 319 374 386 373 384 375 318 328 297 284 299 286 383 372 384 375 300 287 318 328 299 286 343 376 341 308 342 310 344 309 384 375 341 308 347 323 383 372 384 375 348 324 342 310 299 286 345 311 343 376 344 309 346 313 300 287 313 357 321 377 377 358 380 378 322 379 314 360 315 331 377 358 323 315 380 378 378 359 316 332 319 374 385 380 321 377 380 378 386 373 320 381 349 322 351 319 385 380 380 378 352 317 350 321 323 315 379 382 351 319 352 317 380 378 324 318 399 383 387 384 401 385 414 386 388 387 400 388 399 383 401 385 403 389 404 390 402 391 398 392 397 393 403 389 395 394 406 395 404 390 398 392 395 394 405 396 393 397 408 398 406 395 396 399 393 397 407 400 391 401 410 402 408 398 394 403 391 401 409 404 411 405 412 406 410 402 390 407 409 404 419 408 411 405 418 409 420 410 410 402 407 400 421 411 409 404 420 410 422 412 408 398 405 396 423 413 421 411 422 412 424 414 408 398 403 389 425 415 423 413 424 414 426 416 406 395 401 385 427 417 403 389 426 416 428 418 402 391 401 385 413 419 415 420 416 421 414 386 428 418 317 327 319 374 441 422 444 423 320 381 318 328 319 374 389 424 411 405 412 406 390 407 444 423 309 367 317 327 441 422 442 425 318 328 312 369 381 370 429 426 413 419 414 386 430 427 382 371 411 405 417 428 439 429 440 430 418 409 444 423 437 431 445 432 439 429 444 423 446 433 438 434 433 435 445 432 437 431 438 434 446 433 436 436 431 437 447 438 433 435 446 433 448 439 432 440 429 426 447 438 449 441 432 440 448 439 430 427 413 419 429 426 415 420 450 442 430 427 414 386 311 368 447 438 381 370 430 427 448 439 312 369 311 368 441 422 447 438 446 433 442 425 312 369 441 422 443 443 445 432 446 433 444 423 442 425 415 420 449 441 451 444 452 445 450 442 476 446 449 441 431 437 451 444 462 447 432 440 450 442 431 437 433 435 459 448 460 449 434 450 462 447 433 435 435 451 459 448 458 452 436 436 434 450 435 451 437 431 457 453 456 454 438 434 436 436 437 431 439 429 453 455 454 456 440 430 456 454 439 429 417 428 473 457 474 458 418 409 440 430 427 417 415 420 475 459 476 446 416 421 464 460 425 415 427 417 463 461 464 460 428 418 466 462 423 413 425 415 467 463 466 462 426 416 424 414 421 411 423 413 467 463 468 464 424 414 470 465 419 408 421 411 469 466 470 465 422 412 472 467 417 428 419 408 473 457 472 467 420 410 474 458 457 453 455 468 477 469 480 470 456 454 458 452 477 469 479 471 483 472 482 473 480 470 478 474 483 472 481 475 487 476 488 477 482 473 486 478 485 479 487 476 491 480 490 481 488 477 486 478 463 461 475 459 485 479 486 478 476 446 492 482 451 444 483 472 475 459 486 478 484 483 452 445 451 444 461 484 483 472 478 474 462 447 452 445 457 453 477 469 461 484 462 447 478 474 460 449 453 455 473 457 455 468 480 470 474 458 454 456 471 485 481 475 473 457 480 470 482 473 472 467 469 466 487 476 471 485 482 473 488 477 470 465 467 463 489 486 469 466 488 477 490 481 468 464 465 487 491 480 489 486 490 481 492 482 468 464 463 461 491 480 465 487 466 462 492 482 464 460 391 401 389 424 503 488 504 489 390 407 502 490 393 397 391 401 501 491 502 490 392 492 500 493 395 394 393 397 497 494 500 493 394 403 396 399 397 393 395 394 495 495 498 496 396 399 398 392 399 383 397 393 495 495 496 497 398 392 494 498 387 384 399 383 493 499 494 498 400 388 506 500 493 499 501 491 503 488 504 489 502 490 506 500 493 499 495 495 501 491 500 493 496 497 494 498 495 495 497 494 499 501 500 493 498 496 496 497 313 357 381 370 387 384 388 387 382 371 506 500 313 357 505 502 321 377 504 489 506 500 314 360 319 374 321 377 503 488 504 489 322 379 320 381 44 6 46 0 2 2 1 4 47 45 45 5 42 503 44 6 4 7 3 3 45 5 43 9 4 7 2 2 6 11 9 13 3 3 5 8 2 2 0 1 8 10 11 15 1 4 3 3 12 16 14 19 8 10 9 13 15 17 11 15 14 19 16 504 6 11 7 12 17 20 9 13 16 504 14 19 18 22 21 24 15 17 17 20 14 19 12 16 20 21 23 26 13 18 15 17 24 27 26 30 20 21 21 24 27 28 23 26 18 22 20 21 28 31 27 28 21 24 19 23 28 31 26 30 30 34 33 36 27 28 29 32 26 30 24 27 32 33 35 38 25 29 27 28 36 39 38 42 32 33 33 36 39 40 35 38 38 42 40 44 30 34 31 35 41 43 33 36 44 6 42 503 40 44 41 43 43 9 39 40 46 0 44 6 38 42 39 40 45 5 37 41 36 39 50 48 48 46 49 59 51 47 47 45 34 37 52 63 50 48 51 47 53 49 37 41 52 63 34 37 54 50 25 29 35 38 53 49 54 50 24 27 56 52 23 26 25 29 55 51 12 16 58 55 56 52 57 53 59 54 23 26 10 14 62 62 58 55 59 54 63 56 13 18 62 62 10 14 64 57 1 4 11 15 63 56 64 57 0 1 48 46 47 45 1 4 65 58 173 65 175 67 90 66 90 66 175 67 89 69 171 71 173 65 88 64 89 69 174 68 87 73 86 70 84 74 171 71 170 76 85 80 87 73 84 74 82 77 169 75 168 79 83 84 85 80 82 77 80 81 167 78 166 83 81 201 83 84 163 142 78 85 145 87 92 89 79 312 164 90 93 91 147 138 145 87 146 88 148 92 92 89 147 138 93 91 149 95 96 97 94 93 148 92 97 98 151 102 149 95 150 96 152 99 96 97 99 101 153 106 151 102 152 99 154 103 98 100 101 105 155 130 153 106 154 103 156 107 100 104 155 130 101 105 157 110 104 112 102 108 156 107 157 110 103 109 159 114 106 116 104 112 158 111 159 114 105 113 161 118 108 120 106 116 160 115 161 118 107 117 67 122 66 121 108 120 162 119 127 124 159 114 161 118 162 119 160 115 110 126 159 114 127 124 157 110 179 128 128 125 160 115 155 130 157 110 178 127 156 107 126 132 179 128 153 106 155 130 125 129 154 103 124 134 126 132 151 102 153 106 123 131 152 99 122 136 124 134 149 95 151 102 121 133 150 96 120 235 122 136 147 138 149 95 119 135 120 235 150 96 118 139 117 137 115 140 147 138 146 88 116 143 118 139 115 140 113 141 145 87 164 90 114 147 116 143 163 142 113 141 176 145 164 90 176 145 114 147 161 118 67 122 111 148 112 224 67 122 110 126 182 151 111 148 177 149 67 122 112 224 183 150 177 149 176 145 182 151 181 146 176 145 177 149 173 65 134 152 175 67 136 153 135 155 174 68 171 71 132 154 173 65 135 155 133 157 172 72 132 154 171 71 169 75 170 76 172 72 131 158 167 78 165 82 184 160 187 162 166 83 168 79 184 160 130 156 167 78 170 76 131 158 185 161 189 164 188 165 186 159 189 164 144 173 187 162 68 166 184 160 188 165 187 162 185 161 68 166 130 156 184 160 68 166 131 158 129 167 68 166 143 163 141 168 190 170 193 172 142 195 144 173 194 175 192 169 141 168 142 195 193 172 140 177 196 179 194 175 139 174 140 177 195 176 138 178 138 178 137 181 196 179 70 182 137 181 138 178 143 163 190 170 69 183 69 183 191 171 189 164 190 170 205 193 207 184 207 184 206 185 69 183 198 186 199 188 196 179 197 180 200 187 70 182 194 175 196 179 201 189 200 187 197 180 195 176 201 189 203 192 192 169 193 172 204 191 195 176 190 170 192 169 205 193 204 191 193 172 191 171 203 192 201 189 199 188 200 187 202 190 198 186 207 184 205 193 203 192 207 184 198 186 204 191 176 145 138 178 163 142 176 145 164 90 138 178 141 168 210 196 163 142 142 195 140 177 164 90 143 163 212 198 210 196 211 194 213 197 142 195 186 159 165 82 212 198 213 197 166 83 144 173 208 199 212 198 165 82 166 83 213 197 81 201 214 202 210 196 212 198 213 197 211 194 209 200 214 202 78 85 210 196 164 90 79 312 215 203 129 167 71 205 221 204 222 207 71 205 131 158 130 156 221 204 219 206 220 209 222 207 133 157 132 154 219 206 217 208 218 211 220 209 135 155 134 152 217 208 216 210 216 210 218 211 136 153 230 214 216 210 228 212 218 211 216 210 230 214 219 206 226 216 228 212 229 213 227 215 218 211 221 204 224 218 226 216 227 215 225 217 220 209 71 205 223 219 224 218 225 217 223 219 222 207 224 218 223 219 228 212 230 214 223 219 225 217 180 144 233 264 231 220 232 223 234 221 183 150 182 151 231 220 253 222 254 225 232 223 112 224 255 245 109 123 253 222 112 224 110 126 256 226 233 264 180 144 251 227 114 147 181 146 234 221 251 227 113 141 249 229 252 228 250 230 114 147 249 229 115 140 247 231 118 139 116 143 250 230 247 231 117 137 245 233 120 235 118 139 248 232 245 233 119 135 243 236 122 136 120 235 246 234 123 131 241 239 243 236 244 237 242 238 122 136 125 129 239 251 241 239 242 238 240 240 124 134 239 251 125 129 235 241 240 240 236 242 126 132 235 241 178 127 237 243 128 125 179 128 236 242 109 123 255 245 237 243 238 244 256 226 128 125 275 249 237 243 257 246 256 226 238 244 276 248 277 252 235 241 275 249 238 244 236 242 278 250 273 254 239 251 277 252 236 242 240 240 274 253 271 505 241 239 273 254 240 240 242 238 272 255 241 239 271 505 269 256 270 257 272 255 244 237 267 506 245 233 269 256 244 237 246 234 268 258 245 233 267 506 265 259 266 261 268 258 248 232 247 231 265 259 263 260 248 232 250 230 264 262 249 229 263 260 261 263 262 265 264 262 252 228 279 271 233 264 261 263 252 228 234 221 280 266 257 246 255 245 259 267 254 225 256 226 258 247 259 267 253 222 281 269 232 223 254 225 260 268 281 269 231 220 279 271 234 221 232 223 282 270 107 117 283 274 72 272 72 272 284 273 66 121 105 113 285 366 283 274 284 273 286 275 108 120 285 366 105 113 287 276 104 112 106 116 286 275 101 105 289 279 287 276 288 277 290 278 104 112 99 101 291 342 289 279 290 278 292 280 102 108 291 342 99 101 293 281 98 100 100 104 292 280 95 94 295 326 293 281 294 282 296 283 98 100 295 326 95 94 297 284 94 93 96 97 296 283 297 284 93 91 299 286 92 89 94 93 298 285 308 289 327 306 337 290 338 294 328 291 307 288 307 288 337 290 335 293 336 297 338 294 306 292 306 292 335 293 339 296 340 298 336 297 305 295 339 296 88 64 305 295 90 66 89 69 340 298 333 300 86 70 339 296 89 69 87 73 334 299 329 302 84 74 333 300 87 73 85 80 330 301 331 305 82 77 329 302 85 80 83 84 332 303 331 305 329 302 337 290 336 297 330 301 332 303 335 293 329 302 339 296 334 299 330 301 336 297 331 305 337 290 327 306 328 291 338 294 326 307 325 304 80 81 331 305 83 84 81 201 326 307 341 308 343 376 214 202 215 203 344 309 209 200 325 304 341 308 208 199 209 200 342 310 81 201 214 202 343 376 345 311 346 313 344 309 79 312 345 311 299 286 91 86 92 89 300 287 79 312 323 315 351 319 303 316 303 316 352 317 76 314 351 319 349 322 77 320 77 320 350 321 303 316 304 325 77 320 347 323 350 321 77 320 304 325 308 289 304 325 327 306 348 324 304 325 308 289 327 306 347 323 341 308 342 310 348 324 326 307 309 367 295 326 317 327 298 285 296 283 310 329 315 331 323 315 76 314 76 314 324 318 75 330 357 334 355 338 302 335 302 335 356 336 301 333 74 341 302 335 353 339 356 336 302 335 74 341 75 330 74 341 315 331 354 340 74 341 75 330 363 346 291 342 361 343 294 282 292 280 364 345 361 343 367 349 365 347 366 362 368 348 364 345 371 353 365 347 369 350 368 348 366 362 372 352 373 361 371 353 375 354 370 351 372 352 374 356 377 358 373 361 375 354 376 355 374 356 314 360 377 358 315 331 373 361 354 340 316 332 378 359 373 361 353 339 371 353 356 336 354 340 374 356 371 353 355 338 365 347 358 337 356 336 372 352 365 347 357 334 363 346 360 364 358 337 366 362 291 342 363 346 359 363 360 364 364 345 290 278 359 363 357 334 301 333 301 333 358 337 73 365 289 279 283 274 287 276 286 275 284 273 290 278 73 365 283 274 359 363 290 278 284 273 73 365 295 326 309 367 361 343 362 344 310 329 294 282 361 343 309 367 367 349 312 369 310 329 362 344 367 349 311 368 369 350 382 371 312 369 368 348 375 354 369 350 381 370 382 371 370 351 314 360 349 322 385 380 383 372 384 375 386 373 348 324 383 372 385 380 319 374 320 381 386 373 318 328 317 327 297 284 383 372 300 287 298 285 318 328 383 372 299 286 341 308 344 309 300 287 384 375 321 377 379 382 377 358 378 359 380 378 314 360 377 358 379 382 323 315 324 318 380 378 316 332 385 380 379 382 321 377 322 379 380 378 320 381 351 319 379 382 385 380 386 373 380 378 350 321 387 384 413 419 401 385 402 391 414 386 400 388 397 393 399 383 403 389 402 391 400 388 398 392 403 389 405 396 395 394 396 399 406 395 398 392 405 396 407 400 393 397 394 403 408 398 396 399 407 400 409 404 391 401 392 492 410 402 394 403 389 424 391 401 411 405 410 402 392 492 390 407 419 408 417 428 411 405 412 406 418 409 410 402 421 411 419 408 409 404 410 402 420 410 408 398 407 400 405 396 421 411 424 414 406 395 408 398 405 396 403 389 423 413 426 416 404 390 406 395 427 417 425 415 403 389 404 390 426 416 402 391 427 417 401 385 415 420 414 386 402 391 428 418 319 374 443 443 441 422 442 425 444 423 318 328 443 443 319 374 411 405 390 407 320 381 444 423 311 368 309 367 441 422 318 328 310 329 312 369 387 384 381 370 413 419 388 387 414 386 382 371 443 443 411 405 439 429 418 409 412 406 444 423 445 432 443 443 439 429 440 430 444 423 438 434 435 451 433 435 437 431 446 433 434 450 436 436 447 438 445 432 433 435 434 450 446 433 432 440 447 438 431 437 449 441 450 442 432 440 430 427 429 426 449 441 415 420 416 421 450 442 414 386 447 438 429 426 381 370 382 371 430 427 312 369 441 422 445 432 447 438 448 439 446 433 312 369 475 459 415 420 451 444 450 442 416 421 476 446 431 437 461 484 451 444 452 445 462 447 450 442 461 484 431 437 459 448 434 450 432 440 462 447 435 451 457 453 459 448 460 449 458 452 434 450 437 431 455 468 457 453 458 452 456 454 436 436 455 468 437 431 453 455 440 430 438 434 456 454 453 455 439 429 473 457 454 456 474 458 440 430 463 461 427 417 475 459 416 421 428 418 464 460 465 487 425 415 463 461 428 418 426 416 466 462 425 415 465 487 467 463 468 464 466 462 424 414 469 466 421 411 467 463 424 414 422 412 470 465 471 485 419 408 469 466 422 412 420 410 472 467 419 408 471 485 473 457 420 410 418 409 474 458 455 468 479 471 477 469 478 474 480 470 458 452 479 471 481 475 483 472 484 483 482 473 478 474 485 479 483 472 487 476 482 473 484 483 486 478 487 476 489 486 491 480 492 482 490 481 486 478 491 480 463 461 485 479 476 446 464 460 492 482 483 472 485 479 475 459 476 446 486 478 452 445 461 484 477 469 483 472 484 483 478 474 452 445 459 448 457 453 461 484 478 474 458 452 460 449 473 457 479 471 455 468 456 454 480 470 454 456 481 475 479 471 473 457 474 458 480 470 472 467 487 476 481 475 471 485 472 467 482 473 470 465 489 486 487 476 469 466 470 465 488 477 468 464 467 463 465 487 489 486 492 482 466 462 468 464 501 491 391 401 503 488 390 407 392 492 502 490 499 501 393 397 501 491 392 492 394 403 500 493 393 397 499 501 497 494 498 496 500 493 396 399 395 394 497 494 495 495 496 497 498 496 398 392 493 499 399 383 495 495 398 392 400 388 494 498 505 502 387 384 493 499 400 388 388 387 506 500 505 502 493 499 503 488 502 490 494 498 506 500 495 495 499 501 501 491 502 490 500 493 494 498 505 502 313 357 387 384 382 371 314 360 506 500 505 502 503 488 321 377 322 379 504 489 314 360 389 424 319 374 503 488 390 407 504 489 320 381</p>
- </polylist>
- </mesh>
- <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>
- </geometry>
- </library_geometries>
- <library_controllers/>
- <library_visual_scenes>
- <visual_scene id="Scene" name="Scene">
- <node id="Camera" name="Camera" type="NODE">
- <matrix sid="transform">0.4023289 -0.4037423 0.821659 13.26918 0.9154313 0.1880228 -0.3558553 -6.50764 -0.01081678 0.8953432 0.4452454 5.343665 0 0 0 1</matrix>
- <instance_camera url="#Camera-camera"/>
- </node>
- <node id="Lamp" name="Lamp" type="NODE">
- <matrix sid="transform">-0.2908646 -0.7711008 0.5663932 4.076245 0.9551712 -0.1998834 0.2183912 1.005454 -0.05518906 0.6045247 0.7946723 5.903862 0 0 0 1</matrix>
- <instance_light url="#Lamp-light"/>
- </node>
- <node id="Cube" name="Cube" type="NODE">
- <matrix sid="transform">1 0 0 0 0 1 0 -4.13326 0 0 1 0 0 0 0 1</matrix>
- <instance_geometry url="#Cube-mesh">
- <bind_material>
- <technique_common>
- <instance_material symbol="Material_001-material" target="#Material_001-material"/>
- </technique_common>
- </bind_material>
- </instance_geometry>
- </node>
- <node id="Torus" name="Torus" type="NODE">
- <matrix sid="transform">1.008985 -0.154525 1.099123 3.47876 0.5496828 1.360011 -0.3134007 3.875515 -0.9642607 0.6135905 0.9714465 1.133646 0 0 0 1</matrix>
- <instance_geometry url="#Torus-mesh">
- <bind_material>
- <technique_common>
- <instance_material symbol="Material_002-material" target="#Material_002-material">
- <bind_vertex_input semantic="UVMap" input_semantic="TEXCOORD" input_set="0"/>
- </instance_material>
- </technique_common>
- </bind_material>
- </instance_geometry>
- </node>
- <node id="Suzanne" name="Suzanne" type="NODE">
- <matrix sid="transform">-2.55903e-6 2.55903e-6 4 -8.578758 4 1.63716e-12 2.55903e-6 -2.573106 0 4 -2.55903e-6 -1.047175 0 0 0 1</matrix>
- <instance_geometry url="#Suzanne-mesh"/>
- </node>
- </visual_scene>
- </library_visual_scenes>
- <scene>
- <instance_visual_scene url="#Scene"/>
- </scene>
-</COLLADA> \ No newline at end of file
diff --git a/examples/qt3d/playground-qml/doc/src/playground-qml.qdoc b/examples/qt3d/playground-qml/doc/src/playground-qml.qdoc
deleted file mode 100644
index e10a8ea2a..000000000
--- a/examples/qt3d/playground-qml/doc/src/playground-qml.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example playground-qml
- \title Qt 3D: Playground QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/playground-qml/main.cpp b/examples/qt3d/playground-qml/main.cpp
deleted file mode 100644
index 7db0725ce..000000000
--- a/examples/qt3d/playground-qml/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/qinputaspect.h>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/playground-qml/main.qml b/examples/qt3d/playground-qml/main.qml
deleted file mode 100644
index 852fe03c4..000000000
--- a/examples/qt3d/playground-qml/main.qml
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import Qt3D.Input 2.0
-import QtQuick 2.2 as QQ2
-
-Entity {
- id: root
-
- property bool detailCamera: true
-
- FrameGraph {
- id : external_forward_renderer
- activeFrameGraph: MyForwardRenderer {
- mainCamera: mainView.camera
- detailCamera: root.detailCamera ? detailView.camera : mainView.camera
- clearColor: "black"
- }
- }
-
- KeyboardController {id: keyboardController}
-
- KeyboardInput {
- id: keyboardInput
- controller: keyboardController
- focus: true
- onTabPressed: root.detailCamera = !root.detailCamera;
- }
-
- components: [external_forward_renderer, keyboardInput]
-
- Configuration {
- controlledCamera: mainView.camera
- }
-
- MainView {
- id: mainView
- }
-
- DetailView {
- id: detailView
- }
-}
diff --git a/examples/qt3d/playground-qml/playground-qml.pro b/examples/qt3d/playground-qml/playground-qml.pro
deleted file mode 100644
index bbd16e027..000000000
--- a/examples/qt3d/playground-qml/playground-qml.pro
+++ /dev/null
@@ -1,29 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dquick qml quick 3dinput
-
-HEADERS += \
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- AdsEffect.qml \
- SimpleEffect.qml \
- elements/ViewportEntity.qml \
- elements/TechniqueFilterEntity.qml \
- elements/RenderPassFilterEntity.qml \
- elements/CameraSelectorEntity.qml \
- MyForwardRenderer.qml \
- ComplexTechnique.qml \
- RenderableEntity.qml \
- MainView.qml \
- DetailView.qml \
- AnimatedDiffuseMaterial.qml
-
-RESOURCES += \
- playground-qml.qrc \
- ../exampleresources/gltf.qrc \
diff --git a/examples/qt3d/playground-qml/playground-qml.qrc b/examples/qt3d/playground-qml/playground-qml.qrc
deleted file mode 100644
index 33ef7fabf..000000000
--- a/examples/qt3d/playground-qml/playground-qml.qrc
+++ /dev/null
@@ -1,15 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>AdsEffect.qml</file>
- <file>assets/ball.obj</file>
- <file>assets/test_scene.dae</file>
- <file>assets/cube.obj</file>
- <file>ComplexTechnique.qml</file>
- <file>MainView.qml</file>
- <file>DetailView.qml</file>
- <file>RenderableEntity.qml</file>
- <file>AnimatedDiffuseMaterial.qml</file>
- <file>MyForwardRenderer.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/qt3d/qgltf/Scene.qml b/examples/qt3d/qgltf/Scene.qml
index e6d0e7dd8..d359d3cd4 100644
--- a/examples/qt3d/qgltf/Scene.qml
+++ b/examples/qt3d/qgltf/Scene.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/qgltf/main.cpp b/examples/qt3d/qgltf/main.cpp
index bc18004c7..d1dad1b88 100644
--- a/examples/qt3d/qgltf/main.cpp
+++ b/examples/qt3d/qgltf/main.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/qgltf/main.qml b/examples/qt3d/qgltf/main.qml
index 6ee7ae39e..c0bedbc8a 100644
--- a/examples/qt3d/qgltf/main.qml
+++ b/examples/qt3d/qgltf/main.qml
@@ -1,35 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -48,7 +62,7 @@ Entity {
aspectRatio: 16/9
nearPlane : 0.1
farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, 100.0 )
+ position: Qt.vector3d( 0.0, 80.0, 120.0 )
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
@@ -57,12 +71,14 @@ Entity {
controlledCamera: camera
}
- components: FrameGraph {
- activeFrameGraph: ForwardRenderer {
- clearColor: Qt.rgba(0, 0.5, 1, 1)
- camera: camera
+ components: [
+ RendererSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
}
- }
+ ]
Scene {
}
diff --git a/examples/qt3d/qt3d.pro b/examples/qt3d/qt3d.pro
index 252c1533e..d6d7437d1 100644
--- a/examples/qt3d/qt3d.pro
+++ b/examples/qt3d/qt3d.pro
@@ -1,50 +1,21 @@
TEMPLATE = subdirs
SUBDIRS += \
- playground-qml \
simple-qml \
simple-cpp \
- gltf \
- assimp \
- cpp_example \
multiviewport \
- torus-qml \
- cylinder-qml \
- cylinder-cpp \
- bigmodel-qml \
wireframe \
- tessellation-modes \
- deferred-renderer-qml \
- deferred-renderer-cpp \
shadow-map-qml \
- bigscene-cpp \
materials \
- keyboardinput-qml \
- loader-qml \
wave \
materials-cpp \
- dynamicscene-cpp \
scene3d \
- enabled-qml \
- skybox \
controls \
anaglyph-rendering \
- simple-shaders-qml \
planets-qml \
- plasma \
- gooch-qml \
- transparency-qml \
- transparency-qml-scene3d \
- scene3d-loader \
- clip-planes-qml \
- mouseinput-qml \
- custom-mesh-cpp \
- bigscene-instanced-qml \
- custom-mesh-qml \
instanced-arrays-qml \
- picking-qml \
- transforms-qml \
- lights
+ lights \
+ compute-particles
qtHaveModule(multimedia): SUBDIRS += audio-visualizer-qml
@@ -53,9 +24,8 @@ qtHaveModule(multimedia): SUBDIRS += audio-visualizer-qml
# TODO Port the old examples to new APIs
#SUBDIRS += qt3d
-qtHaveModule(widgets): SUBDIRS += assimp-cpp \
- basicshapes-cpp
+
+qtHaveModule(widgets): SUBDIRS += basicshapes-cpp
EXAMPLE_FILES += \
- common \
exampleresources
diff --git a/examples/qt3d/scene3d-loader/AnimatedEntity.qml b/examples/qt3d/scene3d-loader/AnimatedEntity.qml
deleted file mode 100644
index ec7cd7fc8..000000000
--- a/examples/qt3d/scene3d-loader/AnimatedEntity.qml
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-import QtQuick 2.0 as QQ2
-
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- components: [
- FrameGraph {
- activeFrameGraph: Viewport {
- id: viewport
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0) // From Top Left
- clearColor: "transparent"
-
- CameraSelector {
- id : cameraSelector
- camera: camera
-
- ClearBuffer {
- buffers : ClearBuffer.ColorDepthBuffer
- }
- }
- }
- }
- ]
-
- PhongMaterial {
- id: material
- }
-
- TorusMesh {
- id: torusMesh
- radius: 5
- minorRadius: 1
- rings: 100
- slices: 20
- }
-
- Transform {
- id: torusTransform
- scale3D: Qt.vector3d(1.5, 1, 0.5)
- rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
- }
-
- Entity {
- id: torusEntity
- components: [ torusMesh, material, torusTransform ]
- }
-
- SphereMesh {
- id: sphereMesh
- radius: 3
- }
-
- Transform {
- id: sphereTransform
- property real userAngle: 0.0
- translation: Qt.vector3d(20, 0, 0)
- rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
- }
-
- QQ2.NumberAnimation {
- target: sphereTransform
- property: "userAngle"
- duration: 10000
- from: 0
- to: 360
-
- loops: QQ2.Animation.Infinite
- running: true
- }
-
- Entity {
- id: sphereEntity
- components: [ sphereMesh, material, sphereTransform ]
- }
-}
diff --git a/examples/qt3d/scene3d-loader/Scene.qml b/examples/qt3d/scene3d-loader/Scene.qml
deleted file mode 100644
index 5428c6c12..000000000
--- a/examples/qt3d/scene3d-loader/Scene.qml
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Scene3D 2.0
-
-Scene3D {
- focus: true
- aspects: "input"
- AnimatedEntity {}
-}
diff --git a/examples/qt3d/scene3d-loader/Scene2.qml b/examples/qt3d/scene3d-loader/Scene2.qml
deleted file mode 100644
index df74571c4..000000000
--- a/examples/qt3d/scene3d-loader/Scene2.qml
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Scene3D 2.0
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Scene3D {
- focus: true
- aspects: "input"
-
- Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -20.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- FrameGraph {
- id : external_forward_renderer
- activeFrameGraph : ForwardRenderer {
- camera: camera
- clearColor: "black"
- }
- }
-
- components: [external_forward_renderer]
-
- TorusMesh {
- id: mesh
- radius: 5
- minorRadius: 1
- rings: 100
- slices: 20
- }
-
- Transform {
- id: transform
- scale3D: Qt.vector3d(1.5, 1, 0.5)
- rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
- }
-
- Material {
- id: material
- effect : Effect {
- }
- }
-
- Entity {
- id: mainEntity
- objectName: "mainEntity"
- components: [ mesh, material, transform ]
- }
- }
-}
diff --git a/examples/qt3d/scene3d-loader/main.cpp b/examples/qt3d/scene3d-loader/main.cpp
deleted file mode 100644
index 0ed21fd88..000000000
--- a/examples/qt3d/scene3d-loader/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-#include <QQuickView>
-
-int main(int argc, char **argv)
-{
- QGuiApplication app(argc, argv);
-
- QQuickView view;
-
- view.resize(500, 500);
- view.setResizeMode(QQuickView::SizeRootObjectToView);
- view.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/scene3d-loader/main.qml b/examples/qt3d/scene3d-loader/main.qml
deleted file mode 100644
index d6d2750af..000000000
--- a/examples/qt3d/scene3d-loader/main.qml
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Scene3D 2.0
-import QtQuick.Controls 1.2
-
-Item {
-
- Loader {
- id: loader
- anchors.fill: parent
- focus: true
- source: "Scene.qml"
- }
-
- Row {
- id: buttonRow
- anchors {
- horizontalCenter: parent.horizontalCenter
- bottom: parent.bottom
- bottomMargin: parent.height * 0.1
- }
- spacing: 10
- Button {
- text: "Scene 1";
- isDefault: true
- onClicked: loader.source = "Scene.qml"
- }
- Button {
- text: "Scene 2";
- onClicked: loader.source = "Scene2.qml"
- }
- }
-}
diff --git a/examples/qt3d/scene3d-loader/scene3d-loader.pro b/examples/qt3d/scene3d-loader/scene3d-loader.pro
deleted file mode 100644
index 7a1efd955..000000000
--- a/examples/qt3d/scene3d-loader/scene3d-loader.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += qml quick 3dcore 3drender 3dinput
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- AnimatedEntity.qml \
- main.qml \
- Scene.qml \
- Scene2.qml
-
-RESOURCES += \
- scene3d-loader.qrc
diff --git a/examples/qt3d/scene3d/AnimatedEntity.qml b/examples/qt3d/scene3d/AnimatedEntity.qml
index 68871f04b..0f6b7da1a 100644
--- a/examples/qt3d/scene3d/AnimatedEntity.qml
+++ b/examples/qt3d/scene3d/AnimatedEntity.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
import QtQuick 2.0 as QQ2
@@ -47,33 +62,20 @@ Entity {
id: camera
projectionType: CameraLens.PerspectiveProjection
fieldOfView: 45
- aspectRatio: 16/9
nearPlane : 0.1
farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
- Configuration {
- controlledCamera: camera
- }
+ FirstPersonCameraController { camera: camera }
components: [
- FrameGraph {
- activeFrameGraph: Viewport {
- id: viewport
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0) // From Top Left
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ camera: camera
clearColor: "transparent"
-
- CameraSelector {
- id : cameraSelector
- camera: camera
-
- ClearBuffer {
- buffers : ClearBuffer.ColorDepthBuffer
- }
- }
}
}
]
diff --git a/examples/qt3d/scene3d/doc/src/scene3d.qdoc b/examples/qt3d/scene3d/doc/src/scene3d.qdoc
index 3b905f10a..e771c0192 100644
--- a/examples/qt3d/scene3d/doc/src/scene3d.qdoc
+++ b/examples/qt3d/scene3d/doc/src/scene3d.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/scene3d/main.cpp b/examples/qt3d/scene3d/main.cpp
index 0ed21fd88..8886263f4 100644
--- a/examples/qt3d/scene3d/main.cpp
+++ b/examples/qt3d/scene3d/main.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/scene3d/main.qml b/examples/qt3d/scene3d/main.qml
index 6419309a8..9b3528968 100644
--- a/examples/qt3d/scene3d/main.qml
+++ b/examples/qt3d/scene3d/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -64,9 +78,8 @@ Item {
Rectangle {
id: scene
- width: Math.min(parent.width, parent.height) - 100
- height: width
- anchors.centerIn: parent
+ anchors.fill: parent
+ anchors.margins: 50
color: "darkRed"
transform: Rotation {
@@ -84,6 +97,7 @@ Item {
anchors.margins: 10
focus: true
aspects: "input"
+ cameraAspectRatioMode: Scene3D.AutomaticAspectRatio
AnimatedEntity {}
}
diff --git a/examples/qt3d/shadow-map-qml/AdsEffect.qml b/examples/qt3d/shadow-map-qml/AdsEffect.qml
index 4d3924215..9bc81bf4c 100644
--- a/examples/qt3d/shadow-map-qml/AdsEffect.qml
+++ b/examples/qt3d/shadow-map-qml/AdsEffect.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -70,7 +84,7 @@ Effect {
renderPasses: [
RenderPass {
- annotations: [ Annotation { name: "pass"; value: "shadowmap" } ]
+ filterKeys: [ FilterKey { name: "pass"; value: "shadowmap" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/shadowmap.vert")
@@ -78,24 +92,13 @@ Effect {
}
renderStates: [
- PolygonOffset { factor: 4; units: 4 },
- DepthTest { func: DepthTest.Less }
+ PolygonOffset { scaleFactor: 4; depthSteps: 4 },
+ DepthTest { depthFunction: DepthTest.Less }
]
},
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- // The bindings property allows us to map from names of parameters (uniforms or vertex attributes)
- // within a shader to more friendly names in QML. By default the parameter names are exposed from
- // the shader so we only need to add add mappings where the names differ. E.g. here we map from the
- // ka uniform name in the shader to a property called ambient
- bindings: [
- // Uniforms (those provided by the user)
- ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapping.Uniform }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/ads.vert")
@@ -115,7 +118,7 @@ Effect {
renderPasses: [
RenderPass {
- annotations: [ Annotation { name: "pass"; value: "shadowmap" } ]
+ filterKeys: [ FilterKey { name: "pass"; value: "shadowmap" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es3/shadowmap.vert")
@@ -123,19 +126,13 @@ Effect {
}
renderStates: [
- PolygonOffset { factor: 4; units: 4 },
- DepthTest { func: DepthTest.Less }
+ PolygonOffset { scaleFactor: 4; depthSteps: 4 },
+ DepthTest { depthFunction: DepthTest.Less }
]
},
RenderPass {
- annotations: [ Annotation { name : "pass"; value : "forward" } ]
-
- bindings: [
- ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapping.Uniform }
- ]
+ filterKeys: [ FilterKey { name : "pass"; value : "forward" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/es3/ads.vert")
diff --git a/examples/qt3d/shadow-map-qml/AdsMaterial.qml b/examples/qt3d/shadow-map-qml/AdsMaterial.qml
index 184189074..7948b7733 100644
--- a/examples/qt3d/shadow-map-qml/AdsMaterial.qml
+++ b/examples/qt3d/shadow-map-qml/AdsMaterial.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/shadow-map-qml/GroundPlane.qml b/examples/qt3d/shadow-map-qml/GroundPlane.qml
index 3cade62b7..d78f5b07a 100644
--- a/examples/qt3d/shadow-map-qml/GroundPlane.qml
+++ b/examples/qt3d/shadow-map-qml/GroundPlane.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
diff --git a/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml b/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml
index 63cbfae82..068c93764 100644
--- a/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml
+++ b/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -38,7 +52,7 @@ import QtQuick 2.2 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
-FrameGraph {
+RenderSettings {
id: root
property alias viewCamera: viewCameraSelector.camera
@@ -46,55 +60,60 @@ FrameGraph {
readonly property Texture2D shadowTexture: depthTexture
activeFrameGraph: Viewport {
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- clearColor: Qt.rgba(0.0, 0.4, 0.7, 1.0)
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- RenderPassFilter {
- includes: [ Annotation { name: "pass"; value: "shadowmap" } ]
+ ClearBuffers {
+ clearColor: Qt.rgba(0.0, 0.4, 0.7, 1.0)
+ }
- RenderTargetSelector {
- target: RenderTarget {
- attachments: [
- RenderAttachment {
- name: "depth"
- type: RenderAttachment.DepthAttachment
- texture: Texture2D {
- id: depthTexture
- width: 1024
- height: 1024
- format: Texture.DepthFormat
- generateMipMaps: false
- magnificationFilter: Texture.Linear
- minificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.ClampToEdge
- y: WrapMode.ClampToEdge
+ RenderSurfaceSelector {
+ RenderPassFilter {
+ matchAny: [ FilterKey { name: "pass"; value: "shadowmap" } ]
+
+ RenderTargetSelector {
+ target: RenderTarget {
+ attachments: [
+ RenderTargetOutput {
+ objectName: "depth"
+ attachmentPoint: RenderTargetOutput.Depth
+ texture: Texture2D {
+ id: depthTexture
+ width: 1024
+ height: 1024
+ format: Texture.DepthFormat
+ generateMipMaps: false
+ magnificationFilter: Texture.Linear
+ minificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ comparisonFunction: Texture.CompareLessEqual
+ comparisonMode: Texture.CompareRefToTexture
}
- comparisonFunction: Texture.CompareLessEqual
- comparisonMode: Texture.CompareRefToTexture
}
- }
- ]
- }
+ ]
+ }
- ClearBuffer {
- buffers: ClearBuffer.DepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.DepthBuffer
- CameraSelector {
- id: lightCameraSelector
+ CameraSelector {
+ id: lightCameraSelector
+ }
}
}
}
- }
RenderPassFilter {
- includes: [ Annotation { name: "pass"; value: "forward" } ]
+ matchAny: [ FilterKey { name: "pass"; value: "forward" } ]
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
- CameraSelector {
- id: viewCameraSelector
+ CameraSelector {
+ id: viewCameraSelector
+ }
}
}
}
diff --git a/examples/qt3d/shadow-map-qml/ShadowMapLight.qml b/examples/qt3d/shadow-map-qml/ShadowMapLight.qml
index a0e0306b0..42d32021c 100644
--- a/examples/qt3d/shadow-map-qml/ShadowMapLight.qml
+++ b/examples/qt3d/shadow-map-qml/ShadowMapLight.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/shadow-map-qml/Toyplane.qml b/examples/qt3d/shadow-map-qml/Toyplane.qml
index 56ca11886..5a3cdcdd3 100644
--- a/examples/qt3d/shadow-map-qml/Toyplane.qml
+++ b/examples/qt3d/shadow-map-qml/Toyplane.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/shadow-map-qml/Trefoil.qml b/examples/qt3d/shadow-map-qml/Trefoil.qml
index 315e23a8f..c0aa27fa1 100644
--- a/examples/qt3d/shadow-map-qml/Trefoil.qml
+++ b/examples/qt3d/shadow-map-qml/Trefoil.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc b/examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc
index b22ebaf53..7edfd70ce 100644
--- a/examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc
+++ b/examples/qt3d/shadow-map-qml/doc/src/shadow-map-qml.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -121,7 +121,7 @@
\skipto import QtQuick
\printuntil Render 2.0
- The code defines a \l FrameGraph entity that has a tree of entities as the
+ The code defines a \l RendererSettings entity that has a tree of entities as the
active framegraph:
\printuntil clearColor
@@ -136,10 +136,10 @@
Viewport
RenderPassFilter
RenderTargetSelector
- ClearBuffer
+ ClearBuffers
CameraSelector
RenderPassFilter
- ClearBuffer
+ ClearBuffers
CameraSelector
\endcode
@@ -221,7 +221,7 @@
\printuntil }
Inside the technique, we finally have the definition of our two rendering
- passes. We \e tag each pass with an \l Annotation entity, matching the ones
+ passes. We \e tag each pass with an \l FilterKey entity, matching the ones
we specified in the framegraph configuration, so that each pass will have
different rendering settings:
diff --git a/examples/qt3d/shadow-map-qml/main.cpp b/examples/qt3d/shadow-map-qml/main.cpp
index f455f8d66..a8b76c224 100644
--- a/examples/qt3d/shadow-map-qml/main.cpp
+++ b/examples/qt3d/shadow-map-qml/main.cpp
@@ -1,44 +1,55 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <Qt3DQuick/QQmlAspectEngine>
-
#include <QGuiApplication>
#include <QQmlContext>
#include <QQmlEngine>
@@ -47,19 +58,10 @@ int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
view.resize(1600, 800);
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
- engine.setSource(QUrl("qrc:/main.qml"));
-
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/shadow-map-qml/main.qml b/examples/qt3d/shadow-map-qml/main.qml
index 37340053a..6c541eec5 100644
--- a/examples/qt3d/shadow-map-qml/main.qml
+++ b/examples/qt3d/shadow-map-qml/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,6 +51,8 @@
import QtQuick 2.1 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
Entity {
id: sceneRoot
@@ -53,9 +69,7 @@ Entity {
upVector: Qt.vector3d(0.0, 1.0, 0.0)
}
- Configuration {
- controlledCamera: camera
- }
+ FirstPersonCameraController { camera: camera }
ShadowMapLight {
id: light
@@ -66,7 +80,9 @@ Entity {
id: framegraph
viewCamera: camera
lightCamera: light.lightCamera
- }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
]
diff --git a/examples/qt3d/shadow-map-qml/shaders/ads.frag b/examples/qt3d/shadow-map-qml/shaders/ads.frag
index b2b056a3a..0dbcc57b6 100644
--- a/examples/qt3d/shadow-map-qml/shaders/ads.frag
+++ b/examples/qt3d/shadow-map-qml/shaders/ads.frag
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
diff --git a/examples/qt3d/shadow-map-qml/shaders/ads.vert b/examples/qt3d/shadow-map-qml/shaders/ads.vert
index e77a8f287..70a32be6d 100644
--- a/examples/qt3d/shadow-map-qml/shaders/ads.vert
+++ b/examples/qt3d/shadow-map-qml/shaders/ads.vert
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
diff --git a/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag b/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag
index becac915e..894b90b98 100644
--- a/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag
+++ b/examples/qt3d/shadow-map-qml/shaders/shadowmap.frag
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
diff --git a/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert b/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert
index a0b81a846..ea2cd5cc4 100644
--- a/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert
+++ b/examples/qt3d/shadow-map-qml/shaders/shadowmap.vert
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
diff --git a/examples/qt3d/shadow-map-qml/shadow-map-qml.pro b/examples/qt3d/shadow-map-qml/shadow-map-qml.pro
index b8f50aed0..0819dc196 100644
--- a/examples/qt3d/shadow-map-qml/shadow-map-qml.pro
+++ b/examples/qt3d/shadow-map-qml/shadow-map-qml.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput 3dquick qml quick
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
SOURCES += \
main.cpp
diff --git a/examples/qt3d/simple-cpp/doc/src/simple-cpp.qdoc b/examples/qt3d/simple-cpp/doc/src/simple-cpp.qdoc
index 4c76445e5..78a8a6dd4 100644
--- a/examples/qt3d/simple-cpp/doc/src/simple-cpp.qdoc
+++ b/examples/qt3d/simple-cpp/doc/src/simple-cpp.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/simple-cpp/main.cpp b/examples/qt3d/simple-cpp/main.cpp
index baaece681..d3a6728ca 100644
--- a/examples/qt3d/simple-cpp/main.cpp
+++ b/examples/qt3d/simple-cpp/main.cpp
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,119 +51,37 @@
#include <QGuiApplication>
#include <Qt3DCore/QEntity>
-#include <Qt3DCore/QCamera>
-#include <Qt3DCore/QCameraLens>
+#include <Qt3DRender/QCamera>
+#include <Qt3DRender/QCameraLens>
#include <Qt3DCore/QTransform>
#include <Qt3DCore/QAspectEngine>
#include <Qt3DInput/QInputAspect>
#include <Qt3DRender/QRenderAspect>
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QForwardRenderer>
-#include <Qt3DRender/QPhongMaterial>
-#include <Qt3DRender/QCylinderMesh>
-#include <Qt3DRender/QSphereMesh>
-#include <Qt3DRender/QTorusMesh>
-#include <Qt3DRender/QWindow>
+#include <Qt3DExtras//QForwardRenderer>
+#include <Qt3DExtras//QPhongMaterial>
+#include <Qt3DExtras/QCylinderMesh>
+#include <Qt3DExtras/QSphereMesh>
+#include <Qt3DExtras/QTorusMesh>
#include <QPropertyAnimation>
-class OrbitTransformController : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DCore::QTransform* target READ target WRITE setTarget NOTIFY targetChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(float angle READ angle WRITE setAngle NOTIFY angleChanged)
-
-public:
- OrbitTransformController(QObject *parent = 0)
- : QObject(parent)
- , m_target(Q_NULLPTR)
- , m_matrix()
- , m_radius(1.0f)
- , m_angle(0.0f)
- {
- }
-
- void setTarget(Qt3DCore::QTransform *target)
- {
- if (m_target != target) {
- m_target = target;
- emit targetChanged();
- }
- }
-
- Qt3DCore::QTransform *target() const { return m_target; }
-
- void setRadius(float radius)
- {
- if (!qFuzzyCompare(radius, m_radius)) {
- m_radius = radius;
- updateMatrix();
- emit radiusChanged();
- }
- }
-
- float radius() const { return m_radius; }
-
- void setAngle(float angle)
- {
- if (!qFuzzyCompare(angle, m_angle)) {
- m_angle = angle;
- updateMatrix();
- emit angleChanged();
- }
- }
-
- float angle() const { return m_angle; }
-
-signals:
- void targetChanged();
- void radiusChanged();
- void angleChanged();
-
-protected:
- void updateMatrix()
- {
- m_matrix.setToIdentity();
- m_matrix.rotate(m_angle, QVector3D(0.0f, 1.0f, 0.0f));
- m_matrix.translate(m_radius, 0.0f, 0.0f);
- m_target->setMatrix(m_matrix);
- }
-
-private:
- Qt3DCore::QTransform *m_target;
- QMatrix4x4 m_matrix;
- float m_radius;
- float m_angle;
-};
+#include "qt3dwindow.h"
+#include "orbittransformcontroller.h"
+#include "qorbitcameracontroller.h"
-int main(int argc, char* argv[])
+Qt3DCore::QEntity *createScene()
{
- QGuiApplication app(argc, argv);
- Qt3DRender::QWindow view;
- Qt3DInput::QInputAspect *input = new Qt3DInput::QInputAspect;
- view.registerAspect(input);
-
// Root entity
- Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
-
- // Camera
- Qt3DCore::QCamera *cameraEntity = view.defaultCamera();
-
- cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
- cameraEntity->setPosition(QVector3D(0, 0, -40.0f));
- cameraEntity->setUpVector(QVector3D(0, 1, 0));
- cameraEntity->setViewCenter(QVector3D(0, 0, 0));
- input->setCamera(cameraEntity);
+ Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity;
// Material
- Qt3DRender::QMaterial *material = new Qt3DRender::QPhongMaterial(rootEntity);
+ Qt3DRender::QMaterial *material = new Qt3DExtras::QPhongMaterial(rootEntity);
// Torus
Qt3DCore::QEntity *torusEntity = new Qt3DCore::QEntity(rootEntity);
- Qt3DRender::QTorusMesh *torusMesh = new Qt3DRender::QTorusMesh;
+ Qt3DExtras::QTorusMesh *torusMesh = new Qt3DExtras::QTorusMesh;
torusMesh->setRadius(5);
torusMesh->setMinorRadius(1);
torusMesh->setRings(100);
@@ -165,7 +97,7 @@ int main(int argc, char* argv[])
// Sphere
Qt3DCore::QEntity *sphereEntity = new Qt3DCore::QEntity(rootEntity);
- Qt3DRender::QSphereMesh *sphereMesh = new Qt3DRender::QSphereMesh;
+ Qt3DExtras::QSphereMesh *sphereMesh = new Qt3DExtras::QSphereMesh;
sphereMesh->setRadius(3);
Qt3DCore::QTransform *sphereTransform = new Qt3DCore::QTransform;
@@ -186,10 +118,30 @@ int main(int argc, char* argv[])
sphereEntity->addComponent(sphereTransform);
sphereEntity->addComponent(material);
- view.setRootEntity(rootEntity);
+ return rootEntity;
+}
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Qt3DWindow view;
+
+ Qt3DCore::QEntity *scene = createScene();
+
+ // Camera
+ Qt3DRender::QCamera *camera = view.camera();
+ camera->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
+ camera->setPosition(QVector3D(0, 0, 40.0f));
+ camera->setViewCenter(QVector3D(0, 0, 0));
+
+ // For camera controls
+ Qt3DExtras::QOrbitCameraController *camController = new Qt3DExtras::QOrbitCameraController(scene);
+ camController->setLinearSpeed( 50.0f );
+ camController->setLookSpeed( 180.0f );
+ camController->setCamera(camera);
+
+ view.setRootEntity(scene);
view.show();
return app.exec();
}
-
-#include "main.moc"
diff --git a/examples/qt3d/simple-cpp/orbittransformcontroller.cpp b/examples/qt3d/simple-cpp/orbittransformcontroller.cpp
new file mode 100644
index 000000000..0aa7a68e4
--- /dev/null
+++ b/examples/qt3d/simple-cpp/orbittransformcontroller.cpp
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "orbittransformcontroller.h"
+
+#include <Qt3DCore/qtransform.h>
+
+QT_BEGIN_NAMESPACE
+
+OrbitTransformController::OrbitTransformController(QObject *parent)
+ : QObject(parent)
+ , m_target(nullptr)
+ , m_matrix()
+ , m_radius(1.0f)
+ , m_angle(0.0f)
+{
+}
+
+void OrbitTransformController::setTarget(Qt3DCore::QTransform *target)
+{
+ if (m_target != target) {
+ m_target = target;
+ emit targetChanged();
+ }
+}
+
+Qt3DCore::QTransform *OrbitTransformController::target() const
+{
+ return m_target;
+}
+
+void OrbitTransformController::setRadius(float radius)
+{
+ if (!qFuzzyCompare(radius, m_radius)) {
+ m_radius = radius;
+ updateMatrix();
+ emit radiusChanged();
+ }
+}
+
+float OrbitTransformController::radius() const
+{
+ return m_radius;
+}
+
+void OrbitTransformController::setAngle(float angle)
+{
+ if (!qFuzzyCompare(angle, m_angle)) {
+ m_angle = angle;
+ updateMatrix();
+ emit angleChanged();
+ }
+}
+
+float OrbitTransformController::angle() const
+{
+ return m_angle;
+}
+
+void OrbitTransformController::updateMatrix()
+{
+ m_matrix.setToIdentity();
+ m_matrix.rotate(m_angle, QVector3D(0.0f, 1.0f, 0.0f));
+ m_matrix.translate(m_radius, 0.0f, 0.0f);
+ m_target->setMatrix(m_matrix);
+}
+
+QT_END_NAMESPACE
diff --git a/examples/qt3d/simple-cpp/orbittransformcontroller.h b/examples/qt3d/simple-cpp/orbittransformcontroller.h
new file mode 100644
index 000000000..5f41722b6
--- /dev/null
+++ b/examples/qt3d/simple-cpp/orbittransformcontroller.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ORBITTRANSFORMCONTROLLER_H
+#define ORBITTRANSFORMCONTROLLER_H
+
+#include <QObject>
+#include <QMatrix4x4>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QTransform;
+}
+
+class OrbitTransformController : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DCore::QTransform* target READ target WRITE setTarget NOTIFY targetChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+ Q_PROPERTY(float angle READ angle WRITE setAngle NOTIFY angleChanged)
+
+public:
+ OrbitTransformController(QObject *parent = 0);
+
+ void setTarget(Qt3DCore::QTransform *target);
+ Qt3DCore::QTransform *target() const;
+
+ void setRadius(float radius);
+ float radius() const;
+
+ void setAngle(float angle);
+ float angle() const;
+
+signals:
+ void targetChanged();
+ void radiusChanged();
+ void angleChanged();
+
+protected:
+ void updateMatrix();
+
+private:
+ Qt3DCore::QTransform *m_target;
+ QMatrix4x4 m_matrix;
+ float m_radius;
+ float m_angle;
+};
+
+QT_END_NAMESPACE
+
+#endif // ORBITTRANSFORMCONTROLLER_H
diff --git a/examples/qt3d/simple-cpp/simple-cpp.pro b/examples/qt3d/simple-cpp/simple-cpp.pro
index e562663bd..cf01c1242 100644
--- a/examples/qt3d/simple-cpp/simple-cpp.pro
+++ b/examples/qt3d/simple-cpp/simple-cpp.pro
@@ -2,7 +2,11 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput
+QT += 3dcore 3drender 3dinput 3dextras
SOURCES += \
- main.cpp
+ main.cpp \
+ orbittransformcontroller.cpp
+
+HEADERS += \
+ orbittransformcontroller.h
diff --git a/examples/qt3d/simple-qml/CameraController.qml b/examples/qt3d/simple-qml/CameraController.qml
index 0bfda31fb..69eff70ed 100644
--- a/examples/qt3d/simple-qml/CameraController.qml
+++ b/examples/qt3d/simple-qml/CameraController.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire <paul.lemire350@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -61,11 +75,11 @@ Entity {
property bool fineMotion: false
}
- KeyboardController {
+ KeyboardDevice {
id: keyboardSourceDevice
}
- MouseController {
+ MouseDevice {
id: mouseSourceDevice
sensitivity: d.fineMotion ? 0.01 : 0.1
}
@@ -79,7 +93,7 @@ Entity {
inputs: [
ActionInput {
sourceDevice: mouseSourceDevice
- keys: [MouseController.Left]
+ buttons: [MouseEvent.LeftButton]
}
]
},
@@ -88,7 +102,7 @@ Entity {
inputs: [
ActionInput {
sourceDevice: mouseSourceDevice
- keys: [MouseController.Right]
+ buttons: [MouseEvent.RightButton]
}
]
},
@@ -97,7 +111,7 @@ Entity {
inputs: [
ActionInput {
sourceDevice: keyboardSourceDevice
- keys: [Qt.Key_Shift]
+ buttons: [Qt.Key_Shift]
}
]
}
@@ -109,18 +123,18 @@ Entity {
Axis {
name: "RX"
inputs: [
- AxisInput {
+ AnalogAxisInput {
sourceDevice: mouseSourceDevice
- axis: MouseController.X
+ axis: MouseDevice.X
}
]
},
Axis {
name: "RY"
inputs: [
- AxisInput {
+ AnalogAxisInput {
sourceDevice: mouseSourceDevice
- axis: MouseController.Y
+ axis: MouseDevice.Y
}
]
},
@@ -128,14 +142,14 @@ Entity {
Axis {
name: "TX"
inputs: [
- AxisInput {
+ ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- keys: [Qt.Key_Left]
+ buttons: [Qt.Key_Left]
scale: -1.0
},
- AxisInput {
+ ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- keys: [Qt.Key_Right]
+ buttons: [Qt.Key_Right]
scale: 1.0
}
]
@@ -143,14 +157,14 @@ Entity {
Axis {
name: "TZ"
inputs: [
- AxisInput {
+ ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- keys: [Qt.Key_Up]
+ buttons: [Qt.Key_Up]
scale: 1.0
},
- AxisInput {
+ ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- keys: [Qt.Key_Down]
+ buttons: [Qt.Key_Down]
scale: -1.0
}
]
@@ -158,14 +172,14 @@ Entity {
Axis {
name: "TY"
inputs: [
- AxisInput {
+ ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- keys: [Qt.Key_PageUp]
+ buttons: [Qt.Key_PageUp]
scale: 1.0
},
- AxisInput {
+ ButtonAxisInput {
sourceDevice: keyboardSourceDevice
- keys: [Qt.Key_PageDown]
+ buttons: [Qt.Key_PageDown]
scale: -1.0
}
]
@@ -258,8 +272,8 @@ Entity {
}
},
- LogicComponent {
- onFrameUpdate: {
+ FrameAction {
+ onTriggered: {
// The time difference since the last frame is passed in as the
// argument dt. It is a floating point value in units of seconds.
root.camera.translate(Qt.vector3d(d.vx, d.vy, d.vz).times(dt))
diff --git a/examples/qt3d/simple-qml/doc/src/simple-qml.qdoc b/examples/qt3d/simple-qml/doc/src/simple-qml.qdoc
index 1173cbefe..36bb5497e 100644
--- a/examples/qt3d/simple-qml/doc/src/simple-qml.qdoc
+++ b/examples/qt3d/simple-qml/doc/src/simple-qml.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/simple-qml/main.cpp b/examples/qt3d/simple-qml/main.cpp
index 2305a685e..32ae912df 100644
--- a/examples/qt3d/simple-qml/main.cpp
+++ b/examples/qt3d/simple-qml/main.cpp
@@ -1,63 +1,61 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DLogic/QLogicAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <QGuiApplication>
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- engine.aspectEngine()->registerAspect(new Qt3DLogic::QLogicAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/simple-qml/main.qml b/examples/qt3d/simple-qml/main.qml
index f9cd23687..5eed965ca 100644
--- a/examples/qt3d/simple-qml/main.qml
+++ b/examples/qt3d/simple-qml/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,6 +51,8 @@
import QtQuick 2.2 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
Entity {
id: sceneRoot
@@ -53,17 +69,19 @@ Entity {
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
- CameraController {
+ OrbitCameraController {
camera: camera
}
components: [
- FrameGraph {
+ RenderSettings {
activeFrameGraph: ForwardRenderer {
clearColor: Qt.rgba(0, 0.5, 1, 1)
camera: camera
}
- }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
]
PhongMaterial {
diff --git a/examples/qt3d/simple-qml/simple-qml.pro b/examples/qt3d/simple-qml/simple-qml.pro
index 8abb2b301..f9fc1156b 100644
--- a/examples/qt3d/simple-qml/simple-qml.pro
+++ b/examples/qt3d/simple-qml/simple-qml.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput 3dquick 3dlogic qml quick
+QT += 3dcore 3drender 3dinput 3dquick 3dlogic qml quick 3dquickextras
SOURCES += \
main.cpp
diff --git a/examples/qt3d/simple-shaders-qml/main.cpp b/examples/qt3d/simple-shaders-qml/main.cpp
deleted file mode 100644
index a308bfacc..000000000
--- a/examples/qt3d/simple-shaders-qml/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/simple-shaders-qml/main.qml b/examples/qt3d/simple-shaders-qml/main.qml
deleted file mode 100644
index 08dbfbca3..000000000
--- a/examples/qt3d/simple-shaders-qml/main.qml
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.2 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 16/9
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration {
- controlledCamera: camera
- }
-
- components: [
- FrameGraph {
- activeFrameGraph: ForwardRenderer {
- clearColor: Qt.rgba(0, 0.5, 1, 1)
- camera: camera
- }
- }
- ]
-
- TorusMesh {
- id: torusMesh
- radius: 5
- minorRadius: 1
- rings: 100
- slices: 20
- }
-
- Entity {
- id: torusEntityInlineShader
-
- property Transform transform: Transform {
- matrix: {
- var m = Qt.matrix4x4();
- m.rotate(45, Qt.vector3d(1, 0, 0));
- m.translate(Qt.vector3d(-2.0, 0.0, 0.0));
- return m;
- }
- }
-
- // Shader defined inline
- property Material material: Material {
-
- parameters: Parameter { name: "finalColor"; value: "#e76140" /* Inferno Orange */ }
-
- effect: Effect {
- techniques: [
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- majorVersion: 3
- minorVersion: 2
- profile: GraphicsApiFilter.CoreProfile
- }
-
- renderPasses: RenderPass {
- shaderProgram: ShaderProgram {
-
- vertexShaderCode: "
- #version 150
-
- in vec3 vertexPosition;
- in vec3 vertexNormal;
-
- out vec3 position;
- out vec3 normal;
-
- uniform mat4 modelView;
- uniform mat3 modelViewNormal;
- uniform mat4 mvp;
-
- void main()
- {
- normal = normalize(modelViewNormal * vertexNormal);
- position = vec3(modelView * vec4(vertexPosition, 1.0));
- gl_Position = mvp * vec4(vertexPosition, 1.0);
- }
- "
-
- fragmentShaderCode: "
- #version 150
-
- in vec3 normal;
- in vec3 position;
-
- uniform vec3 finalColor;
-
- out vec4 fragColor;
-
- void main()
- {
- vec3 n = normalize(normal);
- vec3 s = normalize(vec3(1.0, 0.0, 1.0) - position);
- vec3 v = normalize(-position);
- float diffuse = max(dot(s, n), 0.0);
- fragColor = vec4(diffuse * finalColor, 1.0);
- }
- "
-
- } // ShaderProgram
- } // RenderPass
- } // Technique
- ] // techniques
- } // Effect
- } // Material
-
- components: [ torusMesh, material, transform ]
- }
-
- Entity {
- id: torusEntitySeparateShader
-
- property Transform transform: Transform {
- matrix: {
- var m = Qt.matrix4x4();
- m.rotate(15, Qt.vector3d(1, 0, 0));
- m.translate(Qt.vector3d(2.0, 0.0, 0.0));
- return m;
- }
- }
-
- // Shader defined in a separate file
- property Material material: Material {
-
- parameters: Parameter { name: "finalColor"; value: "yellow" }
-
- effect: Effect {
- techniques: [
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- majorVersion: 3
- minorVersion: 2
- profile: GraphicsApiFilter.CoreProfile
- }
-
- renderPasses: RenderPass {
- shaderProgram: ShaderProgram {
- vertexShaderCode: loadSource("qrc:/simple-shader.vert")
- fragmentShaderCode: loadSource("qrc:/simple-shader.frag")
- } // ShaderProgram
- } // namespace RenderPass
- } // Technique
- ] // techniques
- } // Effect
- } // Material
-
- components: [ torusMesh, material, transform ]
- }
-}
diff --git a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro b/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro
deleted file mode 100644
index 6da510e50..000000000
--- a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- simple-shader.vert \
- simple-shader.frag
-
-RESOURCES += \
- simple-shaders-qml.qrc
diff --git a/examples/qt3d/skybox/Skybox.qml b/examples/qt3d/skybox/Skybox.qml
deleted file mode 100644
index f040ba5a7..000000000
--- a/examples/qt3d/skybox/Skybox.qml
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
-
- property alias cameraPosition: transform.translation;
- property string sourceDirectory: "";
- property string extension: ".webp"
-
- property TextureCubeMap skyboxTexture: TextureCubeMap {
- generateMipMaps: false
- magnificationFilter: Texture.Linear
- minificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.ClampToEdge
- y: WrapMode.ClampToEdge
- }
- TextureImage { cubeMapFace: Texture.CubeMapPositiveX; source: sourceDirectory + "_posx" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapPositiveY; source: sourceDirectory + "_posy" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapPositiveZ; source: sourceDirectory + "_posz" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapNegativeX; source: sourceDirectory + "_negx" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapNegativeY; source: sourceDirectory + "_negy" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapNegativeZ; source: sourceDirectory + "_negz" + extension }
- }
-
- ShaderProgram {
- id: gl3SkyboxShader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/skybox.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/skybox.frag")
- }
-
- ShaderProgram {
- id: gl2es2SkyboxShader
- vertexShaderCode: loadSource("qrc:/shaders/es2/skybox.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/skybox.frag")
- }
-
- CuboidMesh {
- id: cuboidMesh
- yzMeshResolution: Qt.size(2, 2)
- xzMeshResolution: Qt.size(2, 2)
- xyMeshResolution: Qt.size(2, 2)
- }
-
- Transform {
- id: transform
- }
-
- Material {
- id: skyboxMaterial
- parameters: Parameter { name: "skyboxTexture"; value: skyboxTexture}
-
- effect: Effect {
- techniques: [
- // GL3 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass {
- shaderProgram: gl3SkyboxShader
- renderStates: [
- // cull front faces
- CullFace { mode: CullFace.Front },
- DepthTest { func: DepthTest.LessOrEqual }
- ]
- }
- },
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2SkyboxShader
- renderStates: [
- CullFace { mode: CullFace.Front },
- DepthTest { func: DepthTest.LessOrEqual }
- ]
- }
- },
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2SkyboxShader
- renderStates: [
- CullFace { mode: CullFace.Front },
- DepthTest { func: DepthTest.LessOrEqual }
- ]
- }
- }
- ]
- }
- }
-
- components: [cuboidMesh, skyboxMaterial, transform]
-}
-
diff --git a/examples/qt3d/skybox/doc/src/skybox.qdoc b/examples/qt3d/skybox/doc/src/skybox.qdoc
deleted file mode 100644
index e8ebf9b7f..000000000
--- a/examples/qt3d/skybox/doc/src/skybox.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example skybox
- \title Qt 3D: Skybox QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/skybox/main.cpp b/examples/qt3d/skybox/main.cpp
deleted file mode 100644
index 54c4b6650..000000000
--- a/examples/qt3d/skybox/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
-
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
- return app.exec();
-}
diff --git a/examples/qt3d/skybox/main.qml b/examples/qt3d/skybox/main.qml
deleted file mode 100644
index b8a202970..000000000
--- a/examples/qt3d/skybox/main.qml
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
-
- components: FrameGraph {
- ForwardRenderer {
- camera: basicCamera
- clearColor: "black"
- }
- }
-
- Camera {
- id: basicCamera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 60
- aspectRatio: 16/9
- nearPlane: 0.01
- farPlane: 1000.0
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- position: Qt.vector3d( 0.0, 0.0, -40.0 )
- }
-
- // So that the camera is rendered always at the same position as the camera
- SkyboxEntity {
- cameraPosition: basicCamera.position
- baseName: "qrc:/assets/cubemaps/miramar/miramar"
- extension: ".webp"
- }
-
- Configuration {
- controlledCamera: basicCamera
- }
-
- Entity {
- components: [
- SphereMesh { radius: 5 },
- PhongMaterial { diffuse: "dodgerblue" }
- ]
- }
-}
-
diff --git a/examples/qt3d/skybox/skybox.pro b/examples/qt3d/skybox/skybox.pro
deleted file mode 100644
index 919858d35..000000000
--- a/examples/qt3d/skybox/skybox.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-RESOURCES += \
- skybox.qrc \
- ../exampleresources/cubemaps.qrc
-
-SOURCES += \
- main.cpp
diff --git a/examples/qt3d/tessellation-modes/BasicCamera.qml b/examples/qt3d/tessellation-modes/BasicCamera.qml
deleted file mode 100644
index 79ff51822..000000000
--- a/examples/qt3d/tessellation-modes/BasicCamera.qml
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Camera {
- id: mainCamera
- objectName: "mainCamera"
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 22.5
- aspectRatio: _window.width / _window.height
- onAspectRatioChanged: console.log( "aspectRatio = " + aspectRatio )
- nearPlane: 0.01
- farPlane: 1000.0
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
-}
diff --git a/examples/qt3d/tessellation-modes/TessellatedQuad.qml b/examples/qt3d/tessellation-modes/TessellatedQuad.qml
deleted file mode 100644
index 363b43710..000000000
--- a/examples/qt3d/tessellation-modes/TessellatedQuad.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.1 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import Qt3D.Examples 1.0
-
-Entity {
- id: root
-
- property real x: 0.0
- property real y: 0.0
- property real z: 0.0
- property real scale: 1.0
- property real theta: 0.0
- property Material material
-
- components: [ transform, mesh, root.material ]
-
- Transform {
- id: transform
- translation: Qt.vector3d(root.x, root.y, root.z)
- rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), root.theta)
- scale: root.scale
- }
-
- TessellatedQuadMesh {
- id: mesh
- }
-}
diff --git a/examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml b/examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml
deleted file mode 100644
index 9a4a5002c..000000000
--- a/examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Effect {
- id: root
-
- // It's expected that users of this will specify the tessellation control and evaluation
- // shaders and if necessary suitable replacements for the other stages
- property alias vertexShaderCode: program.vertexShaderCode
- property alias tessellationControlShaderCode: program.tessellationControlShaderCode
- property alias tessellationEvaluationShaderCode: program.tessellationEvaluationShaderCode
- property alias geometryShaderCode: program.geometryShaderCode
- property alias fragmentShaderCode: program.fragmentShaderCode
- property alias shaderProgram: program
-
- parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },
- Parameter { name: "diffuse"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) },
- Parameter { name: "specular"; value: Qt.vector3d( 0.95, 0.95, 0.95 ) },
- Parameter { name: "shininess"; value: 150.0 }
- ]
-
- techniques: [
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 4
- minorVersion: 0
- }
-
- annotations: [ Annotation { name: "renderingStyle"; value: "forward" } ]
-
- parameters: [
- Parameter { name: "light.position"; value: Qt.vector4d(0.0, 0.0, 0.0, 1.0) },
- Parameter { name: "light.intensity"; value: Qt.vector3d(1.0, 1.0, 1.0) },
- Parameter { name: "line.width"; value: 0.8 },
- Parameter { name: "line.color"; value: Qt.vector4d(1.0, 1.0, 1.0, 1.0) }
- ]
-
- renderPasses: [
- RenderPass {
-
- bindings: [
- ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapping.Uniform },
-
- // TODO: Support uniform arrays. We want to be able to do (or something similar) and map vectors or lists of values
- // through to the uniforms
- ParameterMapping { parameterName: "innerTessLevel"; shaderVariableName: "inner[0]"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "outerTessLevel"; shaderVariableName: "outer[0]"; bindingType: ParameterMapping.Uniform }
- ]
-
- shaderProgram: ShaderProgram {
- id: program
- vertexShaderCode: loadSource("qrc:/shaders/passthru.vert")
- geometryShaderCode: loadSource("qrc:/shaders/robustwireframe.geom")
- fragmentShaderCode: loadSource("qrc:/shaders/phongwireframe.frag")
- }
- }
- ]
- }
- ]
-}
diff --git a/examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml b/examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml
deleted file mode 100644
index 98c5b4a7d..000000000
--- a/examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id: root
-
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
- property color specular: Qt.rgba( 0.95, 0.95, 0.95, 1.0 )
- property real shininess: 150.0
- property real lineWidth: 1.0
- property color lineColor: Qt.rgba( 1.0, 1.0, 1.0, 1.0 )
- property var innerTessLevel: [1.0, 1.0 ]
- property var outerTessLevel: [1.0, 1.0, 1.0, 1.0]
-
- parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter { name: "diffuse"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
- Parameter { name: "specular"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
- Parameter { name: "shininess"; value: root.shininess },
- Parameter { name: "line.width"; value: root.lineWidth },
- Parameter { name: "line.color"; value: root.lineColor },
- Parameter { name: "innerTessLevel"; value: root.innerTessLevel },
- Parameter { name: "outerTessLevel"; value: root.outerTessLevel }
- ]
-}
diff --git a/examples/qt3d/tessellation-modes/doc/src/tessellation-modes.qdoc b/examples/qt3d/tessellation-modes/doc/src/tessellation-modes.qdoc
deleted file mode 100644
index eb731d4b1..000000000
--- a/examples/qt3d/tessellation-modes/doc/src/tessellation-modes.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example tessellation-modes
- \title Qt 3D: Tessellation Modes QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/tessellation-modes/main.cpp b/examples/qt3d/tessellation-modes/main.cpp
deleted file mode 100644
index 427058be3..000000000
--- a/examples/qt3d/tessellation-modes/main.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tessellatedquadmesh.h"
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- // Register our custom types
- qmlRegisterType<TessellatedQuadMesh>("Qt3D.Examples", 1, 0, "TessellatedQuadMesh");
-
- // Expose the window as a context property so we can set the aspect ratio
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
-
- // There should be some synchronising mechanism to make sure
- // the source is set after all aspects have been completely initialized
- // Otherwise we might encounter cases where an Aspect's QML elements have
- // not yet been registered
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/tessellation-modes/main.qml b/examples/qt3d/tessellation-modes/main.qml
deleted file mode 100644
index e75664364..000000000
--- a/examples/qt3d/tessellation-modes/main.qml
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.1 as QQ2
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
- objectName: "root"
-
- // Use the renderer configuration specified in ForwardRenderer.qml
- // and render from the mainCamera
- components: [
- FrameGraph {
- activeFrameGraph: ForwardRenderer {
- id: renderer
- camera: mainCamera
- clearColor: "black"
- }
- }
- ]
-
- BasicCamera {
- id: mainCamera
- position: Qt.vector3d( 0.0, 0.0, 10.0 )
- }
-
- Configuration {
- controlledCamera: mainCamera
- }
-
- TessellatedWireframeMaterial {
- id: quadMaterial
- ambient: Qt.rgba( 0.2, 0.0, 0.0, 1.0 )
- diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )
-
- property real innerLevel : 1.0
- property real outerLevel : 1.0
-
- innerTessLevel : [innerLevel, innerLevel]
- outerTessLevel : [outerLevel, outerLevel, outerLevel, outerLevel]
-
- effect: TessellatedWireframeEffect {
- tessellationControlShaderCode: shaderProgram.loadSource("qrc:/shaders/quads.tcs")
- tessellationEvaluationShaderCode: shaderProgram.loadSource("qrc:/shaders/quads.tes")
- }
-
- QQ2.SequentialAnimation {
- loops: QQ2.Animation.Infinite
- running: true
-
- QQ2.NumberAnimation {
- target: quadMaterial;
- properties: "innerLevel,outerLevel";
- duration: 1000;
- from: 1.0
- to: 20.0
- }
-
- QQ2.NumberAnimation {
- target: quadMaterial;
- properties: "innerLevel,outerLevel";
- duration: 1000;
- from: 20.0
- to: 1.0
- }
- }
- }
-
- TessellatedQuad {
- id: quad
- material: quadMaterial
- }
-
- // TODO: Add examples for triangle and isoline tessellation modes
-}
diff --git a/examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp b/examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp
deleted file mode 100644
index b86a57a72..000000000
--- a/examples/qt3d/tessellation-modes/tessellatedquadmesh.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "tessellatedquadmesh.h"
-
-#include <Qt3DRender/qattribute.h>
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qgeometry.h>
-
-class TessellatedGeometry : public Qt3DRender::QGeometry
-{
- Q_OBJECT
-public:
- TessellatedGeometry(Qt3DCore::QNode *parent = Q_NULLPTR)
- : Qt3DRender::QGeometry(parent)
- , m_positionAttribute(new Qt3DRender::QAttribute(this))
- , m_vertexBuffer(new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, this))
- {
- const float positionData[] = {
- -0.8f, -0.8f, 0.0f,
- 0.8f, -0.8f, 0.0f,
- 0.8f, 0.8f, 0.0f,
- -0.8f, 0.8f, 0.0f
- };
-
- const int nVerts = 4;
- const int size = nVerts * 3 * sizeof(float);
- QByteArray positionBytes;
- positionBytes.resize(size);
- memcpy(positionBytes.data(), positionData, size);
-
- m_vertexBuffer->setData(positionBytes);
-
- m_positionAttribute->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(Qt3DRender::QAttribute::Float);
- m_positionAttribute->setDataSize(3);
- m_positionAttribute->setCount(nVerts);
- m_positionAttribute->setByteStride(3 * sizeof(float));
- m_positionAttribute->setBuffer(m_vertexBuffer);
-
- setVerticesPerPatch(4);
- addAttribute(m_positionAttribute);
- }
-
-private:
- Qt3DRender::QAttribute *m_positionAttribute;
- Qt3DRender::QBuffer *m_vertexBuffer;
-};
-
-TessellatedQuadMesh::TessellatedQuadMesh(Qt3DCore::QNode *parent)
- : Qt3DRender::QGeometryRenderer(parent)
-{
- setPrimitiveType(Qt3DRender::QGeometryRenderer::Patches);
- setGeometry(new TessellatedGeometry(this));
-}
-
-TessellatedQuadMesh::~TessellatedQuadMesh()
-{
- QNode::cleanup();
-}
-
-#include "tessellatedquadmesh.moc"
diff --git a/examples/qt3d/tessellation-modes/tessellatedquadmesh.h b/examples/qt3d/tessellation-modes/tessellatedquadmesh.h
deleted file mode 100644
index 0d95a8298..000000000
--- a/examples/qt3d/tessellation-modes/tessellatedquadmesh.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TESSELLATEDQUAD_H
-#define TESSELLATEDQUAD_H
-
-#include <Qt3DRender/qgeometryrenderer.h>
-
-class TessellatedQuadMesh : public Qt3DRender::QGeometryRenderer
-{
- Q_OBJECT
-public:
- explicit TessellatedQuadMesh(Qt3DCore::QNode *parent = 0);
- ~TessellatedQuadMesh();
-};
-
-#endif // TESSELLATEDQUAD_H
diff --git a/examples/qt3d/tessellation-modes/tessellation-modes.pro b/examples/qt3d/tessellation-modes/tessellation-modes.pro
deleted file mode 100644
index e6c758577..000000000
--- a/examples/qt3d/tessellation-modes/tessellation-modes.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-HEADERS += \
- tessellatedquadmesh.h
-
-SOURCES += \
- main.cpp \
- tessellatedquadmesh.cpp
-
-OTHER_FILES += \
- main.qml \
- BasicCamera.qml \
- TessellatedWireframeEffect.qml \
- TessellatedWireframeMaterial.qml \
- TessellatedQuad.qml \
- shaders/*
-
-RESOURCES += \
- tessellation-modes.qrc
diff --git a/examples/qt3d/torus-qml/doc/src/torus-qml.qdoc b/examples/qt3d/torus-qml/doc/src/torus-qml.qdoc
deleted file mode 100644
index 0004f7878..000000000
--- a/examples/qt3d/torus-qml/doc/src/torus-qml.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example torus-qml
- \title Qt 3D: Torus QML Example
- \ingroup qt3d-examples-qml
-*/
diff --git a/examples/qt3d/torus-qml/main.cpp b/examples/qt3d/torus-qml/main.cpp
deleted file mode 100644
index 24dbf55d5..000000000
--- a/examples/qt3d/torus-qml/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-#include <QtQml>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/torus-qml/main.qml b/examples/qt3d/torus-qml/main.qml
index 127106437..2c4f263fb 100644
--- a/examples/qt3d/torus-qml/main.qml
+++ b/examples/qt3d/torus-qml/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,8 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
Entity {
id: sceneRoot
@@ -47,24 +63,25 @@ Entity {
aspectRatio: 16/9
nearPlane : 0.1
farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, -20.0 )
+ position: Qt.vector3d( 0.0, 0.0, 20.0 )
upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
}
- Configuration {
- controlledCamera: camera
- }
+ FirstPersonCameraController { camera: camera }
- FrameGraph {
- id : external_forward_renderer
+ RenderSettings {
+ id : renderSettings
activeFrameGraph : ForwardRenderer {
camera: camera
- clearColor: "black"
+ clearColor: "lightsteelblue"
}
}
- components: [external_forward_renderer]
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { id: inputSettings }
+
+ components: [renderSettings, inputSettings]
TorusMesh {
id: mesh
diff --git a/examples/qt3d/torus-qml/torus-qml.pro b/examples/qt3d/torus-qml/torus-qml.pro
deleted file mode 100644
index dddcd9aad..000000000
--- a/examples/qt3d/torus-qml/torus-qml.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml
-
-RESOURCES += \
- torus-qml.qrc
diff --git a/examples/qt3d/torus-qml/torus-qml.qrc b/examples/qt3d/torus-qml/torus-qml.qrc
deleted file mode 100644
index 5f6483ac3..000000000
--- a/examples/qt3d/torus-qml/torus-qml.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/qt3d/transforms-qml/RenderableEntity.qml b/examples/qt3d/transforms-qml/RenderableEntity.qml
deleted file mode 100644
index 7a11f69b2..000000000
--- a/examples/qt3d/transforms-qml/RenderableEntity.qml
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
-
- property Material material: null
- property alias meshSource: mesh.source
- property alias translation: transform.translation
- property alias rotation: transform.rotation
- property alias scale: transform.scale
-
- components: [ transform, mesh, material ]
-
- Transform {
- id: transform
- }
-
- Mesh {
- id: mesh
- }
-}
diff --git a/examples/qt3d/transforms-qml/TemporaryCamera.qml b/examples/qt3d/transforms-qml/TemporaryCamera.qml
deleted file mode 100644
index 9a55662a5..000000000
--- a/examples/qt3d/transforms-qml/TemporaryCamera.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
-
- property vector3d pos: Qt.vector3d(0.0, 0.0, 0.0)
- property vector3d viewCenter: Qt.vector3d(0.0, 0.0, -10.0)
- property vector3d up: Qt.vector3d(0.0, 1.0, 0.0)
-
- components: [ transform, lens ]
-
- Transform {
- id: transform
-
- matrix: {
- var m = Qt.matrix4x4();
- m.lookAt( root.pos, root.viewCenter, root.up );
- return m;
- }
- }
-
- CameraLens {
- id: lens
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: _view.width / _view.height
- nearPlane: 0.1
- farPlane: 1000.0
- }
-}
diff --git a/examples/qt3d/transforms-qml/TrefoilKnot.qml b/examples/qt3d/transforms-qml/TrefoilKnot.qml
deleted file mode 100644
index a53a45dd6..000000000
--- a/examples/qt3d/transforms-qml/TrefoilKnot.qml
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: root
-
- property vector3d translation: Qt.vector3d(0.0, 0.0, 0.0)
- property real scale: 1.0
- property real theta: 0.0
- property real phi: 0.0
- property Material material
-
- components: [ transform, mesh, root.material ]
-
- Transform {
- id: transform
- translation: root.translation
- rotation: fromEulerAngles(theta, phi, 0)
- scale: root.scale
- }
-
- Mesh {
- id: mesh
- source: "assets/obj/trefoil.obj"
- }
-}
diff --git a/examples/qt3d/transforms-qml/main.cpp b/examples/qt3d/transforms-qml/main.cpp
deleted file mode 100644
index c01e066fe..000000000
--- a/examples/qt3d/transforms-qml/main.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QtQml>
-
-#include <QGuiApplication>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.qmlEngine()->rootContext()->setContextProperty("_view", &view);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/transforms-qml/main.qml b/examples/qt3d/transforms-qml/main.qml
deleted file mode 100644
index 332905f65..000000000
--- a/examples/qt3d/transforms-qml/main.qml
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
- id: sceneRoot
-
- components: [
- FrameGraph {
- activeFrameGraph: ForwardRenderer {
- clearColor: Qt.rgba(0, 0.5, 1, 1)
- camera: camera
- }
- }
- ]
-
- TemporaryCamera {
- id: camera
- pos: Qt.vector3d( 0.0, 0.0, 120.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- up: Qt.vector3d( 0.0, 1.0, 0.0 )
- }
-
- RenderableEntity {
- id: rootEntity
-
- meshSource: "assets/obj/toyplane.obj"
- material: PhongMaterial {
- diffuse: "red"
- }
-
- RenderableEntity {
- id: trefoil
-
- translation: Qt.vector3d( 0.0, 20.0, 0.0 )
- scale: 4
-
- meshSource: "assets/obj/trefoil.obj"
- material: PhongMaterial {
- diffuse: "green"
- }
-
- RenderableEntity {
- id: ball
-
- translation: Qt.vector3d( 0.0, 5.0, 0.0 )
- scale: 0.2
-
- meshSource: "assets/obj/ball.obj"
- material: PhongMaterial {
- diffuse: "purple"
- }
- }
- }
- }
-
- TrefoilKnot {
- translation: Qt.vector3d( 20, 0, 0 )
- scale: 6.0
- phi: 60.0
- material: PhongMaterial {
- diffuse: "grey"
- }
- }
-}
diff --git a/examples/qt3d/transforms-qml/transforms-qml.pro b/examples/qt3d/transforms-qml/transforms-qml.pro
deleted file mode 100644
index 18dd6fa43..000000000
--- a/examples/qt3d/transforms-qml/transforms-qml.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += 3dcore 3drender 3dinput 3dquick qml quick
-
-SOURCES += \
- main.cpp
-
-OTHER_FILES += \
- main.qml \
- RenderableEntity.qml \
- TemporaryCamera.qml \
- TrefoilKnot.qml
-
-RESOURCES += \
- transforms-qml.qrc \
- ../exampleresources/obj.qrc
diff --git a/examples/qt3d/transparency-qml-scene3d/Scene.qml b/examples/qt3d/transparency-qml-scene3d/Scene.qml
deleted file mode 100644
index 6b9b4683d..000000000
--- a/examples/qt3d/transparency-qml-scene3d/Scene.qml
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import QtQuick 2.2 as QQ2
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 800/600
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, 40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration { controlledCamera: camera }
-
- components: FrameGraph { ForwardRenderer{ camera: camera; clearColor: Qt.rgba(0.0, 0.5, 1, 1) } }
-
- TorusMesh {
- id: torusMesh
- radius: 5
- minorRadius: 1
- rings: 100
- slices: 20
- }
-
- SphereMesh {
- id: sphereMesh
- radius: 3
- }
-
- Transform {
- id: sphereTransform
- translation: Qt.vector3d(10, 0, 0)
- }
-
- Transform {
- id: cylinderTransform
- translation: Qt.vector3d(-10, 0, 0)
- }
-
- Entity {
- id: torusEntity
- components: [ torusMesh, phongMaterial ]
- }
-
- Entity {
- id: sphereEntity
- components: [ sphereMesh, alphaMaterial, sphereTransform ]
- }
-
- Entity {
- id: cylinderEntity
- components: [ sphereMesh, alphaMaterial, cylinderTransform ]
- }
-
- Material {
- id: alphaMaterial
-
- property real alpha: 0.5
-
- QQ2.NumberAnimation {
- duration: 2000
- loops: QQ2.Animation.Infinite
- target: alphaMaterial
- property: "alpha"
- from: 0.0
- to: 1.0
- running: true
- }
-
- effect: Effect {
- parameters: [
- Parameter { name: "alpha"; value: alphaMaterial.alpha },
- Parameter { name: "ka"; value: "black" },
- Parameter { name: "kd"; value: "blue" },
- Parameter { name: "ks"; value: "white" },
- Parameter { name: "shininess"; value: 75.0 },
- Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
- Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) }
- ]
-
- ShaderProgram {
- id: alphaPhong
- vertexShaderCode: loadSource("qrc:/phongalpha.vert")
- fragmentShaderCode: loadSource("qrc:/phongalpha.frag")
- }
-
- techniques: [
- Technique
- {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
-
- renderPasses: RenderPass {
- renderStates: [
- CullFace { mode : CullFace.Back },
- DepthTest { func: DepthTest.Less },
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- }
- ,BlendEquation {mode: BlendEquation.FuncAdd}
- ]
-
- shaderProgram: alphaPhong
- }
- },
- Technique
- {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
-
- renderPasses: RenderPass {
- renderStates: [
- CullFace { mode : CullFace.Back },
- DepthTest { func: DepthTest.Less },
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- }
- ,BlendEquation {mode: BlendEquation.FuncAdd}
- ]
-
- shaderProgram: alphaPhong
- }
- }
- ]
- }
- }
-
- PhongMaterial {
- id: phongMaterial
- }
-}
diff --git a/examples/qt3d/transparency-qml-scene3d/main.cpp b/examples/qt3d/transparency-qml-scene3d/main.cpp
deleted file mode 100644
index e65092a5b..000000000
--- a/examples/qt3d/transparency-qml-scene3d/main.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
-
- return app.exec();
-}
diff --git a/examples/qt3d/transparency-qml-scene3d/main.qml b/examples/qt3d/transparency-qml-scene3d/main.qml
deleted file mode 100644
index d1460c8fe..000000000
--- a/examples/qt3d/transparency-qml-scene3d/main.qml
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.4
-import QtQuick.Window 2.2
-import QtQuick.Scene3D 2.0
-
-Window {
- visible: true
- width: 800
- height: 600
-
- Scene3D {
- id: scene3D
- anchors.fill: parent
- focus: true
- aspects: "input"
- Scene {}
- }
-}
diff --git a/examples/qt3d/transparency-qml-scene3d/transparency-qml-scene3d.pro b/examples/qt3d/transparency-qml-scene3d/transparency-qml-scene3d.pro
deleted file mode 100644
index 063b44d00..000000000
--- a/examples/qt3d/transparency-qml-scene3d/transparency-qml-scene3d.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += qml quick 3dcore 3drender 3dinput 3dquick
-
-SOURCES += main.cpp
-
-RESOURCES += transparency-qml-scene3d.qrc
-
diff --git a/examples/qt3d/transparency-qml/main.cpp b/examples/qt3d/transparency-qml/main.cpp
deleted file mode 100644
index 1119d6a21..000000000
--- a/examples/qt3d/transparency-qml/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <window.h>
-#include <Qt3DRender/QRenderAspect>
-#include <Qt3DInput/QInputAspect>
-#include <Qt3DQuick/QQmlAspectEngine>
-
-#include <QGuiApplication>
-
-int main(int argc, char* argv[])
-{
- QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
- view.show();
-
- return app.exec();
-}
diff --git a/examples/qt3d/transparency-qml/main.qml b/examples/qt3d/transparency-qml/main.qml
deleted file mode 100644
index 8d104ab76..000000000
--- a/examples/qt3d/transparency-qml/main.qml
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-import QtQuick 2.4 as QQ2
-
-Entity {
- id: sceneRoot
-
- Camera {
- id: camera
- projectionType: CameraLens.PerspectiveProjection
- fieldOfView: 45
- aspectRatio: 800/600
- nearPlane : 0.1
- farPlane : 1000.0
- position: Qt.vector3d( 0.0, 0.0, 40.0 )
- upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
- viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
- }
-
- Configuration { controlledCamera: camera }
-
- components: FrameGraph { activeFrameGraph: ForwardRenderer{ camera: camera ; clearColor: Qt.rgba(0.0, 0.5, 1, 1) } }
-
- TorusMesh {
- id: torusMesh
- radius: 5
- minorRadius: 1
- rings: 100
- slices: 20
- }
-
- SphereMesh {
- id: sphereMesh
- radius: 3
- }
-
- Transform {
- id: sphereTransform
- translation: Qt.vector3d(10, 0, 0)
- }
-
- Transform {
- id: cylinderTransform
- translation: Qt.vector3d(-10, 0, 0)
- }
-
- Entity {
- id: torusEntity
- components: [ torusMesh, phongMaterial ]
- }
-
- Entity {
- id: sphereEntity
- components: [ sphereMesh, alphaMaterial, sphereTransform ]
- }
-
- Entity {
- id: cylinderEntity
- components: [ sphereMesh, alphaMaterial, cylinderTransform ]
- }
-
- Material
- {
- id: alphaMaterial
-
- property real alpha: 0.5
-
- QQ2.NumberAnimation {
- duration: 2000
- loops: QQ2.Animation.Infinite
- target: alphaMaterial
- property: "alpha"
- from: 0.0
- to: 1.0
- running: true
- }
-
- effect: Effect {
- parameters: [
- Parameter { name: "alpha"; value: alphaMaterial.alpha },
- Parameter { name: "ka"; value: "black" },
- Parameter { name: "kd"; value: "blue" },
- Parameter { name: "ks"; value: "white" },
- Parameter { name: "shininess"; value: 75.0 },
- Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
- Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) }
- ]
-
- ShaderProgram {
- id: alphaPhong
- vertexShaderCode: loadSource("qrc:/phongalpha.vert")
- fragmentShaderCode: loadSource("qrc:/phongalpha.frag")
- }
-
- techniques: [
- Technique
- {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
-
- renderPasses: RenderPass {
- renderStates: [
- CullFace { mode : CullFace.Back },
- DepthTest { func: DepthTest.Less },
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- }
- ,BlendEquation {mode: BlendEquation.FuncAdd}
- ]
-
- shaderProgram: alphaPhong
- }
- },
- Technique
- {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
-
- renderPasses: RenderPass {
- renderStates: [
- CullFace { mode : CullFace.Back },
- DepthTest { func: DepthTest.Less },
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- }
- ,BlendEquation {mode: BlendEquation.FuncAdd}
- ]
-
- shaderProgram: alphaPhong
- }
- }
- ]
- }
- }
-
- PhongMaterial {
- id: phongMaterial
- }
-}
diff --git a/examples/qt3d/transparency-qml/transparency-qml.pro b/examples/qt3d/transparency-qml/transparency-qml.pro
deleted file mode 100644
index e39694137..000000000
--- a/examples/qt3d/transparency-qml/transparency-qml.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-QT += qml quick 3dcore 3drender 3dinput 3dquick
-
-SOURCES += main.cpp
-
-RESOURCES += transparency-qml.qrc
-
diff --git a/examples/qt3d/wave/Background.qml b/examples/qt3d/wave/Background.qml
index c475b0e9a..6937026d6 100644
--- a/examples/qt3d/wave/Background.qml
+++ b/examples/qt3d/wave/Background.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,11 +51,13 @@
import QtQuick 2.1 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
property real hue: 0.0
property alias animateColors: hueAnim.running
+ property Layer layer: null
QQ2.NumberAnimation {
id: hueAnim
@@ -59,29 +75,27 @@ Entity {
property color color2: Qt.hsla( (hue + 0.59) % 1, 1.0, 0.15 )
}
- components: [
- Layer {
- names: "background"
- },
-
- PlaneMesh {
- width: 2.0
- height: 2.0
- meshResolution: Qt.size( 2, 2 )
- },
+ components: [ layer, mesh, transform, material ]
- Transform {
- // Rotate the plane so that it faces us
- rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90)
- },
+ PlaneMesh {
+ id: mesh
+ width: 2.0
+ height: 2.0
+ meshResolution: Qt.size( 2, 2 )
+ }
- Material {
- effect: BackgroundEffect {}
- parameters: [
- Parameter { name: "color1"; value: Qt.vector3d( _private.color1.r, _private.color1.g, _private.color1.b ) },
- Parameter { name: "color2"; value: Qt.vector3d( _private.color2.r, _private.color2.g, _private.color2.b ) }
- ]
- }
- ]
+ Transform {
+ id: transform
+ // Rotate the plane so that it faces us
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90)
+ }
+ Material {
+ id: material
+ effect: BackgroundEffect {}
+ parameters: [
+ Parameter { name: "color1"; value: Qt.vector3d( _private.color1.r, _private.color1.g, _private.color1.b ) },
+ Parameter { name: "color2"; value: Qt.vector3d( _private.color2.r, _private.color2.g, _private.color2.b ) }
+ ]
+ }
}
diff --git a/examples/qt3d/wave/BackgroundEffect.qml b/examples/qt3d/wave/BackgroundEffect.qml
index 16b9670a9..91d3c51cd 100644
--- a/examples/qt3d/wave/BackgroundEffect.qml
+++ b/examples/qt3d/wave/BackgroundEffect.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -49,7 +63,7 @@ Effect {
minorVersion: 1
}
- annotations: Annotation { name: "renderingStyle"; value: "forward" }
+ filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
renderPasses: [
RenderPass {
@@ -57,6 +71,10 @@ Effect {
vertexShaderCode: loadSource( "qrc:/shaders/background.vert" )
fragmentShaderCode: loadSource( "qrc:/shaders/background.frag" )
}
+
+ renderStates: [
+ DepthTest { depthFunction: DepthTest.Always }
+ ]
}
]
}
diff --git a/examples/qt3d/wave/BasicCamera.qml b/examples/qt3d/wave/BasicCamera.qml
index ab84dfe6a..c86b2f5b9 100644
--- a/examples/qt3d/wave/BasicCamera.qml
+++ b/examples/qt3d/wave/BasicCamera.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/wave/Wave.qml b/examples/qt3d/wave/Wave.qml
index 3af082ded..107502897 100644
--- a/examples/qt3d/wave/Wave.qml
+++ b/examples/qt3d/wave/Wave.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -36,6 +50,7 @@
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
@@ -49,14 +64,10 @@ Entity {
property color tint: Qt.rgba( 0.0, 0.0, 0.0, 1.0 )
property real intensity: 0.3
property alias wireframe: material.wireframe
+ property Layer layer: null
components: [ transform, mesh, material, layer ]
- Layer {
- id: layer
- names: "wave"
- }
-
Transform {
id: transform
translation: Qt.vector3d(root.x, root.y, root.z);
diff --git a/examples/qt3d/wave/WaveEffect.qml b/examples/qt3d/wave/WaveEffect.qml
index b83069163..dbada1562 100644
--- a/examples/qt3d/wave/WaveEffect.qml
+++ b/examples/qt3d/wave/WaveEffect.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -51,8 +65,8 @@ Effect {
//
// Material -> Effect -> Technique -> RenderPass -> GLSL default values
parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },
- Parameter { name: "diffuse"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) }
+ Parameter { name: "ka"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },
+ Parameter { name: "kd"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) }
]
techniques: [
@@ -64,7 +78,7 @@ Effect {
minorVersion: 2
}
- annotations: [ Annotation { name: "renderingStyle"; value: "forward" } ]
+ filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
parameters: [
Parameter { name: "light.position"; value: Qt.vector4d( 0.0, 0.0, 0.0, 1.0 ) },
@@ -75,20 +89,14 @@ Effect {
renderPasses: [
RenderPass {
- bindings: [
- ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform }
- ]
-
shaderProgram: wireframe ? wireframeShader : standardShader
// Disable depth testing and use simple additive blending
renderStates: [
- DepthTest { func: DepthTest.Always },
- DepthMask { mask: true },
- BlendState {
- srcRGB: BlendState.One
- dstRGB: BlendState.OneMinusSrcColor
+ DepthTest { depthFunction: DepthTest.Always },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.One
+ destinationRgb: BlendEquationArguments.OneMinusSourceColor
}
]
diff --git a/examples/qt3d/wave/WaveForwardRenderer.qml b/examples/qt3d/wave/WaveForwardRenderer.qml
index 32a1b77c3..48397243e 100644
--- a/examples/qt3d/wave/WaveForwardRenderer.qml
+++ b/examples/qt3d/wave/WaveForwardRenderer.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -42,25 +56,34 @@ TechniqueFilter {
// Expose camera to allow user to choose which camera to use for rendering
property alias camera: cameraSelector.camera
+ property alias window: surfaceSelector.surface
+
+ // Expose the layers we'll manage during rendering
+ readonly property Layer backgroundLayer: Layer {}
+ readonly property Layer waveLayer: Layer {}
// Select the forward rendering Technique of any used Effect
- requires: [ Annotation { name: "renderingStyle"; value: "forward" } ]
+ matchAll: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
- // Use the whole viewport
- Viewport {
- id: viewport
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+ RenderSurfaceSelector {
+ id: surfaceSelector
- // Use the specified camera
- CameraSelector {
- id: cameraSelector
+ // Use the whole viewport
+ Viewport {
+ id: viewport
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
- LayerFilter { layers: "background" }
- }
+ // Use the specified camera
+ CameraSelector {
+ id: cameraSelector
+
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
+ LayerFilter { layers: root.backgroundLayer }
+ }
- LayerFilter { layers: "wave" }
+ LayerFilter { layers: root.waveLayer }
+ }
}
}
}
diff --git a/examples/qt3d/wave/WaveMaterial.qml b/examples/qt3d/wave/WaveMaterial.qml
index fadae7c84..efec8d8e7 100644
--- a/examples/qt3d/wave/WaveMaterial.qml
+++ b/examples/qt3d/wave/WaveMaterial.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -49,8 +63,8 @@ Material {
effect: WaveEffect { id: effect }
parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter { name: "diffuse"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
Parameter { name: "line.width"; value: root.lineWidth },
Parameter { name: "line.color"; value: root.lineColor }
]
diff --git a/examples/qt3d/wave/doc/src/wave.qdoc b/examples/qt3d/wave/doc/src/wave.qdoc
index e0502f6b7..db6089c59 100644
--- a/examples/qt3d/wave/doc/src/wave.qdoc
+++ b/examples/qt3d/wave/doc/src/wave.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/examples/qt3d/wave/main.cpp b/examples/qt3d/wave/main.cpp
index c8c456f1a..56d78f17a 100644
--- a/examples/qt3d/wave/main.cpp
+++ b/examples/qt3d/wave/main.cpp
@@ -1,65 +1,67 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/qinputaspect.h>
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <Qt3DQuick/QQmlAspectEngine>
-
#include <QGuiApplication>
-#include <QtQml>
+#include <QQmlEngine>
+#include <QQmlContext>
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
// Expose the window as a context property so we can set the aspect ratio
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/wave/main.qml b/examples/qt3d/wave/main.qml
index 6f7aaddb9..bfe75c2a1 100644
--- a/examples/qt3d/wave/main.qml
+++ b/examples/qt3d/wave/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -38,15 +52,16 @@ import QtQuick 2.1 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
- KeyboardController { id: keyboard1 }
+ KeyboardDevice { id: keyboard1 }
- KeyboardInput {
+ KeyboardHandler {
id: input
- controller: keyboard1
+ sourceDevice: keyboard1
focus: true
onTabPressed: {
@@ -58,29 +73,32 @@ Entity {
}
}
- FrameGraph {
- id: frameGraph
+ RenderSettings {
+ id: renderSettings
activeFrameGraph: WaveForwardRenderer {
camera: mainCamera
}
}
- components: [ frameGraph, input ]
+ components: [ renderSettings, input, inputSettings ]
+
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { id: inputSettings }
BasicCamera {
id: mainCamera
position: Qt.vector3d( 0.0, 10.0, 25.0 )
}
- Configuration {
- controlledCamera: mainCamera
- }
+ FirstPersonCameraController { camera: mainCamera }
Background {
id: background
+ layer: renderSettings.activeFrameGraph.backgroundLayer
}
Wave {
id: wave
+ layer: renderSettings.activeFrameGraph.waveLayer
}
}
diff --git a/examples/qt3d/wave/wave.pro b/examples/qt3d/wave/wave.pro
index f07c740f9..45c8c64b6 100644
--- a/examples/qt3d/wave/wave.pro
+++ b/examples/qt3d/wave/wave.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dquick 3dinput qml quick
+QT += 3dcore 3drender 3dquick 3dinput qml quick 3dquickextras
HEADERS += \
@@ -18,6 +18,7 @@ OTHER_FILES += \
WaveEffect.qml \
WaveMaterial.qml \
Background.qml \
+ BackgroundEffect.qml \
shaders/background.vert \
shaders/background.frag
diff --git a/examples/qt3d/wireframe/BasicCamera.qml b/examples/qt3d/wireframe/BasicCamera.qml
index ab84dfe6a..c86b2f5b9 100644
--- a/examples/qt3d/wireframe/BasicCamera.qml
+++ b/examples/qt3d/wireframe/BasicCamera.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/wireframe/TrefoilKnot.qml b/examples/qt3d/wireframe/TrefoilKnot.qml
index dc124480b..104866d70 100644
--- a/examples/qt3d/wireframe/TrefoilKnot.qml
+++ b/examples/qt3d/wireframe/TrefoilKnot.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
diff --git a/examples/qt3d/wireframe/WireframeEffect.qml b/examples/qt3d/wireframe/WireframeEffect.qml
index b00e4cdc7..fb17afa0e 100644
--- a/examples/qt3d/wireframe/WireframeEffect.qml
+++ b/examples/qt3d/wireframe/WireframeEffect.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -41,9 +55,9 @@ Effect {
id: root
parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },
- Parameter { name: "diffuse"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) },
- Parameter { name: "specular"; value: Qt.vector3d( 0.95, 0.95, 0.95 ) },
+ Parameter { name: "ka"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },
+ Parameter { name: "kd"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) },
+ Parameter { name: "ks"; value: Qt.vector3d( 0.95, 0.95, 0.95 ) },
Parameter { name: "shininess"; value: 150.0 }
]
@@ -56,7 +70,7 @@ Effect {
minorVersion: 1
}
- annotations: [ Annotation { name: "renderingStyle"; value: "forward" } ]
+ filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
parameters: [
Parameter { name: "light.position"; value: Qt.vector4d( 0.0, 0.0, 0.0, 1.0 ) },
@@ -67,13 +81,6 @@ Effect {
renderPasses: [
RenderPass {
-
- bindings: [
- ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "diffuse"; shaderVariableName: "kd"; bindingType: ParameterMapping.Uniform },
- ParameterMapping { parameterName: "specular"; shaderVariableName: "ks"; bindingType: ParameterMapping.Uniform }
- ]
-
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/robustwireframe.vert")
geometryShaderCode: loadSource("qrc:/shaders/robustwireframe.geom")
diff --git a/examples/qt3d/wireframe/WireframeMaterial.qml b/examples/qt3d/wireframe/WireframeMaterial.qml
index 26bdb8f7e..96b00497a 100644
--- a/examples/qt3d/wireframe/WireframeMaterial.qml
+++ b/examples/qt3d/wireframe/WireframeMaterial.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -48,9 +62,9 @@ Material {
property color lineColor: Qt.rgba( 0.0, 0.0, 0.0, 1.0 )
parameters: [
- Parameter { name: "ambient"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter { name: "diffuse"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
- Parameter { name: "specular"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
+ Parameter { name: "ksp"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
Parameter { name: "shininess"; value: root.shininess },
Parameter { name: "line.width"; value: root.lineWidth },
Parameter { name: "line.color"; value: root.lineColor }
diff --git a/examples/qt3d/wireframe/doc/src/wireframe.qdoc b/examples/qt3d/wireframe/doc/src/wireframe.qdoc
index 078d81250..4f8566ed0 100644
--- a/examples/qt3d/wireframe/doc/src/wireframe.qdoc
+++ b/examples/qt3d/wireframe/doc/src/wireframe.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt.io/licensing/
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -131,7 +131,7 @@
\printuntil id
- The FrameGraph component uses the ForwardRenderer type to completely
+ The RendererSettings component uses the ForwardRenderer type to completely
configure the renderer without touching any C++ code:
\printuntil ]
diff --git a/examples/qt3d/wireframe/main.cpp b/examples/qt3d/wireframe/main.cpp
index de613c520..760786ee8 100644
--- a/examples/qt3d/wireframe/main.cpp
+++ b/examples/qt3d/wireframe/main.cpp
@@ -1,42 +1,54 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <window.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DInput/QInputAspect>
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
#include <Qt3DQuick/QQmlAspectEngine>
#include <QGuiApplication>
@@ -45,21 +57,11 @@
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
-
- Window view;
- Qt3DCore::Quick::QQmlAspectEngine engine;
-
- engine.aspectEngine()->registerAspect(new Qt3DRender::QRenderAspect());
- engine.aspectEngine()->registerAspect(new Qt3DInput::QInputAspect());
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
// Expose the window as a context property so we can set the aspect ratio
- engine.qmlEngine()->rootContext()->setContextProperty("_window", &view);
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view));
- engine.aspectEngine()->setData(data);
- engine.setSource(QUrl("qrc:/main.qml"));
-
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ view.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();
diff --git a/examples/qt3d/wireframe/main.qml b/examples/qt3d/wireframe/main.qml
index ed3f2899f..e0b6b3304 100644
--- a/examples/qt3d/wireframe/main.qml
+++ b/examples/qt3d/wireframe/main.qml
@@ -1,34 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
@@ -37,18 +51,22 @@
import QtQuick 2.1 as QQ2
import Qt3D.Core 2.0
import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
Entity {
id: root
// Render from the mainCamera
components: [
- FrameGraph {
+ RenderSettings {
activeFrameGraph: ForwardRenderer {
id: renderer
camera: mainCamera
}
- }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
]
BasicCamera {
@@ -56,9 +74,7 @@ Entity {
position: Qt.vector3d( 0.0, 0.0, 15.0 )
}
- Configuration {
- controlledCamera: mainCamera
- }
+ FirstPersonCameraController { camera: mainCamera }
WireframeMaterial {
id: wireframeMaterial
diff --git a/examples/qt3d/wireframe/wireframe.pro b/examples/qt3d/wireframe/wireframe.pro
index 6aeb7a5ae..a7c538bc8 100644
--- a/examples/qt3d/wireframe/wireframe.pro
+++ b/examples/qt3d/wireframe/wireframe.pro
@@ -2,7 +2,7 @@
error( "Couldn't find the examples.pri file!" )
}
-QT += 3dcore 3drender 3dinput 3dquick qml quick
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
HEADERS += \
diff --git a/src/3rdparty/assimp/code/BlenderTessellator.cpp b/src/3rdparty/assimp/code/BlenderTessellator.cpp
index 98ccbad6a..8a7e274a3 100644
--- a/src/3rdparty/assimp/code/BlenderTessellator.cpp
+++ b/src/3rdparty/assimp/code/BlenderTessellator.cpp
@@ -146,7 +146,7 @@ void BlenderTessellatorGL::TriangulateDrawCalls( const TessDataGL& tessData )
for ( unsigned int i = 0; i < tessData.drawCalls.size( ); ++i )
{
const DrawCallGL& drawCallGL = tessData.drawCalls[ i ];
- const VertexGL* vertices = &tessData.vertices[ drawCallGL.baseVertex ];
+ const VertexGL* vertices = &tessData.vertices[ drawCallGL.baseVertex ];
if ( drawCallGL.drawMode == GL_TRIANGLES )
{
MakeFacesFromTris( vertices, drawCallGL.vertexCount );
diff --git a/src/3rdparty/assimp/code/FBXConverter.cpp b/src/3rdparty/assimp/code/FBXConverter.cpp
index 56643bccc..c6ef8c908 100644
--- a/src/3rdparty/assimp/code/FBXConverter.cpp
+++ b/src/3rdparty/assimp/code/FBXConverter.cpp
@@ -1259,7 +1259,7 @@ private:
// taking notes so we don't need to do it twice.
BOOST_FOREACH(WeightIndexArray::value_type index, indices) {
- unsigned int count;
+ unsigned int count = 0;
const unsigned int* const out_idx = geo.ToOutputVertexIndex(index, count);
index_out_indices.push_back(no_index_sentinel);
diff --git a/src/3rdparty/patches/0005-assimp-Fix-build-FBXConverter.patch b/src/3rdparty/patches/0005-assimp-Fix-build-FBXConverter.patch
new file mode 100644
index 000000000..9290b30aa
--- /dev/null
+++ b/src/3rdparty/patches/0005-assimp-Fix-build-FBXConverter.patch
@@ -0,0 +1,35 @@
+From 1e39e6b296b94852e73adea1cb652adda435529e Mon Sep 17 00:00:00 2001
+From: Anton Kudryavtsev <a.kudryavtsev@netris.ru>
+Date: Mon, 21 Mar 2016 16:43:43 +0300
+Subject: [PATCH] assimp: Fix build FBXConverter.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If you compile according to https://wiki.qt.io/Qt5ForAndroidBuilding
+with NDK v11.b, you get such warning and the compilation stops:
+
+FBXConverter.cpp:1262:19: warning: ‘count’ may be used uninitialized in this function [-Wmaybe-uninitialized]
+ unsigned int count;
+
+Change-Id: Ieff61e6302800a22080f837267982fd2ea3129e6
+---
+ src/3rdparty/assimp/code/FBXConverter.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/3rdparty/assimp/code/FBXConverter.cpp b/src/3rdparty/assimp/code/FBXConverter.cpp
+index 56643bc..c6ef8c9 100644
+--- a/src/3rdparty/assimp/code/FBXConverter.cpp
++++ b/src/3rdparty/assimp/code/FBXConverter.cpp
+@@ -1259,7 +1259,7 @@ private:
+ // taking notes so we don't need to do it twice.
+ BOOST_FOREACH(WeightIndexArray::value_type index, indices) {
+
+- unsigned int count;
++ unsigned int count = 0;
+ const unsigned int* const out_idx = geo.ToOutputVertexIndex(index, count);
+
+ index_out_indices.push_back(no_index_sentinel);
+--
+1.9.1
+
diff --git a/src/core/aspects/aspects.pri b/src/core/aspects/aspects.pri
index 4bc8bad44..40bbfe739 100644
--- a/src/core/aspects/aspects.pri
+++ b/src/core/aspects/aspects.pri
@@ -1,3 +1,4 @@
+#DEFINES += QT3D_CORE_JOB_TIMING
SOURCES += \
$$PWD/qabstractaspect.cpp \
diff --git a/src/core/aspects/qabstractaspect.cpp b/src/core/aspects/qabstractaspect.cpp
index 1e7b3bbb4..95c81e15e 100644
--- a/src/core/aspects/qabstractaspect.cpp
+++ b/src/core/aspects/qabstractaspect.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,24 +45,24 @@
#include <private/qchangearbiter_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/private/qnodevisitor_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/private/corelogging_p.h>
QT_BEGIN_NAMESPACE
-static QByteArray className(const QMetaObject &obj)
-{
- // note: class names are stored in static meta objects, thus the usage of fromRawData here is fine
- return QByteArray::fromRawData(obj.className(), int(strlen(obj.className())));
-}
-
namespace Qt3DCore {
QAbstractAspectPrivate::QAbstractAspectPrivate()
: QObjectPrivate()
- , m_root(Q_NULLPTR)
- , m_aspectManager(Q_NULLPTR)
- , m_jobManager(Q_NULLPTR)
- , m_arbiter(Q_NULLPTR)
+ , m_root(nullptr)
+ , m_rootId()
+ , m_aspectManager(nullptr)
+ , m_jobManager(nullptr)
+ , m_arbiter(nullptr)
+{
+}
+
+QAbstractAspectPrivate::~QAbstractAspectPrivate()
{
}
@@ -69,59 +72,94 @@ QAbstractAspectPrivate *QAbstractAspectPrivate::get(QAbstractAspect *aspect)
}
/*!
- \class Qt3DCore::QAbstractAspect
- \inmodule Qt3DCore
- \brief QAbstractAspect is the base class for aspects that provide a vertical slice of behavior.
-*/
-QAbstractAspect::QAbstractAspect(QObject *parent)
- : QObject(*new QAbstractAspectPrivate, parent)
+ * \internal
+ * Called in the context of the main thread
+ */
+void QAbstractAspectPrivate::onEngineAboutToShutdown()
{
}
+
/*!
- \typedef Qt3DCore::QAspectJobPtr
- \relates Qt3DCore::QAbstractAspect
+ * \class Qt3DCore::QAbstractAspect
+ * \inherits QObject
+ * \inmodule Qt3DCore
+ * \brief QAbstractAspect is the base class for aspects that provide a vertical slice of behavior.
+ */
- A shared pointer for QAspectJob.
-*/
+/*!
+ * \fn void QAbstractAspect::registerBackendType(const QBackendNodeMapperPtr &functor)
+ * Registers backend with \a functor.
+ */
/*!
- \typedef Qt3DCore::QBackendNodeFunctorPtr
- \relates Qt3DCore::QAbstractAspect
+ * \internal
+ * \fn void registerBackendType(const QBackendNodeMapperPtr &functor)
+ * This is a workaround to fix an erroneous qdoc warning. KEEP IT INTERNAL
+ */
- A shared pointer for QBackendNodeFunctor.
-*/
+/*!
+ * Constructs a new QAbstractAspect with \a parent
+ */
+QAbstractAspect::QAbstractAspect(QObject *parent)
+ : QAbstractAspect(*new QAbstractAspectPrivate, parent) {}
/*!
- \internal
-*/
+ * \typedef Qt3DCore::QAspectJobPtr
+ * \relates Qt3DCore::QAbstractAspect
+ *
+ * A shared pointer for QAspectJob.
+ */
+
+/*!
+ * \typedef Qt3DCore::QBackendNodeMapperPtr
+ * \relates Qt3DCore::QAbstractAspect
+ *
+ * A shared pointer for QBackendNodeMapper.
+ */
+
+/*!
+ * \internal
+ */
QAbstractAspect::QAbstractAspect(QAbstractAspectPrivate &dd, QObject *parent)
: QObject(dd, parent)
{
}
+
/*!
- Registers backend.
+ \internal
*/
-void QAbstractAspect::registerBackendType(const QMetaObject &obj, const QBackendNodeFunctorPtr &functor)
+QAbstractAspect::~QAbstractAspect()
+{
+}
+
+/*!
+ * \return root entity node id.
+ */
+QNodeId QAbstractAspect::rootEntityId() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QAbstractAspect);
+ return d->m_rootId;
+}
+
+/*!
+ * Registers backend with \a obj and \a functor.
+ */
+void QAbstractAspect::registerBackendType(const QMetaObject &obj, const QBackendNodeMapperPtr &functor)
{
Q_D(QAbstractAspect);
- d->m_backendCreatorFunctors.insert(className(obj), functor);
+ d->m_backendCreatorFunctors.insert(&obj, functor);
}
-void QAbstractAspectPrivate::sceneNodeAdded(QSceneChangePtr &e)
+void QAbstractAspectPrivate::sceneNodeAdded(QSceneChangePtr &change)
{
- QScenePropertyChangePtr propertyChange = e.staticCast<QScenePropertyChange>();
- QNodePtr nodePtr = propertyChange->value().value<QNodePtr>();
- QNode *n = nodePtr.data();
- QNodeVisitor visitor;
- visitor.traverse(n, this, &QAbstractAspectPrivate::createBackendNode);
+ QNodeCreatedChangeBasePtr creationChange = qSharedPointerCast<QNodeCreatedChangeBase>(change);
+ createBackendNode(creationChange);
}
-void QAbstractAspectPrivate::sceneNodeRemoved(QSceneChangePtr &e)
+void QAbstractAspectPrivate::sceneNodeRemoved(QSceneChangePtr &change)
{
- QScenePropertyChangePtr propertyChange = e.staticCast<QScenePropertyChange>();
- QNodePtr nodePtr = propertyChange->value().value<QNodePtr>();
- QNode *n = nodePtr.data();
- clearBackendNode(n);
+ QNodeDestroyedChangePtr destructionChange = qSharedPointerCast<QNodeDestroyedChange>(change);
+ clearBackendNode(destructionChange);
}
QVariant QAbstractAspect::executeCommand(const QStringList &args)
@@ -130,69 +168,96 @@ QVariant QAbstractAspect::executeCommand(const QStringList &args)
return QVariant();
}
-QBackendNode *QAbstractAspectPrivate::createBackendNode(QNode *frontend) const
+QVector<QAspectJobPtr> QAbstractAspect::jobsToExecute(qint64 time)
{
- const QMetaObject *metaObj = frontend->metaObject();
- QBackendNodeFunctorPtr functor;
- while (metaObj != Q_NULLPTR && functor.isNull()) {
- functor = m_backendCreatorFunctors.value(className(*metaObj));
+ Q_UNUSED(time);
+ return QVector<QAspectJobPtr>();
+}
+
+QBackendNode *QAbstractAspectPrivate::createBackendNode(const QNodeCreatedChangeBasePtr &change) const
+{
+ const QMetaObject *metaObj = change->metaObject();
+ QBackendNodeMapperPtr backendNodeMapper;
+ while (metaObj != nullptr && backendNodeMapper.isNull()) {
+ backendNodeMapper = m_backendCreatorFunctors.value(metaObj);
metaObj = metaObj->superClass();
}
- if (!functor.isNull()) {
- QBackendNode *backend = functor->get(frontend->id());
- if (backend != Q_NULLPTR)
- return backend;
- backend = functor->create(frontend, this);
- // backend could be null if the user decides that his functor should only
- // perform some action when encountering a given type of item but doesn't need to
- // return a QBackendNode pointer.
- if (backend == Q_NULLPTR)
- return Q_NULLPTR;
- QBackendNodePrivate *backendPriv = QBackendNodePrivate::get(backend);
- // TO DO: Find a way to specify the changes to observe
- // Register backendNode with QChangeArbiter
- if (m_arbiter != Q_NULLPTR) { // Unit tests may not have the arbiter registered
- m_arbiter->registerObserver(backendPriv, backend->peerUuid(), AllChanges);
- if (backend->mode() == QBackendNode::ReadWrite)
- m_arbiter->scene()->addObservable(backendPriv, backend->peerUuid());
- }
+
+ if (!backendNodeMapper)
+ return nullptr;
+
+ QBackendNode *backend = backendNodeMapper->get(change->subjectId());
+ if (backend != nullptr)
return backend;
+ backend = backendNodeMapper->create(change);
+
+ if (!backend)
+ return nullptr;
+
+ // TODO: Find some place else to do all of this function from the arbiter
+ backend->setPeerId(change->subjectId());
+ backend->initializeFromPeer(change);
+
+ // Backend could be null if the user decides that his functor should only
+ // perform some action when encountering a given type of item but doesn't need to
+ // return a QBackendNode pointer.
+
+ QBackendNodePrivate *backendPriv = QBackendNodePrivate::get(backend);
+ backendPriv->setEnabled(change->isNodeEnabled());
+ // TO DO: Find a way to specify the changes to observe
+ // Register backendNode with QChangeArbiter
+ if (m_arbiter != nullptr) { // Unit tests may not have the arbiter registered
+ qCDebug(Nodes) << q_func()->objectName() << "Creating backend node for node id"
+ << change->subjectId() << "of type" << change->metaObject()->className();
+ m_arbiter->registerObserver(backendPriv, backend->peerId(), AllChanges);
+ if (backend->mode() == QBackendNode::ReadWrite)
+ m_arbiter->scene()->addObservable(backendPriv, backend->peerId());
}
- return Q_NULLPTR;
+ return backend;
}
-void QAbstractAspectPrivate::clearBackendNode(QNode *frontend) const
+void QAbstractAspectPrivate::clearBackendNode(const QNodeDestroyedChangePtr &change) const
{
- const QMetaObject *metaObj = frontend->metaObject();
- QBackendNodeFunctorPtr functor;
+ // Each QNodeDestroyedChange may contain info about a whole sub-tree of nodes that
+ // are being destroyed. Iterate over them and process each in turn
+ for (const auto &idAndType : change->subtreeIdsAndTypes()) {
+ const QMetaObject *metaObj = idAndType.type;
+ QBackendNodeMapperPtr backendNodeMapper;
- while (metaObj != Q_NULLPTR && functor.isNull()) {
- functor = m_backendCreatorFunctors.value(className(*metaObj));
- metaObj = metaObj->superClass();
- }
- if (!functor.isNull()) {
- QBackendNode *backend = functor->get(frontend->id());
- if (backend != Q_NULLPTR) {
+ // Find backend node mapper for this type
+ while (metaObj != nullptr && backendNodeMapper.isNull()) {
+ backendNodeMapper = m_backendCreatorFunctors.value(metaObj);
+ metaObj = metaObj->superClass();
+ }
+
+ if (!backendNodeMapper)
+ continue;
+
+ // Request the mapper to destroy the corresponding backend node
+ QBackendNode *backend = backendNodeMapper->get(idAndType.id);
+ if (backend) {
+ qCDebug(Nodes) << q_func()->objectName() << "Deleting backend node for node id"
+ << idAndType.id << "of type" << idAndType.type->className();
QBackendNodePrivate *backendPriv = QBackendNodePrivate::get(backend);
- m_arbiter->unregisterObserver(backendPriv, backend->peerUuid());
+ m_arbiter->unregisterObserver(backendPriv, backend->peerId());
if (backend->mode() == QBackendNode::ReadWrite)
- m_arbiter->scene()->removeObservable(backendPriv, backend->peerUuid());
- functor->destroy(frontend->id());
+ m_arbiter->scene()->removeObservable(backendPriv, backend->peerId());
+ backendNodeMapper->destroy(idAndType.id);
}
}
}
-void QAbstractAspectPrivate::registerAspect(QEntity *rootObject)
+void QAbstractAspectPrivate::setRootAndCreateNodes(QEntity *rootObject, const QVector<QNodeCreatedChangeBasePtr> &changes)
{
- Q_Q(QAbstractAspect);
+ qCDebug(Aspects) << Q_FUNC_INFO << "rootObject =" << rootObject;
if (rootObject == m_root)
return;
m_root = rootObject;
+ m_rootId = rootObject->id();
- QNodeVisitor visitor;
- visitor.traverse(rootObject, this, &QAbstractAspectPrivate::createBackendNode);
- q->onRootEntityChanged(rootObject);
+ for (const auto &change : changes)
+ createBackendNode(change);
}
QServiceLocator *QAbstractAspectPrivate::services() const
@@ -211,19 +276,46 @@ QVector<QAspectJobPtr> QAbstractAspectPrivate::jobsToExecute(qint64 time)
return q->jobsToExecute(time);
}
-void QAbstractAspect::onStartup()
+/*!
+ * Called in the context of the aspect thread once the aspect has been registered.
+ * This provides an opportunity for the aspect to do any initialization tasks that
+ * require to be in the aspect thread context such as creating QObject subclasses that
+ * must have affinity with this thread.
+ *
+ * \sa onUnregistered
+ */
+void QAbstractAspect::onRegistered()
{
}
-void QAbstractAspect::onShutdown()
+/*!
+ * Called in the context of the aspect thread during unregistration
+ * of the aspect. This gives the aspect a chance to do any final pieces of
+ * cleanup that it would not do when just changing to a new scene.
+ *
+ * \sa onRegistered
+ */
+void QAbstractAspect::onUnregistered()
{
}
-void QAbstractAspect::onRootEntityChanged(QEntity *rootEntity)
+/*!
+ *
+ * Called in the QAspectThread context
+ */
+void QAbstractAspect::onEngineStartup()
+{
+}
+
+/*!
+ *
+ * Called in the QAspectThread context
+ */
+void QAbstractAspect::onEngineShutdown()
{
- Q_UNUSED(rootEntity);
}
+
} // of namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/aspects/qabstractaspect.h b/src/core/aspects/qabstractaspect.h
index 7724a6e02..bfe2ccc21 100644
--- a/src/core/aspects/qabstractaspect.h
+++ b/src/core/aspects/qabstractaspect.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,6 +43,7 @@
#include <QObject>
#include <QSharedPointer>
#include <Qt3DCore/qt3dcore_global.h>
+#include <Qt3DCore/qnodeid.h>
QT_BEGIN_NAMESPACE
@@ -51,37 +55,38 @@ class QAspectManager;
class QNode;
class QEntity;
class QAbstractAspectPrivate;
-class QBackendNodeFunctor;
+class QBackendNodeMapper;
typedef QSharedPointer<QAspectJob> QAspectJobPtr;
-typedef QSharedPointer<QBackendNodeFunctor> QBackendNodeFunctorPtr;
+typedef QSharedPointer<QBackendNodeMapper> QBackendNodeMapperPtr;
class QT3DCORESHARED_EXPORT QAbstractAspect : public QObject
{
Q_OBJECT
public:
- explicit QAbstractAspect(QObject *parent = Q_NULLPTR);
+ explicit QAbstractAspect(QObject *parent = nullptr);
+ ~QAbstractAspect();
protected:
- QAbstractAspect(QAbstractAspectPrivate &dd, QObject *parent = Q_NULLPTR);
+ explicit QAbstractAspect(QAbstractAspectPrivate &dd, QObject *parent = nullptr);
+
+ QNodeId rootEntityId() const Q_DECL_NOEXCEPT;
template<class Frontend>
- void registerBackendType(const QBackendNodeFunctorPtr &functor);
- void registerBackendType(const QMetaObject &, const QBackendNodeFunctorPtr &functor);
+ void registerBackendType(const QBackendNodeMapperPtr &functor);
+ void registerBackendType(const QMetaObject &, const QBackendNodeMapperPtr &functor);
private:
virtual QVariant executeCommand(const QStringList &args);
- virtual QVector<QAspectJobPtr> jobsToExecute(qint64 time) = 0;
-
- virtual void onInitialize(const QVariantMap &data) = 0;
- virtual void onCleanup() = 0;
+ virtual QVector<QAspectJobPtr> jobsToExecute(qint64 time);
- virtual void onStartup();
- virtual void onShutdown();
+ virtual void onRegistered();
+ virtual void onUnregistered();
- virtual void onRootEntityChanged(QEntity *rootEntity);
+ virtual void onEngineStartup();
+ virtual void onEngineShutdown();
Q_DECLARE_PRIVATE(QAbstractAspect)
friend class QAspectEngine;
@@ -89,7 +94,7 @@ private:
};
template<class Frontend>
-void QAbstractAspect::registerBackendType(const QBackendNodeFunctorPtr &functor)
+void QAbstractAspect::registerBackendType(const QBackendNodeMapperPtr &functor)
{
registerBackendType(Frontend::staticMetaObject, functor);
}
diff --git a/src/core/aspects/qabstractaspect_p.h b/src/core/aspects/qabstractaspect_p.h
index 445441067..f4d51257e 100644
--- a/src/core/aspects/qabstractaspect_p.h
+++ b/src/core/aspects/qabstractaspect_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,6 +57,7 @@
#include <private/qbackendnodefactory_p.h>
#include <private/qsceneobserverinterface_p.h>
#include <private/qt3dcore_global_p.h>
+#include <Qt3DCore/qnodedestroyedchange.h>
#include <Qt3DCore/qabstractaspect.h>
QT_BEGIN_NAMESPACE
@@ -76,27 +80,31 @@ class QT3DCORE_PRIVATE_EXPORT QAbstractAspectPrivate
{
public:
QAbstractAspectPrivate();
+ ~QAbstractAspectPrivate();
- void registerAspect(QEntity *rootObject);
+ void setRootAndCreateNodes(QEntity *rootObject, const QVector<Qt3DCore::QNodeCreatedChangeBasePtr> &changes);
QServiceLocator *services() const;
QAbstractAspectJobManager *jobManager() const;
QVector<QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_OVERRIDE;
- QBackendNode *createBackendNode(QNode *frontend) const Q_DECL_OVERRIDE;
- void clearBackendNode(QNode *frontend) const;
+ QBackendNode *createBackendNode(const QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ void clearBackendNode(const QNodeDestroyedChangePtr &change) const;
void sceneNodeAdded(Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
void sceneNodeRemoved(Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ virtual void onEngineAboutToShutdown();
+
Q_DECLARE_PUBLIC(QAbstractAspect)
QEntity *m_root;
+ QNodeId m_rootId;
QAspectManager *m_aspectManager;
QAbstractAspectJobManager *m_jobManager;
QChangeArbiter *m_arbiter;
- QHash<QByteArray, QBackendNodeFunctorPtr> m_backendCreatorFunctors;
+ QHash<const QMetaObject*, QBackendNodeMapperPtr> m_backendCreatorFunctors;
static QAbstractAspectPrivate *get(QAbstractAspect *aspect);
};
diff --git a/src/core/aspects/qaspectengine.cpp b/src/core/aspects/qaspectengine.cpp
index 38f85b0a6..08891e349 100644
--- a/src/core/aspects/qaspectengine.cpp
+++ b/src/core/aspects/qaspectengine.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -53,6 +56,7 @@
#include "qentity.h"
#include "qcomponent.h"
#include <Qt3DCore/private/qeventfilterservice_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DCore/private/qservicelocator_p.h>
QT_BEGIN_NAMESPACE
@@ -61,20 +65,28 @@ namespace Qt3DCore {
QAspectEnginePrivate::QAspectEnginePrivate()
: QObjectPrivate()
- , m_postman(Q_NULLPTR)
- , m_scene(Q_NULLPTR)
+ , m_postman(nullptr)
+ , m_scene(nullptr)
{
qRegisterMetaType<Qt3DCore::QAbstractAspect *>();
qRegisterMetaType<Qt3DCore::QObserverInterface *>();
+ qRegisterMetaType<Qt3DCore::QNode *>();
qRegisterMetaType<Qt3DCore::QEntity *>();
qRegisterMetaType<Qt3DCore::QScene *>();
qRegisterMetaType<Qt3DCore::QAbstractPostman *>();
}
+QAspectEnginePrivate::~QAspectEnginePrivate()
+{
+ qDeleteAll(m_aspects);
+}
+
/*!
- Used to init the scene tree when the Qt3D aspect is first started. Basically
- sets the scene/change arbiter on the items and store the entity - component
- pairs in the scene
+ * \internal
+ *
+ * Used to init the scene tree when the Qt3D aspect is first started. Basically,
+ * sets the scene/change arbiter on the items and stores the entity - component
+ * pairs in the scene
*/
void QAspectEnginePrivate::initNode(QNode *node)
{
@@ -84,15 +96,40 @@ void QAspectEnginePrivate::initNode(QNode *node)
void QAspectEnginePrivate::initEntity(QEntity *entity)
{
- Q_FOREACH (QComponent *comp, entity->components()) {
+ const auto components = entity->components();
+ for (QComponent *comp : components) {
if (!m_scene->hasEntityForComponent(comp->id(), entity->id())) {
- if (!comp->shareable() && !m_scene->entitiesForComponent(comp->id()).isEmpty())
+ if (!comp->isShareable() && !m_scene->entitiesForComponent(comp->id()).isEmpty())
qWarning() << "Trying to assign a non shareable component to more than one Entity";
m_scene->addEntityForComponent(comp->id(), entity->id());
}
}
}
+void QAspectEnginePrivate::generateCreationChanges(QNode *root)
+{
+ const QNodeCreatedChangeGenerator generator(root);
+ m_creationChanges = generator.creationChanges();
+}
+
+/*!
+ * \class Qt3DCore::QAspectEngine
+ * \inherits QObject
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QEntityPtr
+ * \relates Qt3DCore::QAspectEngine
+ *
+ * A shared pointer for QEntity.
+ */
+
+/*!
+ * Constructs a new QAspectEngine with \a parent.
+ */
QAspectEngine::QAspectEngine(QObject *parent)
: QObject(*new QAspectEnginePrivate, parent)
{
@@ -109,10 +146,24 @@ QAspectEngine::QAspectEngine(QObject *parent)
d->m_aspectThread->waitForStart(QThread::HighestPriority);
}
+/*!
+ * Destroys the engine.
+ */
QAspectEngine::~QAspectEngine()
{
Q_D(QAspectEngine);
- setRootEntity(Q_NULLPTR);
+
+ // Shutdown the simulation loop by setting an empty scene
+ setRootEntity(QEntityPtr());
+
+ // Unregister all aspects and exit the main loop
+ const auto aspects = d->m_aspects;
+ for (auto aspect : aspects)
+ unregisterAspect(aspect);
+
+ d->m_aspectThread->aspectManager()->quit();
+ d->m_aspectThread->wait();
+
delete d->m_aspectThread;
delete d->m_postman;
delete d->m_scene;
@@ -137,60 +188,35 @@ void QAspectEnginePrivate::initialize()
Q_ARG(Qt3DCore::QScene*, m_scene));
}
+/*!
+ * \internal
+ *
+ * Called when we unset the root entity. Causes the QAspectManager's simulation
+ * loop to be exited. The main loop should keep processing events ready
+ * to start up the simulation again with a new root entity.
+ */
void QAspectEnginePrivate::shutdown()
{
qCDebug(Aspects) << Q_FUNC_INFO;
// Cleanup the scene before quitting the backend
- m_scene->setArbiter(Q_NULLPTR);
+ m_scene->setArbiter(nullptr);
QChangeArbiter *arbiter = m_aspectThread->aspectManager()->changeArbiter();
QChangeArbiter::destroyUnmanagedThreadLocalChangeQueue(arbiter);
-
- // Tell the aspect thread to exit
- // This will return only after the aspectManager has
- // exited its exec loop
- m_aspectThread->aspectManager()->quit();
-
- // Wait for thread to exit
- m_aspectThread->wait();
-
- qCDebug(Aspects) << Q_FUNC_INFO << "deleting aspects";
- // Deletes aspects in the same thread as the one they were created in
- qDeleteAll(m_aspects);
-
- qCDebug(Aspects) << Q_FUNC_INFO << "Shutdown complete";
-}
-
-// Main thread
-void QAspectEngine::setData(const QVariantMap &data)
-{
- Q_D(QAspectEngine);
-
- // We need to initialize the EventFilterService in the main thread
- // as we can register event filters only on QObjects of the same thread
- QObject *eventSource = Q_NULLPTR;
- const QVariant &eventSourceVariant = data.value(QStringLiteral("eventSource"));
- if (eventSourceVariant.isValid() &&
- (eventSource = eventSourceVariant.value<QObject *>()) != Q_NULLPTR) {
- QEventFilterService *eventFilterService = d->m_aspectThread->aspectManager()->serviceLocator()->eventFilterService();
- if (eventFilterService != Q_NULLPTR)
- eventFilterService->initialize(eventSource);
- }
-
- QMetaObject::invokeMethod(d->m_aspectThread->aspectManager(),
- "setData",
- Qt::BlockingQueuedConnection,
- Q_ARG(const QVariantMap &, data));
}
/*!
- * Registers a new \a aspect to the AspectManager.
- * Passing as a QObject* as abstracts like AbstractAspect
- * cannot be registered as a meta type.
+ * Registers a new \a aspect to the AspectManager. The QAspectEngine takes
+ * ownership of the aspect and will delete it when the aspect is unregistered.
*/
+// Called in the main thread
void QAspectEngine::registerAspect(QAbstractAspect *aspect)
{
Q_D(QAspectEngine);
+ // The aspect is moved to the AspectThread
+ // AspectManager::registerAspect is called in the context
+ // of the AspectThread. This is turns call aspect->onInitialize
+ // still in the same AspectThread context
aspect->moveToThread(d->m_aspectThread);
d->m_aspects << aspect;
QMetaObject::invokeMethod(d->m_aspectThread->aspectManager(),
@@ -208,16 +234,81 @@ void QAspectEngine::registerAspect(const QString &name)
{
Q_D(QAspectEngine);
QAbstractAspect *aspect = d->m_factory.createAspect(name);
- if (aspect)
+ if (aspect) {
registerAspect(aspect);
+ d->m_namedAspects.insert(name, aspect);
+ }
}
-QList<QAbstractAspect *> QAspectEngine::aspects() const
+/*!
+ * Unregisters and deletes the given \a aspect.
+ */
+void QAspectEngine::unregisterAspect(QAbstractAspect *aspect)
+{
+ Q_D(QAspectEngine);
+ if (!d->m_aspects.contains(aspect)) {
+ qWarning() << "Attempting to unregister an aspect that is not registered";
+ return;
+ }
+
+ // Cleanly shutdown this aspect by setting its root entity to null which
+ // will cause its onEngineShutdown() virtual to be called to allow it to
+ // cleanup any resources. Then remove it from the QAspectManager's list
+ // of aspects.
+ // TODO: Implement this once we are able to cleanly shutdown
+
+ // Tell the aspect manager to give the aspect a chance to do some cleanup
+ // in its QAbstractAspect::onUnregistered() virtual
+ QMetaObject::invokeMethod(d->m_aspectThread->aspectManager(),
+ "unregisterAspect",
+ Qt::BlockingQueuedConnection,
+ Q_ARG(Qt3DCore::QAbstractAspect *, aspect));
+
+ // Remove from our collection of named aspects (if present)
+ const auto it = std::find_if(d->m_namedAspects.begin(), d->m_namedAspects.end(),
+ [aspect](QAbstractAspect *v) { return v == aspect; });
+ if (it != d->m_namedAspects.end())
+ d->m_namedAspects.erase(it);
+
+ // Finally, scheduly the aspect for deletion. Do this via the event loop
+ // in case we are unregistering the aspect in response to a signal from it.
+ aspect->deleteLater();
+ d->m_aspects.removeOne(aspect);
+}
+
+/*!
+ * Unregisters and deletes the aspect with the given \a name.
+ */
+void QAspectEngine::unregisterAspect(const QString &name)
+{
+ Q_D(QAspectEngine);
+ if (!d->m_namedAspects.contains(name)) {
+ qWarning() << "Attempting to unregister an aspect that is not registered";
+ return;
+ }
+
+ // Delegate unregistering and removal to the overload
+ QAbstractAspect *aspect = d->m_namedAspects.value(name);
+ unregisterAspect(aspect);
+}
+
+/*!
+ * \return the aspects owned by the aspect engine.
+ */
+QVector<QAbstractAspect *> QAspectEngine::aspects() const
{
Q_D(const QAspectEngine);
return d->m_aspects;
}
+/*!
+ * Executes the given \a command on aspect engine. Valid commands are:
+ * \list
+ * \li "list aspects"
+ * \endlist
+ *
+ * \return the reply for the command.
+ */
QVariant QAspectEngine::executeCommand(const QString &command)
{
Q_D(QAspectEngine);
@@ -226,22 +317,22 @@ QVariant QAspectEngine::executeCommand(const QString &command)
if (d->m_aspects.isEmpty())
return QLatin1Literal("No loaded aspect");
- QStringList reply;
- reply << QLatin1Literal("Loaded aspects:");
- foreach (QAbstractAspect *aspect, d->m_aspects) {
+ QString reply;
+ reply += QLatin1String("Loaded aspects:");
+ for (QAbstractAspect *aspect : qAsConst(d->m_aspects)) {
const QString name = d->m_factory.aspectName(aspect);
if (!name.isEmpty())
- reply << (QLatin1Literal(" * ") + name);
+ reply += QLatin1String("\n * ") + name;
else
- reply << QLatin1Literal(" * <unnamed>");
+ reply += QLatin1String("\n * <unnamed>");
}
- return reply.join(QLatin1Char('\n'));
+ return reply;
}
QStringList args = command.split(QLatin1Char(' '));
QString aspectName = args.takeFirst();
- foreach (QAbstractAspect *aspect, d->m_aspects) {
+ for (QAbstractAspect *aspect : qAsConst(d->m_aspects)) {
if (aspectName == d->m_factory.aspectName(aspect))
return aspect->executeCommand(args);
}
@@ -249,9 +340,12 @@ QVariant QAspectEngine::executeCommand(const QString &command)
return QVariant();
}
-void QAspectEngine::setRootEntity(QEntity *root)
+/*!
+ * Sets the \a root entity for the aspect engine.
+ */
+void QAspectEngine::setRootEntity(QEntityPtr root)
{
- qCDebug(Aspects) << "Setting scene root on aspect manager";
+ qCDebug(Aspects) << Q_FUNC_INFO << "root =" << root;
Q_D(QAspectEngine);
if (d->m_root == root)
return;
@@ -261,15 +355,18 @@ void QAspectEngine::setRootEntity(QEntity *root)
// Set the new root object. This will cause the old tree to be deleted
// and the deletion of the old frontend tree will cause the backends to
// free any related resources
- d->m_root.reset(root);
+ d->m_root = root;
- if (shutdownNeeded)
+ if (shutdownNeeded) {
d->shutdown();
+ d->m_aspectThread->aspectManager()->exitSimulationLoop();
+ }
// Do we actually have a new scene?
if (!d->m_root)
return;
+ // Set postman/scene/arbiter ...
d->initialize();
// The aspect engine takes ownership of the scene root. We also set the
@@ -280,19 +377,32 @@ void QAspectEngine::setRootEntity(QEntity *root)
// scene object and adding each node to the scene
// TODO: We probably need a call symmetric to this one above in order to
// deregister the nodes from the scene
- d->initNodeTree(root);
+ d->initNodeTree(root.data());
+
+ // Traverse tree to generate a vector of creation changes
+ d->generateCreationChanges(root.data());
// Finally, tell the aspects about the new scene object tree. This is done
- // in a blocking manner to allow the backends to get synchronized before the
+ // in a blocking manner to allow the aspects to get synchronized before the
// main thread starts triggering potentially more notifications
+
+ // TODO: Pass the creation changes via the arbiter rather than relying upon
+ // an invokeMethod call.
+ qCDebug(Aspects) << "Begin setting scene root on aspect manager";
QMetaObject::invokeMethod(d->m_aspectThread->aspectManager(),
"setRootEntity",
Qt::BlockingQueuedConnection,
- Q_ARG(Qt3DCore::QEntity *, root));
+ Q_ARG(Qt3DCore::QEntity *, root.data()),
+ Q_ARG(QVector<Qt3DCore::QNodeCreatedChangeBasePtr>, d->m_creationChanges));
qCDebug(Aspects) << "Done setting scene root on aspect manager";
+
+ d->m_aspectThread->aspectManager()->enterSimulationLoop();
}
-QSharedPointer<QEntity> QAspectEngine::rootEntity() const
+/*!
+ * \return the root entity of the aspect engine.
+ */
+QEntityPtr QAspectEngine::rootEntity() const
{
Q_D(const QAspectEngine);
return d->m_root;
diff --git a/src/core/aspects/qaspectengine.h b/src/core/aspects/qaspectengine.h
index 37d0ac22e..6de5df42c 100644
--- a/src/core/aspects/qaspectengine.h
+++ b/src/core/aspects/qaspectengine.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,7 +41,7 @@
#define QT3DCORE_QASPECTENGINE_H
#include <QObject>
-#include <QList>
+#include <QVector>
#include <Qt3DCore/qt3dcore_global.h>
@@ -52,21 +55,24 @@ class QAspectEnginePrivate;
class QEntity;
class QNode;
+typedef QSharedPointer<QEntity> QEntityPtr;
+
class QT3DCORESHARED_EXPORT QAspectEngine : public QObject
{
Q_OBJECT
public:
- explicit QAspectEngine(QObject *parent = Q_NULLPTR);
+ explicit QAspectEngine(QObject *parent = nullptr);
~QAspectEngine();
- void setRootEntity(QEntity *root);
- QSharedPointer<QEntity> rootEntity() const;
+ void setRootEntity(QEntityPtr root);
+ QEntityPtr rootEntity() const;
- void setData(const QVariantMap &data);
void registerAspect(QAbstractAspect *aspect);
void registerAspect(const QString &name);
+ void unregisterAspect(QAbstractAspect *aspect);
+ void unregisterAspect(const QString &name);
- QList<QAbstractAspect*> aspects() const;
+ QVector<QAbstractAspect*> aspects() const;
QVariant executeCommand(const QString &command);
diff --git a/src/core/aspects/qaspectengine_p.h b/src/core/aspects/qaspectengine_p.h
index 030c3de13..3639a5f84 100644
--- a/src/core/aspects/qaspectengine_p.h
+++ b/src/core/aspects/qaspectengine_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,6 +52,7 @@
//
#include <private/qobject_p.h>
+#include <Qt3DCore/qnodecreatedchange.h>
#include <Qt3DCore/private/qaspectfactory_p.h>
#include <QtCore/qsharedpointer.h>
@@ -67,6 +71,7 @@ class QAspectEnginePrivate : public QObjectPrivate
{
public:
QAspectEnginePrivate();
+ ~QAspectEnginePrivate();
Q_DECLARE_PUBLIC(QAspectEngine)
@@ -75,7 +80,8 @@ public:
QPostman *m_postman;
QScene *m_scene;
QSharedPointer<QEntity> m_root;
- QList<QAbstractAspect*> m_aspects;
+ QVector<QAbstractAspect*> m_aspects;
+ QHash<QString, QAbstractAspect *> m_namedAspects;
void initialize();
void shutdown();
@@ -83,6 +89,9 @@ public:
void initNodeTree(QNode *node);
void initNode(QNode *node);
void initEntity(QEntity *entity);
+
+ void generateCreationChanges(QNode *rootNode);
+ QVector<QNodeCreatedChangeBasePtr> m_creationChanges;
};
} // Qt3D
diff --git a/src/core/aspects/qaspectfactory.cpp b/src/core/aspects/qaspectfactory.cpp
index eeebba39c..cc9ce91a9 100644
--- a/src/core/aspects/qaspectfactory.cpp
+++ b/src/core/aspects/qaspectfactory.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -93,7 +96,7 @@ QAbstractAspect *QAspectFactory::createAspect(const QString &aspect, QObject *pa
return m_factories.value(aspect)(parent);
} else {
qWarning() << "Unsupported aspect name:" << aspect << "please check registrations";
- return Q_NULLPTR;
+ return nullptr;
}
}
diff --git a/src/core/aspects/qaspectfactory_p.h b/src/core/aspects/qaspectfactory_p.h
index e06c478f5..ce01dcee6 100644
--- a/src/core/aspects/qaspectfactory_p.h
+++ b/src/core/aspects/qaspectfactory_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/aspects/qaspectmanager.cpp b/src/core/aspects/qaspectmanager.cpp
index 80faef768..d565848a8 100644
--- a/src/core/aspects/qaspectmanager.cpp
+++ b/src/core/aspects/qaspectmanager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,6 +58,9 @@
#include <QWaitCondition>
#include <QSurface>
+#if defined(QT3D_CORE_JOB_TIMING)
+#include <QElapsedTimer>
+#endif
QT_BEGIN_NAMESPACE
@@ -62,7 +68,7 @@ namespace Qt3DCore {
QAspectManager::QAspectManager(QObject *parent)
: QObject(parent)
- , m_root(Q_NULLPTR)
+ , m_root(nullptr)
, m_scheduler(new QScheduler(this))
, m_jobManager(new QAspectJobManager(this))
, m_changeArbiter(new QChangeArbiter(this))
@@ -71,8 +77,8 @@ QAspectManager::QAspectManager(QObject *parent)
, m_waitForQuit(0)
{
qRegisterMetaType<QSurface *>("QSurface*");
- m_runMainLoop.fetchAndStoreOrdered(0);
- m_terminated.fetchAndStoreOrdered(0);
+ m_runSimulationLoop.fetchAndStoreOrdered(0);
+ m_runMainLoop.fetchAndStoreOrdered(1);
qCDebug(Aspects) << Q_FUNC_INFO;
}
@@ -83,11 +89,45 @@ QAspectManager::~QAspectManager()
delete m_scheduler;
}
+void QAspectManager::enterSimulationLoop()
+{
+ qCDebug(Aspects) << Q_FUNC_INFO;
+ m_runSimulationLoop.fetchAndStoreOrdered(1);
+}
+
+void QAspectManager::exitSimulationLoop()
+{
+ qCDebug(Aspects) << Q_FUNC_INFO;
+ m_runSimulationLoop.fetchAndStoreOrdered(0);
+ QAbstractFrameAdvanceService *frameAdvanceService =
+ m_serviceLocator->service<QAbstractFrameAdvanceService>(QServiceLocator::FrameAdvanceService);
+ if (frameAdvanceService)
+ frameAdvanceService->stop();
+
+ // Give any aspects a chance to unqueue any asynchronous work they
+ // may have scheduled that would otherwise potentially deadlock or
+ // cause races. For example, the QLogicAspect queues up a vector of
+ // QNodeIds to be processed by a callback on the main thread. However,
+ // if we don't unqueue this work and release its semaphore, the logic
+ // aspect would cause a deadlock when trying to exit the inner loop.
+ // This is because we call this function from the main thread and the
+ // logic aspect is waiting for the main thread to execute the
+ // QLogicComponent::onFrameUpdate() callback.
+ for (QAbstractAspect *aspect : qAsConst(m_aspects))
+ aspect->d_func()->onEngineAboutToShutdown();
+}
+
bool QAspectManager::isShuttingDown() const
{
- return !m_runMainLoop.load();
+ return !m_runSimulationLoop.load();
}
+/*!
+ \internal
+
+ Called by the QAspectThread's run() method immediately after the manager
+ has been created
+*/
void QAspectManager::initialize()
{
qCDebug(Aspects) << Q_FUNC_INFO;
@@ -96,18 +136,23 @@ void QAspectManager::initialize()
m_changeArbiter->initialize(m_jobManager);
}
+/*!
+ \internal
+
+ Called by the QAspectThread's run() method immediately after the manager's
+ exec() function has returned.
+*/
void QAspectManager::shutdown()
{
qCDebug(Aspects) << Q_FUNC_INFO;
- Q_FOREACH (QAbstractAspect *aspect, m_aspects) {
- aspect->onCleanup();
+ for (QAbstractAspect *aspect : qAsConst(m_aspects))
m_changeArbiter->unregisterSceneObserver(aspect->d_func());
- }
+
// Aspects must be deleted in the Thread they were created in
}
-void QAspectManager::setRootEntity(Qt3DCore::QEntity *root)
+void QAspectManager::setRootEntity(Qt3DCore::QEntity *root, const QVector<Qt3DCore::QNodeCreatedChangeBasePtr> &changes)
{
qCDebug(Aspects) << Q_FUNC_INFO;
@@ -115,30 +160,18 @@ void QAspectManager::setRootEntity(Qt3DCore::QEntity *root)
return;
if (m_root) {
- // Allow each aspect chance to cleanup any resources from this scene
- Q_FOREACH (QAbstractAspect *aspect, m_aspects) {
- aspect->onCleanup();
- }
+ // TODO: Delete all backend nodes. This is to be symmetric with how
+ // we create them below in the call to setRootAndCreateNodes
}
m_root = root;
if (m_root) {
- Q_FOREACH (QAbstractAspect *aspect, m_aspects)
- aspect->d_func()->registerAspect(m_root);
- m_runMainLoop.fetchAndStoreOrdered(1);
+ for (QAbstractAspect *aspect : qAsConst(m_aspects))
+ aspect->d_func()->setRootAndCreateNodes(m_root, changes);
}
}
-// Should be called after aspects are registered
-void QAspectManager::setData(const QVariantMap &data)
-{
- qCDebug(Aspects) << Q_FUNC_INFO;
- m_data = data;
- Q_FOREACH (QAbstractAspect *aspect, m_aspects)
- aspect->onInitialize(m_data);
-}
-
/*!
* Registers a new \a aspect.
*/
@@ -146,14 +179,16 @@ void QAspectManager::registerAspect(QAbstractAspect *aspect)
{
qCDebug(Aspects) << "Registering aspect";
- if (aspect != Q_NULLPTR) {
+ if (aspect != nullptr) {
m_aspects.append(aspect);
QAbstractAspectPrivate::get(aspect)->m_aspectManager = this;
QAbstractAspectPrivate::get(aspect)->m_jobManager = m_jobManager;
QAbstractAspectPrivate::get(aspect)->m_arbiter = m_changeArbiter;
// Register sceneObserver with the QChangeArbiter
m_changeArbiter->registerSceneObserver(aspect->d_func());
- aspect->onInitialize(m_data);
+
+ // Allow the aspect to do some work now that it is registered
+ aspect->onRegistered();
}
else {
qCWarning(Aspects) << "Failed to register aspect";
@@ -161,9 +196,24 @@ void QAspectManager::registerAspect(QAbstractAspect *aspect)
qCDebug(Aspects) << "Completed registering aspect";
}
-QVariantMap QAspectManager::data() const
+/*!
+ * \internal
+ *
+ * Calls QAbstractAspect::onUnregistered(), unregisters the aspect from the
+ * change arbiter and unsets the arbiter, job manager and aspect manager.
+ * Operations are performed in the reverse order to registerAspect.
+ */
+void QAspectManager::unregisterAspect(Qt3DCore::QAbstractAspect *aspect)
{
- return m_data;
+ qCDebug(Aspects) << "Unregistering aspect";
+ Q_ASSERT(aspect);
+ aspect->onUnregistered();
+ m_changeArbiter->unregisterSceneObserver(aspect->d_func());
+ QAbstractAspectPrivate::get(aspect)->m_arbiter = nullptr;
+ QAbstractAspectPrivate::get(aspect)->m_jobManager = nullptr;
+ QAbstractAspectPrivate::get(aspect)->m_aspectManager = nullptr;
+ m_aspects.removeOne(aspect);
+ qCDebug(Aspects) << "Completed unregistering aspect";
}
void QAspectManager::exec()
@@ -171,9 +221,9 @@ void QAspectManager::exec()
// Gentlemen, start your engines
QEventLoop eventLoop;
- // Enter the main loop
- while (!m_terminated.load())
- {
+ // Enter the engine loop
+ qCDebug(Aspects) << Q_FUNC_INFO << "***** Entering main loop *****";
+ while (m_runMainLoop.load()) {
// Process any pending events, waiting for more to arrive if queue is empty
eventLoop.processEvents(QEventLoop::WaitForMoreEvents, 16);
@@ -181,21 +231,24 @@ void QAspectManager::exec()
QAbstractFrameAdvanceService *frameAdvanceService =
m_serviceLocator->service<QAbstractFrameAdvanceService>(QServiceLocator::FrameAdvanceService);
- // Start the frameAdvanceService if we're about to enter the running loop
+ // Start the frameAdvanceService if we're about to enter the simulation loop
bool needsShutdown = false;
- if (m_runMainLoop.load()) {
+ if (m_runSimulationLoop.load()) {
needsShutdown = true;
frameAdvanceService->start();
- // We are about to enter the main loop. Give aspects a chance to do any last
+ // We are about to enter the simulation loop. Give aspects a chance to do any last
// pieces of initialization
- qCDebug(Aspects) << "Calling onStartup() for each aspect";
- Q_FOREACH (QAbstractAspect *aspect, m_aspects)
- aspect->onStartup();
+ qCDebug(Aspects) << "Calling onEngineStartup() for each aspect";
+ for (QAbstractAspect *aspect : qAsConst(m_aspects)) {
+ qCDebug(Aspects) << "\t" << aspect->objectName();
+ aspect->onEngineStartup();
+ }
+ qCDebug(Aspects) << "Done calling onEngineStartup() for each aspect";
}
- // Only enter main render loop once the renderer and other aspects are initialized
- while (m_runMainLoop.load()) {
+ // Only enter main simulation loop once the renderer and other aspects are initialized
+ while (m_runSimulationLoop.load()) {
qint64 t = frameAdvanceService->waitForNextFrame();
// Distribute accumulated changes. This includes changes sent from the frontend
@@ -211,21 +264,31 @@ void QAspectManager::exec()
// For each Aspect
// Ask them to launch set of jobs for the current frame
// Updates matrices, bounding volumes, render bins ...
+#if defined(QT3D_CORE_JOB_TIMING)
+ QElapsedTimer timer;
+ timer.start();
+#endif
m_scheduler->scheduleAndWaitForFrameAspectJobs(t);
+#if defined(QT3D_CORE_JOB_TIMING)
+ qDebug() << "Jobs took" << timer.nsecsElapsed() / 1.0e6;
+#endif
// Process any pending events
eventLoop.processEvents();
- }
+ } // End of simulation loop
if (needsShutdown) {
// Give aspects a chance to perform any shutdown actions. This may include unqueuing
// any blocking work on the main thread that could potentially deadlock during shutdown.
- qCDebug(Aspects) << "Calling onShutdown() for each aspect";
- Q_FOREACH (QAbstractAspect *aspect, m_aspects)
- aspect->onShutdown();
+ qCDebug(Aspects) << "Calling onEngineShutdown() for each aspect";
+ for (QAbstractAspect *aspect : qAsConst(m_aspects)) {
+ qCDebug(Aspects) << "\t" << aspect->objectName();
+ aspect->onEngineShutdown();
+ }
+ qCDebug(Aspects) << "Done calling onEngineShutdown() for each aspect";
}
- }
- qCDebug(Aspects) << Q_FUNC_INFO << "Exiting event loop";
+ } // End of main loop
+ qCDebug(Aspects) << Q_FUNC_INFO << "***** Exited main loop *****";
m_waitForEndOfExecLoop.release(1);
m_waitForQuit.acquire(1);
@@ -235,23 +298,17 @@ void QAspectManager::quit()
{
qCDebug(Aspects) << Q_FUNC_INFO;
+ Q_ASSERT_X(m_runSimulationLoop.load() == 0, "QAspectManagr::quit()", "Inner loop is still running");
m_runMainLoop.fetchAndStoreOrdered(0);
- m_terminated.fetchAndStoreOrdered(1);
-
- // Allow the Aspect thread to proceed in case it's locked by the
- // FrameAdvanceService <=> it is still in the running loop
- QAbstractFrameAdvanceService *advanceFrameService = m_serviceLocator->service<QAbstractFrameAdvanceService>(QServiceLocator::FrameAdvanceService);
- if (advanceFrameService)
- advanceFrameService->stop();
// We need to wait for the QAspectManager exec loop to terminate
m_waitForEndOfExecLoop.acquire(1);
m_waitForQuit.release(1);
- qCDebug(Aspects) << Q_FUNC_INFO << "Exited event loop";
+ qCDebug(Aspects) << Q_FUNC_INFO << "Exiting";
}
-const QList<QAbstractAspect *> &QAspectManager::aspects() const
+const QVector<QAbstractAspect *> &QAspectManager::aspects() const
{
return m_aspects;
}
diff --git a/src/core/aspects/qaspectmanager_p.h b/src/core/aspects/qaspectmanager_p.h
index 88ceceb29..5be415533 100644
--- a/src/core/aspects/qaspectmanager_p.h
+++ b/src/core/aspects/qaspectmanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,8 +52,9 @@
//
#include <QObject>
+#include <Qt3DCore/qnodecreatedchange.h>
#include <Qt3DCore/private/qt3dcore_global_p.h>
-#include <QList>
+#include <QVector>
#include <QScopedPointer>
#include <QVariant>
#include <QSemaphore>
@@ -77,34 +81,36 @@ public:
explicit QAspectManager(QObject *parent = 0);
~QAspectManager();
+ void enterSimulationLoop();
+ void exitSimulationLoop();
+
bool isShuttingDown() const;
public Q_SLOTS:
void initialize();
void shutdown();
- void setRootEntity(Qt3DCore::QEntity *root);
- void setData(const QVariantMap &data);
+ void setRootEntity(Qt3DCore::QEntity *root, const QVector<Qt3DCore::QNodeCreatedChangeBasePtr> &changes);
void registerAspect(Qt3DCore::QAbstractAspect *aspect);
- QVariantMap data() const;
+ void unregisterAspect(Qt3DCore::QAbstractAspect *aspect);
void exec();
void quit();
- const QList<QAbstractAspect *> &aspects() const;
+ const QVector<QAbstractAspect *> &aspects() const;
QAbstractAspectJobManager *jobManager() const;
QChangeArbiter *changeArbiter() const;
QServiceLocator *serviceLocator() const;
private:
- QList<QAbstractAspect *> m_aspects;
+ QVector<QAbstractAspect *> m_aspects;
QEntity *m_root;
QVariantMap m_data;
QScheduler *m_scheduler;
QAbstractAspectJobManager *m_jobManager;
QChangeArbiter *m_changeArbiter;
+ QAtomicInt m_runSimulationLoop;
QAtomicInt m_runMainLoop;
- QAtomicInt m_terminated;
QScopedPointer<QServiceLocator> m_serviceLocator;
QSemaphore m_waitForEndOfExecLoop;
QSemaphore m_waitForQuit;
diff --git a/src/core/aspects/qaspectthread.cpp b/src/core/aspects/qaspectthread.cpp
index 169d433d6..9e6961901 100644
--- a/src/core/aspects/qaspectthread.cpp
+++ b/src/core/aspects/qaspectthread.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -46,12 +49,16 @@ namespace Qt3DCore {
QAspectThread::QAspectThread(QObject *parent)
: QThread(parent),
- m_aspectManager(Q_NULLPTR),
+ m_aspectManager(nullptr),
m_semaphore(0)
{
qCDebug(Aspects) << Q_FUNC_INFO;
}
+QAspectThread::~QAspectThread()
+{
+}
+
void QAspectThread::waitForStart(Priority priority)
{
qCDebug(Aspects) << "Starting QAspectThread and going to sleep until it is ready for us...";
diff --git a/src/core/aspects/qaspectthread_p.h b/src/core/aspects/qaspectthread_p.h
index c0054f970..dc508b271 100644
--- a/src/core/aspects/qaspectthread_p.h
+++ b/src/core/aspects/qaspectthread_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -64,6 +67,7 @@ class QAspectThread : public QThread
Q_OBJECT
public:
explicit QAspectThread(QObject *parent = 0);
+ ~QAspectThread();
void waitForStart(Priority priority);
diff --git a/src/core/changes/changes.pri b/src/core/changes/changes.pri
new file mode 100644
index 000000000..49d560a56
--- /dev/null
+++ b/src/core/changes/changes.pri
@@ -0,0 +1,57 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qscenechange.h \
+ $$PWD/qscenechange_p.h \
+ $$PWD/qnodecreatedchange_p.h \
+ $$PWD/qnodecreatedchange.h \
+ $$PWD/qcomponentaddedchange.h \
+ $$PWD/qcomponentaddedchange_p.h \
+ $$PWD/qcomponentremovedchange.h \
+ $$PWD/qcomponentremovedchange_p.h \
+ $$PWD/qnodedestroyedchange.h \
+ $$PWD/qnodedestroyedchange_p.h \
+ $$PWD/qpropertyvalueaddedchangebase.h \
+ $$PWD/qpropertyvalueaddedchangebase_p.h \
+ $$PWD/qpropertyvalueremovedchangebase.h \
+ $$PWD/qpropertyvalueremovedchangebase_p.h \
+ $$PWD/qpropertyupdatedchangebase.h \
+ $$PWD/qpropertyupdatedchangebase_p.h \
+ $$PWD/qdynamicpropertyupdatedchange_p.h \
+ $$PWD/qdynamicpropertyupdatedchange.h \
+ $$PWD/qstaticpropertyupdatedchangebase.h \
+ $$PWD/qstaticpropertyupdatedchangebase_p.h \
+ $$PWD/qpropertyupdatedchange.h \
+ $$PWD/qpropertyupdatedchange_p.h \
+ $$PWD/qtypedpropertyupdatechange_p.h \
+ $$PWD/qstaticpropertyvalueaddedchangebase.h \
+ $$PWD/qstaticpropertyvalueaddedchangebase_p.h \
+ $$PWD/qstaticpropertyvalueremovedchangebase.h \
+ $$PWD/qstaticpropertyvalueremovedchangebase_p.h \
+ $$PWD/qpropertynodeaddedchange.h \
+ $$PWD/qpropertynodeaddedchange_p.h \
+ $$PWD/qpropertynoderemovedchange_p.h \
+ $$PWD/qpropertynoderemovedchange.h \
+ $$PWD/qpropertyvalueaddedchange.h \
+ $$PWD/qpropertyvalueaddedchange_p.h \
+ $$PWD/qpropertyvalueremovedchange.h \
+ $$PWD/qpropertyvalueremovedchange_p.h
+
+SOURCES += \
+ $$PWD/qscenechange.cpp \
+ $$PWD/qnodecreatedchange.cpp \
+ $$PWD/qnodedestroyedchange.cpp \
+ $$PWD/qcomponentaddedchange.cpp \
+ $$PWD/qcomponentremovedchange.cpp \
+ $$PWD/qpropertyvalueaddedchangebase.cpp \
+ $$PWD/qpropertyvalueremovedchangebase.cpp \
+ $$PWD/qpropertyupdatedchangebase.cpp \
+ $$PWD/qdynamicpropertyupdatedchange.cpp \
+ $$PWD/qstaticpropertyupdatedchangebase.cpp \
+ $$PWD/qpropertyupdatedchange.cpp \
+ $$PWD/qstaticpropertyvalueaddedchangebase.cpp \
+ $$PWD/qstaticpropertyvalueremovedchangebase.cpp \
+ $$PWD/qpropertynodeaddedchange.cpp \
+ $$PWD/qpropertynoderemovedchange.cpp \
+ $$PWD/qpropertyvalueaddedchange.cpp \
+ $$PWD/qpropertyvalueremovedchange.cpp
diff --git a/src/core/changes/qcomponentaddedchange.cpp b/src/core/changes/qcomponentaddedchange.cpp
new file mode 100644
index 000000000..d88f4e060
--- /dev/null
+++ b/src/core/changes/qcomponentaddedchange.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcomponentaddedchange.h"
+#include "qcomponentaddedchange_p.h"
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DCore/qentity.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QComponentAddedChangePrivate::QComponentAddedChangePrivate(const QEntity *entity,
+ const QComponent *component)
+ : QSceneChangePrivate()
+ , m_entityId(entity->id())
+ , m_componentId(component->id())
+ , m_componentMetaObject(component->metaObject())
+{
+}
+
+QComponentAddedChange::QComponentAddedChange(const QEntity *entity,
+ const QComponent *component)
+ : QSceneChange(*new QComponentAddedChangePrivate(entity, component),
+ ComponentAdded, entity->id())
+{
+}
+
+QComponentAddedChange::~QComponentAddedChange()
+{
+}
+
+QNodeId QComponentAddedChange::entityId() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QComponentAddedChange);
+ return d->m_entityId;
+}
+
+QNodeId QComponentAddedChange::componentId() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QComponentAddedChange);
+ return d->m_componentId;
+}
+
+const QMetaObject *QComponentAddedChange::componentMetaObject() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QComponentAddedChange);
+ return d->m_componentMetaObject;
+}
+
+QT_END_NAMESPACE
+
+} // namespace Qt3DCore
+
diff --git a/src/core/changes/qcomponentaddedchange.h b/src/core/changes/qcomponentaddedchange.h
new file mode 100644
index 000000000..73d3572b3
--- /dev/null
+++ b/src/core/changes/qcomponentaddedchange.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QCOMPONENTADDEDCHANGE_H
+#define QT3DCORE_QCOMPONENTADDEDCHANGE_H
+
+#include <Qt3DCore/qscenechange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QComponent;
+class QEntity;
+class QComponentAddedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QComponentAddedChange : public QSceneChange
+{
+public:
+ explicit QComponentAddedChange(const QEntity *entity,
+ const QComponent *component);
+ ~QComponentAddedChange();
+
+ QNodeId entityId() const Q_DECL_NOEXCEPT;
+ QNodeId componentId() const Q_DECL_NOEXCEPT;
+ const QMetaObject *componentMetaObject() const Q_DECL_NOEXCEPT;
+
+private:
+ Q_DECLARE_PRIVATE(QComponentAddedChange)
+};
+
+typedef QSharedPointer<QComponentAddedChange> QComponentAddedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QCOMPONENTADDEDCHANGE_H
diff --git a/src/core/changes/qcomponentaddedchange_p.h b/src/core/changes/qcomponentaddedchange_p.h
new file mode 100644
index 000000000..99550c92f
--- /dev/null
+++ b/src/core/changes/qcomponentaddedchange_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QCOMPONENTADDEDCHANGE_P_H
+#define QT3DCORE_QCOMPONENTADDEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <private/qscenechange_p.h>
+#include <Qt3DCore/qnodeid.h>
+
+struct QMetaObject;
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QComponent;
+class QEntity;
+
+class QT3DCORE_PRIVATE_EXPORT QComponentAddedChangePrivate : public QSceneChangePrivate
+{
+public:
+ QComponentAddedChangePrivate(const QEntity *entity, const QComponent *component);
+
+ QNodeId m_entityId;
+ QNodeId m_componentId;
+ const QMetaObject *m_componentMetaObject;
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QCOMPONENTADDEDCHANGE_P_H
+
diff --git a/src/core/changes/qcomponentremovedchange.cpp b/src/core/changes/qcomponentremovedchange.cpp
new file mode 100644
index 000000000..495bb6443
--- /dev/null
+++ b/src/core/changes/qcomponentremovedchange.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcomponentremovedchange.h"
+#include "qcomponentremovedchange_p.h"
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DCore/qentity.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QComponentRemovedChangePrivate::QComponentRemovedChangePrivate(const QEntity *entity,
+ const QComponent *component)
+ : QSceneChangePrivate()
+ , m_entityId(entity->id())
+ , m_componentId(component->id())
+ , m_componentMetaObject(component->metaObject())
+{
+}
+
+QComponentRemovedChange::QComponentRemovedChange(const QEntity *entity,
+ const QComponent *component)
+ : QSceneChange(*new QComponentRemovedChangePrivate(entity, component),
+ ComponentRemoved, entity->id())
+{
+}
+
+QComponentRemovedChange::~QComponentRemovedChange()
+{
+}
+
+QNodeId QComponentRemovedChange::entityId() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QComponentRemovedChange);
+ return d->m_entityId;
+}
+
+QNodeId QComponentRemovedChange::componentId() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QComponentRemovedChange);
+ return d->m_componentId;
+}
+
+const QMetaObject *QComponentRemovedChange::componentMetaObject() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QComponentRemovedChange);
+ return d->m_componentMetaObject;
+}
+
+QT_END_NAMESPACE
+
+} // namespace Qt3DCore
+
diff --git a/src/core/changes/qcomponentremovedchange.h b/src/core/changes/qcomponentremovedchange.h
new file mode 100644
index 000000000..0d968c6ff
--- /dev/null
+++ b/src/core/changes/qcomponentremovedchange.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QCOMPONENTREMOVEDCHANGE_H
+#define QT3DCORE_QCOMPONENTREMOVEDCHANGE_H
+
+#include <Qt3DCore/qscenechange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QComponent;
+class QEntity;
+class QComponentRemovedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QComponentRemovedChange : public QSceneChange
+{
+public:
+ explicit QComponentRemovedChange(const QEntity *entity,
+ const QComponent *component);
+ ~QComponentRemovedChange();
+
+ QNodeId entityId() const Q_DECL_NOEXCEPT;
+ QNodeId componentId() const Q_DECL_NOEXCEPT;
+ const QMetaObject *componentMetaObject() const Q_DECL_NOEXCEPT;
+
+private:
+ Q_DECLARE_PRIVATE(QComponentRemovedChange)
+};
+
+typedef QSharedPointer<QComponentRemovedChange> QComponentRemovedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QCOMPONENTREMOVEDCHANGE_H
diff --git a/src/core/changes/qcomponentremovedchange_p.h b/src/core/changes/qcomponentremovedchange_p.h
new file mode 100644
index 000000000..ff5c71f84
--- /dev/null
+++ b/src/core/changes/qcomponentremovedchange_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H
+#define QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <private/qscenechange_p.h>
+#include <Qt3DCore/qnodeid.h>
+
+struct QMetaObject;
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QComponent;
+class QEntity;
+
+class QT3DCORE_PRIVATE_EXPORT QComponentRemovedChangePrivate : public QSceneChangePrivate
+{
+public:
+ QComponentRemovedChangePrivate(const QEntity *entity, const QComponent *component);
+
+ QNodeId m_entityId;
+ QNodeId m_componentId;
+ const QMetaObject *m_componentMetaObject;
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QCOMPONENTREMOVEDCHANGE_P_H
+
diff --git a/src/core/changes/qdynamicpropertyupdatedchange.cpp b/src/core/changes/qdynamicpropertyupdatedchange.cpp
new file mode 100644
index 000000000..491fffada
--- /dev/null
+++ b/src/core/changes/qdynamicpropertyupdatedchange.cpp
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdynamicpropertyupdatedchange.h"
+#include "qdynamicpropertyupdatedchange_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QDynamicPropertyUpdatedChangePrivate::QDynamicPropertyUpdatedChangePrivate()
+ : QPropertyUpdatedChangeBasePrivate()
+{
+}
+
+QDynamicPropertyUpdatedChangePrivate::~QDynamicPropertyUpdatedChangePrivate()
+{
+}
+
+
+QDynamicPropertyUpdatedChange::QDynamicPropertyUpdatedChange(QNodeId subjectId)
+ : QPropertyUpdatedChangeBase(*new QDynamicPropertyUpdatedChangePrivate, subjectId)
+{
+}
+
+QDynamicPropertyUpdatedChange::QDynamicPropertyUpdatedChange(QDynamicPropertyUpdatedChangePrivate &dd,
+ QNodeId subjectId)
+ : QPropertyUpdatedChangeBase(dd, subjectId)
+{
+}
+
+QDynamicPropertyUpdatedChange::~QDynamicPropertyUpdatedChange()
+{
+}
+
+/*!
+ * \return name of the property.
+ */
+QByteArray QDynamicPropertyUpdatedChange::propertyName() const
+{
+ Q_D(const QDynamicPropertyUpdatedChange);
+ return d->m_propertyName;
+}
+
+/*!
+ * Sets the property change \a name.
+ */
+void QDynamicPropertyUpdatedChange::setPropertyName(const QByteArray &name)
+{
+ Q_D(QDynamicPropertyUpdatedChange);
+ d->m_propertyName = name;
+}
+
+/*!
+ * \return property value.
+ */
+QVariant QDynamicPropertyUpdatedChange::value() const
+{
+ Q_D(const QDynamicPropertyUpdatedChange);
+ return d->m_value;
+}
+
+/*!
+ * Set the property change \a value.
+ */
+void QDynamicPropertyUpdatedChange::setValue(const QVariant &value)
+{
+ Q_D(QDynamicPropertyUpdatedChange);
+ d->m_value = value;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qdynamicpropertyupdatedchange.h b/src/core/changes/qdynamicpropertyupdatedchange.h
new file mode 100644
index 000000000..2eee6d6d6
--- /dev/null
+++ b/src/core/changes/qdynamicpropertyupdatedchange.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_H
+#define QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_H
+
+#include <Qt3DCore/qpropertyupdatedchangebase.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QDynamicPropertyUpdatedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QDynamicPropertyUpdatedChange : public QPropertyUpdatedChangeBase
+{
+public:
+ explicit QDynamicPropertyUpdatedChange(QNodeId subjectId);
+ ~QDynamicPropertyUpdatedChange();
+
+ QByteArray propertyName() const;
+ void setPropertyName(const QByteArray &name);
+
+ QVariant value() const;
+ void setValue(const QVariant &value);
+
+protected:
+ Q_DECLARE_PRIVATE(QDynamicPropertyUpdatedChange)
+ QDynamicPropertyUpdatedChange(QDynamicPropertyUpdatedChangePrivate &dd, QNodeId subjectId);
+};
+
+typedef QSharedPointer<QDynamicPropertyUpdatedChange> QDynamicPropertyUpdatedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QNODEDYNAMICPROPERTYUPDATEDCHANGE_H
diff --git a/src/core/changes/qdynamicpropertyupdatedchange_p.h b/src/core/changes/qdynamicpropertyupdatedchange_p.h
new file mode 100644
index 000000000..729ae44d0
--- /dev/null
+++ b/src/core/changes/qdynamicpropertyupdatedchange_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H
+#define QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qpropertyupdatedchangebase_p.h>
+#include <QtCore/qbytearray.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyUpdatedChange;
+class QFrameAllocator;
+
+class QT3DCORE_PRIVATE_EXPORT QDynamicPropertyUpdatedChangePrivate : public QPropertyUpdatedChangeBasePrivate
+{
+public:
+ QDynamicPropertyUpdatedChangePrivate();
+ virtual ~QDynamicPropertyUpdatedChangePrivate();
+
+ Q_DECLARE_PUBLIC(QDynamicPropertyUpdatedChange)
+
+ QByteArray m_propertyName;
+ QVariant m_value;
+};
+
+} // Qt3D
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QDYNAMICPROPERTYUPDATEDCHANGE_P_H
+
diff --git a/src/core/changes/qnodecreatedchange.cpp b/src/core/changes/qnodecreatedchange.cpp
new file mode 100644
index 000000000..cb4312cb4
--- /dev/null
+++ b/src/core/changes/qnodecreatedchange.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnodecreatedchange.h"
+#include "qnodecreatedchange_p.h"
+#include <Qt3DCore/qnode.h>
+#include <QtCore/qmetaobject.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QNodeCreatedChangeBasePrivate::QNodeCreatedChangeBasePrivate(const QNode *node)
+ : QSceneChangePrivate()
+ , m_parentId(node->parentNode() ? node->parentNode()->id() : QNodeId())
+ , m_metaObject(node->metaObject())
+ , m_nodeEnabled(node->isEnabled())
+{
+}
+
+/*!
+ * \class Qt3DCore::QNodeCreatedChangeBase
+ * \inherits Qt3DCore::QSceneChange
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QNodeCreatedChangeBasePtr
+ * \relates Qt3DCore::QNodeCreatedChangeBase
+ *
+ * A shared pointer for QNodeCreatedChangeBase.
+ */
+
+/*!
+ * Constructs a new QNodeCreatedChangeBase with \a node and \a priority.
+ */
+QNodeCreatedChangeBase::QNodeCreatedChangeBase(const QNode *node)
+ : QSceneChange(*new QNodeCreatedChangeBasePrivate(node), NodeCreated, node->id())
+{
+}
+
+QNodeCreatedChangeBase::QNodeCreatedChangeBase(QNodeCreatedChangeBasePrivate &dd, const QNode *node)
+ : QSceneChange(dd, NodeCreated, node->id())
+{
+}
+
+QNodeCreatedChangeBase::~QNodeCreatedChangeBase()
+{
+}
+
+/*!
+ * \return parent id.
+ */
+QNodeId QNodeCreatedChangeBase::parentId() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QNodeCreatedChangeBase);
+ return d->m_parentId;
+}
+
+/*!
+ * \return metaobject.
+ */
+const QMetaObject *QNodeCreatedChangeBase::metaObject() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QNodeCreatedChangeBase);
+ return d->m_metaObject;
+}
+
+/*!
+ * \return node enabled.
+ */
+bool QNodeCreatedChangeBase::isNodeEnabled() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QNodeCreatedChangeBase);
+ return d->m_nodeEnabled;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qnodecreatedchange.h b/src/core/changes/qnodecreatedchange.h
new file mode 100644
index 000000000..7318dada6
--- /dev/null
+++ b/src/core/changes/qnodecreatedchange.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QNODECREATEDCHANGE_H
+#define QT3DCORE_QNODECREATEDCHANGE_H
+
+#include <Qt3DCore/qt3dcore_global.h>
+#include <Qt3DCore/qscenechange.h>
+
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QNode;
+class QNodeCreatedChangeBasePrivate;
+
+class QT3DCORESHARED_EXPORT QNodeCreatedChangeBase : public QSceneChange
+{
+public:
+ explicit QNodeCreatedChangeBase(const QNode *node);
+ ~QNodeCreatedChangeBase();
+
+ QNodeId parentId() const Q_DECL_NOEXCEPT;
+ const QMetaObject *metaObject() const Q_DECL_NOEXCEPT;
+ bool isNodeEnabled() const Q_DECL_NOEXCEPT;
+
+protected:
+ QNodeCreatedChangeBase(QNodeCreatedChangeBasePrivate &dd, const QNode *node);
+
+private:
+ Q_DECLARE_PRIVATE(QNodeCreatedChangeBase)
+};
+
+typedef QSharedPointer<QNodeCreatedChangeBase> QNodeCreatedChangeBasePtr;
+
+template<typename T>
+class QNodeCreatedChange : public QNodeCreatedChangeBase
+{
+public:
+ explicit QNodeCreatedChange(const QNode *_node)
+ : QNodeCreatedChangeBase(_node)
+ , data()
+ {
+ }
+
+ T data;
+};
+
+template<typename T>
+using QNodeCreatedChangePtr = QSharedPointer<QNodeCreatedChange<T>>;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QNODECREATEDCHANGE_H
diff --git a/src/core/changes/qnodecreatedchange_p.h b/src/core/changes/qnodecreatedchange_p.h
new file mode 100644
index 000000000..75969e461
--- /dev/null
+++ b/src/core/changes/qnodecreatedchange_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QNODECREATEDCHANGE_P_H
+#define QT3DCORE_QNODECREATEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <private/qscenechange_p.h>
+#include <Qt3DCore/qnodeid.h>
+
+struct QMetaObject;
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QNode;
+
+class QT3DCORE_PRIVATE_EXPORT QNodeCreatedChangeBasePrivate : public QSceneChangePrivate
+{
+public:
+ QNodeCreatedChangeBasePrivate(const QNode *node);
+
+ QNodeId m_parentId;
+ const QMetaObject *m_metaObject;
+ bool m_nodeEnabled;
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QNODECREATEDCHANGE_P_H
diff --git a/src/core/changes/qnodedestroyedchange.cpp b/src/core/changes/qnodedestroyedchange.cpp
new file mode 100644
index 000000000..8f1331334
--- /dev/null
+++ b/src/core/changes/qnodedestroyedchange.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnodedestroyedchange.h"
+#include "qnodedestroyedchange_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QNodeDestroyedChange::QNodeDestroyedChange(const QNode *node, const QVector<QNodeIdTypePair> &subtreeIdsAndTypes)
+ : QSceneChange(*new QNodeDestroyedChangePrivate, NodeDeleted, node->id())
+{
+ Q_D(QNodeDestroyedChange);
+ d->m_subtreeIdsAndTypes = subtreeIdsAndTypes;
+}
+
+QNodeDestroyedChange::~QNodeDestroyedChange()
+{
+}
+
+QVector<QNodeIdTypePair> QNodeDestroyedChange::subtreeIdsAndTypes() const
+{
+ Q_D(const QNodeDestroyedChange);
+ return d->m_subtreeIdsAndTypes;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qnodedestroyedchange.h b/src/core/changes/qnodedestroyedchange.h
new file mode 100644
index 000000000..348fda23f
--- /dev/null
+++ b/src/core/changes/qnodedestroyedchange.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QNODEDESTROYEDCHANGE_H
+#define QT3DCORE_QNODEDESTROYEDCHANGE_H
+
+#include <Qt3DCore/qscenechange.h>
+#include <Qt3DCore/qnode.h>
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QNodeDestroyedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QNodeDestroyedChange : public QSceneChange
+{
+public:
+ explicit QNodeDestroyedChange(const QNode *node, const QVector<QNodeIdTypePair> &subtreeIdsAndTypes);
+ ~QNodeDestroyedChange();
+
+ QVector<QNodeIdTypePair> subtreeIdsAndTypes() const;
+
+private:
+ Q_DECLARE_PRIVATE(QNodeDestroyedChange)
+};
+
+typedef QSharedPointer<QNodeDestroyedChange> QNodeDestroyedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QNODEDESTROYEDCHANGE_H
diff --git a/src/core/changes/qnodedestroyedchange_p.h b/src/core/changes/qnodedestroyedchange_p.h
new file mode 100644
index 000000000..45c490707
--- /dev/null
+++ b/src/core/changes/qnodedestroyedchange_p.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QNODEDESTROYEDCHANGE_P_H
+#define QT3DCORE_QNODEDESTROYEDCHANGE_P_H
+
+#include <private/qscenechange_p.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QNodeDestroyedChange;
+
+class QNodeDestroyedChangePrivate : public QSceneChangePrivate
+{
+public:
+ QVector<QNodeIdTypePair> m_subtreeIdsAndTypes;
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QNODEDESTROYEDCHANGE_P_H
diff --git a/src/core/changes/qpropertynodeaddedchange.cpp b/src/core/changes/qpropertynodeaddedchange.cpp
new file mode 100644
index 000000000..5f1a1f921
--- /dev/null
+++ b/src/core/changes/qpropertynodeaddedchange.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpropertynodeaddedchange.h"
+#include "qpropertynodeaddedchange_p.h"
+#include <Qt3DCore/private/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QPropertyNodeAddedChangePrivate::QPropertyNodeAddedChangePrivate()
+ : QStaticPropertyValueAddedChangeBasePrivate()
+ , m_addedNodeIdTypePair()
+{
+}
+
+/*!
+ * \class Qt3DCore::QPropertyNodeAddedChange
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QPropertyNodeAddedChangePtr
+ * \relates Qt3DCore::QPropertyNodeAddedChange
+ *
+ * A shared pointer for QPropertyNodeAddedChange.
+ */
+
+/*!
+ * Constructs a new QPropertyNodeAddedChange with \a subjectId, \a addedNodeId, and
+ * \a priority.
+ */
+QPropertyNodeAddedChange::QPropertyNodeAddedChange(QNodeId subjectId, QNode *node)
+ : QStaticPropertyValueAddedChangeBase(*new QPropertyNodeAddedChangePrivate, subjectId)
+{
+ Q_D(QPropertyNodeAddedChange);
+ d->m_addedNodeIdTypePair = QNodeIdTypePair(node->id(), node->metaObject());
+}
+
+/*! \internal */
+QPropertyNodeAddedChange::~QPropertyNodeAddedChange()
+{
+}
+
+/*!
+ * \return the id of the node added to the property.
+ */
+QNodeId QPropertyNodeAddedChange::addedNodeId() const
+{
+ Q_D(const QPropertyNodeAddedChange);
+ return d->m_addedNodeIdTypePair.id;
+}
+
+/*!
+ * \return the meta object of the node added to the property.
+ */
+const QMetaObject *QPropertyNodeAddedChange::metaObject() const
+{
+ Q_D(const QPropertyNodeAddedChange);
+ return d->m_addedNodeIdTypePair.type;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qpropertynodeaddedchange.h b/src/core/changes/qpropertynodeaddedchange.h
new file mode 100644
index 000000000..a816f711c
--- /dev/null
+++ b/src/core/changes/qpropertynodeaddedchange.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYNODEADDEDCHANGE_H
+#define QT3DCORE_QPROPERTYNODEADDEDCHANGE_H
+
+#include <Qt3DCore/qstaticpropertyvalueaddedchangebase.h>
+#include <Qt3DCore/qnode.h>
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyNodeAddedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QPropertyNodeAddedChange : public QStaticPropertyValueAddedChangeBase
+{
+public:
+ explicit QPropertyNodeAddedChange(QNodeId subjectId, QNode *node);
+ ~QPropertyNodeAddedChange();
+
+ QNodeId addedNodeId() const;
+ const QMetaObject *metaObject() const;
+
+private:
+ Q_DECLARE_PRIVATE(QPropertyNodeAddedChange)
+};
+
+typedef QSharedPointer<QPropertyNodeAddedChange> QPropertyNodeAddedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYNODEADDEDCHANGE_H
diff --git a/src/core/changes/qpropertynodeaddedchange_p.h b/src/core/changes/qpropertynodeaddedchange_p.h
new file mode 100644
index 000000000..01340ae8c
--- /dev/null
+++ b/src/core/changes/qpropertynodeaddedchange_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H
+#define QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qstaticpropertyvalueaddedchangebase_p.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyUpdatedChange;
+class QFrameAllocator;
+
+class QPropertyNodeAddedChangePrivate : public QStaticPropertyValueAddedChangeBasePrivate
+{
+public:
+ QPropertyNodeAddedChangePrivate();
+
+ Q_DECLARE_PUBLIC(QPropertyNodeAddedChange)
+
+ QNodeIdTypePair m_addedNodeIdTypePair;
+};
+
+} // Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYNODEADDEDCHANGE_P_H
diff --git a/src/core/changes/qpropertynoderemovedchange.cpp b/src/core/changes/qpropertynoderemovedchange.cpp
new file mode 100644
index 000000000..590553cb9
--- /dev/null
+++ b/src/core/changes/qpropertynoderemovedchange.cpp
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpropertynoderemovedchange.h"
+#include "qpropertynoderemovedchange_p.h"
+#include <Qt3DCore/private/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QPropertyNodeRemovedChangePrivate::QPropertyNodeRemovedChangePrivate()
+ : QStaticPropertyValueRemovedChangeBasePrivate()
+ , m_removedNodeIdTypePair()
+{
+}
+
+/*!
+ * \class Qt3DCore::QPropertyNodeRemovedChange
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QPropertyNodeRemovedChangePtr
+ * \relates Qt3DCore::QPropertyNodeRemovedChange
+ *
+ * A shared pointer for QPropertyNodeRemovedChange.
+ */
+
+/*!
+ * Constructs a new QPropertyNodeRemovedChange with \a subjectId, \a node, and
+ * \a priority.
+ */
+QPropertyNodeRemovedChange::QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node)
+ : QStaticPropertyValueRemovedChangeBase(*new QPropertyNodeRemovedChangePrivate, subjectId)
+{
+ Q_D(QPropertyNodeRemovedChange);
+ d->m_removedNodeIdTypePair = QNodeIdTypePair(node->id(), QNodePrivate::get(node)->m_typeInfo);
+}
+
+QPropertyNodeRemovedChange::QPropertyNodeRemovedChange(QNodeId subjectId)
+ : QStaticPropertyValueRemovedChangeBase(*new QPropertyNodeRemovedChangePrivate, subjectId)
+{
+}
+
+/*! \internal */
+QPropertyNodeRemovedChange::~QPropertyNodeRemovedChange()
+{
+}
+
+/*!
+ * \return the id of the node removed to the property.
+ */
+QNodeId QPropertyNodeRemovedChange::removedNodeId() const
+{
+ Q_D(const QPropertyNodeRemovedChange);
+ return d->m_removedNodeIdTypePair.id;
+}
+
+/*!
+ * \return the metaObject of the node removed to the property.
+ */
+const QMetaObject *QPropertyNodeRemovedChange::metaObject() const
+{
+ Q_D(const QPropertyNodeRemovedChange);
+ return d->m_removedNodeIdTypePair.type;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qpropertynoderemovedchange.h b/src/core/changes/qpropertynoderemovedchange.h
new file mode 100644
index 000000000..021d753cf
--- /dev/null
+++ b/src/core/changes/qpropertynoderemovedchange.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H
+#define QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H
+
+#include <Qt3DCore/qstaticpropertyvalueremovedchangebase.h>
+#include <Qt3DCore/qnode.h>
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyNodeRemovedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QPropertyNodeRemovedChange : public QStaticPropertyValueRemovedChangeBase
+{
+public:
+ explicit QPropertyNodeRemovedChange(QNodeId subjectId, QNode *node);
+ explicit QPropertyNodeRemovedChange(QNodeId subjectId);
+ ~QPropertyNodeRemovedChange();
+
+ QNodeId removedNodeId() const;
+ const QMetaObject *metaObject() const;
+
+private:
+ Q_DECLARE_PRIVATE(QPropertyNodeRemovedChange)
+};
+
+typedef QSharedPointer<QPropertyNodeRemovedChange> QPropertyNodeRemovedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_H
diff --git a/src/core/changes/qpropertynoderemovedchange_p.h b/src/core/changes/qpropertynoderemovedchange_p.h
new file mode 100644
index 000000000..6cd23661b
--- /dev/null
+++ b/src/core/changes/qpropertynoderemovedchange_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H
+#define QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qstaticpropertyvalueremovedchangebase_p.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyUpdatedChange;
+class QFrameAllocator;
+
+class QPropertyNodeRemovedChangePrivate : public QStaticPropertyValueRemovedChangeBasePrivate
+{
+public:
+ QPropertyNodeRemovedChangePrivate();
+
+ Q_DECLARE_PUBLIC(QPropertyNodeRemovedChange)
+
+ const char *m_propertyName;
+ QNodeIdTypePair m_removedNodeIdTypePair;
+};
+
+} // Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYNODEREMOVEDCHANGE_P_H
diff --git a/src/core/changes/qpropertyupdatedchange.cpp b/src/core/changes/qpropertyupdatedchange.cpp
new file mode 100644
index 000000000..8bb7290ab
--- /dev/null
+++ b/src/core/changes/qpropertyupdatedchange.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpropertyupdatedchange.h"
+#include "qpropertyupdatedchange_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+/*!
+ \class Qt3DCore::QPropertyUpdatedChange
+ \inmodule Qt3DCore
+*/
+QPropertyUpdatedChangePrivate::QPropertyUpdatedChangePrivate()
+ : QStaticPropertyUpdatedChangeBasePrivate()
+{
+}
+
+QPropertyUpdatedChangePrivate::~QPropertyUpdatedChangePrivate()
+{
+}
+
+/*!
+ * \class Qt3DCore::QPropertyUpdatedChange
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QPropertyUpdatedChangePtr
+ * \relates Qt3DCore::QPropertyUpdatedChange
+ *
+ * A shared pointer for QPropertyUpdatedChange.
+ */
+
+/*!
+ * Constructs a new QPropertyUpdatedChange with \a subjectId and \a priority.
+ */
+QPropertyUpdatedChange::QPropertyUpdatedChange(QNodeId subjectId)
+ : QStaticPropertyUpdatedChangeBase(*new QPropertyUpdatedChangePrivate, subjectId)
+{
+}
+
+/*!
+ * \internal
+ */
+QPropertyUpdatedChange::QPropertyUpdatedChange(QPropertyUpdatedChangePrivate &dd,
+ QNodeId subjectId)
+ : QStaticPropertyUpdatedChangeBase(dd, subjectId)
+{
+}
+
+QPropertyUpdatedChange::~QPropertyUpdatedChange()
+{
+}
+
+/*!
+ * \return property value.
+ */
+QVariant QPropertyUpdatedChange::value() const
+{
+ Q_D(const QPropertyUpdatedChange);
+ return d->m_value;
+}
+
+/*!
+ * Set the property change \a value.
+ */
+void QPropertyUpdatedChange::setValue(const QVariant &value)
+{
+ Q_D(QPropertyUpdatedChange);
+ d->m_value = value;
+}
+
+} // Qt3D
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qpropertyupdatedchange.h b/src/core/changes/qpropertyupdatedchange.h
new file mode 100644
index 000000000..acec44694
--- /dev/null
+++ b/src/core/changes/qpropertyupdatedchange.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGE_H
+#define QT3DCORE_QPROPERTYUPDATEDCHANGE_H
+
+#include <Qt3DCore/qstaticpropertyupdatedchangebase.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyUpdatedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase
+{
+public:
+ explicit QPropertyUpdatedChange(QNodeId subjectId);
+ virtual ~QPropertyUpdatedChange();
+
+ QVariant value() const;
+ void setValue(const QVariant &value);
+
+protected:
+ Q_DECLARE_PRIVATE(QPropertyUpdatedChange)
+ QPropertyUpdatedChange(QPropertyUpdatedChangePrivate &dd, QNodeId subjectId);
+};
+
+typedef QSharedPointer<QPropertyUpdatedChange> QPropertyUpdatedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYUPDATEDCHANGE_H
diff --git a/src/core/changes/qpropertyupdatedchange_p.h b/src/core/changes/qpropertyupdatedchange_p.h
new file mode 100644
index 000000000..f985120c9
--- /dev/null
+++ b/src/core/changes/qpropertyupdatedchange_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H
+#define QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qstaticpropertyupdatedchangebase_p.h>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyUpdatedChange;
+
+class QPropertyUpdatedChangePrivate : public QStaticPropertyUpdatedChangeBasePrivate
+{
+public:
+ QPropertyUpdatedChangePrivate();
+ virtual ~QPropertyUpdatedChangePrivate();
+
+ Q_DECLARE_PUBLIC(QPropertyUpdatedChange)
+
+ QVariant m_value;
+};
+
+} // Qt3D
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYUPDATEDCHANGE_P_H
diff --git a/src/core/changes/qpropertyupdatedchangebase.cpp b/src/core/changes/qpropertyupdatedchangebase.cpp
new file mode 100644
index 000000000..fa6937921
--- /dev/null
+++ b/src/core/changes/qpropertyupdatedchangebase.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpropertyupdatedchangebase.h"
+#include "qpropertyupdatedchangebase_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QPropertyUpdatedChangeBasePrivate::QPropertyUpdatedChangeBasePrivate()
+ : QSceneChangePrivate()
+{
+}
+
+QPropertyUpdatedChangeBasePrivate::~QPropertyUpdatedChangeBasePrivate()
+{
+}
+
+/*!
+ * \class Qt3DCore::QPropertyUpdatedChangeBase
+ * \inmodule Qt3DCore
+ *
+ * The QPropertyUpdatedChangeBase class is the base class for all QSceneChange events that
+ * have the changeType() PropertyUpdated. You should not need to instantiate this class.
+ * Usually you should be using one of its subclasses such as QPropertyUpdatedChange or
+ * QTypedPropertyUpdatedChange.
+ *
+ * You can subclass this to create your own node update types for communication between
+ * your QNode and QBackendNode subclasses when writing your own aspects.
+ */
+
+/*!
+ * \typedef Qt3DCore::QPropertyUpdatedChangeBasePtr
+ * \relates Qt3DCore::QPropertyUpdatedChangeBase
+ *
+ * A shared pointer for QPropertyUpdatedChangeBase.
+ */
+
+/*!
+ * Constructs a new QPropertyUpdatedChangeBase with \a senderType, \a subjectId, and
+ * \a priority.
+ */
+QPropertyUpdatedChangeBase::QPropertyUpdatedChangeBase(QNodeId subjectId)
+ : QSceneChange(*new QPropertyUpdatedChangeBasePrivate, PropertyUpdated, subjectId)
+{
+}
+
+QPropertyUpdatedChangeBase::QPropertyUpdatedChangeBase(QPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId)
+ : QSceneChange(dd, PropertyUpdated, subjectId)
+{
+}
+
+QPropertyUpdatedChangeBase::~QPropertyUpdatedChangeBase()
+{
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qpropertyupdatedchangebase.h b/src/core/changes/qpropertyupdatedchangebase.h
new file mode 100644
index 000000000..1abbd899a
--- /dev/null
+++ b/src/core/changes/qpropertyupdatedchangebase.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H
+#define QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H
+
+#include <Qt3DCore/qscenechange.h>
+#include <Qt3DCore/qt3dcore_global.h>
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyUpdatedChangeBasePrivate;
+
+class QT3DCORESHARED_EXPORT QPropertyUpdatedChangeBase : public QSceneChange
+{
+public:
+ ~QPropertyUpdatedChangeBase();
+
+protected:
+ explicit QPropertyUpdatedChangeBase(QNodeId subjectId);
+ QPropertyUpdatedChangeBase(QPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId);
+ Q_DECLARE_PRIVATE(QPropertyUpdatedChangeBase)
+};
+
+typedef QSharedPointer<QPropertyUpdatedChangeBase> QPropertyUpdatedChangeBasePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_H
diff --git a/src/core/changes/qpropertyupdatedchangebase_p.h b/src/core/changes/qpropertyupdatedchangebase_p.h
new file mode 100644
index 000000000..314b1ea15
--- /dev/null
+++ b/src/core/changes/qpropertyupdatedchangebase_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H
+#define QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qscenechange_p.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyUpdatedChangeBase;
+
+class QT3DCORE_PRIVATE_EXPORT QPropertyUpdatedChangeBasePrivate : public QSceneChangePrivate
+{
+public:
+ QPropertyUpdatedChangeBasePrivate();
+ virtual ~QPropertyUpdatedChangeBasePrivate();
+
+ Q_DECLARE_PUBLIC(QPropertyUpdatedChangeBase)
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYUPDATEDCHANGEBASE_P_H
+
diff --git a/src/core/changes/qpropertyvalueaddedchange.cpp b/src/core/changes/qpropertyvalueaddedchange.cpp
new file mode 100644
index 000000000..ae83fe382
--- /dev/null
+++ b/src/core/changes/qpropertyvalueaddedchange.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpropertyvalueaddedchange.h"
+#include "qpropertyvalueaddedchange_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QPropertyValueAddedChangePrivate::QPropertyValueAddedChangePrivate()
+ : QStaticPropertyValueAddedChangeBasePrivate()
+{
+}
+
+
+/*!
+ * \class Qt3DCore::QPropertyValueAddedChange
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QPropertyValueAddedChangePtr
+ * \relates Qt3DCore::QPropertyValueAddedChange
+ *
+ * A shared pointer for QPropertyValueAddedChange.
+ */
+
+/*!
+ * Constructs a new QPropertyValueAddedChange with \a subjectId.
+ */
+QPropertyValueAddedChange::QPropertyValueAddedChange(QNodeId subjectId)
+ : QStaticPropertyValueAddedChangeBase(*new QPropertyValueAddedChangePrivate, subjectId)
+{
+}
+
+QPropertyValueAddedChange::~QPropertyValueAddedChange()
+{
+}
+
+/*!
+ * Sets the value added to the property to \a value.
+ */
+void QPropertyValueAddedChange::setAddedValue(const QVariant &value)
+{
+ Q_D(QPropertyValueAddedChange);
+ d->m_addedValue = value;
+}
+
+/*!
+ * \return the value added to the property.
+ */
+QVariant QPropertyValueAddedChange::addedValue() const
+{
+ Q_D(const QPropertyValueAddedChange);
+ return d->m_addedValue;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qpropertyvalueaddedchange.h b/src/core/changes/qpropertyvalueaddedchange.h
new file mode 100644
index 000000000..80b41c9f8
--- /dev/null
+++ b/src/core/changes/qpropertyvalueaddedchange.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H
+#define QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H
+
+#include <Qt3DCore/qstaticpropertyvalueaddedchangebase.h>
+#include <Qt3DCore/qt3dcore_global.h>
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyValueAddedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QPropertyValueAddedChange : public QStaticPropertyValueAddedChangeBase
+{
+public:
+ explicit QPropertyValueAddedChange(QNodeId subjectId);
+ ~QPropertyValueAddedChange();
+
+ void setAddedValue(const QVariant &value);
+ QVariant addedValue() const;
+
+private:
+ Q_DECLARE_PRIVATE(QPropertyValueAddedChange)
+};
+
+typedef QSharedPointer<QPropertyValueAddedChange> QPropertyValueAddedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGE_H
diff --git a/src/core/changes/qpropertyvalueaddedchange_p.h b/src/core/changes/qpropertyvalueaddedchange_p.h
new file mode 100644
index 000000000..538a591a1
--- /dev/null
+++ b/src/core/changes/qpropertyvalueaddedchange_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H
+#define QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qstaticpropertyvalueaddedchangebase_p.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyValueAddedChange;
+
+class QT3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangePrivate : public QStaticPropertyValueAddedChangeBasePrivate
+{
+public:
+ QPropertyValueAddedChangePrivate();
+
+ Q_DECLARE_PUBLIC(QPropertyValueAddedChange)
+
+ QVariant m_addedValue;
+};
+
+} // Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGE_P_H
+
diff --git a/src/core/changes/qpropertyvalueaddedchangebase.cpp b/src/core/changes/qpropertyvalueaddedchangebase.cpp
new file mode 100644
index 000000000..ae406ffae
--- /dev/null
+++ b/src/core/changes/qpropertyvalueaddedchangebase.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpropertyvalueaddedchangebase.h"
+#include "qpropertyvalueaddedchangebase_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QPropertyValueAddedChangeBasePrivate::QPropertyValueAddedChangeBasePrivate()
+ : QSceneChangePrivate()
+{
+}
+
+QPropertyValueAddedChangeBasePrivate::~QPropertyValueAddedChangeBasePrivate()
+{
+}
+
+/*!
+ * \class Qt3DCore::QPropertyValueAddedChangeBase
+ * \inmodule Qt3DCore
+ *
+ * The QPropertyValueAddedChangeBase class is the base class for all QSceneChange events that
+ * have the changeType() PropertyValueAdded. You should not need to instantiate this class.
+ * Usually you should be using one of its subclasses such as QPropertyNodeAddedChange.
+ *
+ * You can subclass this to create your own node added types for communication between
+ * your QNode and QBackendNode subclasses when writing your own aspects.
+ */
+
+/*!
+ * \typedef Qt3DCore::QPropertyValueAddedChangeBasePtr
+ * \relates Qt3DCore::QPropertyValueAddedChangeBase
+ *
+ * A shared pointer for QPropertyValueAddedChangeBase.
+ */
+
+/*!
+ * Constructs a new QPropertyValueAddedChangeBase with \a senderType, \a subjectId, and
+ * \a priority.
+ */
+QPropertyValueAddedChangeBase::QPropertyValueAddedChangeBase(QNodeId subjectId)
+ : QSceneChange(*new QPropertyValueAddedChangeBasePrivate, PropertyValueAdded, subjectId)
+{
+}
+
+/*! internal */
+QPropertyValueAddedChangeBase::QPropertyValueAddedChangeBase(QPropertyValueAddedChangeBasePrivate &dd,
+ QNodeId subjectId)
+ : QSceneChange(dd, PropertyValueAdded, subjectId)
+{
+}
+
+QPropertyValueAddedChangeBase::~QPropertyValueAddedChangeBase()
+{
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qpropertyvalueaddedchangebase.h b/src/core/changes/qpropertyvalueaddedchangebase.h
new file mode 100644
index 000000000..2ac449667
--- /dev/null
+++ b/src/core/changes/qpropertyvalueaddedchangebase.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H
+#define QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H
+
+#include <Qt3DCore/qscenechange.h>
+#include <Qt3DCore/qt3dcore_global.h>
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyValueAddedChangeBasePrivate;
+
+class QT3DCORESHARED_EXPORT QPropertyValueAddedChangeBase : public QSceneChange
+{
+public:
+ ~QPropertyValueAddedChangeBase();
+
+protected:
+ explicit QPropertyValueAddedChangeBase(QNodeId subjectId);
+ explicit QPropertyValueAddedChangeBase(QPropertyValueAddedChangeBasePrivate &dd, QNodeId subjectId);
+ Q_DECLARE_PRIVATE(QPropertyValueAddedChangeBase)
+};
+
+typedef QSharedPointer<QPropertyValueAddedChangeBase> QPropertyValueAddedChangeBasePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_H
diff --git a/src/core/changes/qpropertyvalueaddedchangebase_p.h b/src/core/changes/qpropertyvalueaddedchangebase_p.h
new file mode 100644
index 000000000..405b2ad3f
--- /dev/null
+++ b/src/core/changes/qpropertyvalueaddedchangebase_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H
+#define QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qscenechange_p.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyValueAddedChangeBase;
+
+class QT3DCORE_PRIVATE_EXPORT QPropertyValueAddedChangeBasePrivate : public QSceneChangePrivate
+{
+public:
+ QPropertyValueAddedChangeBasePrivate();
+ virtual ~QPropertyValueAddedChangeBasePrivate();
+
+ Q_DECLARE_PUBLIC(QPropertyValueAddedChangeBase)
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYVALUEADDEDCHANGEBASE_P_H
+
diff --git a/src/core/changes/qpropertyvalueremovedchange.cpp b/src/core/changes/qpropertyvalueremovedchange.cpp
new file mode 100644
index 000000000..72092a55c
--- /dev/null
+++ b/src/core/changes/qpropertyvalueremovedchange.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpropertyvalueremovedchange.h"
+#include "qpropertyvalueremovedchange_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QPropertyValueRemovedChangePrivate::QPropertyValueRemovedChangePrivate()
+ : QStaticPropertyValueRemovedChangeBasePrivate()
+{
+}
+
+
+/*!
+ * \class Qt3DCore::QPropertyValueRemovedChange
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QPropertyValueRemovedChangePtr
+ * \relates Qt3DCore::QPropertyValueRemovedChange
+ *
+ * A shared pointer for QPropertyValueRemovedChange.
+ */
+
+/*!
+ * Constructs a new QPropertyValueRemovedChange with \a subjectId.
+ */
+QPropertyValueRemovedChange::QPropertyValueRemovedChange(QNodeId subjectId)
+ : QStaticPropertyValueRemovedChangeBase(*new QPropertyValueRemovedChangePrivate, subjectId)
+{
+}
+
+QPropertyValueRemovedChange::~QPropertyValueRemovedChange()
+{
+}
+
+/*!
+ * Sets the value Removed to the property to \a value.
+ */
+void QPropertyValueRemovedChange::setRemovedValue(const QVariant &value)
+{
+ Q_D(QPropertyValueRemovedChange);
+ d->m_RemovedValue = value;
+}
+
+/*!
+ * \return the value Removed to the property.
+ */
+QVariant QPropertyValueRemovedChange::removedValue() const
+{
+ Q_D(const QPropertyValueRemovedChange);
+ return d->m_RemovedValue;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qpropertyvalueremovedchange.h b/src/core/changes/qpropertyvalueremovedchange.h
new file mode 100644
index 000000000..06bb1dd39
--- /dev/null
+++ b/src/core/changes/qpropertyvalueremovedchange.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H
+#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H
+
+#include <Qt3DCore/qstaticpropertyvalueremovedchangebase.h>
+#include <Qt3DCore/qt3dcore_global.h>
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyValueRemovedChangePrivate;
+
+class QT3DCORESHARED_EXPORT QPropertyValueRemovedChange : public QStaticPropertyValueRemovedChangeBase
+{
+public:
+ explicit QPropertyValueRemovedChange(QNodeId subjectId);
+ ~QPropertyValueRemovedChange();
+
+ void setRemovedValue(const QVariant &value);
+ QVariant removedValue() const;
+
+private:
+ Q_DECLARE_PRIVATE(QPropertyValueRemovedChange)
+};
+
+typedef QSharedPointer<QPropertyValueRemovedChange> QPropertyValueRemovedChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_H
diff --git a/src/core/changes/qpropertyvalueremovedchange_p.h b/src/core/changes/qpropertyvalueremovedchange_p.h
new file mode 100644
index 000000000..82644b76c
--- /dev/null
+++ b/src/core/changes/qpropertyvalueremovedchange_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H
+#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qstaticpropertyvalueremovedchangebase_p.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyValueRemovedChange;
+
+class QT3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangePrivate : public QStaticPropertyValueRemovedChangeBasePrivate
+{
+public:
+ QPropertyValueRemovedChangePrivate();
+
+ Q_DECLARE_PUBLIC(QPropertyValueRemovedChange)
+
+ QVariant m_RemovedValue;
+};
+
+} // Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGE_P_H
+
diff --git a/src/core/changes/qpropertyvalueremovedchangebase.cpp b/src/core/changes/qpropertyvalueremovedchangebase.cpp
new file mode 100644
index 000000000..0892aa7c2
--- /dev/null
+++ b/src/core/changes/qpropertyvalueremovedchangebase.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpropertyvalueremovedchangebase.h"
+#include "qpropertyvalueremovedchangebase_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QPropertyValueRemovedChangeBasePrivate::QPropertyValueRemovedChangeBasePrivate()
+ : QSceneChangePrivate()
+{
+}
+
+QPropertyValueRemovedChangeBasePrivate::~QPropertyValueRemovedChangeBasePrivate()
+{
+}
+
+/*!
+ * \class Qt3DCore::QPropertyValueRemovedChangeBase
+ * \inmodule Qt3DCore
+ *
+ * The QPropertyValueRemovedChangeBase class is the base class for all QSceneChange events that
+ * have the changeType() PropertyValueRemoved. You should not need to instantiate this class.
+ * Usually you should be using one of its subclasses such as QPropertyNodeRemovedChange.
+ *
+ * You can subclass this to create your own node Removed types for communication between
+ * your QNode and QBackendNode subclasses when writing your own aspects.
+ */
+
+/*!
+ * \typedef Qt3DCore::QPropertyValueRemovedChangeBasePtr
+ * \relates Qt3DCore::QPropertyValueRemovedChangeBase
+ *
+ * A shared pointer for QPropertyValueRemovedChangeBase.
+ */
+
+/*!
+ * Constructs a new QPropertyValueRemovedChangeBase with \a senderType, \a subjectId, and
+ * \a priority.
+ */
+QPropertyValueRemovedChangeBase::QPropertyValueRemovedChangeBase(QNodeId subjectId)
+ : QSceneChange(*new QPropertyValueRemovedChangeBasePrivate, PropertyValueRemoved, subjectId)
+{
+}
+
+/*! internal */
+QPropertyValueRemovedChangeBase::QPropertyValueRemovedChangeBase(QPropertyValueRemovedChangeBasePrivate &dd,
+ QNodeId subjectId)
+ : QSceneChange(dd, PropertyValueRemoved, subjectId)
+{
+}
+
+QPropertyValueRemovedChangeBase::~QPropertyValueRemovedChangeBase()
+{
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qpropertyvalueremovedchangebase.h b/src/core/changes/qpropertyvalueremovedchangebase.h
new file mode 100644
index 000000000..44bc57726
--- /dev/null
+++ b/src/core/changes/qpropertyvalueremovedchangebase.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H
+#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H
+
+#include <Qt3DCore/qscenechange.h>
+#include <Qt3DCore/qt3dcore_global.h>
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyValueRemovedChangeBasePrivate;
+
+class QT3DCORESHARED_EXPORT QPropertyValueRemovedChangeBase : public QSceneChange
+{
+public:
+ ~QPropertyValueRemovedChangeBase();
+
+protected:
+ Q_DECLARE_PRIVATE(QPropertyValueRemovedChangeBase)
+ explicit QPropertyValueRemovedChangeBase(QNodeId subjectId);
+ explicit QPropertyValueRemovedChangeBase(QPropertyValueRemovedChangeBasePrivate &dd, QNodeId subjectId);
+};
+
+typedef QSharedPointer<QPropertyValueRemovedChangeBase> QPropertyValueRemovedChangeBasePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_H
diff --git a/src/core/changes/qpropertyvalueremovedchangebase_p.h b/src/core/changes/qpropertyvalueremovedchangebase_p.h
new file mode 100644
index 000000000..e4c4be640
--- /dev/null
+++ b/src/core/changes/qpropertyvalueremovedchangebase_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H
+#define QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qscenechange_p.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyValueRemovedChangeBase;
+
+class QT3DCORE_PRIVATE_EXPORT QPropertyValueRemovedChangeBasePrivate : public QSceneChangePrivate
+{
+public:
+ QPropertyValueRemovedChangeBasePrivate();
+ virtual ~QPropertyValueRemovedChangeBasePrivate();
+
+ Q_DECLARE_PUBLIC(QPropertyValueRemovedChangeBase)
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QPROPERTYVALUEREMOVEDCHANGEBASE_P_H
+
diff --git a/src/core/changes/qscenechange.cpp b/src/core/changes/qscenechange.cpp
new file mode 100644
index 000000000..99693dbf1
--- /dev/null
+++ b/src/core/changes/qscenechange.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qscenechange.h"
+#include "qscenechange_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+/*!
+ * \enum Qt3DCore::ChangeFlag
+ * \relates Qt3DCore::QSceneChange
+ *
+ * The types of change that can be sent and received by Qt3D's change notification system.
+ *
+ * \value NodeCreated A new instance of a QNode subclass has been created.
+ * \value NodeDeleted A QNode has been deleted.
+ * \value PropertyUpdated A QNode property has been updated.
+ * \value PropertyValueAdded A QNode has been added to the scene.
+ * \value PropertyValueRemoved A QNode has been removed from the scene.
+ * \value ComponentAdded A QComponent has been added to a QEntity.
+ * \value ComponentRemoved A QComponent has been removed from a QEntity.
+ * \value AllChanges Allows an observer to monitor for any of the above changes.
+ */
+
+QSceneChangePrivate::QSceneChangePrivate()
+ : q_ptr(nullptr)
+ , m_subjectId()
+ , m_deliveryFlags(QSceneChange::BackendNodes)
+ , m_type(AllChanges)
+{
+}
+
+QSceneChangePrivate::~QSceneChangePrivate()
+{
+}
+
+/*!
+ * \class Qt3DCore::QSceneChange
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QSceneChangePtr
+ * \relates Qt3DCore::QSceneChange
+ *
+ * A shared pointer for QSceneChange.
+ */
+
+/*!
+ * Constructs a new QSceneChange with \a type, \a senderType, \a subjectId, and \a priority.
+ */
+QSceneChange::QSceneChange(ChangeFlag type, QNodeId subjectId)
+ : d_ptr(new QSceneChangePrivate)
+{
+ d_ptr->q_ptr = this;
+ Q_D(QSceneChange);
+ d->m_type = type;
+ d->m_subjectId = subjectId;
+}
+
+/*! \internal */
+QSceneChange::QSceneChange(QSceneChangePrivate &dd,
+ ChangeFlag type, QNodeId subjectId)
+ : d_ptr(&dd)
+{
+ d_ptr->q_ptr = this;
+ Q_D(QSceneChange);
+ d->m_type = type;
+ d->m_subjectId = subjectId;
+}
+
+QSceneChange::~QSceneChange()
+{
+ delete d_ptr;
+}
+
+/*!
+ * \return scene change type.
+ */
+ChangeFlag QSceneChange::type() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QSceneChange);
+ return d->m_type;
+}
+
+void QSceneChange::setDeliveryFlags(DeliveryFlags flags) Q_DECL_NOEXCEPT
+{
+ Q_D(QSceneChange);
+ d->m_deliveryFlags = flags;
+}
+
+QSceneChange::DeliveryFlags QSceneChange::deliveryFlags() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QSceneChange);
+ return d->m_deliveryFlags;
+}
+
+/*!
+ * \return scene change subject id.
+ */
+QNodeId QSceneChange::subjectId() const Q_DECL_NOEXCEPT
+{
+ Q_D(const QSceneChange);
+ return d->m_subjectId;
+}
+
+} // Qt3D
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qscenechange.h b/src/core/changes/qscenechange.h
new file mode 100644
index 000000000..bd7686a53
--- /dev/null
+++ b/src/core/changes/qscenechange.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QSCENECHANGE_H
+#define QT3DCORE_QSCENECHANGE_H
+
+#include <Qt3DCore/qt3dcore_global.h>
+#include <QSharedPointer>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+enum ChangeFlag {
+ NodeCreated = 1 << 0,
+ NodeDeleted = 1 << 1,
+ PropertyUpdated = 1 << 2,
+ PropertyValueAdded = 1 << 3,
+ PropertyValueRemoved = 1 << 4,
+ ComponentAdded = 1 << 5,
+ ComponentRemoved = 1 << 6,
+ AllChanges = 0xFFFFFFFF
+};
+Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag)
+Q_DECLARE_OPERATORS_FOR_FLAGS(ChangeFlags)
+
+class QSceneChangePrivate;
+
+class QT3DCORESHARED_EXPORT QSceneChange
+{
+public:
+ enum DeliveryFlag {
+ BackendNodes = 0x0001,
+ Nodes = 0x0010,
+ DeliverToAll = BackendNodes | Nodes
+ };
+ Q_DECLARE_FLAGS(DeliveryFlags, DeliveryFlag)
+
+ virtual ~QSceneChange();
+
+ ChangeFlag type() const Q_DECL_NOEXCEPT;
+
+ void setDeliveryFlags(DeliveryFlags flags) Q_DECL_NOEXCEPT;
+ DeliveryFlags deliveryFlags() const Q_DECL_NOEXCEPT;
+
+ QNodeId subjectId() const Q_DECL_NOEXCEPT;
+
+protected:
+ Q_DECLARE_PRIVATE(QSceneChange)
+ explicit QSceneChange(ChangeFlag type, QNodeId subjectId);
+ explicit QSceneChange(QSceneChangePrivate &dd,
+ ChangeFlag type, QNodeId subjectId);
+ QSceneChangePrivate *d_ptr;
+
+private:
+ Q_DISABLE_COPY(QSceneChange)
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSceneChange::DeliveryFlags)
+
+typedef QSharedPointer<QSceneChange> QSceneChangePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QSCENECHANGE_H
diff --git a/src/core/changes/qscenechange_p.h b/src/core/changes/qscenechange_p.h
new file mode 100644
index 000000000..80ce4eaa5
--- /dev/null
+++ b/src/core/changes/qscenechange_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QSCENECHANGE_P_H
+#define QT3DCORE_QSCENECHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGlobal>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <Qt3DCore/qscenechange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QSceneChange;
+class QNodeId;
+
+class QT3DCORE_PRIVATE_EXPORT QSceneChangePrivate
+{
+public :
+ QSceneChangePrivate();
+ virtual ~QSceneChangePrivate();
+
+ Q_DECLARE_PUBLIC(QSceneChange)
+
+ QSceneChange *q_ptr;
+
+ QNodeId m_subjectId;
+ QSceneChange::DeliveryFlags m_deliveryFlags;
+ ChangeFlag m_type;
+};
+
+} // Qt3D
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QSCENECHANGE_P_H
diff --git a/src/core/changes/qstaticpropertyupdatedchangebase.cpp b/src/core/changes/qstaticpropertyupdatedchangebase.cpp
new file mode 100644
index 000000000..1da01e89e
--- /dev/null
+++ b/src/core/changes/qstaticpropertyupdatedchangebase.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstaticpropertyupdatedchangebase.h"
+#include "qstaticpropertyupdatedchangebase_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QStaticPropertyUpdatedChangeBasePrivate::QStaticPropertyUpdatedChangeBasePrivate()
+ : QPropertyUpdatedChangeBasePrivate()
+{
+}
+
+QStaticPropertyUpdatedChangeBasePrivate::~QStaticPropertyUpdatedChangeBasePrivate()
+{
+}
+
+
+/*!
+ * \class Qt3DCore::QStaticPropertyUpdatedChangeBase
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QStaticPropertyUpdatedChangeBasePtr
+ * \relates Qt3DCore::QStaticPropertyUpdatedChangeBase
+ *
+ * A shared pointer for QStaticPropertyUpdatedChangeBase.
+ */
+
+/*!
+ * Constructs a new QStaticPropertyUpdatedChangeBase with \a type, \a senderType, \a subjectId, and
+ * \a priority.
+ */
+QStaticPropertyUpdatedChangeBase::QStaticPropertyUpdatedChangeBase(QNodeId subjectId)
+ : QPropertyUpdatedChangeBase(*new QStaticPropertyUpdatedChangeBasePrivate, subjectId)
+{
+}
+
+/*! \internal */
+QStaticPropertyUpdatedChangeBase::QStaticPropertyUpdatedChangeBase(QStaticPropertyUpdatedChangeBasePrivate &dd,
+ QNodeId subjectId)
+ : QPropertyUpdatedChangeBase(dd, subjectId)
+{
+}
+
+QStaticPropertyUpdatedChangeBase::~QStaticPropertyUpdatedChangeBase()
+{
+}
+
+/*!
+ * \return name of the property.
+ */
+const char *QStaticPropertyUpdatedChangeBase::propertyName() const
+{
+ Q_D(const QStaticPropertyUpdatedChangeBase);
+ return d->m_propertyName;
+}
+
+/*!
+ * Sets the property change \a name.
+ */
+void QStaticPropertyUpdatedChangeBase::setPropertyName(const char *name)
+{
+ Q_D(QStaticPropertyUpdatedChangeBase);
+ d->m_propertyName = name;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qstaticpropertyupdatedchangebase.h b/src/core/changes/qstaticpropertyupdatedchangebase.h
new file mode 100644
index 000000000..ca145e975
--- /dev/null
+++ b/src/core/changes/qstaticpropertyupdatedchangebase.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H
+#define QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H
+
+#include <Qt3DCore/qpropertyupdatedchangebase.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QStaticPropertyUpdatedChangeBasePrivate;
+
+class QT3DCORESHARED_EXPORT QStaticPropertyUpdatedChangeBase : public QPropertyUpdatedChangeBase
+{
+public:
+ ~QStaticPropertyUpdatedChangeBase();
+
+ const char *propertyName() const;
+ void setPropertyName(const char *name);
+
+protected:
+ explicit QStaticPropertyUpdatedChangeBase(QNodeId subjectId);
+ explicit QStaticPropertyUpdatedChangeBase(QStaticPropertyUpdatedChangeBasePrivate &dd, QNodeId subjectId);
+ Q_DECLARE_PRIVATE(QStaticPropertyUpdatedChangeBase)
+};
+
+typedef QSharedPointer<QStaticPropertyUpdatedChangeBase> QStaticPropertyUpdatedChangeBasePtr;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_H
diff --git a/src/core/changes/qstaticpropertyupdatedchangebase_p.h b/src/core/changes/qstaticpropertyupdatedchangebase_p.h
new file mode 100644
index 000000000..c81df4076
--- /dev/null
+++ b/src/core/changes/qstaticpropertyupdatedchangebase_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H
+#define QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qpropertyupdatedchangebase_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QPropertyUpdatedChange;
+class QFrameAllocator;
+
+class QStaticPropertyUpdatedChangeBasePrivate : public QPropertyUpdatedChangeBasePrivate
+{
+public:
+ QStaticPropertyUpdatedChangeBasePrivate();
+ virtual ~QStaticPropertyUpdatedChangeBasePrivate();
+
+ Q_DECLARE_PUBLIC(QStaticPropertyUpdatedChangeBase)
+
+ /// FIXME: use QMetaProperty here once the NodeDeleted etc. change events
+ /// get refactored to their own QSceneChange subclass
+ const char *m_propertyName;
+};
+
+} // Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QSTATICPROPERTYUPDATEDCHANGEBASE_P_H
+
diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp b/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp
new file mode 100644
index 000000000..108c8d5c4
--- /dev/null
+++ b/src/core/changes/qstaticpropertyvalueaddedchangebase.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstaticpropertyvalueaddedchangebase.h"
+#include "qstaticpropertyvalueaddedchangebase_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QStaticPropertyValueAddedChangeBasePrivate::QStaticPropertyValueAddedChangeBasePrivate()
+ : QPropertyValueAddedChangeBasePrivate()
+{
+}
+
+
+QStaticPropertyValueAddedChangeBase::QStaticPropertyValueAddedChangeBase(QNodeId subjectId)
+ : QPropertyValueAddedChangeBase(*new QStaticPropertyValueAddedChangeBasePrivate, subjectId)
+{
+}
+
+QStaticPropertyValueAddedChangeBase::QStaticPropertyValueAddedChangeBase(QStaticPropertyValueAddedChangeBasePrivate &dd,
+ QNodeId subjectId)
+ : QPropertyValueAddedChangeBase(dd, subjectId)
+{
+}
+
+QStaticPropertyValueAddedChangeBase::~QStaticPropertyValueAddedChangeBase()
+{
+}
+
+/*!
+ * \return name of the property.
+ */
+const char *QStaticPropertyValueAddedChangeBase::propertyName() const
+{
+ Q_D(const QStaticPropertyValueAddedChangeBase);
+ return d->m_propertyName;
+}
+
+/*!
+ * Sets the property change \a name.
+ */
+void QStaticPropertyValueAddedChangeBase::setPropertyName(const char *name)
+{
+ Q_D(QStaticPropertyValueAddedChangeBase);
+ d->m_propertyName = name;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase.h b/src/core/changes/qstaticpropertyvalueaddedchangebase.h
new file mode 100644
index 000000000..bf55ac31c
--- /dev/null
+++ b/src/core/changes/qstaticpropertyvalueaddedchangebase.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H
+#define QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H
+
+#include <Qt3DCore/qpropertyvalueaddedchangebase.h>
+#include <Qt3DCore/qt3dcore_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QStaticPropertyValueAddedChangeBasePrivate;
+
+class QT3DCORESHARED_EXPORT QStaticPropertyValueAddedChangeBase : public QPropertyValueAddedChangeBase
+{
+public:
+ ~QStaticPropertyValueAddedChangeBase();
+
+ const char *propertyName() const;
+ void setPropertyName(const char *name);
+
+protected:
+ Q_DECLARE_PRIVATE(QStaticPropertyValueAddedChangeBase)
+ explicit QStaticPropertyValueAddedChangeBase(QNodeId subjectId);
+ QStaticPropertyValueAddedChangeBase(QStaticPropertyValueAddedChangeBasePrivate &dd,
+ QNodeId subjectId);
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_H
diff --git a/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h b/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h
new file mode 100644
index 000000000..7a614c0d1
--- /dev/null
+++ b/src/core/changes/qstaticpropertyvalueaddedchangebase_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H
+#define QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qpropertyvalueaddedchangebase_p.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QStaticPropertyValueAddedChangeBase;
+
+class QT3DCORE_PRIVATE_EXPORT QStaticPropertyValueAddedChangeBasePrivate : public QPropertyValueAddedChangeBasePrivate
+{
+public:
+ QStaticPropertyValueAddedChangeBasePrivate();
+
+ Q_DECLARE_PUBLIC(QStaticPropertyValueAddedChangeBase)
+
+ const char *m_propertyName;
+};
+
+} // Qt3D
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QSTATICPROPERTYVALUEADDEDCHANGEBASE_P_H
+
diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp b/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp
new file mode 100644
index 000000000..9eff24b65
--- /dev/null
+++ b/src/core/changes/qstaticpropertyvalueremovedchangebase.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstaticpropertyvalueremovedchangebase.h"
+#include "qstaticpropertyvalueremovedchangebase_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QStaticPropertyValueRemovedChangeBasePrivate::QStaticPropertyValueRemovedChangeBasePrivate()
+ : QPropertyValueRemovedChangeBasePrivate()
+{
+}
+
+
+QStaticPropertyValueRemovedChangeBase::QStaticPropertyValueRemovedChangeBase(QNodeId subjectId)
+ : QPropertyValueRemovedChangeBase(*new QStaticPropertyValueRemovedChangeBasePrivate, subjectId)
+{
+}
+
+QStaticPropertyValueRemovedChangeBase::QStaticPropertyValueRemovedChangeBase(QStaticPropertyValueRemovedChangeBasePrivate &dd,
+ QNodeId subjectId)
+ : QPropertyValueRemovedChangeBase(dd, subjectId)
+{
+}
+
+QStaticPropertyValueRemovedChangeBase::~QStaticPropertyValueRemovedChangeBase()
+{
+}
+
+/*!
+ * \return name of the property.
+ */
+const char *QStaticPropertyValueRemovedChangeBase::propertyName() const
+{
+ Q_D(const QStaticPropertyValueRemovedChangeBase);
+ return d->m_propertyName;
+}
+
+/*!
+ * Sets the property change \a name.
+ */
+void QStaticPropertyValueRemovedChangeBase::setPropertyName(const char *name)
+{
+ Q_D(QStaticPropertyValueRemovedChangeBase);
+ d->m_propertyName = name;
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase.h b/src/core/changes/qstaticpropertyvalueremovedchangebase.h
new file mode 100644
index 000000000..f6f554397
--- /dev/null
+++ b/src/core/changes/qstaticpropertyvalueremovedchangebase.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H
+#define QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H
+
+#include <Qt3DCore/qpropertyvalueremovedchangebase.h>
+#include <Qt3DCore/qt3dcore_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QStaticPropertyValueRemovedChangeBasePrivate;
+
+class QT3DCORESHARED_EXPORT QStaticPropertyValueRemovedChangeBase : public QPropertyValueRemovedChangeBase
+{
+public:
+ ~QStaticPropertyValueRemovedChangeBase();
+
+ const char *propertyName() const;
+ void setPropertyName(const char *name);
+
+protected:
+ Q_DECLARE_PRIVATE(QStaticPropertyValueRemovedChangeBase)
+ explicit QStaticPropertyValueRemovedChangeBase(QNodeId subjectId);
+ QStaticPropertyValueRemovedChangeBase(QStaticPropertyValueRemovedChangeBasePrivate &dd,
+ QNodeId subjectId);
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_H
diff --git a/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h b/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h
new file mode 100644
index 000000000..47f43f745
--- /dev/null
+++ b/src/core/changes/qstaticpropertyvalueremovedchangebase_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H
+#define QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qpropertyvalueremovedchangebase_p.h>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QStaticPropertyValueRemovedChangeBase;
+
+class QT3DCORE_PRIVATE_EXPORT QStaticPropertyValueRemovedChangeBasePrivate : public QPropertyValueRemovedChangeBasePrivate
+{
+public:
+ QStaticPropertyValueRemovedChangeBasePrivate();
+
+ Q_DECLARE_PUBLIC(QStaticPropertyValueRemovedChangeBase)
+
+ const char *m_propertyName;
+};
+
+} // Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QSTATICPROPERTYVALUEREMOVEDCHANGEBASE_P_H
+
diff --git a/src/core/changes/qtypedpropertyupdatechange_p.h b/src/core/changes/qtypedpropertyupdatechange_p.h
new file mode 100644
index 000000000..f196ee5eb
--- /dev/null
+++ b/src/core/changes/qtypedpropertyupdatechange_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H
+#define QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qstaticpropertyupdatedchangebase.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+template<typename T>
+class QTypedPropertyUpdatedChange : public QStaticPropertyUpdatedChangeBase
+{
+public:
+ explicit QTypedPropertyUpdatedChange(QNodeId _subjectId)
+ : QStaticPropertyUpdatedChangeBase(_subjectId)
+ , data()
+ {
+ }
+
+ T data;
+};
+
+template<typename T>
+using QTypedPropertyUpdatedChangePtr = QSharedPointer<QTypedPropertyUpdatedChange<T>>;
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QTYPEDPROPERTYUPDATECHANGE_P_H
+
diff --git a/src/core/core-components/core-components.pri b/src/core/core-components/core-components.pri
deleted file mode 100644
index 737c6802e..000000000
--- a/src/core/core-components/core-components.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-HEADERS += \
- $$PWD/qcamera_p.h \
- $$PWD/qcamera.h \
- $$PWD/qcameralens.h \
- $$PWD/qcameralens_p.h
-
-SOURCES += \
- $$PWD/qcamera.cpp \
- $$PWD/qcameralens.cpp
-
-INCLUDEPATH += $$PWD
diff --git a/src/core/core-components/qcamera.cpp b/src/core/core-components/qcamera.cpp
deleted file mode 100644
index ba086f7ac..000000000
--- a/src/core/core-components/qcamera.cpp
+++ /dev/null
@@ -1,482 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcamera.h"
-#include "qcamera_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-QCameraPrivate::QCameraPrivate()
- : QEntityPrivate()
- , m_position(0.0f, 0.0f, 0.0f)
- , m_viewCenter(0.0f, 0.0f, -100.0f)
- , m_upVector(0.0f, 1.0f, 0.0f)
- , m_cameraToCenter(m_viewCenter - m_position)
- , m_viewMatrixDirty(false)
- , m_lens(new QCameraLens())
- , m_transform(new QTransform())
-{
-}
-
-/*!
- \qmltype Camera
- \instantiates Qt3DCore::QCamera
- \inherits Entity
- \inqmlmodule Qt3D.Core
- \since 5.5
-*/
-
-QCamera::QCamera(QNode *parent)
- : QEntity(*new QCameraPrivate, parent)
-{
- QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)), this, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)));
- QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged(float)), this, SIGNAL(nearPlaneChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged(float)), this, SIGNAL(farPlaneChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged(float)), this, SIGNAL(fieldOfViewChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged(float)), this, SIGNAL(aspectRatioChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(leftChanged(float)), this, SIGNAL(leftChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(rightChanged(float)), this, SIGNAL(rightChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged(float)), this, SIGNAL(bottomChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(topChanged(float)), this, SIGNAL(topChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)), this, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)));
- QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged(const QMatrix4x4 &)), this, SIGNAL(viewMatrixChanged(const QMatrix4x4 &)));
- addComponent(d_func()->m_lens);
- addComponent(d_func()->m_transform);
-}
-
-QCamera::~QCamera()
-{
- QNode::cleanup();
-}
-
-/*! \internal */
-QCamera::QCamera(QCameraPrivate &dd, QNode *parent)
- : QEntity(dd, parent)
-{
- QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)), this, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)));
- QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged(float)), this, SIGNAL(nearPlaneChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged(float)), this, SIGNAL(farPlaneChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged(float)), this, SIGNAL(fieldOfViewChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged(float)), this, SIGNAL(aspectRatioChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(leftChanged(float)), this, SIGNAL(leftChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(rightChanged(float)), this, SIGNAL(rightChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged(float)), this, SIGNAL(bottomChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(topChanged(float)), this, SIGNAL(topChanged(float)));
- QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)), this, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)));
- QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged(const QMatrix4x4 &)), this, SIGNAL(viewMatrixChanged(const QMatrix4x4 &)));
- addComponent(d_func()->m_lens);
- addComponent(d_func()->m_transform);
-}
-
-QCameraLens *QCamera::lens() const
-{
- Q_D(const QCamera);
- return d->m_lens;
-}
-
-QTransform *QCamera::transform() const
-{
- Q_D(const QCamera);
- return d->m_transform;
-}
-
-void QCamera::translate(const QVector3D &vLocal, CameraTranslationOption option)
-{
- QVector3D viewVector = viewCenter() - position(); // From "camera" position to view center
-
- // Calculate the amount to move by in world coordinates
- QVector3D vWorld;
- if (!qFuzzyIsNull(vLocal.x())) {
- // Calculate the vector for the local x axis
- const QVector3D x = QVector3D::crossProduct(viewVector, upVector()).normalized();
- vWorld += vLocal.x() * x;
- }
-
- if (!qFuzzyIsNull(vLocal.y()))
- vWorld += vLocal.y() * upVector();
-
- if (!qFuzzyIsNull(vLocal.z()))
- vWorld += vLocal.z() * viewVector.normalized();
-
- // Update the camera position using the calculated world vector
- setPosition(position() + vWorld);
-
- // May be also update the view center coordinates
- if (option == TranslateViewCenter)
- setViewCenter(viewCenter() + vWorld);
-
- // Refresh the camera -> view center vector
- viewVector = viewCenter() - position();
-
- // Calculate a new up vector. We do this by:
- // 1) Calculate a new local x-direction vector from the cross product of the new
- // camera to view center vector and the old up vector.
- // 2) The local x vector is the normal to the plane in which the new up vector
- // must lay. So we can take the cross product of this normal and the new
- // x vector. The new normal vector forms the last part of the orthonormal basis
- const QVector3D x = QVector3D::crossProduct(viewVector, upVector()).normalized();
- setUpVector(QVector3D::crossProduct(x, viewVector).normalized());
-}
-
-void QCamera::translateWorld(const QVector3D &vWorld, CameraTranslationOption option)
-{
- // Update the camera position using the calculated world vector
- setPosition(position() + vWorld);
-
- // May be also update the view center coordinates
- if (option == TranslateViewCenter)
- setViewCenter(viewCenter() + vWorld);
-}
-
-QQuaternion QCamera::tiltRotation(float angle) const
-{
- const QVector3D viewVector = viewCenter() - position();
- const QVector3D xBasis = QVector3D::crossProduct(upVector(), viewVector.normalized()).normalized();
- return QQuaternion::fromAxisAndAngle(xBasis, -angle);
-}
-
-QQuaternion QCamera::panRotation(float angle) const
-{
- return QQuaternion::fromAxisAndAngle(upVector(), angle);
-}
-
-QQuaternion QCamera::rollRotation(float angle) const
-{
- QVector3D viewVector = viewCenter() - position();
- return QQuaternion::fromAxisAndAngle(viewVector, -angle);
-}
-
-QQuaternion QCamera::rotation(float angle, const QVector3D &axis) const
-{
- return QQuaternion::fromAxisAndAngle(axis, angle);
-}
-
-void QCamera::tilt(float angle)
-{
- QQuaternion q = tiltRotation(angle);
- rotate(q);
-}
-
-void QCamera::pan(float angle)
-{
- QQuaternion q = panRotation(-angle);
- rotate(q);
-}
-
-void QCamera::pan(float angle, const QVector3D &axis)
-{
- QQuaternion q = rotation(-angle, axis);
- rotate(q);
-}
-
-void QCamera::roll(float angle)
-{
- QQuaternion q = rollRotation(-angle);
- rotate(q);
-}
-
-void QCamera::tiltAboutViewCenter(float angle)
-{
- QQuaternion q = tiltRotation(-angle);
- rotateAboutViewCenter(q);
-}
-
-void QCamera::panAboutViewCenter(float angle)
-{
- QQuaternion q = panRotation(angle);
- rotateAboutViewCenter(q);
-}
-
-void QCamera::panAboutViewCenter(float angle, const QVector3D &axis)
-{
- QQuaternion q = rotation(angle, axis);
- rotateAboutViewCenter(q);
-}
-
-void QCamera::rollAboutViewCenter(float angle)
-{
- QQuaternion q = rollRotation(angle);
- rotateAboutViewCenter(q);
-}
-
-void QCamera::rotate(const QQuaternion& q)
-{
- setUpVector(q * upVector());
- QVector3D viewVector = viewCenter() - position();
- QVector3D cameraToCenter = q * viewVector;
- setViewCenter(position() + cameraToCenter);
-}
-
-void QCamera::rotateAboutViewCenter(const QQuaternion& q)
-{
- setUpVector(q * upVector());
- QVector3D viewVector = viewCenter() - position();
- QVector3D cameraToCenter = q * viewVector;
- setPosition(viewCenter() - cameraToCenter);
- setViewCenter(position() + cameraToCenter);
-}
-
-void QCamera::setProjectionType(QCameraLens::ProjectionType type)
-{
- Q_D(QCamera);
- d->m_lens->setProjectionType(type);
-}
-
-/*!
- \qmlproperty enumeration Qt3DCore::Camera::projectionType
-
- Holds the type of the camera projection (orthogonal or perspective).
-
- \value CameraLens.OrthographicProjection Orthographic projection
- \value CameraLens.PerspectiveProjection Perspective projection
-*/
-QCameraLens::ProjectionType QCamera::projectionType() const
-{
- Q_D(const QCamera);
- return d->m_lens->projectionType();
-}
-
-void QCamera::setNearPlane(float nearPlane)
-{
- Q_D(QCamera);
- d->m_lens->setNearPlane(nearPlane);
-}
-
-/*!
- \qmlproperty float Qt3DCore::Camera::nearPlane
-*/
-float QCamera::nearPlane() const
-{
- Q_D(const QCamera);
- return d->m_lens->nearPlane();
-}
-
-void QCamera::setFarPlane(float farPlane)
-{
- Q_D(QCamera);
- d->m_lens->setFarPlane(farPlane);
-}
-
-/*!
- \qmlproperty float Qt3DCore::Camera::farPlane
-*/
-float QCamera::farPlane() const
-{
- Q_D(const QCamera);
- return d->m_lens->farPlane();
-}
-
-void QCamera::setFieldOfView(float fieldOfView)
-{
- Q_D(QCamera);
- d->m_lens->setFieldOfView(fieldOfView);
-}
-
-/*!
- \qmlproperty float Qt3DCore::Camera::fieldOfView
-*/
-float QCamera::fieldOfView() const
-{
- Q_D(const QCamera);
- return d->m_lens->fieldOfView();
-}
-
-void QCamera::setAspectRatio(float aspectRatio)
-{
- Q_D(QCamera);
- d->m_lens->setAspectRatio(aspectRatio);
-}
-
-/*!
- \qmlproperty float Qt3DCore::Camera::aspectRatio
-*/
-float QCamera::aspectRatio() const
-{
- Q_D(const QCamera);
- return d->m_lens->aspectRatio();
-}
-
-void QCamera::setLeft(float left)
-{
- Q_D(QCamera);
- d->m_lens->setLeft(left);
-}
-
-/*!
- \qmlproperty float Qt3DCore::Camera::left
-*/
-float QCamera::left() const
-{
- Q_D(const QCamera);
- return d->m_lens->left();
-}
-
-void QCamera::setRight(float right)
-{
- Q_D(QCamera);
- d->m_lens->setRight(right);
-}
-
-/*!
- \qmlproperty float Qt3DCore::Camera::right
-*/
-float QCamera::right() const
-{
- Q_D(const QCamera);
- return d->m_lens->right();
-}
-
-void QCamera::setBottom(float bottom)
-{
- Q_D(QCamera);
- d->m_lens->setBottom(bottom);
-}
-
-/*!
- \qmlproperty float Qt3DCore::Camera::bottom
-*/
-float QCamera::bottom() const
-{
- Q_D(const QCamera);
- return d->m_lens->bottom();
-}
-
-void QCamera::setTop(float top)
-{
- Q_D(QCamera);
- d->m_lens->setTop(top);
-}
-
-/*!
- \qmlproperty float Qt3DCore::Camera::top
-*/
-float QCamera::top() const
-{
- Q_D(const QCamera);
- return d->m_lens->top();
-}
-
-/*!
- \qmlproperty matrix4x4 Qt3DCore::Camera::projectionMatrix
- \readonly
-*/
-QMatrix4x4 QCamera::projectionMatrix() const
-{
- Q_D(const QCamera);
- return d->m_lens->projectionMatrix();
-}
-
-void QCamera::setPosition(const QVector3D &position)
-{
- Q_D(QCamera);
- d->m_position = position;
- d->m_cameraToCenter = d->m_viewCenter - position;
- d->m_viewMatrixDirty = true;
- emit positionChanged(position);
- emit viewVectorChanged(d->m_cameraToCenter);
- d->updateViewMatrix();
-}
-
-/*!
- \qmlproperty vector3d Qt3DCore::Camera::position
-*/
-QVector3D QCamera::position() const
-{
- Q_D(const QCamera);
- return d->m_position;
-}
-
-void QCamera::setUpVector(const QVector3D &upVector)
-{
- Q_D(QCamera);
- d->m_upVector = upVector;
- d->m_viewMatrixDirty = true;
- emit upVectorChanged(upVector);
- d->updateViewMatrix();
-}
-
-/*!
- \qmlproperty vector3d Qt3DCore::Camera::upVector
-*/
-QVector3D QCamera::upVector() const
-{
- Q_D(const QCamera);
- return d->m_upVector;
-}
-
-void QCamera::setViewCenter(const QVector3D &viewCenter)
-{
- Q_D(QCamera);
- d->m_viewCenter = viewCenter;
- d->m_cameraToCenter = viewCenter - d->m_position;
- d->m_viewMatrixDirty = true;
- emit viewCenterChanged(viewCenter);
- emit viewVectorChanged(d->m_cameraToCenter);
- d->updateViewMatrix();
-}
-
-/*!
- \qmlproperty vector3d Qt3DCore::Camera::viewCenter
-*/
-QVector3D QCamera::viewCenter() const
-{
- Q_D(const QCamera);
- return d->m_viewCenter;
-}
-
-/*!
- \qmlproperty vector3d Qt3DCore::Camera::viewVector
-*/
-QVector3D QCamera::viewVector() const
-{
- Q_D(const QCamera);
- return d->m_cameraToCenter;
-}
-
-/*!
- \qmlproperty matrix4x4 Qt3DCore::Camera::viewMatrix
-*/
-QMatrix4x4 QCamera::viewMatrix() const
-{
- Q_D(const QCamera);
- return d->m_transform->matrix();
-}
-
-} // Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/core/core-components/qcamera.h b/src/core/core-components/qcamera.h
deleted file mode 100644
index 847041dbe..000000000
--- a/src/core/core-components/qcamera.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_CAMERA_H
-#define QT3DCORE_CAMERA_H
-
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qcameralens.h>
-#include <QMatrix4x4>
-#include <QQuaternion>
-#include <QVector3D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QLookAtTransform;
-class QTransform;
-
-class QCameraPrivate;
-class QT3DCORESHARED_EXPORT QCamera : public QEntity
-{
- Q_OBJECT
- // CameraLens
- Q_PROPERTY(Qt3DCore::QCameraLens::ProjectionType projectionType READ projectionType WRITE setProjectionType NOTIFY projectionTypeChanged)
- Q_PROPERTY(float nearPlane READ nearPlane WRITE setNearPlane NOTIFY nearPlaneChanged)
- Q_PROPERTY(float farPlane READ farPlane WRITE setFarPlane NOTIFY farPlaneChanged)
- Q_PROPERTY(float fieldOfView READ fieldOfView WRITE setFieldOfView NOTIFY fieldOfViewChanged)
- Q_PROPERTY(float aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged)
- Q_PROPERTY(float left READ left WRITE setLeft NOTIFY leftChanged)
- Q_PROPERTY(float right READ right WRITE setRight NOTIFY rightChanged)
- Q_PROPERTY(float bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
- Q_PROPERTY(float top READ top WRITE setTop NOTIFY topChanged)
- Q_PROPERTY(QMatrix4x4 projectionMatrix READ projectionMatrix NOTIFY projectionMatrixChanged)
- // LookAt
- Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
- Q_PROPERTY(QVector3D upVector READ upVector WRITE setUpVector NOTIFY upVectorChanged)
- Q_PROPERTY(QVector3D viewCenter READ viewCenter WRITE setViewCenter NOTIFY viewCenterChanged)
- Q_PROPERTY(QVector3D viewVector READ viewVector NOTIFY viewVectorChanged)
- Q_PROPERTY(QMatrix4x4 viewMatrix READ viewMatrix NOTIFY viewMatrixChanged)
-
-public:
- explicit QCamera(QNode *parent = Q_NULLPTR);
- ~QCamera();
-
- enum CameraTranslationOption {
- TranslateViewCenter,
- DontTranslateViewCenter
- };
- Q_ENUM(CameraTranslationOption)
-
- QCameraLens *lens() const;
- QTransform *transform() const;
-
- QQuaternion tiltRotation(float angle) const;
- QQuaternion panRotation(float angle) const;
- QQuaternion rollRotation(float angle) const;
- QQuaternion rotation(float angle, const QVector3D &axis) const;
-
- // Translate relative to camera orientation axes
- Q_INVOKABLE void translate(const QVector3D& vLocal, CameraTranslationOption option = TranslateViewCenter);
-
- // Translate relative to world axes
- Q_INVOKABLE void translateWorld(const QVector3D& vWorld, CameraTranslationOption option = TranslateViewCenter);
-
- Q_INVOKABLE void tilt(float angle);
- Q_INVOKABLE void pan(float angle);
- Q_INVOKABLE void pan(float angle, const QVector3D &axis);
- Q_INVOKABLE void roll(float angle);
-
- Q_INVOKABLE void tiltAboutViewCenter(float angle);
- Q_INVOKABLE void panAboutViewCenter(float angle);
- Q_INVOKABLE void panAboutViewCenter(float angle, const QVector3D &axis);
- Q_INVOKABLE void rollAboutViewCenter(float angle);
-
- Q_INVOKABLE void rotate(const QQuaternion& q);
- Q_INVOKABLE void rotateAboutViewCenter(const QQuaternion& q);
-
- QCameraLens::ProjectionType projectionType() const;
- float nearPlane() const;
- float farPlane() const;
- float fieldOfView() const;
- float aspectRatio() const;
- float left() const;
- float right() const;
- float bottom() const;
- float top() const;
- QMatrix4x4 projectionMatrix() const;
- QVector3D position() const;
- QVector3D upVector() const;
- QVector3D viewCenter() const;
- QVector3D viewVector() const;
- QMatrix4x4 viewMatrix() const;
-
-public Q_SLOTS:
- void setProjectionType(QCameraLens::ProjectionType type);
- void setNearPlane(float nearPlane);
- void setFarPlane(float farPlane);
- void setFieldOfView(float fieldOfView);
- void setAspectRatio(float aspectRatio);
- void setLeft(float left);
- void setRight(float right);
- void setBottom(float bottom);
- void setTop(float top);
- void setPosition(const QVector3D &position);
- void setUpVector(const QVector3D &upVector);
- void setViewCenter(const QVector3D &viewCenter);
-
-Q_SIGNALS:
- void projectionTypeChanged(QCameraLens::ProjectionType projectionType);
- void nearPlaneChanged(float nearPlane);
- void farPlaneChanged(float farPlane);
- void fieldOfViewChanged(float fieldOfView);
- void aspectRatioChanged(float aspectRatio);
- void leftChanged(float left);
- void rightChanged(float right);
- void bottomChanged(float bottom);
- void topChanged(float top);
- void projectionMatrixChanged(const QMatrix4x4 &projectionMatrix);
- void positionChanged(const QVector3D &position);
- void upVectorChanged(const QVector3D &upVector);
- void viewCenterChanged(const QVector3D &viewCenter);
- void viewVectorChanged(const QVector3D &viewVector);
- void viewMatrixChanged(const QMatrix4x4 &viewMatrix);
-
-protected:
- Q_DECLARE_PRIVATE(QCamera)
- QT3D_CLONEABLE(QCamera)
- QCamera(QCameraPrivate &dd, QNode *parent = Q_NULLPTR);
-};
-
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_CAMERA_H
diff --git a/src/core/core-components/qcamera_p.h b/src/core/core-components/qcamera_p.h
deleted file mode 100644
index c64b4a5ab..000000000
--- a/src/core/core-components/qcamera_p.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_CAMERA_P_H
-#define QT3DCORE_CAMERA_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qcameralens.h>
-#include <Qt3DCore/qtransform.h>
-#include <private/qentity_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QCameraPrivate : public QEntityPrivate
-{
-public:
- QCameraPrivate();
-
- Q_DECLARE_PUBLIC(QCamera)
-
- void updateViewMatrix()
- {
- QMatrix4x4 m;
- m.lookAt(m_position, m_viewCenter, m_upVector);
- m_transform->setMatrix(m);
- }
-
- QVector3D m_position;
- QVector3D m_viewCenter;
- QVector3D m_upVector;
-
- QVector3D m_cameraToCenter; // The vector from the camera position to the view center
- bool m_viewMatrixDirty;
-
- // Components
- QCameraLens *m_lens;
- QTransform *m_transform;
-};
-
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_CAMERA_P_H
diff --git a/src/core/core-components/qcameralens.cpp b/src/core/core-components/qcameralens.cpp
deleted file mode 100644
index b6ae09a00..000000000
--- a/src/core/core-components/qcameralens.cpp
+++ /dev/null
@@ -1,473 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcameralens.h"
-#include "qcameralens_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-QCameraLensPrivate::QCameraLensPrivate()
- : QComponentPrivate()
- , m_projectionType(QCameraLens::OrthographicProjection)
- , m_nearPlane(0.1f)
- , m_farPlane(1024.0f)
- , m_fieldOfView(25.0f)
- , m_aspectRatio(1.0f)
- , m_left(-0.5f)
- , m_right(0.5f)
- , m_bottom(-0.5f)
- , m_top(0.5f)
-{
-}
-
-QCameraLens::QCameraLens(QNode *parent)
- : QComponent(*new QCameraLensPrivate, parent)
-{
- Q_D(QCameraLens);
- d->updateProjectionMatrix();
-}
-
-QCameraLens::~QCameraLens()
-{
- QNode::cleanup();
-}
-
-void QCameraLens::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QCameraLens *lens = static_cast<const QCameraLens*>(ref);
- d_func()->m_projectionType = lens->d_func()->m_projectionType;
- d_func()->m_nearPlane = lens->d_func()->m_nearPlane;
- d_func()->m_farPlane = lens->d_func()->m_farPlane;
- d_func()->m_fieldOfView = lens->d_func()->m_fieldOfView;
- d_func()->m_aspectRatio = lens->d_func()->m_aspectRatio;
- d_func()->m_left = lens->d_func()->m_left;
- d_func()->m_right = lens->d_func()->m_right;
- d_func()->m_bottom = lens->d_func()->m_bottom;
- d_func()->m_top = lens->d_func()->m_top;
- d_func()->m_projectionMatrix = lens->d_func()->m_projectionMatrix;
-}
-
-/*! \class Qt3DCore::QCameraLens
- * \inmodule Qt3DCore
- *
- * \brief Qt3DCore::QCameraLens specifies the projection matrix that will be used to
- * define a Camera for a 3D scene.
- *
- * \since 5.5
- */
-QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent)
- : QComponent(dd, parent)
-{
- Q_D(QCameraLens);
- d->updateOrthographicProjection();
-}
-
-/*!
- * Sets the lens' projection type \a projectionType.
- *
- * \note Qt3DCore::QCameraLens::Frustum and
- * Qt3DCore::QCameraLens::PerspectiveProjection are two different ways of
- * specifying the same projection.
- */
-void QCameraLens::setProjectionType(QCameraLens::ProjectionType projectionType)
-{
- Q_D(QCameraLens);
- if (d->m_projectionType != projectionType) {
- d->m_projectionType = projectionType;
- emit projectionTypeChanged(projectionType);
- d->updateProjectionMatrix();
- }
-}
-
-/*!
- * Returns the lens' projection type.
- */
-QCameraLens::ProjectionType QCameraLens::projectionType() const
-{
- Q_D(const QCameraLens);
- return d->m_projectionType;
-}
-
-/*!
- * Defines an orthographic projection based on \a left, \a right, \a bottom, \a
- * top, \a nearPlane, \a farPlane.
- */
-void QCameraLens::setOrthographicProjection(float left, float right,
- float bottom, float top,
- float nearPlane, float farPlane)
-{
- Q_D(QCameraLens);
- bool block = blockNotifications(true);
- setLeft(left);
- setRight(right);
- setBottom(bottom);
- setTop(top);
- setNearPlane(nearPlane);
- setFarPlane(farPlane);
- setProjectionType(OrthographicProjection);
- blockNotifications(block);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Defines an orthographic projection based on \a left, \a right, \a bottom, \a
- * top, \a nearPlane, \a farPlane.
- */
-void QCameraLens::setFrustumProjection(float left, float right,
- float bottom, float top,
- float nearPlane, float farPlane)
-{
- Q_D(QCameraLens);
- bool block = blockNotifications(true);
- setLeft(left);
- setRight(right);
- setBottom(bottom);
- setTop(top);
- setNearPlane(nearPlane);
- setFarPlane(farPlane);
- setProjectionType(FrustumProjection);
- blockNotifications(block);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Defines a perspective projection based on \a fieldOfView, \a aspectRatio, \a
- * nearPlane, \a farPlane.
- */
-void QCameraLens::setPerspectiveProjection(float fieldOfView, float aspectRatio,
- float nearPlane, float farPlane)
-{
- Q_D(QCameraLens);
- bool block = blockNotifications(true);
- setFieldOfView(fieldOfView);
- setAspectRatio(aspectRatio);
- setNearPlane(nearPlane);
- setFarPlane(farPlane);
- setProjectionType(PerspectiveProjection);
- blockNotifications(block);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Sets the projection's near plane to \a nearPlane. This triggers a projection
- * matrix update.
- */
-void QCameraLens::setNearPlane(float nearPlane)
-{
- Q_D(QCameraLens);
- if (qFuzzyCompare(d->m_nearPlane, nearPlane))
- return;
- d->m_nearPlane = nearPlane;
- emit nearPlaneChanged(nearPlane);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Returns the projection's near plane.
- */
-float QCameraLens::nearPlane() const
-{
- Q_D(const QCameraLens);
- return d->m_nearPlane;
-}
-
-/*!
- * Sets the projection's far plane to \a farPlane. This triggers a projection
- * matrix update.
- */
-void QCameraLens::setFarPlane(float farPlane)
-{
- Q_D(QCameraLens);
- if (qFuzzyCompare(d->m_farPlane, farPlane))
- return;
- d->m_farPlane = farPlane;
- emit farPlaneChanged(farPlane);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Returns the projection's far plane.
- */
-float QCameraLens::farPlane() const
-{
- Q_D(const QCameraLens);
- return d->m_farPlane;
-}
-
-/*!
- * Sets the projection's field of view to \a fieldOfView degrees. This triggers
- * a projection matrix update.
- *
- * \note this has no effect if the projection type is not
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-void QCameraLens::setFieldOfView(float fieldOfView)
-{
- Q_D(QCameraLens);
- if (qFuzzyCompare(d->m_fieldOfView, fieldOfView))
- return;
- d->m_fieldOfView = fieldOfView;
- emit fieldOfViewChanged(fieldOfView);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Returns the projection's field of view in degrees.
- *
- * \note: The return value may be undefined if the projection type is not
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-float QCameraLens::fieldOfView() const
-{
- Q_D(const QCameraLens);
- return d->m_fieldOfView;
-}
-
-/*!
- * Sets the projection's aspect ratio to \a aspectRatio. This triggers a projection
- * matrix update.
- *
- * \note this has no effect if the projection type is not
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-void QCameraLens::setAspectRatio(float aspectRatio)
-{
- Q_D(QCameraLens);
- if (qFuzzyCompare(d->m_aspectRatio, aspectRatio))
- return;
- d->m_aspectRatio = aspectRatio;
- emit aspectRatioChanged(aspectRatio);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Returns the projection's aspect ratio.
- *
- * \note: The return value may be undefined if the projection type is not
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-float QCameraLens::aspectRatio() const
-{
- Q_D(const QCameraLens);
- return d->m_aspectRatio;
-}
-
-/*!
- * Sets the projection's lower left window coordinate to \a left. This
- * triggers a projection matrix update.
- *
- * \note this has no effect if the projection type is
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-void QCameraLens::setLeft(float left)
-{
- Q_D(QCameraLens);
- if (qFuzzyCompare(d->m_left, left))
- return;
- d->m_left = left;
- emit leftChanged(left);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Returns the lower left window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-float QCameraLens::left() const
-{
- Q_D(const QCameraLens);
- return d->m_left;
-}
-
-/*!
- * Sets the projection's upper right window coordinate to \a right. This triggers
- * a projection matrix update.
- *
- * \note this has no effect if the projection type is
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-void QCameraLens::setRight(float right)
-{
- Q_D(QCameraLens);
- if (qFuzzyCompare(d->m_right, right))
- return;
- d->m_right = right;
- emit rightChanged(right);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Returns the upper right window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-float QCameraLens::right() const
-{
- Q_D(const QCameraLens);
- return d->m_right;
-}
-
-/*!
- * Sets the projection's bottom window coordinate to \a bottom. This triggers a
- * projection matrix update.
- *
- * \note this has no effect if the projection type is
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-void QCameraLens::setBottom(float bottom)
-{
- Q_D(QCameraLens);
- if (qFuzzyCompare(d->m_bottom, bottom))
- return;
- d->m_bottom = bottom;
- emit bottomChanged(bottom);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Returns the bottom window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-float QCameraLens::bottom() const
-{
- Q_D(const QCameraLens);
- return d->m_bottom;
-}
-
-/*!
- * Sets the projection's top window coordinate to \a top. This triggers a
- * projection matrix update.
- *
- * \note this has no effect if the projection type is
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-void QCameraLens::setTop(float top)
-{
- Q_D(QCameraLens);
- if (qFuzzyCompare(d->m_top, top))
- return;
- d->m_top = top;
- emit topChanged(top);
- d->updateProjectionMatrix();
-}
-
-/*!
- * Returns the bottom window coordinate of the projection.
- *
- * \note The return value may be undefined if the projection type is
- * Qt3DCore::QCameraLens::PerspectiveProjection.
- */
-float QCameraLens::top() const
-{
- Q_D(const QCameraLens);
- return d->m_top;
-}
-
-/*!
- * Returns the projection matrix.
- */
-QMatrix4x4 QCameraLens::projectionMatrix() const
-{
- Q_D(const QCameraLens);
- return d->m_projectionMatrix;
-}
-
-} // Qt3D
-
-/*!
- \qmltype CameraLens
- \instantiates Qt3DCore::QCameraLens
- \inqmlmodule Qt3D.Core
- \inherits Component3D
- \since 5.5
- \brief Provides the projection matrix that is used to define a Camera for 3D scene.
-*/
-
-/*!
- \qmlproperty enumeration Qt3DCore::CameraLens::projectionType
-
- Holds the type of the camera projection (orthogonal or perspective).
-
- \value CameraLens.OrthographicProjection Orthogonal projection
- \value CameraLens.PerspectiveProjection Perspective projection
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::nearPlane
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::farPlane
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::fieldOfView
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::aspectRatio
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::left
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::right
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::bottom
-*/
-
-/*!
- \qmlproperty float Qt3DCore::CameraLens::top
-*/
-
-/*!
- \qmlproperty matrix4x4 Qt3DCore::CameraLens::projectionMatrix
- \readonly
-*/
-
-QT_END_NAMESPACE
diff --git a/src/core/core-components/qcameralens.h b/src/core/core-components/qcameralens.h
deleted file mode 100644
index 5cb0d8389..000000000
--- a/src/core/core-components/qcameralens.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_CAMERALENS_H
-#define QT3DCORE_CAMERALENS_H
-
-#include <Qt3DCore/qcomponent.h>
-#include <Qt3DCore/qt3dcore_global.h>
-
-#include <QMatrix4x4>
-#include <QQuaternion>
-#include <QVector3D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QCameraLensPrivate;
-
-class QT3DCORESHARED_EXPORT QCameraLens : public QComponent
-{
- Q_OBJECT
- Q_PROPERTY(ProjectionType projectionType READ projectionType WRITE setProjectionType NOTIFY projectionTypeChanged)
- Q_PROPERTY(float nearPlane READ nearPlane WRITE setNearPlane NOTIFY nearPlaneChanged)
- Q_PROPERTY(float farPlane READ farPlane WRITE setFarPlane NOTIFY farPlaneChanged)
- Q_PROPERTY(float fieldOfView READ fieldOfView WRITE setFieldOfView NOTIFY fieldOfViewChanged)
- Q_PROPERTY(float aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged)
- Q_PROPERTY(float left READ left WRITE setLeft NOTIFY leftChanged)
- Q_PROPERTY(float right READ right WRITE setRight NOTIFY rightChanged)
- Q_PROPERTY(float bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
- Q_PROPERTY(float top READ top WRITE setTop NOTIFY topChanged)
- Q_PROPERTY(QMatrix4x4 projectionMatrix READ projectionMatrix NOTIFY projectionMatrixChanged)
-
-public:
- explicit QCameraLens(QNode *parent = Q_NULLPTR);
- ~QCameraLens();
-
- enum ProjectionType {
- OrthographicProjection,
- PerspectiveProjection,
- FrustumProjection
- };
- Q_ENUM(ProjectionType)
-
- ProjectionType projectionType() const;
- float nearPlane() const;
- float farPlane() const;
- float fieldOfView() const;
- float aspectRatio() const;
- float left() const;
- float right() const;
- float bottom() const;
- float top() const;
-
- QMatrix4x4 projectionMatrix() const;
-
- void setOrthographicProjection(float left, float right,
- float bottom, float top,
- float nearPlane, float farPlane);
-
- void setFrustumProjection(float left, float right,
- float bottom, float top,
- float nearPlane, float farPlane);
-
- void setPerspectiveProjection(float fieldOfView, float aspect,
- float nearPlane, float farPlane);
-
-public Q_SLOTS:
- void setProjectionType(ProjectionType projectionType);
- void setNearPlane(float nearPlane);
- void setFarPlane(float farPlane);
- void setFieldOfView(float fieldOfView);
- void setAspectRatio(float aspectRatio);
- void setLeft(float left);
- void setRight(float right);
- void setBottom(float bottom);
- void setTop(float top);
-
-Q_SIGNALS:
- void projectionTypeChanged(QCameraLens::ProjectionType projectionType);
- void nearPlaneChanged(float nearPlane);
- void farPlaneChanged(float farPlane);
- void fieldOfViewChanged(float fieldOfView);
- void aspectRatioChanged(float aspectRatio);
- void leftChanged(float left);
- void rightChanged(float right);
- void bottomChanged(float bottom);
- void topChanged(float top);
- void projectionMatrixChanged(const QMatrix4x4 &projectionMatrix);
-
-protected:
- QCameraLens(QCameraLensPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QCameraLens)
- QT3D_CLONEABLE(QCameraLens)
-};
-
-} // Qt3D
-
-QT_END_NAMESPACE
-
-#endif // CAMERALENS_H
diff --git a/src/core/core-components/qcameralens_p.h b/src/core/core-components/qcameralens_p.h
deleted file mode 100644
index 02cc292bb..000000000
--- a/src/core/core-components/qcameralens_p.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_CAMERALENS_P_H
-#define QT3DCORE_CAMERALENS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/private/qcomponent_p.h>
-#include "qcameralens.h"
-
-#include <Qt3DCore/qscenepropertychange.h>
-
-#include <QtGui/qmatrix4x4.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QCameraLensPrivate : public QComponentPrivate
-{
-public:
- QCameraLensPrivate();
-
- inline void updateProjectionMatrix()
- {
- switch (m_projectionType) {
- case QCameraLens::OrthographicProjection:
- updateOrthographicProjection();
- break;
- case QCameraLens::PerspectiveProjection:
- updatePerpectiveProjection();
- break;
- case QCameraLens::FrustumProjection:
- updateFrustumProjection();
- break;
- }
- }
-
- Q_DECLARE_PUBLIC(QCameraLens)
-
- QCameraLens::ProjectionType m_projectionType;
-
- float m_nearPlane;
- float m_farPlane;
-
- float m_fieldOfView;
- float m_aspectRatio;
-
- float m_left;
- float m_right;
- float m_bottom;
- float m_top;
-
- mutable QMatrix4x4 m_projectionMatrix;
-
-private:
- inline void updatePerpectiveProjection()
- {
- Q_Q(QCameraLens);
- m_projectionMatrix.setToIdentity();
- m_projectionMatrix.perspective(m_fieldOfView, m_aspectRatio, m_nearPlane, m_farPlane);
- Q_EMIT q->projectionMatrixChanged(m_projectionMatrix);
- }
-
- inline void updateOrthographicProjection()
- {
- Q_Q(QCameraLens);
- m_projectionMatrix.setToIdentity();
- m_projectionMatrix.ortho(m_left, m_right, m_bottom, m_top, m_nearPlane, m_farPlane);
- Q_EMIT q->projectionMatrixChanged(m_projectionMatrix);
- }
-
- inline void updateFrustumProjection()
- {
- Q_Q(QCameraLens);
- m_projectionMatrix.setToIdentity();
- m_projectionMatrix.frustum(m_left, m_right, m_bottom, m_top, m_nearPlane, m_farPlane);
- Q_EMIT q->projectionMatrixChanged(m_projectionMatrix);
- }
-};
-
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_CAMERALENS_P_H
diff --git a/src/core/core.pri b/src/core/core.pri
index 45bd7a692..becdbb282 100644
--- a/src/core/core.pri
+++ b/src/core/core.pri
@@ -1,39 +1,17 @@
INCLUDEPATH += $$PWD
-# Aspects
-include (./aspects/aspects.pri)
-# Jobs
-include (./jobs/jobs.pri)
-# Nodes
-include (./nodes/nodes.pri)
-# Qml Components
-include (./core-components/core-components.pri)
-#Transformations
-include (./transforms/transforms.pri)
-# Resources Management
-include (./resources/resources.pri)
-# Services
-include (./services/services.pri)
-
HEADERS += \
$$PWD/qt3dcore_global.h \
$$PWD/qtickclock_p.h \
$$PWD/qscheduler_p.h \
$$PWD/corelogging_p.h \
- $$PWD/qscenechange.h \
- $$PWD/qscenepropertychange.h \
- $$PWD/qscenechange_p.h \
- $$PWD/qscenepropertychange_p.h \
$$PWD/qsceneobserverinterface_p.h \
$$PWD/qpostman_p.h \
- $$PWD/qbackendscenepropertychange.h \
- $$PWD/qbackendscenepropertychange_p.h \
$$PWD/qobservableinterface_p.h \
$$PWD/qobserverinterface_p.h \
$$PWD/qlockableobserverinterface_p.h \
$$PWD/qchangearbiter_p.h \
$$PWD/qbackendnodefactory_p.h \
- $$PWD/qray3d.h \
$$PWD/qt3dcore_global_p.h \
$$PWD/qscene_p.h
@@ -45,11 +23,7 @@ SOURCES += \
$$PWD/qobservableinterface.cpp \
$$PWD/qobserverinterface.cpp \
$$PWD/qlockableobserverinterface.cpp \
- $$PWD/qscenechange.cpp \
- $$PWD/qscenepropertychange.cpp \
$$PWD/qsceneobserverinterface.cpp \
$$PWD/qpostman.cpp \
$$PWD/qscene.cpp \
- $$PWD/qbackendscenepropertychange.cpp \
- $$PWD/qbackendnodefactory.cpp \
- $$PWD/qray3d.cpp
+ $$PWD/qbackendnodefactory.cpp
diff --git a/src/core/core.pro b/src/core/core.pro
index a32a6eaf3..74aa56e95 100644
--- a/src/core/core.pro
+++ b/src/core/core.pro
@@ -3,6 +3,9 @@ MODULE = 3dcore
QT = core-private gui-private
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
gcov {
CONFIG += static
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
@@ -13,6 +16,13 @@ gcov {
win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
include(core.pri)
+include(aspects/aspects.pri)
+include(changes/changes.pri)
+include(jobs/jobs.pri)
+include(nodes/nodes.pri)
+include(transforms/transforms.pri)
+include(resources/resources.pri)
+include(services/services.pri)
!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
diff --git a/src/core/corelogging.cpp b/src/core/corelogging.cpp
index a9917d90c..4ad8c5f0e 100644
--- a/src/core/corelogging.cpp
+++ b/src/core/corelogging.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/corelogging_p.h b/src/core/corelogging_p.h
index 7b944bb50..7fc3fff55 100644
--- a/src/core/corelogging_p.h
+++ b/src/core/corelogging_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/jobs/dependencyhandler.cpp b/src/core/jobs/dependencyhandler.cpp
index d39b04ba4..dcea66a62 100644
--- a/src/core/jobs/dependencyhandler.cpp
+++ b/src/core/jobs/dependencyhandler.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/jobs/dependencyhandler_p.h b/src/core/jobs/dependencyhandler_p.h
index 8c0c6734e..abaa8e55f 100644
--- a/src/core/jobs/dependencyhandler_p.h
+++ b/src/core/jobs/dependencyhandler_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/jobs/qabstractaspectjobmanager.cpp b/src/core/jobs/qabstractaspectjobmanager.cpp
index f01f97142..afd49fdf3 100644
--- a/src/core/jobs/qabstractaspectjobmanager.cpp
+++ b/src/core/jobs/qabstractaspectjobmanager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/jobs/qabstractaspectjobmanager_p.h b/src/core/jobs/qabstractaspectjobmanager_p.h
index 6f7b2ce30..32e6e499e 100644
--- a/src/core/jobs/qabstractaspectjobmanager_p.h
+++ b/src/core/jobs/qabstractaspectjobmanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -60,7 +63,7 @@ class QT3DCORESHARED_EXPORT QAbstractAspectJobManager : public QObject
{
Q_OBJECT
public:
- explicit QAbstractAspectJobManager(QObject *p = Q_NULLPTR);
+ explicit QAbstractAspectJobManager(QObject *p = nullptr);
virtual void initialize() {}
virtual void enqueueJobs(const QVector<QAspectJobPtr> &jobQueue) = 0;
diff --git a/src/core/jobs/qaspectjob.cpp b/src/core/jobs/qaspectjob.cpp
index 5cbadc238..539ae78bf 100644
--- a/src/core/jobs/qaspectjob.cpp
+++ b/src/core/jobs/qaspectjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,12 +58,31 @@ QAspectJobPrivate::QAspectJobPrivate()
{
}
+QAspectJobPrivate *QAspectJobPrivate::get(QAspectJob *job)
+{
+ return job->d_func();
+}
+
QAspectJob::QAspectJob()
: d_ptr(new QAspectJobPrivate)
{
}
-/*! \internal */
+/*!
+ * \class Qt3DCore::QAspectJob
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \fn void QAspectJob::run()
+ * Executes job.
+ */
+
+/*!
+ * \internal
+ */
QAspectJob::QAspectJob(QAspectJobPrivate &dd)
: d_ptr(&dd)
{
@@ -71,6 +93,9 @@ QAspectJob::~QAspectJob()
delete d_ptr;
}
+/*!
+ * Adds \a dependency to the aspect job.
+ */
void QAspectJob::addDependency(QWeakPointer<QAspectJob> dependency)
{
Q_D(QAspectJob);
@@ -82,6 +107,9 @@ void QAspectJob::addDependency(QWeakPointer<QAspectJob> dependency)
#endif
}
+/*!
+ * Removes the given \a dependency from aspect job.
+ */
void QAspectJob::removeDependency(QWeakPointer<QAspectJob> dependency)
{
Q_D(QAspectJob);
@@ -95,6 +123,9 @@ void QAspectJob::removeDependency(QWeakPointer<QAspectJob> dependency)
}
}
+/*!
+ * \return the dependencies of the aspect job.
+ */
QVector<QWeakPointer<QAspectJob> > QAspectJob::dependencies() const
{
Q_D(const QAspectJob);
diff --git a/src/core/jobs/qaspectjob.h b/src/core/jobs/qaspectjob.h
index faa77a1d2..b2e5e587c 100644
--- a/src/core/jobs/qaspectjob.h
+++ b/src/core/jobs/qaspectjob.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,9 +64,10 @@ public:
virtual void run() = 0;
protected:
- QAspectJob(QAspectJobPrivate &dd);
+ explicit QAspectJob(QAspectJobPrivate &dd);
private:
+ Q_DISABLE_COPY(QAspectJob)
Q_DECLARE_PRIVATE(QAspectJob)
QAspectJobPrivate *d_ptr;
};
diff --git a/src/core/jobs/qaspectjob_p.h b/src/core/jobs/qaspectjob_p.h
index 312479e99..df788c091 100644
--- a/src/core/jobs/qaspectjob_p.h
+++ b/src/core/jobs/qaspectjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,8 +51,8 @@
// We mean it.
//
-#include <QtGlobal>
#include <QWeakPointer>
+#include <Qt3DCore/private/qt3dcore_global_p.h>
QT_BEGIN_NAMESPACE
@@ -57,12 +60,45 @@ namespace Qt3DCore {
class QAspectJob;
-class QAspectJobPrivate
+#ifdef QT3D_JOBS_RUN_STATS
+struct FrameHeader
+{
+ quint32 frameId;
+ quint32 jobCount;
+};
+
+union JobId
+{
+ quint32 typeAndInstance[2];
+ quint64 id;
+};
+
+struct JobRunStats
+{
+ JobRunStats()
+ {
+ jobId.id = 0;
+ }
+
+ qint64 startTime;
+ qint64 endTime;
+ JobId jobId;
+ // QAspectJob subclasses should properly populate the jobId
+ quint64 threadId;
+};
+#endif
+
+class QT3DCORE_PRIVATE_EXPORT QAspectJobPrivate
{
public:
QAspectJobPrivate();
+ static QAspectJobPrivate *get(QAspectJob *job);
+
QVector<QWeakPointer<QAspectJob> > m_dependencies;
+#ifdef QT3D_JOBS_RUN_STATS
+ JobRunStats m_stats;
+#endif
};
} // Qt3D
diff --git a/src/core/jobs/qaspectjobmanager.cpp b/src/core/jobs/qaspectjobmanager.cpp
index c997e7862..3ee756091 100644
--- a/src/core/jobs/qaspectjobmanager.cpp
+++ b/src/core/jobs/qaspectjobmanager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,13 +68,14 @@ void QAspectJobManager::initialize()
{
}
+// Adds all Aspect Jobs to be processed for a frame
void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
{
// Convert QJobs to Tasks
QHash<QAspectJob *, AspectTaskRunnable *> tasksMap;
QVector<RunnableInterface *> taskList;
taskList.reserve(jobQueue.size());
- Q_FOREACH (const QAspectJobPtr &job, jobQueue) {
+ for (const QAspectJobPtr &job : jobQueue) {
AspectTaskRunnable *task = new AspectTaskRunnable();
task->m_job = job;
tasksMap.insert(job.data(), task);
@@ -82,10 +86,10 @@ void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
// Resolve dependencies
QVector<Dependency> dependencyList;
- Q_FOREACH (const QSharedPointer<QAspectJob> &job, jobQueue) {
+ for (const QSharedPointer<QAspectJob> &job : jobQueue) {
const QVector<QWeakPointer<QAspectJob> > &deps = job->dependencies();
- Q_FOREACH (const QWeakPointer<QAspectJob> &dep, deps) {
+ for (const QWeakPointer<QAspectJob> &dep : deps) {
AspectTaskRunnable *taskDependee = tasksMap.value(dep.data());
if (taskDependee) {
@@ -97,10 +101,13 @@ void QAspectJobManager::enqueueJobs(const QVector<QAspectJobPtr> &jobQueue)
}
}
m_dependencyHandler->addDependencies(qMove(dependencyList));
-
+#ifdef QT3D_JOBS_RUN_STATS
+ QThreadPooler::starNewFrameJobLogsStats();
+#endif
m_threadPooler->mapDependables(taskList);
}
+// Wait for all aspects jobs to be completed
void QAspectJobManager::waitForAllJobs()
{
m_threadPooler->future().waitForFinished();
diff --git a/src/core/jobs/qaspectjobmanager_p.h b/src/core/jobs/qaspectjobmanager_p.h
index 10e4e39c5..5b7f27ad6 100644
--- a/src/core/jobs/qaspectjobmanager_p.h
+++ b/src/core/jobs/qaspectjobmanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/jobs/qaspectjobproviderinterface_p.h b/src/core/jobs/qaspectjobproviderinterface_p.h
index 02350b5d6..1e2166ace 100644
--- a/src/core/jobs/qaspectjobproviderinterface_p.h
+++ b/src/core/jobs/qaspectjobproviderinterface_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/jobs/qthreadpooler.cpp b/src/core/jobs/qthreadpooler.cpp
index 90221aae9..bac7c0dd4 100644
--- a/src/core/jobs/qthreadpooler.cpp
+++ b/src/core/jobs/qthreadpooler.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,33 +42,43 @@
#include <QDebug>
+#ifdef QT3D_JOBS_RUN_STATS
+#include <QFile>
+#include <QThreadStorage>
+#endif
+
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
+#ifdef QT3D_JOBS_RUN_STATS
+QElapsedTimer QThreadPooler::m_jobsStatTimer;
+#endif
+
QThreadPooler::QThreadPooler(QObject *parent)
: QObject(parent),
- m_futureInterface(Q_NULLPTR),
- m_mutex(new QMutex(QMutex::NonRecursive)),
+ m_futureInterface(nullptr),
+ m_mutex(),
m_taskCount(0)
{
// Ensures that threads will never be recycled
m_threadPool.setExpiryTimeout(-1);
+#ifdef QT3D_JOBS_RUN_STATS
+ QThreadPooler::m_jobsStatTimer.start();
+#endif
}
QThreadPooler::~QThreadPooler()
{
// Wait till all tasks are finished before deleting mutex
- QMutexLocker locker(m_mutex);
+ QMutexLocker locker(&m_mutex);
locker.unlock();
-
- delete m_mutex;
}
void QThreadPooler::setDependencyHandler(DependencyHandler *handler)
{
m_dependencyHandler = handler;
- m_dependencyHandler->setMutex(m_mutex);
+ m_dependencyHandler->setMutex(&m_mutex);
}
void QThreadPooler::enqueueTasks(const QVector<RunnableInterface *> &tasks)
@@ -85,7 +98,7 @@ void QThreadPooler::enqueueTasks(const QVector<RunnableInterface *> &tasks)
void QThreadPooler::taskFinished(RunnableInterface *task)
{
- const QMutexLocker locker(m_mutex);
+ const QMutexLocker locker(&m_mutex);
release();
@@ -100,13 +113,13 @@ void QThreadPooler::taskFinished(RunnableInterface *task)
m_futureInterface->reportFinished();
delete m_futureInterface;
}
- m_futureInterface = Q_NULLPTR;
+ m_futureInterface = nullptr;
}
}
QFuture<void> QThreadPooler::mapDependables(QVector<RunnableInterface *> &taskQueue)
{
- const QMutexLocker locker(m_mutex);
+ const QMutexLocker locker(&m_mutex);
if (!m_futureInterface)
m_futureInterface = new QFutureInterface<void>();
@@ -121,7 +134,7 @@ QFuture<void> QThreadPooler::mapDependables(QVector<RunnableInterface *> &taskQu
QFuture<void> QThreadPooler::future()
{
- const QMutexLocker locker(m_mutex);
+ const QMutexLocker locker(&m_mutex);
if (!m_futureInterface)
return QFuture<void>();
@@ -155,6 +168,65 @@ int QThreadPooler::maxThreadCount() const
return m_threadPool.maxThreadCount();
}
+#ifdef QT3D_JOBS_RUN_STATS
+
+QThreadStorage<QVector<JobRunStats> *> jobStatsCached;
+
+QVector<QVector<JobRunStats> *> localStorages;
+QMutex localStoragesMutex;
+
+// Called by the jobs
+void QThreadPooler::addJobLogStatsEntry(JobRunStats &stats)
+{
+ if (!jobStatsCached.hasLocalData()) {
+ auto jobVector = new QVector<JobRunStats>;
+ jobStatsCached.setLocalData(jobVector);
+ QMutexLocker lock(&localStoragesMutex);
+ localStorages.push_back(jobVector);
+ }
+ jobStatsCached.localData()->push_back(stats);
+}
+
+// Called before jobs are executed (AspectThread)
+void QThreadPooler::starNewFrameJobLogsStats()
+{
+ for (QVector<JobRunStats> *storage : qAsConst(localStorages))
+ storage->clear();
+}
+
+// Called after jobs have been executed
+void QThreadPooler::writeFrameJobLogStats()
+{
+ static QScopedPointer<QFile> traceFile;
+ static quint32 frameId = 0;
+ if (!traceFile) {
+ traceFile.reset(new QFile(QStringLiteral("trace.qt3d")));
+ if (!traceFile->open(QFile::WriteOnly|QFile::Truncate))
+ qCritical("Failed to open trace file");
+ }
+
+ FrameHeader header;
+ header.frameId = frameId;
+ header.jobCount = 0;
+
+ for (const QVector<JobRunStats> *storage : qAsConst(localStorages))
+ header.jobCount += storage->size();
+
+ traceFile->write(reinterpret_cast<char *>(&header), sizeof(FrameHeader));
+
+
+
+ for (const QVector<JobRunStats> *storage : qAsConst(localStorages)) {
+ qDebug() << Q_FUNC_INFO << localStorages.size() << storage << storage->size();
+ for (const JobRunStats &stat : *storage) {
+ traceFile->write(reinterpret_cast<const char *>(&stat), sizeof(JobRunStats));
+ }
+ }
+ traceFile->flush();
+ ++frameId;
+}
+#endif
+
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/jobs/qthreadpooler_p.h b/src/core/jobs/qthreadpooler_p.h
index 16a0cc0ff..4b1137318 100644
--- a/src/core/jobs/qthreadpooler_p.h
+++ b/src/core/jobs/qthreadpooler_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,18 +53,22 @@
#include "task_p.h"
#include "dependencyhandler_p.h"
-
+#include "qaspectjob_p.h"
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include <QtCore/QFutureInterface>
#include <QtCore/QFuture>
#include <QThreadPool>
+#ifdef QT3D_JOBS_RUN_STATS
+#include <QElapsedTimer>
+#endif
+
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QThreadPooler : public QObject
+class QT3DCORE_PRIVATE_EXPORT QThreadPooler : public QObject
{
Q_OBJECT
@@ -76,6 +83,13 @@ public:
void setDependencyHandler(DependencyHandler *handler);
int maxThreadCount() const;
+#ifdef QT3D_JOBS_RUN_STATS
+ static QElapsedTimer m_jobsStatTimer;
+
+ static void addJobLogStatsEntry(JobRunStats &stats);
+ static void starNewFrameJobLogsStats();
+ static void writeFrameJobLogStats();
+#endif
private:
void enqueueTasks(const QVector<RunnableInterface *> &tasks);
@@ -85,7 +99,7 @@ private:
private:
QFutureInterface<void> *m_futureInterface;
- QMutex *m_mutex;
+ QMutex m_mutex;
DependencyHandler *m_dependencyHandler;
QAtomicInt m_taskCount;
QThreadPool m_threadPool;
diff --git a/src/core/jobs/task.cpp b/src/core/jobs/task.cpp
index b3ce85379..45da858f4 100644
--- a/src/core/jobs/task.cpp
+++ b/src/core/jobs/task.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,7 +42,7 @@
#include "qthreadpooler_p.h"
#include <QMutexLocker>
-
+#include <QElapsedTimer>
#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -64,8 +67,23 @@ AspectTaskRunnable::~AspectTaskRunnable()
void AspectTaskRunnable::run()
{
- if (m_job)
+ if (m_job) {
+#ifdef QT3D_JOBS_RUN_STATS
+ QAspectJobPrivate *jobD = QAspectJobPrivate::get(m_job.data());
+ if (m_pooler) {
+ jobD->m_stats.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
+ jobD->m_stats.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
+ }
+#endif
m_job->run();
+#ifdef QT3D_JOBS_RUN_STATS
+ if (m_pooler) {
+ jobD->m_stats.endTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
+ // Add current job's stats to log output
+ QThreadPooler::addJobLogStatsEntry(jobD->m_stats);
+ }
+#endif
+ }
// We could have an append sub task or something in here
// So that a job can post sub jobs ?
@@ -91,7 +109,7 @@ SyncTaskRunnable::SyncTaskRunnable(QAbstractAspectJobManager::JobFunction func,
: m_func(func),
m_arg(arg),
m_atomicCount(atomicCount),
- m_pooler(Q_NULLPTR),
+ m_pooler(nullptr),
m_reserved(false)
{
}
@@ -123,7 +141,7 @@ void SyncTaskRunnable::setDependencyHandler(DependencyHandler *handler)
DependencyHandler *SyncTaskRunnable::dependencyHandler()
{
- return Q_NULLPTR;
+ return nullptr;
}
} // namespace Qt3DCore {
diff --git a/src/core/jobs/task_p.h b/src/core/jobs/task_p.h
index bdbfdebd2..593d7d7ad 100644
--- a/src/core/jobs/task_p.h
+++ b/src/core/jobs/task_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/nodes/nodes.pri b/src/core/nodes/nodes.pri
index 64823813e..785ae2b21 100644
--- a/src/core/nodes/nodes.pri
+++ b/src/core/nodes/nodes.pri
@@ -11,8 +11,10 @@ HEADERS += \
$$PWD/qbackendnode.h \
$$PWD/qnodeid.h \
$$PWD/qnodevisitor_p.h \
- $$PWD/qabstractnodefactory.h \
- $$PWD/propertychangehandler_p.h
+ $$PWD/propertychangehandler_p.h \
+ $$PWD/qdestructionidandtypecollector_p.h \
+ $$PWD/qnodecreatedchangegenerator_p.h \
+ $$PWD/qabstractnodefactory_p.h
SOURCES += \
$$PWD/qnode.cpp \
@@ -21,5 +23,7 @@ SOURCES += \
$$PWD/qbackendnode.cpp \
$$PWD/qnodeid.cpp \
$$PWD/qnodevisitor.cpp \
- $$PWD/qabstractnodefactory.cpp
-
+ $$PWD/qabstractnodefactory.cpp \
+ $$PWD/propertychangehandler.cpp \
+ $$PWD/qdestructionidandtypecollector.cpp \
+ $$PWD/qnodecreatedchangegenerator.cpp
diff --git a/src/core/nodes/propertychangehandler.cpp b/src/core/nodes/propertychangehandler.cpp
new file mode 100644
index 000000000..8c66fdd6f
--- /dev/null
+++ b/src/core/nodes/propertychangehandler.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtWebChannel module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "propertychangehandler_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+PropertyChangeHandlerBase::PropertyChangeHandlerBase(QObject *parent) :
+ QObject(parent)
+{
+}
+
+void PropertyChangeHandlerBase::connectToPropertyChange(const QObject *object, int propertyIndex)
+{
+ const QMetaObject *metaObject = object->metaObject();
+ const QMetaProperty property = metaObject->property(propertyIndex);
+ if (!property.hasNotifySignal())
+ return;
+
+ static const int memberOffset = staticMetaObject.methodCount();
+ QMetaObject::Connection connection = QMetaObject::connect(object, property.notifySignalIndex(),
+ this, memberOffset + propertyIndex,
+ Qt::DirectConnection, 0);
+ Q_ASSERT(connection);
+ Q_UNUSED(connection);
+}
+
+void PropertyChangeHandlerBase::disconnectFromPropertyChange(const QObject *object, int propertyIndex)
+{
+ const QMetaObject *metaObject = object->metaObject();
+ const QMetaProperty property = metaObject->property(propertyIndex);
+ if (!property.hasNotifySignal())
+ return;
+
+ static const int memberOffset = staticMetaObject.methodCount();
+ QMetaObject::disconnect(object, property.notifySignalIndex(), this, memberOffset + propertyIndex);
+}
+
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/core/nodes/propertychangehandler_p.h b/src/core/nodes/propertychangehandler_p.h
index 543fa62fe..e91df5016 100644
--- a/src/core/nodes/propertychangehandler_p.h
+++ b/src/core/nodes/propertychangehandler_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebChannel module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,6 +51,8 @@
// We mean it.
//
+#include <Qt3DCore/qt3dcore_global.h>
+
#include <QObject>
#include <QHash>
#include <QVector>
@@ -58,17 +63,11 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-/**
- * The property change handler is similar to QSignalSpy, but geared towards the usecase of Qt3D.
- *
- * It allows connecting to any number of property change signals of the receiver object and forwards
- * the signal invocations to the Receiver by calling its propertyChanged function.
- */
-template<class Receiver>
-class PropertyChangeHandler : public QObject
+class QT3DCORESHARED_EXPORT PropertyChangeHandlerBase : public QObject
{
+ Q_OBJECT
public:
- PropertyChangeHandler(Receiver *receiver, QObject *parent = Q_NULLPTR);
+ PropertyChangeHandlerBase(QObject *parent = nullptr);
/**
* Connect to the change signal of @p property in @p object.
@@ -79,6 +78,19 @@ public:
* Disconnect from the change signal of @p property in @p object.
*/
void disconnectFromPropertyChange(const QObject *object, int propertyIndex);
+};
+
+/**
+ * The property change handler is similar to QSignalSpy, but geared towards the usecase of Qt3D.
+ *
+ * It allows connecting to any number of property change signals of the receiver object and forwards
+ * the signal invocations to the Receiver by calling its propertyChanged function.
+ */
+template<class Receiver>
+class PropertyChangeHandler : public PropertyChangeHandlerBase
+{
+public:
+ PropertyChangeHandler(Receiver *receiver, QObject *parent = nullptr);
/**
* @internal
@@ -94,40 +106,12 @@ private:
template<class Receiver>
PropertyChangeHandler<Receiver>::PropertyChangeHandler(Receiver *receiver, QObject *parent)
- : QObject(parent)
+ : PropertyChangeHandlerBase(parent)
, m_receiver(receiver)
{
}
template<class Receiver>
-void PropertyChangeHandler<Receiver>::connectToPropertyChange(const QObject *object, int propertyIndex)
-{
- const QMetaObject *metaObject = object->metaObject();
- const QMetaProperty property = metaObject->property(propertyIndex);
- if (!property.hasNotifySignal())
- return;
-
- static const int memberOffset = QObject::staticMetaObject.methodCount();
- QMetaObject::Connection connection = QMetaObject::connect(object, property.notifySignalIndex(),
- this, memberOffset + propertyIndex,
- Qt::DirectConnection, 0);
- Q_ASSERT(connection);
- Q_UNUSED(connection);
-}
-
-template<class Receiver>
-void PropertyChangeHandler<Receiver>::disconnectFromPropertyChange(const QObject *object, int propertyIndex)
-{
- const QMetaObject *metaObject = object->metaObject();
- const QMetaProperty property = metaObject->property(propertyIndex);
- if (!property.hasNotifySignal())
- return;
-
- static const int memberOffset = QObject::staticMetaObject.methodCount();
- QMetaObject::disconnect(object, property.notifySignalIndex(), this, memberOffset + propertyIndex);
-}
-
-template<class Receiver>
int PropertyChangeHandler<Receiver>::qt_metacall(QMetaObject::Call call, int methodId, void **args)
{
methodId = QObject::qt_metacall(call, methodId, args);
diff --git a/src/core/nodes/qabstractnodefactory.cpp b/src/core/nodes/qabstractnodefactory.cpp
index d64efca5a..2bd39f333 100644
--- a/src/core/nodes/qabstractnodefactory.cpp
+++ b/src/core/nodes/qabstractnodefactory.cpp
@@ -1,57 +1,78 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qabstractnodefactory.h"
+#include "qabstractnodefactory_p.h"
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
+/*!
+ * \class Qt3DCore::QAbstractNodeFactory
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \fn QNode *QAbstractNodeFactory::createNode(const char *type)
+ * Creates a node of \a type.
+ */
+
QAbstractNodeFactory::~QAbstractNodeFactory()
{
}
-QList<QAbstractNodeFactory *> node_factories;
+QVector<QAbstractNodeFactory *> node_factories;
+/*!
+ * Registers the given \a factory
+ */
void QAbstractNodeFactory::registerNodeFactory(QAbstractNodeFactory *factory)
{
node_factories << factory;
}
-QList<QAbstractNodeFactory *> QAbstractNodeFactory::nodeFactories()
+/*!
+ * \return the node factories.
+ */
+QVector<QAbstractNodeFactory *> QAbstractNodeFactory::nodeFactories()
{
return node_factories;
}
diff --git a/src/core/nodes/qabstractnodefactory.h b/src/core/nodes/qabstractnodefactory.h
deleted file mode 100644
index cc8d92254..000000000
--- a/src/core/nodes/qabstractnodefactory.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTNODEFACTORY_H
-#define QABSTRACTNODEFACTORY_H
-
-#include <Qt3DCore/qt3dcore_global.h>
-#include <Qt3DCore/qnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QT3DCORESHARED_EXPORT QAbstractNodeFactory
-{
-public:
- virtual ~QAbstractNodeFactory();
-
- virtual QNode *createNode(const char *type) = 0;
-
- static void registerNodeFactory(QAbstractNodeFactory *factory);
- static QList<QAbstractNodeFactory *> nodeFactories();
-
- template<class T> static T *createNode(const char *type)
- {
- Q_FOREACH (QAbstractNodeFactory *f, QAbstractNodeFactory::nodeFactories()) {
- QNode *n = f->createNode(type);
- if (n)
- return qobject_cast<T *>(n);
- }
- return new T;
- }
-};
-
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
-
-#endif // QABSTRACTNODEFACTORY_H
diff --git a/src/core/nodes/qabstractnodefactory_p.h b/src/core/nodes/qabstractnodefactory_p.h
new file mode 100644
index 000000000..bb7533e94
--- /dev/null
+++ b/src/core/nodes/qabstractnodefactory_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QABSTRACTNODEFACTORY_P_H
+#define QABSTRACTNODEFACTORY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QT3DCORE_PRIVATE_EXPORT QAbstractNodeFactory
+{
+public:
+ virtual ~QAbstractNodeFactory();
+
+ virtual QNode *createNode(const char *type) = 0;
+
+ static void registerNodeFactory(QAbstractNodeFactory *factory);
+ static QVector<QAbstractNodeFactory *> nodeFactories();
+
+ template<class T> static T *createNode(const char *type)
+ {
+ const auto factories = QAbstractNodeFactory::nodeFactories();
+ for (QAbstractNodeFactory *f : factories) {
+ QNode *n = f->createNode(type);
+ if (n)
+ return qobject_cast<T *>(n);
+ }
+ return new T;
+ }
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QABSTRACTNODEFACTORY_P_H
diff --git a/src/core/nodes/qbackendnode.cpp b/src/core/nodes/qbackendnode.cpp
index a5c675100..8435bc961 100644
--- a/src/core/nodes/qbackendnode.cpp
+++ b/src/core/nodes/qbackendnode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,19 +39,25 @@
#include "qbackendnode.h"
#include "qbackendnode_p.h"
-#include "qbackendnodefactory_p.h"
#include "qaspectengine.h"
#include "qnode.h"
+#include "qpropertyupdatedchange.h"
+#include <Qt3DCore/private/corelogging_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
+/*! \internal */
+QBackendNodeMapper::~QBackendNodeMapper()
+{
+}
+
QBackendNodePrivate::QBackendNodePrivate(QBackendNode::Mode mode)
- : q_ptr(Q_NULLPTR)
+ : q_ptr(nullptr)
, m_mode(mode)
- , m_factory(Q_NULLPTR)
- , m_arbiter(Q_NULLPTR)
+ , m_arbiter(nullptr)
+ , m_enabled(false)
{
}
@@ -64,7 +73,7 @@ void QBackendNodePrivate::setArbiter(QLockableObserverInterface *arbiter)
void QBackendNodePrivate::notifyObservers(const QSceneChangePtr &e)
{
Q_ASSERT(m_mode == QBackendNode::ReadWrite);
- if (m_arbiter != Q_NULLPTR)
+ if (m_arbiter != nullptr)
m_arbiter->sceneChangeEvent(e);
}
@@ -73,11 +82,77 @@ void QBackendNodePrivate::sceneChangeEvent(const QSceneChangePtr &e)
q_func()->sceneChangeEvent(e);
}
+void QBackendNodePrivate::setEnabled(bool enabled)
+{
+ m_enabled = enabled;
+}
+
QBackendNodePrivate *QBackendNodePrivate::get(QBackendNode *n)
{
return n->d_func();
}
+/*!
+ * \class Qt3DCore::QBackendNodeMapper
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \fn QBackendNode *QBackendNodeMapper::create(QNode *frontend) const
+ *
+ * TODO
+ *
+ * \a frontend
+ *
+ * \return created node.
+ */
+
+/*!
+ * \fn QBackendNode *QBackendNodeMapper::create(const QNodeCreatedChangeBasePtr &change) const
+ *
+ * TODO
+ *
+ * \a change
+ *
+ * \return created node.
+ */
+
+/*!
+ * \fn QBackendNode *QBackendNodeMapper::get(QNodeId id) const
+ *
+ * \return backend node for the given node \a id.
+ */
+
+/*!
+ * \fn void QBackendNodeMapper::destroy(QNodeId id) const
+ *
+ * Destroys the backend node for the given node \a id.
+ */
+
+/*!
+ * \class Qt3DCore::QBackendNode
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \fn void Qt3DCore::QBackendNode::updateFromPeer(QNode *peer)
+ *
+ * Updates the backend node from \a peer.
+ */
+
+/*!
+ * \enum Qt3DCore::QBackendNode::Mode
+ *
+ * The mode for the backend node.
+ *
+ * \value ReadOnly
+ * \value ReadWrite
+ */
+
QBackendNode::QBackendNode(QBackendNode::Mode mode)
: d_ptr(new QBackendNodePrivate(mode))
{
@@ -89,54 +164,95 @@ QBackendNode::~QBackendNode()
delete d_ptr;
}
-void QBackendNode::setFactory(const QBackendNodeFactory *factory)
-{
- Q_D(QBackendNode);
- d->m_factory = factory;
-}
-
-void QBackendNode::setPeer(QNode *peer)
+/*!
+ * Sets the peer \a id.
+ */
+void QBackendNode::setPeerId(QNodeId id) Q_DECL_NOEXCEPT
{
Q_D(QBackendNode);
- QNodeId peerUuid;
- if (peer != Q_NULLPTR)
- peerUuid = peer->id();
- d->m_peerUuid = peerUuid;
- updateFromPeer(peer);
+ d->m_peerId = id;
}
-QNodeId QBackendNode::peerUuid() const
+/*!
+ * \return the peer id of the backend node.
+ */
+QNodeId QBackendNode::peerId() const Q_DECL_NOEXCEPT
{
Q_D(const QBackendNode);
- return d->m_peerUuid;
+ return d->m_peerId;
}
-QBackendNode::Mode QBackendNode::mode() const
+/*!
+ * \return \c true if the backend node is enabled.
+ */
+bool QBackendNode::isEnabled() const Q_DECL_NOEXCEPT
{
Q_D(const QBackendNode);
- return d->m_mode;
+ return d->m_enabled;
}
-QBackendNode *QBackendNode::createBackendNode(QNode *frontend) const
+/*!
+ * \return the mode of the backend mode.
+ */
+QBackendNode::Mode QBackendNode::mode() const Q_DECL_NOEXCEPT
{
Q_D(const QBackendNode);
- Q_ASSERT(d->m_factory);
- return d->m_factory->createBackendNode(frontend);
+ return d->m_mode;
}
-/*! \internal */
+/*!
+ * \internal
+ */
QBackendNode::QBackendNode(QBackendNodePrivate &dd)
: d_ptr(&dd)
{
d_ptr->q_ptr = this;
}
+/*!
+ * Notifies observers of scene change \a e.
+ */
void QBackendNode::notifyObservers(const QSceneChangePtr &e)
{
Q_D(QBackendNode);
d->notifyObservers(e);
}
+void QBackendNode::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
+{
+ Q_UNUSED(change);
+ qCDebug(Nodes) << Q_FUNC_INFO << change->metaObject()->className() << "does not override";
+}
+
+/*!
+ * Enables or disables the backend node by \a enabled.
+ */
+void QBackendNode::setEnabled(bool enabled) Q_DECL_NOEXCEPT
+{
+ Q_D(QBackendNode);
+ d->m_enabled = enabled;
+}
+
+/*!
+ * TODO
+ * \a e
+ */
+void QBackendNode::sceneChangeEvent(const QSceneChangePtr &e)
+{
+ Q_D(QBackendNode);
+ auto propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+
+ switch (e->type()) {
+ case PropertyUpdated: {
+ if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
+ d->m_enabled = propertyChange->value().value<bool>();
+ break;
+ }
+ default:
+ break;
+ }
+}
+
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/core/nodes/qbackendnode.h b/src/core/nodes/qbackendnode.h
index 8b9d7f609..39114034d 100644
--- a/src/core/nodes/qbackendnode.h
+++ b/src/core/nodes/qbackendnode.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,27 +42,31 @@
#include <Qt3DCore/qt3dcore_global.h>
#include <Qt3DCore/qscenechange.h>
+#include <Qt3DCore/qnodecreatedchange.h>
#include <Qt3DCore/qnodeid.h>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QBackendNodeFactory;
class QBackendNodePrivate;
class QBackendNode;
class QAspectEngine;
-class QT3DCORESHARED_EXPORT QBackendNodeFunctor
+#if defined(QT_BUILD_INTERNAL)
+class QBackendNodeTester;
+#endif
+
+class QT3DCORESHARED_EXPORT QBackendNodeMapper
{
public:
- virtual ~QBackendNodeFunctor() {}
- virtual QBackendNode *create(QNode *frontend, const QBackendNodeFactory *factory) const = 0;
- virtual QBackendNode *get(const QNodeId &id) const = 0;
- virtual void destroy(const QNodeId &id) const = 0;
+ virtual ~QBackendNodeMapper();
+ virtual QBackendNode *create(const QNodeCreatedChangeBasePtr &change) const = 0;
+ virtual QBackendNode *get(QNodeId id) const = 0;
+ virtual void destroy(QNodeId id) const = 0;
};
-typedef QSharedPointer<QBackendNodeFunctor> QBackendNodeFunctorPtr;
+typedef QSharedPointer<QBackendNodeMapper> QBackendNodeMapperPtr;
class QT3DCORESHARED_EXPORT QBackendNode
{
@@ -72,30 +79,34 @@ public:
explicit QBackendNode(Mode mode = ReadOnly);
virtual ~QBackendNode();
- void setFactory(const QBackendNodeFactory *factory);
+ QNodeId peerId() const Q_DECL_NOEXCEPT;
- void setPeer(QNode *peer);
- QNodeId peerUuid() const;
+ void setEnabled(bool enabled) Q_DECL_NOEXCEPT;
+ bool isEnabled() const Q_DECL_NOEXCEPT;
- Mode mode() const;
- virtual void updateFromPeer(QNode *peer) = 0;
+ Mode mode() const Q_DECL_NOEXCEPT;
protected:
- QBackendNode *createBackendNode(QNode *frontend) const;
+ Q_DECLARE_PRIVATE(QBackendNode)
+ explicit QBackendNode(QBackendNodePrivate &dd);
void notifyObservers(const QSceneChangePtr &e);
- virtual void sceneChangeEvent(const QSceneChangePtr &e) = 0;
-
- QBackendNode(QBackendNodePrivate &dd);
+ virtual void sceneChangeEvent(const QSceneChangePtr &e);
- Q_DECLARE_PRIVATE(QBackendNode)
QBackendNodePrivate *d_ptr;
private:
- friend class QBackendScenePropertyChange;
+ Q_DISABLE_COPY(QBackendNode)
+ void setPeerId(QNodeId id) Q_DECL_NOEXCEPT;
+ virtual void initializeFromPeer(const QNodeCreatedChangeBasePtr &change);
+
+ friend class QBackendNodePropertyChange;
+ friend class QAbstractAspectPrivate;
+#if defined(QT_BUILD_INTERNAL)
+ friend class QBackendNodeTester;
+#endif
};
-
-} // Qt3D
+} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/nodes/qbackendnode_p.h b/src/core/nodes/qbackendnode_p.h
index 7b1e4b597..6cddfad11 100644
--- a/src/core/nodes/qbackendnode_p.h
+++ b/src/core/nodes/qbackendnode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -60,8 +63,6 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QBackendNodeFactory;
-
class QT3DCORE_PRIVATE_EXPORT QBackendNodePrivate
: public QObserverInterface
, public QObservableInterface
@@ -69,10 +70,10 @@ class QT3DCORE_PRIVATE_EXPORT QBackendNodePrivate
public:
QBackendNodePrivate(QBackendNode::Mode mode);
- void setFactory(const QBackendNodeFactory *factory);
void setArbiter(QLockableObserverInterface *arbiter) Q_DECL_OVERRIDE;
void notifyObservers(const QSceneChangePtr &e) Q_DECL_OVERRIDE;
void sceneChangeEvent(const QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ void setEnabled(bool enabled);
static QBackendNodePrivate *get(QBackendNode *n);
@@ -80,9 +81,12 @@ public:
QBackendNode *q_ptr;
QBackendNode::Mode m_mode;
- const QBackendNodeFactory *m_factory;
QLockableObserverInterface *m_arbiter;
- QNodeId m_peerUuid;
+ QNodeId m_peerId;
+ bool m_enabled;
+
+private:
+ Q_DISABLE_COPY(QBackendNodePrivate)
};
} // Qt3D
diff --git a/src/core/nodes/qcomponent.cpp b/src/core/nodes/qcomponent.cpp
index 3b015c23d..32bab14d0 100644
--- a/src/core/nodes/qcomponent.cpp
+++ b/src/core/nodes/qcomponent.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,7 +42,7 @@
#include "qentity.h"
#include "qentity_p.h"
#include "qscene_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -51,38 +54,28 @@ QComponentPrivate::QComponentPrivate()
{
}
+QComponentPrivate::~QComponentPrivate()
+{
+}
+
void QComponentPrivate::addEntity(QEntity *entity)
{
m_entities.append(entity);
- if (m_scene != Q_NULLPTR && !m_scene->hasEntityForComponent(m_id, entity->id())) {
+ if (m_scene != nullptr && !m_scene->hasEntityForComponent(m_id, entity->id())) {
if (!m_shareable && !m_scene->entitiesForComponent(m_id).isEmpty())
qWarning() << "Trying to assign a non shareable component to more than one Entity";
m_scene->addEntityForComponent(m_id, entity->id());
}
- // We notify only if we have a QChangeArbiter
- if (m_changeArbiter != Q_NULLPTR) {
- Q_Q(QComponent);
- QScenePropertyChangePtr e(new QScenePropertyChange(ComponentAdded, QSceneChange::Node, q->id()));
- e->setPropertyName("entity");
- e->setValue(QVariant::fromValue(entity->id()));
- notifyObservers(e);
- }
+ // TODO: Add QAddedToEntityChange to be delivered to components on the backend
}
void QComponentPrivate::removeEntity(QEntity *entity)
{
- // We notify only if we have a QChangeArbiter
- if (m_changeArbiter != Q_NULLPTR) {
- Q_Q(QComponent);
- QScenePropertyChangePtr e(new QScenePropertyChange(ComponentRemoved, QSceneChange::Node, q->id()));
- e->setPropertyName("entity");
- e->setValue(QVariant::fromValue(entity->id()));
- notifyObservers(e);
- }
+ // TODO: Add QRemovedFromEntityChange to be delivered to components on the backend
- if (m_scene != Q_NULLPTR)
+ if (m_scene != nullptr)
m_scene->removeEntityForComponent(m_id, entity->id());
m_entities.removeAll(entity);
@@ -114,15 +107,13 @@ void QComponentPrivate::removeEntity(QEntity *entity)
instance one of the subclasses instead.
*/
QComponent::QComponent(QNode *parent)
- : QNode(*new QComponentPrivate, parent)
-{
-}
+ : QComponent(*new QComponentPrivate, parent) {}
QComponent::~QComponent()
{
- Q_ASSERT_X(QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DCore::QComponent subclass didn't call QNode::cleanup in its destructor");
+ Q_D(QComponent);
- Q_FOREACH (QEntity *entity, entities()) {
+ for (QEntity *entity : qAsConst(d->m_entities)) {
QEntityPrivate *entityPimpl = static_cast<QEntityPrivate *>(QEntityPrivate::get(entity));
if (entityPimpl)
entityPimpl->m_components.removeAll(this);
@@ -130,17 +121,16 @@ QComponent::~QComponent()
}
/*!
- Returns whether the QComponent is shareable across entities or not.
+ \property Qt3DCore::QComponent::isShareable
+ Holds the shareable flag of the QComponent. The QComponent can be shared across several
+ entities if \c{true}.
*/
-bool QComponent::shareable() const
+bool QComponent::isShareable() const
{
Q_D(const QComponent);
return d->m_shareable;
}
-/*!
- The QComponent can be shared across several entities if \a shareable is true.
-*/
void QComponent::setShareable(bool shareable)
{
Q_D(QComponent);
@@ -150,13 +140,6 @@ void QComponent::setShareable(bool shareable)
}
}
-void QComponent::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QComponent *comp = static_cast<const QComponent *>(ref);
- setShareable(comp->shareable());
-}
-
/*!
Returns a QVector containing all the entities that reference this component.
*/
@@ -186,7 +169,7 @@ QComponent::QComponent(QComponentPrivate &dd, QNode *parent)
*/
/*!
- \qmlproperty bool Qt3DCore::Component3D::shareable
+ \qmlproperty bool Component3D::isShareable
*/
QT_END_NAMESPACE
diff --git a/src/core/nodes/qcomponent.h b/src/core/nodes/qcomponent.h
index cb91270d0..8c1adcfc3 100644
--- a/src/core/nodes/qcomponent.h
+++ b/src/core/nodes/qcomponent.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,26 +52,24 @@ class QComponentPrivate;
class QT3DCORESHARED_EXPORT QComponent : public QNode
{
Q_OBJECT
- Q_PROPERTY(bool shareable READ shareable WRITE setShareable NOTIFY shareableChanged)
+ Q_PROPERTY(bool isShareable READ isShareable WRITE setShareable NOTIFY shareableChanged)
public:
- explicit QComponent(QNode *parent = Q_NULLPTR);
+ explicit QComponent(QNode *parent = nullptr);
~QComponent();
- bool shareable() const;
+ bool isShareable() const;
QVector<QEntity *> entities() const;
public Q_SLOTS:
- void setShareable(bool shareable);
+ void setShareable(bool isShareable);
Q_SIGNALS:
- void shareableChanged(bool shareable);
- void enabledChanged(bool enabled);
+ void shareableChanged(bool isShareable);
protected:
- QComponent(QComponentPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
+ explicit QComponent(QComponentPrivate &dd, QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QComponent)
diff --git a/src/core/nodes/qcomponent_p.h b/src/core/nodes/qcomponent_p.h
index ead923c75..74cef1629 100644
--- a/src/core/nodes/qcomponent_p.h
+++ b/src/core/nodes/qcomponent_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -59,6 +62,7 @@ class QT3DCORE_PRIVATE_EXPORT QComponentPrivate : public QNodePrivate
{
public:
QComponentPrivate();
+ ~QComponentPrivate();
void addEntity(QEntity *entity);
void removeEntity(QEntity *entity);
diff --git a/src/core/nodes/qdestructionidandtypecollector.cpp b/src/core/nodes/qdestructionidandtypecollector.cpp
new file mode 100644
index 000000000..2c611a490
--- /dev/null
+++ b/src/core/nodes/qdestructionidandtypecollector.cpp
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdestructionidandtypecollector_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QDestructionIdAndTypeCollector::QDestructionIdAndTypeCollector(QNode *rootNode)
+{
+ QNodeVisitor visitor;
+ visitor.traverse(rootNode, this, &QDestructionIdAndTypeCollector::collectIdAndType);
+}
+
+QT_END_NAMESPACE
+
+} // namespace Qt3DCore
diff --git a/src/core/nodes/qdestructionidandtypecollector_p.h b/src/core/nodes/qdestructionidandtypecollector_p.h
new file mode 100644
index 000000000..3e5fd9138
--- /dev/null
+++ b/src/core/nodes/qdestructionidandtypecollector_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QIDTYPEVISITOR_H
+#define QT3DCORE_QIDTYPEVISITOR_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnodevisitor_p.h>
+#include <Qt3DCore/private/qentity_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QDestructionIdAndTypeCollector
+{
+public:
+ QDestructionIdAndTypeCollector(QNode *rootNode);
+
+ QVector<QNodeIdTypePair> subtreeIdsAndTypes() const { return m_subtreeIdsAndTypes; }
+
+private:
+ void collectIdAndType(QNode *node)
+ {
+ QNodeIdTypePair idAndType(node->id(), QNodePrivate::get(node)->m_typeInfo);
+ m_subtreeIdsAndTypes.push_back(idAndType);
+
+ // Mark this node as having been handled for destruction so we don't
+ // repeat it unnecessarily in an O(n^2) manner
+ QNodePrivate::get(node)->m_hasBackendNode = false;
+ }
+
+ QVector<QNodeIdTypePair> m_subtreeIdsAndTypes;
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QIDTYPEVISITOR_H
diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp
index 6af880190..86cb050a6 100644
--- a/src/core/nodes/qentity.cpp
+++ b/src/core/nodes/qentity.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,7 +43,10 @@
#include "qcomponent_p.h"
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qcomponentaddedchange.h>
+#include <Qt3DCore/qcomponentremovedchange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qnodecreatedchange.h>
#include <Qt3DCore/private/corelogging_p.h>
#include <QMetaObject>
#include <QMetaProperty>
@@ -54,6 +60,10 @@ QEntityPrivate::QEntityPrivate()
, m_parentEntityId()
{}
+QEntityPrivate::~QEntityPrivate()
+{
+}
+
/*!
\class Qt3DCore::QEntity
\inmodule Qt3DCore
@@ -68,7 +78,7 @@ QEntityPrivate::QEntityPrivate()
backend aspect will be able to interpret and process an Entity by
recognizing which components it is made up of. One aspect may decide to only
process entities composed of a single Qt3DCore::QTransform component whilst
- another may focus on Qt3DCore::QMouseInput.
+ another may focus on Qt3DCore::QMouseHandler.
\sa Qt3DCore::QComponent, Qt3DCore::QTransform
*/
@@ -77,20 +87,7 @@ QEntityPrivate::QEntityPrivate()
Constructs a new Qt3DCore::QEntity instance with \a parent as parent.
*/
QEntity::QEntity(QNode *parent)
- : QNode(*new QEntityPrivate, parent)
-{
-}
-
-QEntity::~QEntity()
-{
- // remove all component aggregations
- removeAllComponents();
-
- QNode::cleanup();
- // If all children are removed
- // That includes the components that are parented by this entity
-
-}
+ : QEntity(*new QEntityPrivate, parent) {}
/*! \internal */
QEntity::QEntity(QEntityPrivate &dd, QNode *parent)
@@ -98,24 +95,21 @@ QEntity::QEntity(QEntityPrivate &dd, QNode *parent)
{
}
-/*!
- Copies all the properties and components of the Qt3DCore::QEntity \a ref to the
- current instance.
-*/
-void QEntity::copy(const QNode *ref)
+QEntity::~QEntity()
{
- QNode::copy(ref);
- const QEntity *entity = static_cast<const QEntity*>(ref);
- d_func()->m_visible = entity->d_func()->m_visible;
- d_func()->m_parentEntityId = entity->d_func()->parentEntityId();
-
- Q_FOREACH (QComponent *c, entity->d_func()->m_components) {
- QNode *ccclone = QNode::clone(c);
- addComponent(qobject_cast<QComponent *>(ccclone));
- }
+ // remove all component aggregations
+ Q_D(const QEntity);
+ // to avoid hammering m_components by repeated removeComponent()
+ // calls below, move all contents out, so the removeOne() calls in
+ // removeComponent() don't actually remove something:
+ const auto components = std::move(d->m_components);
+ for (QComponent *comp : components)
+ removeComponent(comp);
}
+
+
/*!
- \typedef Qt3DCore::QComponentList
+ \typedef Qt3DCore::QComponentVector
\relates Qt3DCore::QEntity
List of QComponent pointers.
@@ -124,7 +118,7 @@ void QEntity::copy(const QNode *ref)
/*!
Returns the list of Qt3DCore::QComponent instances the entity is referencing.
*/
-QList<QComponent *> QEntity::components() const
+QComponentVector QEntity::components() const
{
Q_D(const QEntity);
return d->m_components;
@@ -152,14 +146,9 @@ void QEntity::addComponent(QComponent *comp)
if (!comp->parent())
comp->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- // Sending a full fledged component in the notification as we'll need
- // to know which type of component it was and its properties to create
- // the backend object
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(ComponentAdded, QSceneChange::Node, id()));
- propertyChange->setPropertyName("component");
- propertyChange->setValue(QVariant::fromValue(QNodePtr(QNode::clone(comp), &QNodePrivate::nodePtrDeleter)));
- d->notifyObservers(propertyChange);
+ if (d->m_changeArbiter) {
+ const auto componentAddedChange = QComponentAddedChangePtr::create(this, comp);
+ d->notifyObservers(componentAddedChange);
}
static_cast<QComponentPrivate *>(QComponentPrivate::get(comp))->addEntity(this);
}
@@ -175,30 +164,15 @@ void QEntity::removeComponent(QComponent *comp)
static_cast<QComponentPrivate *>(QComponentPrivate::get(comp))->removeEntity(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- // Sending just the component id as it is the only part needed to
- // cleanup the backend object. This way we avoid a clone which might
- // fail in the case of large scenes.
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(ComponentRemoved, QSceneChange::Node, id()));
- propertyChange->setValue(QVariant::fromValue(comp->id()));
- propertyChange->setPropertyName("componentId");
- d->notifyObservers(propertyChange);
+ if (d->m_changeArbiter) {
+ const auto componentRemovedChange = QComponentRemovedChangePtr::create(this, comp);
+ d->notifyObservers(componentRemovedChange);
}
d->m_components.removeOne(comp);
}
/*!
- Remove all references to the components.
-*/
-void QEntity::removeAllComponents()
-{
- Q_D(const QEntity);
- Q_FOREACH (QComponent *comp, d->m_components)
- removeComponent(comp);
-}
-
-/*!
Returns the parent Qt3DCore::QEntity instance of this entity. If the
immediate parent isn't a Qt3DCore::QEntity, this function traverses up the
scene hierarchy until a parent Qt3DCore::QEntity is found. If no
@@ -210,7 +184,7 @@ QEntity *QEntity::parentEntity() const
QNode *parentNode = QNode::parentNode();
QEntity *parentEntity = qobject_cast<QEntity *>(parentNode);
- while (parentEntity == Q_NULLPTR && parentNode != Q_NULLPTR) {
+ while (parentEntity == nullptr && parentNode != nullptr) {
parentNode = parentNode->parentNode();
parentEntity = qobject_cast<QEntity*>(parentNode);
}
@@ -238,6 +212,23 @@ QNodeId QEntityPrivate::parentEntityId() const
return m_parentEntityId;
}
+QNodeCreatedChangeBasePtr QEntity::createNodeCreationChange() const
+{
+ auto creationChange = QNodeCreatedChangePtr<QEntityData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QEntity);
+ data.parentEntityId = parentEntity() ? parentEntity()->id() : Qt3DCore::QNodeId();
+ data.componentIdsAndTypes.reserve(d->m_components.size());
+ const QComponentVector &components = d->m_components;
+ for (const auto &c : components) {
+ const auto idAndType = QNodeIdTypePair(c->id(), c->metaObject());
+ data.componentIdsAndTypes.push_back(idAndType);
+ }
+
+ return creationChange;
+}
+
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/nodes/qentity.h b/src/core/nodes/qentity.h
index 0e8da0800..a7f492a96 100644
--- a/src/core/nodes/qentity.h
+++ b/src/core/nodes/qentity.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,32 +52,33 @@ namespace Qt3DCore {
class QComponent;
class QEntityPrivate;
-typedef QList<QComponent*> QComponentList;
+typedef QVector<QComponent*> QComponentVector;
class QT3DCORESHARED_EXPORT QEntity : public QNode
{
Q_OBJECT
public:
- explicit QEntity(QNode *parent = Q_NULLPTR);
+ explicit QEntity(QNode *parent = nullptr);
virtual ~QEntity();
- QComponentList components() const;
+ QComponentVector components() const;
void addComponent(QComponent *comp);
void removeComponent(QComponent *comp);
- void removeAllComponents();
QEntity *parentEntity() const;
protected:
- QEntity(QEntityPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
+ explicit QEntity(QEntityPrivate &dd, QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QEntity)
- QT3D_CLONEABLE(QEntity)
+
+ QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
+typedef QSharedPointer<QEntity> QEntityPtr;
+
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/nodes/qentity_p.h b/src/core/nodes/qentity_p.h
index 8ae219a68..a9dfb9b0d 100644
--- a/src/core/nodes/qentity_p.h
+++ b/src/core/nodes/qentity_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -60,12 +63,13 @@ class QT3DCORE_PRIVATE_EXPORT QEntityPrivate : public QNodePrivate
{
public :
QEntityPrivate();
+ ~QEntityPrivate();
Q_DECLARE_PUBLIC(QEntity)
QNodeId parentEntityId() const;
- QComponentList m_components;
+ QComponentVector m_components;
bool m_visible;
// TODO: Is a bool enough here or do we need additional states for entities?
@@ -73,6 +77,12 @@ public :
mutable QNodeId m_parentEntityId;
};
+struct QEntityData
+{
+ Qt3DCore::QNodeId parentEntityId;
+ QVector<QNodeIdTypePair> componentIdsAndTypes;
+};
+
}
QT_END_NAMESPACE
diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp
index 90023cdcf..e56d4bd81 100644
--- a/src/core/nodes/qnode.cpp
+++ b/src/core/nodes/qnode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,8 +41,13 @@
#include "qnode_p.h"
#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qdynamicpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/qnodedestroyedchange.h>
#include <Qt3DCore/qaspectengine.h>
+#include <Qt3DCore/private/qdestructionidandtypecollector_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/private/qpostman_p.h>
#include <QEvent>
@@ -48,102 +56,206 @@
#include <QMetaProperty>
#include <Qt3DCore/QComponent>
#include <Qt3DCore/private/corelogging_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DCore/private/qnodevisitor_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-QHash<QNodeId, QNode *> QNodePrivate::m_clonesLookupTable = QHash<QNodeId, QNode *>();
-
QNodePrivate::QNodePrivate()
: QObjectPrivate()
- , m_changeArbiter(Q_NULLPTR)
- , m_scene(Q_NULLPTR)
+ , m_changeArbiter(nullptr)
+ , m_typeInfo(nullptr)
+ , m_scene(nullptr)
, m_id(QNodeId::createId())
, m_blockNotifications(false)
- , m_wasCleanedUp(false)
+ , m_hasBackendNode(false)
, m_enabled(true)
, m_propertyChangesSetup(false)
, m_signals(this)
{
}
-// Called by QNodePrivate::ctor or setParent (main thread)
+QNodePrivate::~QNodePrivate()
+{
+}
+
+void QNodePrivate::init(QNode *parent)
+{
+ if (!parent)
+ return;
+
+ // If we have a QNode parent that has a scene (and hence change arbiter),
+ // copy these to this QNode. If valid, then also notify the backend
+ // in a deferred way when the object is fully constructed. This is delayed
+ // until the object is fully constructed as it involves calling a virtual
+ // function of QNode.
+ const auto parentPrivate = get(parent);
+ m_scene = parentPrivate->m_scene;
+ Q_Q(QNode);
+ if (m_scene) {
+ m_scene->addObservable(q); // Sets the m_changeArbiter to that of the scene
+
+ // Scehdule the backend notification
+ QMetaObject::invokeMethod(q, "_q_notifyCreationAndChildChanges", Qt::QueuedConnection);
+ }
+}
+
+/*!
+ * \internal
+ *
+ * Sends QNodeCreatedChange events to the aspects.
+ */
+void QNodePrivate::notifyCreationChange()
+{
+ Q_Q(QNode);
+ QNodeCreatedChangeGenerator generator(q);
+ const auto creationChanges = generator.creationChanges();
+ for (const auto &change : creationChanges)
+ notifyObservers(change);
+}
+
+/*!
+ * \internal
+ *
+ * Sends a QNodeCreatedChange event to the aspects and then also notifies the
+ * parent backend node of its new child. This is called in a deferred manner
+ * by the QNodePrivate::init() method to notify the backend of newly created
+ * nodes with a parent that is already part of the scene.
+ */
+void QNodePrivate::_q_notifyCreationAndChildChanges()
+{
+ Q_Q(QNode);
+
+ // Check that the parent hasn't been unset since this call was enqueued
+ auto parentNode = q->parentNode();
+ if (!parentNode)
+ return;
+
+ // Let the backend know we have been added to the scene
+ notifyCreationChange();
+
+ // Let the backend parent know that they have a new child
+ Q_ASSERT(parentNode);
+ QNodePrivate::get(parentNode)->_q_addChild(q);
+}
+
+/*!
+ * \internal
+ *
+ * Called by _q_setParentHelper() or _q_notifyCreationAndChildChanges()
+ * on the main thread.
+ */
void QNodePrivate::_q_addChild(QNode *childNode)
{
Q_ASSERT(childNode);
- if (childNode == q_func())
- return ;
-
- // If the scene is null it means that the current node is part of a subtree
- // that has been pre-prepared. Therefore the node shouldn't be added by
- // itself but only when the root of the said subtree is inserted into an
- // existing node whose m_scene member is valid
- if (m_scene == Q_NULLPTR)
+ Q_ASSERT_X(childNode->parent() == q_func(), Q_FUNC_INFO, "not a child of this node");
+
+ if (!m_scene)
return;
- QNodeVisitor visitor;
- // Recursively set scene and change arbiter for the node subtree
- visitor.traverse(childNode, this, &QNodePrivate::setSceneHelper);
-
- // We notify only if we have a QChangeArbiter
- if (m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeCreated, QSceneChange::Node, m_id));
- e->setPropertyName("node");
- // We need to clone the parent of the childNode we send
- QNode *parentClone = QNode::clone(q_func());
- QNode *childClone = Q_NULLPTR;
- Q_FOREACH (QObject *c, parentClone->children()) {
- QNode *clone = qobject_cast<QNode *>(c);
- if (clone != Q_NULLPTR && clone->id() == childNode->id()) {
- childClone = clone;
- break;
- }
- }
- e->setValue(QVariant::fromValue(QNodePtr(childClone, &QNodePrivate::nodePtrDeleter)));
- notifyObservers(e);
+ // We need to send a QPropertyNodeAddedChange to the backend
+ // to notify the backend that we have a new child
+ if (m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(m_id, childNode);
+ change->setPropertyName("children");
+ notifyObservers(change);
}
- // Handle Entity - Components
+ // Update the scene
+ // TODO: Fold this into the QNodeCreatedChangeGenerator so we don't have to
+ // traverse the sub tree three times!
+ QNodeVisitor visitor;
visitor.traverse(childNode, this, &QNodePrivate::addEntityComponentToScene);
}
-// Called by setParent or cleanup (main thread) (could be other thread if created on the backend in a job)
+/*!
+ * \internal
+ *
+ * Called by _q_setParentHelper on the main thread.
+ */
void QNodePrivate::_q_removeChild(QNode *childNode)
{
Q_ASSERT(childNode);
- if (childNode->parent() != q_func())
- qCWarning(Nodes) << Q_FUNC_INFO << "not a child of " << this;
-
- // Notify only if child isn't a clone
- if (m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeAboutToBeDeleted, QSceneChange::Node, m_id));
- e->setPropertyName("node");
- // We need to clone the parent of the childNode we send
- // QNode *parentClone = QNode::clone(childNode->parentNode());
- // QNode *childClone = Q_NULLPTR;
- // Q_FOREACH (QObject *c, parentClone->children()) {
- // QNode *clone = qobject_cast<QNode *>(c);
- // if (clone != Q_NULLPTR && clone->id() == childNode->id()) {
- // childClone = clone;
- // break;
- // }
- // }
-
- // We cannot clone the parent as it seems that the childNode is already removed
- // from the parent when the ChildRemoved event is triggered
- // and that would therefore return us a childNode NULL (because not found in the parent's children list)
- // and crash the backend
-
- QNode *childClone = QNode::clone(childNode);
- e->setValue(QVariant::fromValue(QNodePtr(childClone, &QNodePrivate::nodePtrDeleter)));
- notifyObservers(e);
+ Q_ASSERT_X(childNode->parent() == q_func(), Q_FUNC_INFO, "not a child of this node");
+
+ // We notify the backend that we lost a child
+ if (m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(m_id, childNode);
+ change->setPropertyName("children");
+ notifyObservers(change);
}
+}
- // Recursively unset the scene on all children
- QNodeVisitor visitor;
- visitor.traverse(childNode, this, &QNodePrivate::unsetSceneHelper);
+/*!
+ * \internal
+ *
+ * Reparents the public QNode to \a parent. If the new parent is nullptr then this
+ * QNode is no longer part of the scene and so we notify the backend of its removal
+ * from its parent's list of children, and then send a QNodeDestroyedChange to the
+ * aspects so that the corresponding backend node is destroyed.
+ *
+ * If \a parent is not null, then we must tell its new parent about this QNode now
+ * being a child of it on the backend. If this QNode did not have a parent upon
+ * entry to this function, then we must first send a QNodeCreatedChange to the backend
+ * prior to sending the QPropertyNodeAddedChange to its parent.
+ *
+ * Note: This function should never be called from the ctor directly as the type may
+ * not be fully created yet and creating creation changes involves calling a virtual
+ * function on QNode. The function _q_notifyCreationAndChildChanges() is used
+ * for sending initial notification when a parent is passed to the QNode ctor.
+ * That function does a subset of this function with the assumption that the new object
+ * had no parent before (must be true as it is newly constructed).
+ */
+void QNodePrivate::_q_setParentHelper(QNode *parent)
+{
+ Q_Q(QNode);
+ QNode *oldParentNode = q->parentNode();
+
+ // If we had a parent, we let him know that we are about to change
+ // parent
+ if (oldParentNode) {
+ QNodePrivate::get(oldParentNode)->_q_removeChild(q);
+
+ // If we have an old parent but the new parent is null
+ // the backend node needs to be destroyed
+ if (!parent) {
+ // Tell the backend we are about to be destroyed
+ if (m_hasBackendNode) {
+ const QDestructionIdAndTypeCollector collector(q);
+ const auto destroyedChange = QNodeDestroyedChangePtr::create(q, collector.subtreeIdsAndTypes());
+ notifyObservers(destroyedChange);
+ }
+
+ // We unset the scene from the node as its backend node was/is about to be destroyed
+ QNodeVisitor visitor;
+ visitor.traverse(q, oldParentNode->d_func(), &QNodePrivate::unsetSceneHelper);
+ }
+ }
+
+ // Basically QObject::setParent but for QObjectPrivate
+ QObjectPrivate::setParent_helper(parent);
+ QNode *newParentNode = q->parentNode();
+
+ if (newParentNode) {
+ // If we had no parent but are about to set one,
+ // we need to send a QNodeCreatedChange
+ if (!oldParentNode) {
+ QNodePrivate *newParentPrivate = QNodePrivate::get(newParentNode);
+
+ // Set the scene helper / arbiter
+ if (newParentPrivate->m_scene) {
+ QNodeVisitor visitor;
+ visitor.traverse(q, newParentNode->d_func(), &QNodePrivate::setSceneHelper);
+ }
+
+ notifyCreationChange();
+ }
+
+ // If we have a valid new parent, we let him know that we are its child
+ QNodePrivate::get(newParentNode)->_q_addChild(q);
+ }
}
void QNodePrivate::registerNotifiedProperties()
@@ -211,9 +323,9 @@ void QNodePrivate::setSceneHelper(QNode *root)
// We also need to handle QEntity <-> QComponent relationships
if (QComponent *c = qobject_cast<QComponent *>(root)) {
const QVector<QEntity *> entities = c->entities();
- Q_FOREACH (QEntity *entity, entities) {
+ for (QEntity *entity : entities) {
if (!m_scene->hasEntityForComponent(c->id(), entity->id())) {
- if (!c->shareable() && !m_scene->entitiesForComponent(c->id()).isEmpty())
+ if (!c->isShareable() && !m_scene->entitiesForComponent(c->id()).isEmpty())
qWarning() << "Trying to assign a non shareable component to more than one Entity";
m_scene->addEntityForComponent(c->id(), entity->id());
}
@@ -232,15 +344,15 @@ void QNodePrivate::unsetSceneHelper(QNode *root)
// We also need to handle QEntity <-> QComponent relationships removal
if (QComponent *c = qobject_cast<QComponent *>(root)) {
const QVector<QEntity *> entities = c->entities();
- Q_FOREACH (QEntity *entity, entities) {
+ for (QEntity *entity : entities) {
if (m_scene)
m_scene->removeEntityForComponent(c->id(), entity->id());
}
}
- if (m_scene != Q_NULLPTR)
+ if (m_scene != nullptr)
m_scene->removeObservable(root);
- root->d_func()->setScene(Q_NULLPTR);
+ root->d_func()->setScene(nullptr);
}
/*!
@@ -249,7 +361,8 @@ void QNodePrivate::unsetSceneHelper(QNode *root)
void QNodePrivate::addEntityComponentToScene(QNode *root)
{
if (QEntity *e = qobject_cast<QEntity *>(root)) {
- Q_FOREACH (QComponent *c, e->components()) {
+ const auto components = e->components();
+ for (QComponent *c : components) {
if (!m_scene->hasEntityForComponent(c->id(), e->id()))
m_scene->addEntityForComponent(c->id(), e->id());
}
@@ -270,6 +383,21 @@ void QNodePrivate::setArbiter(QLockableObserverInterface *arbiter)
}
/*!
+ * Sends the \a change QSceneChangePtr to any QBackendNodes in the registered
+ * aspects that correspond to this QNode.
+ *
+ * For the common case of a QObject property change, QNode handles this for you
+ * automatically by sending a QPropertyUpdatedChange event to the backend nodes.
+ * You only need to call this function if you wish to send a specific type of
+ * change in place of the automatic handling.
+ */
+void QNode::notifyObservers(const QSceneChangePtr &change)
+{
+ Q_D(QNode);
+ d->notifyObservers(change);
+}
+
+/*!
Called when one or more backend aspects sends a notification \a change to the
current Qt3DCore::QNode instance.
@@ -308,7 +436,19 @@ void QNodePrivate::notifyPropertyChange(const char *name, const QVariant &value)
if (m_blockNotifications)
return;
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, m_id));
+ auto e = QPropertyUpdatedChangePtr::create(m_id);
+ e->setPropertyName(name);
+ e->setValue(value);
+ notifyObservers(e);
+}
+
+void QNodePrivate::notifyDynamicPropertyChange(const QByteArray &name, const QVariant &value)
+{
+ // Bail out early if we can to avoid operator new
+ if (m_blockNotifications)
+ return;
+
+ auto e = QDynamicPropertyUpdatedChangePtr::create(m_id);
e->setPropertyName(name);
e->setValue(value);
notifyObservers(e);
@@ -323,12 +463,12 @@ void QNodePrivate::notifyObservers(const QSceneChangePtr &change)
Q_ASSERT(change);
// Don't send notifications if we are blocking
- if (m_blockNotifications && change->type() == NodeUpdated)
+ if (m_blockNotifications && change->type() == PropertyUpdated)
return;
- if (m_changeArbiter != Q_NULLPTR) {
+ if (m_changeArbiter != nullptr) {
QAbstractPostman *postman = m_changeArbiter->postman();
- if (postman != Q_NULLPTR)
+ if (postman != nullptr)
postman->notifyBackend(change);
}
}
@@ -345,14 +485,14 @@ void QNodePrivate::notifyObservers(const QSceneChangePtr &change)
*/
void QNodePrivate::insertTree(QNode *treeRoot, int depth)
{
- if (m_scene != Q_NULLPTR) {
+ if (m_scene != nullptr) {
treeRoot->d_func()->setScene(m_scene);
m_scene->addObservable(treeRoot);
}
- Q_FOREACH (QObject *c, treeRoot->children()) {
- QNode *n = Q_NULLPTR;
- if ((n = qobject_cast<QNode *>(c)) != Q_NULLPTR)
+ for (QObject *c : treeRoot->children()) {
+ QNode *n = nullptr;
+ if ((n = qobject_cast<QNode *>(c)) != nullptr)
insertTree(n, depth + 1);
}
@@ -374,7 +514,7 @@ QNodePrivate *QNodePrivate::get(QNode *q)
void QNodePrivate::nodePtrDeleter(QNode *q)
{
QObject *p = q->parent();
- if (p == Q_NULLPTR)
+ if (p == nullptr)
p = q;
p->deleteLater();
}
@@ -413,6 +553,18 @@ void QNodePrivate::nodePtrDeleter(QNode *q)
*/
/*!
+ \fn QNodeId qIdForNode(QNode *node)
+ \relates Qt3DCore::QNode
+ \return node id for \a node.
+*/
+
+/*!
+ \fn QNodeIdVector qIdsForNodes(const T &nodes)
+ \relates Qt3DCore::QNode
+ \return vector of node ids for \a nodes.
+*/
+
+/*!
Creates a new QNode instance with parent \a parent.
\note The backend aspects will be notified that a QNode instance is
@@ -422,49 +574,22 @@ void QNodePrivate::nodePtrDeleter(QNode *q)
\sa setParent()
*/
QNode::QNode(QNode *parent)
- : QObject(*new QNodePrivate, parent)
-{
- qRegisterMetaType<QNode *>("QNode*");
- // We need to add ourselves with the parent if it is valid
- // This will notify the backend about the new child
- if (parent) {
- // This needs to be invoked only after the QNode has been fully
- QMetaObject::invokeMethod(parent, "_q_addChild", Qt::QueuedConnection, Q_ARG(QNode*, this));
- }
-}
+ : QNode(*new QNodePrivate, parent) {}
/*! \internal */
QNode::QNode(QNodePrivate &dd, QNode *parent)
: QObject(dd, parent)
{
- qRegisterMetaType<QNode *>("QNode*");
- // We need to add ourselves with the parent if it is valid
- // This will notify the backend about the new child
- if (parent) {
- // This needs to be invoked only after the QNode has been fully
- QMetaObject::invokeMethod(parent, "_q_addChild", Qt::QueuedConnection, Q_ARG(QNode*, this));
- }
-}
-
-/*!
- Copies all the attributes from \a ref to the current Qt3DCore::QNode instance.
-
- \note When subclassing QNode, you should reimplement this method and
- always call the copy method on the base class. This will ensure that when cloned,
- the QNode is properly initialized.
-*/
-void QNode::copy(const QNode *ref)
-{
- if (ref) {
- d_func()->m_id = ref->d_func()->m_id;
- d_func()->m_enabled = ref->d_func()->m_enabled;
- setObjectName(ref->objectName());
- }
+ Q_D(QNode);
+ d->init(parent);
}
QNode::~QNode()
{
- Q_ASSERT_X(QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DCore::QNode subclass didn't call QNode::cleanup in its destructor");
+ // If we have a parent it makes sense to let it know we are about to be destroyed.
+ // This in turn triggers the deletion of the corresponding backend nodes for the
+ // subtree rooted at this QNode.
+ setParent(Q_NODE_NULLPTR);
}
/*!
@@ -477,7 +602,15 @@ const QNodeId QNode::id() const
}
/*!
- Returns the immediate QNode parent, or null if the node has no parent.
+ \property Qt3DCore::QNode::parent
+
+ Holds the immediate QNode parent, or null if the node has no parent.
+
+ Setting the parent will notify the backend aspects about current QNode
+ instance's parent change.
+
+ \note if \a parent happens to be null, this will actually notify that the
+ current QNode instance was removed from the scene.
*/
QNode *QNode::parentNode() const
{
@@ -515,22 +648,20 @@ bool QNode::blockNotifications(bool block)
return previous;
}
-/*!
- * Sets the parent node of the current QNode instance to \a parent.
- * Setting the parent will notify the backend aspects about current QNode
- * instance's parent change.
- *
- * \note if \a parent happens to be null, this will actually notify that the
- * current QNode instance was removed from the scene.
- */
+// Note: should never be called from the ctor directly as the type may not be fully
+// created yet
void QNode::setParent(QNode *parent)
{
- if (parentNode())
- QNodePrivate::get(parentNode())->_q_removeChild(this);
- QObject::setParent(parent);
- if (parentNode())
- QNodePrivate::get(parentNode())->_q_addChild(this);
+ Q_D(QNode);
+ if (parentNode() == parent)
+ return;
+ d->_q_setParentHelper(parent);
+
+ // Block notifications as we want to let the _q_setParentHelper
+ // manually handle them
+ const bool blocked = blockNotifications(true);
emit parentChanged(parent);
+ blockNotifications(blocked);
}
/*!
@@ -540,7 +671,7 @@ void QNode::setParent(QNode *parent)
A shared pointer for QNode.
*/
/*!
- \typedef Qt3DCore::QNodeList
+ \typedef Qt3DCore::QNodeVector
\relates Qt3DCore::QNode
List of QNode pointers.
@@ -550,27 +681,19 @@ void QNode::setParent(QNode *parent)
* Returns a list filled with the QNode children of the current
* QNode instance.
*/
-QNodeList QNode::childrenNodes() const
+QNodeVector QNode::childNodes() const
{
- QNodeList nodeChildrenList;
- const QObjectList objectChildrenList = QObject::children();
+ QNodeVector nodeChildrenList;
+ const QObjectList &objectChildrenList = QObject::children();
nodeChildrenList.reserve(objectChildrenList.size());
- Q_FOREACH (QObject *c, objectChildrenList) {
+ for (QObject *c : objectChildrenList) {
if (QNode *n = qobject_cast<QNode *>(c))
nodeChildrenList.push_back(n);
}
return nodeChildrenList;
}
-/*!
- Set the QNode to enabled if \a isEnabled is \c true.
- By default a QNode is always enabled.
-
- \note the interpretation of what enabled means is aspect-dependent. Even if
- enabled is set to \c false, some aspects may still consider the node in
- some manner. This is documented on a class by class basis.
-*/
void QNode::setEnabled(bool isEnabled)
{
Q_D(QNode);
@@ -583,7 +706,14 @@ void QNode::setEnabled(bool isEnabled)
}
/*!
- Returns whether the QNode is enabled or not.
+ \property Qt3DCore::QNode::enabled
+
+ Holds the QNode enabled flag.
+ By default a QNode is always enabled.
+
+ \note the interpretation of what enabled means is aspect-dependent. Even if
+ enabled is set to \c false, some aspects may still consider the node in
+ some manner. This is documented on a class by class basis.
*/
bool QNode::isEnabled() const
{
@@ -591,64 +721,16 @@ bool QNode::isEnabled() const
return d->m_enabled;
}
-/*!
- Returns a clone of \a node. All the children of \a node are cloned as well.
-
- \note This is the only way to create two nodes with the same id.
-*/
-QNode *QNode::clone(QNode *node)
-{
- if (node == Q_NULLPTR)
- return Q_NULLPTR;
-
- static int clearLock = 0;
- clearLock++;
-
- // We keep a reference of clones for the current subtree
- // In order to preserve relationships when multiple entities
- // reference the same component
- QNode *clonedNode = QNodePrivate::m_clonesLookupTable.value(node->id());
- if (clonedNode == Q_NULLPTR) {
- clonedNode = node->doClone();
- // doClone, returns new instance with content copied
- // and relationships added
- QNodePrivate::m_clonesLookupTable.insert(clonedNode->id(), clonedNode);
- }
- Q_FOREACH (QObject *c, node->children()) {
- QNode *childNode = qobject_cast<QNode *>(c);
- if (childNode != Q_NULLPTR) {
- QNode *cclone = QNode::clone(childNode);
- // We use QObject::setParent instead of QNode::setParent to avoid the
- // whole overhead generated by the latter as we are only dealing with clones
- if (cclone != Q_NULLPTR)
- static_cast<QObject *>(cclone)->setParent(clonedNode);
- }
- }
-
- if (--clearLock == 0) // Cloning done
- QNodePrivate::m_clonesLookupTable.clear();
-
- return clonedNode;
-}
-
-/*!
- * This methods can only be called once and takes care of notyfing the backend
- * aspects that the current Qt3DCore::QNode instance is about to be destroyed.
- *
- * \note It must be called by the destructor of every class subclassing
- * QNode that is clonable (using the QT3D_CLONEABLE macro).
- */
-void QNode::cleanup()
+QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const
{
- Q_D(QNode);
- if (!d->m_wasCleanedUp) {
- d->m_wasCleanedUp = true;
- qCDebug(Nodes) << Q_FUNC_INFO << this;
- if (parentNode())
- QNodePrivate::get(parentNode())->_q_removeChild(this);
- // Root element has no parent and therefore we cannot
- // call parent->_q_removeChild();
- }
+ // Uncomment this when implementing new frontend and backend types.
+ // Any classes that don't override this function will be noticeable here.
+ // Note that some classes actually don't need to override as they have
+ // no additional data to send. In those cases this default implementation
+ // is perfectly fine.
+ // const QMetaObject *mo = metaObject();
+ // qDebug() << Q_FUNC_INFO << mo->className();
+ return QNodeCreatedChangeBasePtr::create(this);
}
} // namespace Qt3DCore
diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h
index 65aa340e9..3522800ef 100644
--- a/src/core/nodes/qnode.h
+++ b/src/core/nodes/qnode.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -41,9 +44,9 @@
#include <Qt3DCore/qt3dcore_global.h>
#include <Qt3DCore/qnodeid.h>
#include <Qt3DCore/qscenechange.h>
-#include <Qt3DCore/qabstractnodefactory.h>
+#include <Qt3DCore/qnodecreatedchange.h>
-#define Q_NODE_NULLPTR static_cast<Qt3DCore::QNode *>(Q_NULLPTR)
+#define Q_NODE_NULLPTR static_cast<Qt3DCore::QNode *>(nullptr)
QT_BEGIN_NAMESPACE
@@ -54,21 +57,12 @@ class QNodePrivate;
class QEntity;
class QAspectEngine;
-typedef QList<QNode *> QNodeList;
-typedef QSharedPointer<QNode> QNodePtr;
-
-#define QT3DCORE_QUOTE(str) #str
-#define QT3D_CLONEABLE(Class) \
- friend class Qt3DCore::QAbstractNodeFactory; \
- QNode *doClone() const Q_DECL_OVERRIDE { \
- Class *clone_ = Qt3DCore::QAbstractNodeFactory::createNode<Class>(QT3DCORE_QUOTE(Class)); \
- clone_->copy(this); \
- return clone_; \
- }
+#if defined(QT_BUILD_INTERNAL)
+class QBackendNodeTester;
+#endif
-// Each QNode subclass should call QNode::cleanup in it dtor
-// QNode::cleanup checks that a flags wasn't set to true,
-// sets it to true and sends a clone to the backend
+typedef QVector<QNode *> QNodeVector;
+typedef QSharedPointer<QNode> QNodePtr;
class QT3DCORESHARED_EXPORT QNode : public QObject
{
@@ -76,7 +70,7 @@ class QT3DCORESHARED_EXPORT QNode : public QObject
Q_PROPERTY(Qt3DCore::QNode *parent READ parentNode WRITE setParent NOTIFY parentChanged)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
public:
- explicit QNode(QNode *parent = Q_NULLPTR);
+ explicit QNode(QNode *parent = nullptr);
virtual ~QNode();
const QNodeId id() const;
@@ -85,12 +79,12 @@ public:
bool notificationsBlocked() const;
bool blockNotifications(bool block);
- QNodeList childrenNodes() const;
+ QNodeVector childNodes() const;
bool isEnabled() const;
public Q_SLOTS:
- virtual void setParent(QNode *parent);
+ void setParent(QNode *parent);
void setEnabled(bool isEnabled);
Q_SIGNALS:
@@ -98,30 +92,62 @@ Q_SIGNALS:
void enabledChanged(bool enabled);
protected:
- // Clone should only be made in the main thread
- static QNode *clone(QNode *node);
-
- QNode(QNodePrivate &dd, QNode *parent = Q_NULLPTR);
- virtual void copy(const QNode *ref);
+ explicit QNode(QNodePrivate &dd, QNode *parent = nullptr);
+ void notifyObservers(const QSceneChangePtr &change);
virtual void sceneChangeEvent(const QSceneChangePtr &change);
- void cleanup();
-
private:
Q_DECLARE_PRIVATE(QNode)
- virtual QNode *doClone() const = 0;
+ virtual QNodeCreatedChangeBasePtr createNodeCreationChange() const;
// We only want setParent(QNode *) to be callable
// when dealing with QNode objects
void setParent(QObject *) Q_DECL_EQ_DELETE;
- Q_PRIVATE_SLOT(d_func(), void _q_addChild(QNode *))
- Q_PRIVATE_SLOT(d_func(), void _q_removeChild(QNode *))
+ Q_PRIVATE_SLOT(d_func(), void _q_notifyCreationAndChildChanges())
+ Q_PRIVATE_SLOT(d_func(), void _q_addChild(Qt3DCore::QNode *))
+ Q_PRIVATE_SLOT(d_func(), void _q_removeChild(Qt3DCore::QNode *))
+ Q_PRIVATE_SLOT(d_func(), void _q_setParentHelper(Qt3DCore::QNode *))
friend class QAspectEngine;
+ friend class QAspectEnginePrivate;
+ friend class QNodeCreatedChangeGenerator;
friend class QPostman;
friend class QScene;
+
+#if defined(QT_BUILD_INTERNAL)
+ friend class QBackendNodeTester;
+#endif
+};
+
+inline QNodeId qIdForNode(QNode *node){ return node ? node->id() : QNodeId(); }
+
+template<typename T>
+inline QNodeIdVector qIdsForNodes(const T &nodes)
+{
+ QNodeIdVector ids;
+ ids.reserve(nodes.size());
+ for (const auto n : nodes)
+ ids.push_back(n->id());
+ return ids;
+}
+
+struct QNodeIdTypePair
+{
+ QNodeIdTypePair() Q_DECL_NOEXCEPT
+ : id()
+ , type(nullptr)
+ {}
+
+ explicit QNodeIdTypePair(QNodeId _id, const QMetaObject *_type) Q_DECL_NOEXCEPT
+ : id(_id)
+ , type(_type)
+ {}
+
+ QNodeId id;
+ const QMetaObject *type;
};
+QT3D_DECLARE_TYPEINFO(Qt3DCore, QNodeIdTypePair, Q_PRIMITIVE_TYPE)
} // namespace Qt3DCore
diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h
index c3fc0fae2..648bc4c34 100644
--- a/src/core/nodes/qnode_p.h
+++ b/src/core/nodes/qnode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -66,6 +69,9 @@ class QT3DCORE_PRIVATE_EXPORT QNodePrivate : public QObjectPrivate, public QObse
{
public:
QNodePrivate();
+ ~QNodePrivate();
+
+ void init(QNode *parent);
void setScene(QScene *scene);
QScene *scene() const;
@@ -73,6 +79,7 @@ public:
void setArbiter(QLockableObserverInterface *arbiter) Q_DECL_OVERRIDE;
void notifyPropertyChange(const char *name, const QVariant &value);
+ void notifyDynamicPropertyChange(const QByteArray &name, const QVariant &value);
void notifyObservers(const QSceneChangePtr &change) Q_DECL_OVERRIDE;
void insertTree(QNode *treeRoot, int depth = 0);
@@ -82,18 +89,22 @@ public:
// For now this just protects access to the m_changeArbiter.
// Later on we may decide to extend support for multiple observers.
QAbstractArbiter *m_changeArbiter;
+ QMetaObject *m_typeInfo;
QScene *m_scene;
mutable QNodeId m_id;
bool m_blockNotifications;
- bool m_wasCleanedUp;
+ bool m_hasBackendNode;
bool m_enabled;
static QNodePrivate *get(QNode *q);
static void nodePtrDeleter(QNode *q);
private:
+ void notifyCreationChange();
+ void _q_notifyCreationAndChildChanges();
void _q_addChild(QNode *childNode);
void _q_removeChild(QNode *childNode);
+ void _q_setParentHelper(QNode *parent);
void registerNotifiedProperties();
void unregisterNotifiedProperties();
void propertyChanged(int propertyIndex);
@@ -105,8 +116,6 @@ private:
friend class PropertyChangeHandler<QNodePrivate>;
bool m_propertyChangesSetup;
PropertyChangeHandler<QNodePrivate> m_signals;
-
- static QHash<QNodeId, QNode *> m_clonesLookupTable;
};
} // namespace Qt3DCore
diff --git a/src/core/nodes/qnodecreatedchangegenerator.cpp b/src/core/nodes/qnodecreatedchangegenerator.cpp
new file mode 100644
index 000000000..c350c866a
--- /dev/null
+++ b/src/core/nodes/qnodecreatedchangegenerator.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnodecreatedchangegenerator_p.h"
+#include <Qt3DCore/private/qnodevisitor_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QNodeCreatedChangeGenerator::QNodeCreatedChangeGenerator(QNode *rootNode)
+{
+ QNodeVisitor visitor;
+ visitor.traverse(rootNode, this, &QNodeCreatedChangeGenerator::createCreationChange);
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/src/core/nodes/qnodecreatedchangegenerator_p.h b/src/core/nodes/qnodecreatedchangegenerator_p.h
new file mode 100644
index 000000000..f00241b39
--- /dev/null
+++ b/src/core/nodes/qnodecreatedchangegenerator_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QNODECREATEDCHANGEGENERATOR_H
+#define QT3DCORE_QNODECREATEDCHANGEGENERATOR_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qt3dcore_global.h>
+#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DCore/private/qnode_p.h>
+#include <QtCore/qvector.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QT3DCORE_PRIVATE_EXPORT QNodeCreatedChangeGenerator
+{
+public:
+ QNodeCreatedChangeGenerator(QNode *rootNode);
+
+ QVector<QNodeCreatedChangeBasePtr> creationChanges() const { return m_creationChanges; }
+
+private:
+ void createCreationChange(QNode *node)
+ {
+ const auto creationChange = node->createNodeCreationChange();
+ m_creationChanges.push_back(creationChange);
+
+ // Store the metaobject of the node in the QNode so that we have it available
+ // to us during destruction in the QNode destructor. This allows us to send
+ // the QNodeId and the metaobject as typeinfo to the backend aspects so they
+ // in turn can find the correct QBackendNodeMapper object to handle the destruction
+ // of the corresponding backend nodes.
+ QNodePrivate *d = QNodePrivate::get(node);
+ d->m_typeInfo = const_cast<QMetaObject*>(creationChange->metaObject());
+
+ // Mark this node as having been handled for creation so that it is picked up
+ d->m_hasBackendNode = true;
+ }
+
+ QVector<QNodeCreatedChangeBasePtr> m_creationChanges;
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QNODECREATEDCHANGEGENERATOR_H
diff --git a/src/core/nodes/qnodeid.cpp b/src/core/nodes/qnodeid.cpp
index ac8055e9d..306ec0443 100644
--- a/src/core/nodes/qnodeid.cpp
+++ b/src/core/nodes/qnodeid.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,20 +43,83 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-QNodeId QNodeId::createId()
+/*!
+ * \class Qt3DCore::QNodeId
+ * \inmodule Qt3DCore
+ *
+ * TODO
+ */
+
+/*!
+ * \typedef Qt3DCore::QNodeIdVector
+ * \relates Qt3DCore::QNodeId
+ *
+ * A vector of {QNodeId}s.
+ */
+
+/*!
+ * \fn bool QNodeId::isNull() const
+ * \return TODO
+ */
+
+/*!
+ * \fn bool Qt3DCore::QNodeId::operator ==(QNodeId other) const
+ * \return \c true if \c this == \a other.
+ */
+
+/*!
+ * \fn bool Qt3DCore::QNodeId::operator !=(QNodeId other) const
+ * \return \c true if \c this != \a other.
+ */
+
+/*!
+ * \fn bool Qt3DCore::QNodeId::operator <(QNodeId other) const
+ * \return \c true if \c this < \a other.
+ */
+
+/*!
+ * \fn bool Qt3DCore::QNodeId::operator >(QNodeId other) const
+ * \return \c true if \c this > \a other.
+ */
+
+/*!
+ * \fn quint64 QNodeId::id() const
+ * \return TODO
+ */
+
+/*!
+ * \fn Qt3DCore::QNodeId::operator bool() const
+ * TODO
+ */
+
+/*!
+ * \fn uint Qt3DCore::qHash(QNodeId id, uint seed = 0)
+ * \relates Qt3DCore::QNodeId
+ * \return hash of node with \a id and optional \a seed.
+ */
+
+/*!
+ * \return node id.
+ */
+QNodeId QNodeId::createId() Q_DECL_NOTHROW
{
+ typedef
#if defined(Q_ATOMIC_INT64_IS_SUPPORTED)
- static QAtomicInteger<quint64> m_curId = QAtomicInteger<quint64>(1);
+ quint64
#else
- static QAtomicInteger<quint32> m_curId = QAtomicInteger<quint32>(1);
+ quint32
#endif
- QNodeId id;
- id.m_id = m_curId.fetchAndAddOrdered(1);
- return id;
+ UIntType;
+ static QBasicAtomicInteger<UIntType> next = Q_BASIC_ATOMIC_INITIALIZER(0);
+ return QNodeId(next.fetchAndAddRelaxed(1) + 1);
}
#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug d, const QNodeId &id)
+/*!
+ * << with \a d and \a id.
+ * \return QDebug.
+ */
+QDebug operator<<(QDebug d, QNodeId id)
{
d << id.id();
return d;
diff --git a/src/core/nodes/qnodeid.h b/src/core/nodes/qnodeid.h
index 76fdd2745..33f1a39e5 100644
--- a/src/core/nodes/qnodeid.h
+++ b/src/core/nodes/qnodeid.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,68 +42,77 @@
#include <Qt3DCore/qt3dcore_global.h>
#include <QDebug>
+#include <QtCore/QHashFunctions>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QT3DCORESHARED_EXPORT QNodeId
+class QNodeId
{
+ Q_DECL_CONSTEXPR explicit QNodeId(quint64 i) Q_DECL_NOTHROW
+ : m_id(i)
+ {}
public:
- QNodeId()
+ Q_DECL_CONSTEXPR QNodeId() Q_DECL_NOTHROW
: m_id(0)
{}
- static QNodeId createId();
+ QT3DCORESHARED_EXPORT static QNodeId createId() Q_DECL_NOTHROW;
- inline bool isNull() const
+ Q_DECL_CONSTEXPR bool isNull() const Q_DECL_NOEXCEPT
{
return m_id == 0;
}
- inline bool operator ==(const QNodeId &other) const
+ Q_DECL_CONSTEXPR bool operator ==(QNodeId other) const Q_DECL_NOEXCEPT
{
return other.m_id == m_id;
}
- inline bool operator !=(const QNodeId &other) const
+ Q_DECL_CONSTEXPR bool operator !=(QNodeId other) const Q_DECL_NOEXCEPT
{
return !operator ==(other);
}
- inline bool operator <(const QNodeId &other) const
+ Q_DECL_CONSTEXPR bool operator <(QNodeId other) const Q_DECL_NOEXCEPT
{
return m_id < other.m_id;
}
- inline bool operator >(const QNodeId &other) const
+ Q_DECL_CONSTEXPR bool operator >(QNodeId other) const Q_DECL_NOEXCEPT
{
return m_id > other.m_id;
}
- inline quint64 id() const
+ Q_DECL_CONSTEXPR quint64 id() const Q_DECL_NOEXCEPT
{
return m_id;
}
+ Q_DECL_CONSTEXPR operator bool() const Q_DECL_NOEXCEPT
+ {
+ return m_id != 0;
+ }
+
private:
quint64 m_id;
};
+QT3D_DECLARE_TYPEINFO(Qt3DCore, QNodeId, Q_PRIMITIVE_TYPE)
+typedef QVector<QNodeId> QNodeIdVector;
#ifndef QT_NO_DEBUG_STREAM
-QT3DCORESHARED_EXPORT QDebug operator<<(QDebug d, const QNodeId &id);
+QT3DCORESHARED_EXPORT QDebug operator<<(QDebug d, QNodeId id);
#endif
-inline uint qHash(const QNodeId &id, uint seed = 0) Q_DECL_NOTHROW
+inline Q_DECL_CONSTEXPR uint qHash(QNodeId id, uint seed = 0) Q_DECL_NOTHROW
{
- Q_UNUSED(seed);
- return id.id();
+ using QT_PREPEND_NAMESPACE(qHash);
+ return qHash(id.id(), seed);
}
-} // Qt3D
-
-Q_DECLARE_TYPEINFO(Qt3DCore::QNodeId, Q_MOVABLE_TYPE);
+} // Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/nodes/qnodevisitor.cpp b/src/core/nodes/qnodevisitor.cpp
index 541c6654b..c60456230 100644
--- a/src/core/nodes/qnodevisitor.cpp
+++ b/src/core/nodes/qnodevisitor.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,12 +61,12 @@ QNode* QNodeVisitor::currentNode() const
return m_path.back();
}
-void QNodeVisitor::setPath(QNodeList path)
+void QNodeVisitor::setPath(QNodeVector path)
{
m_path = path;
}
-QNodeList QNodeVisitor::path() const
+QNodeVector QNodeVisitor::path() const
{
return m_path;
}
diff --git a/src/core/nodes/qnodevisitor_p.h b/src/core/nodes/qnodevisitor_p.h
index 1483992f2..3637293f5 100644
--- a/src/core/nodes/qnodevisitor_p.h
+++ b/src/core/nodes/qnodevisitor_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -89,18 +92,19 @@ public:
QNode *rootNode() const;
QNode *currentNode() const;
- void setPath(QNodeList path);
- QNodeList path() const;
+ void setPath(QNodeVector path);
+ QNodeVector path() const;
void append(QNode *n);
void pop_back();
private:
- QNodeList m_path;
+ Q_DISABLE_COPY(QNodeVisitor)
+ QNodeVector m_path;
template<typename NodeVisitorFunctor>
void startTraversing(QNode *rootNode_, NodeVisitorFunctor fN)
{
- setPath(QNodeList() << rootNode_);
+ setPath(QNodeVector() << rootNode_);
if (rootNode_)
visitNode(rootNode_, fN);
}
@@ -108,7 +112,7 @@ private:
template<typename NodeVisitorFunctor, typename EntityVisitorFunctor>
void startTraversing(QNode *rootNode_, NodeVisitorFunctor fN, EntityVisitorFunctor fE)
{
- setPath(QNodeList() << rootNode_);
+ setPath(QNodeVector() << rootNode_);
QEntity* rootEntity = qobject_cast<QEntity *>(rootNode_);
if (rootEntity)
@@ -141,9 +145,9 @@ private:
template<typename NodeVisitorFunctor, typename EntityVisitorFunctor>
void traverseChildren(NodeVisitorFunctor &fN, EntityVisitorFunctor &fE)
{
- Q_FOREACH (QObject *n, currentNode()->children()) {
+ for (QObject *n : currentNode()->children()) {
QNode *node = qobject_cast<QNode *>(n);
- if (node != Q_NULLPTR)
+ if (node != nullptr)
outerVisitNode(node, fN, fE);
} // of children iteration
}
@@ -151,9 +155,9 @@ private:
template<typename NodeVisitorFunctor>
void traverseChildren(NodeVisitorFunctor &fN)
{
- Q_FOREACH (QObject *n, currentNode()->children()) {
+ for (QObject *n : currentNode()->children()) {
QNode *node = qobject_cast<QNode *>(n);
- if (node != Q_NULLPTR)
+ if (node != nullptr)
outerVisitNode(node, fN);
} // of children iteration
}
diff --git a/src/core/qbackendnodefactory.cpp b/src/core/qbackendnodefactory.cpp
index 4b44cc8a8..6fd5b33d1 100644
--- a/src/core/qbackendnodefactory.cpp
+++ b/src/core/qbackendnodefactory.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qbackendnodefactory_p.h b/src/core/qbackendnodefactory_p.h
index c56236446..9f2afb16d 100644
--- a/src/core/qbackendnodefactory_p.h
+++ b/src/core/qbackendnodefactory_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,19 +52,19 @@
//
#include <Qt3DCore/private/qt3dcore_global_p.h>
+#include <Qt3DCore/qnodecreatedchange.h>
QT_BEGIN_NAMESPACE
namespace Qt3DCore {
class QBackendNode;
-class QNode;
class QT3DCORE_PRIVATE_EXPORT QBackendNodeFactory
{
public:
virtual ~QBackendNodeFactory();
- virtual QBackendNode *createBackendNode(QNode *frontend) const = 0;
+ virtual QBackendNode *createBackendNode(const QNodeCreatedChangeBasePtr &change) const = 0;
};
} // namespace Qt3DCore
diff --git a/src/core/qbackendscenepropertychange.cpp b/src/core/qbackendscenepropertychange.cpp
deleted file mode 100644
index f78ef940b..000000000
--- a/src/core/qbackendscenepropertychange.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qbackendscenepropertychange.h"
-#include "qbackendscenepropertychange_p.h"
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/private/qbackendnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-/*!
- \class Qt3DCore::QBackendScenePropertyChange
- \inmodule Qt3DCore
-*/
-
-QBackendScenePropertyChangePrivate::QBackendScenePropertyChangePrivate()
- : QScenePropertyChangePrivate()
-{
-}
-
-QBackendScenePropertyChangePrivate::~QBackendScenePropertyChangePrivate()
-{
-}
-
-QBackendScenePropertyChange::QBackendScenePropertyChange(ChangeFlag type, const QNodeId &subjectId, QSceneChange::Priority priority)
- : QScenePropertyChange(*new QBackendScenePropertyChangePrivate, type, Observable, subjectId, priority)
-{
-}
-
-QBackendScenePropertyChange::~QBackendScenePropertyChange()
-{
-}
-
-// TO DO get rid off setTargetNode, use the subject instead ??
-void QBackendScenePropertyChange::setTargetNode(const QNodeId &id)
-{
- Q_D(QBackendScenePropertyChange);
- d->m_targetUuid = id;
-}
-
-QNodeId QBackendScenePropertyChange::targetNode() const
-{
- Q_D(const QBackendScenePropertyChange);
- return d->m_targetUuid;
-}
-
-/*!
- \typedef Qt3DCore::QBackendScenePropertyChangePtr
- \relates Qt3DCore::QBackendScenePropertyChange
-
- A shared pointer for QBackendScenePropertyChange.
-*/
-
-/*! \internal */
-QBackendScenePropertyChange::QBackendScenePropertyChange(QBackendScenePropertyChangePrivate &dd)
- : QScenePropertyChange(dd)
-{
-}
-
-/*! \internal */
-QBackendScenePropertyChange::QBackendScenePropertyChange(QBackendScenePropertyChangePrivate &dd, ChangeFlag type, const QNodeId &subjectId, QSceneChange::Priority priority)
- : QScenePropertyChange(dd, type, Observable, subjectId, priority)
-{
-}
-
-} // Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/core/qbackendscenepropertychange.h b/src/core/qbackendscenepropertychange.h
deleted file mode 100644
index 8c06d19af..000000000
--- a/src/core/qbackendscenepropertychange.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_QBACKENDSCENEPROPERTYCHANGE_H
-#define QT3DCORE_QBACKENDSCENEPROPERTYCHANGE_H
-
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QBackendScenePropertyChangePrivate;
-class QBackendNode;
-
-class QT3DCORESHARED_EXPORT QBackendScenePropertyChange : public QScenePropertyChange
-{
-public:
- QBackendScenePropertyChange(ChangeFlag type, const QNodeId &subjectId,
- Priority priority = Standard);
- virtual ~QBackendScenePropertyChange();
-
- void setTargetNode(const QNodeId &id);
- QNodeId targetNode() const;
-
-protected:
- Q_DECLARE_PRIVATE(QBackendScenePropertyChange)
- QBackendScenePropertyChange(QBackendScenePropertyChangePrivate &dd);
- QBackendScenePropertyChange(QBackendScenePropertyChangePrivate &dd, ChangeFlag type, const QNodeId &subjectId, Priority priority = Standard);
-};
-
-typedef QSharedPointer<QBackendScenePropertyChange> QBackendScenePropertyChangePtr;
-
-
-} // Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_QBACKENDSCENEPROPERTYCHANGE_H
diff --git a/src/core/qbackendscenepropertychange_p.h b/src/core/qbackendscenepropertychange_p.h
deleted file mode 100644
index 99080b8b2..000000000
--- a/src/core/qbackendscenepropertychange_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_QBACKENDSCENEPROPERTYCHANGE_P_H
-#define QT3DCORE_QBACKENDSCENEPROPERTYCHANGE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qscenepropertychange_p.h>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QBackendScenePropertyChange;
-
-class QBackendScenePropertyChangePrivate : public QScenePropertyChangePrivate
-{
-public:
- QBackendScenePropertyChangePrivate();
- virtual ~QBackendScenePropertyChangePrivate();
-
- Q_DECLARE_PUBLIC(QBackendScenePropertyChange)
-
- QNodeId m_targetUuid;
-};
-
-} // Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_QBACKENDSCENEPROPERTYCHANGE_P_H
diff --git a/src/core/qchangearbiter.cpp b/src/core/qchangearbiter.cpp
index 039fe4f6c..19bbc479a 100644
--- a/src/core/qchangearbiter.cpp
+++ b/src/core/qchangearbiter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -73,9 +76,9 @@ namespace Qt3DCore {
QChangeArbiter::QChangeArbiter(QObject *parent)
: QObject(parent)
, m_mutex(QMutex::Recursive)
- , m_jobManager(Q_NULLPTR)
- , m_postman(Q_NULLPTR)
- , m_scene(Q_NULLPTR)
+ , m_jobManager(nullptr)
+ , m_postman(nullptr)
+ , m_scene(nullptr)
{
// The QMutex has to be recursive to handle the case where :
// 1) SyncChanges is called, mutex is locked
@@ -88,7 +91,7 @@ QChangeArbiter::QChangeArbiter(QObject *parent)
QChangeArbiter::~QChangeArbiter()
{
- if (m_jobManager != Q_NULLPTR)
+ if (m_jobManager != nullptr)
m_jobManager->waitForPerThreadFunction(QChangeArbiter::destroyThreadLocalChangeQueue, this);
m_lockingChangeQueues.clear();
m_changeQueues.clear();
@@ -113,43 +116,26 @@ void QChangeArbiter::distributeQueueChanges(QChangeQueue *changeQueue)
continue;
if (change->type() == NodeCreated) {
- Q_FOREACH (QSceneObserverInterface *observer, m_sceneObservers)
+ for (QSceneObserverInterface *observer : qAsConst(m_sceneObservers))
observer->sceneNodeAdded(change);
- }
- else if (change->type() == NodeAboutToBeDeleted || change->type() == NodeDeleted) {
- Q_FOREACH (QSceneObserverInterface *observer, m_sceneObservers)
+ } else if (change->type() == NodeDeleted) {
+ for (QSceneObserverInterface *observer : qAsConst(m_sceneObservers))
observer->sceneNodeRemoved(change);
}
- switch (change->observableType()) {
-
- case QSceneChange::Observable: {
- const QNodeId nodeId = change->subjectId();
- if (m_nodeObservations.contains(nodeId)) {
- QObserverList &observers = m_nodeObservations[nodeId];
- Q_FOREACH (const QObserverPair&observer, observers) {
- if ((change->type() & observer.first))
- observer.second->sceneChangeEvent(change);
- }
+ const QNodeId nodeId = change->subjectId();
+ const auto it = m_nodeObservations.constFind(nodeId);
+ if (it != m_nodeObservations.cend()) {
+ const QObserverList &observers = it.value();
+ for (const QObserverPair &observer : observers) {
+ if ((change->type() & observer.first))
+ observer.second->sceneChangeEvent(change);
+ }
+ if (change->deliveryFlags() & QSceneChange::Nodes) {
// Also send change to the postman
m_postman->sceneChangeEvent(change);
}
- break;
}
-
- case QSceneChange::Node: {
- const QNodeId nodeId = change->subjectId();
- if (m_nodeObservations.contains(nodeId)) {
- QObserverList &observers = m_nodeObservations[nodeId];
- Q_FOREACH (const QObserverPair&observer, observers) {
- if ((change->type() & observer.first))
- observer.second->sceneChangeEvent(change);
- }
- }
- break;
- }
-
- } // observableType switch
}
changeQueue->clear();
}
@@ -186,10 +172,10 @@ void QChangeArbiter::removeLockingChangeQueue(QChangeArbiter::QChangeQueue *queu
void QChangeArbiter::syncChanges()
{
QMutexLocker locker(&m_mutex);
- Q_FOREACH (QChangeArbiter::QChangeQueue *changeQueue, m_changeQueues)
+ for (QChangeArbiter::QChangeQueue *changeQueue : qAsConst(m_changeQueues))
distributeQueueChanges(changeQueue);
- Q_FOREACH (QChangeQueue *changeQueue, m_lockingChangeQueues)
+ for (QChangeQueue *changeQueue : qAsConst(m_lockingChangeQueues))
distributeQueueChanges(changeQueue);
}
@@ -209,7 +195,7 @@ QScene *QChangeArbiter::scene() const
}
void QChangeArbiter::registerObserver(QObserverInterface *observer,
- const QNodeId &nodeId,
+ QNodeId nodeId,
ChangeFlags changeFlags)
{
QMutexLocker locker(&m_mutex);
@@ -224,7 +210,7 @@ void QChangeArbiter::registerSceneObserver(QSceneObserverInterface *observer)
m_sceneObservers << observer;
}
-void QChangeArbiter::unregisterObserver(QObserverInterface *observer, const QNodeId &nodeId)
+void QChangeArbiter::unregisterObserver(QObserverInterface *observer, QNodeId nodeId)
{
QMutexLocker locker(&m_mutex);
if (m_nodeObservations.contains(nodeId)) {
@@ -239,7 +225,7 @@ void QChangeArbiter::unregisterObserver(QObserverInterface *observer, const QNod
// Called from the QAspectThread context, no need to lock
void QChangeArbiter::unregisterSceneObserver(QSceneObserverInterface *observer)
{
- if (observer != Q_NULLPTR)
+ if (observer != nullptr)
m_sceneObservers.removeOne(observer);
}
@@ -301,7 +287,7 @@ void QChangeArbiter::destroyUnmanagedThreadLocalChangeQueue(void *changeArbiter)
if (arbiter->tlsChangeQueue()->hasLocalData()) {
QChangeQueue *localChangeQueue = arbiter->tlsChangeQueue()->localData();
arbiter->removeLockingChangeQueue(localChangeQueue);
- arbiter->tlsChangeQueue()->setLocalData(Q_NULLPTR);
+ arbiter->tlsChangeQueue()->setLocalData(nullptr);
}
}
@@ -327,7 +313,7 @@ void QChangeArbiter::destroyThreadLocalChangeQueue(void *changeArbiter)
if (arbiter->tlsChangeQueue()->hasLocalData()) {
QChangeQueue *localChangeQueue = arbiter->tlsChangeQueue()->localData();
arbiter->removeChangeQueue(localChangeQueue);
- arbiter->tlsChangeQueue()->setLocalData(Q_NULLPTR);
+ arbiter->tlsChangeQueue()->setLocalData(nullptr);
}
}
diff --git a/src/core/qchangearbiter_p.h b/src/core/qchangearbiter_p.h
index 1fc914b11..e3fdcad9b 100644
--- a/src/core/qchangearbiter_p.h
+++ b/src/core/qchangearbiter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -93,10 +96,10 @@ public:
void syncChanges();
void registerObserver(QObserverInterface *observer,
- const QNodeId &nodeId,
+ QNodeId nodeId,
ChangeFlags changeFlags = AllChanges);
void unregisterObserver(QObserverInterface *observer,
- const QNodeId &nodeId);
+ QNodeId nodeId);
void registerSceneObserver(QSceneObserverInterface *observer);
void unregisterSceneObserver(QSceneObserverInterface *observer);
diff --git a/src/core/qlockableobserverinterface.cpp b/src/core/qlockableobserverinterface.cpp
index 63390153d..ac0bf4c32 100644
--- a/src/core/qlockableobserverinterface.cpp
+++ b/src/core/qlockableobserverinterface.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qlockableobserverinterface_p.h b/src/core/qlockableobserverinterface_p.h
index baa2600bf..1d6878c22 100644
--- a/src/core/qlockableobserverinterface_p.h
+++ b/src/core/qlockableobserverinterface_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qobservableinterface.cpp b/src/core/qobservableinterface.cpp
index c296ac4c7..51c4dbbf9 100644
--- a/src/core/qobservableinterface.cpp
+++ b/src/core/qobservableinterface.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qobservableinterface_p.h b/src/core/qobservableinterface_p.h
index 3a9bb8369..e867f1b84 100644
--- a/src/core/qobservableinterface_p.h
+++ b/src/core/qobservableinterface_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qobserverinterface.cpp b/src/core/qobserverinterface.cpp
index 731d96267..0e452f169 100644
--- a/src/core/qobserverinterface.cpp
+++ b/src/core/qobserverinterface.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qobserverinterface_p.h b/src/core/qobserverinterface_p.h
index f3107cb1c..9763883fb 100644
--- a/src/core/qobserverinterface_p.h
+++ b/src/core/qobserverinterface_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qpostman.cpp b/src/core/qpostman.cpp
index 35aa888df..ac78450c6 100644
--- a/src/core/qpostman.cpp
+++ b/src/core/qpostman.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,8 +39,7 @@
#include "qpostman_p.h"
#include <private/qobject_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/private/qlockableobserverinterface_p.h>
#include <Qt3DCore/qnode.h>
@@ -52,7 +54,7 @@ class QPostmanPrivate : public QObjectPrivate
public:
QPostmanPrivate()
: QObjectPrivate()
- , m_scene(Q_NULLPTR)
+ , m_scene(nullptr)
{
}
@@ -67,6 +69,10 @@ QPostman::QPostman(QObject *parent)
qRegisterMetaType<QSceneChangePtr >("QSceneChangePtr");
}
+QPostman::~QPostman()
+{
+}
+
void QPostman::setScene(QScene *scene)
{
Q_D(QPostman);
@@ -115,19 +121,18 @@ void QPostman::notifyBackend(const QSceneChangePtr &change)
void QPostman::notifyFrontendNode(const QSceneChangePtr &e)
{
Q_D(QPostman);
- QBackendScenePropertyChangePtr change = qSharedPointerCast<QBackendScenePropertyChange>(e);
- if (!change.isNull() && d->m_scene != Q_NULLPTR) {
- QNode *n = d->m_scene->lookupNode(change->targetNode());
- if (n != Q_NULLPTR)
- n->sceneChangeEvent(change);
+ if (!e.isNull() && d->m_scene != nullptr) {
+ QNode *n = d->m_scene->lookupNode(e->subjectId());
+ if (n != nullptr)
+ n->sceneChangeEvent(e);
}
}
void QPostman::submitChangeBatch()
{
Q_D(QPostman);
- QLockableObserverInterface *arbiter = Q_NULLPTR;
- if (d->m_scene && (arbiter = d->m_scene->arbiter()) != Q_NULLPTR) {
+ QLockableObserverInterface *arbiter = nullptr;
+ if (d->m_scene && (arbiter = d->m_scene->arbiter()) != nullptr) {
arbiter->sceneChangeEventWithLock(d->m_batch);
d->m_batch.clear();
}
diff --git a/src/core/qpostman_p.h b/src/core/qpostman_p.h
index c98ce6700..4c286e2f3 100644
--- a/src/core/qpostman_p.h
+++ b/src/core/qpostman_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -72,6 +75,7 @@ class QPostman Q_DECL_FINAL
Q_OBJECT
public:
explicit QPostman(QObject *parent = 0);
+ ~QPostman();
void setScene(QScene *sceneLookup) Q_DECL_FINAL;
void sceneChangeEvent(const QSceneChangePtr &e) Q_DECL_FINAL;
diff --git a/src/core/qray3d.cpp b/src/core/qray3d.cpp
deleted file mode 100644
index 9305baeb0..000000000
--- a/src/core/qray3d.cpp
+++ /dev/null
@@ -1,373 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qray3d.h"
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-/*!
- \class Qt3DCore::QRay3D
- \inmodule Qt3DCore
- \brief The QRay3D class defines a directional line in 3D space extending through an origin point.
- \since 5.5
- \ingroup qt3d
- \ingroup qt3d::math
-
- A ray is defined by the origin() point and the direction() vector.
- Rays are infinite in length, extending out from origin() in
- both directions. If the direction() is zero length, then the
- behavior of the class is undefined.
-
- A ray can be thought of as a one-dimensional co-ordinate system.
- If the co-ordinate is \b t then the origin() point is at
- \b t = 0, the point origin() + direction() is at \b t = 1,
- and the point origin() - direction() is at \b t = -1.
- The point() method can be used to obtain the position of a point
- within this one-dimensional co-ordinate system. The projectedDistance()
- method can be used to convert a point into a value in this
- one-dimensional co-ordinate system.
-*/
-
-/*!
- \fn Qt3DCore::QRay3D::QRay3D()
-
- Construct a default ray with an origin() of (0, 0, 0), a
- direction() of (0, 0, 1) and a distance of 1.
-*/
-QRay3D::QRay3D()
- : m_direction(0.0f, 0.0f, 1.0f)
- , m_distance(1.0f)
-{
-}
-
-/*!
- \fn Qt3DCore::QRay3D::QRay3D(const QVector3D &origin, const QVector3D &direction, float distance)
-
- Construct a ray given its defining \a origin, \a direction and \a distance.
- The \a direction does not need to be normalized.
-
- To construct a ray that passes through two points, use the following:
-
- \code
- QRay3D thruAB(pointA, pointB - pointA);
- \endcode
-*/
-QRay3D::QRay3D(const QVector3D &origin, const QVector3D &direction, float distance)
- : m_origin(origin)
- , m_direction(direction)
- , m_distance(distance)
-{}
-
-QRay3D::~QRay3D()
-{
-}
-
-/*!
- \fn QVector3D Qt3DCore::QRay3D::origin() const
-
- Returns the origin of this ray. The default value is (0, 0, 0).
-
- \sa setOrigin(), direction()
-*/
-QVector3D QRay3D::origin() const
-{
- return m_origin;
-}
-
-/*!
- \fn void Qt3DCore::QRay3D::setOrigin(const QVector3D &value)
-
- Sets the origin point of this ray to \a value.
-
- \sa origin(), setDirection()
- */
-void QRay3D::setOrigin(const QVector3D &value)
-{
- m_origin = value;
-}
-
-/*!
- \fn QVector3D Qt3DCore::QRay3D::direction() const
-
- Returns the direction vector of this ray. The default value is (0, 0, 1).
-
- \sa setDirection(), origin()
-*/
-QVector3D QRay3D::direction() const
-{
- return m_direction;
-}
-
-/*!
- \fn void Qt3DCore::QRay3D::setDirection(const QVector3D &direction)
-
- Sets the direction vector of this ray to \a direction.
-
- \sa direction(), setOrigin()
-*/
-void QRay3D::setDirection(const QVector3D &value)
-{
- if (value.isNull())
- return;
-
- m_direction = value;
-}
-
-float QRay3D::distance() const
-{
- return m_distance;
-}
-
-void QRay3D::setDistance(float distance)
-{
- m_distance = distance;
-}
-
-QVector3D QRay3D::point(float t) const
-{
- return m_origin + t * m_direction;
-}
-
-QRay3D &QRay3D::transform(const QMatrix4x4 &matrix)
-{
- m_origin = matrix * m_origin;
- m_direction = matrix.mapVector(m_direction);
-
- return *this;
-}
-
-QRay3D QRay3D::transformed(const QMatrix4x4 &matrix) const
-{
- return QRay3D(matrix * m_origin, matrix.mapVector(m_direction));
-}
-
-bool QRay3D::operator==(const QRay3D &other) const
-{
- return m_origin == other.origin() && m_direction == other.direction();
-}
-
-bool QRay3D::operator!=(const QRay3D &other) const
-{
- return !(*this == other);
-}
-
-/*!
- Returns true if \a point lies on this ray; false otherwise.
-*/
-bool QRay3D::contains(const QVector3D &point) const
-{
- QVector3D ppVec(point - m_origin);
- if (ppVec.isNull()) // point coincides with origin
- return true;
- const float dot = QVector3D::dotProduct(ppVec, m_direction);
- if (qFuzzyIsNull(dot))
- return false;
- return qFuzzyCompare(dot*dot, ppVec.lengthSquared() * m_direction.lengthSquared());
-}
-
-/*!
- Returns true if \a ray lies on this ray; false otherwise. If true,
- this implies that the two rays are actually the same, but with
- different origin() points or an inverted direction().
-*/
-bool QRay3D::contains(const QRay3D &ray) const
-{
- const float dot = QVector3D::dotProduct(m_direction, ray.direction());
- if (!qFuzzyCompare(dot*dot, m_direction.lengthSquared() * ray.direction().lengthSquared()))
- return false;
- return contains(ray.origin());
-}
-
-/*!
- \fn QVector3D Qt3DCore::QRay3D::point(float t) const
-
- Returns the point on the ray defined by moving \a t units
- along the ray in the direction of the direction() vector.
- Note that \a t may be negative in which case the point returned
- will lie behind the origin() point with respect to the
- direction() vector.
-
- The units for \a t are defined by direction(). The return value
- is precisely origin() + t * direction().
-
- \sa projectedDistance(), distance()
-*/
-
-/*!
- Returns the number of direction() units along the ray from origin()
- to \a point. Essentially, this function computes the value t, where
- \a point = origin() + t * direction(). If \a point is not on the ray,
- then the closest point that is on the ray will be used instead.
-
- If the return value is positive, then \a point lies in front of
- the origin() with respect to the direction() vector. If the return
- value is negative, then \a point lies behind the origin() with
- respect to the direction() vector.
-
- \sa point(), project()
-*/
-float QRay3D::projectedDistance(const QVector3D &point) const
-{
- Q_ASSERT(!m_direction.isNull());
-
- return QVector3D::dotProduct(point - m_origin, m_direction) /
- m_direction.lengthSquared();
-}
-
-/*!
- Returns the projection of \a vector onto this ray. In the
- following diagram, the dotted line is the ray, and V is the
- \a vector. The return value will be the vector V':
-
- \image qray3d-project.png
-
- \sa projectedDistance()
-*/
-QVector3D QRay3D::project(const QVector3D &vector) const
-{
- QVector3D norm = m_direction.normalized();
- return QVector3D::dotProduct(vector, norm) * norm;
-}
-
-/*!
- Returns the minimum distance from this ray to \a point, or equivalently
- the length of a line perpendicular to this ray which passes through
- \a point. If \a point is on the ray, then this function will return zero.
-
- \sa point()
-*/
-float QRay3D::distance(const QVector3D &point) const
-{
- float t = projectedDistance(point);
- return (point - (m_origin + t * m_direction)).length();
-}
-
-/*!
- \fn QRay3D &Qt3DCore::QRay3D::transform(const QMatrix4x4 &matrix)
-
- Transforms this ray using \a matrix, replacing origin() and
- direction() with the transformed versions.
-
- \sa transformed()
-*/
-
-/*!
- \fn QRay3D Qt3DCore::QRay3D::transformed(const QMatrix4x4 &matrix) const
-
- Returns a new ray that is formed by transforming origin()
- and direction() using \a matrix.
-
- \sa transform()
-*/
-
-/*!
- \fn bool Qt3DCore::QRay3D::operator==(const QRay3D &other) const
-
- Returns \c true if this ray is the same as \a other; \c false otherwise.
-
- \sa operator!=()
-*/
-
-/*!
- \fn bool Qt3DCore::QRay3D::operator!=(const QRay3D &other) const
-
- Returns \c true if this ray is not the same as \a other; \c false otherwise.
-
- \sa operator==()
-*/
-
-/*!
- \fn bool qFuzzyCompare(const Qt3DCore::QRay3D &ray1, const Qt3DCore::QRay3D &ray2)
- \relates Qt3DCore::QRay3D
-
- Returns \c true if \a ray1 and \a ray2 are almost equal; \c false
- otherwise.
-*/
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, const QRay3D &ray)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QRay3D(origin("
- << ray.origin().x() << ", " << ray.origin().y() << ", "
- << ray.origin().z() << ") - direction("
- << ray.direction().x() << ", " << ray.direction().y() << ", "
- << ray.direction().z() << "))";
- return dbg;
-}
-
-#endif
-
-#ifndef QT_NO_DATASTREAM
-
-/*!
- \relates Qt3DCore::QRay3D
-
- Writes the given \a ray to the given \a stream and returns a
- reference to the stream.
-*/
-QDataStream &operator<<(QDataStream &stream, const QRay3D &ray)
-{
- stream << ray.origin();
- stream << ray.direction();
- return stream;
-}
-
-/*!
- \relates Qt3DCore::QRay3D
-
- Reads a 3D ray from the given \a stream into the given \a ray
- and returns a reference to the stream.
-*/
-QDataStream &operator>>(QDataStream &stream, QRay3D &ray)
-{
- QVector3D origin, direction;
- stream >> origin;
- stream >> direction;
- ray = QRay3D(origin, direction);
- return stream;
-}
-
-#endif // QT_NO_DATASTREAM
-
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
diff --git a/src/core/qray3d.h b/src/core/qray3d.h
deleted file mode 100644
index 8ddbbc400..000000000
--- a/src/core/qray3d.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_QRAY3D_H
-#define QT3DCORE_QRAY3D_H
-
-#include <Qt3DCore/qt3dcore_global.h>
-#include <QtGui/qvector3d.h>
-#include <QtGui/qmatrix4x4.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QT3DCORESHARED_EXPORT QRay3D
-{
-public:
- QRay3D();
- explicit QRay3D(const QVector3D &origin, const QVector3D &direction = QVector3D(0.0f, 0.0f, 1.0f), float distance = 1.0f);
- ~QRay3D();
-
- QVector3D origin() const;
- void setOrigin(const QVector3D &value);
-
- QVector3D direction() const;
- void setDirection(const QVector3D &value);
-
- float distance() const;
- void setDistance(float distance);
-
- bool contains(const QVector3D &point) const;
- bool contains(const QRay3D &ray) const;
-
- QVector3D point(float t) const;
- float projectedDistance(const QVector3D &point) const;
-
- QVector3D project(const QVector3D &vector) const;
-
- float distance(const QVector3D &point) const;
-
- QRay3D &transform(const QMatrix4x4 &matrix);
- QRay3D transformed(const QMatrix4x4 &matrix) const;
-
- bool operator==(const QRay3D &other) const;
- bool operator!=(const QRay3D &other) const;
-
-private:
- QVector3D m_origin;
- QVector3D m_direction;
- float m_distance;
-};
-
-#ifndef QT_NO_DEBUG_STREAM
-QT3DCORESHARED_EXPORT QDebug operator<<(QDebug dbg, const Qt3DCore::QRay3D &ray);
-#endif
-
-#ifndef QT_NO_DATASTREAM
-QT3DCORESHARED_EXPORT QDataStream &operator<<(QDataStream &stream, const Qt3DCore::QRay3D &ray);
-QT3DCORESHARED_EXPORT QDataStream &operator>>(QDataStream &stream, Qt3DCore::QRay3D &ray);
-#endif
-
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
-
-inline bool qFuzzyCompare(const Qt3DCore::QRay3D &ray1, const Qt3DCore::QRay3D &ray2)
-{
- return qFuzzyCompare(ray1.origin(), ray2.origin()) &&
- qFuzzyCompare(ray1.direction(), ray2.direction());
-}
-
-Q_DECLARE_METATYPE(Qt3DCore::QRay3D)
-
-#endif // QT3DCORE_QRAY3D_H
diff --git a/src/core/qscene.cpp b/src/core/qscene.cpp
index 920d46d66..42c3a2bc8 100644
--- a/src/core/qscene.cpp
+++ b/src/core/qscene.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -51,7 +54,7 @@ class QScenePrivate
public:
QScenePrivate(QAspectEngine *engine)
: m_engine(engine)
- , m_arbiter(Q_NULLPTR)
+ , m_arbiter(nullptr)
{
}
@@ -61,7 +64,6 @@ public:
QMultiHash<QNodeId, QObservableInterface *> m_observablesLookupTable;
QHash<QObservableInterface *, QNodeId> m_observableToUuid;
QLockableObserverInterface *m_arbiter;
- QHash<QNodeId, QNode *> m_clonesLookupTable;
mutable QReadWriteLock m_lock;
};
@@ -82,13 +84,13 @@ QAspectEngine *QScene::engine() const
}
// Called by any thread
-void QScene::addObservable(QObservableInterface *observable, const QNodeId &id)
+void QScene::addObservable(QObservableInterface *observable, QNodeId id)
{
Q_D(QScene);
QWriteLocker lock(&d->m_lock);
d->m_observablesLookupTable.insert(id, observable);
d->m_observableToUuid.insert(observable, id);
- if (d->m_arbiter != Q_NULLPTR)
+ if (d->m_arbiter != nullptr)
observable->setArbiter(d->m_arbiter);
}
@@ -96,44 +98,45 @@ void QScene::addObservable(QObservableInterface *observable, const QNodeId &id)
void QScene::addObservable(QNode *observable)
{
Q_D(QScene);
- if (observable != Q_NULLPTR) {
+ if (observable != nullptr) {
QWriteLocker lock(&d->m_lock);
d->m_nodeLookupTable.insert(observable->id(), observable);
- if (d->m_arbiter != Q_NULLPTR)
+ if (d->m_arbiter != nullptr)
observable->d_func()->setArbiter(d->m_arbiter);
}
}
// Called by any thread
-void QScene::removeObservable(QObservableInterface *observable, const QNodeId &id)
+void QScene::removeObservable(QObservableInterface *observable, QNodeId id)
{
Q_D(QScene);
QWriteLocker lock(&d->m_lock);
d->m_observablesLookupTable.remove(id, observable);
d->m_observableToUuid.remove(observable);
- observable->setArbiter(Q_NULLPTR);
+ observable->setArbiter(nullptr);
}
// Called by main thread
void QScene::removeObservable(QNode *observable)
{
Q_D(QScene);
- if (observable != Q_NULLPTR) {
+ if (observable != nullptr) {
QWriteLocker lock(&d->m_lock);
QNodeId nodeUuid = observable->id();
- QObservableList observables = d->m_observablesLookupTable.values(nodeUuid);
- Q_FOREACH (QObservableInterface *o, observables) {
- o->setArbiter(Q_NULLPTR);
- d->m_observableToUuid.remove(o);
+ const auto p = d->m_observablesLookupTable.equal_range(nodeUuid); // must be non-const equal_range to ensure p.second stays valid
+ auto it = p.first;
+ while (it != p.second) {
+ it.value()->setArbiter(nullptr);
+ d->m_observableToUuid.remove(it.value());
+ it = d->m_observablesLookupTable.erase(it);
}
- d->m_observablesLookupTable.remove(nodeUuid);
d->m_nodeLookupTable.remove(nodeUuid);
- observable->d_func()->setArbiter(Q_NULLPTR);
+ observable->d_func()->setArbiter(nullptr);
}
}
// Called by any thread
-QObservableList QScene::lookupObservables(const QNodeId &id) const
+QObservableList QScene::lookupObservables(QNodeId id) const
{
Q_D(const QScene);
QReadLocker lock(&d->m_lock);
@@ -141,7 +144,7 @@ QObservableList QScene::lookupObservables(const QNodeId &id) const
}
// Called by any thread
-QNode *QScene::lookupNode(const QNodeId &id) const
+QNode *QScene::lookupNode(QNodeId id) const
{
Q_D(const QScene);
QReadLocker lock(&d->m_lock);
@@ -154,7 +157,7 @@ QVector<QNode *> QScene::lookupNodes(const QVector<QNodeId> &ids) const
QReadLocker lock(&d->m_lock);
QVector<QNode *> nodes(ids.size());
int index = 0;
- Q_FOREACH (const QNodeId &id, ids)
+ for (QNodeId id : ids)
nodes[index++] = d->m_nodeLookupTable.value(id);
return nodes;
}
@@ -178,28 +181,32 @@ QLockableObserverInterface *QScene::arbiter() const
return d->m_arbiter;
}
-QList<QNodeId> QScene::entitiesForComponent(const QNodeId &id) const
+QVector<QNodeId> QScene::entitiesForComponent(QNodeId id) const
{
Q_D(const QScene);
QReadLocker lock(&d->m_lock);
- return d->m_componentToEntities.values(id);
+ QVector<QNodeId> result;
+ const auto p = d->m_componentToEntities.equal_range(id);
+ for (auto it = p.first; it != p.second; ++it)
+ result.push_back(*it);
+ return result;
}
-void QScene::addEntityForComponent(const QNodeId &componentUuid, const QNodeId &entityUuid)
+void QScene::addEntityForComponent(QNodeId componentUuid, QNodeId entityUuid)
{
Q_D(QScene);
QWriteLocker lock(&d->m_lock);
d->m_componentToEntities.insert(componentUuid, entityUuid);
}
-void QScene::removeEntityForComponent(const QNodeId &componentUuid, const QNodeId &entityUuid)
+void QScene::removeEntityForComponent(QNodeId componentUuid, QNodeId entityUuid)
{
Q_D(QScene);
QWriteLocker lock(&d->m_lock);
d->m_componentToEntities.remove(componentUuid, entityUuid);
}
-bool QScene::hasEntityForComponent(const QNodeId &componentUuid, const QNodeId &entityUuid)
+bool QScene::hasEntityForComponent(QNodeId componentUuid, QNodeId entityUuid)
{
Q_D(QScene);
QReadLocker lock(&d->m_lock);
diff --git a/src/core/qscene_p.h b/src/core/qscene_p.h
index e89a6f171..59c609de7 100644
--- a/src/core/qscene_p.h
+++ b/src/core/qscene_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,18 +68,18 @@ typedef QList<QObservableInterface *> QObservableList;
class QT3DCORE_PRIVATE_EXPORT QScene
{
public:
- QScene(QAspectEngine *engine = Q_NULLPTR);
+ QScene(QAspectEngine *engine = nullptr);
~QScene();
QAspectEngine *engine() const;
- void addObservable(QObservableInterface *observable, const QNodeId &id);
+ void addObservable(QObservableInterface *observable, QNodeId id);
void addObservable(QNode *observable);
- void removeObservable(QObservableInterface *observable, const QNodeId &id);
+ void removeObservable(QObservableInterface *observable, QNodeId id);
void removeObservable(QNode *observable);
- QObservableList lookupObservables(const QNodeId &id) const;
+ QObservableList lookupObservables(QNodeId id) const;
- QNode *lookupNode(const QNodeId &id) const;
+ QNode *lookupNode(QNodeId id) const;
QVector<QNode *> lookupNodes(const QVector<QNodeId> &ids) const;
QNodeId nodeIdFromObservable(QObservableInterface *observable) const;
@@ -84,10 +87,10 @@ public:
Qt3DCore::QLockableObserverInterface *arbiter() const;
// Component -> Entities
- QList<QNodeId> entitiesForComponent(const QNodeId &id) const;
- void addEntityForComponent(const QNodeId &componentUuid, const QNodeId &entityUuid);
- void removeEntityForComponent(const QNodeId &componentUuid, const QNodeId &entityUuid);
- bool hasEntityForComponent(const QNodeId &componentUuid, const QNodeId &entityUuid);
+ QVector<QNodeId> entitiesForComponent(QNodeId id) const;
+ void addEntityForComponent(QNodeId componentUuid, QNodeId entityUuid);
+ void removeEntityForComponent(QNodeId componentUuid, QNodeId entityUuid);
+ bool hasEntityForComponent(QNodeId componentUuid, QNodeId entityUuid);
private:
Q_DECLARE_PRIVATE(QScene)
diff --git a/src/core/qscenechange.cpp b/src/core/qscenechange.cpp
deleted file mode 100644
index a65980733..000000000
--- a/src/core/qscenechange.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscenechange.h"
-#include "qscenechange_p.h"
-#include <QDateTime>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-/*!
- \enum Qt3DCore::ChangeFlag
-
- The types of change that can be sent and received by Qt3D's change notification system.
-
- \value NodeCreated A new instance of a QNode subclass has been created.
- \value NodeAboutToBeDeleted A QNode is about to be deleted from the scene.
- \value NodeDeleted A QNode has been deleted.
- \value NodeUpdated A QNode property has been updated.
- \value NodeAdded A QNode has been added to the scene.
- \value NodeRemoved A QNode has been removed from the scene.
- \value ComponentAdded A QComponent has been added to a QEntity.
- \value ComponentRemoved A QComponent has been removed from a QEntity.
- \value AllChanges Allows an observer to monitor for any of the above changes.
-*/
-
-QSceneChangePrivate::QSceneChangePrivate()
- : q_ptr(Q_NULLPTR)
-{
-}
-
-QSceneChangePrivate::~QSceneChangePrivate()
-{
-}
-
-QSceneChange::QSceneChange(ChangeFlag type, ObservableType observableType, const QNodeId &subjectId, QSceneChange::Priority priority)
- : d_ptr(new QSceneChangePrivate)
-{
- d_ptr->q_ptr = this;
- Q_D(QSceneChange);
- d->m_type = type;
- d->m_priority = priority;
- d->m_timestamp = QDateTime::currentMSecsSinceEpoch();
- d->m_subjectId = subjectId;
- d->m_subjectType = observableType;
-}
-
-QSceneChange::~QSceneChange()
-{
- delete d_ptr;
-}
-
-/*! \internal */
-QSceneChange::QSceneChange(QSceneChangePrivate &dd)
- : d_ptr(&dd)
-{
- d_ptr->q_ptr = this;
-}
-
-/*! \internal */
-QSceneChange::QSceneChange(QSceneChangePrivate &dd, ChangeFlag type, ObservableType observableType, const QNodeId &subjectId, QSceneChange::Priority priority)
- : d_ptr(&dd)
-{
- d_ptr->q_ptr = this;
- Q_D(QSceneChange);
- d->m_type = type;
- d->m_priority = priority;
- d->m_timestamp = QDateTime::currentMSecsSinceEpoch();
- d->m_subjectId = subjectId;
- d->m_subjectType = observableType;
-}
-
-ChangeFlag QSceneChange::type() const
-{
- Q_D(const QSceneChange);
- return d->m_type;
-}
-
-QSceneChange::Priority QSceneChange::priority() const
-{
- Q_D(const QSceneChange);
- return d->m_priority;
-}
-
-qint64 QSceneChange::timestamp() const
-{
- Q_D(const QSceneChange);
- return d->m_timestamp;
-}
-
-QSceneChange::ObservableType QSceneChange::observableType() const
-{
- Q_D(const QSceneChange);
- return d->m_subjectType;
-}
-
-QNodeId QSceneChange::subjectId() const
-{
- Q_D(const QSceneChange);
- return d->m_subjectId;
-}
-
-} // Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/core/qscenechange.h b/src/core/qscenechange.h
deleted file mode 100644
index 9efa4e010..000000000
--- a/src/core/qscenechange.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_QSCENECHANGE_H
-#define QT3DCORE_QSCENECHANGE_H
-
-#include <Qt3DCore/qt3dcore_global.h>
-#include <QSharedPointer>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-enum ChangeFlag {
- NodeCreated = 1 << 0,
- NodeAboutToBeDeleted = 1 << 1,
- NodeDeleted = 1 << 2,
- NodeUpdated = 1 << 3,
- NodeAdded = 1 << 4,
- NodeRemoved = 1 << 5,
- ComponentAdded = 1 << 6,
- ComponentRemoved = 1 << 7,
- AllChanges = 0xFFFFFFFF
-};
-Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag)
-Q_DECLARE_OPERATORS_FOR_FLAGS(ChangeFlags)
-
-class QNode;
-class QObservableInterface;
-class QSceneChangePrivate;
-
-class QT3DCORESHARED_EXPORT QSceneChange
-{
-public:
- enum Priority {
- High,
- Standard,
- Low
- };
-
- enum ObservableType {
- Observable,
- Node
- };
-
- QSceneChange(ChangeFlag type, ObservableType observableType, const QNodeId &subjectId, Priority priority = Standard);
- virtual ~QSceneChange();
-
- ChangeFlag type() const;
- qint64 timestamp() const;
- QSceneChange::Priority priority() const;
- QSceneChange::ObservableType observableType() const;
- QNodeId subjectId() const;
-
-protected:
- Q_DECLARE_PRIVATE(QSceneChange)
- QSceneChangePrivate *d_ptr;
- QSceneChange(QSceneChangePrivate &dd);
- QSceneChange(QSceneChangePrivate &dd, ChangeFlag type, ObservableType observableType, const QNodeId &subjectId, Priority priority = Standard);
-
- // TODO: add timestamp from central clock and priority level
- // These can be used to resolve any conflicts between events
- // posted from different aspects
-};
-
-typedef QSharedPointer<QSceneChange> QSceneChangePtr;
-
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_QSCENECHANGE_H
diff --git a/src/core/qscenechange_p.h b/src/core/qscenechange_p.h
deleted file mode 100644
index b739fb770..000000000
--- a/src/core/qscenechange_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_QSCENECHANGE_P_H
-#define QT3DCORE_QSCENECHANGE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGlobal>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QSceneChange;
-class QNodeId;
-
-class QSceneChangePrivate
-{
-public :
- QSceneChangePrivate();
- virtual ~QSceneChangePrivate();
-
- Q_DECLARE_PUBLIC(QSceneChange)
-
- QSceneChange *q_ptr;
-
- QNodeId m_subjectId;
- QSceneChange::ObservableType m_subjectType;
- ChangeFlag m_type;
- QSceneChange::Priority m_priority;
- qint64 m_timestamp;
-};
-
-} // Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_QSCENECHANGE_P_H
diff --git a/src/core/qsceneobserverinterface.cpp b/src/core/qsceneobserverinterface.cpp
index f9b4556f2..784ff654e 100644
--- a/src/core/qsceneobserverinterface.cpp
+++ b/src/core/qsceneobserverinterface.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qsceneobserverinterface_p.h b/src/core/qsceneobserverinterface_p.h
index b3f632ffb..4cbe9e3f0 100644
--- a/src/core/qsceneobserverinterface_p.h
+++ b/src/core/qsceneobserverinterface_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qscenepropertychange.cpp b/src/core/qscenepropertychange.cpp
deleted file mode 100644
index 683e3c49d..000000000
--- a/src/core/qscenepropertychange.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qscenepropertychange.h"
-#include "qscenepropertychange_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-/*!
- \class Qt3DCore::QScenePropertyChange
- \inmodule Qt3DCore
-*/
-
-QScenePropertyChangePrivate::QScenePropertyChangePrivate()
- : QSceneChangePrivate()
-{
-}
-
-QScenePropertyChangePrivate::~QScenePropertyChangePrivate()
-{
-
-}
-
-QScenePropertyChange::QScenePropertyChange(ChangeFlag type, ObservableType observableType, const QNodeId &subjectId, QSceneChange::Priority priority)
- : QSceneChange(*new QScenePropertyChangePrivate, type, observableType, subjectId, priority)
-{
-}
-
-/*! \internal */
-QScenePropertyChange::QScenePropertyChange(QScenePropertyChangePrivate &dd)
- : QSceneChange(dd)
-{
-}
-
-/*! \internal */
-QScenePropertyChange::QScenePropertyChange(QScenePropertyChangePrivate &dd, ChangeFlag type, ObservableType observableType, const QNodeId &subjectId, QSceneChange::Priority priority)
- : QSceneChange(dd, type, observableType, subjectId, priority)
-{
-}
-
-QScenePropertyChange::~QScenePropertyChange()
-{
-}
-
-const char *QScenePropertyChange::propertyName() const
-{
- Q_D(const QScenePropertyChange);
- return d->m_propertyName;
-}
-
-QVariant QScenePropertyChange::value() const
-{
- Q_D(const QScenePropertyChange);
- return d->m_value;
-}
-
-void QScenePropertyChange::setPropertyName(const char *name)
-{
- Q_D(QScenePropertyChange);
- d->m_propertyName = name;
-}
-
-void QScenePropertyChange::setValue(const QVariant &value)
-{
- Q_D(QScenePropertyChange);
- d->m_value = value;
-}
-
-} // Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/core/qscenepropertychange.h b/src/core/qscenepropertychange.h
deleted file mode 100644
index 23552ad34..000000000
--- a/src/core/qscenepropertychange.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_QSCENEPROPERTYCHANGE_H
-#define QT3DCORE_QSCENEPROPERTYCHANGE_H
-
-#include <Qt3DCore/qscenechange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QScenePropertyChangePrivate;
-
-class QT3DCORESHARED_EXPORT QScenePropertyChange : public QSceneChange
-{
-public:
- QScenePropertyChange(ChangeFlag type, ObservableType observableType, const QNodeId &subjectId, Priority priority = Standard);
- virtual ~QScenePropertyChange();
-
- const char *propertyName() const;
- QVariant value() const;
-
- void setPropertyName(const char *name);
- void setValue(const QVariant &value);
-
-protected:
- Q_DECLARE_PRIVATE(QScenePropertyChange)
- QScenePropertyChange(QScenePropertyChangePrivate &dd);
- QScenePropertyChange(QScenePropertyChangePrivate &dd, ChangeFlag type, ObservableType observableType, const QNodeId &subjectId, Priority priority = Standard);
-};
-
-typedef QSharedPointer<QScenePropertyChange> QScenePropertyChangePtr;
-
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_QSCENEPROPERTYCHANGE_H
diff --git a/src/core/qscenepropertychange_p.h b/src/core/qscenepropertychange_p.h
deleted file mode 100644
index 55c934810..000000000
--- a/src/core/qscenepropertychange_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DCORE_QSCENEPROPERTYCHANGE_P_H
-#define QT3DCORE_QSCENEPROPERTYCHANGE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qscenechange_p.h>
-#include <QVariant>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QScenePropertyChange;
-
-class QScenePropertyChangePrivate : public QSceneChangePrivate
-{
-public:
- QScenePropertyChangePrivate();
- virtual ~QScenePropertyChangePrivate();
-
- Q_DECLARE_PUBLIC(QScenePropertyChange)
-
- /// FIXME: use QMetaProperty here once the NodeAboutToBeDeleted etc. change events
- /// get refactored to their own QSceneChange subclass
- const char *m_propertyName;
- QVariant m_value;
-};
-
-} // Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3DCORE_QSCENEPROPERTYCHANGE_P_H
diff --git a/src/core/qscheduler.cpp b/src/core/qscheduler.cpp
index b6b3dedc6..82b44a12f 100644
--- a/src/core/qscheduler.cpp
+++ b/src/core/qscheduler.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,6 +53,10 @@ QScheduler::QScheduler(QObject *parent)
{
}
+QScheduler::~QScheduler()
+{
+}
+
void QScheduler::setAspectManager(QAspectManager *aspectManager)
{
m_aspectManager = aspectManager;
@@ -70,8 +77,8 @@ void QScheduler::scheduleAndWaitForFrameAspectJobs(qint64 time)
// TODO: Set up dependencies between jobs as needed
// For now just queue them up as they are
- const QList<QAbstractAspect *> &aspects = m_aspectManager->aspects();
- Q_FOREACH (QAbstractAspect *aspect, aspects) {
+ const QVector<QAbstractAspect *> &aspects = m_aspectManager->aspects();
+ for (QAbstractAspect *aspect : aspects) {
QVector<QAspectJobPtr> aspectJobs = QAbstractAspectPrivate::get(aspect)->jobsToExecute(time);
jobQueue << aspectJobs;
}
diff --git a/src/core/qscheduler_p.h b/src/core/qscheduler_p.h
index 56bc70939..9d0f99ccb 100644
--- a/src/core/qscheduler_p.h
+++ b/src/core/qscheduler_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,6 +65,7 @@ class QScheduler : public QObject
Q_OBJECT
public:
explicit QScheduler(QObject *parent = 0);
+ ~QScheduler();
void setAspectManager(QAspectManager *aspectManager);
QAspectManager *aspectManager() const;
diff --git a/src/core/qt3dcore_global.h b/src/core/qt3dcore_global.h
index 53297712d..725df149b 100644
--- a/src/core/qt3dcore_global.h
+++ b/src/core/qt3dcore_global.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -51,6 +54,25 @@ QT_BEGIN_NAMESPACE
# define QT3DCORESHARED_EXPORT
#endif
+#define QT3D_DECLARE_TYPEINFO(NS, Class, Flags) \
+ } /* NS */ \
+ Q_DECLARE_TYPEINFO(NS :: Class, Flags); \
+ namespace NS { \
+ /*end*/
+
+#define QT3D_DECLARE_TYPEINFO_2(OuterNS, InnerNS, Class, Flags) \
+ } /* InnerNS */ \
+ QT3D_DECLARE_TYPEINFO(OuterNS, InnerNS :: Class, Flags) \
+ namespace InnerNS { \
+ /*end*/
+
+#define QT3D_DECLARE_SHARED(NS, Class) \
+ inline void swap(Class &lhs, Class &rhs) \
+ Q_DECL_NOEXCEPT_EXPR(noexcept(lhs.swap(rhs))) \
+ { lhs.swap(rhs); } \
+ QT3D_DECLARE_TYPEINFO(NS, Class, Q_MOVABLE_TYPE) \
+ /*end*/
+
QT_END_NAMESPACE
#endif // QT3DCORE_GLOBAL_H
diff --git a/src/core/qt3dcore_global_p.h b/src/core/qt3dcore_global_p.h
index fce51de04..e872844d7 100644
--- a/src/core/qt3dcore_global_p.h
+++ b/src/core/qt3dcore_global_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qtickclock.cpp b/src/core/qtickclock.cpp
index ad9063b3e..4dfb29f1b 100644
--- a/src/core/qtickclock.cpp
+++ b/src/core/qtickclock.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/qtickclock_p.h b/src/core/qtickclock_p.h
index bda4ef250..b19417173 100644
--- a/src/core/qtickclock_p.h
+++ b/src/core/qtickclock_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/resources/qboundedcircularbuffer_p.h b/src/core/resources/qboundedcircularbuffer_p.h
index cf05df44d..f879a4a6f 100644
--- a/src/core/resources/qboundedcircularbuffer_p.h
+++ b/src/core/resources/qboundedcircularbuffer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/resources/qcircularbuffer_p.h b/src/core/resources/qcircularbuffer_p.h
index 5cb2f24cb..08665f4b5 100644
--- a/src/core/resources/qcircularbuffer_p.h
+++ b/src/core/resources/qcircularbuffer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -72,7 +75,7 @@ class CircularBufferData : public QSharedData
{
protected:
CircularBufferData()
- : data(Q_NULLPTR),
+ : data(nullptr),
capacity(0),
size(0),
first(-1),
@@ -207,7 +210,7 @@ public:
typedef T *pointer;
typedef T &reference;
- Q_DECL_CONSTEXPR iterator() : buffer(Q_NULLPTR), index(-1) {}
+ Q_DECL_CONSTEXPR iterator() : buffer(nullptr), index(-1) {}
iterator(QCircularBuffer<T> *buf, int idx)
: buffer(buf), index(idx)
{}
@@ -292,7 +295,7 @@ public:
typedef const T *pointer;
typedef const T &reference;
- Q_DECL_CONSTEXPR const_iterator() : buffer(Q_NULLPTR), index(-1) {}
+ Q_DECL_CONSTEXPR const_iterator() : buffer(nullptr), index(-1) {}
const_iterator(const QCircularBuffer<T> *buff, int idx)
: buffer(buff), index(idx)
{}
@@ -460,7 +463,7 @@ public:
{
d.detach();
if (d->size == 0)
- return array_range(Q_NULLPTR, 0);
+ return array_range(nullptr, 0);
if (!isLinearised())
linearise();
return array_range(d->data() + d->first, d->last - d->first + 1);
@@ -469,7 +472,7 @@ public:
const_array_range constData() const
{
if (!isLinearised() || d->size == 0)
- return const_array_range(Q_NULLPTR, 0);
+ return const_array_range(nullptr, 0);
return const_array_range(d->data() + d->first, d->last - d->first + 1);
}
@@ -477,7 +480,7 @@ public:
{
d.detach();
if (d->size == 0)
- return array_range(Q_NULLPTR, 0);
+ return array_range(nullptr, 0);
if (isLinearised())
return array_range(d->data() + d->first, d->last - d->first + 1);
else
@@ -487,7 +490,7 @@ public:
const_array_range constDataOne() const
{
if (d->size == 0)
- return const_array_range(Q_NULLPTR, 0);
+ return const_array_range(nullptr, 0);
if (isLinearised())
return const_array_range(d->data() + d->first, d->last - d->first + 1);
else
@@ -498,14 +501,14 @@ public:
{
d.detach();
if (d->size == 0 || isLinearised())
- return array_range(Q_NULLPTR, 0);
+ return array_range(nullptr, 0);
return array_range(d->data(), d->last + 1);
}
const_array_range dataTwo() const { return constDataTwo(); }
const_array_range constDataTwo() const
{
if (d->size == 0 || isLinearised())
- return const_array_range(Q_NULLPTR, 0);
+ return const_array_range(nullptr, 0);
return const_array_range(d->data(), d->last + 1);
}
diff --git a/src/core/resources/qframeallocator.cpp b/src/core/resources/qframeallocator.cpp
index d2527000d..ff15dadf6 100644
--- a/src/core/resources/qframeallocator.cpp
+++ b/src/core/resources/qframeallocator.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -107,7 +110,7 @@ int QFrameAllocator::allocatorPoolSize() const
bool QFrameAllocator::isEmpty() const
{
Q_D(const QFrameAllocator);
- Q_FOREACH (const QFixedFrameAllocator &allocator, d->m_allocatorPool) {
+ for (const QFixedFrameAllocator &allocator : d->m_allocatorPool) {
if (!allocator.isEmpty())
return false;
}
@@ -118,7 +121,7 @@ uint QFrameAllocator::totalChunkCount() const
{
Q_D(const QFrameAllocator);
uint chunkCount = 0;
- foreach (const QFixedFrameAllocator& allocator, d->m_allocatorPool)
+ for (const QFixedFrameAllocator& allocator : d->m_allocatorPool)
chunkCount += allocator.chunkCount();
return chunkCount;
}
@@ -126,8 +129,8 @@ uint QFrameAllocator::totalChunkCount() const
QFixedFrameAllocator::QFixedFrameAllocator()
: m_blockSize(0)
, m_nbrBlock(0)
- , m_lastAllocatedChunck(Q_NULLPTR)
- , m_lastFreedChunck(Q_NULLPTR)
+ , m_lastAllocatedChunck(nullptr)
+ , m_lastFreedChunck(nullptr)
{
}
@@ -145,7 +148,7 @@ void QFixedFrameAllocator::init(uint blockSize, uchar pageSize)
void *QFixedFrameAllocator::allocate()
{
Q_ASSERT(m_blockSize && m_nbrBlock);
- if (m_lastAllocatedChunck == Q_NULLPTR ||
+ if (m_lastAllocatedChunck == nullptr ||
m_lastAllocatedChunck->m_blocksAvailable == 0) {
int i = 0;
for (; i < m_chunks.size(); i++) {
@@ -168,8 +171,8 @@ void *QFixedFrameAllocator::allocate()
void QFixedFrameAllocator::deallocate(void *ptr)
{
Q_ASSERT(m_blockSize && m_nbrBlock);
- if (!m_chunks.empty() && ptr != Q_NULLPTR) {
- if (m_lastFreedChunck != Q_NULLPTR && m_lastFreedChunck->contains(ptr, m_blockSize))
+ if (!m_chunks.empty() && ptr != nullptr) {
+ if (m_lastFreedChunck != nullptr && m_lastFreedChunck->contains(ptr, m_blockSize))
m_lastFreedChunck->deallocate(ptr, m_blockSize);
else {
for (int i = 0; i < m_chunks.size(); i++) {
@@ -189,9 +192,9 @@ void QFixedFrameAllocator::trim()
if (m_chunks.at(i).isEmpty()) {
m_chunks[i].release();
if (m_lastAllocatedChunck == &m_chunks[i])
- m_lastAllocatedChunck = Q_NULLPTR;
+ m_lastAllocatedChunck = nullptr;
if (m_lastFreedChunck == &m_chunks[i])
- m_lastAllocatedChunck = Q_NULLPTR;
+ m_lastFreedChunck = nullptr;
m_chunks.removeAt(i);
}
}
@@ -202,8 +205,8 @@ void QFixedFrameAllocator::release()
for (int i = m_chunks.size() - 1; i >= 0; i--)
m_chunks[i].release();
m_chunks.clear();
- m_lastAllocatedChunck = Q_NULLPTR;
- m_lastFreedChunck = Q_NULLPTR;
+ m_lastAllocatedChunck = nullptr;
+ m_lastFreedChunck = nullptr;
}
// Allows to reuse chunks without having to reinitialize and reallocate them
@@ -215,7 +218,7 @@ void QFixedFrameAllocator::clear()
bool QFixedFrameAllocator::isEmpty() const
{
- Q_FOREACH (const QFrameChunk &chunck, m_chunks) {
+ for (const QFrameChunk &chunck : m_chunks) {
if (chunck.m_blocksAvailable != chunck.m_maxBlocksAvailable)
return false;
}
@@ -245,7 +248,7 @@ void QFrameChunk::init(uint blockSize, uchar blocks)
void *QFrameChunk::allocate(uint blockSize)
{
if (m_blocksAvailable == 0)
- return Q_NULLPTR;
+ return nullptr;
uchar *r = m_data + (m_firstAvailableBlock * blockSize);
m_firstAvailableBlock = *r;
--m_blocksAvailable;
diff --git a/src/core/resources/qframeallocator_p.h b/src/core/resources/qframeallocator_p.h
index 01006c5ca..cd0fa504c 100644
--- a/src/core/resources/qframeallocator_p.h
+++ b/src/core/resources/qframeallocator_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/resources/qframeallocator_p_p.h b/src/core/resources/qframeallocator_p_p.h
index 3e6cdf4d8..b49def87a 100644
--- a/src/core/resources/qframeallocator_p_p.h
+++ b/src/core/resources/qframeallocator_p_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/resources/qhandle_p.h b/src/core/resources/qhandle_p.h
index 6952c54e3..fd36c4847 100644
--- a/src/core/resources/qhandle_p.h
+++ b/src/core/resources/qhandle_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -124,7 +127,11 @@ QDebug operator<<(QDebug dbg, const QHandle<T, INDEXBITS> &h)
return dbg;
}
-} // Qt3D
+} // Qt3DCore
+
+template <typename T, uint I>
+class QTypeInfo<Qt3DCore::QHandle<T,I> > // simpler than fighting the Q_DECLARE_TYPEINFO macro
+ : public QTypeInfoMerger<Qt3DCore::QHandle<T,I>, quint32> {};
QT_END_NAMESPACE
diff --git a/src/core/resources/qhandlemanager_p.h b/src/core/resources/qhandlemanager_p.h
index e37dedff0..61e87ba1e 100644
--- a/src/core/resources/qhandlemanager_p.h
+++ b/src/core/resources/qhandlemanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,6 +61,14 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
+#ifndef QT_NO_DEBUG_STREAM
+template <typename T, uint INDEXBITS>
+class QHandleManager;
+
+template <typename T, uint INDEXBITS = 16>
+QDebug operator<<(QDebug dbg, const QHandleManager<T, INDEXBITS> &manager);
+#endif
+
template <typename T, uint INDEXBITS = 16>
class QHandleManager
{
@@ -82,11 +93,13 @@ public:
private:
Q_DISABLE_COPY(QHandleManager)
+ friend QDebug operator<< <>(QDebug dbg, const QHandleManager<T, INDEXBITS> &manager);
+
template <typename U>
struct HandleEntry
{
HandleEntry()
- : m_data(Q_NULLPTR)
+ : m_data(nullptr)
, m_nextFreeIndex(0)
, m_counter(0)
, m_active(false)
@@ -94,7 +107,7 @@ private:
{}
explicit HandleEntry(quint32 nextFreeIndex)
- : m_data(Q_NULLPTR)
+ : m_data(nullptr)
, m_nextFreeIndex(nextFreeIndex)
, m_counter(0)
, m_active(false)
@@ -182,7 +195,7 @@ T *QHandleManager<T, INDEXBITS>::data(const QHandle<T, INDEXBITS> &handle, bool
m_entries[index].m_active == false) {
if (ok)
*ok = false;
- return Q_NULLPTR;
+ return nullptr;
}
T *d = m_entries[index].m_data;
@@ -199,7 +212,7 @@ const T *QHandleManager<T, INDEXBITS>::constData(const QHandle<T, INDEXBITS> &ha
m_entries[index].m_active == false) {
if (ok)
*ok = false;
- return Q_NULLPTR;
+ return nullptr;
}
const T *d = m_entries[index].m_data;
@@ -208,6 +221,28 @@ const T *QHandleManager<T, INDEXBITS>::constData(const QHandle<T, INDEXBITS> &ha
return d;
}
+#ifndef QT_NO_DEBUG_STREAM
+template <typename T, uint INDEXBITS>
+QDebug operator<<(QDebug dbg, const QHandleManager<T, INDEXBITS> &manager)
+{
+ QDebugStateSaver saver(dbg);
+ dbg << "First free entry =" << manager.m_firstFreeEntry << endl;
+
+ const auto end = manager.m_entries.cend();
+ const auto max = manager.m_activeEntryCount;
+ auto i = 0;
+ for (auto it = manager.m_entries.cbegin(); it != end && i < max; ++it) {
+ const auto isActive = it->m_active;
+ if (isActive) {
+ dbg << *(it->m_data);
+ ++i;
+ }
+ }
+
+ return dbg;
+}
+#endif
+
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/core/resources/qresourcemanager.cpp b/src/core/resources/qresourcemanager.cpp
index b71a1c20b..f13960940 100644
--- a/src/core/resources/qresourcemanager.cpp
+++ b/src/core/resources/qresourcemanager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h
index 917f0ba08..4a6001a59 100644
--- a/src/core/resources/qresourcemanager_p.h
+++ b/src/core/resources/qresourcemanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,6 +52,8 @@
//
#include <QtGlobal>
+#include <QReadWriteLock>
+#include <QReadLocker>
#include <QMutex>
#include <QHash>
#include <Qt3DCore/qt3dcore_global.h>
@@ -62,6 +67,20 @@ namespace Qt3DCore {
template <class Host>
struct NonLockingPolicy
{
+ struct ReadLocker
+ {
+ ReadLocker(const NonLockingPolicy*) {}
+ void unlock() {}
+ void relock() {}
+ };
+
+ struct WriteLocker
+ {
+ WriteLocker(const NonLockingPolicy*) {}
+ void unlock() {}
+ void relock() {}
+ };
+
struct Locker
{
Locker(const NonLockingPolicy*) {}
@@ -77,6 +96,48 @@ public :
ObjectLevelLockingPolicy()
{}
+ class ReadLocker
+ {
+ public:
+ ReadLocker(const ObjectLevelLockingPolicy *host)
+ : m_locker(&host->m_readWritelock)
+ { }
+
+ void unlock()
+ {
+ m_locker.unlock();
+ }
+
+ void relock()
+ {
+ m_locker.relock();
+ }
+
+ private:
+ QReadLocker m_locker;
+ };
+
+ class WriteLocker
+ {
+ public:
+ WriteLocker(const ObjectLevelLockingPolicy *host)
+ : m_locker(&host->m_readWritelock)
+ { }
+
+ void unlock()
+ {
+ m_locker.unlock();
+ }
+
+ void relock()
+ {
+ m_locker.relock();
+ }
+
+ private:
+ QWriteLocker m_locker;
+ };
+
class Locker
{
public:
@@ -100,6 +161,9 @@ public :
private:
friend class Locker;
+ friend class ReadLocker;
+ friend class WriteLocker;
+ mutable QReadWriteLock m_readWritelock;
mutable QMutex m_lock;
};
@@ -174,7 +238,7 @@ public:
m_bucketDataPtrs[bucketIdx] = static_cast<T*>(malloc(sizeof(T) * BucketSize));
// ### memset is only needed as long as we also use this for primitive types (see FrameGraphManager)
// ### remove once this is fixed, add a static_assert on T instead
- memset((void *)m_bucketDataPtrs[bucketIdx], 0, sizeof(T) * BucketSize);
+ memset((void*) m_bucketDataPtrs[bucketIdx], 0, sizeof(T) * BucketSize);
++m_numBuckets;
}
@@ -295,7 +359,7 @@ public:
private:
enum {
- MaxSize = 1 << INDEXBITS
+ MaxSize = 1 << INDEXBITS
};
QVector<T> m_bucket;
@@ -311,117 +375,161 @@ private:
};
-template <typename T, typename C, uint INDEXBITS = 16,
+#ifndef QT_NO_DEBUG_STREAM
+template <typename ValueType, typename KeyType, uint INDEXBITS,
+ template <typename, uint> class AllocatingPolicy,
+ template <class> class LockingPolicy
+ >
+class QResourceManager;
+
+template <typename ValueType, typename KeyType, uint INDEXBITS = 16,
+ template <typename, uint> class AllocatingPolicy = ArrayAllocatingPolicy,
+ template <class> class LockingPolicy = NonLockingPolicy
+ >
+QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, AllocatingPolicy, LockingPolicy> &manager);
+#endif
+
+template <typename ValueType, typename KeyType, uint INDEXBITS = 16,
template <typename, uint> class AllocatingPolicy = ArrayAllocatingPolicy,
template <class> class LockingPolicy = NonLockingPolicy
>
class QResourceManager
- : public AllocatingPolicy<T, INDEXBITS>
- , public LockingPolicy< QResourceManager<T, C, INDEXBITS, AllocatingPolicy, LockingPolicy> >
+ : public AllocatingPolicy<ValueType, INDEXBITS>
+ , public LockingPolicy< QResourceManager<ValueType, KeyType, INDEXBITS, AllocatingPolicy, LockingPolicy> >
{
public:
QResourceManager() :
- AllocatingPolicy<T, INDEXBITS>(),
- m_maxResourcesEntries((1 << INDEXBITS) - 1)
+ AllocatingPolicy<ValueType, INDEXBITS>(),
+ m_maxSize((1 << INDEXBITS) - 1)
{
}
~QResourceManager()
{}
- QHandle<T, INDEXBITS> acquire()
+ QHandle<ValueType, INDEXBITS> acquire()
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
- QHandle<T, INDEXBITS> handle = m_handleManager.acquire(AllocatingPolicy<T, INDEXBITS>::allocateResource());
+ typename LockingPolicy<QResourceManager>::WriteLocker lock(this);
+ QHandle<ValueType, INDEXBITS> handle = m_handleManager.acquire(AllocatingPolicy<ValueType, INDEXBITS>::allocateResource());
return handle;
}
- T* data(const QHandle<T, INDEXBITS> &handle)
+ ValueType* data(const QHandle<ValueType, INDEXBITS> &handle)
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
- T* d = m_handleManager.data(handle);
+ typename LockingPolicy<QResourceManager>::ReadLocker lock(this);
+ ValueType* d = m_handleManager.data(handle);
return d;
}
- void release(const QHandle<T, INDEXBITS> &handle)
+ void release(const QHandle<ValueType, INDEXBITS> &handle)
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
+ typename LockingPolicy<QResourceManager>::WriteLocker lock(this);
releaseLocked(handle);
}
void reset()
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
+ typename LockingPolicy<QResourceManager>::WriteLocker lock(this);
m_handleManager.reset();
- AllocatingPolicy<T, INDEXBITS>::reset();
+ AllocatingPolicy<ValueType, INDEXBITS>::reset();
}
- bool contains(const C &id) const
+ bool contains(const KeyType &id) const
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
- return m_handleToResourceMapper.contains(id);
+ typename LockingPolicy<QResourceManager>::ReadLocker lock(this);
+ return m_keyToHandleMap.contains(id);
}
- QHandle<T, INDEXBITS> getOrAcquireHandle(const C &id)
+ QHandle<ValueType, INDEXBITS> getOrAcquireHandle(const KeyType &id)
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
- QHandle<T, INDEXBITS> &handle = m_handleToResourceMapper[id];
- if (handle.isNull())
- handle = m_handleManager.acquire(AllocatingPolicy<T, INDEXBITS>::allocateResource());
+ typename LockingPolicy<QResourceManager>::ReadLocker lock(this);
+ QHandle<ValueType, INDEXBITS> handle = m_keyToHandleMap.value(id);
+ if (handle.isNull()) {
+ lock.unlock();
+ typename LockingPolicy<QResourceManager>::WriteLocker writeLock(this);
+ // Test that the handle hasn't been set (in the meantime between the read unlock and the write lock)
+ QHandle<ValueType, INDEXBITS> &handleToSet = m_keyToHandleMap[id];
+ if (handleToSet.isNull())
+ handleToSet = m_handleManager.acquire(AllocatingPolicy<ValueType, INDEXBITS>::allocateResource());
+ return handleToSet;
+ }
return handle;
}
- QHandle<T, INDEXBITS> lookupHandle(const C &id)
+ QHandle<ValueType, INDEXBITS> lookupHandle(const KeyType &id)
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
- return m_handleToResourceMapper.value(id);
+ typename LockingPolicy<QResourceManager>::ReadLocker lock(this);
+ return m_keyToHandleMap.value(id);
}
- T *lookupResource(const C &id)
+ ValueType *lookupResource(const KeyType &id)
{
- T* ret = Q_NULLPTR;
+ ValueType* ret = nullptr;
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
- QHandle<T, INDEXBITS> handle = m_handleToResourceMapper.value(id);
+ typename LockingPolicy<QResourceManager>::ReadLocker lock(this);
+ QHandle<ValueType, INDEXBITS> handle = m_keyToHandleMap.value(id);
if (!handle.isNull())
ret = m_handleManager.data(handle);
}
return ret;
}
- T *getOrCreateResource(const C &id)
+ ValueType *getOrCreateResource(const KeyType &id)
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
- QHandle<T, INDEXBITS> &handle = m_handleToResourceMapper[id];
- if (handle.isNull())
- handle = m_handleManager.acquire(AllocatingPolicy<T, INDEXBITS>::allocateResource());
+ const QHandle<ValueType, INDEXBITS> handle = getOrAcquireHandle(id);
+ typename LockingPolicy<QResourceManager>::ReadLocker lock(this);
return m_handleManager.data(handle);
}
- void releaseResource(const C &id)
+ void releaseResource(const KeyType &id)
{
- typename LockingPolicy<QResourceManager>::Locker lock(this);
- QHandle<T, INDEXBITS> handle = m_handleToResourceMapper.take(id);
+ typename LockingPolicy<QResourceManager>::WriteLocker lock(this);
+ QHandle<ValueType, INDEXBITS> handle = m_keyToHandleMap.take(id);
if (!handle.isNull())
releaseLocked(handle);
}
- int maxResourcesEntries() const { return m_maxResourcesEntries; }
+ int maximumSize() const { return m_maxSize; }
+
+ int count() const Q_DECL_NOEXCEPT { return m_handleManager.activeEntries(); }
protected:
- QHandleManager<T, INDEXBITS> m_handleManager;
- QHash<C, QHandle<T, INDEXBITS> > m_handleToResourceMapper;
- int m_maxResourcesEntries;
+ QHandleManager<ValueType, INDEXBITS> m_handleManager;
+ QHash<KeyType, QHandle<ValueType, INDEXBITS> > m_keyToHandleMap;
+ const int m_maxSize;
private:
- void releaseLocked(const QHandle<T, INDEXBITS> &handle)
+ void releaseLocked(const QHandle<ValueType, INDEXBITS> &handle)
{
- T *val = m_handleManager.data(handle);
+ ValueType *val = m_handleManager.data(handle);
m_handleManager.release(handle);
- AllocatingPolicy<T, INDEXBITS>::releaseResource(val);
+ AllocatingPolicy<ValueType, INDEXBITS>::releaseResource(val);
}
+
+ friend QDebug operator<< <>(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, AllocatingPolicy, LockingPolicy> &manager);
};
+#ifndef QT_NO_DEBUG_STREAM
+template <typename ValueType, typename KeyType, uint INDEXBITS,
+ template <typename, uint> class AllocatingPolicy,
+ template <class> class LockingPolicy
+ >
+QDebug operator<<(QDebug dbg, const QResourceManager<ValueType, KeyType, INDEXBITS, AllocatingPolicy, LockingPolicy> &manager)
+{
+ QDebugStateSaver saver(dbg);
+ dbg << "Contains" << manager.count() << "items" << "of a maximum" << manager.maximumSize() << endl;
+
+ dbg << "Key to Handle Map:" << endl;
+ const auto end = manager.m_keyToHandleMap.cend();
+ for (auto it = manager.m_keyToHandleMap.cbegin(); it != end; ++it)
+ dbg << "QNodeId =" << it.key() << "Handle =" << it.value() << endl;
+
+ dbg << "Resources:" << endl;
+ dbg << manager.m_handleManager;
+ return dbg;
+}
+#endif
+
}// Qt3D
QT_END_NAMESPACE
diff --git a/src/core/services/nullservices_p.h b/src/core/services/nullservices_p.h
index 5f395a2e2..ed7bd3a39 100644
--- a/src/core/services/nullservices_p.h
+++ b/src/core/services/nullservices_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,7 +52,6 @@
//
#include <Qt3DCore/qt3dcore_global.h>
-#include <Qt3DCore/qray3d.h>
#include "qopenglinformationservice_p.h"
#include "qsysteminformationservice_p.h"
diff --git a/src/core/services/qabstractframeadvanceservice.cpp b/src/core/services/qabstractframeadvanceservice.cpp
index f282f34e7..15bf46afa 100644
--- a/src/core/services/qabstractframeadvanceservice.cpp
+++ b/src/core/services/qabstractframeadvanceservice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qabstractframeadvanceservice_p.h b/src/core/services/qabstractframeadvanceservice_p.h
index 4f49022be..2dde68f06 100644
--- a/src/core/services/qabstractframeadvanceservice_p.h
+++ b/src/core/services/qabstractframeadvanceservice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qabstractframeadvanceservice_p_p.h b/src/core/services/qabstractframeadvanceservice_p_p.h
index 74a1ed6a4..d73ca3116 100644
--- a/src/core/services/qabstractframeadvanceservice_p_p.h
+++ b/src/core/services/qabstractframeadvanceservice_p_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qabstractserviceprovider_p.h b/src/core/services/qabstractserviceprovider_p.h
index a75a42598..2913cee31 100644
--- a/src/core/services/qabstractserviceprovider_p.h
+++ b/src/core/services/qabstractserviceprovider_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qeventfilterservice.cpp b/src/core/services/qeventfilterservice.cpp
index f8607e761..c5aa13ce1 100644
--- a/src/core/services/qeventfilterservice.cpp
+++ b/src/core/services/qeventfilterservice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire (paul.lemire350@gmail.com)
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,39 +45,33 @@
QT_BEGIN_NAMESPACE
-namespace Qt3DCore {
-
namespace {
+ struct FilterPriorityPair
+ {
+ QObject *filter;
+ int priority;
+ };
-struct FilterPriorityPair
-{
- QObject *filter;
- int priority;
-};
+ bool operator <(const FilterPriorityPair &a, const FilterPriorityPair &b)
+ {
+ return a.priority < b.priority;
+ }
+}
-bool operator <(const FilterPriorityPair &a, const FilterPriorityPair &b)
-{
- return a.priority < b.priority;
+Q_DECLARE_TYPEINFO(FilterPriorityPair, Q_PRIMITIVE_TYPE);
+
+namespace Qt3DCore {
+
+namespace {
+ class InternalEventListener;
}
-class InternalEventListener : public QObject
+class QEventFilterServicePrivate : public QAbstractServiceProviderPrivate
{
- Q_OBJECT
public:
- explicit InternalEventListener(QObject *parent = Q_NULLPTR)
- : QObject(parent)
- {
- }
-
- bool eventFilter(QObject *obj, QEvent *e) Q_DECL_FINAL
- {
- for (int i = m_eventFilters.size() - 1; i >= 0; --i) {
- const FilterPriorityPair &fPPair = m_eventFilters.at(i);
- if (fPPair.filter->eventFilter(obj, e))
- return true;
- }
- return false;
- }
+ QEventFilterServicePrivate()
+ : QAbstractServiceProviderPrivate(QServiceLocator::EventFilterService, QStringLiteral("Default event filter service implementation"))
+ {}
void registerEventFilter(QObject *eventFilter, int priority)
{
@@ -102,22 +99,37 @@ public:
}
}
-private:
+ QScopedPointer<InternalEventListener> m_eventDispatcher;
QVector<FilterPriorityPair> m_eventFilters;
};
-} // anonymous
+namespace {
-class QEventFilterServicePrivate : public QAbstractServiceProviderPrivate
+class InternalEventListener : public QObject
{
+ Q_OBJECT
public:
- QEventFilterServicePrivate()
- : QAbstractServiceProviderPrivate(QServiceLocator::EventFilterService, QStringLiteral("Default event filter service implementation"))
- {}
+ explicit InternalEventListener(QEventFilterServicePrivate *filterService, QObject *parent = nullptr)
+ : QObject(parent)
+ , m_filterService(filterService)
+ {
+ }
- QScopedPointer<InternalEventListener> m_eventDispatcher;
+ bool eventFilter(QObject *obj, QEvent *e) Q_DECL_FINAL
+ {
+ for (int i = m_filterService->m_eventFilters.size() - 1; i >= 0; --i) {
+ const FilterPriorityPair &fPPair = m_filterService->m_eventFilters.at(i);
+ if (fPPair.filter->eventFilter(obj, e))
+ return true;
+ }
+ return false;
+ }
+
+ QEventFilterServicePrivate* m_filterService;
};
+} // anonymous
+
/* !\internal
\class Qt3DCore::QEventFilterService
@@ -144,24 +156,24 @@ QEventFilterService::~QEventFilterService()
void QEventFilterService::initialize(QObject *eventSource)
{
Q_D(QEventFilterService);
- d->m_eventDispatcher.reset(new InternalEventListener());
- eventSource->installEventFilter(d->m_eventDispatcher.data());
+ if (eventSource == nullptr) {
+ d->m_eventDispatcher.reset();
+ } else {
+ d->m_eventDispatcher.reset(new InternalEventListener(d));
+ eventSource->installEventFilter(d->m_eventDispatcher.data());
+ }
}
void QEventFilterService::registerEventFilter(QObject *eventFilter, int priority)
{
Q_D(QEventFilterService);
- if (!d->m_eventDispatcher)
- return;
- d->m_eventDispatcher->registerEventFilter(eventFilter, priority);
+ d->registerEventFilter(eventFilter, priority);
}
void QEventFilterService::unregisterEventFilter(QObject *eventFilter)
{
Q_D(QEventFilterService);
- if (!d->m_eventDispatcher)
- return;
- d->m_eventDispatcher->unregisterEventFilter(eventFilter);
+ d->unregisterEventFilter(eventFilter);
}
} // Qt3DCore
diff --git a/src/core/services/qeventfilterservice_p.h b/src/core/services/qeventfilterservice_p.h
index 53b45ca8a..14ffd16fa 100644
--- a/src/core/services/qeventfilterservice_p.h
+++ b/src/core/services/qeventfilterservice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire (paul.lemire350@gmail.com)
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qopenglinformationservice.cpp b/src/core/services/qopenglinformationservice.cpp
index 2e5fa5780..0f62544c8 100644
--- a/src/core/services/qopenglinformationservice.cpp
+++ b/src/core/services/qopenglinformationservice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qopenglinformationservice_p.h b/src/core/services/qopenglinformationservice_p.h
index 4c5c933b8..a2c37c29a 100644
--- a/src/core/services/qopenglinformationservice_p.h
+++ b/src/core/services/qopenglinformationservice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qopenglinformationservice_p_p.h b/src/core/services/qopenglinformationservice_p_p.h
index 98750b9d5..4abef6f18 100644
--- a/src/core/services/qopenglinformationservice_p_p.h
+++ b/src/core/services/qopenglinformationservice_p_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qservicelocator.cpp b/src/core/services/qservicelocator.cpp
index aa073933f..3d3d56386 100644
--- a/src/core/services/qservicelocator.cpp
+++ b/src/core/services/qservicelocator.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -242,7 +245,7 @@ QAbstractServiceProvider *QServiceLocator::_q_getServiceHelper(int type)
case EventFilterService:
return eventFilterService();
default:
- return d->m_services.value(type, Q_NULLPTR);
+ return d->m_services.value(type, nullptr);
}
}
diff --git a/src/core/services/qservicelocator_p.h b/src/core/services/qservicelocator_p.h
index 7eae5622a..c68b56ffd 100644
--- a/src/core/services/qservicelocator_p.h
+++ b/src/core/services/qservicelocator_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qsysteminformationservice.cpp b/src/core/services/qsysteminformationservice.cpp
index 17a2feff9..f11e0c3d1 100644
--- a/src/core/services/qsysteminformationservice.cpp
+++ b/src/core/services/qsysteminformationservice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qsysteminformationservice_p.h b/src/core/services/qsysteminformationservice_p.h
index 1e4a8bb2a..dc384fb93 100644
--- a/src/core/services/qsysteminformationservice_p.h
+++ b/src/core/services/qsysteminformationservice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qsysteminformationservice_p_p.h b/src/core/services/qsysteminformationservice_p_p.h
index df68ab860..897caf62b 100644
--- a/src/core/services/qsysteminformationservice_p_p.h
+++ b/src/core/services/qsysteminformationservice_p_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qtickclockservice.cpp b/src/core/services/qtickclockservice.cpp
index 6899ddf8a..3691959ed 100644
--- a/src/core/services/qtickclockservice.cpp
+++ b/src/core/services/qtickclockservice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/services/qtickclockservice_p.h b/src/core/services/qtickclockservice_p.h
index ec5055da2..b84018d0b 100644
--- a/src/core/services/qtickclockservice_p.h
+++ b/src/core/services/qtickclockservice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/transforms/qmath3d_p.h b/src/core/transforms/qmath3d_p.h
index 8a990c7d3..38ebbd99a 100644
--- a/src/core/transforms/qmath3d_p.h
+++ b/src/core/transforms/qmath3d_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Konstantin Ritt.
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/core/transforms/qtransform.cpp b/src/core/transforms/qtransform.cpp
index 162da9d95..55974a836 100644
--- a/src/core/transforms/qtransform.cpp
+++ b/src/core/transforms/qtransform.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,7 +41,7 @@
#include "qtransform_p.h"
#include "qmath3d_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -54,40 +57,144 @@ QTransformPrivate::QTransformPrivate()
{
}
-QTransform::QTransform(QNode *parent)
- : QComponent(*new QTransformPrivate, parent)
+QTransformPrivate::~QTransformPrivate()
{
}
+
/*!
- \qmltype Transform
- \inqmlmodule Qt3D.Core
- \since 5.6
- \TODO
-*/
+ * \qmltype Transform
+ * \inqmlmodule Qt3D.Core
+ * \inherits Component3D
+ * \instantiates Qt3DCore::QComponent
+ * \since 5.6
+ *
+ * TODO
+ */
-/*! \internal */
-QTransform::QTransform(QTransformPrivate &dd, QNode *parent)
- : QComponent(dd, parent)
+/*!
+ * \qmlproperty matrix4x4 Transform::matrix
+ *
+ * Holds the matrix4x4 of the transform.
+ */
+
+/*!
+ * \qmlproperty real Transform::rotationX
+ *
+ * Holds the x rotation of the transform as Euler angle.
+ */
+
+/*!
+ * \qmlproperty real Transform::rotationY
+ *
+ * Holds the y rotation of the transform as Euler angle.
+ */
+
+/*!
+ * \qmlproperty real Transform::rotationZ
+ *
+ * Holds the z rotation of the transform as Euler angle.
+ */
+
+/*!
+ * \qmlproperty vector3d Transform::scale3D
+ *
+ * Holds the scale of the transform as vector3d.
+ */
+
+/*!
+ * \qmlproperty float Transform::scale
+ *
+ * Holds the uniform scale of the transform. If the scale has been set with scale3D, holds
+ * the x value only.
+ */
+
+/*!
+ * \qmlproperty quaternion Transform::rotation
+ *
+ * Holds the rotation of the transform as quaternion.
+ */
+
+/*!
+ * \qmlproperty vector3d Transform::translation
+ *
+ * Holds the translation of the transform as vector3d.
+ */
+
+/*!
+ * \qmlmethod quaternion Transform::fromAxisAndAngle(vector3d axis, real angle)
+ * Creates a quaternion from \a axis and \a angle.
+ * \return the resulting quaternion.
+ */
+
+/*!
+ * \qmlmethod quaternion Transform::fromAxisAndAngle(real x, real y, real z, real angle)
+ * Creates a quaternion from \a x, \a y, \a z, and \a angle.
+ * \return the resulting quaternion.
+ */
+
+/*!
+ * \qmlmethod quaternion Transform::fromAxesAndAngles(vector3d axis1, real angle1,
+ * vector3d axis2, real angle2)
+ * Creates a quaternion from \a axis1, \a angle1, \a axis2, and \a angle2.
+ * \return the resulting quaternion.
+ */
+
+/*!
+ * \qmlmethod quaternion Transform::fromAxesAndAngles(vector3d axis1, real angle1,
+ * vector3d axis2, real angle2,
+ * vector3d axis3, real angle3)
+ * Creates a quaternion from \a axis1, \a angle1, \a axis2, \a angle2, \a axis3, and \a angle3.
+ * \return the resulting quaternion.
+ */
+
+/*!
+ * \qmlmethod quaternion Transform::fromEulerAngles(vector3d eulerAngles)
+ * Creates a quaternion from \a eulerAngles.
+ * \return the resulting quaternion.
+ */
+
+/*!
+ * \qmlmethod quaternion Transform::fromEulerAngles(real pitch, real yaw, real roll)
+ * Creates a quaternion from \a pitch, \a yaw, and \a roll.
+ * \return the resulting quaternion.
+ */
+
+/*!
+ * \qmlmethod matrix4x4 Transform::rotateAround(vector3d point, real angle, vector3d axis)
+ * Creates a rotation matrix from \a axis and \a angle around \a point.
+ * \return the resulting matrix4x4.
+ */
+
+/*!
+ * \class Qt3DCore::QTransform
+ * \inmodule Qt3DCore
+ * \inherits Qt3DCore::QComponent
+ * \since 5.6
+ *
+ * TODO
+ */
+
+/*!
+ * Constructs a new QTransform with \a parent.
+ */
+QTransform::QTransform(QNode *parent)
+ : QComponent(*new QTransformPrivate, parent)
{
}
+/*!
+ * \internal
+ */
QTransform::~QTransform()
{
- QNode::cleanup();
}
-void QTransform::copy(const QNode *ref)
+/*!
+ * \internal
+ */
+QTransform::QTransform(QTransformPrivate &dd, QNode *parent)
+ : QComponent(dd, parent)
{
- QComponent::copy(ref);
- const QTransform *transform = static_cast<const QTransform *>(ref);
- // We need to copy the matrix with all the pending
- // transformations applied
- d_func()->m_matrix = transform->matrix();
- d_func()->m_rotation = transform->rotation();
- d_func()->m_scale = transform->scale3D();
- d_func()->m_translation = transform->translation();
- d_func()->m_eulerRotationAngles = transform->d_func()->m_eulerRotationAngles;
- d_func()->m_matrixDirty = transform->d_func()->m_matrixDirty;
}
void QTransform::setMatrix(const QMatrix4x4 &m)
@@ -177,6 +284,11 @@ void QTransform::setRotationZ(float rotationZ)
blockNotifications(wasBlocked);
}
+/*!
+ * \property Qt3DCore::QTransform::matrix
+ *
+ * Holds the QMatrix4x4 of the transform.
+ */
QMatrix4x4 QTransform::matrix() const
{
Q_D(const QTransform);
@@ -187,18 +299,33 @@ QMatrix4x4 QTransform::matrix() const
return d->m_matrix;
}
+/*!
+ * \property Qt3DCore::QTransform::rotationX
+ *
+ * Holds the x rotation of the transform as Euler angle.
+ */
float QTransform::rotationX() const
{
Q_D(const QTransform);
return d->m_eulerRotationAngles.x();
}
+/*!
+ * \property Qt3DCore::QTransform::rotationY
+ *
+ * Holds the y rotation of the transform as Euler angle.
+ */
float QTransform::rotationY() const
{
Q_D(const QTransform);
return d->m_eulerRotationAngles.y();
}
+/*!
+ * \property Qt3DCore::QTransform::rotationZ
+ *
+ * Holds the z rotation of the transform as Euler angle.
+ */
float QTransform::rotationZ() const
{
Q_D(const QTransform);
@@ -215,6 +342,11 @@ void QTransform::setScale3D(const QVector3D &scale)
}
}
+/*!
+ * \property Qt3DCore::QTransform::scale3D
+ *
+ * Holds the scale of the transform as QVector3D.
+ */
QVector3D QTransform::scale3D() const
{
Q_D(const QTransform);
@@ -232,6 +364,12 @@ void QTransform::setScale(float scale)
}
}
+/*!
+ * \property Qt3DCore::QTransform::scale
+ *
+ * Holds the uniform scale of the transform. If the scale has been set with setScale3D, holds
+ * the x value only.
+ */
float QTransform::scale() const
{
Q_D(const QTransform);
@@ -249,6 +387,11 @@ void QTransform::setRotation(const QQuaternion &rotation)
}
}
+/*!
+ * \property Qt3DCore::QTransform::rotation
+ *
+ * Holds the rotation of the transform as QQuaternion.
+ */
QQuaternion QTransform::rotation() const
{
Q_D(const QTransform);
@@ -265,22 +408,39 @@ void QTransform::setTranslation(const QVector3D &translation)
}
}
+/*!
+ * \property Qt3DCore::QTransform::translation
+ *
+ * Holds the translation of the transform as QVector3D.
+ */
QVector3D QTransform::translation() const
{
Q_D(const QTransform);
return d->m_translation;
}
+/*!
+ * Creates a QQuaternion from \a axis and \a angle.
+ * \return the resulting QQuaternion.
+ */
QQuaternion QTransform::fromAxisAndAngle(const QVector3D &axis, float angle)
{
return QQuaternion::fromAxisAndAngle(axis, angle);
}
+/*!
+ * Creates a QQuaternion from \a x, \a y, \a z, and \a angle.
+ * \return the resulting QQuaternion.
+ */
QQuaternion QTransform::fromAxisAndAngle(float x, float y, float z, float angle)
{
return QQuaternion::fromAxisAndAngle(x, y, z, angle);
}
+/*!
+ * Creates a QQuaternion from \a axis1, \a angle1, \a axis2, and \a angle2.
+ * \return the resulting QQuaternion.
+ */
QQuaternion QTransform::fromAxesAndAngles(const QVector3D &axis1, float angle1,
const QVector3D &axis2, float angle2)
{
@@ -289,6 +449,10 @@ QQuaternion QTransform::fromAxesAndAngles(const QVector3D &axis1, float angle1,
return q2 * q1;
}
+/*!
+ * Creates a QQuaternion from \a axis1, \a angle1, \a axis2, \a angle2, \a axis3, and \a angle3.
+ * \return the resulting QQuaternion.
+ */
QQuaternion QTransform::fromAxesAndAngles(const QVector3D &axis1, float angle1,
const QVector3D &axis2, float angle2,
const QVector3D &axis3, float angle3)
@@ -299,16 +463,28 @@ QQuaternion QTransform::fromAxesAndAngles(const QVector3D &axis1, float angle1,
return q3 * q2 * q1;
}
+/*!
+ * Creates a QQuaternion from \a eulerAngles.
+ * \return the resulting QQuaternion.
+ */
QQuaternion QTransform::fromEulerAngles(const QVector3D &eulerAngles)
{
return QQuaternion::fromEulerAngles(eulerAngles);
}
+/*!
+ * Creates a QQuaternion from \a pitch, \a yaw, and \a roll.
+ * \return the resulting QQuaternion.
+ */
QQuaternion QTransform::fromEulerAngles(float pitch, float yaw, float roll)
{
return QQuaternion::fromEulerAngles(pitch, yaw, roll);
}
+/*!
+ * Creates a rotation matrix from \a axis and \a angle around \a point.
+ * \return the resulting QMatrix4x4.
+ */
QMatrix4x4 QTransform::rotateAround(const QVector3D &point, float angle, const QVector3D &axis)
{
QMatrix4x4 m;
@@ -318,6 +494,19 @@ QMatrix4x4 QTransform::rotateAround(const QVector3D &point, float angle, const Q
return m;
}
+QNodeCreatedChangeBasePtr QTransform::createNodeCreationChange() const
+{
+ auto creationChange = QNodeCreatedChangePtr<QTransformData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QTransform);
+ data.rotation = d->m_rotation;
+ data.scale = d->m_scale;
+ data.translation = d->m_translation;
+
+ return creationChange;
+}
+
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/transforms/qtransform.h b/src/core/transforms/qtransform.h
index ccb4e3e5b..9dcab1108 100644
--- a/src/core/transforms/qtransform.h
+++ b/src/core/transforms/qtransform.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,13 +58,13 @@ class QT3DCORESHARED_EXPORT QTransform : public QComponent
Q_PROPERTY(float scale READ scale WRITE setScale NOTIFY scaleChanged)
Q_PROPERTY(QVector3D scale3D READ scale3D WRITE setScale3D NOTIFY scale3DChanged)
Q_PROPERTY(QQuaternion rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
+ Q_PROPERTY(QVector3D translation READ translation WRITE setTranslation NOTIFY translationChanged)
Q_PROPERTY(float rotationX READ rotationX WRITE setRotationX NOTIFY rotationXChanged)
Q_PROPERTY(float rotationY READ rotationY WRITE setRotationY NOTIFY rotationYChanged)
Q_PROPERTY(float rotationZ READ rotationZ WRITE setRotationZ NOTIFY rotationZChanged)
- Q_PROPERTY(QVector3D translation READ translation WRITE setTranslation NOTIFY translationChanged)
public:
- explicit QTransform(QNode *parent = Q_NULLPTR);
+ explicit QTransform(QNode *parent = nullptr);
~QTransform();
float scale() const;
@@ -104,19 +107,18 @@ Q_SIGNALS:
void scaleChanged(float scale);
void scale3DChanged(const QVector3D &scale);
void rotationChanged(const QQuaternion &rotation);
+ void translationChanged(const QVector3D &translation);
+ void matrixChanged(const QMatrix4x4 &matrix);
void rotationXChanged(float rotationX);
void rotationYChanged(float rotationY);
void rotationZChanged(float rotationZ);
- void translationChanged(const QVector3D &translation);
- void matrixChanged(const QMatrix4x4 &matrix);
protected:
- QTransform(QTransformPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
+ explicit QTransform(QTransformPrivate &dd, QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QTransform)
- QT3D_CLONEABLE(QTransform)
+ QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DCore
diff --git a/src/core/transforms/qtransform_p.h b/src/core/transforms/qtransform_p.h
index b7f55e0ee..8d1a60566 100644
--- a/src/core/transforms/qtransform_p.h
+++ b/src/core/transforms/qtransform_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -60,6 +63,7 @@ class QTransformPrivate : public QComponentPrivate
public:
QTransformPrivate();
+ ~QTransformPrivate();
// Stored in this order as QQuaternion is bigger than QVector3D
// Operations are applied in the order of:
@@ -73,6 +77,13 @@ public:
mutable bool m_matrixDirty;
};
+struct QTransformData
+{
+ QQuaternion rotation;
+ QVector3D scale;
+ QVector3D translation;
+};
+
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/doc/qt3d.qdocconf b/src/doc/qt3d.qdocconf
index d34e37b2a..d818ee03f 100644
--- a/src/doc/qt3d.qdocconf
+++ b/src/doc/qt3d.qdocconf
@@ -43,7 +43,6 @@ depends += qtcore qtgui qtqml qtquick qtdoc
headerdirs += . \
../render \
../core \
- ../collision \
../logic \
../plugins \
../quick3d/quick3d \
@@ -55,7 +54,6 @@ excludefiles += "*_p.h"
sourcedirs += . \
../render \
../core \
- ../collision \
../logic \
../plugins \
../quick3d/quick3d \
diff --git a/src/doc/snippets/code/src_core_qcircularbuffer.cpp b/src/doc/snippets/code/src_core_qcircularbuffer.cpp
index 574ca75c8..3a41adfba 100644
--- a/src/doc/snippets/code/src_core_qcircularbuffer.cpp
+++ b/src/doc/snippets/code/src_core_qcircularbuffer.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/doc/src/externalresources.qdoc b/src/doc/src/externalresources.qdoc
index 8ddce9d47..512f1263b 100644
--- a/src/doc/src/externalresources.qdoc
+++ b/src/doc/src/externalresources.qdoc
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/doc/src/qcircularbuffer.qdoc b/src/doc/src/qcircularbuffer.qdoc
index 631087039..e313a7375 100644
--- a/src/doc/src/qcircularbuffer.qdoc
+++ b/src/doc/src/qcircularbuffer.qdoc
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/doc/src/qt3d-examples.qdoc b/src/doc/src/qt3d-examples.qdoc
index 8ff15f122..28259fb85 100644
--- a/src/doc/src/qt3d-examples.qdoc
+++ b/src/doc/src/qt3d-examples.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/doc/src/qt3d-index.qdoc b/src/doc/src/qt3d-index.qdoc
index e97f83c02..3c2630c22 100644
--- a/src/doc/src/qt3d-index.qdoc
+++ b/src/doc/src/qt3d-index.qdoc
@@ -1,35 +1,38 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/doc/src/qt3d-module.qdoc b/src/doc/src/qt3d-module.qdoc
index 264c258c3..f6dc6934d 100644
--- a/src/doc/src/qt3d-module.qdoc
+++ b/src/doc/src/qt3d-module.qdoc
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/doc/src/qt3d-overview.qdoc b/src/doc/src/qt3d-overview.qdoc
index 2e1dd053f..7e9c7b4c3 100644
--- a/src/doc/src/qt3d-overview.qdoc
+++ b/src/doc/src/qt3d-overview.qdoc
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/doc/src/qt3dinput-module.qdoc b/src/doc/src/qt3dinput-module.qdoc
index 8560dd000..b14380e3a 100644
--- a/src/doc/src/qt3dinput-module.qdoc
+++ b/src/doc/src/qt3dinput-module.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/doc/src/qt3dlogic-module.qdoc b/src/doc/src/qt3dlogic-module.qdoc
index 20850b891..826ac1e4f 100644
--- a/src/doc/src/qt3dlogic-module.qdoc
+++ b/src/doc/src/qt3dlogic-module.qdoc
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -11,8 +11,8 @@
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
@@ -20,7 +20,7 @@
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/doc/src/qt3drender-framegraph.qdoc b/src/doc/src/qt3drender-framegraph.qdoc
index 6d7c4207b..d585c833b 100644
--- a/src/doc/src/qt3drender-framegraph.qdoc
+++ b/src/doc/src/qt3drender-framegraph.qdoc
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -194,8 +197,8 @@
rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
property alias camera: cameraSelector.camera
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
CameraSelector {
id: cameraSelector
@@ -236,8 +239,8 @@
CameraSelector {
id: cameraSelector
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
}
}
}
@@ -248,8 +251,8 @@
Viewport {
rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
}
}
}
@@ -274,8 +277,8 @@
property alias Camera: cameraSelectorBottomLeftViewport.camera
property alias Camera: cameraSelectorBottomRightViewport.camera
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
}
Viewport {
@@ -352,7 +355,7 @@
\endlist
\endlist
- However, in this case the \e {order is important}. If the ClearBuffer node
+ However, in this case the \e {order is important}. If the ClearBuffers node
were to be the last instead of the first, this would result in a black
screen for the simple reason that everything would be cleared right after
having been so carefully rendered. For a similar reason, it could not be
@@ -426,8 +429,8 @@
RenderTargetSelector {
id: gBufferTargetSelector
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
RenderPassFilter {
id: geometryPass
@@ -444,8 +447,8 @@
LayerFilter {
layers: "screenQuad"
- ClearBuffer {
- buffers: ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
RenderPassFilter {
id: finalPass
diff --git a/src/doc/src/qt3drender-module.qdoc b/src/doc/src/qt3drender-module.qdoc
index 6cc53fe9d..6599c2e11 100644
--- a/src/doc/src/qt3drender-module.qdoc
+++ b/src/doc/src/qt3drender-module.qdoc
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/extras/defaults/defaults.pri b/src/extras/defaults/defaults.pri
new file mode 100644
index 000000000..04cd87246
--- /dev/null
+++ b/src/extras/defaults/defaults.pri
@@ -0,0 +1,47 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qphongmaterial.h \
+ $$PWD/qphongmaterial_p.h \
+ $$PWD/qdiffusemapmaterial_p.h \
+ $$PWD/qdiffusemapmaterial.h \
+ $$PWD/qnormaldiffusespecularmapmaterial.h \
+ $$PWD/qnormaldiffusespecularmapmaterial_p.h \
+ $$PWD/qnormaldiffusemapmaterial.h \
+ $$PWD/qnormaldiffusemapmaterial_p.h \
+ $$PWD/qnormaldiffusemapalphamaterial.h \
+ $$PWD/qnormaldiffusemapalphamaterial_p.h \
+ $$PWD/qdiffusespecularmapmaterial.h \
+ $$PWD/qdiffusespecularmapmaterial_p.h \
+ $$PWD/qforwardrenderer.h \
+ $$PWD/qforwardrenderer_p.h \
+ $$PWD/qpervertexcolormaterial.h \
+ $$PWD/qpervertexcolormaterial_p.h \
+ $$PWD/qskyboxentity.h \
+ $$PWD/qskyboxentity_p.h \
+ $$PWD/qgoochmaterial.h \
+ $$PWD/qgoochmaterial_p.h \
+ $$PWD/qphongalphamaterial.h \
+ $$PWD/qphongalphamaterial_p.h \
+ $$PWD/qt3dwindow.h \
+ $$PWD/qfirstpersoncameracontroller.h \
+ $$PWD/qfirstpersoncameracontroller_p.h \
+ $$PWD/qorbitcameracontroller.h \
+ $$PWD/qorbitcameracontroller_p.h
+
+SOURCES += \
+ $$PWD/qphongmaterial.cpp \
+ $$PWD/qdiffusemapmaterial.cpp \
+ $$PWD/qnormaldiffusespecularmapmaterial.cpp \
+ $$PWD/qnormaldiffusemapmaterial.cpp \
+ $$PWD/qnormaldiffusemapalphamaterial.cpp \
+ $$PWD/qdiffusespecularmapmaterial.cpp \
+ $$PWD/qforwardrenderer.cpp \
+ $$PWD/qpervertexcolormaterial.cpp \
+ $$PWD/qskyboxentity.cpp \
+ $$PWD/qgoochmaterial.cpp \
+ $$PWD/qphongalphamaterial.cpp \
+ $$PWD/qt3dwindow.cpp \
+ $$PWD/qfirstpersoncameracontroller.cpp \
+ $$PWD/qorbitcameracontroller.cpp
+
diff --git a/src/extras/defaults/qdiffusemapmaterial.cpp b/src/extras/defaults/qdiffusemapmaterial.cpp
new file mode 100644
index 000000000..854d0a809
--- /dev/null
+++ b/src/extras/defaults/qdiffusemapmaterial.cpp
@@ -0,0 +1,316 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdiffusemapmaterial.h"
+#include "qdiffusemapmaterial_p.h"
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <QUrl>
+#include <QVector3D>
+#include <QVector4D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QDiffuseMapMaterialPrivate::QDiffuseMapMaterialPrivate()
+ : QMaterialPrivate()
+ , m_diffuseMapEffect(new QEffect())
+ , m_diffuseTexture(new QTexture2D())
+ , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
+ , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture))
+ , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.01f, 0.01f, 0.01f, 1.0f)))
+ , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
+ , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
+ , m_diffuseMapGL3Technique(new QTechnique())
+ , m_diffuseMapGL2Technique(new QTechnique())
+ , m_diffuseMapES2Technique(new QTechnique())
+ , m_diffuseMapGL3RenderPass(new QRenderPass())
+ , m_diffuseMapGL2RenderPass(new QRenderPass())
+ , m_diffuseMapES2RenderPass(new QRenderPass())
+ , m_diffuseMapGL3Shader(new QShaderProgram())
+ , m_diffuseMapGL2ES2Shader(new QShaderProgram())
+ , m_filterKey(new QFilterKey)
+{
+ m_diffuseTexture->setMagnificationFilter(QAbstractTexture::Linear);
+ m_diffuseTexture->setMinificationFilter(QAbstractTexture::LinearMipMapLinear);
+ m_diffuseTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
+ m_diffuseTexture->setGenerateMipMaps(true);
+ m_diffuseTexture->setMaximumAnisotropy(16.0f);
+}
+
+void QDiffuseMapMaterialPrivate::init()
+{
+ connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseMapMaterialPrivate::handleAmbientChanged);
+ connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseMapMaterialPrivate::handleDiffuseChanged);
+ connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseMapMaterialPrivate::handleSpecularChanged);
+ connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseMapMaterialPrivate::handleShininessChanged);
+ connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseMapMaterialPrivate::handleTextureScaleChanged);
+
+ m_diffuseMapGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/diffusemap.vert"))));
+ m_diffuseMapGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/diffusemap.frag"))));
+ m_diffuseMapGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/diffusemap.vert"))));
+ m_diffuseMapGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/diffusemap.frag"))));
+
+ m_diffuseMapGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_diffuseMapGL3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_diffuseMapGL3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_diffuseMapGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_diffuseMapGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_diffuseMapGL2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_diffuseMapGL2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_diffuseMapGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_diffuseMapES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_diffuseMapES2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_diffuseMapES2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_diffuseMapES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ Q_Q(QDiffuseMapMaterial);
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_diffuseMapGL3Technique->addFilterKey(m_filterKey);
+ m_diffuseMapGL2Technique->addFilterKey(m_filterKey);
+ m_diffuseMapES2Technique->addFilterKey(m_filterKey);
+
+ m_diffuseMapGL3RenderPass->setShaderProgram(m_diffuseMapGL3Shader);
+ m_diffuseMapGL2RenderPass->setShaderProgram(m_diffuseMapGL2ES2Shader);
+ m_diffuseMapES2RenderPass->setShaderProgram(m_diffuseMapGL2ES2Shader);
+
+ m_diffuseMapGL3Technique->addRenderPass(m_diffuseMapGL3RenderPass);
+ m_diffuseMapGL2Technique->addRenderPass(m_diffuseMapGL2RenderPass);
+ m_diffuseMapES2Technique->addRenderPass(m_diffuseMapES2RenderPass);
+
+ m_diffuseMapEffect->addTechnique(m_diffuseMapGL3Technique);
+ m_diffuseMapEffect->addTechnique(m_diffuseMapGL2Technique);
+ m_diffuseMapEffect->addTechnique(m_diffuseMapES2Technique);
+
+ m_diffuseMapEffect->addParameter(m_ambientParameter);
+ m_diffuseMapEffect->addParameter(m_diffuseParameter);
+ m_diffuseMapEffect->addParameter(m_specularParameter);
+ m_diffuseMapEffect->addParameter(m_shininessParameter);
+ m_diffuseMapEffect->addParameter(m_textureScaleParameter);
+
+ q->setEffect(m_diffuseMapEffect);
+}
+
+void QDiffuseMapMaterialPrivate::handleAmbientChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseMapMaterial);
+ emit q->ambientChanged(var.value<QColor>());
+}
+
+void QDiffuseMapMaterialPrivate::handleDiffuseChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseMapMaterial);
+ emit q->diffuseChanged(var.value<QAbstractTexture *>());
+}
+
+void QDiffuseMapMaterialPrivate::handleSpecularChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseMapMaterial);
+ emit q->specularChanged(var.value<QColor>());
+}
+
+void QDiffuseMapMaterialPrivate::handleShininessChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseMapMaterial);
+ emit q->shininessChanged(var.toFloat());
+}
+
+void QDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseMapMaterial);
+ emit q->textureScaleChanged(var.toFloat());
+}
+
+/*!
+ \class Qt3DRender::QDiffuseMapMaterial
+ \brief The QDiffuseMapMaterial provides a default implementation of the phong lighting effect where the diffuse light component
+ is read from a texture map.
+ \inmodule Qt3DRender
+ \since 5.5
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
+ The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ Constructs a new Qt3DRender::QDiffuseMapMaterial instance with parent object \a parent.
+ */
+QDiffuseMapMaterial::QDiffuseMapMaterial(QNode *parent)
+ : QMaterial(*new QDiffuseMapMaterialPrivate, parent)
+{
+ Q_D(QDiffuseMapMaterial);
+ d->init();
+}
+
+/*!
+ Destroys the QDiffuseMapMaterial instance.
+*/
+QDiffuseMapMaterial::~QDiffuseMapMaterial()
+{
+}
+
+/*!
+ \property Qt3DRender::QDiffuseMapMaterial::ambient
+
+ Holds the current ambient color.
+*/
+
+QColor QDiffuseMapMaterial::ambient() const
+{
+ Q_D(const QDiffuseMapMaterial);
+ return d->m_ambientParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QDiffuseMapMaterial::specular
+
+ Holds the current specular color.
+*/
+QColor QDiffuseMapMaterial::specular() const
+{
+ Q_D(const QDiffuseMapMaterial);
+ return d->m_specularParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QDiffuseMapMaterial::shininess
+
+ Holds the current shininess as a float value.
+*/
+float QDiffuseMapMaterial::shininess() const
+{
+ Q_D(const QDiffuseMapMaterial);
+ return d->m_shininessParameter->value().toFloat();
+}
+
+/*!
+ \property Qt3DRender::QDiffuseMapMaterial::diffuse
+
+ Holds the current QTexture used as the diffuse map.
+
+ By default, the diffuse texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+QAbstractTexture *QDiffuseMapMaterial::diffuse() const
+{
+ Q_D(const QDiffuseMapMaterial);
+ return d->m_diffuseParameter->value().value<QAbstractTexture *>();
+}
+
+/*!
+ \property Qt3DRender::QDiffuseMapMaterial::textureScale
+
+ Holds the current texture scale as a float value.
+
+*/
+float QDiffuseMapMaterial::textureScale() const
+{
+ Q_D(const QDiffuseMapMaterial);
+ return d->m_textureScaleParameter->value().toFloat();
+}
+
+void QDiffuseMapMaterial::setAmbient(const QColor &ambient)
+{
+ Q_D(const QDiffuseMapMaterial);
+ d->m_ambientParameter->setValue(ambient);
+}
+
+void QDiffuseMapMaterial::setSpecular(const QColor &specular)
+{
+ Q_D(QDiffuseMapMaterial);
+ d->m_specularParameter->setValue(specular);
+}
+
+void QDiffuseMapMaterial::setShininess(float shininess)
+{
+ Q_D(QDiffuseMapMaterial);
+ d->m_shininessParameter->setValue(shininess);
+}
+
+void QDiffuseMapMaterial::setDiffuse(QAbstractTexture *diffuseMap)
+{
+ Q_D(QDiffuseMapMaterial);
+ d->m_diffuseParameter->setValue(QVariant::fromValue(diffuseMap));
+}
+
+void QDiffuseMapMaterial::setTextureScale(float textureScale)
+{
+ Q_D(QDiffuseMapMaterial);
+ d->m_textureScaleParameter->setValue(textureScale);
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qdiffusemapmaterial.h b/src/extras/defaults/qdiffusemapmaterial.h
new file mode 100644
index 000000000..b6bba9b36
--- /dev/null
+++ b/src/extras/defaults/qdiffusemapmaterial.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QDIFFUSEMAPMATERIAL_H
+#define QT3DEXTRAS_QDIFFUSEMAPMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qmaterial.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractTexture;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QDiffuseMapMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QDiffuseMapMaterial : public Qt3DRender::QMaterial
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
+ Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
+ Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture *diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
+ Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
+
+public:
+ explicit QDiffuseMapMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QDiffuseMapMaterial();
+
+ QColor ambient() const;
+ QColor specular() const;
+ float shininess() const;
+ Qt3DRender::QAbstractTexture *diffuse() const;
+ float textureScale() const;
+
+public Q_SLOTS:
+ void setAmbient(const QColor &color);
+ void setSpecular(const QColor &specular);
+ void setShininess(float shininess);
+ void setDiffuse(Qt3DRender::QAbstractTexture *diffuse);
+ void setTextureScale(float textureScale);
+
+Q_SIGNALS:
+ void ambientChanged(const QColor &ambient);
+ void diffuseChanged(Qt3DRender::QAbstractTexture *diffuse);
+ void specularChanged(const QColor &specular);
+ void shininessChanged(float shininess);
+ void textureScaleChanged(float textureScale);
+
+private:
+ Q_DECLARE_PRIVATE(QDiffuseMapMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRASQDIFFUSEMAPMATERIAL_H
diff --git a/src/extras/defaults/qdiffusemapmaterial_p.h b/src/extras/defaults/qdiffusemapmaterial_p.h
new file mode 100644
index 000000000..c0bcc01eb
--- /dev/null
+++ b/src/extras/defaults/qdiffusemapmaterial_p.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QDIFFUSEMAPMATERIAL_P_H
+#define QT3DEXTRAS_QDIFFUSEMAPMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QEffect;
+class QAbstractTexture;
+class QTechnique;
+class QParameter;
+class QShaderProgram;
+class QRenderPass;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QDiffuseMapMaterial;
+
+class QDiffuseMapMaterialPrivate : public Qt3DRender::QMaterialPrivate
+{
+ QDiffuseMapMaterialPrivate();
+
+ void init();
+
+ void handleAmbientChanged(const QVariant &var);
+ void handleDiffuseChanged(const QVariant &var);
+ void handleSpecularChanged(const QVariant &var);
+ void handleShininessChanged(const QVariant &var);
+ void handleTextureScaleChanged(const QVariant &var);
+
+ Qt3DRender::QEffect *m_diffuseMapEffect;
+ Qt3DRender::QAbstractTexture *m_diffuseTexture;
+ Qt3DRender::QParameter *m_ambientParameter;
+ Qt3DRender::QParameter *m_diffuseParameter;
+ Qt3DRender::QParameter *m_specularParameter;
+ Qt3DRender::QParameter *m_shininessParameter;
+ Qt3DRender::QParameter *m_textureScaleParameter;
+ Qt3DRender::QTechnique *m_diffuseMapGL3Technique;
+ Qt3DRender::QTechnique *m_diffuseMapGL2Technique;
+ Qt3DRender::QTechnique *m_diffuseMapES2Technique;
+ Qt3DRender::QRenderPass *m_diffuseMapGL3RenderPass;
+ Qt3DRender::QRenderPass *m_diffuseMapGL2RenderPass;
+ Qt3DRender::QRenderPass *m_diffuseMapES2RenderPass;
+ Qt3DRender::QShaderProgram *m_diffuseMapGL3Shader;
+ Qt3DRender::QShaderProgram *m_diffuseMapGL2ES2Shader;
+ Qt3DRender::QFilterKey *m_filterKey;
+
+ Q_DECLARE_PUBLIC(QDiffuseMapMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QDIFFUSEAPMATERIAL_P_H
+
diff --git a/src/extras/defaults/qdiffusespecularmapmaterial.cpp b/src/extras/defaults/qdiffusespecularmapmaterial.cpp
new file mode 100644
index 000000000..a4ccb6121
--- /dev/null
+++ b/src/extras/defaults/qdiffusespecularmapmaterial.cpp
@@ -0,0 +1,330 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qdiffusespecularmapmaterial.h"
+#include "qdiffusespecularmapmaterial_p.h"
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <QUrl>
+#include <QVector3D>
+#include <QVector4D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QDiffuseSpecularMapMaterialPrivate::QDiffuseSpecularMapMaterialPrivate()
+ : QMaterialPrivate()
+ , m_diffuseSpecularMapEffect(new QEffect())
+ , m_diffuseTexture(new QTexture2D())
+ , m_specularTexture(new QTexture2D())
+ , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
+ , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture))
+ , m_specularParameter(new QParameter(QStringLiteral("specularTexture"), m_specularTexture))
+ , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
+ , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
+ , m_diffuseSpecularMapGL3Technique(new QTechnique())
+ , m_diffuseSpecularMapGL2Technique(new QTechnique())
+ , m_diffuseSpecularMapES2Technique(new QTechnique())
+ , m_diffuseSpecularMapGL3RenderPass(new QRenderPass())
+ , m_diffuseSpecularMapGL2RenderPass(new QRenderPass())
+ , m_diffuseSpecularMapES2RenderPass(new QRenderPass())
+ , m_diffuseSpecularMapGL3Shader(new QShaderProgram())
+ , m_diffuseSpecularMapGL2ES2Shader(new QShaderProgram())
+ , m_filterKey(new QFilterKey)
+{
+ m_diffuseTexture->setMagnificationFilter(QAbstractTexture::Linear);
+ m_diffuseTexture->setMinificationFilter(QAbstractTexture::LinearMipMapLinear);
+ m_diffuseTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
+ m_diffuseTexture->setGenerateMipMaps(true);
+ m_diffuseTexture->setMaximumAnisotropy(16.0f);
+
+ m_specularTexture->setMagnificationFilter(QAbstractTexture::Linear);
+ m_specularTexture->setMinificationFilter(QAbstractTexture::LinearMipMapLinear);
+ m_specularTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
+ m_specularTexture->setGenerateMipMaps(true);
+ m_specularTexture->setMaximumAnisotropy(16.0f);
+}
+
+void QDiffuseSpecularMapMaterialPrivate::init()
+{
+ connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseSpecularMapMaterialPrivate::handleAmbientChanged);
+ connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseSpecularMapMaterialPrivate::handleDiffuseChanged);
+ connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseSpecularMapMaterialPrivate::handleSpecularChanged);
+ connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseSpecularMapMaterialPrivate::handleShininessChanged);
+ connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged);
+
+ m_diffuseSpecularMapGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/diffusemap.vert"))));
+ m_diffuseSpecularMapGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/diffusespecularmap.frag"))));
+ m_diffuseSpecularMapGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/diffusemap.vert"))));
+ m_diffuseSpecularMapGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/diffusespecularmap.frag"))));
+
+ m_diffuseSpecularMapGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_diffuseSpecularMapGL3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_diffuseSpecularMapGL3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_diffuseSpecularMapGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_diffuseSpecularMapGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_diffuseSpecularMapGL2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_diffuseSpecularMapGL2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_diffuseSpecularMapGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_diffuseSpecularMapES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_diffuseSpecularMapES2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_diffuseSpecularMapES2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_diffuseSpecularMapES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ Q_Q(QDiffuseSpecularMapMaterial);
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_diffuseSpecularMapGL3Technique->addFilterKey(m_filterKey);
+ m_diffuseSpecularMapGL2Technique->addFilterKey(m_filterKey);
+ m_diffuseSpecularMapES2Technique->addFilterKey(m_filterKey);
+
+ m_diffuseSpecularMapGL3RenderPass->setShaderProgram(m_diffuseSpecularMapGL3Shader);
+ m_diffuseSpecularMapGL2RenderPass->setShaderProgram(m_diffuseSpecularMapGL2ES2Shader);
+ m_diffuseSpecularMapES2RenderPass->setShaderProgram(m_diffuseSpecularMapGL2ES2Shader);
+
+ m_diffuseSpecularMapGL3Technique->addRenderPass(m_diffuseSpecularMapGL3RenderPass);
+ m_diffuseSpecularMapGL2Technique->addRenderPass(m_diffuseSpecularMapGL2RenderPass);
+ m_diffuseSpecularMapES2Technique->addRenderPass(m_diffuseSpecularMapES2RenderPass);
+
+ m_diffuseSpecularMapEffect->addTechnique(m_diffuseSpecularMapGL3Technique);
+ m_diffuseSpecularMapEffect->addTechnique(m_diffuseSpecularMapGL2Technique);
+ m_diffuseSpecularMapEffect->addTechnique(m_diffuseSpecularMapES2Technique);
+
+ m_diffuseSpecularMapEffect->addParameter(m_ambientParameter);
+ m_diffuseSpecularMapEffect->addParameter(m_diffuseParameter);
+ m_diffuseSpecularMapEffect->addParameter(m_specularParameter);
+ m_diffuseSpecularMapEffect->addParameter(m_shininessParameter);
+ m_diffuseSpecularMapEffect->addParameter(m_textureScaleParameter);
+
+ q->setEffect(m_diffuseSpecularMapEffect);
+}
+
+void QDiffuseSpecularMapMaterialPrivate::handleAmbientChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseSpecularMapMaterial);
+ emit q->ambientChanged(var.value<QColor>());
+}
+
+void QDiffuseSpecularMapMaterialPrivate::handleDiffuseChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseSpecularMapMaterial);
+ emit q->diffuseChanged(var.value<QAbstractTexture *>());
+}
+
+void QDiffuseSpecularMapMaterialPrivate::handleSpecularChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseSpecularMapMaterial);
+ emit q->specularChanged(var.value<QAbstractTexture *>());
+}
+
+void QDiffuseSpecularMapMaterialPrivate::handleShininessChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseSpecularMapMaterial);
+ emit q->shininessChanged(var.toFloat());
+}
+
+void QDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
+{
+ Q_Q(QDiffuseSpecularMapMaterial);
+ emit q->textureScaleChanged(var.toFloat());
+}
+
+/*!
+ \class Qt3DRender::QDiffuseSpecularMapMaterial
+ \brief The QDiffuseSpecularMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse and specular light components
+ are read from texture maps.
+ \inmodule Qt3DRender
+ \since 5.5
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
+ The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ Constructs a new Qt3DRender::QDiffuseSpecularMapMaterial instance with parent object \a parent.
+*/
+QDiffuseSpecularMapMaterial::QDiffuseSpecularMapMaterial(QNode *parent)
+ : QMaterial(*new QDiffuseSpecularMapMaterialPrivate, parent)
+{
+ Q_D(QDiffuseSpecularMapMaterial);
+ d->init();
+}
+
+/*!
+ Destroys the QDiffuseSpecularMapMaterial instance.
+*/
+QDiffuseSpecularMapMaterial::~QDiffuseSpecularMapMaterial()
+{
+}
+
+/*!
+ \property Qt3DRender::QDiffuseSpecularMapMaterial::ambient
+
+ Holds the current ambient color.
+*/
+QColor QDiffuseSpecularMapMaterial::ambient() const
+{
+ Q_D(const QDiffuseSpecularMapMaterial);
+ return d->m_ambientParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QDiffuseSpecularMapMaterial::diffuse
+
+ Holds the current diffuse map texture.
+
+ By default, the diffuse texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+QAbstractTexture *QDiffuseSpecularMapMaterial::diffuse() const
+{
+ Q_D(const QDiffuseSpecularMapMaterial);
+ return d->m_diffuseParameter->value().value<QAbstractTexture *>();
+}
+
+/*!
+ \property Qt3DRender::QDiffuseSpecularMapMaterial::specular
+
+ Holds the current specular map texture.
+
+ By default, the specular texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+QAbstractTexture *QDiffuseSpecularMapMaterial::specular() const
+{
+ Q_D(const QDiffuseSpecularMapMaterial);
+ return d->m_specularParameter->value().value<QAbstractTexture *>();
+}
+
+/*!
+ \property Qt3DRender::QDiffuseSpecularMapMaterial::shininess
+
+ Holds the current shininess as a float value.
+*/
+float QDiffuseSpecularMapMaterial::shininess() const
+{
+ Q_D(const QDiffuseSpecularMapMaterial);
+ return d->m_shininessParameter->value().toFloat();
+}
+
+/*!
+ \property Qt3DRender::QDiffuseSpecularMapMaterial::textureScale
+
+ Holds the current texture scale as a float value.
+*/
+float QDiffuseSpecularMapMaterial::textureScale() const
+{
+ Q_D(const QDiffuseSpecularMapMaterial);
+ return d->m_textureScaleParameter->value().toFloat();
+}
+
+void QDiffuseSpecularMapMaterial::setAmbient(const QColor &ambient)
+{
+ Q_D(QDiffuseSpecularMapMaterial);
+ d->m_ambientParameter->setValue(ambient);
+}
+
+void QDiffuseSpecularMapMaterial::setDiffuse(QAbstractTexture *diffuse)
+{
+ Q_D(QDiffuseSpecularMapMaterial);
+ d->m_diffuseParameter->setValue(QVariant::fromValue(diffuse));
+}
+
+void QDiffuseSpecularMapMaterial::setSpecular(QAbstractTexture *specular)
+{
+ Q_D(QDiffuseSpecularMapMaterial);
+ d->m_specularParameter->setValue(QVariant::fromValue(specular));
+}
+
+void QDiffuseSpecularMapMaterial::setShininess(float shininess)
+{
+ Q_D(QDiffuseSpecularMapMaterial);
+ d->m_shininessParameter->setValue(shininess);
+}
+
+void QDiffuseSpecularMapMaterial::setTextureScale(float textureScale)
+{
+ Q_D(QDiffuseSpecularMapMaterial);
+ d->m_textureScaleParameter->setValue(textureScale);
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qdiffusespecularmapmaterial.h b/src/extras/defaults/qdiffusespecularmapmaterial.h
new file mode 100644
index 000000000..d5dd053bd
--- /dev/null
+++ b/src/extras/defaults/qdiffusespecularmapmaterial.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QDIFFUSESPECULARMAPMATERIAL_H
+#define QT3DEXTRAS_QDIFFUSESPECULARMAPMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qmaterial.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractTexture;
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QDiffuseSpecularMapMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QDiffuseSpecularMapMaterial : public Qt3DRender::QMaterial
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
+ Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture *specular READ specular WRITE setSpecular NOTIFY specularChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture *diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
+ Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
+
+public:
+ explicit QDiffuseSpecularMapMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QDiffuseSpecularMapMaterial();
+
+ QColor ambient() const;
+ Qt3DRender::QAbstractTexture *diffuse() const;
+ Qt3DRender::QAbstractTexture *specular() const;
+ float shininess() const;
+ float textureScale() const;
+
+public Q_SLOTS:
+ void setAmbient(const QColor &ambient);
+ void setDiffuse(Qt3DRender::QAbstractTexture *diffuse);
+ void setSpecular(Qt3DRender::QAbstractTexture *specular);
+ void setShininess(float shininess);
+ void setTextureScale(float textureScale);
+
+Q_SIGNALS:
+ void ambientChanged(const QColor &ambient);
+ void diffuseChanged(Qt3DRender::QAbstractTexture *diffuse);
+ void specularChanged(Qt3DRender::QAbstractTexture *specular);
+ void shininessChanged(float shininess);
+ void textureScaleChanged(float textureScale);
+
+private:
+ Q_DECLARE_PRIVATE(QDiffuseSpecularMapMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QDIFFUSESPECULARMAPMATERIAL_H
diff --git a/src/extras/defaults/qdiffusespecularmapmaterial_p.h b/src/extras/defaults/qdiffusespecularmapmaterial_p.h
new file mode 100644
index 000000000..b358e088a
--- /dev/null
+++ b/src/extras/defaults/qdiffusespecularmapmaterial_p.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QDIFFUSESPECULARMAPMATERIAL_P_H
+#define QT3DEXTRAS_QDIFFUSESPECULARMAPMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QEffect;
+class QAbstractTexture;
+class QTechnique;
+class QParameter;
+class QShaderProgram;
+class QRenderPass;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QDiffuseSpecularMapMaterial;
+
+class QDiffuseSpecularMapMaterialPrivate : public Qt3DRender::QMaterialPrivate
+{
+public:
+ QDiffuseSpecularMapMaterialPrivate();
+
+ void init();
+
+ void handleAmbientChanged(const QVariant &var);
+ void handleDiffuseChanged(const QVariant &var);
+ void handleSpecularChanged(const QVariant &var);
+ void handleShininessChanged(const QVariant &var);
+ void handleTextureScaleChanged(const QVariant &var);
+
+ Qt3DRender::QEffect *m_diffuseSpecularMapEffect;
+ Qt3DRender::QAbstractTexture *m_diffuseTexture;
+ Qt3DRender::QAbstractTexture *m_specularTexture;
+ Qt3DRender::QParameter *m_ambientParameter;
+ Qt3DRender::QParameter *m_diffuseParameter;
+ Qt3DRender::QParameter *m_specularParameter;
+ Qt3DRender::QParameter *m_shininessParameter;
+ Qt3DRender::QParameter *m_textureScaleParameter;
+ Qt3DRender::QTechnique *m_diffuseSpecularMapGL3Technique;
+ Qt3DRender::QTechnique *m_diffuseSpecularMapGL2Technique;
+ Qt3DRender::QTechnique *m_diffuseSpecularMapES2Technique;
+ Qt3DRender::QRenderPass *m_diffuseSpecularMapGL3RenderPass;
+ Qt3DRender::QRenderPass *m_diffuseSpecularMapGL2RenderPass;
+ Qt3DRender::QRenderPass *m_diffuseSpecularMapES2RenderPass;
+ Qt3DRender::QShaderProgram *m_diffuseSpecularMapGL3Shader;
+ Qt3DRender::QShaderProgram *m_diffuseSpecularMapGL2ES2Shader;
+ Qt3DRender::QFilterKey *m_filterKey;
+
+ Q_DECLARE_PUBLIC(QDiffuseSpecularMapMaterial)
+};
+
+} // Qt3DExtras
+
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QDIFFUSESPECULARMAPMATERIAL_P_H
+
diff --git a/src/extras/defaults/qfirstpersoncameracontroller.cpp b/src/extras/defaults/qfirstpersoncameracontroller.cpp
new file mode 100644
index 000000000..0e1af51b3
--- /dev/null
+++ b/src/extras/defaults/qfirstpersoncameracontroller.cpp
@@ -0,0 +1,253 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qfirstpersoncameracontroller_p.h"
+#include "qfirstpersoncameracontroller.h"
+#include <Qt3DRender/QCamera>
+#include <Qt3DInput/QAxis>
+#include <Qt3DInput/QAnalogAxisInput>
+#include <Qt3DInput/QButtonAxisInput>
+#include <Qt3DInput/QAction>
+#include <Qt3DInput/QActionInput>
+#include <Qt3DInput/QLogicalDevice>
+#include <Qt3DInput/QKeyboardDevice>
+#include <Qt3DInput/QMouseDevice>
+#include <Qt3DInput/QMouseEvent>
+#include <Qt3DLogic/QFrameAction>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+QFirstPersonCameraControllerPrivate::QFirstPersonCameraControllerPrivate()
+ : Qt3DCore::QEntityPrivate()
+ , m_camera(nullptr)
+ , m_leftMouseButtonAction(new Qt3DInput::QAction())
+ , m_fineMotionAction(new Qt3DInput::QAction())
+ , m_rxAxis(new Qt3DInput::QAxis())
+ , m_ryAxis(new Qt3DInput::QAxis())
+ , m_txAxis(new Qt3DInput::QAxis())
+ , m_tyAxis(new Qt3DInput::QAxis())
+ , m_tzAxis(new Qt3DInput::QAxis())
+ , m_leftMouseButtonInput(new Qt3DInput::QActionInput())
+ , m_fineMotionKeyInput(new Qt3DInput::QActionInput())
+ , m_mouseRxInput(new Qt3DInput::QAnalogAxisInput())
+ , m_mouseRyInput(new Qt3DInput::QAnalogAxisInput())
+ , m_keyboardTxPosInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTyPosInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTzPosInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTxNegInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTyNegInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTzNegInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardDevice(new Qt3DInput::QKeyboardDevice())
+ , m_mouseDevice(new Qt3DInput::QMouseDevice())
+ , m_logicalDevice(new Qt3DInput::QLogicalDevice())
+ , m_frameAction(new Qt3DLogic::QFrameAction())
+ , m_linearSpeed(10.0f)
+ , m_lookSpeed(180.0f)
+ , m_firstPersonUp(QVector3D(0.0f, 1.0f, 0.0f))
+{}
+
+void QFirstPersonCameraControllerPrivate::init()
+{
+ //// Actions
+
+ // Left Mouse Button Action
+ m_leftMouseButtonInput->setButtons(QVector<int>() << Qt::LeftButton);
+ m_leftMouseButtonInput->setSourceDevice(m_mouseDevice);
+ m_leftMouseButtonAction->addInput(m_leftMouseButtonInput);
+
+ // Fine Motion Action
+ m_fineMotionKeyInput->setButtons(QVector<int>() << Qt::Key_Shift);
+ m_fineMotionKeyInput->setSourceDevice(m_keyboardDevice);
+ m_fineMotionAction->addInput(m_fineMotionKeyInput);
+
+ //// Axes
+
+ // Mouse X
+ m_mouseRxInput->setAxis(Qt3DInput::QMouseDevice::X);
+ m_mouseRxInput->setSourceDevice(m_mouseDevice);
+ m_rxAxis->addInput(m_mouseRxInput);
+
+ // Mouse Y
+ m_mouseRyInput->setAxis(Qt3DInput::QMouseDevice::Y);
+ m_mouseRyInput->setSourceDevice(m_mouseDevice);
+ m_ryAxis->addInput(m_mouseRyInput);
+
+ // Keyboard Pos Tx
+ m_keyboardTxPosInput->setButtons(QVector<int>() << Qt::Key_Right);
+ m_keyboardTxPosInput->setScale(1.0f);
+ m_keyboardTxPosInput->setSourceDevice(m_keyboardDevice);
+ m_txAxis->addInput(m_keyboardTxPosInput);
+
+ // Keyboard Pos Ty
+ m_keyboardTyPosInput->setButtons(QVector<int>() << Qt::Key_PageUp);
+ m_keyboardTyPosInput->setScale(1.0f);
+ m_keyboardTyPosInput->setSourceDevice(m_keyboardDevice);
+ m_tyAxis->addInput(m_keyboardTyPosInput);
+
+ // Keyboard Pos Tz
+ m_keyboardTzPosInput->setButtons(QVector<int>() << Qt::Key_Up);
+ m_keyboardTzPosInput->setScale(1.0f);
+ m_keyboardTzPosInput->setSourceDevice(m_keyboardDevice);
+ m_tzAxis->addInput(m_keyboardTzPosInput);
+
+ // Keyboard Neg Tx
+ m_keyboardTxNegInput->setButtons(QVector<int>() << Qt::Key_Left);
+ m_keyboardTxNegInput->setScale(-1.0f);
+ m_keyboardTxNegInput->setSourceDevice(m_keyboardDevice);
+ m_txAxis->addInput(m_keyboardTxNegInput);
+
+ // Keyboard Neg Ty
+ m_keyboardTyNegInput->setButtons(QVector<int>() << Qt::Key_PageDown);
+ m_keyboardTyNegInput->setScale(-1.0f);
+ m_keyboardTyNegInput->setSourceDevice(m_keyboardDevice);
+ m_tyAxis->addInput(m_keyboardTyNegInput);
+
+ // Keyboard Neg Tz
+ m_keyboardTzNegInput->setButtons(QVector<int>() << Qt::Key_Down);
+ m_keyboardTzNegInput->setScale(-1.0f);
+ m_keyboardTzNegInput->setSourceDevice(m_keyboardDevice);
+ m_tzAxis->addInput(m_keyboardTzNegInput);
+
+ //// Logical Device
+
+ m_logicalDevice->addAction(m_fineMotionAction);
+ m_logicalDevice->addAction(m_leftMouseButtonAction);
+ m_logicalDevice->addAxis(m_rxAxis);
+ m_logicalDevice->addAxis(m_ryAxis);
+ m_logicalDevice->addAxis(m_txAxis);
+ m_logicalDevice->addAxis(m_tyAxis);
+ m_logicalDevice->addAxis(m_tzAxis);
+
+ Q_Q(QFirstPersonCameraController);
+ //// FrameAction
+
+ QObject::connect(m_frameAction, SIGNAL(triggered(float)),
+ q, SLOT(_q_onTriggered(float)));
+
+ q->addComponent(m_frameAction);
+ q->addComponent(m_logicalDevice);
+}
+
+void QFirstPersonCameraControllerPrivate::_q_onTriggered(float dt)
+{
+ if (m_camera != nullptr) {
+ m_camera->translate(QVector3D(m_txAxis->value() * m_linearSpeed,
+ m_tyAxis->value() * m_linearSpeed,
+ m_tzAxis->value() * m_linearSpeed) * dt);
+ if (m_leftMouseButtonAction->isActive()) {
+ m_camera->pan(m_rxAxis->value() * m_lookSpeed * dt, m_firstPersonUp);
+ m_camera->tilt(m_ryAxis->value() * m_lookSpeed * dt);
+ }
+ }
+}
+
+QFirstPersonCameraController::QFirstPersonCameraController(Qt3DCore::QNode *parent)
+ : Qt3DCore::QEntity(*new QFirstPersonCameraControllerPrivate, parent)
+{
+ Q_D(QFirstPersonCameraController);
+ d->init();
+}
+
+QFirstPersonCameraController::~QFirstPersonCameraController()
+{
+}
+
+Qt3DRender::QCamera *QFirstPersonCameraController::camera() const
+{
+ Q_D(const QFirstPersonCameraController);
+ return d->m_camera;
+}
+
+float QFirstPersonCameraController::linearSpeed() const
+{
+ Q_D(const QFirstPersonCameraController);
+ return d->m_linearSpeed;
+}
+
+float QFirstPersonCameraController::lookSpeed() const
+{
+ Q_D(const QFirstPersonCameraController);
+ return d->m_lookSpeed;
+}
+
+void QFirstPersonCameraController::setCamera(Qt3DRender::QCamera *camera)
+{
+ Q_D(QFirstPersonCameraController);
+ if (d->m_camera != camera) {
+ d->m_camera = camera;
+ emit cameraChanged();
+ }
+}
+
+void QFirstPersonCameraController::setLinearSpeed(float linearSpeed)
+{
+ Q_D(QFirstPersonCameraController);
+ if (d->m_linearSpeed != linearSpeed) {
+ d->m_linearSpeed = linearSpeed;
+ emit linearSpeedChanged();
+ }
+}
+
+void QFirstPersonCameraController::setLookSpeed(float lookSpeed)
+{
+ Q_D(QFirstPersonCameraController);
+ if (d->m_lookSpeed != lookSpeed) {
+ d->m_lookSpeed = lookSpeed;
+ emit lookSpeedChanged();
+ }
+}
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#include "moc_qfirstpersoncameracontroller.cpp"
diff --git a/src/extras/defaults/qfirstpersoncameracontroller.h b/src/extras/defaults/qfirstpersoncameracontroller.h
new file mode 100644
index 000000000..e50d4db5a
--- /dev/null
+++ b/src/extras/defaults/qfirstpersoncameracontroller.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QFIRSTPERSONCAMERACONTROLLER_H
+#define QT3DEXTRAS_QFIRSTPERSONCAMERACONTROLLER_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DCore/QEntity>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+class QCamera;
+}
+
+namespace Qt3DExtras {
+
+class QFirstPersonCameraControllerPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QFirstPersonCameraController : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged)
+ Q_PROPERTY(float linearSpeed READ linearSpeed WRITE setLinearSpeed NOTIFY linearSpeedChanged)
+ Q_PROPERTY(float lookSpeed READ lookSpeed WRITE setLookSpeed NOTIFY lookSpeedChanged)
+
+public:
+ explicit QFirstPersonCameraController(Qt3DCore::QNode *parent = nullptr);
+ ~QFirstPersonCameraController();
+
+ Qt3DRender::QCamera *camera() const;
+ float linearSpeed() const;
+ float lookSpeed() const;
+
+ void setCamera(Qt3DRender::QCamera *camera);
+ void setLinearSpeed(float linearSpeed);
+ void setLookSpeed(float lookSpeed);
+
+Q_SIGNALS:
+ void cameraChanged();
+ void linearSpeedChanged();
+ void lookSpeedChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QFirstPersonCameraController)
+ Q_PRIVATE_SLOT(d_func(), void _q_onTriggered(float))
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QFIRSTPERSONCAMERACONTROLLER_H
diff --git a/src/extras/defaults/qfirstpersoncameracontroller_p.h b/src/extras/defaults/qfirstpersoncameracontroller_p.h
new file mode 100644
index 000000000..9ea830f85
--- /dev/null
+++ b/src/extras/defaults/qfirstpersoncameracontroller_p.h
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QFIRSTPERSONCAMERACONTROLLER_P_H
+#define QT3DEXTRAS_QFIRSTPERSONCAMERACONTROLLER_P_H
+
+#include <Qt3DCore/private/qentity_p.h>
+#include <QVector3D>
+#include "qfirstpersoncameracontroller.h"
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+class QCamera;
+}
+
+namespace Qt3DLogic {
+class QFrameAction;
+}
+
+namespace Qt3DInput {
+
+class QKeyboardDevice;
+class QMouseDevice;
+class QLogicalDevice;
+class QAction;
+class QActionInput;
+class QAxis;
+class QAnalogAxisInput;
+class QButtonAxisInput;
+class QAxisActionHandler;
+
+}
+
+namespace Qt3DExtras {
+
+class QFirstPersonCameraControllerPrivate : public Qt3DCore::QEntityPrivate
+{
+public:
+ QFirstPersonCameraControllerPrivate();
+
+ void init();
+
+ Qt3DRender::QCamera *m_camera;
+
+ Qt3DInput::QAction *m_leftMouseButtonAction;
+ Qt3DInput::QAction *m_fineMotionAction;
+
+ Qt3DInput::QAxis *m_rxAxis;
+ Qt3DInput::QAxis *m_ryAxis;
+ Qt3DInput::QAxis *m_txAxis;
+ Qt3DInput::QAxis *m_tyAxis;
+ Qt3DInput::QAxis *m_tzAxis;
+
+ Qt3DInput::QActionInput *m_leftMouseButtonInput;
+ Qt3DInput::QActionInput *m_fineMotionKeyInput;
+
+ Qt3DInput::QAnalogAxisInput *m_mouseRxInput;
+ Qt3DInput::QAnalogAxisInput *m_mouseRyInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTxPosInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTyPosInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTzPosInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTxNegInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTyNegInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTzNegInput;
+
+ Qt3DInput::QKeyboardDevice *m_keyboardDevice;
+ Qt3DInput::QMouseDevice *m_mouseDevice;
+
+ Qt3DInput::QLogicalDevice *m_logicalDevice;
+
+ Qt3DLogic::QFrameAction *m_frameAction;
+
+ float m_linearSpeed;
+ float m_lookSpeed;
+ QVector3D m_firstPersonUp;
+
+ void _q_onTriggered(float);
+
+ Q_DECLARE_PUBLIC(QFirstPersonCameraController)
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QFIRSTPERSONCAMERACONTROLLER_P_H
diff --git a/src/extras/defaults/qforwardrenderer.cpp b/src/extras/defaults/qforwardrenderer.cpp
new file mode 100644
index 000000000..8e6dc9425
--- /dev/null
+++ b/src/extras/defaults/qforwardrenderer.cpp
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qforwardrenderer.h"
+#include "qforwardrenderer_p.h"
+
+#include <Qt3DRender/qviewport.h>
+#include <Qt3DRender/qcameraselector.h>
+#include <Qt3DRender/qclearbuffers.h>
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qfrustumculling.h>
+#include <Qt3DRender/qrendersurfaceselector.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QForwardRendererPrivate::QForwardRendererPrivate()
+ : QTechniqueFilterPrivate()
+ , m_surfaceSelector(new QRenderSurfaceSelector)
+ , m_viewport(new QViewport())
+ , m_cameraSelector(new QCameraSelector())
+ , m_clearBuffer(new QClearBuffers())
+ , m_frustumCulling(new QFrustumCulling())
+{
+}
+
+void QForwardRendererPrivate::init()
+{
+ Q_Q(QForwardRenderer);
+
+ m_frustumCulling->setParent(m_clearBuffer);
+ m_clearBuffer->setParent(m_cameraSelector);
+ m_cameraSelector->setParent(m_viewport);
+ m_viewport->setParent(m_surfaceSelector);
+ m_surfaceSelector->setParent(q);
+
+ m_viewport->setNormalizedRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f));
+ m_clearBuffer->setClearColor(Qt::white);
+ m_clearBuffer->setBuffers(QClearBuffers::ColorDepthBuffer);
+
+ QFilterKey *forwardRenderingStyle = new QFilterKey(q);
+ forwardRenderingStyle->setName(QStringLiteral("renderingStyle"));
+ forwardRenderingStyle->setValue(QStringLiteral("forward"));
+ q->addMatch(forwardRenderingStyle);
+}
+
+/*!
+ \class Qt3DRender::QForwardRenderer
+ \brief The Qt3DRender::QForwardRenderer provides a default \l {QFrameGraph}{FrameGraph} implementation of a forward renderer.
+ \inmodule Qt3DRender
+ \since 5.5
+
+ Forward rendering is how OpenGL is traditionally. It renders directly to the backbuffer
+ one object at a time shading each one as it goes.
+
+ Internally the Qt3DRender::QForwardRenderer is a subclass of Qt3DRender::QTechniqueFilter.
+ This a is a single leaf Framegraph tree which contains a Qt3DRender::QViewport, a Qt3DRender::QCameraSelector
+ and a Qt3DRender::QClearBuffers.
+ The Qt3DRender::QForwardRenderer has a default requirement annotation whose name is "renderingStyle" and value "forward".
+ If you need to filter out your techniques, you should do so based on that annotation.
+
+ By default the viewport occupies the whole screen and the clear color is white. Frustum culling is also enabled.
+*/
+
+/*!
+ Constructs a new Qt3DRender::QForwardRenderer instance with parent object \a parent.
+ */
+QForwardRenderer::QForwardRenderer(QNode *parent)
+ : QTechniqueFilter(*new QForwardRendererPrivate, parent)
+{
+ Q_D(QForwardRenderer);
+ QObject::connect(d->m_clearBuffer, SIGNAL(clearColorChanged(const QColor &)), this, SIGNAL(clearColorChanged(const QColor &)));
+ QObject::connect(d->m_viewport, SIGNAL(normalizedRectChanged(const QRectF &)), this, SIGNAL(viewportRectChanged(const QRectF &)));
+ QObject::connect(d->m_cameraSelector, SIGNAL(cameraChanged(Qt3DCore::QEntity *)), this, SIGNAL(cameraChanged(Qt3DCore::QEntity *)));
+ QObject::connect(d->m_surfaceSelector, SIGNAL(surfaceChanged(QObject *)), this, SIGNAL(surfaceChanged(QObject *)));
+ d->init();
+}
+
+/*!
+ Destroys the QForwardRenderer instance.
+*/
+QForwardRenderer::~QForwardRenderer()
+{
+}
+
+void QForwardRenderer::setViewportRect(const QRectF &viewportRect)
+{
+ Q_D(QForwardRenderer);
+ d->m_viewport->setNormalizedRect(viewportRect);
+}
+
+void QForwardRenderer::setClearColor(const QColor &clearColor)
+{
+ Q_D(QForwardRenderer);
+ d->m_clearBuffer->setClearColor(clearColor);
+}
+
+/*!
+ Sets the camera which should be used to render the scene to \a camera.
+
+ \note A camera is a QEntity having a QCameraLens as one of its components.
+*/
+void QForwardRenderer::setCamera(Qt3DCore::QEntity *camera)
+{
+ Q_D(QForwardRenderer);
+ d->m_cameraSelector->setCamera(camera);
+}
+
+void QForwardRenderer::setSurface(QObject *surface)
+{
+ Q_D(QForwardRenderer);
+ d->m_surfaceSelector->setSurface(surface);
+}
+
+/*!
+ \property Qt3DRender::QForwardRenderer::viewportRect
+
+ Holds the current viewport normalizedRect.
+ */
+QRectF QForwardRenderer::viewportRect() const
+{
+ Q_D(const QForwardRenderer);
+ return d->m_viewport->normalizedRect();
+}
+
+/*!
+ \property Qt3DRender::QForwardRenderer::clearColor
+
+ Holds the current clearColor.
+*/
+QColor QForwardRenderer::clearColor() const
+{
+ Q_D(const QForwardRenderer);
+ return d->m_clearBuffer->clearColor();
+}
+
+/*!
+ \property Qt3DRender::QForwardRenderer::camera
+
+ Holds the current QEntity camera used to render the scene.
+
+ \note A camera is a QEntity that has a QCameraLens as one of its components.
+*/
+Qt3DCore::QEntity *QForwardRenderer::camera() const
+{
+ Q_D(const QForwardRenderer);
+ return d->m_cameraSelector->camera();
+}
+
+QObject *QForwardRenderer::surface() const
+{
+ Q_D(const QForwardRenderer);
+ return d->m_surfaceSelector->surface();
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qforwardrenderer.h b/src/extras/defaults/qforwardrenderer.h
new file mode 100644
index 000000000..a744b3caf
--- /dev/null
+++ b/src/extras/defaults/qforwardrenderer.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QFORWARDRENDERER_H
+#define QT3DEXTRAS_QFORWARDRENDERER_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qtechniquefilter.h>
+#include <QRectF>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+class QSurface;
+
+namespace Qt3DExtras {
+
+class QForwardRendererPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QForwardRenderer : public Qt3DRender::QTechniqueFilter
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
+ Q_PROPERTY(QRectF viewportRect READ viewportRect WRITE setViewportRect NOTIFY viewportRectChanged)
+ Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
+ Q_PROPERTY(Qt3DCore::QEntity *camera READ camera WRITE setCamera NOTIFY cameraChanged)
+public:
+ explicit QForwardRenderer(Qt3DCore::QNode *parent = nullptr);
+ ~QForwardRenderer();
+
+ QRectF viewportRect() const;
+ QColor clearColor() const;
+ Qt3DCore::QEntity *camera() const;
+ QObject *surface() const;
+
+public Q_SLOTS:
+ void setViewportRect(const QRectF &viewportRect);
+ void setClearColor(const QColor &clearColor);
+ void setCamera(Qt3DCore::QEntity *camera);
+ void setSurface(QObject * surface);
+
+Q_SIGNALS:
+ void viewportRectChanged(const QRectF &viewportRect);
+ void clearColorChanged(const QColor &clearColor);
+ void cameraChanged(Qt3DCore::QEntity *camera);
+ void surfaceChanged(QObject *surface);
+
+private:
+ Q_DECLARE_PRIVATE(QForwardRenderer)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QFORWARDRENDERER_H
diff --git a/src/extras/defaults/qforwardrenderer_p.h b/src/extras/defaults/qforwardrenderer_p.h
new file mode 100644
index 000000000..56d66a542
--- /dev/null
+++ b/src/extras/defaults/qforwardrenderer_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QFORWARDRENDERER_P_H
+#define QT3DEXTRAS_QFORWARDRENDERER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qtechniquefilter_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QForwardRenderer;
+class QViewport;
+class QClearBuffers;
+class QCameraSelector;
+class QFrustumCulling;
+class QRenderSurfaceSelector;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QForwardRendererPrivate: public Qt3DRender::QTechniqueFilterPrivate
+{
+public:
+ QForwardRendererPrivate();
+
+ Qt3DRender::QRenderSurfaceSelector *m_surfaceSelector;
+ Qt3DRender::QViewport *m_viewport;
+ Qt3DRender::QCameraSelector *m_cameraSelector;
+ Qt3DRender::QClearBuffers *m_clearBuffer;
+ Qt3DRender::QFrustumCulling *m_frustumCulling;
+
+ void init();
+
+ Q_DECLARE_PUBLIC(QForwardRenderer)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QFORWARDRENDERER_P_H
+
diff --git a/src/extras/defaults/qgoochmaterial.cpp b/src/extras/defaults/qgoochmaterial.cpp
new file mode 100644
index 000000000..6b6ea131a
--- /dev/null
+++ b/src/extras/defaults/qgoochmaterial.cpp
@@ -0,0 +1,363 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgoochmaterial.h"
+#include "qgoochmaterial_p.h"
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qtechnique.h>
+
+#include <QtCore/qurl.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+QGoochMaterialPrivate::QGoochMaterialPrivate()
+ : QMaterialPrivate()
+ , m_effect(new Qt3DRender::QEffect)
+ , m_diffuseParameter(new Qt3DRender::QParameter(QStringLiteral("kd"), QColor::fromRgbF(0.0f, 0.0f, 0.0f)))
+ , m_specularParameter(new Qt3DRender::QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.0f, 0.0f, 0.0f)))
+ , m_coolParameter(new Qt3DRender::QParameter(QStringLiteral("kblue"), QColor::fromRgbF(0.0f, 0.0f, 0.4f)))
+ , m_warmParameter(new Qt3DRender::QParameter(QStringLiteral("kyellow"), QColor::fromRgbF(0.4f, 0.4f, 0.0f)))
+ , m_alphaParameter(new Qt3DRender::QParameter(QStringLiteral("alpha"), 0.25f))
+ , m_betaParameter(new Qt3DRender::QParameter(QStringLiteral("beta"), 0.5f))
+ , m_shininessParameter(new Qt3DRender::QParameter(QStringLiteral("shininess"), 100.0f))
+ , m_gl3Technique(new Qt3DRender::QTechnique)
+ , m_gl2Technique(new Qt3DRender::QTechnique)
+ , m_es2Technique(new Qt3DRender::QTechnique)
+ , m_gl3RenderPass(new Qt3DRender::QRenderPass)
+ , m_gl2RenderPass(new Qt3DRender::QRenderPass)
+ , m_es2RenderPass(new Qt3DRender::QRenderPass)
+ , m_gl3Shader(new Qt3DRender::QShaderProgram)
+ , m_gl2ES2Shader(new Qt3DRender::QShaderProgram)
+ , m_filterKey(new Qt3DRender::QFilterKey)
+{
+}
+
+void QGoochMaterialPrivate::init()
+{
+ Q_Q(QGoochMaterial);
+
+ connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QGoochMaterialPrivate::handleDiffuseChanged);
+ connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QGoochMaterialPrivate::handleSpecularChanged);
+ connect(m_coolParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QGoochMaterialPrivate::handleCoolChanged);
+ connect(m_warmParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QGoochMaterialPrivate::handleWarmChanged);
+ connect(m_alphaParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QGoochMaterialPrivate::handleAlphaChanged);
+ connect(m_betaParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QGoochMaterialPrivate::handleBetaChanged);
+ connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QGoochMaterialPrivate::handleShininessChanged);
+
+ m_gl3Shader->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/gooch.vert"))));
+ m_gl3Shader->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/gooch.frag"))));
+ m_gl2ES2Shader->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/gooch.vert"))));
+ m_gl2ES2Shader->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/gooch.frag"))));
+
+ m_gl3Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
+ m_gl3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_gl3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_gl3Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
+
+ m_gl2Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
+ m_gl2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_gl2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_gl2Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
+
+ m_es2Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGLES);
+ m_es2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_es2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_es2Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
+
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_gl3Technique->addFilterKey(m_filterKey);
+ m_gl2Technique->addFilterKey(m_filterKey);
+ m_es2Technique->addFilterKey(m_filterKey);
+
+ m_gl3RenderPass->setShaderProgram(m_gl3Shader);
+ m_gl2RenderPass->setShaderProgram(m_gl2ES2Shader);
+ m_es2RenderPass->setShaderProgram(m_gl2ES2Shader);
+
+ m_gl3Technique->addRenderPass(m_gl3RenderPass);
+ m_gl2Technique->addRenderPass(m_gl2RenderPass);
+ m_es2Technique->addRenderPass(m_es2RenderPass);
+
+ m_effect->addTechnique(m_gl3Technique);
+ m_effect->addTechnique(m_gl2Technique);
+ m_effect->addTechnique(m_es2Technique);
+
+ m_effect->addParameter(m_diffuseParameter);
+ m_effect->addParameter(m_specularParameter);
+ m_effect->addParameter(m_coolParameter);
+ m_effect->addParameter(m_warmParameter);
+ m_effect->addParameter(m_alphaParameter);
+ m_effect->addParameter(m_betaParameter);
+ m_effect->addParameter(m_shininessParameter);
+
+ q->setEffect(m_effect);
+}
+
+void QGoochMaterialPrivate::handleDiffuseChanged(const QVariant &var)
+{
+ Q_Q(QGoochMaterial);
+ emit q->diffuseChanged(var.value<QColor>());
+}
+
+void QGoochMaterialPrivate::handleSpecularChanged(const QVariant &var)
+{
+ Q_Q(QGoochMaterial);
+ emit q->specularChanged(var.value<QColor>());
+}
+
+void QGoochMaterialPrivate::handleCoolChanged(const QVariant &var)
+{
+ Q_Q(QGoochMaterial);
+ emit q->coolChanged(var.value<QColor>());
+}
+
+void QGoochMaterialPrivate::handleWarmChanged(const QVariant &var)
+{
+ Q_Q(QGoochMaterial);
+ emit q->warmChanged(var.value<QColor>());
+}
+
+void QGoochMaterialPrivate::handleAlphaChanged(const QVariant &var)
+{
+ Q_Q(QGoochMaterial);
+ emit q->alphaChanged(var.toFloat());
+}
+
+void QGoochMaterialPrivate::handleBetaChanged(const QVariant &var)
+{
+ Q_Q(QGoochMaterial);
+ emit q->betaChanged(var.toFloat());
+}
+
+void QGoochMaterialPrivate::handleShininessChanged(const QVariant &var)
+{
+ Q_Q(QGoochMaterial);
+ emit q->shininessChanged(var.toFloat());
+}
+
+/*!
+ \class Qt3DExtras::QGoochMaterial
+ \brief The QGoochMaterial provides a material that implements the Gooch
+ shading model, popular in CAD and CAM applications.
+ \inmodule Qt3DExtras
+ \since 5.5
+
+ The Gooch lighting model uses both color and brightness to help show the
+ curvature of 3D surfaces. This is often better than models such as Phong
+ that rely purely upon changes in brightness. In situations such as in CAD
+ and CAM applications where photorealism is not a goal, the Gooch shading
+ model in conjunction with some kind of silhouette edge inking is a popular
+ solution.
+
+ The Gooch lighting model is explained fully in the \l{original Gooch
+ paper}. The Gooch model mixes a diffuse objetc color with a user-provided
+ cool color and warm color to produce the end points of a color ramp that is
+ used to shade the object based upon the cosine of the angle between the
+ vector from the fragment to the light source and the fragment's normal
+ vector. Optionally, a specular highlight can be added on top. The relative
+ contributions to the cool and warm colors by the diffuse color are
+ controlled by the alpha and beta properties respecitvely.
+
+ This material uses an effect with a single render pass approach and
+ performs per fragment lighting. Techniques are provided for OpenGL 2,
+ OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ Constructs a new Qt3DExtras::QGoochMaterial instance with parent object \a parent.
+*/
+QGoochMaterial::QGoochMaterial(QNode *parent)
+ : QMaterial(*new QGoochMaterialPrivate, parent)
+{
+ Q_D(QGoochMaterial);
+ d->init();
+}
+
+/*! \internal */
+QGoochMaterial::~QGoochMaterial()
+{
+}
+
+QGoochMaterial::QGoochMaterial(QGoochMaterialPrivate &dd, QNode *parent)
+ : QMaterial(dd, parent)
+{
+ Q_D(QGoochMaterial);
+ d->init();
+}
+
+/*!
+ \property Qt3DExtras::QGoochMaterial::diffuse
+
+ Holds the current diffuse color.
+*/
+QColor QGoochMaterial::diffuse() const
+{
+ Q_D(const QGoochMaterial);
+ return d->m_diffuseParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DExtras::QGoochMaterial::specular
+
+ Holds the current specular color.
+*/
+QColor QGoochMaterial::specular() const
+{
+ Q_D(const QGoochMaterial);
+ return d->m_specularParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DExtras::QGoochMaterial::cool
+
+ Holds the current cool color.
+*/
+QColor QGoochMaterial::cool() const
+{
+ Q_D(const QGoochMaterial);
+ return d->m_coolParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DExtras::QGoochMaterial::warm
+
+ Holds the current warm color.
+*/
+QColor QGoochMaterial::warm() const
+{
+ Q_D(const QGoochMaterial);
+ return d->m_warmParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DExtras::QGoochMaterial::alpha
+
+ Holds the current alpha value. The start point of the color ramp
+ used by the Gooch shader is calculated as {c = cool + alpha * diffuse}.
+*/
+float QGoochMaterial::alpha() const
+{
+ Q_D(const QGoochMaterial);
+ return d->m_alphaParameter->value().toFloat();
+}
+
+/*!
+ \property Qt3DExtras::QGoochMaterial::beta
+
+ Holds the current beta value. The start point of the color ramp
+ used by the Gooch shader is calculated as {c = warm + beta * diffuse}.
+*/
+float QGoochMaterial::beta() const
+{
+ Q_D(const QGoochMaterial);
+ return d->m_betaParameter->value().toFloat();
+}
+
+/*!
+ \property Qt3DExtras::QGoochMaterial::shininess
+
+ Holds the current shininess value. Higher values of shininess result in
+ a smaller and brighter highlight.
+*/
+float QGoochMaterial::shininess() const
+{
+ Q_D(const QGoochMaterial);
+ return d->m_shininessParameter->value().toFloat();
+}
+
+void QGoochMaterial::setDiffuse(const QColor &diffuse)
+{
+ Q_D(QGoochMaterial);
+ return d->m_diffuseParameter->setValue(diffuse);
+}
+
+void QGoochMaterial::setSpecular(const QColor &specular)
+{
+ Q_D(QGoochMaterial);
+ return d->m_specularParameter->setValue(specular);
+}
+
+void QGoochMaterial::setCool(const QColor &cool)
+{
+ Q_D(QGoochMaterial);
+ return d->m_coolParameter->setValue(cool);
+}
+
+void QGoochMaterial::setWarm(const QColor &warm)
+{
+ Q_D(QGoochMaterial);
+ return d->m_warmParameter->setValue(warm);
+}
+
+void QGoochMaterial::setAlpha(float alpha)
+{
+ Q_D(QGoochMaterial);
+ return d->m_alphaParameter->setValue(alpha);
+}
+
+void QGoochMaterial::setBeta(float beta)
+{
+ Q_D(QGoochMaterial);
+ return d->m_betaParameter->setValue(beta);
+}
+
+void QGoochMaterial::setShininess(float shininess)
+{
+ Q_D(QGoochMaterial);
+ return d->m_shininessParameter->setValue(shininess);
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qgoochmaterial.h b/src/extras/defaults/qgoochmaterial.h
new file mode 100644
index 000000000..232257513
--- /dev/null
+++ b/src/extras/defaults/qgoochmaterial.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QGOOCHMATERIAL_H
+#define QT3DEXTRAS_QGOOCHMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qmaterial.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QGoochMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QGoochMaterial : public Qt3DRender::QMaterial
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
+ Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
+ Q_PROPERTY(QColor cool READ cool WRITE setCool NOTIFY coolChanged)
+ Q_PROPERTY(QColor warm READ warm WRITE setWarm NOTIFY warmChanged)
+ Q_PROPERTY(float alpha READ alpha WRITE setAlpha NOTIFY alphaChanged)
+ Q_PROPERTY(float beta READ beta WRITE setBeta NOTIFY betaChanged)
+ Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
+
+public:
+ explicit QGoochMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QGoochMaterial();
+
+ QColor diffuse() const;
+ QColor specular() const;
+ QColor cool() const;
+ QColor warm() const;
+ float alpha() const;
+ float beta() const;
+ float shininess() const;
+
+public Q_SLOTS:
+ void setDiffuse(const QColor &diffuse);
+ void setSpecular(const QColor &specular);
+ void setCool(const QColor &cool);
+ void setWarm(const QColor &warm);
+ void setAlpha(float alpha);
+ void setBeta(float beta);
+ void setShininess(float shininess);
+
+Q_SIGNALS:
+ void diffuseChanged(const QColor &diffuse);
+ void specularChanged(const QColor &specular);
+ void coolChanged(const QColor &cool);
+ void warmChanged(const QColor &warm);
+ void alphaChanged(float alpha);
+ void betaChanged(float beta);
+ void shininessChanged(float shininess);
+
+protected:
+ explicit QGoochMaterial(QGoochMaterialPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QGoochMaterial)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QGOOCHMATERIAL_H
diff --git a/src/extras/defaults/qgoochmaterial_p.h b/src/extras/defaults/qgoochmaterial_p.h
new file mode 100644
index 000000000..d4ef256f6
--- /dev/null
+++ b/src/extras/defaults/qgoochmaterial_p.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QGOOCHMATERIAL_P_H
+#define QT3DEXTRAS_QGOOCHMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QEffect;
+class QRenderPass;
+class QShaderProgram;
+class QTechnique;
+
+}
+
+namespace Qt3DExtras {
+
+class QGoochMaterialPrivate : public Qt3DRender::QMaterialPrivate
+{
+public:
+ QGoochMaterialPrivate();
+
+ void init();
+
+ void handleDiffuseChanged(const QVariant &var);
+ void handleSpecularChanged(const QVariant &var);
+ void handleCoolChanged(const QVariant &var);
+ void handleWarmChanged(const QVariant &var);
+ void handleAlphaChanged(const QVariant &var);
+ void handleBetaChanged(const QVariant &var);
+ void handleShininessChanged(const QVariant &var);
+
+ Qt3DRender::QEffect *m_effect;
+ Qt3DRender::QParameter *m_diffuseParameter;
+ Qt3DRender::QParameter *m_specularParameter;
+ Qt3DRender::QParameter *m_coolParameter;
+ Qt3DRender::QParameter *m_warmParameter;
+ Qt3DRender::QParameter *m_alphaParameter;
+ Qt3DRender::QParameter *m_betaParameter;
+ Qt3DRender::QParameter *m_shininessParameter;
+ Qt3DRender::QTechnique *m_gl3Technique;
+ Qt3DRender::QTechnique *m_gl2Technique;
+ Qt3DRender::QTechnique *m_es2Technique;
+ Qt3DRender::QRenderPass *m_gl3RenderPass;
+ Qt3DRender::QRenderPass *m_gl2RenderPass;
+ Qt3DRender::QRenderPass *m_es2RenderPass;
+ Qt3DRender::QShaderProgram *m_gl3Shader;
+ Qt3DRender::QShaderProgram *m_gl2ES2Shader;
+ Qt3DRender::QFilterKey *m_filterKey;
+
+ Q_DECLARE_PUBLIC(QGoochMaterial)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QGOOCHMATERIAL_P_H
+
diff --git a/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp b/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp
new file mode 100644
index 000000000..61b8def84
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusemapalphamaterial.cpp
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnormaldiffusemapalphamaterial.h"
+#include "qnormaldiffusemapalphamaterial_p.h"
+
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <Qt3DRender/qalphacoverage.h>
+#include <Qt3DRender/qdepthtest.h>
+
+#include <QUrl>
+#include <QVector3D>
+#include <QVector4D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+
+QNormalDiffuseMapAlphaMaterialPrivate::QNormalDiffuseMapAlphaMaterialPrivate()
+ : QNormalDiffuseMapMaterialPrivate()
+ , m_alphaCoverage(new QAlphaCoverage())
+ , m_depthTest(new QDepthTest())
+{
+}
+
+void QNormalDiffuseMapAlphaMaterialPrivate::init()
+{
+ connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleAmbientChanged);
+ connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleDiffuseChanged);
+ connect(m_normalParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleNormalChanged);
+ connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleSpecularChanged);
+ connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleShininessChanged);
+ connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged);
+
+ m_normalDiffuseGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemap.vert"))));
+ m_normalDiffuseGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemapalpha.frag"))));
+ m_normalDiffuseGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemap.vert"))));
+ m_normalDiffuseGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemapalpha.frag"))));
+
+ m_normalDiffuseGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_normalDiffuseGL3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_normalDiffuseGL3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_normalDiffuseGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_normalDiffuseGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_normalDiffuseGL2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_normalDiffuseGL2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_normalDiffuseGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_normalDiffuseES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_normalDiffuseES2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_normalDiffuseES2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_normalDiffuseES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ Q_Q(QNormalDiffuseMapMaterial);
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_normalDiffuseGL3Technique->addFilterKey(m_filterKey);
+ m_normalDiffuseGL2Technique->addFilterKey(m_filterKey);
+ m_normalDiffuseES2Technique->addFilterKey(m_filterKey);
+
+ m_depthTest->setDepthFunction(QDepthTest::Less);
+
+ m_normalDiffuseGL3RenderPass->setShaderProgram(m_normalDiffuseGL3Shader);
+ m_normalDiffuseGL3RenderPass->addRenderState(m_alphaCoverage);
+ m_normalDiffuseGL3RenderPass->addRenderState(m_depthTest);
+
+ m_normalDiffuseGL2RenderPass->setShaderProgram(m_normalDiffuseGL2ES2Shader);
+ m_normalDiffuseGL2RenderPass->addRenderState(m_alphaCoverage);
+ m_normalDiffuseGL2RenderPass->addRenderState(m_depthTest);
+
+ m_normalDiffuseES2RenderPass->setShaderProgram(m_normalDiffuseGL2ES2Shader);
+ m_normalDiffuseES2RenderPass->addRenderState(m_alphaCoverage);
+ m_normalDiffuseES2RenderPass->addRenderState(m_depthTest);
+
+ m_normalDiffuseGL3Technique->addRenderPass(m_normalDiffuseGL3RenderPass);
+ m_normalDiffuseGL2Technique->addRenderPass(m_normalDiffuseGL2RenderPass);
+ m_normalDiffuseES2Technique->addRenderPass(m_normalDiffuseES2RenderPass);
+
+ m_normalDiffuseEffect->addTechnique(m_normalDiffuseGL3Technique);
+ m_normalDiffuseEffect->addTechnique(m_normalDiffuseGL2Technique);
+ m_normalDiffuseEffect->addTechnique(m_normalDiffuseES2Technique);
+
+ m_normalDiffuseEffect->addParameter(m_ambientParameter);
+ m_normalDiffuseEffect->addParameter(m_diffuseParameter);
+ m_normalDiffuseEffect->addParameter(m_normalParameter);
+ m_normalDiffuseEffect->addParameter(m_specularParameter);
+ m_normalDiffuseEffect->addParameter(m_shininessParameter);
+ m_normalDiffuseEffect->addParameter(m_textureScaleParameter);
+
+ q->setEffect(m_normalDiffuseEffect);
+}
+
+
+/*!
+ \class Qt3DRender::QNormalDiffuseMapAlphaMaterial
+ \brief The QNormalDiffuseMapAlphaMaterial provides a default implementation of the phong lighting and bump effect where the diffuse light component
+ is read from a texture map and the normals of the mesh being rendered from a normal texture map. In addition, it defines an alpha to coverage and
+ a depth test to be performed in the rendering pass.
+ \inmodule Qt3DRender
+ \since 5.5
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
+ The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+/*!
+ Constructs a new Qt3DRender::QNormalDiffuseMapAlphaMaterial instance with parent object \a parent.
+*/
+QNormalDiffuseMapAlphaMaterial::QNormalDiffuseMapAlphaMaterial(QNode *parent)
+ : QNormalDiffuseMapMaterial(*new QNormalDiffuseMapAlphaMaterialPrivate, parent)
+{
+}
+
+/*!
+ Destroys the QNormalDiffuseMapAlphaMaterial instance.
+*/
+QNormalDiffuseMapAlphaMaterial::~QNormalDiffuseMapAlphaMaterial()
+{
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qnormaldiffusemapalphamaterial.h b/src/extras/defaults/qnormaldiffusemapalphamaterial.h
new file mode 100644
index 000000000..040199b26
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusemapalphamaterial.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QNORMALDIFFUSEMAPALPHAMATERIAL_H
+#define QT3DEXTRAS_QNORMALDIFFUSEMAPALPHAMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DExtras/qnormaldiffusemapmaterial.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QNormalDiffuseMapAlphaMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QNormalDiffuseMapAlphaMaterial : public QNormalDiffuseMapMaterial
+{
+ Q_OBJECT
+public:
+ explicit QNormalDiffuseMapAlphaMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QNormalDiffuseMapAlphaMaterial();
+
+private:
+ Q_DECLARE_PRIVATE(QNormalDiffuseMapAlphaMaterial)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QNORMALDIFFUSEMAPALPHAMATERIAL_H
diff --git a/src/extras/defaults/qnormaldiffusemapalphamaterial_p.h b/src/extras/defaults/qnormaldiffusemapalphamaterial_p.h
new file mode 100644
index 000000000..91b0961f1
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusemapalphamaterial_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QNORMALDIFFUSEMAPALPHAMATERIAL_P_H
+#define QT3DEXTRAS_QNORMALDIFFUSEMAPALPHAMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qnormaldiffusemapmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+
+namespace Qt3DRender {
+
+class QAlphaCoverage;
+class QDepthTest;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QNormalDiffuseMapAlphaMaterial;
+class QNormalDiffuseMapAlphaMaterialPrivate: public QNormalDiffuseMapMaterialPrivate
+{
+public:
+ QNormalDiffuseMapAlphaMaterialPrivate();
+
+ void init() Q_DECL_OVERRIDE;
+
+ Qt3DRender::QAlphaCoverage *m_alphaCoverage;
+ Qt3DRender::QDepthTest *m_depthTest;
+
+ Q_DECLARE_PUBLIC(QNormalDiffuseMapAlphaMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QNORMALDIFFUSEMAPALPHAMATERIAL_P_H
+
diff --git a/src/extras/defaults/qnormaldiffusemapmaterial.cpp b/src/extras/defaults/qnormaldiffusemapmaterial.cpp
new file mode 100644
index 000000000..01d67a477
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusemapmaterial.cpp
@@ -0,0 +1,363 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnormaldiffusemapmaterial.h"
+#include "qnormaldiffusemapmaterial_p.h"
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+
+#include <QUrl>
+#include <QVector3D>
+#include <QVector4D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QNormalDiffuseMapMaterialPrivate::QNormalDiffuseMapMaterialPrivate()
+ : QMaterialPrivate()
+ , m_normalDiffuseEffect(new QEffect())
+ , m_diffuseTexture(new QTexture2D())
+ , m_normalTexture(new QTexture2D())
+ , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.1f, 0.1f, 0.1f, 1.0f)))
+ , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture))
+ , m_normalParameter(new QParameter(QStringLiteral("normalTexture"), m_normalTexture))
+ , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.01f, 0.01f, 0.01f, 1.0f)))
+ , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
+ , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
+ , m_normalDiffuseGL3Technique(new QTechnique())
+ , m_normalDiffuseGL2Technique(new QTechnique())
+ , m_normalDiffuseES2Technique(new QTechnique())
+ , m_normalDiffuseGL3RenderPass(new QRenderPass())
+ , m_normalDiffuseGL2RenderPass(new QRenderPass())
+ , m_normalDiffuseES2RenderPass(new QRenderPass())
+ , m_normalDiffuseGL3Shader(new QShaderProgram())
+ , m_normalDiffuseGL2ES2Shader(new QShaderProgram())
+ , m_filterKey(new QFilterKey)
+{
+ m_diffuseTexture->setMagnificationFilter(QAbstractTexture::Linear);
+ m_diffuseTexture->setMinificationFilter(QAbstractTexture::LinearMipMapLinear);
+ m_diffuseTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
+ m_diffuseTexture->setGenerateMipMaps(true);
+ m_diffuseTexture->setMaximumAnisotropy(16.0f);
+
+ m_normalTexture->setMagnificationFilter(QAbstractTexture::Linear);
+ m_normalTexture->setMinificationFilter(QAbstractTexture::Linear);
+ m_normalTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
+ m_normalTexture->setMaximumAnisotropy(16.0f);
+}
+
+void QNormalDiffuseMapMaterialPrivate::init()
+{
+ connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleAmbientChanged);
+ connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleDiffuseChanged);
+ connect(m_normalParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleNormalChanged);
+ connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleSpecularChanged);
+ connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleShininessChanged);
+ connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged);
+
+ m_normalDiffuseGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemap.vert"))));
+ m_normalDiffuseGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemap.frag"))));
+ m_normalDiffuseGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemap.vert"))));
+ m_normalDiffuseGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemap.frag"))));
+
+ m_normalDiffuseGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_normalDiffuseGL3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_normalDiffuseGL3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_normalDiffuseGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_normalDiffuseGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_normalDiffuseGL2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_normalDiffuseGL2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_normalDiffuseGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_normalDiffuseES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_normalDiffuseES2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_normalDiffuseES2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_normalDiffuseES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ Q_Q(QNormalDiffuseMapMaterial);
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_normalDiffuseGL3Technique->addFilterKey(m_filterKey);
+ m_normalDiffuseGL2Technique->addFilterKey(m_filterKey);
+ m_normalDiffuseES2Technique->addFilterKey(m_filterKey);
+
+ m_normalDiffuseGL3RenderPass->setShaderProgram(m_normalDiffuseGL3Shader);
+ m_normalDiffuseGL2RenderPass->setShaderProgram(m_normalDiffuseGL2ES2Shader);
+ m_normalDiffuseES2RenderPass->setShaderProgram(m_normalDiffuseGL2ES2Shader);
+
+ m_normalDiffuseGL3Technique->addRenderPass(m_normalDiffuseGL3RenderPass);
+ m_normalDiffuseGL2Technique->addRenderPass(m_normalDiffuseGL2RenderPass);
+ m_normalDiffuseES2Technique->addRenderPass(m_normalDiffuseES2RenderPass);
+
+ m_normalDiffuseEffect->addTechnique(m_normalDiffuseGL3Technique);
+ m_normalDiffuseEffect->addTechnique(m_normalDiffuseGL2Technique);
+ m_normalDiffuseEffect->addTechnique(m_normalDiffuseES2Technique);
+
+ m_normalDiffuseEffect->addParameter(m_ambientParameter);
+ m_normalDiffuseEffect->addParameter(m_diffuseParameter);
+ m_normalDiffuseEffect->addParameter(m_normalParameter);
+ m_normalDiffuseEffect->addParameter(m_specularParameter);
+ m_normalDiffuseEffect->addParameter(m_shininessParameter);
+ m_normalDiffuseEffect->addParameter(m_textureScaleParameter);
+
+ q->setEffect(m_normalDiffuseEffect);
+}
+
+void QNormalDiffuseMapMaterialPrivate::handleAmbientChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseMapMaterial);
+ emit q->ambientChanged(var.value<QColor>());
+}
+
+void QNormalDiffuseMapMaterialPrivate::handleDiffuseChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseMapMaterial);
+ emit q->diffuseChanged(var.value<QAbstractTexture *>());
+}
+
+void QNormalDiffuseMapMaterialPrivate::handleNormalChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseMapMaterial);
+ emit q->normalChanged(var.value<QAbstractTexture *>());
+}
+
+void QNormalDiffuseMapMaterialPrivate::handleSpecularChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseMapMaterial);
+ emit q->specularChanged(var.value<QColor>());
+}
+
+void QNormalDiffuseMapMaterialPrivate::handleShininessChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseMapMaterial);
+ emit q->shininessChanged(var.toFloat());
+}
+
+void QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseMapMaterial);
+ emit q->textureScaleChanged(var.toFloat());
+}
+
+/*!
+ \class Qt3DRender::QNormalDiffuseMapMaterial
+ \brief The QNormalDiffuseMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse light component
+ is read from a texture map and the normals of the mesh being rendered from a normal texture map.
+ \inmodule Qt3DRender
+ \since 5.5
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
+ The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ Constructs a new Qt3DRender::QNormalDiffuseMapMaterial instance with parent object \a parent.
+*/
+QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNode *parent)
+ : QMaterial(*new QNormalDiffuseMapMaterialPrivate, parent)
+{
+ Q_D(QNormalDiffuseMapMaterial);
+ d->init();
+}
+
+/*! \internal */
+QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNormalDiffuseMapMaterialPrivate &dd, QNode *parent)
+ : QMaterial(dd, parent)
+{
+ Q_D(QNormalDiffuseMapMaterial);
+ d->init();
+}
+
+/*!
+ Destroys the QNormalDiffuseMapMaterial instance.
+*/
+QNormalDiffuseMapMaterial::~QNormalDiffuseMapMaterial()
+{
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseMapMaterial::ambient
+
+ Holds the current ambient color.
+*/
+QColor QNormalDiffuseMapMaterial::ambient() const
+{
+ Q_D(const QNormalDiffuseMapMaterial);
+ return d->m_ambientParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseMapMaterial::specular
+
+ Holds the current specular color.
+*/
+QColor QNormalDiffuseMapMaterial::specular() const
+{
+ Q_D(const QNormalDiffuseMapMaterial);
+ return d->m_specularParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseMapMaterial::diffuse
+
+ Holds the current diffuse map texture.
+
+ By default, the diffuse texture has these properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap modeM
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+QAbstractTexture *QNormalDiffuseMapMaterial::diffuse() const
+{
+ Q_D(const QNormalDiffuseMapMaterial);
+ return d->m_diffuseParameter->value().value<QAbstractTexture *>();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseMapMaterial::normal
+
+ Holds the current normal map texture.
+
+ By default, the normal texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+QAbstractTexture *QNormalDiffuseMapMaterial::normal() const
+{
+ Q_D(const QNormalDiffuseMapMaterial);
+ return d->m_normalParameter->value().value<QAbstractTexture *>();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseMapMaterial::shininess
+
+ Holds the current shininess as a float value.
+*/
+float QNormalDiffuseMapMaterial::shininess() const
+{
+ Q_D(const QNormalDiffuseMapMaterial);
+ return d->m_shininessParameter->value().toFloat();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseMapMaterial::textureScale
+
+ Holds the current texture scale as a float value.
+*/
+float QNormalDiffuseMapMaterial::textureScale() const
+{
+ Q_D(const QNormalDiffuseMapMaterial);
+ return d->m_textureScaleParameter->value().toFloat();
+}
+
+void QNormalDiffuseMapMaterial::setAmbient(const QColor &ambient)
+{
+ Q_D(QNormalDiffuseMapMaterial);
+ d->m_ambientParameter->setValue(ambient);
+}
+
+void QNormalDiffuseMapMaterial::setSpecular(const QColor &specular)
+{
+ Q_D(QNormalDiffuseMapMaterial);
+ d->m_specularParameter->setValue(specular);
+}
+
+void QNormalDiffuseMapMaterial::setDiffuse(QAbstractTexture *diffuse)
+{
+ Q_D(QNormalDiffuseMapMaterial);
+ d->m_diffuseParameter->setValue(QVariant::fromValue(diffuse));
+}
+
+void QNormalDiffuseMapMaterial::setNormal(QAbstractTexture *normal)
+{
+ Q_D(QNormalDiffuseMapMaterial);
+ d->m_normalParameter->setValue(QVariant::fromValue(normal));
+}
+
+void QNormalDiffuseMapMaterial::setShininess(float shininess)
+{
+ Q_D(QNormalDiffuseMapMaterial);
+ d->m_shininessParameter->setValue(shininess);
+}
+
+void QNormalDiffuseMapMaterial::setTextureScale(float textureScale)
+{
+ Q_D(QNormalDiffuseMapMaterial);
+ d->m_textureScaleParameter->setValue(textureScale);
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qnormaldiffusemapmaterial.h b/src/extras/defaults/qnormaldiffusemapmaterial.h
new file mode 100644
index 000000000..f60a27b86
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusemapmaterial.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QNORMALDIFFUSEMAPMATERIAL_H
+#define QT3DEXTRAS_QNORMALDIFFUSEMAPMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qmaterial.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractTexture;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QNormalDiffuseMapMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QNormalDiffuseMapMaterial : public Qt3DRender::QMaterial
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
+ Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture *diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture *normal READ normal WRITE setNormal NOTIFY normalChanged)
+ Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
+ Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
+
+public:
+ explicit QNormalDiffuseMapMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QNormalDiffuseMapMaterial();
+
+ QColor ambient() const;
+ QColor specular() const;
+ Qt3DRender::QAbstractTexture *diffuse() const;
+ Qt3DRender::QAbstractTexture *normal() const;
+ float shininess() const;
+ float textureScale() const;
+
+public Q_SLOTS:
+ void setAmbient(const QColor &ambient);
+ void setSpecular(const QColor &specular);
+ void setDiffuse(Qt3DRender::QAbstractTexture *diffuse);
+ void setNormal(Qt3DRender::QAbstractTexture *normal);
+ void setShininess(float shininess);
+ void setTextureScale(float textureScale);
+
+Q_SIGNALS:
+ void ambientChanged(const QColor &ambient);
+ void diffuseChanged(Qt3DRender::QAbstractTexture *diffuse);
+ void normalChanged(Qt3DRender::QAbstractTexture *normal);
+ void specularChanged(const QColor &specular);
+ void shininessChanged(float shininess);
+ void textureScaleChanged(float textureScale);
+
+protected:
+ QNormalDiffuseMapMaterial(QNormalDiffuseMapMaterialPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QNormalDiffuseMapMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QNORMALDIFFUSEMAPMATERIAL_H
diff --git a/src/extras/defaults/qnormaldiffusemapmaterial_p.h b/src/extras/defaults/qnormaldiffusemapmaterial_p.h
new file mode 100644
index 000000000..8dff59218
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusemapmaterial_p.h
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QNORMALDIFFUSEMAPMATERIAL_P_H
+#define QT3DEXTRAS_QNORMALDIFFUSEMAPMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QEffect;
+class QAbstractTexture;
+class QTechnique;
+class QParameter;
+class QShaderProgram;
+class QRenderPass;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QNormalDiffuseMapMaterial;
+
+class QNormalDiffuseMapMaterialPrivate: public Qt3DRender::QMaterialPrivate
+{
+public:
+ QNormalDiffuseMapMaterialPrivate();
+
+ virtual void init();
+
+ void handleAmbientChanged(const QVariant &var);
+ void handleDiffuseChanged(const QVariant &var);
+ void handleNormalChanged(const QVariant &var);
+ void handleSpecularChanged(const QVariant &var);
+ void handleShininessChanged(const QVariant &var);
+ void handleTextureScaleChanged(const QVariant &var);
+
+ Qt3DRender::QEffect *m_normalDiffuseEffect;
+ Qt3DRender::QAbstractTexture *m_diffuseTexture;
+ Qt3DRender::QAbstractTexture *m_normalTexture;
+ Qt3DRender::QParameter *m_ambientParameter;
+ Qt3DRender::QParameter *m_diffuseParameter;
+ Qt3DRender::QParameter *m_normalParameter;
+ Qt3DRender::QParameter *m_specularParameter;
+ Qt3DRender::QParameter *m_shininessParameter;
+ Qt3DRender::QParameter *m_textureScaleParameter;
+ Qt3DRender::QTechnique *m_normalDiffuseGL3Technique;
+ Qt3DRender::QTechnique *m_normalDiffuseGL2Technique;
+ Qt3DRender::QTechnique *m_normalDiffuseES2Technique;
+ Qt3DRender::QRenderPass *m_normalDiffuseGL3RenderPass;
+ Qt3DRender::QRenderPass *m_normalDiffuseGL2RenderPass;
+ Qt3DRender::QRenderPass *m_normalDiffuseES2RenderPass;
+ Qt3DRender::QShaderProgram *m_normalDiffuseGL3Shader;
+ Qt3DRender::QShaderProgram *m_normalDiffuseGL2ES2Shader;
+ Qt3DRender::QFilterKey *m_filterKey;
+
+ Q_DECLARE_PUBLIC(QNormalDiffuseMapMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QNORMALDIFFUSEMAPMATERIAL_P_H
+
diff --git a/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp b/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp
new file mode 100644
index 000000000..6d54b9535
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusespecularmapmaterial.cpp
@@ -0,0 +1,379 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnormaldiffusespecularmapmaterial.h"
+#include "qnormaldiffusespecularmapmaterial_p.h"
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <QUrl>
+#include <QVector3D>
+#include <QVector4D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QNormalDiffuseSpecularMapMaterialPrivate::QNormalDiffuseSpecularMapMaterialPrivate()
+ : QMaterialPrivate()
+ , m_normalDiffuseSpecularEffect(new QEffect())
+ , m_diffuseTexture(new QTexture2D())
+ , m_normalTexture(new QTexture2D())
+ , m_specularTexture(new QTexture2D())
+ , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
+ , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture))
+ , m_normalParameter(new QParameter(QStringLiteral("normalTexture"), m_normalTexture))
+ , m_specularParameter(new QParameter(QStringLiteral("specularTexture"), m_specularTexture))
+ , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
+ , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
+ , m_normalDiffuseSpecularGL3Technique(new QTechnique())
+ , m_normalDiffuseSpecularGL2Technique(new QTechnique())
+ , m_normalDiffuseSpecularES2Technique(new QTechnique())
+ , m_normalDiffuseSpecularGL3RenderPass(new QRenderPass())
+ , m_normalDiffuseSpecularGL2RenderPass(new QRenderPass())
+ , m_normalDiffuseSpecularES2RenderPass(new QRenderPass())
+ , m_normalDiffuseSpecularGL3Shader(new QShaderProgram())
+ , m_normalDiffuseSpecularGL2ES2Shader(new QShaderProgram())
+ , m_filterKey(new QFilterKey)
+{
+ m_diffuseTexture->setMagnificationFilter(QAbstractTexture::Linear);
+ m_diffuseTexture->setMinificationFilter(QAbstractTexture::LinearMipMapLinear);
+ m_diffuseTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
+ m_diffuseTexture->setGenerateMipMaps(true);
+ m_diffuseTexture->setMaximumAnisotropy(16.0f);
+
+ m_normalTexture->setMagnificationFilter(QAbstractTexture::Linear);
+ m_normalTexture->setMinificationFilter(QAbstractTexture::Linear);
+ m_normalTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
+ m_normalTexture->setMaximumAnisotropy(16.0f);
+
+ m_specularTexture->setMagnificationFilter(QAbstractTexture::Linear);
+ m_specularTexture->setMinificationFilter(QAbstractTexture::LinearMipMapLinear);
+ m_specularTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
+ m_specularTexture->setGenerateMipMaps(true);
+ m_specularTexture->setMaximumAnisotropy(16.0f);
+}
+
+void QNormalDiffuseSpecularMapMaterialPrivate::init()
+{
+ connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseSpecularMapMaterialPrivate::handleAmbientChanged);
+ connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseSpecularMapMaterialPrivate::handleDiffuseChanged);
+ connect(m_normalParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseSpecularMapMaterialPrivate::handleNormalChanged);
+ connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseSpecularMapMaterialPrivate::handleSpecularChanged);
+ connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseSpecularMapMaterialPrivate::handleShininessChanged);
+ connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QNormalDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged);
+
+ m_normalDiffuseSpecularGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemap.vert"))));
+ m_normalDiffuseSpecularGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusespecularmap.frag"))));
+ m_normalDiffuseSpecularGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemap.vert"))));
+ m_normalDiffuseSpecularGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusespecularmap.frag"))));
+
+ m_normalDiffuseSpecularGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_normalDiffuseSpecularGL3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_normalDiffuseSpecularGL3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_normalDiffuseSpecularGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_normalDiffuseSpecularGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_normalDiffuseSpecularGL2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_normalDiffuseSpecularGL2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_normalDiffuseSpecularGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_normalDiffuseSpecularES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_normalDiffuseSpecularES2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_normalDiffuseSpecularES2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_normalDiffuseSpecularES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ Q_Q(QNormalDiffuseSpecularMapMaterial);
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_normalDiffuseSpecularGL3Technique->addFilterKey(m_filterKey);
+ m_normalDiffuseSpecularGL2Technique->addFilterKey(m_filterKey);
+ m_normalDiffuseSpecularES2Technique->addFilterKey(m_filterKey);
+
+ m_normalDiffuseSpecularGL3RenderPass->setShaderProgram(m_normalDiffuseSpecularGL3Shader);
+ m_normalDiffuseSpecularGL2RenderPass->setShaderProgram(m_normalDiffuseSpecularGL2ES2Shader);
+ m_normalDiffuseSpecularES2RenderPass->setShaderProgram(m_normalDiffuseSpecularGL2ES2Shader);
+
+ m_normalDiffuseSpecularGL3Technique->addRenderPass(m_normalDiffuseSpecularGL3RenderPass);
+ m_normalDiffuseSpecularGL2Technique->addRenderPass(m_normalDiffuseSpecularGL2RenderPass);
+ m_normalDiffuseSpecularES2Technique->addRenderPass(m_normalDiffuseSpecularES2RenderPass);
+
+ m_normalDiffuseSpecularEffect->addTechnique(m_normalDiffuseSpecularGL3Technique);
+ m_normalDiffuseSpecularEffect->addTechnique(m_normalDiffuseSpecularGL2Technique);
+ m_normalDiffuseSpecularEffect->addTechnique(m_normalDiffuseSpecularES2Technique);
+
+ m_normalDiffuseSpecularEffect->addParameter(m_ambientParameter);
+ m_normalDiffuseSpecularEffect->addParameter(m_diffuseParameter);
+ m_normalDiffuseSpecularEffect->addParameter(m_normalParameter);
+ m_normalDiffuseSpecularEffect->addParameter(m_specularParameter);
+ m_normalDiffuseSpecularEffect->addParameter(m_shininessParameter);
+ m_normalDiffuseSpecularEffect->addParameter(m_textureScaleParameter);
+
+ q->setEffect(m_normalDiffuseSpecularEffect);
+}
+
+void QNormalDiffuseSpecularMapMaterialPrivate::handleAmbientChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseSpecularMapMaterial);
+ emit q->ambientChanged(var.value<QColor>());
+}
+
+void QNormalDiffuseSpecularMapMaterialPrivate::handleDiffuseChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseSpecularMapMaterial);
+ emit q->diffuseChanged(var.value<QAbstractTexture *>());
+}
+
+void QNormalDiffuseSpecularMapMaterialPrivate::handleNormalChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseSpecularMapMaterial);
+ emit q->normalChanged(var.value<QAbstractTexture *>());
+}
+
+void QNormalDiffuseSpecularMapMaterialPrivate::handleSpecularChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseSpecularMapMaterial);
+ emit q->specularChanged(var.value<QAbstractTexture *>());
+}
+
+void QNormalDiffuseSpecularMapMaterialPrivate::handleShininessChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseSpecularMapMaterial);
+ emit q->shininessChanged(var.toFloat());
+}
+
+void QNormalDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
+{
+ Q_Q(QNormalDiffuseSpecularMapMaterial);
+ emit q->textureScaleChanged(var.toFloat());
+}
+
+/*!
+ \class Qt3DRender::QNormalDiffuseSpecularMapMaterial
+ \brief The QNormalDiffuseSpecularMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse and specular light components
+ are read from texture maps and the normals of the mesh being rendered from a normal texture map.
+ \inmodule Qt3DRender
+ \since 5.5
+
+ The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
+ The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ Constructs a new Qt3DRender::QNormalDiffuseSpecularMapMaterial instance with parent object \a parent.
+*/
+QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNode *parent)
+ : QMaterial(*new QNormalDiffuseSpecularMapMaterialPrivate, parent)
+{
+ Q_D(QNormalDiffuseSpecularMapMaterial);
+ d->init();
+}
+
+/*! \internal */
+QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNormalDiffuseSpecularMapMaterialPrivate &dd, QNode *parent)
+ : QMaterial(dd, parent)
+{
+ Q_D(QNormalDiffuseSpecularMapMaterial);
+ d->init();
+}
+
+/*!
+ Destroys the Qt3DRender::QNormalDiffuseSpecularMapMaterial instance.
+*/
+QNormalDiffuseSpecularMapMaterial::~QNormalDiffuseSpecularMapMaterial()
+{
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::ambient
+
+ Holds the current ambient color.
+*/
+QColor QNormalDiffuseSpecularMapMaterial::ambient() const
+{
+ Q_D(const QNormalDiffuseSpecularMapMaterial);
+ return d->m_ambientParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::diffuse
+
+ Holds the current diffuse map texture.
+
+ By default, the diffuse texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+QAbstractTexture *QNormalDiffuseSpecularMapMaterial::diffuse() const
+{
+ Q_D(const QNormalDiffuseSpecularMapMaterial);
+ return d->m_diffuseParameter->value().value<QAbstractTexture *>();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::normal
+
+ Holds the current normal map texture.
+
+ By default, the normal texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+QAbstractTexture *QNormalDiffuseSpecularMapMaterial::normal() const
+{
+ Q_D(const QNormalDiffuseSpecularMapMaterial);
+ return d->m_normalParameter->value().value<QAbstractTexture *>();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::specular
+
+ Holds the current specular map texture.
+
+ By default, the specular texture has the following properties:
+
+ \list
+ \li Linear minification and magnification filters
+ \li Linear mipmap with mipmapping enabled
+ \li Repeat wrap mode
+ \li Maximum anisotropy of 16.0
+ \endlist
+*/
+QAbstractTexture *QNormalDiffuseSpecularMapMaterial::specular() const
+{
+ Q_D(const QNormalDiffuseSpecularMapMaterial);
+ return d->m_specularParameter->value().value<QAbstractTexture *>();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::shininess
+
+ Holds the current shininess as a float value.
+*/
+float QNormalDiffuseSpecularMapMaterial::shininess() const
+{
+ Q_D(const QNormalDiffuseSpecularMapMaterial);
+ return d->m_shininessParameter->value().toFloat();
+}
+
+/*!
+ \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::textureScale
+
+ Holds the current texture scale as a float value.
+*/
+float QNormalDiffuseSpecularMapMaterial::textureScale() const
+{
+ Q_D(const QNormalDiffuseSpecularMapMaterial);
+ return d->m_textureScaleParameter->value().toFloat();
+}
+
+void QNormalDiffuseSpecularMapMaterial::setAmbient(const QColor &ambient)
+{
+ Q_D(QNormalDiffuseSpecularMapMaterial);
+ d->m_ambientParameter->setValue(ambient);
+}
+
+void QNormalDiffuseSpecularMapMaterial::setDiffuse(QAbstractTexture *diffuse)
+{
+ Q_D(QNormalDiffuseSpecularMapMaterial);
+ d->m_diffuseParameter->setValue(QVariant::fromValue(diffuse));
+}
+
+void QNormalDiffuseSpecularMapMaterial::setNormal(QAbstractTexture *normal)
+{
+ Q_D(QNormalDiffuseSpecularMapMaterial);
+ d->m_normalParameter->setValue(QVariant::fromValue(normal));
+}
+
+void QNormalDiffuseSpecularMapMaterial::setSpecular(QAbstractTexture *specular)
+{
+ Q_D(QNormalDiffuseSpecularMapMaterial);
+ d->m_specularParameter->setValue(QVariant::fromValue(specular));
+}
+
+void QNormalDiffuseSpecularMapMaterial::setShininess(float shininess)
+{
+ Q_D(QNormalDiffuseSpecularMapMaterial);
+ d->m_shininessParameter->setValue(shininess);
+}
+
+void QNormalDiffuseSpecularMapMaterial::setTextureScale(float textureScale)
+{
+ Q_D(QNormalDiffuseSpecularMapMaterial);
+ d->m_textureScaleParameter->setValue(textureScale);
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qnormaldiffusespecularmapmaterial.h b/src/extras/defaults/qnormaldiffusespecularmapmaterial.h
new file mode 100644
index 000000000..586715971
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusespecularmapmaterial.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QNORMALDIFFUSESPECULARMAPMATERIAL_H
+#define QT3DEXTRAS_QNORMALDIFFUSESPECULARMAPMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qmaterial.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QNormalDiffuseSpecularMapMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QNormalDiffuseSpecularMapMaterial : public Qt3DRender::QMaterial
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture *diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture *normal READ normal WRITE setNormal NOTIFY normalChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture *specular READ specular WRITE setSpecular NOTIFY specularChanged)
+ Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
+ Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
+
+public:
+ explicit QNormalDiffuseSpecularMapMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QNormalDiffuseSpecularMapMaterial();
+
+ QColor ambient() const;
+ Qt3DRender::QAbstractTexture *diffuse() const;
+ Qt3DRender::QAbstractTexture *normal() const;
+ Qt3DRender::QAbstractTexture *specular() const;
+ float shininess() const;
+ float textureScale() const;
+
+public Q_SLOTS:
+ void setAmbient(const QColor &ambient);
+ void setDiffuse(Qt3DRender::QAbstractTexture *diffuse);
+ void setNormal(Qt3DRender::QAbstractTexture *normal);
+ void setSpecular(Qt3DRender::QAbstractTexture *specular);
+ void setShininess(float shininess);
+ void setTextureScale(float textureScale);
+
+Q_SIGNALS:
+ void ambientChanged(const QColor &ambient);
+ void diffuseChanged(Qt3DRender::QAbstractTexture *diffuse);
+ void normalChanged(Qt3DRender::QAbstractTexture *normal);
+ void specularChanged(Qt3DRender::QAbstractTexture *specular);
+ void shininessChanged(float shininess);
+ void textureScaleChanged(float textureScale);
+
+protected:
+ QNormalDiffuseSpecularMapMaterial(QNormalDiffuseSpecularMapMaterialPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QNormalDiffuseSpecularMapMaterial)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QNORMALDIFFUSESPECULARMAPMATERIAL_H
diff --git a/src/extras/defaults/qnormaldiffusespecularmapmaterial_p.h b/src/extras/defaults/qnormaldiffusespecularmapmaterial_p.h
new file mode 100644
index 000000000..3316044ff
--- /dev/null
+++ b/src/extras/defaults/qnormaldiffusespecularmapmaterial_p.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QNORMALDIFFUSESPECULARMAPMATERIAL_P_H
+#define QT3DEXTRAS_QNORMALDIFFUSESPECULARMAPMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QEffect;
+class QAbstractTexture;
+class QTechnique;
+class QParameter;
+class QShaderProgram;
+class QRenderPass;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QNormalDiffuseSpecularMapMaterial;
+
+class QNormalDiffuseSpecularMapMaterialPrivate : public Qt3DRender::QMaterialPrivate
+{
+public:
+ QNormalDiffuseSpecularMapMaterialPrivate();
+
+ void init();
+
+ void handleAmbientChanged(const QVariant &var);
+ void handleDiffuseChanged(const QVariant &var);
+ void handleNormalChanged(const QVariant &var);
+ void handleSpecularChanged(const QVariant &var);
+ void handleShininessChanged(const QVariant &var);
+ void handleTextureScaleChanged(const QVariant &var);
+
+ Qt3DRender::QEffect *m_normalDiffuseSpecularEffect;
+ Qt3DRender::QAbstractTexture *m_diffuseTexture;
+ Qt3DRender::QAbstractTexture *m_normalTexture;
+ Qt3DRender::QAbstractTexture *m_specularTexture;
+ Qt3DRender::QParameter *m_ambientParameter;
+ Qt3DRender::QParameter *m_diffuseParameter;
+ Qt3DRender::QParameter *m_normalParameter;
+ Qt3DRender::QParameter *m_specularParameter;
+ Qt3DRender::QParameter *m_shininessParameter;
+ Qt3DRender::QParameter *m_textureScaleParameter;
+ Qt3DRender::QTechnique *m_normalDiffuseSpecularGL3Technique;
+ Qt3DRender::QTechnique *m_normalDiffuseSpecularGL2Technique;
+ Qt3DRender::QTechnique *m_normalDiffuseSpecularES2Technique;
+ Qt3DRender::QRenderPass *m_normalDiffuseSpecularGL3RenderPass;
+ Qt3DRender::QRenderPass *m_normalDiffuseSpecularGL2RenderPass;
+ Qt3DRender::QRenderPass *m_normalDiffuseSpecularES2RenderPass;
+ Qt3DRender::QShaderProgram *m_normalDiffuseSpecularGL3Shader;
+ Qt3DRender::QShaderProgram *m_normalDiffuseSpecularGL2ES2Shader;
+ Qt3DRender::QFilterKey *m_filterKey;
+
+ Q_DECLARE_PUBLIC(QNormalDiffuseSpecularMapMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QNORMALDIFFUSESPECULARMAPMATERIAL_P_H
+
diff --git a/src/extras/defaults/qorbitcameracontroller.cpp b/src/extras/defaults/qorbitcameracontroller.cpp
new file mode 100644
index 000000000..deeec7f0d
--- /dev/null
+++ b/src/extras/defaults/qorbitcameracontroller.cpp
@@ -0,0 +1,321 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qorbitcameracontroller_p.h"
+#include "qorbitcameracontroller.h"
+#include <QtGlobal>
+#include <Qt3DRender/QCamera>
+#include <Qt3DInput/QAxis>
+#include <Qt3DInput/QAnalogAxisInput>
+#include <Qt3DInput/QButtonAxisInput>
+#include <Qt3DInput/QAction>
+#include <Qt3DInput/QActionInput>
+#include <Qt3DInput/QLogicalDevice>
+#include <Qt3DInput/QKeyboardDevice>
+#include <Qt3DInput/QMouseDevice>
+#include <Qt3DInput/QMouseEvent>
+#include <Qt3DLogic/QFrameAction>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+/*!
+ * \class QOrbitCameraController::QOrbitCameraController
+ * \internal
+ */
+
+QOrbitCameraControllerPrivate::QOrbitCameraControllerPrivate()
+ : Qt3DCore::QEntityPrivate()
+ , m_camera(nullptr)
+ , m_leftMouseButtonAction(new Qt3DInput::QAction())
+ , m_rightMouseButtonAction(new Qt3DInput::QAction())
+ , m_altButtonAction(new Qt3DInput::QAction())
+ , m_shiftButtonAction(new Qt3DInput::QAction())
+ , m_rxAxis(new Qt3DInput::QAxis())
+ , m_ryAxis(new Qt3DInput::QAxis())
+ , m_txAxis(new Qt3DInput::QAxis())
+ , m_tyAxis(new Qt3DInput::QAxis())
+ , m_tzAxis(new Qt3DInput::QAxis())
+ , m_leftMouseButtonInput(new Qt3DInput::QActionInput())
+ , m_rightMouseButtonInput(new Qt3DInput::QActionInput())
+ , m_altButtonInput(new Qt3DInput::QActionInput())
+ , m_shiftButtonInput(new Qt3DInput::QActionInput())
+ , m_mouseRxInput(new Qt3DInput::QAnalogAxisInput())
+ , m_mouseRyInput(new Qt3DInput::QAnalogAxisInput())
+ , m_keyboardTxPosInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTyPosInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTzPosInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTxNegInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTyNegInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardTzNegInput(new Qt3DInput::QButtonAxisInput())
+ , m_keyboardDevice(new Qt3DInput::QKeyboardDevice())
+ , m_mouseDevice(new Qt3DInput::QMouseDevice())
+ , m_logicalDevice(new Qt3DInput::QLogicalDevice())
+ , m_frameAction(new Qt3DLogic::QFrameAction())
+ , m_linearSpeed(10.0f)
+ , m_lookSpeed(180.0f)
+ , m_zoomInLimit(2.0f)
+ , m_cameraUp(QVector3D(0.0f, 1.0f, 0.0f))
+{}
+
+void QOrbitCameraControllerPrivate::init()
+{
+ //// Actions
+
+ // Left Mouse Button Action
+ m_leftMouseButtonInput->setButtons(QVector<int>() << Qt::LeftButton);
+ m_leftMouseButtonInput->setSourceDevice(m_mouseDevice);
+ m_leftMouseButtonAction->addInput(m_leftMouseButtonInput);
+
+ // Right Mouse Button Action
+ m_rightMouseButtonInput->setButtons(QVector<int>() << Qt::RightButton);
+ m_rightMouseButtonInput->setSourceDevice(m_mouseDevice);
+ m_rightMouseButtonAction->addInput(m_rightMouseButtonInput);
+
+ // Alt Button Action
+ m_altButtonInput->setButtons(QVector<int>() << Qt::Key_Alt);
+ m_altButtonInput->setSourceDevice(m_keyboardDevice);
+ m_altButtonAction->addInput(m_altButtonInput);
+
+ // Shift Button Action
+ m_shiftButtonInput->setButtons(QVector<int>() << Qt::Key_Shift);
+ m_shiftButtonInput->setSourceDevice(m_keyboardDevice);
+ m_shiftButtonAction->addInput(m_shiftButtonInput);
+
+ //// Axes
+
+ // Mouse X
+ m_mouseRxInput->setAxis(Qt3DInput::QMouseDevice::X);
+ m_mouseRxInput->setSourceDevice(m_mouseDevice);
+ m_rxAxis->addInput(m_mouseRxInput);
+
+ // Mouse Y
+ m_mouseRyInput->setAxis(Qt3DInput::QMouseDevice::Y);
+ m_mouseRyInput->setSourceDevice(m_mouseDevice);
+ m_ryAxis->addInput(m_mouseRyInput);
+
+ // Keyboard Pos Tx
+ m_keyboardTxPosInput->setButtons(QVector<int>() << Qt::Key_Right);
+ m_keyboardTxPosInput->setScale(1.0f);
+ m_keyboardTxPosInput->setSourceDevice(m_keyboardDevice);
+ m_txAxis->addInput(m_keyboardTxPosInput);
+
+ // Keyboard Pos Tz
+ m_keyboardTzPosInput->setButtons(QVector<int>() << Qt::Key_PageUp);
+ m_keyboardTzPosInput->setScale(1.0f);
+ m_keyboardTzPosInput->setSourceDevice(m_keyboardDevice);
+ m_tzAxis->addInput(m_keyboardTzPosInput);
+
+ // Keyboard Pos Ty
+ m_keyboardTyPosInput->setButtons(QVector<int>() << Qt::Key_Up);
+ m_keyboardTyPosInput->setScale(1.0f);
+ m_keyboardTyPosInput->setSourceDevice(m_keyboardDevice);
+ m_tyAxis->addInput(m_keyboardTyPosInput);
+
+ // Keyboard Neg Tx
+ m_keyboardTxNegInput->setButtons(QVector<int>() << Qt::Key_Left);
+ m_keyboardTxNegInput->setScale(-1.0f);
+ m_keyboardTxNegInput->setSourceDevice(m_keyboardDevice);
+ m_txAxis->addInput(m_keyboardTxNegInput);
+
+ // Keyboard Neg Tz
+ m_keyboardTzNegInput->setButtons(QVector<int>() << Qt::Key_PageDown);
+ m_keyboardTzNegInput->setScale(-1.0f);
+ m_keyboardTzNegInput->setSourceDevice(m_keyboardDevice);
+ m_tzAxis->addInput(m_keyboardTzNegInput);
+
+ // Keyboard Neg Ty
+ m_keyboardTyNegInput->setButtons(QVector<int>() << Qt::Key_Down);
+ m_keyboardTyNegInput->setScale(-1.0f);
+ m_keyboardTyNegInput->setSourceDevice(m_keyboardDevice);
+ m_tyAxis->addInput(m_keyboardTyNegInput);
+
+ //// Logical Device
+
+ m_logicalDevice->addAction(m_leftMouseButtonAction);
+ m_logicalDevice->addAction(m_rightMouseButtonAction);
+ m_logicalDevice->addAction(m_altButtonAction);
+ m_logicalDevice->addAction(m_shiftButtonAction);
+ m_logicalDevice->addAxis(m_rxAxis);
+ m_logicalDevice->addAxis(m_ryAxis);
+ m_logicalDevice->addAxis(m_txAxis);
+ m_logicalDevice->addAxis(m_tyAxis);
+ m_logicalDevice->addAxis(m_tzAxis);
+
+ Q_Q(QOrbitCameraController);
+ //// FrameAction
+
+ QObject::connect(m_frameAction, SIGNAL(triggered(float)),
+ q, SLOT(_q_onTriggered(float)));
+
+ q->addComponent(m_frameAction);
+ q->addComponent(m_logicalDevice);
+}
+
+float clampInputs(float input1, float input2)
+{
+ float axisValue = input1 + input2;
+ return (axisValue < -1) ? -1 : (axisValue > 1) ? 1 : axisValue;
+}
+
+float zoomDistance(QVector3D firstPoint, QVector3D secondPoint)
+{
+ return (secondPoint - firstPoint).lengthSquared();
+}
+
+void QOrbitCameraControllerPrivate::_q_onTriggered(float dt)
+{
+ if (m_camera != nullptr) {
+ // Mouse input
+ if (m_leftMouseButtonAction->isActive()) {
+ if (m_rightMouseButtonAction->isActive()) {
+ if ( zoomDistance(m_camera->position(), m_camera->viewCenter()) > m_zoomInLimit * m_zoomInLimit) {
+ // Dolly up to limit
+ m_camera->translate(QVector3D(0, 0, m_ryAxis->value()), m_camera->DontTranslateViewCenter);
+ } else {
+ m_camera->translate(QVector3D(0, 0, -0.5), m_camera->DontTranslateViewCenter);
+ }
+ } else {
+ // Translate
+ m_camera->translate(QVector3D(clampInputs(m_rxAxis->value(), m_txAxis->value()) * m_linearSpeed,
+ clampInputs(m_ryAxis->value(), m_tyAxis->value()) * m_linearSpeed,
+ 0) * dt);
+ return;
+ }
+ }
+ else if (m_rightMouseButtonAction->isActive()) {
+ // Orbit
+ m_camera->panAboutViewCenter((m_rxAxis->value() * m_lookSpeed) * dt, m_cameraUp);
+ m_camera->tiltAboutViewCenter((m_ryAxis->value() * m_lookSpeed) * dt);
+ }
+ // Keyboard Input
+ if (m_altButtonAction->isActive()) {
+ // Orbit
+ m_camera->panAboutViewCenter((m_txAxis->value() * m_lookSpeed) * dt, m_cameraUp);
+ m_camera->tiltAboutViewCenter((m_tyAxis->value() * m_lookSpeed) * dt);
+ } else if (m_shiftButtonAction->isActive()) {
+ if (zoomDistance(m_camera->position(), m_camera->viewCenter()) > m_zoomInLimit * m_zoomInLimit) {
+ // Dolly
+ m_camera->translate(QVector3D(0, 0, m_tyAxis->value()), m_camera->DontTranslateViewCenter);
+ } else {
+ m_camera->translate(QVector3D(0, 0, -0.5), m_camera->DontTranslateViewCenter);
+ }
+ } else {
+ // Translate
+ m_camera->translate(QVector3D(clampInputs(m_leftMouseButtonAction->isActive() ? m_rxAxis->value() : 0, m_txAxis->value()) * m_linearSpeed,
+ clampInputs(m_leftMouseButtonAction->isActive() ? m_ryAxis->value() : 0, m_tyAxis->value()) * m_linearSpeed,
+ m_tzAxis->value() * m_linearSpeed) * dt);
+ }
+ }
+}
+
+QOrbitCameraController::QOrbitCameraController(Qt3DCore::QNode *parent)
+ : Qt3DCore::QEntity(*new QOrbitCameraControllerPrivate, parent)
+{
+ Q_D(QOrbitCameraController);
+ d->init();
+}
+
+QOrbitCameraController::~QOrbitCameraController()
+{
+}
+
+Qt3DRender::QCamera *QOrbitCameraController::camera() const
+{
+ Q_D(const QOrbitCameraController);
+ return d->m_camera;
+}
+
+float QOrbitCameraController::linearSpeed() const
+{
+ Q_D(const QOrbitCameraController);
+ return d->m_linearSpeed;
+}
+
+float QOrbitCameraController::lookSpeed() const
+{
+ Q_D(const QOrbitCameraController);
+ return d->m_lookSpeed;
+}
+
+float QOrbitCameraController::zoomInLimit() const
+{
+ Q_D(const QOrbitCameraController);
+ return d->m_zoomInLimit;
+}
+
+void QOrbitCameraController::setCamera(Qt3DRender::QCamera *camera)
+{
+ Q_D(QOrbitCameraController);
+ if (d->m_camera != camera) {
+ d->m_camera = camera;
+ emit cameraChanged();
+ }
+}
+
+void QOrbitCameraController::setLinearSpeed(float linearSpeed)
+{
+ Q_D(QOrbitCameraController);
+ if (d->m_linearSpeed != linearSpeed) {
+ d->m_linearSpeed = linearSpeed;
+ emit linearSpeedChanged();
+ }
+}
+
+void QOrbitCameraController::setLookSpeed(float lookSpeed)
+{
+ Q_D(QOrbitCameraController);
+ if (d->m_lookSpeed != lookSpeed) {
+ d->m_lookSpeed = lookSpeed;
+ emit lookSpeedChanged();
+ }
+}
+
+void QOrbitCameraController::setZoomInLimit(float zoomInLimit)
+{
+ Q_D(QOrbitCameraController);
+ if (d->m_zoomInLimit != zoomInLimit) {
+ d->m_zoomInLimit = zoomInLimit;
+ emit zoomInLimitChanged();
+ }
+}
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#include "moc_qorbitcameracontroller.cpp"
diff --git a/src/extras/defaults/qorbitcameracontroller.h b/src/extras/defaults/qorbitcameracontroller.h
new file mode 100644
index 000000000..fb4d0aa7a
--- /dev/null
+++ b/src/extras/defaults/qorbitcameracontroller.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QORBITCAMERACONTROLLER_H
+#define QT3DEXTRAS_QORBITCAMERACONTROLLER_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DCore/QEntity>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+class QCamera;
+}
+
+namespace Qt3DExtras {
+
+class QOrbitCameraControllerPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QOrbitCameraController : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QCamera *camera READ camera WRITE setCamera NOTIFY cameraChanged)
+ Q_PROPERTY(float linearSpeed READ linearSpeed WRITE setLinearSpeed NOTIFY linearSpeedChanged)
+ Q_PROPERTY(float lookSpeed READ lookSpeed WRITE setLookSpeed NOTIFY lookSpeedChanged)
+ Q_PROPERTY(float zoomInLimit READ zoomInLimit WRITE setZoomInLimit NOTIFY zoomInLimitChanged)
+
+public:
+ explicit QOrbitCameraController(Qt3DCore::QNode *parent = nullptr);
+ ~QOrbitCameraController();
+
+ float clampInputs(float input1, float input2);
+ Qt3DRender::QCamera *camera() const;
+ float linearSpeed() const;
+ float lookSpeed() const;
+ float zoomInLimit() const;
+
+ void setCamera(Qt3DRender::QCamera *camera);
+ void setLinearSpeed(float linearSpeed);
+ void setLookSpeed(float lookSpeed);
+ void setZoomInLimit(float zoomInLimit);
+
+Q_SIGNALS:
+ void cameraChanged();
+ void linearSpeedChanged();
+ void lookSpeedChanged();
+ void zoomInLimitChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QOrbitCameraController)
+ Q_PRIVATE_SLOT(d_func(), void _q_onTriggered(float))
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QORBITCAMERACONTROLLER_H
diff --git a/src/extras/defaults/qorbitcameracontroller_p.h b/src/extras/defaults/qorbitcameracontroller_p.h
new file mode 100644
index 000000000..d207df712
--- /dev/null
+++ b/src/extras/defaults/qorbitcameracontroller_p.h
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QORBITCAMERACONTROLLER_P_H
+#define QT3DEXTRAS_QORBITCAMERACONTROLLER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qentity_p.h>
+#include <QVector3D>
+#include "qorbitcameracontroller.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+class QCamera;
+}
+
+namespace Qt3DLogic {
+class QFrameAction;
+}
+
+namespace Qt3DInput {
+
+class QKeyboardDevice;
+class QMouseDevice;
+class QLogicalDevice;
+class QAction;
+class QActionInput;
+class QAxis;
+class QAnalogAxisInput;
+class QButtonAxisInput;
+class QAxisActionHandler;
+
+}
+
+namespace Qt3DExtras {
+
+class QOrbitCameraControllerPrivate : public Qt3DCore::QEntityPrivate
+{
+public:
+ QOrbitCameraControllerPrivate();
+
+ void init();
+
+ Qt3DRender::QCamera *m_camera;
+
+ Qt3DInput::QAction *m_leftMouseButtonAction;
+ Qt3DInput::QAction *m_rightMouseButtonAction;
+ Qt3DInput::QAction *m_altButtonAction;
+ Qt3DInput::QAction *m_shiftButtonAction;
+
+ Qt3DInput::QAxis *m_rxAxis;
+ Qt3DInput::QAxis *m_ryAxis;
+ Qt3DInput::QAxis *m_txAxis;
+ Qt3DInput::QAxis *m_tyAxis;
+ Qt3DInput::QAxis *m_tzAxis;
+
+ Qt3DInput::QActionInput *m_leftMouseButtonInput;
+ Qt3DInput::QActionInput *m_rightMouseButtonInput;
+ Qt3DInput::QActionInput *m_altButtonInput;
+ Qt3DInput::QActionInput *m_shiftButtonInput;
+
+ Qt3DInput::QAnalogAxisInput *m_mouseRxInput;
+ Qt3DInput::QAnalogAxisInput *m_mouseRyInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTxPosInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTyPosInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTzPosInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTxNegInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTyNegInput;
+ Qt3DInput::QButtonAxisInput *m_keyboardTzNegInput;
+
+ Qt3DInput::QKeyboardDevice *m_keyboardDevice;
+ Qt3DInput::QMouseDevice *m_mouseDevice;
+
+ Qt3DInput::QLogicalDevice *m_logicalDevice;
+
+ Qt3DLogic::QFrameAction *m_frameAction;
+
+ float m_linearSpeed;
+ float m_lookSpeed;
+ float m_zoomInLimit;
+ QVector3D m_cameraUp;
+
+ void _q_onTriggered(float);
+
+ Q_DECLARE_PUBLIC(QOrbitCameraController)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QORBITCAMERACONTROLLER_P_H
diff --git a/src/extras/defaults/qpervertexcolormaterial.cpp b/src/extras/defaults/qpervertexcolormaterial.cpp
new file mode 100644
index 000000000..2a301cd3f
--- /dev/null
+++ b/src/extras/defaults/qpervertexcolormaterial.cpp
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Lorenz Esch (TU Ilmenau).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpervertexcolormaterial.h"
+#include "qpervertexcolormaterial_p.h"
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <QUrl>
+#include <QVector3D>
+#include <QVector4D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate()
+ : QMaterialPrivate()
+ , m_vertexEffect(new QEffect())
+ , m_vertexGL3Technique(new QTechnique())
+ , m_vertexGL2Technique(new QTechnique())
+ , m_vertexES2Technique(new QTechnique())
+ , m_vertexGL3RenderPass(new QRenderPass())
+ , m_vertexGL2RenderPass(new QRenderPass())
+ , m_vertexES2RenderPass(new QRenderPass())
+ , m_vertexGL3Shader(new QShaderProgram())
+ , m_vertexGL2ES2Shader(new QShaderProgram())
+ , m_filterKey(new QFilterKey)
+{
+}
+
+/*!
+ \class Qt3DRender::QPerVertexColorMaterial
+ \brief The QPerVertexColorMaterial class provides a default implementation for rendering the color properties set for each vertex.
+ \inmodule Qt3DRender
+ \since 5.5
+
+ This lighting effect is based on the combination of 2 lighting components ambient and diffuse. Ambient is set by the vertex color.
+ Diffuse takes in account the normal distribution of each vertex.
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rough surface reflections with the lights
+ \endlist
+
+ This material uses an effect with a single render pass approach and forms fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ \fn Qt3DRender::QPerVertexColorMaterial::QPerVertexColorMaterial(Qt3DCore::QNode *parent)
+
+ Constructs a new QPerVertexColorMaterial instance with parent object \a parent.
+*/
+QPerVertexColorMaterial::QPerVertexColorMaterial(QNode *parent)
+ : QMaterial(*new QPerVertexColorMaterialPrivate, parent)
+{
+ Q_D(QPerVertexColorMaterial);
+ d->init();
+}
+
+/*!
+ \fn Qt3DRender::QPerVertexColorMaterial::~QPerVertexColorMaterial()
+
+ Destroys the QPerVertexColorMaterial
+*/
+QPerVertexColorMaterial::~QPerVertexColorMaterial()
+{
+}
+
+// TODO: Define how lights are proties are set in the shaders. Ideally using a QShaderData
+void QPerVertexColorMaterialPrivate::init()
+{
+ m_vertexGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/pervertexcolor.vert"))));
+ m_vertexGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/pervertexcolor.frag"))));
+ m_vertexGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/pervertexcolor.vert"))));
+ m_vertexGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/pervertexcolor.frag"))));
+
+ m_vertexGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_vertexGL3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_vertexGL3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_vertexGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_vertexGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_vertexGL2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_vertexGL2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_vertexGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_vertexES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_vertexES2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_vertexES2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_vertexES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ Q_Q(QPerVertexColorMaterial);
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_vertexGL3Technique->addFilterKey(m_filterKey);
+ m_vertexGL2Technique->addFilterKey(m_filterKey);
+ m_vertexES2Technique->addFilterKey(m_filterKey);
+
+ m_vertexGL3RenderPass->setShaderProgram(m_vertexGL3Shader);
+ m_vertexGL2RenderPass->setShaderProgram(m_vertexGL2ES2Shader);
+ m_vertexES2RenderPass->setShaderProgram(m_vertexGL2ES2Shader);
+
+ m_vertexGL3Technique->addRenderPass(m_vertexGL3RenderPass);
+ m_vertexGL2Technique->addRenderPass(m_vertexGL2RenderPass);
+ m_vertexES2Technique->addRenderPass(m_vertexES2RenderPass);
+
+ m_vertexEffect->addTechnique(m_vertexGL3Technique);
+ m_vertexEffect->addTechnique(m_vertexGL2Technique);
+ m_vertexEffect->addTechnique(m_vertexES2Technique);
+
+ q->setEffect(m_vertexEffect);
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qpervertexcolormaterial.h b/src/extras/defaults/qpervertexcolormaterial.h
new file mode 100644
index 000000000..485e2fe0e
--- /dev/null
+++ b/src/extras/defaults/qpervertexcolormaterial.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Lorenz Esch (TU Ilmenau).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPERVERTEXCOLORMATERIAL_H
+#define QT3DEXTRAS_QPERVERTEXCOLORMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qmaterial.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QPerVertexColorMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QPerVertexColorMaterial : public Qt3DRender::QMaterial
+{
+ Q_OBJECT
+
+public:
+ explicit QPerVertexColorMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QPerVertexColorMaterial();
+
+private:
+ Q_DECLARE_PRIVATE(QPerVertexColorMaterial)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPERVERTEXCOLORMATERIAL_H
diff --git a/src/extras/defaults/qpervertexcolormaterial_p.h b/src/extras/defaults/qpervertexcolormaterial_p.h
new file mode 100644
index 000000000..678353525
--- /dev/null
+++ b/src/extras/defaults/qpervertexcolormaterial_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Lorenz Esch (TU Ilmenau).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPERVERTEXCOLORMATERIAL_P_H
+#define QT3DEXTRAS_QPERVERTEXCOLORMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QEffect;
+class QTechnique;
+class QParameter;
+class QShaderProgram;
+class QRenderPass;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QPerVertexColorMaterial;
+
+class QPerVertexColorMaterialPrivate : public Qt3DRender::QMaterialPrivate
+{
+public:
+ QPerVertexColorMaterialPrivate();
+
+ void init();
+
+ Qt3DRender::QEffect *m_vertexEffect;
+ Qt3DRender::QTechnique *m_vertexGL3Technique;
+ Qt3DRender::QTechnique *m_vertexGL2Technique;
+ Qt3DRender::QTechnique *m_vertexES2Technique;
+ Qt3DRender::QRenderPass *m_vertexGL3RenderPass;
+ Qt3DRender::QRenderPass *m_vertexGL2RenderPass;
+ Qt3DRender::QRenderPass *m_vertexES2RenderPass;
+ Qt3DRender::QShaderProgram *m_vertexGL3Shader;
+ Qt3DRender::QShaderProgram *m_vertexGL2ES2Shader;
+ Qt3DRender::QFilterKey *m_filterKey;
+
+ Q_DECLARE_PUBLIC(QPerVertexColorMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPERVERTEXCOLORMATERIAL_P_H
+
diff --git a/src/extras/defaults/qphongalphamaterial.cpp b/src/extras/defaults/qphongalphamaterial.cpp
new file mode 100644
index 000000000..9d80751c5
--- /dev/null
+++ b/src/extras/defaults/qphongalphamaterial.cpp
@@ -0,0 +1,327 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qphongalphamaterial.h"
+#include "qphongalphamaterial_p.h"
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <Qt3DRender/qblendequation.h>
+#include <Qt3DRender/qblendequationarguments.h>
+#include <Qt3DRender/qnodepthmask.h>
+#include <QUrl>
+#include <QVector3D>
+#include <QVector4D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QPhongAlphaMaterialPrivate::QPhongAlphaMaterialPrivate()
+ : QMaterialPrivate()
+ , m_phongEffect(new QEffect())
+ , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
+ , m_diffuseParameter(new QParameter(QStringLiteral("kd"), QColor::fromRgbF(0.7f, 0.7f, 0.7f, 1.0f)))
+ , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.01f, 0.01f, 0.01f, 1.0f)))
+ , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
+ , m_alphaParameter(new QParameter(QStringLiteral("alpha"), 0.5f))
+ , m_phongAlphaGL3Technique(new QTechnique())
+ , m_phongAlphaGL2Technique(new QTechnique())
+ , m_phongAlphaES2Technique(new QTechnique())
+ , m_phongAlphaGL3RenderPass(new QRenderPass())
+ , m_phongAlphaGL2RenderPass(new QRenderPass())
+ , m_phongAlphaES2RenderPass(new QRenderPass())
+ , m_phongAlphaGL3Shader(new QShaderProgram())
+ , m_phongAlphaGL2ES2Shader(new QShaderProgram())
+ , m_noDepthMask(new QNoDepthMask())
+ , m_blendState(new QBlendEquationArguments())
+ , m_blendEquation(new QBlendEquation())
+ , m_filterKey(new QFilterKey)
+{
+}
+
+// TODO: Define how lights are properties are set in the shaders. Ideally using a QShaderData
+void QPhongAlphaMaterialPrivate::init()
+{
+ connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongAlphaMaterialPrivate::handleAmbientChanged);
+ connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongAlphaMaterialPrivate::handleDiffuseChanged);
+ connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongAlphaMaterialPrivate::handleSpecularChanged);
+ connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongAlphaMaterialPrivate::handleShininessChanged);
+ connect(m_alphaParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongAlphaMaterialPrivate::handleAlphaChanged);
+
+ m_phongAlphaGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/phong.vert"))));
+ m_phongAlphaGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/phongalpha.frag"))));
+ m_phongAlphaGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/phong.vert"))));
+ m_phongAlphaGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/phongalpha.frag"))));
+
+ m_phongAlphaGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_phongAlphaGL3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_phongAlphaGL3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_phongAlphaGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_phongAlphaGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_phongAlphaGL2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_phongAlphaGL2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_phongAlphaGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_phongAlphaES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_phongAlphaES2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_phongAlphaES2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_phongAlphaES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ Q_Q(QPhongAlphaMaterial);
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_phongAlphaGL3Technique->addFilterKey(m_filterKey);
+ m_phongAlphaGL2Technique->addFilterKey(m_filterKey);
+ m_phongAlphaES2Technique->addFilterKey(m_filterKey);
+
+ m_blendState->setSourceRgb(QBlendEquationArguments::SourceAlpha);
+ m_blendState->setDestinationRgb(QBlendEquationArguments::OneMinusSourceAlpha);
+ m_blendEquation->setBlendFunction(QBlendEquation::Add);
+
+ m_phongAlphaGL3RenderPass->setShaderProgram(m_phongAlphaGL3Shader);
+ m_phongAlphaGL2RenderPass->setShaderProgram(m_phongAlphaGL2ES2Shader);
+ m_phongAlphaES2RenderPass->setShaderProgram(m_phongAlphaGL2ES2Shader);
+
+ m_phongAlphaGL3RenderPass->addRenderState(m_noDepthMask);
+ m_phongAlphaGL3RenderPass->addRenderState(m_blendState);
+ m_phongAlphaGL3RenderPass->addRenderState(m_blendEquation);
+
+ m_phongAlphaGL2RenderPass->addRenderState(m_noDepthMask);
+ m_phongAlphaGL2RenderPass->addRenderState(m_blendState);
+ m_phongAlphaGL2RenderPass->addRenderState(m_blendEquation);
+
+ m_phongAlphaES2RenderPass->addRenderState(m_noDepthMask);
+ m_phongAlphaES2RenderPass->addRenderState(m_blendState);
+ m_phongAlphaES2RenderPass->addRenderState(m_blendEquation);
+
+ m_phongAlphaGL3Technique->addRenderPass(m_phongAlphaGL3RenderPass);
+ m_phongAlphaGL2Technique->addRenderPass(m_phongAlphaGL2RenderPass);
+ m_phongAlphaES2Technique->addRenderPass(m_phongAlphaES2RenderPass);
+
+ m_phongEffect->addTechnique(m_phongAlphaGL3Technique);
+ m_phongEffect->addTechnique(m_phongAlphaGL2Technique);
+ m_phongEffect->addTechnique(m_phongAlphaES2Technique);
+
+ m_phongEffect->addParameter(m_ambientParameter);
+ m_phongEffect->addParameter(m_diffuseParameter);
+ m_phongEffect->addParameter(m_specularParameter);
+ m_phongEffect->addParameter(m_shininessParameter);
+ m_phongEffect->addParameter(m_alphaParameter);
+
+ q->setEffect(m_phongEffect);
+}
+
+void QPhongAlphaMaterialPrivate::handleAmbientChanged(const QVariant &var)
+{
+ Q_Q(QPhongAlphaMaterial);
+ emit q->ambientChanged(var.value<QColor>());
+}
+
+void QPhongAlphaMaterialPrivate::handleDiffuseChanged(const QVariant &var)
+{
+ Q_Q(QPhongAlphaMaterial);
+ emit q->diffuseChanged(var.value<QColor>());
+}
+
+void QPhongAlphaMaterialPrivate::handleSpecularChanged(const QVariant &var)
+{
+ Q_Q(QPhongAlphaMaterial);
+ emit q->specularChanged(var.value<QColor>());
+}
+
+void QPhongAlphaMaterialPrivate::handleShininessChanged(const QVariant &var)
+{
+ Q_Q(QPhongAlphaMaterial);
+ emit q->shininessChanged(var.toFloat());
+}
+
+void QPhongAlphaMaterialPrivate::handleAlphaChanged(const QVariant &var)
+{
+ Q_Q(QPhongAlphaMaterial);
+ emit q->alphaChanged(var.toFloat());
+}
+
+/*!
+ \class Qt3DRender::QPhongAlphaMaterial
+
+ \brief The QPhongAlphaMaterial class provides a default implementation of
+ the phong lighting effect with alpha.
+ \inmodule Qt3DRenderer
+ \since 5.5
+
+ The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
+ The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \li Alpha is the transparency of the surface between 0 (fully transparent) and 1 (opaque).
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ \fn Qt3DRender::QPhongAlphaMaterial::QPhongAlphaMaterial(Qt3DCore::QNode *parent)
+
+ Constructs a new QPhongAlphaMaterial instance with parent object \a parent.
+*/
+QPhongAlphaMaterial::QPhongAlphaMaterial(QNode *parent)
+ : QMaterial(*new QPhongAlphaMaterialPrivate, parent)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->init();
+}
+
+/*!
+ Destroys the QPhongAlphaMaterial.
+*/
+QPhongAlphaMaterial::~QPhongAlphaMaterial()
+{
+}
+
+/*!
+ \property Qt3DRender::QPhongAlphaMaterial::ambient
+
+ Holds the ambient color.
+*/
+QColor QPhongAlphaMaterial::ambient() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_ambientParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QPhongAlphaMaterial::diffuse
+
+ Holds the diffuse color.
+*/
+QColor QPhongAlphaMaterial::diffuse() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_diffuseParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QPhongAlphaMaterial::specular
+
+ Holds the specular color.
+*/
+QColor QPhongAlphaMaterial::specular() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_specularParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QPhongAlphaMaterial::shininess
+
+ Holds the shininess exponent.
+*/
+float QPhongAlphaMaterial::shininess() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_shininessParameter->value().toFloat();
+}
+
+/*!
+ \property Qt3DRender::QPhongAlphaMaterial::alpha
+
+ Holds the alpha component of the object which varies between 0 and 1.
+
+ \note: default value is 0.5f
+*/
+float QPhongAlphaMaterial::alpha() const
+{
+ Q_D(const QPhongAlphaMaterial);
+ return d->m_alphaParameter->value().toFloat();
+}
+
+void QPhongAlphaMaterial::setAmbient(const QColor &ambient)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_ambientParameter->setValue(ambient);
+}
+
+void QPhongAlphaMaterial::setDiffuse(const QColor &diffuse)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_diffuseParameter->setValue(diffuse);
+}
+
+void QPhongAlphaMaterial::setSpecular(const QColor &specular)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_specularParameter->setValue(specular);
+}
+
+void QPhongAlphaMaterial::setShininess(float shininess)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_shininessParameter->setValue(shininess);
+}
+
+void QPhongAlphaMaterial::setAlpha(float alpha)
+{
+ Q_D(QPhongAlphaMaterial);
+ d->m_alphaParameter->setValue(alpha);
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qphongalphamaterial.h b/src/extras/defaults/qphongalphamaterial.h
new file mode 100644
index 000000000..fb2ae1857
--- /dev/null
+++ b/src/extras/defaults/qphongalphamaterial.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPHONGALPHAMATERIAL_H
+#define QT3DEXTRAS_QPHONGALPHAMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qmaterial.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QPhongAlphaMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QPhongAlphaMaterial : public Qt3DRender::QMaterial
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
+ Q_PROPERTY(QColor diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
+ Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
+ Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
+ Q_PROPERTY(float alpha READ alpha WRITE setAlpha NOTIFY alphaChanged)
+
+public:
+ explicit QPhongAlphaMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QPhongAlphaMaterial();
+
+ QColor ambient() const;
+ QColor diffuse() const;
+ QColor specular() const;
+ float shininess() const;
+ float alpha() const;
+
+public Q_SLOTS:
+ void setAmbient(const QColor &ambient);
+ void setDiffuse(const QColor &diffuse);
+ void setSpecular(const QColor &specular);
+ void setShininess(float shininess);
+ void setAlpha(float alpha);
+
+Q_SIGNALS:
+ void ambientChanged(const QColor &ambient);
+ void diffuseChanged(const QColor &diffuse);
+ void specularChanged(const QColor &specular);
+ void shininessChanged(float shininess);
+ void alphaChanged(float alpha);
+
+private:
+ Q_DECLARE_PRIVATE(QPhongAlphaMaterial)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPHONGALPHAMATERIAL_H
diff --git a/src/extras/defaults/qphongalphamaterial_p.h b/src/extras/defaults/qphongalphamaterial_p.h
new file mode 100644
index 000000000..623eca0ea
--- /dev/null
+++ b/src/extras/defaults/qphongalphamaterial_p.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPHONGALPHAMATERIAL_P_H
+#define QT3DEXTRAS_QPHONGALPHAMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QEffect;
+class QTechnique;
+class QParameter;
+class QShaderProgram;
+class QRenderPass;
+class QNoDepthMask;
+class QBlendEquationArguments;
+class QBlendEquation;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QPhongAlphaMaterial;
+
+class QPhongAlphaMaterialPrivate : public Qt3DRender::QMaterialPrivate
+{
+public:
+ QPhongAlphaMaterialPrivate();
+
+ void init();
+
+ void handleAmbientChanged(const QVariant &var);
+ void handleDiffuseChanged(const QVariant &var);
+ void handleSpecularChanged(const QVariant &var);
+ void handleShininessChanged(const QVariant &var);
+ void handleAlphaChanged(const QVariant &var);
+
+ Qt3DRender::QEffect *m_phongEffect;
+ Qt3DRender::QParameter *m_ambientParameter;
+ Qt3DRender::QParameter *m_diffuseParameter;
+ Qt3DRender::QParameter *m_specularParameter;
+ Qt3DRender::QParameter *m_shininessParameter;
+ Qt3DRender::QParameter *m_alphaParameter;
+ Qt3DRender::QTechnique *m_phongAlphaGL3Technique;
+ Qt3DRender::QTechnique *m_phongAlphaGL2Technique;
+ Qt3DRender::QTechnique *m_phongAlphaES2Technique;
+ Qt3DRender::QRenderPass *m_phongAlphaGL3RenderPass;
+ Qt3DRender::QRenderPass *m_phongAlphaGL2RenderPass;
+ Qt3DRender::QRenderPass *m_phongAlphaES2RenderPass;
+ Qt3DRender::QShaderProgram *m_phongAlphaGL3Shader;
+ Qt3DRender::QShaderProgram *m_phongAlphaGL2ES2Shader;
+ Qt3DRender::QNoDepthMask *m_noDepthMask;
+ Qt3DRender::QBlendEquationArguments *m_blendState;
+ Qt3DRender::QBlendEquation *m_blendEquation;
+ Qt3DRender::QFilterKey *m_filterKey;
+
+ Q_DECLARE_PUBLIC(QPhongAlphaMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPHONGALPHAMATERIAL_P_H
+
diff --git a/src/extras/defaults/qphongmaterial.cpp b/src/extras/defaults/qphongmaterial.cpp
new file mode 100644
index 000000000..f9c51bae8
--- /dev/null
+++ b/src/extras/defaults/qphongmaterial.cpp
@@ -0,0 +1,275 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qphongmaterial.h"
+#include "qphongmaterial_p.h"
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DRender/qshaderprogram.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <QUrl>
+#include <QVector3D>
+#include <QVector4D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QPhongMaterialPrivate::QPhongMaterialPrivate()
+ : QMaterialPrivate()
+ , m_phongEffect(new QEffect())
+ , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
+ , m_diffuseParameter(new QParameter(QStringLiteral("kd"), QColor::fromRgbF(0.7f, 0.7f, 0.7f, 1.0f)))
+ , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.01f, 0.01f, 0.01f, 1.0f)))
+ , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
+ , m_phongGL3Technique(new QTechnique())
+ , m_phongGL2Technique(new QTechnique())
+ , m_phongES2Technique(new QTechnique())
+ , m_phongGL3RenderPass(new QRenderPass())
+ , m_phongGL2RenderPass(new QRenderPass())
+ , m_phongES2RenderPass(new QRenderPass())
+ , m_phongGL3Shader(new QShaderProgram())
+ , m_phongGL2ES2Shader(new QShaderProgram())
+ , m_filterKey(new QFilterKey)
+{
+}
+
+void QPhongMaterialPrivate::init()
+{
+ connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongMaterialPrivate::handleAmbientChanged);
+ connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongMaterialPrivate::handleDiffuseChanged);
+ connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongMaterialPrivate::handleSpecularChanged);
+ connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
+ this, &QPhongMaterialPrivate::handleShininessChanged);
+
+
+ m_phongGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/phong.vert"))));
+ m_phongGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/phong.frag"))));
+ m_phongGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/phong.vert"))));
+ m_phongGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/phong.frag"))));
+
+ m_phongGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_phongGL3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_phongGL3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_phongGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_phongGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_phongGL2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_phongGL2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_phongGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_phongES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_phongES2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_phongES2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_phongES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_phongGL3RenderPass->setShaderProgram(m_phongGL3Shader);
+ m_phongGL2RenderPass->setShaderProgram(m_phongGL2ES2Shader);
+ m_phongES2RenderPass->setShaderProgram(m_phongGL2ES2Shader);
+
+ m_phongGL3Technique->addRenderPass(m_phongGL3RenderPass);
+ m_phongGL2Technique->addRenderPass(m_phongGL2RenderPass);
+ m_phongES2Technique->addRenderPass(m_phongES2RenderPass);
+
+ Q_Q(QPhongMaterial);
+ m_filterKey->setParent(q);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_phongGL3Technique->addFilterKey(m_filterKey);
+ m_phongGL2Technique->addFilterKey(m_filterKey);
+ m_phongES2Technique->addFilterKey(m_filterKey);
+
+ m_phongEffect->addTechnique(m_phongGL3Technique);
+ m_phongEffect->addTechnique(m_phongGL2Technique);
+ m_phongEffect->addTechnique(m_phongES2Technique);
+
+ m_phongEffect->addParameter(m_ambientParameter);
+ m_phongEffect->addParameter(m_diffuseParameter);
+ m_phongEffect->addParameter(m_specularParameter);
+ m_phongEffect->addParameter(m_shininessParameter);
+
+ q->setEffect(m_phongEffect);
+}
+
+void QPhongMaterialPrivate::handleAmbientChanged(const QVariant &var)
+{
+ Q_Q(QPhongMaterial);
+ emit q->ambientChanged(var.value<QColor>());
+}
+
+void QPhongMaterialPrivate::handleDiffuseChanged(const QVariant &var)
+{
+ Q_Q(QPhongMaterial);
+ emit q->diffuseChanged(var.value<QColor>());
+}
+
+void QPhongMaterialPrivate::handleSpecularChanged(const QVariant &var)
+{
+ Q_Q(QPhongMaterial);
+ emit q->specularChanged(var.value<QColor>());
+}
+
+void QPhongMaterialPrivate::handleShininessChanged(const QVariant &var)
+{
+ Q_Q(QPhongMaterial);
+ emit q->shininessChanged(var.toFloat());
+}
+
+/*!
+ \class Qt3DRender::QPhongMaterial
+ \brief The QPhongMaterial class provides a default implementation of the phong lighting effect.
+ \inmodule Qt3DRender
+ \since 5.5
+
+ The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
+ The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
+
+ \list
+ \li Ambient is the color that is emitted by an object without any other light source.
+ \li Diffuse is the color that is emitted for rought surface reflections with the lights.
+ \li Specular is the color emitted for shiny surface reflections with the lights.
+ \li The shininess of a surface is controlled by a float property.
+ \endlist
+
+ This material uses an effect with a single render pass approach and performs per fragment lighting.
+ Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
+*/
+
+/*!
+ \fn Qt3DRender::QPhongMaterial::QPhongMaterial(Qt3DCore::QNode *parent)
+
+ Constructs a new QPhongMaterial instance with parent object \a parent.
+*/
+QPhongMaterial::QPhongMaterial(QNode *parent)
+ : QMaterial(*new QPhongMaterialPrivate, parent)
+{
+ Q_D(QPhongMaterial);
+ d->init();
+}
+
+/*!
+ \fn Qt3DRender::QPhongMaterial::~QPhongMaterial()
+
+ Destroys the QPhongMaterial.
+*/
+QPhongMaterial::~QPhongMaterial()
+{
+}
+
+/*!
+ \property Qt3DRender::QPhongMaterial::ambient
+
+ Holds the ambient color.
+*/
+QColor QPhongMaterial::ambient() const
+{
+ Q_D(const QPhongMaterial);
+ return d->m_ambientParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QPhongMaterial::diffuse
+
+ Holds the diffuse color.
+*/
+QColor QPhongMaterial::diffuse() const
+{
+ Q_D(const QPhongMaterial);
+ return d->m_diffuseParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QPhongMaterial::specular
+
+ Holds the specular color.
+*/
+QColor QPhongMaterial::specular() const
+{
+ Q_D(const QPhongMaterial);
+ return d->m_specularParameter->value().value<QColor>();
+}
+
+/*!
+ \property Qt3DRender::QPhongMaterial::shininess
+
+ Holds the shininess exponent.
+*/
+float QPhongMaterial::shininess() const
+{
+ Q_D(const QPhongMaterial);
+ return d->m_shininessParameter->value().toFloat();
+}
+
+void QPhongMaterial::setAmbient(const QColor &ambient)
+{
+ Q_D(QPhongMaterial);
+ d->m_ambientParameter->setValue(ambient);
+}
+
+void QPhongMaterial::setDiffuse(const QColor &diffuse)
+{
+ Q_D(QPhongMaterial);
+ d->m_diffuseParameter->setValue(diffuse);
+}
+
+void QPhongMaterial::setSpecular(const QColor &specular)
+{
+ Q_D(QPhongMaterial);
+ d->m_specularParameter->setValue(specular);
+}
+
+void QPhongMaterial::setShininess(float shininess)
+{
+ Q_D(QPhongMaterial);
+ d->m_shininessParameter->setValue(shininess);
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qphongmaterial.h b/src/extras/defaults/qphongmaterial.h
new file mode 100644
index 000000000..d4b8a0f0e
--- /dev/null
+++ b/src/extras/defaults/qphongmaterial.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPHONGMATERIAL_H
+#define QT3DEXTRAS_QPHONGMATERIAL_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qmaterial.h>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QPhongMaterialPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QPhongMaterial : public Qt3DRender::QMaterial
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
+ Q_PROPERTY(QColor diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
+ Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
+ Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
+
+public:
+ explicit QPhongMaterial(Qt3DCore::QNode *parent = nullptr);
+ ~QPhongMaterial();
+
+ QColor ambient() const;
+ QColor diffuse() const;
+ QColor specular() const;
+ float shininess() const;
+
+public Q_SLOTS:
+ void setAmbient(const QColor &ambient);
+ void setDiffuse(const QColor &diffuse);
+ void setSpecular(const QColor &specular);
+ void setShininess(float shininess);
+
+Q_SIGNALS:
+ void ambientChanged(const QColor &ambient);
+ void diffuseChanged(const QColor &diffuse);
+ void specularChanged(const QColor &specular);
+ void shininessChanged(float shininess);
+
+private:
+ Q_DECLARE_PRIVATE(QPhongMaterial)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPHONGMATERIAL_H
diff --git a/src/extras/defaults/qphongmaterial_p.h b/src/extras/defaults/qphongmaterial_p.h
new file mode 100644
index 000000000..bc6d0ce44
--- /dev/null
+++ b/src/extras/defaults/qphongmaterial_p.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPHONGMATERIAL_P_H
+#define QT3DEXTRAS_QPHONGMATERIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qmaterial_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QEffect;
+class QTechnique;
+class QParameter;
+class QShaderProgram;
+class QRenderPass;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QPhongMaterial;
+
+class QPhongMaterialPrivate : public Qt3DRender::QMaterialPrivate
+{
+public:
+ QPhongMaterialPrivate();
+
+ void init();
+
+ void handleAmbientChanged(const QVariant &var);
+ void handleDiffuseChanged(const QVariant &var);
+ void handleSpecularChanged(const QVariant &var);
+ void handleShininessChanged(const QVariant &var);
+
+ Qt3DRender::QEffect *m_phongEffect;
+ Qt3DRender::QParameter *m_ambientParameter;
+ Qt3DRender::QParameter *m_diffuseParameter;
+ Qt3DRender::QParameter *m_specularParameter;
+ Qt3DRender::QParameter *m_shininessParameter;
+ Qt3DRender::QTechnique *m_phongGL3Technique;
+ Qt3DRender::QTechnique *m_phongGL2Technique;
+ Qt3DRender::QTechnique *m_phongES2Technique;
+ Qt3DRender::QRenderPass *m_phongGL3RenderPass;
+ Qt3DRender::QRenderPass *m_phongGL2RenderPass;
+ Qt3DRender::QRenderPass *m_phongES2RenderPass;
+ Qt3DRender::QShaderProgram *m_phongGL3Shader;
+ Qt3DRender::QShaderProgram *m_phongGL2ES2Shader;
+ Qt3DRender::QFilterKey *m_filterKey;
+
+ Q_DECLARE_PUBLIC(QPhongMaterial)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPHONGMATERIAL_P_H
+
diff --git a/src/extras/defaults/qskyboxentity.cpp b/src/extras/defaults/qskyboxentity.cpp
new file mode 100644
index 000000000..2e755f385
--- /dev/null
+++ b/src/extras/defaults/qskyboxentity.cpp
@@ -0,0 +1,293 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qskyboxentity.h"
+#include "qskyboxentity_p.h"
+
+#include <Qt3DCore/qtransform.h>
+#include <Qt3DRender/qfilterkey.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qcullface.h>
+#include <Qt3DRender/qdepthtest.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DExtras/qcuboidmesh.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+#include <Qt3DRender/qshaderprogram.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+QSkyboxEntityPrivate::QSkyboxEntityPrivate()
+ : QEntityPrivate()
+ , m_effect(new QEffect())
+ , m_material(new QMaterial())
+ , m_skyboxTexture(new QTextureCubeMap())
+ , m_gl3Shader(new QShaderProgram())
+ , m_gl2es2Shader(new QShaderProgram())
+ , m_gl2Technique(new QTechnique())
+ , m_es2Technique(new QTechnique())
+ , m_gl3Technique(new QTechnique())
+ , m_filterKey(new QFilterKey)
+ , m_gl2RenderPass(new QRenderPass())
+ , m_es2RenderPass(new QRenderPass())
+ , m_gl3RenderPass(new QRenderPass())
+ , m_mesh(new QCuboidMesh())
+ , m_transform(new Qt3DCore::QTransform())
+ , m_textureParameter(new QParameter(QStringLiteral("skyboxTexture"), m_skyboxTexture))
+ , m_posXImage(new QTextureImage())
+ , m_posYImage(new QTextureImage())
+ , m_posZImage(new QTextureImage())
+ , m_negXImage(new QTextureImage())
+ , m_negYImage(new QTextureImage())
+ , m_negZImage(new QTextureImage())
+ , m_extension(QStringLiteral(".png"))
+{
+}
+
+/*!
+ * \internal
+ */
+void QSkyboxEntityPrivate::init()
+{
+ m_gl3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/skybox.vert"))));
+ m_gl3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/skybox.frag"))));
+ m_gl2es2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/skybox.vert"))));
+ m_gl2es2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/skybox.frag"))));
+
+ m_gl3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_gl3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_gl3Technique->graphicsApiFilter()->setMajorVersion(1);
+ m_gl3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+
+ m_gl2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ m_gl2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_gl2Technique->graphicsApiFilter()->setMajorVersion(0);
+ m_gl2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_es2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ m_es2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_es2Technique->graphicsApiFilter()->setMajorVersion(0);
+ m_es2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+ m_filterKey->setParent(m_effect);
+ m_filterKey->setName(QStringLiteral("renderingStyle"));
+ m_filterKey->setValue(QStringLiteral("forward"));
+
+ m_gl3Technique->addFilterKey(m_filterKey);
+ m_gl2Technique->addFilterKey(m_filterKey);
+ m_es2Technique->addFilterKey(m_filterKey);
+
+ m_gl3RenderPass->setShaderProgram(m_gl3Shader);
+ m_gl2RenderPass->setShaderProgram(m_gl2es2Shader);
+ m_es2RenderPass->setShaderProgram(m_gl2es2Shader);
+
+ QCullFace *cullFront = new QCullFace();
+ cullFront->setMode(QCullFace::Front);
+ QDepthTest *depthTest = new QDepthTest();
+ depthTest->setDepthFunction(QDepthTest::LessOrEqual);
+
+ m_gl3RenderPass->addRenderState(cullFront);
+ m_gl3RenderPass->addRenderState(depthTest);
+ m_gl2RenderPass->addRenderState(cullFront);
+ m_gl2RenderPass->addRenderState(depthTest);
+ m_es2RenderPass->addRenderState(cullFront);
+ m_es2RenderPass->addRenderState(depthTest);
+
+ m_gl3Technique->addRenderPass(m_gl3RenderPass);
+ m_gl2Technique->addRenderPass(m_gl2RenderPass);
+ m_es2Technique->addRenderPass(m_es2RenderPass);
+
+ m_effect->addTechnique(m_gl3Technique);
+ m_effect->addTechnique(m_gl2Technique);
+ m_effect->addTechnique(m_es2Technique);
+
+ m_material->setEffect(m_effect);
+ m_material->addParameter(m_textureParameter);
+
+ m_mesh->setXYMeshResolution(QSize(2, 2));
+ m_mesh->setXZMeshResolution(QSize(2, 2));
+ m_mesh->setYZMeshResolution(QSize(2, 2));
+
+ m_posXImage->setFace(QTextureCubeMap::CubeMapPositiveX);
+ m_posYImage->setFace(QTextureCubeMap::CubeMapPositiveY);
+ m_posZImage->setFace(QTextureCubeMap::CubeMapPositiveZ);
+ m_negXImage->setFace(QTextureCubeMap::CubeMapNegativeX);
+ m_negYImage->setFace(QTextureCubeMap::CubeMapNegativeY);
+ m_negZImage->setFace(QTextureCubeMap::CubeMapNegativeZ);
+
+ m_skyboxTexture->setMagnificationFilter(QTextureCubeMap::Linear);
+ m_skyboxTexture->setMinificationFilter(QTextureCubeMap::Linear);
+ m_skyboxTexture->setGenerateMipMaps(false);
+ m_skyboxTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::ClampToEdge));
+
+ m_skyboxTexture->addTextureImage(m_posXImage);
+ m_skyboxTexture->addTextureImage(m_posYImage);
+ m_skyboxTexture->addTextureImage(m_posZImage);
+ m_skyboxTexture->addTextureImage(m_negXImage);
+ m_skyboxTexture->addTextureImage(m_negYImage);
+ m_skyboxTexture->addTextureImage(m_negZImage);
+
+ q_func()->addComponent(m_mesh);
+ q_func()->addComponent(m_material);
+ q_func()->addComponent(m_transform);
+}
+
+/*!
+ * \internal
+ */
+void QSkyboxEntityPrivate::reloadTexture()
+{
+ m_posXImage->setSource(QUrl(m_baseName + QStringLiteral("_posx") + m_extension));
+ m_posYImage->setSource(QUrl(m_baseName + QStringLiteral("_posy") + m_extension));
+ m_posZImage->setSource(QUrl(m_baseName + QStringLiteral("_posz") + m_extension));
+ m_negXImage->setSource(QUrl(m_baseName + QStringLiteral("_negx") + m_extension));
+ m_negYImage->setSource(QUrl(m_baseName + QStringLiteral("_negy") + m_extension));
+ m_negZImage->setSource(QUrl(m_baseName + QStringLiteral("_negz") + m_extension));
+}
+
+/*!
+ * \class Qt3DRender::QSkyboxEntity
+ * \inmodule Qt3DRender
+ *
+ * \brief Qt3DRender::QSkyboxEntity is a convenience Qt3DCore::QEntity subclass that can
+ * be used to insert a skybox in a 3D scene.
+ *
+ * By specifying a base name and an extension, Qt3DCore::QSkyboxEntity
+ * will take care of building a TextureCubeMap to be rendered at runtime. The
+ * images in the source directory should match the pattern:
+ * \b base name + * "_posx|_posy|_posz|_negx|_negy|_negz" + extension
+ *
+ * By default the extension defaults to .png.
+ *
+ * \note Please note that you shouldn't try to render skybox with an
+ * orthographic projection.
+ *
+ * \since 5.5
+ */
+
+/*!
+ * Constructs a new Qt3DCore::QSkyboxEntity object with \a parent as parent.
+ */
+QSkyboxEntity::QSkyboxEntity(QNode *parent)
+ : QEntity(*new QSkyboxEntityPrivate, parent)
+{
+ d_func()->init();
+}
+
+/*! \internal */
+QSkyboxEntity::~QSkyboxEntity()
+{
+}
+
+/*!
+ * Sets the base name to \a baseName.
+ */
+void QSkyboxEntity::setBaseName(const QString &baseName)
+{
+ Q_D(QSkyboxEntity);
+ if (baseName != d->m_baseName) {
+ d->m_baseName = baseName;
+ emit sourceDirectoryChanged(baseName);
+ d->reloadTexture();
+ }
+}
+/*!
+ * Returns the base name.
+ */
+QString QSkyboxEntity::baseName() const
+{
+ Q_D(const QSkyboxEntity);
+ return d->m_baseName;
+}
+
+/*!
+ * Sets the extension to \a extension.
+ */
+void QSkyboxEntity::setExtension(const QString &extension)
+{
+ Q_D(QSkyboxEntity);
+ if (extension != d->m_extension) {
+ d->m_extension = extension;
+ emit extensionChanged(extension);
+ d->reloadTexture();
+ }
+}
+
+/*!
+ * Returns the extension
+ */
+QString QSkyboxEntity::extension() const
+{
+ Q_D(const QSkyboxEntity);
+ return d->m_extension;
+}
+
+/*!
+ * Sets the camera position to \a cameraPosition.
+ */
+void QSkyboxEntity::setCameraPosition(const QVector3D &cameraPosition)
+{
+ Q_D(QSkyboxEntity);
+ if (cameraPosition != d->m_position) {
+ d->m_position = cameraPosition;
+ d->m_transform->setTranslation(d->m_position);
+ emit cameraPositionChanged(cameraPosition);
+ }
+}
+
+/*!
+ * Returns the camera position.
+ */
+QVector3D QSkyboxEntity::cameraPosition() const
+{
+ Q_D(const QSkyboxEntity);
+ return d->m_position;
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qskyboxentity.h b/src/extras/defaults/qskyboxentity.h
new file mode 100644
index 000000000..8cb279e1a
--- /dev/null
+++ b/src/extras/defaults/qskyboxentity.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QSKYBOXENTITY_H
+#define QT3DEXTRAS_QSKYBOXENTITY_H
+
+#include <Qt3DCore/qentity.h>
+#include <Qt3DExtras/qt3dextras_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QSkyboxEntityPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QSkyboxEntity : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+public:
+ explicit QSkyboxEntity(Qt3DCore::QNode *parent = nullptr);
+ ~QSkyboxEntity();
+
+ void setBaseName(const QString &path);
+ QString baseName() const;
+
+ void setExtension(const QString &extension);
+ QString extension() const;
+
+ void setCameraPosition(const QVector3D &cameraPosition);
+ QVector3D cameraPosition() const;
+
+Q_SIGNALS:
+ void sourceDirectoryChanged(const QString &path);
+ void extensionChanged(const QString &extension);
+ void cameraPositionChanged(const QVector3D &cameraPosition);
+
+private:
+ Q_DECLARE_PRIVATE(QSkyboxEntity)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QSKYBOXENTITY_H
diff --git a/src/extras/defaults/qskyboxentity_p.h b/src/extras/defaults/qskyboxentity_p.h
new file mode 100644
index 000000000..565caa66d
--- /dev/null
+++ b/src/extras/defaults/qskyboxentity_p.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QSKYBOXENTITY_P_H
+#define QT3DEXTRAS_QSKYBOXENTITY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qentity_p.h>
+#include <QVector3D>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QTransform;
+}
+
+namespace Qt3DRender {
+
+class QFilterKey;
+class QTextureCubeMap;
+class QShaderProgram;
+class QSkyboxEntity;
+class QTextureImage;
+class QRenderPass;
+class QTechnique;
+class QParameter;
+class QMaterial;
+class QEffect;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QCuboidMesh;
+
+class QSkyboxEntityPrivate : public Qt3DCore::QEntityPrivate
+{
+ QSkyboxEntityPrivate();
+
+ void init();
+ void reloadTexture();
+
+ Q_DECLARE_PUBLIC(QSkyboxEntity)
+
+ Qt3DRender::QEffect *m_effect;
+ Qt3DRender::QMaterial *m_material;
+ Qt3DRender::QTextureCubeMap *m_skyboxTexture;
+ Qt3DRender::QShaderProgram *m_gl3Shader;
+ Qt3DRender::QShaderProgram *m_gl2es2Shader;
+ Qt3DRender::QTechnique *m_gl2Technique;
+ Qt3DRender::QTechnique *m_es2Technique;
+ Qt3DRender::QTechnique *m_gl3Technique;
+ Qt3DRender::QFilterKey *m_filterKey;
+ Qt3DRender::QRenderPass *m_gl2RenderPass;
+ Qt3DRender::QRenderPass *m_es2RenderPass;
+ Qt3DRender::QRenderPass *m_gl3RenderPass;
+ QCuboidMesh *m_mesh;
+ Qt3DCore::QTransform *m_transform;
+ Qt3DRender::QParameter *m_textureParameter;
+ Qt3DRender::QTextureImage *m_posXImage;
+ Qt3DRender:: QTextureImage *m_posYImage;
+ Qt3DRender::QTextureImage *m_posZImage;
+ Qt3DRender::QTextureImage *m_negXImage;
+ Qt3DRender::QTextureImage *m_negYImage;
+ Qt3DRender::QTextureImage *m_negZImage;
+ QString m_extension;
+ QString m_baseName;
+ QVector3D m_position;
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QSKYBOXENTITY_P_H
+
diff --git a/src/extras/defaults/qt3dwindow.cpp b/src/extras/defaults/qt3dwindow.cpp
new file mode 100644
index 000000000..eed9d8862
--- /dev/null
+++ b/src/extras/defaults/qt3dwindow.cpp
@@ -0,0 +1,179 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qt3dwindow.h"
+
+#include <Qt3DExtras/qforwardrenderer.h>
+#include <Qt3DRender/qrendersettings.h>
+#include <Qt3DRender/qrenderaspect.h>
+#include <Qt3DInput/qinputaspect.h>
+#include <Qt3DInput/qinputsettings.h>
+#include <Qt3DLogic/qlogicaspect.h>
+
+#include <Qt3DCore/qaspectengine.h>
+#include <Qt3DRender/qcamera.h>
+#include <Qt3DCore/qentity.h>
+
+#include <QtGui/qopenglcontext.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+Qt3DWindow::Qt3DWindow(QScreen *screen)
+ : QWindow(screen)
+ , m_aspectEngine(new Qt3DCore::QAspectEngine)
+ , m_renderAspect(new Qt3DRender::QRenderAspect)
+ , m_inputAspect(new Qt3DInput::QInputAspect)
+ , m_logicAspect(new Qt3DLogic::QLogicAspect)
+ , m_renderSettings(new Qt3DRender::QRenderSettings)
+ , m_forwardRenderer(new Qt3DExtras::QForwardRenderer)
+ , m_defaultCamera(new Qt3DRender::QCamera)
+ , m_inputSettings(new Qt3DInput::QInputSettings)
+ , m_root(new Qt3DCore::QEntity)
+ , m_userRoot(nullptr)
+ , m_initialized(false)
+{
+ setSurfaceType(QSurface::OpenGLSurface);
+
+ resize(1024, 768);
+
+ QSurfaceFormat format;
+#ifdef QT_OPENGL_ES_2
+ format.setRenderableType(QSurfaceFormat::OpenGLES);
+#else
+ if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
+ format.setVersion(4, 3);
+ format.setProfile(QSurfaceFormat::CoreProfile);
+ }
+#endif
+ format.setDepthBufferSize(24);
+ format.setSamples(4);
+ format.setStencilBufferSize(8);
+ setFormat(format);
+ create();
+
+ m_aspectEngine->registerAspect(m_renderAspect);
+ m_aspectEngine->registerAspect(m_inputAspect);
+ m_aspectEngine->registerAspect(m_logicAspect);
+
+ m_defaultCamera->setParent(m_root);
+ m_forwardRenderer->setCamera(m_defaultCamera);
+ m_forwardRenderer->setSurface(this);
+ m_renderSettings->setActiveFrameGraph(m_forwardRenderer);
+ m_inputSettings->setEventSource(this);
+}
+
+Qt3DWindow::~Qt3DWindow()
+{
+}
+
+void Qt3DWindow::registerAspect(Qt3DCore::QAbstractAspect *aspect)
+{
+ Q_ASSERT(!isVisible());
+ m_aspectEngine->registerAspect(aspect);
+}
+
+void Qt3DWindow::registerAspect(const QString &name)
+{
+ Q_ASSERT(!isVisible());
+ m_aspectEngine->registerAspect(name);
+}
+
+void Qt3DWindow::setRootEntity(Qt3DCore::QEntity *root)
+{
+ Q_ASSERT(!isVisible());
+ m_userRoot = root;
+}
+
+void Qt3DWindow::setActiveFrameGraph(Qt3DRender::QFrameGraphNode *activeFrameGraph)
+{
+ m_renderSettings->setActiveFrameGraph(activeFrameGraph);
+}
+
+Qt3DRender::QFrameGraphNode *Qt3DWindow::activeFrameGraph() const
+{
+ return m_renderSettings->activeFrameGraph();
+}
+
+Qt3DExtras::QForwardRenderer *Qt3DWindow::defaultFramegraph() const
+{
+ return m_forwardRenderer;
+}
+
+Qt3DRender::QCamera *Qt3DWindow::camera() const
+{
+ return m_defaultCamera;
+}
+
+void Qt3DWindow::showEvent(QShowEvent *e)
+{
+ if (!m_initialized) {
+ if (m_userRoot != nullptr)
+ m_userRoot->setParent(m_root);
+
+ m_root->addComponent(m_renderSettings);
+ m_root->addComponent(m_inputSettings);
+ m_aspectEngine->setRootEntity(Qt3DCore::QEntityPtr(m_root));
+
+ m_initialized = true;
+ }
+
+ QWindow::showEvent(e);
+}
+
+void Qt3DWindow::resizeEvent(QResizeEvent *)
+{
+ m_defaultCamera->setAspectRatio(float(width()) / float(height()));
+}
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/defaults/qt3dwindow.h b/src/extras/defaults/qt3dwindow.h
new file mode 100644
index 000000000..1d73966de
--- /dev/null
+++ b/src/extras/defaults/qt3dwindow.h
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DWINDOW_H
+#define QT3DWINDOW_H
+
+#include <QWindow>
+#include <Qt3DExtras/qt3dextras_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QAspectEngine;
+class QAbstractAspect;
+class QEntity;
+}
+
+namespace Qt3DRender {
+class QCamera;
+class QFrameGraphNode;
+class QRenderAspect;
+class QRenderSettings;
+}
+
+namespace Qt3DExtras {
+class QForwardRenderer;
+}
+
+namespace Qt3DInput {
+class QInputAspect;
+class QInputSettings;
+}
+
+namespace Qt3DLogic {
+class QLogicAspect;
+}
+
+namespace Qt3DExtras {
+
+class QT3DEXTRASSHARED_EXPORT Qt3DWindow : public QWindow
+{
+ Q_OBJECT
+public:
+ Qt3DWindow(QScreen *screen = nullptr);
+ ~Qt3DWindow();
+
+ void registerAspect(Qt3DCore::QAbstractAspect *aspect);
+ void registerAspect(const QString &name);
+
+ void setRootEntity(Qt3DCore::QEntity *root);
+
+ void setActiveFrameGraph(Qt3DRender::QFrameGraphNode *activeFrameGraph);
+ Qt3DRender::QFrameGraphNode *activeFrameGraph() const;
+ Qt3DExtras::QForwardRenderer *defaultFramegraph() const;
+
+ Qt3DRender::QCamera *camera() const;
+
+public Q_SLOTS:
+
+Q_SIGNALS:
+
+protected:
+ void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+
+private:
+ QScopedPointer<Qt3DCore::QAspectEngine> m_aspectEngine;
+
+ // Aspects
+ Qt3DRender::QRenderAspect *m_renderAspect;
+ Qt3DInput::QInputAspect *m_inputAspect;
+ Qt3DLogic::QLogicAspect *m_logicAspect;
+
+ // Renderer configuration
+ Qt3DRender::QRenderSettings *m_renderSettings;
+ Qt3DExtras::QForwardRenderer *m_forwardRenderer;
+ Qt3DRender::QCamera *m_defaultCamera;
+
+ // Input configuration
+ Qt3DInput::QInputSettings *m_inputSettings;
+
+ // Logic configuration
+
+ // Scene
+ Qt3DCore::QEntity *m_root;
+ Qt3DCore::QEntity *m_userRoot;
+
+ bool m_initialized;
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DWINDOW_H
diff --git a/src/extras/extras.pro b/src/extras/extras.pro
new file mode 100644
index 000000000..a7bbc7f66
--- /dev/null
+++ b/src/extras/extras.pro
@@ -0,0 +1,19 @@
+TARGET = Qt3DExtras
+MODULE = 3dextras
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private 3dinput 3dlogic
+
+DEFINES += QT3DEXTRAS_LIBRARY
+
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
+load(qt_module)
+
+include (geometries/geometries.pri)
+include (defaults/defaults.pri)
+
+HEADERS += \
+ qt3dextras_global.h
+
+RESOURCES += $$PWD/extras.qrc
+
diff --git a/src/extras/extras.qrc b/src/extras/extras.qrc
new file mode 100644
index 000000000..e7b1c1d9a
--- /dev/null
+++ b/src/extras/extras.qrc
@@ -0,0 +1,43 @@
+<RCC>
+ <qresource prefix="/">
+ <file>shaders/gl3/light.inc.frag</file>
+ <file>shaders/es2/light.inc.frag</file>
+ <file>shaders/es2/light.inc.frag100</file>
+ <file>shaders/gl3/phong.vert</file>
+ <file>shaders/gl3/phong.frag</file>
+ <file>shaders/es2/phong.vert</file>
+ <file>shaders/es2/phong.frag</file>
+ <file>shaders/gl3/normaldiffusespecularmap.frag</file>
+ <file>shaders/gl3/diffusemap.vert</file>
+ <file>shaders/gl3/diffusemap.frag</file>
+ <file>shaders/es2/normaldiffusespecularmap.frag</file>
+ <file>shaders/es2/diffusemap.vert</file>
+ <file>shaders/es2/diffusemap.frag</file>
+ <file>shaders/es2/normaldiffusemap.vert</file>
+ <file>shaders/es2/normaldiffusemap.frag</file>
+ <file>shaders/es2/normaldiffusemapalpha.frag</file>
+ <file>shaders/gl3/normaldiffusemap.frag</file>
+ <file>shaders/gl3/normaldiffusemap.vert</file>
+ <file>shaders/gl3/normaldiffusemapalpha.frag</file>
+ <file>shaders/es2/diffusespecularmap.frag</file>
+ <file>shaders/gl3/diffusespecularmap.frag</file>
+ <file>shaders/gl3/pervertexcolor.frag</file>
+ <file>shaders/gl3/pervertexcolor.vert</file>
+ <file>shaders/es2/pervertexcolor.frag</file>
+ <file>shaders/es2/pervertexcolor.vert</file>
+ <file>shaders/es2/skybox.frag</file>
+ <file>shaders/es2/skybox.vert</file>
+ <file>shaders/gl3/skybox.frag</file>
+ <file>shaders/gl3/skybox.vert</file>
+ <file>shaders/gl3/gooch.vert</file>
+ <file>shaders/gl3/gooch.frag</file>
+ <file>shaders/es2/gooch.frag</file>
+ <file>shaders/es2/gooch.vert</file>
+ <file>shaders/gl3/phongalpha.frag</file>
+ <file>shaders/es2/phongalpha.frag</file>
+ <file>shaders/gl3/unlittexture.vert</file>
+ <file>shaders/gl3/unlittexture.frag</file>
+ <file>shaders/es2/unlittexture.frag</file>
+ <file>shaders/es2/unlittexture.vert</file>
+ </qresource>
+</RCC>
diff --git a/src/extras/geometries/geometries.pri b/src/extras/geometries/geometries.pri
new file mode 100644
index 000000000..7a2932cb7
--- /dev/null
+++ b/src/extras/geometries/geometries.pri
@@ -0,0 +1,35 @@
+HEADERS += \
+ $$PWD/qconegeometry.h \
+ $$PWD/qconegeometry_p.h \
+ $$PWD/qconemesh.h \
+ $$PWD/qcuboidmesh.h \
+ $$PWD/qcylindergeometry.h \
+ $$PWD/qcylindergeometry_p.h \
+ $$PWD/qcylindermesh.h \
+ $$PWD/qplanemesh.h \
+ $$PWD/qspheremesh.h \
+ $$PWD/qtorusmesh.h \
+ $$PWD/qtorusgeometry.h \
+ $$PWD/qtorusgeometry_p.h \
+ $$PWD/qspheregeometry.h \
+ $$PWD/qspheregeometry_p.h \
+ $$PWD/qcuboidgeometry.h \
+ $$PWD/qcuboidgeometry_p.h \
+ $$PWD/qplanegeometry.h \
+ $$PWD/qplanegeometry_p.h
+
+SOURCES += \
+ $$PWD/qconegeometry.cpp \
+ $$PWD/qconemesh.cpp \
+ $$PWD/qcuboidmesh.cpp \
+ $$PWD/qcylindergeometry.cpp \
+ $$PWD/qcylindermesh.cpp \
+ $$PWD/qplanemesh.cpp \
+ $$PWD/qspheremesh.cpp \
+ $$PWD/qtorusmesh.cpp \
+ $$PWD/qtorusgeometry.cpp \
+ $$PWD/qspheregeometry.cpp \
+ $$PWD/qcuboidgeometry.cpp \
+ $$PWD/qplanegeometry.cpp
+
+INCLUDEPATH += $$PWD
diff --git a/src/extras/geometries/qconegeometry.cpp b/src/extras/geometries/qconegeometry.cpp
new file mode 100644
index 000000000..7215c0797
--- /dev/null
+++ b/src/extras/geometries/qconegeometry.cpp
@@ -0,0 +1,590 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _USE_MATH_DEFINES
+# define _USE_MATH_DEFINES // For MSVC
+#endif
+
+#include "qconegeometry.h"
+#include "qconegeometry_p.h"
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/qattribute.h>
+#include <QVector3D>
+#include <cmath>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+namespace {
+
+void createSidesVertices(float *&verticesPtr,
+ int rings,
+ int slices,
+ double topRadius,
+ double bottomRadius,
+ double length)
+{
+ const float dY = length / static_cast<float>(rings - 1);
+ const float dTheta = (M_PI * 2) / static_cast<float>(slices);
+
+ for (int ring = 0; ring < rings; ++ring) {
+ const float y = -length / 2.0f + static_cast<float>(ring) * dY;
+
+ const float t = (y + length / 2) / length;
+ const float radius = (bottomRadius * (1 - t)) + (t * topRadius);
+
+ for (int slice = 0; slice <= slices; ++slice) {
+ const float theta = static_cast<float>(slice) * dTheta;
+ const float ta = std::tan((M_PI/2) - std::atan(length / (bottomRadius - topRadius)));
+ const float ct = std::cos(theta);
+ const float st = std::sin(theta);
+
+ *verticesPtr++ = radius * ct;
+ *verticesPtr++ = y;
+ *verticesPtr++ = radius * st;
+
+ *verticesPtr++ = (y + length / 2.0) / length;
+ *verticesPtr++ = theta / (M_PI * 2);
+
+ QVector3D n(ct, ta, st);
+ n.normalize();
+ *verticesPtr++ = n.x();
+ *verticesPtr++ = n.y();
+ *verticesPtr++ = n.z();
+ }
+ }
+}
+
+void createSidesIndices(quint16 *&indicesPtr, int rings, int slices)
+{
+ for (int ring = 0; ring < rings-1; ++ring) {
+ const int ringIndexStart = ring * (slices + 1);
+ const int nextRingIndexStart = (ring + 1) * (slices + 1);
+
+ for (int slice = 0; slice <= slices; ++slice) {
+ if (slice == slices)
+ continue;
+
+ const int nextSlice = slice + 1;
+
+ *indicesPtr++ = (ringIndexStart + slice);
+ *indicesPtr++ = (nextRingIndexStart + slice);
+ *indicesPtr++ = (ringIndexStart + nextSlice);
+ *indicesPtr++ = (ringIndexStart + nextSlice);
+ *indicesPtr++ = (nextRingIndexStart + slice);
+ *indicesPtr++ = (nextRingIndexStart + nextSlice);
+ }
+ }
+}
+
+void createDiscVertices(float *&verticesPtr,
+ int slices,
+ double topRadius,
+ double bottomRadius,
+ double length,
+ double yPosition)
+{
+ const float dTheta = (M_PI * 2) / static_cast<float>(slices);
+ const double yNormal = (yPosition < 0.0f) ? -1.0f : 1.0f;
+
+ *verticesPtr++ = 0.0f;
+ *verticesPtr++ = yPosition;
+ *verticesPtr++ = 0.0f;
+
+ *verticesPtr++ = 1.0f;
+ *verticesPtr++ = 0.0f;
+
+ *verticesPtr++ = 0.0f;
+ *verticesPtr++ = yNormal;
+ *verticesPtr++ = 0.0f;
+
+
+ for (int slice = 0; slice <= slices; ++slice)
+ {
+ const float theta = static_cast<float>(slice) * dTheta;
+ const float ct = std::cos(theta);
+ const float st = std::sin(theta);
+
+ const float t = (yPosition + length / 2) / length;
+ const float radius = (bottomRadius * (1 - t)) + (t * topRadius);
+
+ *verticesPtr++ = radius * ct;
+ *verticesPtr++ = yPosition;
+ *verticesPtr++ = radius * st;
+
+ *verticesPtr++ = 1.0f;
+ *verticesPtr++ = theta / (M_PI * 2);
+
+ *verticesPtr++ = 0.0f;
+ *verticesPtr++ = yNormal;
+ *verticesPtr++ = 0.0f;
+ }
+}
+
+void createDiscIndices(quint16 *&indicesPtr,
+ int discCenterIndex,
+ int slices,
+ bool isTopCap)
+{
+ if ( !isTopCap ) {
+ for ( int i = slices - 1 ; i >= 0 ; --i )
+ {
+ if ( i != 0 ) {
+ *indicesPtr++ = discCenterIndex;
+ *indicesPtr++ = discCenterIndex + i + 1;
+ *indicesPtr++ = discCenterIndex + i;
+ } else {
+ *indicesPtr++ = discCenterIndex;
+ *indicesPtr++ = discCenterIndex + i + 1;
+ *indicesPtr++ = discCenterIndex + slices;
+ }
+ }
+ } else {
+ for ( int i = 0 ; i < slices; ++i )
+ {
+ if ( i != slices - 1 ) {
+ *indicesPtr++ = discCenterIndex;
+ *indicesPtr++ = discCenterIndex + i + 1;
+ *indicesPtr++ = discCenterIndex + i + 2;
+ } else {
+ *indicesPtr++ = discCenterIndex;
+ *indicesPtr++ = discCenterIndex + i + 1;
+ *indicesPtr++ = discCenterIndex + 1;
+ }
+ }
+ }
+}
+
+} // anonymous
+
+
+class ConeVertexDataFunctor : public QBufferDataGenerator
+{
+public:
+ ConeVertexDataFunctor(bool hasTopEndcap, bool hasBottomEndcap, int rings, int slices,
+ float topRadius, float bottomRadius, float length)
+ : m_hasTopEndcap(hasTopEndcap)
+ , m_hasBottomEndcap(hasBottomEndcap)
+ , m_rings(rings)
+ , m_slices(slices)
+ , m_topRadius(topRadius)
+ , m_bottomRadius(bottomRadius)
+ , m_length(length)
+ {}
+
+ QByteArray operator ()() Q_DECL_OVERRIDE
+ {
+ int verticesCount = 0;
+
+ verticesCount = ( m_slices + 1 ) * m_rings // Sides
+ + (m_hasTopEndcap + m_hasBottomEndcap) * (m_slices + 1) + 2; // endcaps
+
+ // vec3 pos, vec2 texCoord, vec3 normal
+ const quint32 vertexSize = (3 + 2 + 3) * sizeof(float);
+
+ QByteArray verticesData;
+ verticesData.resize(vertexSize * verticesCount);
+ float *verticesPtr = reinterpret_cast<float*>(verticesData.data());
+
+ createSidesVertices(verticesPtr, m_rings, m_slices, m_topRadius, m_bottomRadius, m_length);
+ if ( m_hasTopEndcap )
+ createDiscVertices(verticesPtr, m_slices, m_topRadius, m_bottomRadius, m_length, m_length * 0.5f);
+ if ( m_hasBottomEndcap )
+ createDiscVertices(verticesPtr, m_slices, m_topRadius, m_bottomRadius, m_length, -m_length * 0.5f);
+
+ return verticesData;
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
+ {
+ const ConeVertexDataFunctor *otherFunctor = functor_cast<ConeVertexDataFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_hasTopEndcap == m_hasTopEndcap &&
+ otherFunctor->m_hasBottomEndcap == m_hasBottomEndcap &&
+ otherFunctor->m_rings == m_rings &&
+ otherFunctor->m_slices == m_slices &&
+ otherFunctor->m_topRadius == m_topRadius &&
+ otherFunctor->m_bottomRadius == m_bottomRadius &&
+ otherFunctor->m_length == m_length);
+ return false;
+ }
+
+ QT3D_FUNCTOR(ConeVertexDataFunctor)
+
+private:
+ bool m_hasTopEndcap;
+ bool m_hasBottomEndcap;
+ int m_rings;
+ int m_slices;
+ float m_topRadius;
+ float m_bottomRadius;
+ float m_length;
+};
+
+class ConeIndexDataFunctor : public QBufferDataGenerator
+{
+public:
+ ConeIndexDataFunctor(bool hasTopEndcap, bool hasBottomEndcap, int rings, int slices,
+ float length)
+ : m_hasTopEndcap(hasTopEndcap)
+ , m_hasBottomEndcap(hasBottomEndcap)
+ , m_rings(rings)
+ , m_slices(slices)
+ , m_length(length)
+ {
+ }
+
+ QByteArray operator ()() Q_DECL_OVERRIDE
+ {
+ int facesCount = 0;
+
+ facesCount = (m_slices * 2) * m_rings // 2 x tris per side, for all rings
+ + m_slices * (m_hasTopEndcap + m_hasBottomEndcap); // endcaps
+
+ const int indicesCount = facesCount * 3;
+ const int indexSize = sizeof(quint16);
+ Q_ASSERT(indicesCount < 65536);
+
+ QByteArray indicesBytes;
+ indicesBytes.resize(indicesCount * indexSize);
+ quint16 *indicesPtr = reinterpret_cast<quint16*>(indicesBytes.data());
+
+ createSidesIndices(indicesPtr, m_rings, m_slices);
+ if ( m_hasTopEndcap )
+ createDiscIndices(indicesPtr, m_rings * (m_slices + 1) + m_slices + 2, m_slices, true);
+ if ( m_hasBottomEndcap )
+ createDiscIndices(indicesPtr, m_rings * (m_slices + 1), m_slices, false);
+
+ return indicesBytes;
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
+ {
+ const ConeIndexDataFunctor *otherFunctor = functor_cast<ConeIndexDataFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_hasTopEndcap == m_hasTopEndcap &&
+ otherFunctor->m_hasBottomEndcap == m_hasBottomEndcap &&
+ otherFunctor->m_rings == m_rings &&
+ otherFunctor->m_slices == m_slices &&
+ otherFunctor->m_length == m_length);
+ return false;
+ }
+
+ QT3D_FUNCTOR(ConeIndexDataFunctor)
+
+private:
+ bool m_hasTopEndcap;
+ bool m_hasBottomEndcap;
+ int m_rings;
+ int m_slices;
+ float m_length;
+};
+
+
+QConeGeometryPrivate::QConeGeometryPrivate()
+ : QGeometryPrivate()
+ , m_hasTopEndcap(true)
+ , m_hasBottomEndcap(true)
+ , m_rings(16)
+ , m_slices(16)
+ , m_topRadius(0.0f)
+ , m_bottomRadius(1.0f)
+ , m_length(1.0f)
+ , m_positionAttribute(nullptr)
+ , m_normalAttribute(nullptr)
+ , m_texCoordAttribute(nullptr)
+ , m_indexAttribute(nullptr)
+ , m_vertexBuffer(nullptr)
+ , m_indexBuffer(nullptr)
+{
+}
+
+void QConeGeometryPrivate::init()
+{
+ Q_Q(QConeGeometry);
+ m_positionAttribute = new QAttribute(q);
+ m_normalAttribute = new QAttribute(q);
+ m_texCoordAttribute = new QAttribute(q);
+ m_indexAttribute = new QAttribute(q);
+ m_vertexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, q);
+ m_indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, q);
+
+ // vec3 pos, vec2 tex, vec3 normal
+ const quint32 elementSize = 3 + 2 + 3;
+ const quint32 stride = elementSize * sizeof(float);
+ const int faces = (m_slices + 1) * (m_rings + 1);
+ int nVerts = 0;
+
+ nVerts = (m_slices * 2) * m_rings // Sides
+ + m_slices * (m_hasTopEndcap + m_hasBottomEndcap); // endcaps
+
+ m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
+ m_positionAttribute->setDataType(QAttribute::Float);
+ m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_positionAttribute->setBuffer(m_vertexBuffer);
+ m_positionAttribute->setByteStride(stride);
+ m_positionAttribute->setCount(nVerts);
+
+ m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
+ m_texCoordAttribute->setDataType(QAttribute::Float);
+ m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_texCoordAttribute->setBuffer(m_vertexBuffer);
+ m_texCoordAttribute->setByteStride(stride);
+ m_texCoordAttribute->setByteOffset(3 * sizeof(float));
+ m_texCoordAttribute->setCount(nVerts);
+
+ m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
+ m_normalAttribute->setDataType(QAttribute::Float);
+ m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_normalAttribute->setBuffer(m_vertexBuffer);
+ m_normalAttribute->setByteStride(stride);
+ m_normalAttribute->setByteOffset(5 * sizeof(float));
+ m_normalAttribute->setCount(nVerts);
+
+ m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
+ m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setBuffer(m_indexBuffer);
+
+ m_indexAttribute->setCount(faces * 3);
+
+ m_vertexBuffer->setDataGenerator(QSharedPointer<ConeVertexDataFunctor>::create(m_hasTopEndcap, m_hasBottomEndcap, m_rings, m_slices,
+ m_topRadius, m_bottomRadius, m_length));
+ m_indexBuffer->setDataGenerator(QSharedPointer<ConeIndexDataFunctor>::create(m_hasTopEndcap, m_hasBottomEndcap, m_rings, m_slices,
+ m_length));
+
+ q->addAttribute(m_positionAttribute);
+ q->addAttribute(m_texCoordAttribute);
+ q->addAttribute(m_normalAttribute);
+ q->addAttribute(m_indexAttribute);
+}
+
+QConeGeometry::QConeGeometry(QNode *parent)
+ : QGeometry(*new QConeGeometryPrivate, parent)
+{
+ Q_D(QConeGeometry);
+ d->init();
+}
+
+QConeGeometry::QConeGeometry(QConeGeometryPrivate &dd, QNode *parent)
+ :QGeometry(dd, parent)
+{
+ Q_D(QConeGeometry);
+ d->init();
+}
+
+
+/*! \internal */
+QConeGeometry::~QConeGeometry()
+{
+}
+
+void QConeGeometry::updateVertices()
+{
+ Q_D(QConeGeometry);
+ const int nVerts = (d->m_slices + 1) * (d->m_rings + 1);
+ d->m_positionAttribute->setCount(nVerts);
+ d->m_texCoordAttribute->setCount(nVerts);
+ d->m_normalAttribute->setCount(nVerts);
+ d->m_vertexBuffer->setDataGenerator(QSharedPointer<ConeVertexDataFunctor>::create(d->m_hasTopEndcap, d->m_hasBottomEndcap, d->m_rings, d->m_slices,
+ d->m_topRadius, d->m_bottomRadius, d->m_length));
+}
+
+void QConeGeometry::updateIndices()
+{
+ Q_D(QConeGeometry);
+ int faces = 0;
+
+ faces = (d->m_slices * 2) * d->m_rings // 2 x tris per side, for all rings
+ + d->m_slices * (d->m_hasTopEndcap + d->m_hasBottomEndcap); // 2 x endcaps
+
+ d->m_indexAttribute->setCount(faces * 3);
+ d->m_indexBuffer->setDataGenerator(QSharedPointer<ConeIndexDataFunctor>::create(d->m_hasTopEndcap, d->m_hasBottomEndcap, d->m_rings, d->m_slices,
+ d->m_length));
+}
+
+void QConeGeometry::setHasTopEndcap(bool hasTopEndcap)
+{
+ Q_D(QConeGeometry);
+ if (hasTopEndcap != d->m_hasTopEndcap) {
+ d->m_hasTopEndcap = hasTopEndcap;
+ updateVertices();
+ emit hasTopEndcapChanged(hasTopEndcap);
+ }
+}
+
+
+void QConeGeometry::setHasBottomEndcap(bool hasBottomEndcap)
+{
+ Q_D(QConeGeometry);
+ if (hasBottomEndcap != d->m_hasBottomEndcap) {
+ d->m_hasBottomEndcap = hasBottomEndcap;
+ updateVertices();
+ emit hasBottomEndcapChanged(hasBottomEndcap);
+ }
+}
+
+void QConeGeometry::setRings(int rings)
+{
+ Q_D(QConeGeometry);
+ if (rings != d->m_rings) {
+ d->m_rings = rings;
+ updateVertices();
+ updateIndices();
+ emit ringsChanged(rings);
+ }
+}
+
+void QConeGeometry::setSlices(int slices)
+{
+ Q_D(QConeGeometry);
+ if (slices != d->m_slices) {
+ d->m_slices = slices;
+ updateVertices();
+ updateIndices();
+ emit slicesChanged(slices);
+ }
+}
+
+void QConeGeometry::setTopRadius(float topRadius)
+{
+ Q_D(QConeGeometry);
+ if (topRadius != d->m_topRadius) {
+ d->m_topRadius = topRadius;
+ updateVertices();
+ emit topRadiusChanged(topRadius);
+ }
+}
+
+void QConeGeometry::setBottomRadius(float bottomRadius)
+{
+ Q_D(QConeGeometry);
+ if (bottomRadius != d->m_bottomRadius) {
+ d->m_bottomRadius = bottomRadius;
+ updateVertices();
+ emit bottomRadiusChanged(bottomRadius);
+ }
+}
+
+void QConeGeometry::setLength(float length)
+{
+ Q_D(QConeGeometry);
+ if (length != d->m_length) {
+ d->m_length = length;
+ updateVertices();
+ updateIndices();
+ emit lengthChanged(length);
+ }
+}
+
+bool QConeGeometry::hasTopEndcap() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_hasTopEndcap;
+}
+
+bool QConeGeometry::hasBottomEndcap() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_hasBottomEndcap;
+}
+
+float QConeGeometry::topRadius() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_topRadius;
+}
+
+float QConeGeometry::bottomRadius() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_bottomRadius;
+}
+
+int QConeGeometry::rings() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_rings;
+}
+
+int QConeGeometry::slices() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_slices;
+}
+
+float QConeGeometry::length() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_length;
+}
+
+QAttribute *QConeGeometry::positionAttribute() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_positionAttribute;
+}
+
+QAttribute *QConeGeometry::normalAttribute() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_normalAttribute;
+}
+
+QAttribute *QConeGeometry::texCoordAttribute() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_texCoordAttribute;
+}
+
+QAttribute *QConeGeometry::indexAttribute() const
+{
+ Q_D(const QConeGeometry);
+ return d->m_indexAttribute;
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qconegeometry.h b/src/extras/geometries/qconegeometry.h
new file mode 100644
index 000000000..4f1dc944a
--- /dev/null
+++ b/src/extras/geometries/qconegeometry.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QCONEGEOMETRY_H
+#define QT3DEXTRAS_QCONEGEOMETRY_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometry.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+class QAttribute;
+} // Render
+
+namespace Qt3DExtras {
+
+class QConeGeometryPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QConeGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+ Q_PROPERTY( bool hasTopEndcap READ hasTopEndcap WRITE setHasTopEndcap NOTIFY hasTopEndcapChanged )
+ Q_PROPERTY( bool hasBottomEndcap READ hasBottomEndcap WRITE setHasBottomEndcap NOTIFY hasBottomEndcapChanged )
+ Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
+ Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
+ Q_PROPERTY( float topRadius READ topRadius WRITE setTopRadius NOTIFY topRadiusChanged )
+ Q_PROPERTY( float bottomRadius READ bottomRadius WRITE setBottomRadius NOTIFY bottomRadiusChanged )
+ Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
+ Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
+
+public:
+ explicit QConeGeometry(QNode *parent = nullptr);
+ ~QConeGeometry();
+
+ void updateVertices();
+ void updateIndices();
+
+ bool hasTopEndcap() const;
+ bool hasBottomEndcap() const;
+ float topRadius() const;
+ float bottomRadius() const;
+ int rings() const;
+ int slices() const;
+ float length() const;
+
+ Qt3DRender::QAttribute *positionAttribute() const;
+ Qt3DRender::QAttribute *normalAttribute() const;
+ Qt3DRender::QAttribute *texCoordAttribute() const;
+ Qt3DRender::QAttribute *indexAttribute() const;
+
+public Q_SLOTS:
+ void setHasTopEndcap( bool hasTopEndcap );
+ void setHasBottomEndcap( bool hasBottomEndcap );
+ void setTopRadius( float topRadius );
+ void setBottomRadius( float bottomRadius );
+ void setRings( int rings );
+ void setSlices( int slices );
+ void setLength( float length );
+
+Q_SIGNALS:
+ void hasTopEndcapChanged( bool hasTopEndcap );
+ void hasBottomEndcapChanged( bool hasBottomEndcap );
+ void topRadiusChanged( float topRadius );
+ void bottomRadiusChanged( float bottomRadius );
+ void ringsChanged( int rings );
+ void slicesChanged( int slices );
+ void lengthChanged( float length );
+
+protected:
+ QConeGeometry(QConeGeometryPrivate &dd, QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QConeGeometry)
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QCONEGEOMETRY_H
diff --git a/src/extras/geometries/qconegeometry_p.h b/src/extras/geometries/qconegeometry_p.h
new file mode 100644
index 000000000..3987b4315
--- /dev/null
+++ b/src/extras/geometries/qconegeometry_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QCONEGEOMETRY_P_H
+#define QT3DEXTRAS_QCONEGEOMETRY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qgeometry_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+class QBuffer;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QConeGeometryPrivate : public Qt3DRender::QGeometryPrivate
+{
+public:
+ QConeGeometryPrivate();
+
+ void init();
+
+ Q_DECLARE_PUBLIC(QConeGeometry)
+
+ bool m_hasTopEndcap;
+ bool m_hasBottomEndcap;
+ int m_rings;
+ int m_slices;
+ float m_topRadius;
+ float m_bottomRadius;
+ float m_length;
+ Qt3DRender::QAttribute *m_positionAttribute;
+ Qt3DRender::QAttribute *m_normalAttribute;
+ Qt3DRender::QAttribute *m_texCoordAttribute;
+ Qt3DRender::QAttribute *m_indexAttribute;
+ Qt3DRender::QBuffer *m_positionBuffer;
+ Qt3DRender::QBuffer *m_vertexBuffer;
+ Qt3DRender::QBuffer *m_indexBuffer;
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QCONEGEOMETRY_P_H
+
diff --git a/src/extras/geometries/qconemesh.cpp b/src/extras/geometries/qconemesh.cpp
new file mode 100644
index 000000000..e2f43b16d
--- /dev/null
+++ b/src/extras/geometries/qconemesh.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _USE_MATH_DEFINES
+# define _USE_MATH_DEFINES // For MSVC
+#endif
+
+#include "qconemesh.h"
+#include "qconegeometry.h"
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/qattribute.h>
+#include <qmath.h>
+#include <QVector3D>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+QConeMesh::QConeMesh(QNode *parent)
+ : QGeometryRenderer(parent)
+{
+ QConeGeometry *geometry = new QConeGeometry(this);
+ QObject::connect(geometry, &QConeGeometry::hasTopEndcapChanged, this, &QConeMesh::hasTopEndcapChanged);
+ QObject::connect(geometry, &QConeGeometry::hasBottomEndcapChanged, this, &QConeMesh::hasBottomEndcapChanged);
+ QObject::connect(geometry, &QConeGeometry::topRadiusChanged, this, &QConeMesh::topRadiusChanged);
+ QObject::connect(geometry, &QConeGeometry::bottomRadiusChanged, this, &QConeMesh::bottomRadiusChanged);
+ QObject::connect(geometry, &QConeGeometry::ringsChanged, this, &QConeMesh::ringsChanged);
+ QObject::connect(geometry, &QConeGeometry::slicesChanged, this, &QConeMesh::slicesChanged);
+ QObject::connect(geometry, &QConeGeometry::lengthChanged, this, &QConeMesh::lengthChanged);
+
+ QGeometryRenderer::setGeometry(geometry);
+}
+
+/*! \internal */
+QConeMesh::~QConeMesh()
+{
+}
+
+void QConeMesh::setHasTopEndcap(bool hasTopEndcap)
+{
+ static_cast<QConeGeometry *>(geometry())->setHasTopEndcap(hasTopEndcap);
+}
+
+void QConeMesh::setHasBottomEndcap(bool hasBottomEndcap)
+{
+ static_cast<QConeGeometry *>(geometry())->setHasBottomEndcap(hasBottomEndcap);
+}
+
+void QConeMesh::setTopRadius(float topRadius)
+{
+ static_cast<QConeGeometry *>(geometry())->setTopRadius(topRadius);
+}
+
+void QConeMesh::setBottomRadius(float bottomRadius)
+{
+ static_cast<QConeGeometry *>(geometry())->setBottomRadius(bottomRadius);
+}
+
+void QConeMesh::setRings(int rings)
+{
+ static_cast<QConeGeometry *>(geometry())->setRings(rings);
+}
+
+void QConeMesh::setSlices(int slices)
+{
+ static_cast<QConeGeometry *>(geometry())->setSlices(slices);
+}
+
+void QConeMesh::setLength(float length)
+{
+ static_cast<QConeGeometry *>(geometry())->setLength(length);
+}
+
+bool QConeMesh::hasTopEndcap() const
+{
+ return static_cast<QConeGeometry *>(geometry())->hasTopEndcap();
+}
+
+bool QConeMesh::hasBottomEndcap() const
+{
+ return static_cast<QConeGeometry *>(geometry())->hasBottomEndcap();
+}
+
+float QConeMesh::topRadius() const
+{
+ return static_cast<QConeGeometry *>(geometry())->topRadius();
+}
+
+float QConeMesh::bottomRadius() const
+{
+ return static_cast<QConeGeometry *>(geometry())->bottomRadius();
+}
+
+int QConeMesh::rings() const
+{
+ return static_cast<QConeGeometry *>(geometry())->rings();
+}
+
+int QConeMesh::slices() const
+{
+ return static_cast<QConeGeometry *>(geometry())->slices();
+}
+
+float QConeMesh::length() const
+{
+ return static_cast<QConeGeometry *>(geometry())->length();
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qconemesh.h b/src/extras/geometries/qconemesh.h
new file mode 100644
index 000000000..c32070e5c
--- /dev/null
+++ b/src/extras/geometries/qconemesh.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QCONEMESH_H
+#define QT3DEXTRAS_QCONEMESH_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometryrenderer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QT3DEXTRASSHARED_EXPORT QConeMesh : public Qt3DRender::QGeometryRenderer
+{
+ Q_OBJECT
+ Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
+ Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
+ Q_PROPERTY( bool hasTopEndcap READ hasTopEndcap WRITE setHasTopEndcap NOTIFY hasTopEndcapChanged )
+ Q_PROPERTY( bool hasBottomEndcap READ hasBottomEndcap WRITE setHasBottomEndcap NOTIFY hasBottomEndcapChanged )
+ Q_PROPERTY( float topRadius READ topRadius WRITE setTopRadius NOTIFY topRadiusChanged )
+ Q_PROPERTY( float bottomRadius READ bottomRadius WRITE setBottomRadius NOTIFY bottomRadiusChanged )
+ Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
+public:
+ explicit QConeMesh(Qt3DCore::QNode *parent = nullptr);
+ ~QConeMesh();
+
+ int rings() const;
+ int slices() const;
+ bool hasTopEndcap() const;
+ bool hasBottomEndcap() const;
+ float topRadius() const;
+ float bottomRadius() const;
+ float length() const;
+
+public Q_SLOTS:
+ void setHasTopEndcap( bool hasTopEndcap );
+ void setHasBottomEndcap( bool hasBottomEndcap );
+ void setTopRadius( float topRadius );
+ void setBottomRadius( float bottomRadius );
+ void setRings( int rings );
+ void setSlices( int slices );
+ void setLength( float length );
+
+Q_SIGNALS:
+ void hasTopEndcapChanged( bool hasTopEndcap );
+ void hasBottomEndcapChanged( bool hasBottomEndcap );
+ void topRadiusChanged( float topRadius );
+ void bottomRadiusChanged( float bottomRadius );
+ void ringsChanged( int rings );
+ void slicesChanged( int slices );
+ void lengthChanged( float length );
+
+private:
+ // As this is a default provided geometry renderer, no one should be able
+ // to modify the QGeometryRenderer's properties
+
+ void setInstanceCount(int instanceCount);
+ void setVertexCount(int vertexCount);
+ void setIndexOffset(int indexOffset);
+ void setFirstInstance(int firstInstance);
+ void setRestartIndexValue(int index);
+ void setPrimitiveRestartEnabled(bool enabled);
+ void setGeometry(Qt3DRender::QGeometry *geometry);
+ void setPrimitiveType(PrimitiveType primitiveType);
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QCONEMESH_H
diff --git a/src/extras/geometries/qcuboidgeometry.cpp b/src/extras/geometries/qcuboidgeometry.cpp
new file mode 100644
index 000000000..21944c529
--- /dev/null
+++ b/src/extras/geometries/qcuboidgeometry.cpp
@@ -0,0 +1,826 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcuboidgeometry.h"
+#include "qcuboidgeometry_p.h"
+#include <Qt3DRender/qattribute.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/private/renderlogging_p.h>
+#include <limits>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+namespace {
+
+enum PlaneNormal {
+ PositiveX,
+ NegativeX,
+ PositiveY,
+ NegativeY,
+ PositiveZ,
+ NegativeZ
+};
+
+void createPlaneVertexData(float w, float h, const QSize &resolution,
+ PlaneNormal normal, float planeDistance,
+ float *vertices)
+{
+ const float a0 = -w / 2.0f;
+ const float b0 = -h / 2.0f;
+ const float da = w / (resolution.width() - 1);
+ const float db = h / (resolution.height() - 1);
+ const float du = 1.0 / (resolution.width() - 1);
+ const float dv = 1.0 / (resolution.height() - 1);
+ float n = 1.0f;
+
+ switch (normal) {
+ case NegativeX:
+ n = -1.0f; // fall through
+ case PositiveX: {
+ // Iterate over z
+ for (int j = 0; j < resolution.height(); ++j) {
+ const float b = b0 + static_cast<float>(j) * db;
+ const float v = static_cast<float>(j) * dv;
+
+ // Iterate over y
+ for (int i = 0; i < resolution.width(); ++i) {
+ const float a = a0 + static_cast<float>(i) * da;
+ const float u = static_cast<float>(i) * du;
+
+ // position
+ *vertices++ = planeDistance;
+ *vertices++ = a;
+ *vertices++ = b;
+
+ // texture coordinates
+ *vertices++ = u;
+ *vertices++ = v;
+
+ // normal
+ *vertices++ = n;
+ *vertices++ = 0.0f;
+ *vertices++ = 0.0f;
+
+ // tangent
+ *vertices++ = 0.0f;
+ *vertices++ = 0.0f;
+ *vertices++ = 1.0f;
+ *vertices++ = 1.0f;
+ }
+ }
+ break;
+ }
+
+ case NegativeY:
+ n = -1.0f;
+ case PositiveY: {
+ // Iterate over z
+ for (int j = 0; j < resolution.height(); ++j) {
+ const float b = b0 + static_cast<float>(j) * db;
+ const float v = static_cast<float>(j) * dv;
+
+ // Iterate over x
+ // This iterates in the opposite sense to the other directions
+ // so that the winding order is correct
+ for (int i = resolution.width() - 1; i >= 0; --i) {
+ const float a = a0 + static_cast<float>(i) * da;
+ const float u = static_cast<float>(i) * du;
+
+ // position
+ *vertices++ = a;
+ *vertices++ = planeDistance;
+ *vertices++ = b;
+
+ // texture coordinates
+ *vertices++ = u;
+ *vertices++ = v;
+
+ // normal
+ *vertices++ = 0.0f;
+ *vertices++ = n;
+ *vertices++ = 0.0f;
+
+ // tangent
+ *vertices++ = 1.0f;
+ *vertices++ = 0.0f;
+ *vertices++ = 0.0f;
+ *vertices++ = 1.0f;
+ }
+ }
+ break;
+ }
+
+ case NegativeZ:
+ n = -1.0f;
+ case PositiveZ: {
+ // Iterate over y
+ for (int j = 0; j < resolution.height(); ++j) {
+ const float b = b0 + static_cast<float>(j) * db;
+ const float v = static_cast<float>(j) * dv;
+
+ // Iterate over x
+ for (int i = 0; i < resolution.width(); ++i) {
+ const float a = a0 + static_cast<float>(i) * da;
+ const float u = static_cast<float>(i) * du;
+
+ // position
+ *vertices++ = a;
+ *vertices++ = b;
+ *vertices++ = planeDistance;
+
+ // texture coordinates
+ *vertices++ = u;
+ *vertices++ = v;
+
+ // normal
+ *vertices++ = 0.0f;
+ *vertices++ = 0.0f;
+ *vertices++ = n;
+
+ // tangent
+ *vertices++ = 1.0f;
+ *vertices++ = 0.0f;
+ *vertices++ = 0.0f;
+ *vertices++ = 1.0f;
+ }
+ }
+ break;
+ }
+ } // switch (normal)
+}
+
+void createPlaneIndexData(PlaneNormal normal, const QSize &resolution, quint16 *indices, quint16 &baseVertex)
+{
+ float n = 1.0f;
+
+ switch (normal) {
+ case NegativeX:
+ case NegativeY:
+ case NegativeZ:
+ n = -1.0f;
+ break;
+ default:
+ break;
+ }
+
+ // Populate indices taking care to get correct CCW winding on all faces
+ if (n > 0.0f) {
+ for (int j = 0; j < resolution.height() - 1; ++j) {
+ const int rowStartIndex = j * resolution.width() + baseVertex;
+ const int nextRowStartIndex = (j + 1) * resolution.width() + baseVertex;
+
+ // Iterate over x
+ for (int i = 0; i < resolution.width() - 1; ++i) {
+ // Split quad into two triangles
+ *indices++ = rowStartIndex + i;
+ *indices++ = rowStartIndex + i + 1;
+ *indices++ = nextRowStartIndex + i;
+
+ *indices++ = nextRowStartIndex + i;
+ *indices++ = rowStartIndex + i + 1;
+ *indices++ = nextRowStartIndex + i + 1;
+ }
+ }
+ } else {
+ for (int j = 0; j < resolution.height() - 1; ++j) {
+ const int rowStartIndex = j * resolution.width() + baseVertex;
+ const int nextRowStartIndex = (j + 1) * resolution.width() + baseVertex;
+
+ // Iterate over x
+ for (int i = 0; i < resolution.width() - 1; ++i) {
+ // Split quad into two triangles
+ *indices++ = rowStartIndex + i;
+ *indices++ = nextRowStartIndex + i;
+ *indices++ = rowStartIndex + i + 1;
+
+ *indices++ = nextRowStartIndex + i;
+ *indices++ = nextRowStartIndex + i + 1;
+ *indices++ = rowStartIndex + i + 1;
+ }
+ }
+ }
+ baseVertex += resolution.width() * resolution.height();
+}
+
+QByteArray createCuboidVertexData(float xExtent,
+ float yExtent,
+ float zExtent,
+ const QSize &yzResolution,
+ const QSize &xzResolution,
+ const QSize &xyResolution)
+{
+ Q_ASSERT(xExtent > 0.0f && yExtent > 0.0f && zExtent > 0.0);
+ Q_ASSERT(yzResolution.width() >= 2 && yzResolution.height() >=2);
+ Q_ASSERT(xzResolution.width() >= 2 && xzResolution.height() >=2);
+ Q_ASSERT(xyResolution.width() >= 2 && xyResolution.height() >=2);
+
+ const int yzVerts = yzResolution.width() * yzResolution.height();
+ const int xzVerts = xzResolution.width() * xzResolution.height();
+ const int xyVerts = xyResolution.width() * xyResolution.height();
+ const int nVerts = 2 * (yzVerts + xzVerts + xyVerts);
+
+ const quint32 elementSize = 3 + 3 + 2 + 4;
+ const quint32 stride = elementSize * sizeof(float);
+ QByteArray vertexBytes;
+ vertexBytes.resize(stride * nVerts);
+ float* vertices = reinterpret_cast<float*>(vertexBytes.data());
+
+ createPlaneVertexData(yExtent, zExtent, yzResolution, PositiveX, xExtent * 0.5f, vertices);
+ vertices += yzVerts * elementSize;
+ createPlaneVertexData(yExtent, zExtent, yzResolution, NegativeX, -xExtent * 0.5f, vertices);
+ vertices += yzVerts * elementSize;
+ createPlaneVertexData(xExtent, zExtent, xzResolution, PositiveY, yExtent * 0.5f, vertices);
+ vertices += xzVerts * elementSize;
+ createPlaneVertexData(xExtent, zExtent, xzResolution, NegativeY, -yExtent * 0.5f, vertices);
+ vertices += xzVerts * elementSize;
+ createPlaneVertexData(xExtent, yExtent, xyResolution, PositiveZ, zExtent * 0.5f, vertices);
+ vertices += xyVerts * elementSize;
+ createPlaneVertexData(xExtent, yExtent, xyResolution, NegativeZ, -zExtent * 0.5f, vertices);
+
+ return vertexBytes;
+}
+
+QByteArray createCuboidIndexData(const QSize &yzResolution,
+ const QSize &xzResolution,
+ const QSize &xyResolution)
+{
+ Q_ASSERT(yzResolution.width() >= 2 && yzResolution.height() >= 2);
+ Q_ASSERT(xzResolution.width() >= 2 && xzResolution.height() >= 2);
+ Q_ASSERT(xyResolution.width() >= 2 && xyResolution.height() >= 2);
+
+ const int yzIndices = 2 * 3 * (yzResolution.width() - 1) * (yzResolution.height() - 1);
+ const int xzIndices = 2 * 3 * (xzResolution.width() - 1) * (xzResolution.height() - 1);
+ const int xyIndices = 2 * 3 * (xyResolution.width() - 1) * (xyResolution.height() - 1);
+ const int indexCount = 2 * (yzIndices + xzIndices + xyIndices);
+
+ QByteArray indexData;
+ indexData.resize(indexCount * sizeof(quint16));
+ quint16 *indices = reinterpret_cast<quint16 *>(indexData.data());
+ quint16 baseIndex = 0;
+
+ createPlaneIndexData(PositiveX, yzResolution, indices, baseIndex);
+ indices += yzIndices;
+ createPlaneIndexData(NegativeX, yzResolution, indices, baseIndex);
+ indices += yzIndices;
+ createPlaneIndexData(PositiveY, xzResolution, indices, baseIndex);
+ indices += xzIndices;
+ createPlaneIndexData(NegativeY, xzResolution, indices, baseIndex);
+ indices += xzIndices;
+ createPlaneIndexData(PositiveZ, xyResolution, indices, baseIndex);
+ indices += xyIndices;
+ createPlaneIndexData(NegativeZ, xyResolution, indices, baseIndex);
+
+ return indexData;
+}
+
+} // anonymous
+
+class CuboidVertexBufferFunctor : public QBufferDataGenerator
+{
+public:
+ explicit CuboidVertexBufferFunctor(float xExtent,
+ float yExtent,
+ float zExtent,
+ const QSize &yzResolution,
+ const QSize &xzResolution,
+ const QSize &xyResolution)
+ : m_xExtent(xExtent)
+ , m_yExtent(yExtent)
+ , m_zExtent(zExtent)
+ , m_yzFaceResolution(yzResolution)
+ , m_xzFaceResolution(xzResolution)
+ , m_xyFaceResolution(xyResolution)
+ {}
+
+ ~CuboidVertexBufferFunctor() {}
+
+ QByteArray operator()() Q_DECL_FINAL
+ {
+ return createCuboidVertexData(m_xExtent, m_yExtent, m_zExtent,
+ m_yzFaceResolution, m_xzFaceResolution, m_xyFaceResolution);
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_FINAL
+ {
+ const CuboidVertexBufferFunctor *otherFunctor = functor_cast<CuboidVertexBufferFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_xExtent == m_xExtent &&
+ otherFunctor->m_yExtent == m_yExtent &&
+ otherFunctor->m_zExtent == m_zExtent &&
+ otherFunctor->m_yzFaceResolution == m_yzFaceResolution &&
+ otherFunctor->m_xzFaceResolution == m_xzFaceResolution &&
+ otherFunctor->m_xyFaceResolution == m_xyFaceResolution);
+ return false;
+ }
+
+ QT3D_FUNCTOR(CuboidVertexBufferFunctor)
+
+private:
+ float m_xExtent;
+ float m_yExtent;
+ float m_zExtent;
+ QSize m_yzFaceResolution;
+ QSize m_xzFaceResolution;
+ QSize m_xyFaceResolution;
+};
+
+class CuboidIndexBufferFunctor : public QBufferDataGenerator
+{
+public:
+ explicit CuboidIndexBufferFunctor(const QSize &yzResolution,
+ const QSize &xzResolution,
+ const QSize &xyResolution)
+ : m_yzFaceResolution(yzResolution)
+ , m_xzFaceResolution(xzResolution)
+ , m_xyFaceResolution(xyResolution)
+ {}
+
+ ~CuboidIndexBufferFunctor() {}
+
+ QByteArray operator()() Q_DECL_FINAL
+ {
+ return createCuboidIndexData(m_yzFaceResolution, m_xzFaceResolution, m_xyFaceResolution);
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_FINAL
+ {
+ const CuboidIndexBufferFunctor *otherFunctor = functor_cast<CuboidIndexBufferFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_yzFaceResolution == m_yzFaceResolution &&
+ otherFunctor->m_xzFaceResolution == m_xzFaceResolution &&
+ otherFunctor->m_xyFaceResolution == m_xyFaceResolution);
+ return false;
+ }
+
+ QT3D_FUNCTOR(CuboidIndexBufferFunctor)
+
+private:
+ QSize m_yzFaceResolution;
+ QSize m_xzFaceResolution;
+ QSize m_xyFaceResolution;
+};
+
+QCuboidGeometryPrivate::QCuboidGeometryPrivate()
+ : QGeometryPrivate()
+ , m_xExtent(1.0f)
+ , m_yExtent(1.0f)
+ , m_zExtent(1.0f)
+ , m_yzFaceResolution(2, 2)
+ , m_xzFaceResolution(2, 2)
+ , m_xyFaceResolution(2, 2)
+ , m_positionAttribute(nullptr)
+ , m_normalAttribute(nullptr)
+ , m_texCoordAttribute(nullptr)
+ , m_tangentAttribute(nullptr)
+ , m_indexAttribute(nullptr)
+ , m_vertexBuffer(nullptr)
+ , m_indexBuffer(nullptr)
+{
+}
+
+void QCuboidGeometryPrivate::init()
+{
+ Q_Q(QCuboidGeometry);
+ m_positionAttribute = new Qt3DRender::QAttribute(q);
+ m_normalAttribute = new Qt3DRender::QAttribute(q);
+ m_texCoordAttribute = new Qt3DRender::QAttribute(q);
+ m_tangentAttribute = new Qt3DRender::QAttribute(q);
+ m_indexAttribute = new Qt3DRender::QAttribute(q);
+ m_vertexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, q);
+ m_indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, q);
+
+ // vec3 pos vec2 tex vec3 normal vec4 tangent
+ const quint32 stride = (3 + 2 + 3 + 4) * sizeof(float);
+ const int yzIndices = 2 * 3 * (m_yzFaceResolution.width() - 1) * (m_yzFaceResolution.height() - 1);
+ const int xzIndices = 2 * 3 * (m_xzFaceResolution.width() - 1) * (m_xzFaceResolution.height() - 1);
+ const int xyIndices = 2 * 3 * (m_xyFaceResolution.width() - 1) * (m_xyFaceResolution.height() - 1);
+ const int yzVerts = m_yzFaceResolution.width() * m_yzFaceResolution.height();
+ const int xzVerts = m_xzFaceResolution.width() * m_xzFaceResolution.height();
+ const int xyVerts = m_xyFaceResolution.width() * m_xyFaceResolution.height();
+
+ const int nVerts = 2 * (yzVerts + xzVerts + xyVerts);
+ const int indexCount = 2 * (yzIndices + xzIndices + xyIndices);
+
+ m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
+ m_positionAttribute->setDataType(QAttribute::Float);
+ m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_positionAttribute->setBuffer(m_vertexBuffer);
+ m_positionAttribute->setByteStride(stride);
+ m_positionAttribute->setCount(nVerts);
+
+ m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
+ m_texCoordAttribute->setDataType(QAttribute::Float);
+ m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_texCoordAttribute->setBuffer(m_vertexBuffer);
+ m_texCoordAttribute->setByteStride(stride);
+ m_texCoordAttribute->setByteOffset(3 * sizeof(float));
+ m_texCoordAttribute->setCount(nVerts);
+
+ m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
+ m_normalAttribute->setDataType(QAttribute::Float);
+ m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_normalAttribute->setBuffer(m_vertexBuffer);
+ m_normalAttribute->setByteStride(stride);
+ m_normalAttribute->setByteOffset(5 * sizeof(float));
+ m_normalAttribute->setCount(nVerts);
+
+ m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
+ m_tangentAttribute->setDataType(QAttribute::Float);
+ m_tangentAttribute->setDataSize(4);
+ m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_tangentAttribute->setBuffer(m_vertexBuffer);
+ m_tangentAttribute->setByteStride(stride);
+ m_tangentAttribute->setByteOffset(8 * sizeof(float));
+ m_tangentAttribute->setCount(nVerts);
+
+ m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
+ m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setBuffer(m_indexBuffer);
+
+ m_indexAttribute->setCount(indexCount);
+
+ m_vertexBuffer->setDataGenerator(QSharedPointer<CuboidVertexBufferFunctor>::create(m_xExtent, m_yExtent, m_zExtent,
+ m_yzFaceResolution, m_xzFaceResolution, m_xyFaceResolution));
+ m_indexBuffer->setDataGenerator(QSharedPointer<CuboidIndexBufferFunctor>::create(m_yzFaceResolution, m_xzFaceResolution, m_xyFaceResolution));
+
+ q->addAttribute(m_positionAttribute);
+ q->addAttribute(m_texCoordAttribute);
+ q->addAttribute(m_normalAttribute);
+ q->addAttribute(m_tangentAttribute);
+ q->addAttribute(m_indexAttribute);
+}
+
+/*!
+ * \qmltype CuboidGeometry
+ * \instantiates Qt3DRender::QCuboidGeometry
+ * \inqmlmodule Qt3D.Render
+ */
+
+/*!
+ * \qmlproperty float CuboidGeometry::xExtent
+ *
+ * Holds the x extent.
+ */
+
+/*!
+ * \qmlproperty float CuboidGeometry::yExtent
+ *
+ * Holds the y extent.
+ */
+
+/*!
+ * \qmlproperty float CuboidGeometry::zExtent
+ *
+ * Holds the z extent.
+ */
+
+/*!
+ * \qmlproperty size CuboidGeometry::yzMeshResolution
+ *
+ * Holds the y-z resolution.
+ */
+
+/*!
+ * \qmlproperty size CuboidGeometry::xzMeshResolution
+ *
+ * Holds the x-z resolution.
+ */
+
+/*!
+ * \qmlproperty size CuboidGeometry::xyMeshResolution
+ *
+ * Holds the x-y resolution.
+ */
+
+/*!
+ * \qmlproperty Attribute CuboidGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute CuboidGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute CuboidGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute CuboidGeometry::tangentAttribute
+ *
+ * Holds the geometry tangent attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute CuboidGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+
+/*!
+ * \class Qt3DRender::QCuboidGeometry
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometry
+ *
+ */
+
+/*!
+ * Constructs a new QCuboidGeometry with \a parent.
+ */
+QCuboidGeometry::QCuboidGeometry(QNode *parent)
+ : QGeometry(*new QCuboidGeometryPrivate(), parent)
+{
+ Q_D(QCuboidGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QCuboidGeometry::QCuboidGeometry(QCuboidGeometryPrivate &dd, QNode *parent)
+ : QGeometry(dd, parent)
+{
+ Q_D(QCuboidGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QCuboidGeometry::~QCuboidGeometry()
+{
+}
+
+/*!
+ * Updates indices based on mesh resolutions.
+ */
+void QCuboidGeometry::updateIndices()
+{
+ Q_D(QCuboidGeometry);
+ const int yzIndices = 2 * 3 * (d->m_yzFaceResolution.width() - 1) * (d->m_yzFaceResolution.height() - 1);
+ const int xzIndices = 2 * 3 * (d->m_xzFaceResolution.width() - 1) * (d->m_xzFaceResolution.height() - 1);
+ const int xyIndices = 2 * 3 * (d->m_xyFaceResolution.width() - 1) * (d->m_xyFaceResolution.height() - 1);
+ const int indexCount = 2 * (yzIndices + xzIndices + xyIndices);
+
+ d->m_indexAttribute->setCount(indexCount);
+ d->m_indexBuffer->setDataGenerator(QSharedPointer<CuboidIndexBufferFunctor>::create(d->m_yzFaceResolution, d->m_xzFaceResolution, d->m_xyFaceResolution));
+
+}
+
+/*!
+ * Updates vertices based on mesh resolutions.
+ */
+void QCuboidGeometry::updateVertices()
+{
+ Q_D(QCuboidGeometry);
+ const int yzVerts = d->m_yzFaceResolution.width() * d->m_yzFaceResolution.height();
+ const int xzVerts = d->m_xzFaceResolution.width() * d->m_xzFaceResolution.height();
+ const int xyVerts = d->m_xyFaceResolution.width() * d->m_xyFaceResolution.height();
+ const int nVerts = 2 * (yzVerts + xzVerts + xyVerts);
+
+ d->m_positionAttribute->setCount(nVerts);
+ d->m_normalAttribute->setCount(nVerts);
+ d->m_texCoordAttribute->setCount(nVerts);
+ d->m_tangentAttribute->setCount(nVerts);
+
+ d->m_vertexBuffer->setDataGenerator(QSharedPointer<CuboidVertexBufferFunctor>::create(d->m_xExtent, d->m_yExtent, d->m_zExtent,
+ d->m_yzFaceResolution, d->m_xzFaceResolution, d->m_xyFaceResolution));
+}
+
+void QCuboidGeometry::setXExtent(float xExtent)
+{
+ Q_D(QCuboidGeometry);
+ if (d->m_xExtent != xExtent) {
+ d->m_xExtent = xExtent;
+ updateVertices();
+ emit xExtentChanged(xExtent);
+ }
+}
+
+void QCuboidGeometry::setYExtent(float yExtent)
+{
+ Q_D(QCuboidGeometry);
+ if (d->m_yExtent != yExtent) {
+ d->m_yExtent = yExtent;
+ updateVertices();
+ emit yExtentChanged(yExtent);
+ }
+}
+
+void QCuboidGeometry::setZExtent(float zExtent)
+{
+ Q_D(QCuboidGeometry);
+ if (d->m_zExtent != zExtent) {
+ d->m_zExtent = zExtent;
+ updateVertices();
+ emit zExtentChanged(zExtent);
+ }
+}
+
+void QCuboidGeometry::setYZMeshResolution(const QSize &resolution)
+{
+ Q_D(QCuboidGeometry);
+ if (d->m_yzFaceResolution != resolution) {
+ d->m_yzFaceResolution = resolution;
+ updateVertices();
+ updateIndices();
+ emit yzMeshResolutionChanged(resolution);
+ }
+}
+
+void QCuboidGeometry::setXZMeshResolution(const QSize &resolution)
+{
+ Q_D(QCuboidGeometry);
+ if (d->m_xzFaceResolution != resolution) {
+ d->m_xzFaceResolution = resolution;
+ updateVertices();
+ updateIndices();
+ emit xzMeshResolutionChanged(resolution);
+ }
+}
+
+void QCuboidGeometry::setXYMeshResolution(const QSize &resolution)
+{
+ Q_D(QCuboidGeometry);
+ if (d->m_xyFaceResolution != resolution) {
+ d->m_xyFaceResolution = resolution;
+ updateVertices();
+ updateIndices();
+ emit xyMeshResolutionChanged(resolution);
+ }
+}
+
+/*!
+ * \property QCuboidGeometry::xExtent
+ *
+ * Holds the x extent.
+ */
+float QCuboidGeometry::xExtent() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_xExtent;
+}
+
+/*!
+ * \property QCuboidGeometry::yExtent
+ *
+ * Holds the y extent.
+ */
+float QCuboidGeometry::yExtent() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_yExtent;
+}
+
+/*!
+ * \property QCuboidGeometry::zExtent
+ *
+ * Holds the z extent.
+ */
+float QCuboidGeometry::zExtent() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_zExtent;
+}
+
+/*!
+ * \property QCuboidGeometry::yzMeshResolution
+ *
+ * Holds the y-z resolution.
+ */
+QSize QCuboidGeometry::yzMeshResolution() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_yzFaceResolution;
+}
+
+/*!
+ * \property QCuboidGeometry::xzMeshResolution
+ *
+ * Holds the x-z resolution.
+ */
+QSize QCuboidGeometry::xyMeshResolution() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_xyFaceResolution;
+}
+
+/*!
+ * \property QCuboidGeometry::xyMeshResolution
+ *
+ * Holds the x-y resolution.
+ */
+QSize QCuboidGeometry::xzMeshResolution() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_xzFaceResolution;
+}
+
+/*!
+ * \property QCuboidGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+QAttribute *QCuboidGeometry::positionAttribute() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_positionAttribute;
+}
+
+/*!
+ * \property QCuboidGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+QAttribute *QCuboidGeometry::normalAttribute() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_normalAttribute;
+}
+
+/*!
+ * \property QCuboidGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+QAttribute *QCuboidGeometry::texCoordAttribute() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_texCoordAttribute;
+}
+
+/*!
+ * \property QCuboidGeometry::tangentAttribute
+ *
+ * Holds the geometry tangent attribute.
+ */
+QAttribute *QCuboidGeometry::tangentAttribute() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_tangentAttribute;
+}
+
+/*!
+ * \property QCuboidGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+QAttribute *QCuboidGeometry::indexAttribute() const
+{
+ Q_D(const QCuboidGeometry);
+ return d->m_indexAttribute;
+}
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qcuboidgeometry.h b/src/extras/geometries/qcuboidgeometry.h
new file mode 100644
index 000000000..fad5dcf9f
--- /dev/null
+++ b/src/extras/geometries/qcuboidgeometry.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QCUBOIDGEOMETRY_H
+#define QT3DEXTRAS_QCUBOIDGEOMETRY_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometry.h>
+#include <QSize>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+
+} // Qt3DRender
+
+namespace Qt3DExtras {
+
+class QCuboidGeometryPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QCuboidGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+ Q_PROPERTY(float xExtent READ xExtent WRITE setXExtent NOTIFY xExtentChanged)
+ Q_PROPERTY(float yExtent READ yExtent WRITE setYExtent NOTIFY yExtentChanged)
+ Q_PROPERTY(float zExtent READ zExtent WRITE setZExtent NOTIFY zExtentChanged)
+ Q_PROPERTY(QSize xyMeshResolution READ xyMeshResolution WRITE setXYMeshResolution NOTIFY xyMeshResolutionChanged)
+ Q_PROPERTY(QSize yzMeshResolution READ yzMeshResolution WRITE setYZMeshResolution NOTIFY yzMeshResolutionChanged)
+ Q_PROPERTY(QSize xzMeshResolution READ xzMeshResolution WRITE setXZMeshResolution NOTIFY xzMeshResolutionChanged)
+ Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *tangentAttribute READ tangentAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
+
+public:
+ explicit QCuboidGeometry(QNode *parent = nullptr);
+ ~QCuboidGeometry();
+
+ void updateIndices();
+ void updateVertices();
+
+ float xExtent() const;
+ float yExtent() const;
+ float zExtent() const;
+ QSize yzMeshResolution() const;
+ QSize xyMeshResolution() const;
+ QSize xzMeshResolution() const;
+
+ Qt3DRender::QAttribute *positionAttribute() const;
+ Qt3DRender::QAttribute *normalAttribute() const;
+ Qt3DRender::QAttribute *texCoordAttribute() const;
+ Qt3DRender::QAttribute *tangentAttribute() const;
+ Qt3DRender::QAttribute *indexAttribute() const;
+
+public Q_SLOTS:
+ void setXExtent(float xExtent);
+ void setYExtent(float yExtent);
+ void setZExtent(float zExtent);
+ void setYZMeshResolution(const QSize &resolution);
+ void setXZMeshResolution(const QSize &resolution);
+ void setXYMeshResolution(const QSize &resolution);
+
+Q_SIGNALS:
+ void xExtentChanged(float xExtent);
+ void yExtentChanged(float yExtent);
+ void zExtentChanged(float zExtent);
+
+ void yzMeshResolutionChanged(const QSize &yzMeshResolution);
+ void xzMeshResolutionChanged(const QSize &xzMeshResolution);
+ void xyMeshResolutionChanged(const QSize &xyMeshResolution);
+
+protected:
+ QCuboidGeometry(QCuboidGeometryPrivate &dd, QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QCuboidGeometry)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QCUBOIDGEOMETRY_H
diff --git a/src/extras/geometries/qcuboidgeometry_p.h b/src/extras/geometries/qcuboidgeometry_p.h
new file mode 100644
index 000000000..212be19b4
--- /dev/null
+++ b/src/extras/geometries/qcuboidgeometry_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QCUBOIDGEOMETRY_P_H
+#define QT3DEXTRAS_QCUBOIDGEOMETRY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qgeometry_p.h>
+#include <QSize>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+class QBuffer;
+
+} // Qt3DRender
+
+namespace Qt3DExtras {
+
+class QCuboidGeometryPrivate : public Qt3DRender::QGeometryPrivate
+{
+public:
+ QCuboidGeometryPrivate();
+ void init();
+
+ // Dimensions
+ float m_xExtent;
+ float m_yExtent;
+ float m_zExtent;
+
+ // Resolutions of faces with normal x, y, and z
+ QSize m_yzFaceResolution;
+ QSize m_xzFaceResolution;
+ QSize m_xyFaceResolution;
+
+ Qt3DRender::QAttribute *m_positionAttribute;
+ Qt3DRender::QAttribute *m_normalAttribute;
+ Qt3DRender::QAttribute *m_texCoordAttribute;
+ Qt3DRender::QAttribute *m_tangentAttribute;
+ Qt3DRender::QAttribute *m_indexAttribute;
+ Qt3DRender::QBuffer *m_vertexBuffer;
+ Qt3DRender::QBuffer *m_indexBuffer;
+
+ Q_DECLARE_PUBLIC(QCuboidGeometry)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QCUBOIDGEOMETRY_P_H
+
diff --git a/src/extras/geometries/qcuboidmesh.cpp b/src/extras/geometries/qcuboidmesh.cpp
new file mode 100644
index 000000000..004fca472
--- /dev/null
+++ b/src/extras/geometries/qcuboidmesh.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcuboidmesh.h"
+#include "qcuboidgeometry.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+/*!
+ * \qmltype QCuboidMesh
+ * \instantiates Qt3DRender::QCuboidMesh
+ * \inqmlmodule Qt3D.Render
+ * \brief A cube mesh.
+ */
+
+/*!
+ * \qmlproperty float CuboidMesh::xExtent
+ *
+ * Holds the x extent.
+ */
+
+/*!
+ * \qmlproperty float CuboidMesh::yExtent
+ *
+ * Holds the y extent.
+ */
+
+/*!
+ * \qmlproperty float CuboidMesh::zExtent
+ *
+ * Holds the z extent.
+ */
+
+/*!
+ * \qmlproperty size CuboidMesh::yzMeshResolution
+ *
+ * Holds the y-z resolution.
+ */
+
+/*!
+ * \qmlproperty size CuboidMesh::xzMeshResolution
+ *
+ * Holds the x-z resolution.
+ */
+
+/*!
+ * \qmlproperty size CuboidMesh::xyMeshResolution
+ *
+ * Holds the x-y resolution.
+ */
+
+/*!
+ * \class Qt3DRender::QCuboidMesh
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometryRenderer
+ *
+ * \brief A cube mesh.
+ */
+
+/*!
+ * Constructs a new QCuboidMedh with \a parent.
+ */
+QCuboidMesh::QCuboidMesh(QNode *parent)
+ : QGeometryRenderer(parent)
+{
+ QCuboidGeometry *geometry = new QCuboidGeometry(this);
+ QObject::connect(geometry, &QCuboidGeometry::xExtentChanged, this, &QCuboidMesh::xExtentChanged);
+ QObject::connect(geometry, &QCuboidGeometry::yExtentChanged, this, &QCuboidMesh::yExtentChanged);
+ QObject::connect(geometry, &QCuboidGeometry::zExtentChanged, this, &QCuboidMesh::zExtentChanged);
+ QObject::connect(geometry, &QCuboidGeometry::xyMeshResolutionChanged, this, &QCuboidMesh::xyMeshResolutionChanged);
+ QObject::connect(geometry, &QCuboidGeometry::xzMeshResolutionChanged, this, &QCuboidMesh::xzMeshResolutionChanged);
+ QObject::connect(geometry, &QCuboidGeometry::yzMeshResolutionChanged, this, &QCuboidMesh::yzMeshResolutionChanged);
+ QGeometryRenderer::setGeometry(geometry);
+}
+
+/*! \internal */
+QCuboidMesh::~QCuboidMesh()
+{
+}
+
+void QCuboidMesh::setXExtent(float xExtent)
+{
+ static_cast<QCuboidGeometry *>(geometry())->setXExtent(xExtent);
+}
+
+/*!
+ * \property QCuboidMesh::xExtent
+ *
+ * Holds the x extent.
+ */
+float QCuboidMesh::xExtent() const
+{
+ return static_cast<QCuboidGeometry *>(geometry())->xExtent();
+}
+
+void QCuboidMesh::setYExtent(float yExtent)
+{
+ static_cast<QCuboidGeometry *>(geometry())->setYExtent(yExtent);
+}
+
+/*!
+ * \property QCuboidMesh::yExtent
+ *
+ * Holds the y extent.
+ */
+float QCuboidMesh::yExtent() const
+{
+ return static_cast<QCuboidGeometry *>(geometry())->yExtent();
+}
+
+void QCuboidMesh::setZExtent(float zExtent)
+{
+ static_cast<QCuboidGeometry *>(geometry())->setZExtent(zExtent);
+}
+
+/*!
+ * \property QCuboidMesh::zExtent
+ *
+ * Holds the z extent.
+ */
+float QCuboidMesh::zExtent() const
+{
+ return static_cast<QCuboidGeometry *>(geometry())->zExtent();
+}
+
+void QCuboidMesh::setYZMeshResolution(const QSize &resolution)
+{
+ static_cast<QCuboidGeometry *>(geometry())->setYZMeshResolution(resolution);
+}
+
+/*!
+ * \property QCuboidMesh::yzMeshResolution
+ *
+ * Holds the y-z resolution.
+ */
+QSize QCuboidMesh::yzMeshResolution() const
+{
+ return static_cast<QCuboidGeometry *>(geometry())->yzMeshResolution();
+}
+
+void QCuboidMesh::setXZMeshResolution(const QSize &resolution)
+{
+ static_cast<QCuboidGeometry *>(geometry())->setXZMeshResolution(resolution);
+}
+
+/*!
+ * \property QCuboidMesh::xzMeshResolution
+ *
+ * Holds the x-z resolution.
+ */
+QSize QCuboidMesh::xzMeshResolution() const
+{
+ return static_cast<QCuboidGeometry *>(geometry())->xzMeshResolution();
+}
+
+void QCuboidMesh::setXYMeshResolution(const QSize &resolution)
+{
+ static_cast<QCuboidGeometry *>(geometry())->setXYMeshResolution(resolution);
+}
+
+/*!
+ * \property QCuboidMesh::xyMeshResolution
+ *
+ * Holds the x-y resolution.
+ */
+QSize QCuboidMesh::xyMeshResolution() const
+{
+ return static_cast<QCuboidGeometry *>(geometry())->xyMeshResolution();
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qcuboidmesh.h b/src/extras/geometries/qcuboidmesh.h
new file mode 100644
index 000000000..f709703c5
--- /dev/null
+++ b/src/extras/geometries/qcuboidmesh.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_CUBOIDMESH_H
+#define QT3DEXTRAS_CUBOIDMESH_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometryrenderer.h>
+#include <QSize>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QT3DEXTRASSHARED_EXPORT QCuboidMesh : public Qt3DRender::QGeometryRenderer
+{
+ Q_OBJECT
+
+ Q_PROPERTY(float xExtent READ xExtent WRITE setXExtent NOTIFY xExtentChanged)
+ Q_PROPERTY(float yExtent READ yExtent WRITE setYExtent NOTIFY yExtentChanged)
+ Q_PROPERTY(float zExtent READ zExtent WRITE setZExtent NOTIFY zExtentChanged)
+ Q_PROPERTY(QSize yzMeshResolution READ yzMeshResolution WRITE setYZMeshResolution NOTIFY yzMeshResolutionChanged)
+ Q_PROPERTY(QSize xzMeshResolution READ xzMeshResolution WRITE setXZMeshResolution NOTIFY xzMeshResolutionChanged)
+ Q_PROPERTY(QSize xyMeshResolution READ xyMeshResolution WRITE setXYMeshResolution NOTIFY xyMeshResolutionChanged)
+
+public:
+ explicit QCuboidMesh(Qt3DCore::QNode *parent = nullptr);
+ ~QCuboidMesh();
+
+ float xExtent() const;
+ float yExtent() const;
+ float zExtent() const;
+ QSize yzMeshResolution() const;
+ QSize xzMeshResolution() const;
+ QSize xyMeshResolution() const;
+
+public Q_SLOTS:
+ void setXExtent(float xExtent);
+ void setYExtent(float yExtent);
+ void setZExtent(float zExtent);
+ void setYZMeshResolution(const QSize &resolution);
+ void setXZMeshResolution(const QSize &resolution);
+ void setXYMeshResolution(const QSize &resolution);
+
+Q_SIGNALS:
+ void xExtentChanged(float xExtent);
+ void yExtentChanged(float yExtent);
+ void zExtentChanged(float zExtent);
+
+ void yzMeshResolutionChanged(const QSize &yzMeshResolution);
+ void xzMeshResolutionChanged(const QSize &xzMeshResolution);
+ void xyMeshResolutionChanged(const QSize &xyMeshResolution);
+
+private:
+ // As this is a default provided geometry renderer, no one should be able
+ // to modify the QGeometryRenderer's properties
+
+ void setInstanceCount(int instanceCount);
+ void setVertexCount(int vertexCount);
+ void setIndexOffset(int indexOffset);
+ void setFirstInstance(int firstInstance);
+ void setRestartIndexValue(int index);
+ void setPrimitiveRestartEnabled(bool enabled);
+ void setGeometry(Qt3DRender::QGeometry *geometry);
+ void setPrimitiveType(PrimitiveType primitiveType);
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_CUBOIDMESH_H
diff --git a/src/extras/geometries/qcylindergeometry.cpp b/src/extras/geometries/qcylindergeometry.cpp
new file mode 100644
index 000000000..2cbe1939c
--- /dev/null
+++ b/src/extras/geometries/qcylindergeometry.cpp
@@ -0,0 +1,585 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _USE_MATH_DEFINES
+# define _USE_MATH_DEFINES // For MSVC
+#endif
+
+#include "qcylindergeometry.h"
+#include "qcylindergeometry_p.h"
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/qattribute.h>
+#include <qmath.h>
+#include <QVector3D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+namespace {
+
+void createSidesVertices(float *&verticesPtr,
+ int rings,
+ int slices,
+ double radius,
+ double length)
+{
+ const float dY = length / static_cast<float>(rings - 1);
+ const float dTheta = (M_PI * 2) / static_cast<float>(slices);
+
+ for (int ring = 0; ring < rings; ++ring) {
+ const float y = -length / 2.0f + static_cast<float>(ring) * dY;
+
+ for (int slice = 0; slice <= slices; ++slice) {
+ const float theta = static_cast<float>(slice) * dTheta;
+ const float ct = qCos(theta);
+ const float st = qSin(theta);
+
+ *verticesPtr++ = radius * ct;
+ *verticesPtr++ = y;
+ *verticesPtr++ = radius * st;
+
+ *verticesPtr++ = (y + length / 2.0) / length;
+ *verticesPtr++ = theta / (M_PI * 2);
+
+ QVector3D n(ct, 0.0f, st);
+ n.normalize();
+ *verticesPtr++ = n.x();
+ *verticesPtr++ = n.y();
+ *verticesPtr++ = n.z();
+ }
+ }
+}
+
+void createSidesIndices(quint16 *&indicesPtr, int rings, int slices)
+{
+ for (int ring = 0; ring < rings - 1; ++ring) {
+ const int ringIndexStart = ring * (slices + 1);
+ const int nextRingIndexStart = (ring + 1) * (slices + 1);
+
+ for (int slice = 0; slice < slices; ++slice) {
+ const int nextSlice = slice + 1;
+
+ *indicesPtr++ = (ringIndexStart + slice);
+ *indicesPtr++ = (nextRingIndexStart + slice);
+ *indicesPtr++ = (ringIndexStart + nextSlice);
+ *indicesPtr++ = (ringIndexStart + nextSlice);
+ *indicesPtr++ = (nextRingIndexStart + slice);
+ *indicesPtr++ = (nextRingIndexStart + nextSlice);
+ }
+ }
+}
+
+void createDiscVertices(float *&verticesPtr,
+ int slices,
+ double radius,
+ double yPosition)
+{
+ const float dTheta = (M_PI * 2) / static_cast<float>(slices);
+ const double yNormal = (yPosition < 0.0f) ? -1.0f : 1.0f;
+
+ *verticesPtr++ = 0.0f;
+ *verticesPtr++ = yPosition;
+ *verticesPtr++ = 0.0f;
+
+ *verticesPtr++ = 1.0f;
+ *verticesPtr++ = 0.0f;
+
+ *verticesPtr++ = 0.0f;
+ *verticesPtr++ = yNormal;
+ *verticesPtr++ = 0.0f;
+
+ for (int slice = 0; slice <= slices; ++slice) {
+ const float theta = static_cast<float>(slice) * dTheta;
+ const float ct = qCos(theta);
+ const float st = qSin(theta);
+
+ *verticesPtr++ = radius * ct;
+ *verticesPtr++ = yPosition;
+ *verticesPtr++ = radius * st;
+
+ *verticesPtr++ = 1.0f;
+ *verticesPtr++ = theta / (M_PI * 2);
+
+ *verticesPtr++ = 0.0f;
+ *verticesPtr++ = yNormal;
+ *verticesPtr++ = 0.0f;
+ }
+}
+
+void createDiscIndices(quint16 *&indicesPtr,
+ int discCenterIndex,
+ int slices,
+ double yPosition)
+{
+ const double yNormal = (yPosition < 0.0f) ? -1.0f : 1.0f;
+
+ for (int slice = 0; slice < slices; ++slice) {
+ const int nextSlice = slice + 1;
+
+ *indicesPtr++ = discCenterIndex;
+ *indicesPtr++ = (discCenterIndex + 1 + nextSlice);
+ *indicesPtr++ = (discCenterIndex + 1 + slice);
+
+ if (yNormal < 0.0f)
+ qSwap(*(indicesPtr -1), *(indicesPtr - 2));
+ }
+}
+
+} // anonymous
+
+
+class CylinderVertexDataFunctor : public QBufferDataGenerator
+{
+public:
+ CylinderVertexDataFunctor(int rings, int slices, float radius, float length)
+ : m_rings(rings)
+ , m_slices(slices)
+ , m_radius(radius)
+ , m_length(length)
+ {}
+
+ QByteArray operator ()() Q_DECL_OVERRIDE
+ {
+ const int verticesCount = (m_slices + 1) * m_rings + 2 * (m_slices + 1) + 2;
+ // vec3 pos, vec2 texCoord, vec3 normal
+ const quint32 vertexSize = (3 + 2 + 3) * sizeof(float);
+
+ QByteArray verticesData;
+ verticesData.resize(vertexSize * verticesCount);
+ float *verticesPtr = reinterpret_cast<float*>(verticesData.data());
+
+ createSidesVertices(verticesPtr, m_rings, m_slices, m_radius, m_length);
+ createDiscVertices(verticesPtr, m_slices, m_radius, -m_length * 0.5f);
+ createDiscVertices(verticesPtr, m_slices, m_radius, m_length * 0.5f);
+
+ return verticesData;
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
+ {
+ const CylinderVertexDataFunctor *otherFunctor = functor_cast<CylinderVertexDataFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_rings == m_rings &&
+ otherFunctor->m_slices == m_slices &&
+ otherFunctor->m_radius == m_radius &&
+ otherFunctor->m_length == m_length);
+ return false;
+ }
+
+ QT3D_FUNCTOR(CylinderVertexDataFunctor)
+
+private:
+ int m_rings;
+ int m_slices;
+ float m_radius;
+ float m_length;
+};
+
+class CylinderIndexDataFunctor : public QBufferDataGenerator
+{
+public:
+ CylinderIndexDataFunctor(int rings, int slices, float length)
+ : m_rings(rings)
+ , m_slices(slices)
+ , m_length(length)
+ {
+ }
+
+ QByteArray operator ()() Q_DECL_OVERRIDE
+ {
+ const int facesCount = (m_slices * 2) * (m_rings - 1) // two tris per side, for each pair of adjacent rings
+ + m_slices * 2; // two caps
+ const int indicesCount = facesCount * 3;
+ const int indexSize = sizeof(quint16);
+ Q_ASSERT(indicesCount < 65536);
+
+ QByteArray indicesBytes;
+ indicesBytes.resize(indicesCount * indexSize);
+ quint16 *indicesPtr = reinterpret_cast<quint16*>(indicesBytes.data());
+
+ createSidesIndices(indicesPtr, m_rings, m_slices);
+ createDiscIndices(indicesPtr, m_rings * (m_slices + 1), m_slices, -m_length * 0.5);
+ createDiscIndices(indicesPtr, m_rings * (m_slices + 1) + m_slices + 2, m_slices, m_length * 0.5);
+ Q_ASSERT(indicesPtr == (reinterpret_cast<quint16*>(indicesBytes.data()) + indicesCount));
+
+ return indicesBytes;
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
+ {
+ const CylinderIndexDataFunctor *otherFunctor = functor_cast<CylinderIndexDataFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_rings == m_rings &&
+ otherFunctor->m_slices == m_slices &&
+ otherFunctor->m_length == m_length);
+ return false;
+ }
+
+ QT3D_FUNCTOR(CylinderIndexDataFunctor)
+
+private:
+ int m_rings;
+ int m_slices;
+ float m_length;
+};
+
+
+QCylinderGeometryPrivate::QCylinderGeometryPrivate()
+ : QGeometryPrivate()
+ , m_rings(16)
+ , m_slices(16)
+ , m_radius(1.0f)
+ , m_length(1.0f)
+ , m_positionAttribute(nullptr)
+ , m_normalAttribute(nullptr)
+ , m_texCoordAttribute(nullptr)
+ , m_indexAttribute(nullptr)
+ , m_vertexBuffer(nullptr)
+ , m_indexBuffer(nullptr)
+{
+}
+
+void QCylinderGeometryPrivate::init()
+{
+ Q_Q(QCylinderGeometry);
+ m_positionAttribute = new QAttribute(q);
+ m_normalAttribute = new QAttribute(q);
+ m_texCoordAttribute = new QAttribute(q);
+ m_indexAttribute = new QAttribute(q);
+ m_vertexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, q);
+ m_indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, q);
+
+ // vec3 pos, vec2 tex, vec3 normal
+ const quint32 elementSize = 3 + 2 + 3;
+ const quint32 stride = elementSize * sizeof(float);
+ const int nVerts = (m_slices + 1) * m_rings + 2 * (m_slices + 1) + 2;
+ const int faces = (m_slices * 2) * (m_rings - 1) + (m_slices * 2);
+
+ m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
+ m_positionAttribute->setDataType(QAttribute::Float);
+ m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_positionAttribute->setBuffer(m_vertexBuffer);
+ m_positionAttribute->setByteStride(stride);
+ m_positionAttribute->setCount(nVerts);
+
+ m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
+ m_texCoordAttribute->setDataType(QAttribute::Float);
+ m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_texCoordAttribute->setBuffer(m_vertexBuffer);
+ m_texCoordAttribute->setByteStride(stride);
+ m_texCoordAttribute->setByteOffset(3 * sizeof(float));
+ m_texCoordAttribute->setCount(nVerts);
+
+ m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
+ m_normalAttribute->setDataType(QAttribute::Float);
+ m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_normalAttribute->setBuffer(m_vertexBuffer);
+ m_normalAttribute->setByteStride(stride);
+ m_normalAttribute->setByteOffset(5 * sizeof(float));
+ m_normalAttribute->setCount(nVerts);
+
+ m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
+ m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setBuffer(m_indexBuffer);
+
+ m_indexAttribute->setCount(faces * 3);
+
+ m_vertexBuffer->setDataGenerator(QSharedPointer<CylinderVertexDataFunctor>::create(m_rings, m_slices, m_radius, m_length));
+ m_indexBuffer->setDataGenerator(QSharedPointer<CylinderIndexDataFunctor>::create(m_rings, m_slices, m_length));
+
+ q->addAttribute(m_positionAttribute);
+ q->addAttribute(m_texCoordAttribute);
+ q->addAttribute(m_normalAttribute);
+ q->addAttribute(m_indexAttribute);
+}
+
+/*!
+ * \qmltype CylinderGeometry
+ * \instantiates Qt3DRender::QCylinderGeometry
+ * \inqmlmodule Qt3D.Render
+ */
+
+/*!
+ * \qmlproperty int CylinderGeometry::rings
+ *
+ * Holds the number of rings in the cylinder.
+ */
+
+/*!
+ * \qmlproperty int CylinderGeometry::slices
+ *
+ * Holds the number of slices in the cylinder.
+ */
+
+/*!
+ * \qmlproperty float CylinderGeometry::radius
+ *
+ * Holds the radius of the cylinder.
+ */
+
+/*!
+ * \qmlproperty float CylinderGeometry::length
+ *
+ * Holds the length of the cylinder.
+ */
+
+/*!
+ * \qmlproperty Attribute CylinderGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute CylinderGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute CylinderGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute CylinderGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+
+/*!
+ * \class Qt3DRender::QCylinderGeometry
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometry
+ */
+
+/*!
+ * Constructs a new QCylinderMesh with \a parent.
+ */
+QCylinderGeometry::QCylinderGeometry(QNode *parent)
+ : QGeometry(*new QCylinderGeometryPrivate, parent)
+{
+ Q_D(QCylinderGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QCylinderGeometry::QCylinderGeometry(QCylinderGeometryPrivate &dd, QNode *parent)
+ :QGeometry(dd, parent)
+{
+ Q_D(QCylinderGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QCylinderGeometry::~QCylinderGeometry()
+{
+}
+
+/*!
+ * Updates the vertices based on rings and slices.
+ */
+void QCylinderGeometry::updateVertices()
+{
+ Q_D(QCylinderGeometry);
+ const int nVerts = (d->m_slices + 1) * (d->m_rings + 1);
+ d->m_positionAttribute->setCount(nVerts);
+ d->m_texCoordAttribute->setCount(nVerts);
+ d->m_normalAttribute->setCount(nVerts);
+
+ d->m_vertexBuffer->setDataGenerator(QSharedPointer<CylinderVertexDataFunctor>::create(d->m_rings, d->m_slices, d->m_radius, d->m_length));
+}
+
+/*!
+ * Updates the indices based on rings and slices.
+ */
+void QCylinderGeometry::updateIndices()
+{
+ Q_D(QCylinderGeometry);
+ const int faces = (d->m_slices * 2) * (d->m_rings - 1) + (2 * d->m_slices);
+ d->m_indexAttribute->setCount(faces * 3);
+ d->m_indexBuffer->setDataGenerator(QSharedPointer<CylinderIndexDataFunctor>::create(d->m_rings, d->m_slices, d->m_length));
+}
+
+void QCylinderGeometry::setRings(int rings)
+{
+ Q_D(QCylinderGeometry);
+ if (rings != d->m_rings) {
+ d->m_rings = rings;
+ updateVertices();
+ updateIndices();
+ emit ringsChanged(rings);
+ }
+}
+
+void QCylinderGeometry::setSlices(int slices)
+{
+ Q_D(QCylinderGeometry);
+ if (slices != d->m_slices) {
+ d->m_slices = slices;
+ updateVertices();
+ updateIndices();
+ emit slicesChanged(slices);
+ }
+}
+
+void QCylinderGeometry::setRadius(float radius)
+{
+ Q_D(QCylinderGeometry);
+ if (radius != d->m_radius) {
+ d->m_radius = radius;
+ updateVertices();
+ emit radiusChanged(radius);
+ }
+}
+
+void QCylinderGeometry::setLength(float length)
+{
+ Q_D(QCylinderGeometry);
+ if (length != d->m_length) {
+ d->m_length = length;
+ updateVertices();
+ updateIndices();
+ emit lengthChanged(length);
+ }
+}
+
+/*!
+ * \property QCylinderGeometry::rings
+ *
+ * Holds the number of rings in the cylinder.
+ */
+int QCylinderGeometry::rings() const
+{
+ Q_D(const QCylinderGeometry);
+ return d->m_rings;
+}
+
+/*!
+ * \property QCylinderGeometry::slices
+ *
+ * Holds the number of slices in the cylinder.
+ */
+int QCylinderGeometry::slices() const
+{
+ Q_D(const QCylinderGeometry);
+ return d->m_slices;
+}
+
+/*!
+ * \property QCylinderGeometry::radius
+ *
+ * Holds the radius of the cylinder.
+ */
+float QCylinderGeometry::radius() const
+{
+ Q_D(const QCylinderGeometry);
+ return d->m_radius;
+}
+
+/*!
+ * \property QCylinderGeometry::length
+ *
+ * Holds the length of the cylinder.
+ */
+float QCylinderGeometry::length() const
+{
+ Q_D(const QCylinderGeometry);
+ return d->m_length;
+}
+
+/*!
+ * \property QCylinderGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+QAttribute *QCylinderGeometry::positionAttribute() const
+{
+ Q_D(const QCylinderGeometry);
+ return d->m_positionAttribute;
+}
+
+/*!
+ * \property QCylinderGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+QAttribute *QCylinderGeometry::normalAttribute() const
+{
+ Q_D(const QCylinderGeometry);
+ return d->m_normalAttribute;
+}
+
+/*!
+ * \property QCylinderGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+QAttribute *QCylinderGeometry::texCoordAttribute() const
+{
+ Q_D(const QCylinderGeometry);
+ return d->m_texCoordAttribute;
+}
+
+/*!
+ * \property QCylinderGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+QAttribute *QCylinderGeometry::indexAttribute() const
+{
+ Q_D(const QCylinderGeometry);
+ return d->m_indexAttribute;
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qcylindergeometry.h b/src/extras/geometries/qcylindergeometry.h
new file mode 100644
index 000000000..add4a7d96
--- /dev/null
+++ b/src/extras/geometries/qcylindergeometry.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QCYLINDERGEOMETRY_H
+#define QT3DEXTRAS_QCYLINDERGEOMETRY_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometry.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QCylinderGeometryPrivate;
+class QT3DEXTRASSHARED_EXPORT QCylinderGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+ Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
+ Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+ Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
+ Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
+
+public:
+ explicit QCylinderGeometry(QNode *parent = nullptr);
+ ~QCylinderGeometry();
+
+ void updateVertices();
+ void updateIndices();
+
+ int rings() const;
+ int slices() const;
+ float radius() const;
+ float length() const;
+
+ Qt3DRender::QAttribute *positionAttribute() const;
+ Qt3DRender::QAttribute *normalAttribute() const;
+ Qt3DRender::QAttribute *texCoordAttribute() const;
+ Qt3DRender::QAttribute *indexAttribute() const;
+
+public Q_SLOTS:
+ void setRings(int rings);
+ void setSlices(int slices);
+ void setRadius(float radius);
+ void setLength(float length);
+
+Q_SIGNALS:
+ void radiusChanged(float radius);
+ void ringsChanged(int rings);
+ void slicesChanged(int slices);
+ void lengthChanged(float length);
+
+protected:
+ QCylinderGeometry(QCylinderGeometryPrivate &dd, QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QCylinderGeometry)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QCYLINDERGEOMETRY_H
diff --git a/src/extras/geometries/qcylindergeometry_p.h b/src/extras/geometries/qcylindergeometry_p.h
new file mode 100644
index 000000000..50c37cb62
--- /dev/null
+++ b/src/extras/geometries/qcylindergeometry_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QCYLINDERGEOMETRY_P_H
+#define QT3DEXTRAS_QCYLINDERGEOMETRY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qgeometry_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+class QBuffer;
+
+} // namespace Qt3DRender
+
+namespace Qt3DExtras {
+
+class QCylinderGeometryPrivate : public Qt3DRender::QGeometryPrivate
+{
+public:
+ QCylinderGeometryPrivate();
+
+ void init();
+
+ Q_DECLARE_PUBLIC(QCylinderGeometry)
+
+ int m_rings;
+ int m_slices;
+ float m_radius;
+ float m_length;
+ Qt3DRender::QAttribute *m_positionAttribute;
+ Qt3DRender::QAttribute *m_normalAttribute;
+ Qt3DRender::QAttribute *m_texCoordAttribute;
+ Qt3DRender::QAttribute *m_indexAttribute;
+ Qt3DRender::QBuffer *m_vertexBuffer;
+ Qt3DRender::QBuffer *m_indexBuffer;
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QCYLINDERGEOMETRY_P_H
+
diff --git a/src/extras/geometries/qcylindermesh.cpp b/src/extras/geometries/qcylindermesh.cpp
new file mode 100644
index 000000000..ef405cb6e
--- /dev/null
+++ b/src/extras/geometries/qcylindermesh.cpp
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _USE_MATH_DEFINES
+# define _USE_MATH_DEFINES // For MSVC
+#endif
+
+#include "qcylindermesh.h"
+#include "qcylindergeometry.h"
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/qattribute.h>
+#include <qmath.h>
+#include <QVector3D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+/*!
+ * \qmltype CylinderMesh
+ * \instantiates Qt3DRender::QCylinderMesh
+ * \inqmlmodule Qt3D.Render
+ * \brief A cylindrical mesh.
+ */
+
+/*!
+ * \qmlproperty int CylinderMesh::rings
+ *
+ * Holds the number of rings in the mesh.
+ */
+
+/*!
+ * \qmlproperty int CylinderMesh::slices
+ *
+ * Holds the number of slices in the mesh.
+ */
+
+/*!
+ * \qmlproperty float CylinderMesh::radius
+ *
+ * Holds the radius of the cylinder.
+ */
+
+/*!
+ * \qmlproperty float CylinderMesh::length
+ *
+ * Holds the length of the cylinder.
+ */
+
+/*!
+ * \class Qt3DRender::QCylinderMesh
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometryRenderer
+ *
+ * \brief A cylindrical mesh.
+ */
+
+/*!
+ * Constructs a new QCylinderMesh with \a parent.
+ */
+QCylinderMesh::QCylinderMesh(QNode *parent)
+ : QGeometryRenderer(parent)
+{
+ QCylinderGeometry *geometry = new QCylinderGeometry(this);
+ QObject::connect(geometry, &QCylinderGeometry::radiusChanged, this, &QCylinderMesh::radiusChanged);
+ QObject::connect(geometry, &QCylinderGeometry::ringsChanged, this, &QCylinderMesh::ringsChanged);
+ QObject::connect(geometry, &QCylinderGeometry::slicesChanged, this, &QCylinderMesh::slicesChanged);
+ QObject::connect(geometry, &QCylinderGeometry::lengthChanged, this, &QCylinderMesh::lengthChanged);
+
+ QGeometryRenderer::setGeometry(geometry);
+}
+
+/*! \internal */
+QCylinderMesh::~QCylinderMesh()
+{
+}
+
+void QCylinderMesh::setRings(int rings)
+{
+ static_cast<QCylinderGeometry *>(geometry())->setRings(rings);
+}
+
+void QCylinderMesh::setSlices(int slices)
+{
+ static_cast<QCylinderGeometry *>(geometry())->setSlices(slices);
+}
+
+void QCylinderMesh::setRadius(float radius)
+{
+ static_cast<QCylinderGeometry *>(geometry())->setRadius(radius);
+}
+
+void QCylinderMesh::setLength(float length)
+{
+ static_cast<QCylinderGeometry *>(geometry())->setLength(length);
+}
+
+/*!
+ * \property QCylinderMesh::rings
+ *
+ * Holds the number of rings in the mesh.
+ */
+int QCylinderMesh::rings() const
+{
+ return static_cast<QCylinderGeometry *>(geometry())->rings();
+}
+
+/*!
+ * \property QCylinderMesh::slices
+ *
+ * Holds the number of slices in the mesh.
+ */
+int QCylinderMesh::slices() const
+{
+ return static_cast<QCylinderGeometry *>(geometry())->slices();
+}
+
+/*!
+ * \property QCylinderMesh::radius
+ *
+ * Holds the radius of the cylinder.
+ */
+float QCylinderMesh::radius() const
+{
+ return static_cast<QCylinderGeometry *>(geometry())->radius();
+}
+
+/*!
+ * \property QCylinderMesh::length
+ *
+ * Holds the length of the cylinder.
+ */
+float QCylinderMesh::length() const
+{
+ return static_cast<QCylinderGeometry *>(geometry())->length();
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qcylindermesh.h b/src/extras/geometries/qcylindermesh.h
new file mode 100644
index 000000000..3083ed849
--- /dev/null
+++ b/src/extras/geometries/qcylindermesh.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QCYLINDERMESH_H
+#define QT3DEXTRAS_QCYLINDERMESH_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometryrenderer.h>
+
+QT_BEGIN_NAMESPACE
+
+
+namespace Qt3DExtras {
+
+class QT3DEXTRASSHARED_EXPORT QCylinderMesh : public Qt3DRender::QGeometryRenderer
+{
+ Q_OBJECT
+ Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
+ Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+ Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
+public:
+ explicit QCylinderMesh(Qt3DCore::QNode *parent = nullptr);
+ ~QCylinderMesh();
+
+ int rings() const;
+ int slices() const;
+ float radius() const;
+ float length() const;
+
+public Q_SLOTS:
+ void setRings(int rings);
+ void setSlices(int slices);
+ void setRadius(float radius);
+ void setLength(float length);
+
+Q_SIGNALS:
+ void radiusChanged(float radius);
+ void ringsChanged(int rings);
+ void slicesChanged(int slices);
+ void lengthChanged(float length);
+
+private:
+ // As this is a default provided geometry renderer, no one should be able
+ // to modify the QGeometryRenderer's properties
+
+ void setInstanceCount(int instanceCount);
+ void setVertexCount(int vertexCount);
+ void setIndexOffset(int indexOffset);
+ void setFirstInstance(int firstInstance);
+ void setRestartIndexValue(int index);
+ void setPrimitiveRestartEnabled(bool enabled);
+ void setGeometry(Qt3DRender::QGeometry *geometry);
+ void setPrimitiveType(PrimitiveType primitiveType);
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QCYLINDERMESH_H
diff --git a/src/extras/geometries/qplanegeometry.cpp b/src/extras/geometries/qplanegeometry.cpp
new file mode 100644
index 000000000..59ed9ee21
--- /dev/null
+++ b/src/extras/geometries/qplanegeometry.cpp
@@ -0,0 +1,528 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplanegeometry.h"
+#include "qplanegeometry_p.h"
+#include <Qt3DRender/qattribute.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <limits>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+namespace {
+
+QByteArray createPlaneVertexData(float w, float h, const QSize &resolution)
+{
+ Q_ASSERT(w > 0.0f);
+ Q_ASSERT(h > 0.0f);
+ Q_ASSERT(resolution.width() >= 2);
+ Q_ASSERT(resolution.height() >= 2);
+
+ const int nVerts = resolution.width() * resolution.height();
+
+ // Populate a buffer with the interleaved per-vertex data with
+ // vec3 pos, vec2 texCoord, vec3 normal, vec4 tangent
+ const quint32 elementSize = 3 + 2 + 3 + 4;
+ const quint32 stride = elementSize * sizeof(float);
+ QByteArray bufferBytes;
+ bufferBytes.resize(stride * nVerts);
+ float* fptr = reinterpret_cast<float*>(bufferBytes.data());
+
+ const float x0 = -w / 2.0f;
+ const float z0 = -h / 2.0f;
+ const float dx = w / (resolution.width() - 1);
+ const float dz = h / (resolution.height() - 1);
+ const float du = 1.0 / (resolution.width() - 1);
+ const float dv = 1.0 / (resolution.height() - 1);
+
+ // Iterate over z
+ for (int j = 0; j < resolution.height(); ++j) {
+ const float z = z0 + static_cast<float>(j) * dz;
+ const float v = static_cast<float>(j) * dv;
+
+ // Iterate over x
+ for (int i = 0; i < resolution.width(); ++i) {
+ const float x = x0 + static_cast<float>(i) * dx;
+ const float u = static_cast<float>(i) * du;
+
+ // position
+ *fptr++ = x;
+ *fptr++ = 0.0;
+ *fptr++ = z;
+
+ // texture coordinates
+ *fptr++ = u;
+ *fptr++ = v;
+
+ // normal
+ *fptr++ = 0.0f;
+ *fptr++ = 1.0f;
+ *fptr++ = 0.0f;
+
+ // tangent
+ *fptr++ = 1.0f;
+ *fptr++ = 0.0f;
+ *fptr++ = 0.0f;
+ *fptr++ = 1.0f;
+ }
+ }
+
+ return bufferBytes;
+}
+
+QByteArray createPlaneIndexData(const QSize &resolution)
+{
+ // Create the index data. 2 triangles per rectangular face
+ const int faces = 2 * (resolution.width() - 1) * (resolution.height() - 1);
+ const int indices = 3 * faces;
+ Q_ASSERT(indices < std::numeric_limits<quint16>::max());
+ QByteArray indexBytes;
+ indexBytes.resize(indices * sizeof(quint16));
+ quint16* indexPtr = reinterpret_cast<quint16*>(indexBytes.data());
+
+ // Iterate over z
+ for (int j = 0; j < resolution.height() - 1; ++j) {
+ const int rowStartIndex = j * resolution.width();
+ const int nextRowStartIndex = (j + 1) * resolution.width();
+
+ // Iterate over x
+ for (int i = 0; i < resolution.width() - 1; ++i) {
+ // Split quad into two triangles
+ *indexPtr++ = rowStartIndex + i;
+ *indexPtr++ = nextRowStartIndex + i;
+ *indexPtr++ = rowStartIndex + i + 1;
+
+ *indexPtr++ = nextRowStartIndex + i;
+ *indexPtr++ = nextRowStartIndex + i + 1;
+ *indexPtr++ = rowStartIndex + i + 1;
+ }
+ }
+
+ return indexBytes;
+}
+
+} // anonymous
+
+class PlaneVertexBufferFunctor : public QBufferDataGenerator
+{
+public:
+ explicit PlaneVertexBufferFunctor(float w, float h, const QSize &resolution)
+ : m_width(w)
+ , m_height(h)
+ , m_resolution(resolution)
+ {}
+
+ ~PlaneVertexBufferFunctor() {}
+
+ QByteArray operator()() Q_DECL_FINAL
+ {
+ return createPlaneVertexData(m_width, m_height, m_resolution);
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_FINAL
+ {
+ const PlaneVertexBufferFunctor *otherFunctor = functor_cast<PlaneVertexBufferFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_width == m_width &&
+ otherFunctor->m_height == m_height &&
+ otherFunctor->m_resolution == m_resolution);
+ return false;
+ }
+
+ QT3D_FUNCTOR(PlaneVertexBufferFunctor)
+
+ private:
+ float m_width;
+ float m_height;
+ QSize m_resolution;
+};
+
+class PlaneIndexBufferFunctor : public QBufferDataGenerator
+{
+public:
+ explicit PlaneIndexBufferFunctor(const QSize &resolution)
+ : m_resolution(resolution)
+ {}
+
+ ~PlaneIndexBufferFunctor() {}
+
+ QByteArray operator()() Q_DECL_FINAL
+ {
+ return createPlaneIndexData(m_resolution);
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_FINAL
+ {
+ const PlaneIndexBufferFunctor *otherFunctor = functor_cast<PlaneIndexBufferFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_resolution == m_resolution);
+ return false;
+ }
+
+ QT3D_FUNCTOR(PlaneIndexBufferFunctor)
+
+ private:
+ QSize m_resolution;
+};
+
+/*!
+ * \qmltype PlaneGeometry
+ * \instantiates Qt3DRender::QPlaneGeometry
+ * \inqmlmodule Qt3D.Render
+ */
+
+/*!
+ * \qmlproperty float PlaneGeometry::width
+ *
+ * Holds the plane width.
+ */
+
+/*!
+ * \qmlproperty float PlaneGeometry::height
+ *
+ * Holds the plane height.
+ */
+
+/*!
+ * \qmlproperty size PlaneGeometry::resolution
+ *
+ * Holds the plane resolution.
+ */
+
+/*!
+ * \qmlproperty Attribute PlaneGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute PlaneGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute PlaneGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute PlaneGeometry::tangentAttribute
+ *
+ * Holds the geometry tangent attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute PlaneGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+
+/*!
+ * \class Qt3DRender::QPlaneGeometry
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometry
+ */
+
+/*!
+ * Constructs a new QPlaneGeometry with \a parent.
+ */
+QPlaneGeometry::QPlaneGeometry(QPlaneGeometry::QNode *parent)
+ : QGeometry(*new QPlaneGeometryPrivate(), parent)
+{
+ Q_D(QPlaneGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QPlaneGeometry::QPlaneGeometry(QPlaneGeometryPrivate &dd, QNode *parent)
+ : QGeometry(dd, parent)
+{
+ Q_D(QPlaneGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QPlaneGeometry::~QPlaneGeometry()
+{
+}
+
+/*!
+ * Updates vertices based on resolution.
+ */
+void QPlaneGeometry::updateVertices()
+{
+ Q_D(QPlaneGeometry);
+ const int nVerts = d->m_meshResolution.width() * d->m_meshResolution.height();
+
+ d->m_positionAttribute->setCount(nVerts);
+ d->m_normalAttribute->setCount(nVerts);
+ d->m_texCoordAttribute->setCount(nVerts);
+ d->m_tangentAttribute->setCount(nVerts);
+ d->m_vertexBuffer->setDataGenerator(QSharedPointer<PlaneVertexBufferFunctor>::create(d->m_width, d->m_height, d->m_meshResolution));
+}
+
+/*!
+ * Updates indices based on resolution.
+ */
+void QPlaneGeometry::updateIndices()
+{
+ Q_D(QPlaneGeometry);
+ const int faces = 2 * (d->m_meshResolution.width() - 1) * (d->m_meshResolution.height() - 1);
+ // Each primitive has 3 vertices
+ d->m_indexAttribute->setCount(faces * 3);
+ d->m_indexBuffer->setDataGenerator(QSharedPointer<PlaneIndexBufferFunctor>::create(d->m_meshResolution));
+
+}
+
+void QPlaneGeometry::setResolution(const QSize &resolution)
+{
+ Q_D(QPlaneGeometry);
+ if (d->m_meshResolution == resolution)
+ return;
+ d->m_meshResolution = resolution;
+ updateVertices();
+ updateIndices();
+ emit resolutionChanged(resolution);
+}
+
+void QPlaneGeometry::setWidth(float width)
+{
+ Q_D(QPlaneGeometry);
+ if (width == d->m_width)
+ return;
+ d->m_width = width;
+ updateVertices();
+ emit widthChanged(width);
+}
+
+void QPlaneGeometry::setHeight(float height)
+{
+ Q_D(QPlaneGeometry);
+ if (height == d->m_height)
+ return;
+ d->m_height = height;
+ updateVertices();
+ emit heightChanged(height);
+}
+
+/*!
+ * \property QPlaneGeometry::resolution
+ *
+ * Holds the plane resolution.
+ */
+QSize QPlaneGeometry::resolution() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_meshResolution;
+}
+
+/*!
+ * \property QPlaneGeometry::width
+ *
+ * Holds the plane width.
+ */
+float QPlaneGeometry::width() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_width;
+}
+
+/*!
+ * \property QPlaneGeometry::height
+ *
+ * Holds the plane height.
+ */
+float QPlaneGeometry::height() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_height;
+}
+
+/*!
+ * \property QPlaneGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+QAttribute *QPlaneGeometry::positionAttribute() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_positionAttribute;
+}
+
+/*!
+ * \property QPlaneGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+QAttribute *QPlaneGeometry::normalAttribute() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_normalAttribute;
+}
+
+/*!
+ * \property QPlaneGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+QAttribute *QPlaneGeometry::texCoordAttribute() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_texCoordAttribute;
+}
+
+/*!
+ * \property QPlaneGeometry::tangentAttribute
+ *
+ * Holds the geometry tangent attribute.
+ */
+QAttribute *QPlaneGeometry::tangentAttribute() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_tangentAttribute;
+}
+
+/*!
+ * \property QPlaneGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+QAttribute *QPlaneGeometry::indexAttribute() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_indexAttribute;
+}
+
+QPlaneGeometryPrivate::QPlaneGeometryPrivate()
+ : QGeometryPrivate()
+ , m_width(1.0f)
+ , m_height(1.0f)
+ , m_meshResolution(QSize(2, 2))
+ , m_positionAttribute(nullptr)
+ , m_normalAttribute(nullptr)
+ , m_texCoordAttribute(nullptr)
+ , m_tangentAttribute(nullptr)
+ , m_indexAttribute(nullptr)
+ , m_vertexBuffer(nullptr)
+ , m_indexBuffer(nullptr)
+{
+}
+
+void QPlaneGeometryPrivate::init()
+{
+ Q_Q(QPlaneGeometry);
+ m_positionAttribute = new QAttribute(q);
+ m_normalAttribute = new QAttribute(q);
+ m_texCoordAttribute = new QAttribute(q);
+ m_tangentAttribute = new QAttribute(q);
+ m_indexAttribute = new QAttribute(q);
+ m_vertexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, q);
+ m_indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, q);
+
+ const int nVerts = m_meshResolution.width() * m_meshResolution.height();
+ const int stride = (3 + 2 + 3 + 4) * sizeof(float);
+ const int faces = 2 * (m_meshResolution.width() - 1) * (m_meshResolution.height() - 1);
+
+ m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
+ m_positionAttribute->setDataType(QAttribute::Float);
+ m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_positionAttribute->setBuffer(m_vertexBuffer);
+ m_positionAttribute->setByteStride(stride);
+ m_positionAttribute->setCount(nVerts);
+
+ m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
+ m_texCoordAttribute->setDataType(QAttribute::Float);
+ m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_texCoordAttribute->setBuffer(m_vertexBuffer);
+ m_texCoordAttribute->setByteStride(stride);
+ m_texCoordAttribute->setByteOffset(3 * sizeof(float));
+ m_texCoordAttribute->setCount(nVerts);
+
+ m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
+ m_normalAttribute->setDataType(QAttribute::Float);
+ m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_normalAttribute->setBuffer(m_vertexBuffer);
+ m_normalAttribute->setByteStride(stride);
+ m_normalAttribute->setByteOffset(5 * sizeof(float));
+ m_normalAttribute->setCount(nVerts);
+
+ m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
+ m_tangentAttribute->setDataType(QAttribute::Float);
+ m_tangentAttribute->setDataSize(4);
+ m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_tangentAttribute->setBuffer(m_vertexBuffer);
+ m_tangentAttribute->setByteStride(stride);
+ m_tangentAttribute->setByteOffset(8 * sizeof(float));
+ m_tangentAttribute->setCount(nVerts);
+
+ m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
+ m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setBuffer(m_indexBuffer);
+
+ // Each primitive has 3 vertives
+ m_indexAttribute->setCount(faces * 3);
+
+ m_vertexBuffer->setDataGenerator(QSharedPointer<PlaneVertexBufferFunctor>::create(m_width, m_height, m_meshResolution));
+ m_indexBuffer->setDataGenerator(QSharedPointer<PlaneIndexBufferFunctor>::create(m_meshResolution));
+
+ q->addAttribute(m_positionAttribute);
+ q->addAttribute(m_texCoordAttribute);
+ q->addAttribute(m_normalAttribute);
+ q->addAttribute(m_tangentAttribute);
+ q->addAttribute(m_indexAttribute);
+}
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qplanegeometry.h b/src/extras/geometries/qplanegeometry.h
new file mode 100644
index 000000000..7ec5cba43
--- /dev/null
+++ b/src/extras/geometries/qplanegeometry.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPLANEGEOMETRY_H
+#define QT3DEXTRAS_QPLANEGEOMETRY_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometry.h>
+#include <QSize>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+
+} // Qt3DRender
+
+namespace Qt3DExtras {
+
+class QPlaneGeometryPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QPlaneGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+ Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
+ Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged)
+ Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged)
+ Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *tangentAttribute READ tangentAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
+
+public:
+ explicit QPlaneGeometry(QNode *parent = nullptr);
+ ~QPlaneGeometry();
+
+ void updateVertices();
+ void updateIndices();
+
+ QSize resolution() const;
+ float width() const;
+ float height() const;
+
+ Qt3DRender::QAttribute *positionAttribute() const;
+ Qt3DRender::QAttribute *normalAttribute() const;
+ Qt3DRender::QAttribute *texCoordAttribute() const;
+ Qt3DRender::QAttribute *tangentAttribute() const;
+ Qt3DRender::QAttribute *indexAttribute() const;
+
+public Q_SLOTS:
+ void setResolution(const QSize &resolution);
+ void setWidth(float width);
+ void setHeight(float height);
+
+Q_SIGNALS:
+ void resolutionChanged(const QSize &resolution);
+ void widthChanged(float width);
+ void heightChanged(float height);
+
+protected:
+ QPlaneGeometry(QPlaneGeometryPrivate &dd, QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QPlaneGeometry)
+};
+
+} // Qt3DExpoerimental
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPLANEGEOMETRY_H
diff --git a/src/extras/geometries/qplanegeometry_p.h b/src/extras/geometries/qplanegeometry_p.h
new file mode 100644
index 000000000..d0a4e88e4
--- /dev/null
+++ b/src/extras/geometries/qplanegeometry_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPLANEGEOMETRY_P_H
+#define QT3DEXTRAS_QPLANEGEOMETRY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qgeometry_p.h>
+#include <QSize>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+class QBuffer;
+
+} // Qt3DRender
+
+namespace Qt3DExtras {
+
+class QPlaneGeometryPrivate : public Qt3DRender::QGeometryPrivate
+{
+public:
+ QPlaneGeometryPrivate();
+ void init();
+
+ float m_width;
+ float m_height;
+ QSize m_meshResolution;
+ Qt3DRender::QAttribute *m_positionAttribute;
+ Qt3DRender::QAttribute *m_normalAttribute;
+ Qt3DRender::QAttribute *m_texCoordAttribute;
+ Qt3DRender::QAttribute *m_tangentAttribute;
+ Qt3DRender::QAttribute *m_indexAttribute;
+ Qt3DRender::QBuffer *m_vertexBuffer;
+ Qt3DRender::QBuffer *m_indexBuffer;
+
+ Q_DECLARE_PUBLIC(QPlaneGeometry)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPLANEGEOMETRY_P_H
+
diff --git a/src/extras/geometries/qplanemesh.cpp b/src/extras/geometries/qplanemesh.cpp
new file mode 100644
index 000000000..f9d1a105b
--- /dev/null
+++ b/src/extras/geometries/qplanemesh.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplanemesh.h"
+#include "qplanegeometry.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+/*!
+ * \qmltype PlaneMesh
+ * \instantiates Qt3DRender::QPlaneMesh
+ * \inqmlmodule Qt3D.Render
+ * \brief A square planar mesh.
+ */
+
+/*!
+ * \qmlproperty float PlaneMesh::width
+ *
+ * Holds the plane width.
+ */
+
+/*!
+ * \qmlproperty float PlaneMesh::height
+ *
+ * Holds the plane height.
+ */
+
+/*!
+ * \qmlproperty size PlaneMesh::meshResolution
+ *
+ * Holds the plane resolution.
+ */
+
+/*!
+ * \class Qt3DRender::QPlaneMesh
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometryRenderer
+ *
+ * \brief A square planar mesh.
+ */
+
+/*!
+ * Constructs a new QPlaneMesh with \a parent.
+ */
+QPlaneMesh::QPlaneMesh(QNode *parent)
+ : QGeometryRenderer(parent)
+{
+ QPlaneGeometry *geometry = new QPlaneGeometry(this);
+ QObject::connect(geometry, &QPlaneGeometry::widthChanged, this, &QPlaneMesh::widthChanged);
+ QObject::connect(geometry, &QPlaneGeometry::heightChanged, this, &QPlaneMesh::heightChanged);
+ QObject::connect(geometry, &QPlaneGeometry::resolutionChanged, this, &QPlaneMesh::meshResolutionChanged);
+ QGeometryRenderer::setGeometry(geometry);
+}
+
+/*! \internal */
+QPlaneMesh::~QPlaneMesh()
+{
+}
+
+void QPlaneMesh::setWidth(float width)
+{
+ static_cast<QPlaneGeometry *>(geometry())->setWidth(width);
+}
+
+/*!
+ * \property QPlaneMesh::width
+ *
+ * Holds the plane width.
+ */
+float QPlaneMesh::width() const
+{
+ return static_cast<QPlaneGeometry *>(geometry())->width();
+}
+
+void QPlaneMesh::setHeight(float height)
+{
+ static_cast<QPlaneGeometry *>(geometry())->setHeight(height);
+}
+
+/*!
+ * \property QPlaneMesh::height
+ *
+ * Holds the plane height.
+ */
+float QPlaneMesh::height() const
+{
+ return static_cast<QPlaneGeometry *>(geometry())->height();
+}
+
+void QPlaneMesh::setMeshResolution(const QSize &resolution)
+{
+ static_cast<QPlaneGeometry *>(geometry())->setResolution(resolution);
+}
+
+/*!
+ * \property QPlaneMesh::meshResolution
+ *
+ * Holds the plane resolution.
+ */
+QSize QPlaneMesh::meshResolution() const
+{
+ return static_cast<QPlaneGeometry *>(geometry())->resolution();
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qplanemesh.h b/src/extras/geometries/qplanemesh.h
new file mode 100644
index 000000000..b1505db17
--- /dev/null
+++ b/src/extras/geometries/qplanemesh.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QPLANEMESH_H
+#define QT3DEXTRAS_QPLANEMESH_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometryrenderer.h>
+#include <QSize>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QT3DEXTRASSHARED_EXPORT QPlaneMesh : public Qt3DRender::QGeometryRenderer
+{
+ Q_OBJECT
+ Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
+ Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged)
+ Q_PROPERTY(QSize meshResolution READ meshResolution WRITE setMeshResolution NOTIFY meshResolutionChanged)
+
+public:
+ explicit QPlaneMesh(Qt3DCore::QNode *parent = nullptr);
+ ~QPlaneMesh();
+
+ float width() const;
+ float height() const;
+ QSize meshResolution() const;
+
+public Q_SLOTS:
+ void setWidth(float width);
+ void setHeight(float height);
+ void setMeshResolution(const QSize &resolution);
+
+Q_SIGNALS:
+ void meshResolutionChanged(const QSize &meshResolution);
+ void widthChanged(float width);
+ void heightChanged(float height);
+
+private:
+ // As this is a default provided geometry renderer, no one should be able
+ // to modify the QGeometryRenderer's properties
+
+ void setInstanceCount(int instanceCount);
+ void setVertexCount(int vertexCount);
+ void setIndexOffset(int indexOffset);
+ void setFirstInstance(int firstInstance);
+ void setRestartIndexValue(int index);
+ void setPrimitiveRestartEnabled(bool enabled);
+ void setGeometry(Qt3DRender::QGeometry *geometry);
+ void setPrimitiveType(PrimitiveType primitiveType);
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QPLANEMESH_H
diff --git a/src/extras/geometries/qspheregeometry.cpp b/src/extras/geometries/qspheregeometry.cpp
new file mode 100644
index 000000000..0c582f441
--- /dev/null
+++ b/src/extras/geometries/qspheregeometry.cpp
@@ -0,0 +1,583 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qspheregeometry.h"
+#include "qspheregeometry_p.h"
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qattribute.h>
+
+#ifndef _USE_MATH_DEFINES
+# define _USE_MATH_DEFINES // For MSVC
+#endif
+
+#include <qmath.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+namespace {
+
+QByteArray createSphereMeshVertexData(float radius, int rings, int slices)
+{
+ QByteArray bufferBytes;
+ // vec3 pos, vec2 texCoord, vec3 normal, vec4 tangent
+ const quint32 elementSize = 3 + 2 + 3 + 4;
+ const quint32 stride = elementSize * sizeof(float);
+ const int nVerts = (slices + 1) * (rings + 1);
+ bufferBytes.resize(stride * nVerts);
+
+ float* fptr = reinterpret_cast<float*>(bufferBytes.data());
+
+ const float dTheta = (M_PI * 2) / static_cast<float>( slices );
+ const float dPhi = M_PI / static_cast<float>( rings );
+ const float du = 1.0f / static_cast<float>( slices );
+ const float dv = 1.0f / static_cast<float>( rings );
+
+ // Iterate over latitudes (rings)
+ for ( int lat = 0; lat < rings + 1; ++lat )
+ {
+ const float phi = M_PI_2 - static_cast<float>( lat ) * dPhi;
+ const float cosPhi = qCos( phi );
+ const float sinPhi = qSin( phi );
+ const float v = 1.0f - static_cast<float>( lat ) * dv;
+
+ // Iterate over longitudes (slices)
+ for ( int lon = 0; lon < slices + 1; ++lon )
+ {
+ const float theta = static_cast<float>( lon ) * dTheta;
+ const float cosTheta = qCos( theta );
+ const float sinTheta = qSin( theta );
+ const float u = static_cast<float>( lon ) * du;
+
+ *fptr++ = radius * cosTheta * cosPhi;
+ *fptr++ = radius * sinPhi;
+ *fptr++ = radius * sinTheta * cosPhi;
+
+ *fptr++ = u;
+ *fptr++ = v;
+
+ *fptr++ = cosTheta * cosPhi;
+ *fptr++ = sinPhi;
+ *fptr++ = sinTheta * cosPhi;
+
+ *fptr++ = sinTheta;
+ *fptr++ = 0.0;
+ *fptr++ = -cosTheta;
+ *fptr++ = 1.0;
+ }
+ }
+ return bufferBytes;
+}
+
+QByteArray createSphereMeshIndexData(int rings, int slices)
+{
+ int faces = (slices * 2) * (rings - 2); // two tris per slice, for all middle rings
+ faces += 2 * slices; // tri per slice for both top and bottom
+
+ QByteArray indexBytes;
+ const int indices = faces * 3;
+ Q_ASSERT(indices < 65536);
+ indexBytes.resize(indices * sizeof(quint16));
+ quint16 *indexPtr = reinterpret_cast<quint16*>(indexBytes.data());
+
+ // top cap
+ {
+ const int nextRingStartIndex = slices + 1;
+ for ( int j = 0; j < slices; ++j )
+ {
+ *indexPtr++ = nextRingStartIndex + j;
+ *indexPtr++ = 0;
+ *indexPtr++ = nextRingStartIndex + j + 1;
+ }
+ }
+
+ for ( int i = 1; i < (rings - 1); ++i )
+ {
+ const int ringStartIndex = i * ( slices + 1 );
+ const int nextRingStartIndex = ( i + 1 ) * ( slices + 1 );
+
+ for ( int j = 0; j < slices; ++j )
+ {
+ // Split the quad into two triangles
+ *indexPtr++ = ringStartIndex + j;
+ *indexPtr++ = ringStartIndex + j + 1;
+ *indexPtr++ = nextRingStartIndex + j;
+ *indexPtr++ = nextRingStartIndex + j;
+ *indexPtr++ = ringStartIndex + j + 1;
+ *indexPtr++ = nextRingStartIndex + j + 1;
+ }
+ }
+
+ // bottom cap
+ {
+ const int ringStartIndex = (rings - 1) * ( slices + 1);
+ const int nextRingStartIndex = (rings) * ( slices + 1);
+ for ( int j = 0; j < slices; ++j )
+ {
+ *indexPtr++ = ringStartIndex + j + 1;
+ *indexPtr++ = nextRingStartIndex;
+ *indexPtr++ = ringStartIndex + j;
+ }
+ }
+
+ return indexBytes;
+}
+
+} // anonymous
+
+class SphereVertexDataFunctor : public QBufferDataGenerator
+{
+public:
+ SphereVertexDataFunctor(int rings, int slices, float radius)
+ : m_rings(rings)
+ , m_slices(slices)
+ , m_radius(radius)
+ {
+ }
+
+ QByteArray operator ()() Q_DECL_OVERRIDE
+ {
+ return createSphereMeshVertexData(m_radius, m_rings, m_slices);
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
+ {
+ const SphereVertexDataFunctor *otherFunctor = functor_cast<SphereVertexDataFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_rings == m_rings &&
+ otherFunctor->m_slices == m_slices &&
+ otherFunctor->m_radius == m_radius);
+ return false;
+ }
+
+ QT3D_FUNCTOR(SphereVertexDataFunctor)
+
+private:
+ int m_rings;
+ int m_slices;
+ float m_radius;
+};
+
+class SphereIndexDataFunctor : public QBufferDataGenerator
+{
+public:
+ SphereIndexDataFunctor(int rings, int slices)
+ : m_rings(rings)
+ , m_slices(slices)
+ {
+ }
+
+ QByteArray operator ()() Q_DECL_OVERRIDE
+ {
+ return createSphereMeshIndexData(m_rings, m_slices);
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
+ {
+ const SphereIndexDataFunctor *otherFunctor = functor_cast<SphereIndexDataFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_rings == m_rings &&
+ otherFunctor->m_slices == m_slices);
+ return false;
+ }
+
+ QT3D_FUNCTOR(SphereIndexDataFunctor)
+
+private:
+ int m_rings;
+ int m_slices;
+};
+
+QSphereGeometryPrivate::QSphereGeometryPrivate()
+ : QGeometryPrivate()
+ , m_generateTangents(false)
+ , m_rings(16)
+ , m_slices(16)
+ , m_radius(1.0f)
+ , m_positionAttribute(nullptr)
+ , m_normalAttribute(nullptr)
+ , m_texCoordAttribute(nullptr)
+ , m_tangentAttribute(nullptr)
+ , m_indexAttribute(nullptr)
+ , m_vertexBuffer(nullptr)
+ , m_indexBuffer(nullptr)
+{
+}
+
+void QSphereGeometryPrivate::init()
+{
+ Q_Q(QSphereGeometry);
+ m_positionAttribute = new QAttribute(q);
+ m_normalAttribute = new QAttribute(q);
+ m_texCoordAttribute = new QAttribute(q);
+ m_tangentAttribute = new QAttribute(q);
+ m_indexAttribute = new QAttribute(q);
+ m_vertexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, q);
+ m_indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, q);
+
+ // vec3 pos, vec2 tex, vec3 normal, vec4 tangent
+ const quint32 elementSize = 3 + 2 + 3 + 4;
+ const quint32 stride = elementSize * sizeof(float);
+ const int nVerts = (m_slices + 1) * (m_rings + 1);
+ const int faces = (m_slices * 2) * (m_rings - 2) + (2 * m_slices);
+
+ m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
+ m_positionAttribute->setDataType(QAttribute::Float);
+ m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_positionAttribute->setBuffer(m_vertexBuffer);
+ m_positionAttribute->setByteStride(stride);
+ m_positionAttribute->setCount(nVerts);
+
+ m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
+ m_texCoordAttribute->setDataType(QAttribute::Float);
+ m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_texCoordAttribute->setBuffer(m_vertexBuffer);
+ m_texCoordAttribute->setByteStride(stride);
+ m_texCoordAttribute->setByteOffset(3 * sizeof(float));
+ m_texCoordAttribute->setCount(nVerts);
+
+ m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
+ m_normalAttribute->setDataType(QAttribute::Float);
+ m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_normalAttribute->setBuffer(m_vertexBuffer);
+ m_normalAttribute->setByteStride(stride);
+ m_normalAttribute->setByteOffset(5 * sizeof(float));
+ m_normalAttribute->setCount(nVerts);
+
+ m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
+ m_tangentAttribute->setDataType(QAttribute::Float);
+ m_tangentAttribute->setDataSize(4);
+ m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_tangentAttribute->setBuffer(m_vertexBuffer);
+ m_tangentAttribute->setByteStride(stride);
+ m_tangentAttribute->setByteOffset(8 * sizeof(float));
+ m_tangentAttribute->setCount(nVerts);
+
+ m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
+ m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setBuffer(m_indexBuffer);
+
+ m_indexAttribute->setCount(faces * 3);
+
+ m_vertexBuffer->setDataGenerator(QSharedPointer<SphereVertexDataFunctor>::create(m_rings, m_slices, m_radius));
+ m_indexBuffer->setDataGenerator(QSharedPointer<SphereIndexDataFunctor>::create(m_rings, m_slices));
+
+ q->addAttribute(m_positionAttribute);
+ q->addAttribute(m_texCoordAttribute);
+ q->addAttribute(m_normalAttribute);
+ if (m_generateTangents)
+ q->addAttribute(m_tangentAttribute);
+ q->addAttribute(m_indexAttribute);
+}
+
+/*!
+ * \qmltype SphereGeometry
+ * \instantiates QSphereGeometry
+ * \inqmlmodule Qt3D.Render
+ */
+
+/*!
+ * \qmlproperty int SphereGeometry::rings
+ *
+ * Holds the number of rings in the sphere.
+ */
+
+/*!
+ * \qmlproperty int SphereGeometry::slices
+ *
+ * Holds the number of slices in the sphere.
+ */
+
+/*!
+ * \qmlproperty float SphereGeometry::radius
+ *
+ * Holds the radius of the sphere.
+ */
+
+/*!
+ * \qmlproperty bool SphereGeometry::generateTangents
+ *
+ * Holds the value of the automatic tangent generation flag.
+ */
+
+/*!
+ * \qmlproperty Attribute SphereGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute SphereGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute SphereGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute SphereGeometry::tangentAttribute
+ *
+ * Holds the geometry tangent attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute SphereGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+
+/*!
+ * \class QSphereGeometry
+ * \inmodule Qt3DRender
+ *
+ * \inherits QGeometry
+ */
+
+/*!
+ * Constructs a new QSphereGeometry with \a parent.
+ */
+QSphereGeometry::QSphereGeometry(QNode *parent)
+ : QGeometry(*new QSphereGeometryPrivate(), parent)
+{
+ Q_D(QSphereGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QSphereGeometry::QSphereGeometry(QSphereGeometryPrivate &dd, QNode *parent)
+ : QGeometry(dd, parent)
+{
+ Q_D(QSphereGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QSphereGeometry::~QSphereGeometry()
+{
+}
+
+/*!
+ * Updates vertices based on rings and slices.
+ */
+void QSphereGeometry::updateVertices()
+{
+ Q_D(QSphereGeometry);
+ const int nVerts = (d->m_slices + 1) * (d->m_rings + 1);
+ d->m_positionAttribute->setCount(nVerts);
+ d->m_texCoordAttribute->setCount(nVerts);
+ d->m_normalAttribute->setCount(nVerts);
+ d->m_tangentAttribute->setCount(nVerts);
+ d->m_vertexBuffer->setDataGenerator(QSharedPointer<SphereVertexDataFunctor>::create(d->m_rings, d->m_slices, d->m_radius));
+}
+
+/*!
+ * Updates indices based on rings and slices.
+ */
+void QSphereGeometry::updateIndices()
+{
+ Q_D(QSphereGeometry);
+ const int faces = (d->m_slices * 2) * (d->m_rings - 2) + (2 * d->m_slices);
+ d->m_indexAttribute->setCount(faces * 3);
+ d->m_indexBuffer->setDataGenerator(QSharedPointer<SphereIndexDataFunctor>::create(d->m_rings, d->m_slices));
+
+}
+
+void QSphereGeometry::setRings(int rings)
+{
+ Q_D(QSphereGeometry);
+ if (rings != d->m_rings) {
+ d->m_rings = rings;
+ updateVertices();
+ updateIndices();
+ emit ringsChanged(rings);
+ }
+}
+
+void QSphereGeometry::setSlices(int slices)
+{
+ Q_D(QSphereGeometry);
+ if (slices != d->m_slices) {
+ d->m_slices = slices;
+ updateVertices();
+ updateIndices();
+ emit slicesChanged(slices);
+ }
+}
+
+void QSphereGeometry::setRadius(float radius)
+{
+ Q_D(QSphereGeometry);
+ if (radius != d->m_radius) {
+ d->m_radius = radius;
+ updateVertices();
+ emit radiusChanged(radius);
+ }
+}
+
+void QSphereGeometry::setGenerateTangents(bool gen)
+{
+ Q_D(QSphereGeometry);
+ if (d->m_generateTangents != gen) {
+ if (d->m_generateTangents)
+ removeAttribute(d->m_tangentAttribute);
+ d->m_generateTangents = gen;
+ if (d->m_generateTangents)
+ addAttribute(d->m_tangentAttribute);
+ emit generateTangentsChanged(gen);
+ }
+}
+
+/*!
+ * \property QSphereGeometry::generateTangents
+ *
+ * Holds the value of the automatic tangent generation flag.
+ */
+bool QSphereGeometry::generateTangents() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_generateTangents;
+}
+
+/*!
+ * \property QSphereGeometry::rings
+ *
+ * Holds the number of rings in the sphere.
+ */
+int QSphereGeometry::rings() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_rings;
+}
+
+/*!
+ * \property QSphereGeometry::slices
+ *
+ * Holds the number of slices in the sphere.
+ */
+int QSphereGeometry::slices() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_slices;
+}
+
+/*!
+ * \property QSphereGeometry::radius
+ *
+ * Holds the radius of the sphere.
+ */
+float QSphereGeometry::radius() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_radius;
+}
+
+/*!
+ * \property QSphereGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+QAttribute *QSphereGeometry::positionAttribute() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_positionAttribute;
+}
+
+/*!
+ * \property QSphereGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+QAttribute *QSphereGeometry::normalAttribute() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_normalAttribute;
+}
+
+/*!
+ * \property QSphereGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+QAttribute *QSphereGeometry::texCoordAttribute() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_texCoordAttribute;
+}
+
+/*!
+ * \property QSphereGeometry::tangentAttribute
+ *
+ * Holds the geometry tangent attribute.
+ */
+QAttribute *QSphereGeometry::tangentAttribute() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_tangentAttribute;
+}
+
+/*!
+ * \property QSphereGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+QAttribute *QSphereGeometry::indexAttribute() const
+{
+ Q_D(const QSphereGeometry);
+ return d->m_indexAttribute;
+}
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
diff --git a/src/extras/geometries/qspheregeometry.h b/src/extras/geometries/qspheregeometry.h
new file mode 100644
index 000000000..d657c0c67
--- /dev/null
+++ b/src/extras/geometries/qspheregeometry.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QSPHEREGEOMETRY_H
+#define QT3DEXTRAS_QSPHEREGEOMETRY_H
+
+#include <Qt3DRender/qgeometry.h>
+#include <Qt3DExtras/qt3dextras_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+
+} // Qt3DRender
+
+namespace Qt3DExtras {
+
+class QSphereGeometryPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QSphereGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+ Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
+ Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+ Q_PROPERTY(bool generateTangents READ generateTangents WRITE setGenerateTangents NOTIFY generateTangentsChanged)
+ Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *tangentAttribute READ tangentAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
+
+public:
+ explicit QSphereGeometry(QNode *parent = nullptr);
+ ~QSphereGeometry();
+
+ void updateVertices();
+ void updateIndices();
+
+ bool generateTangents() const;
+ int rings() const;
+ int slices() const;
+ float radius() const;
+
+ Qt3DRender::QAttribute *positionAttribute() const;
+ Qt3DRender::QAttribute *normalAttribute() const;
+ Qt3DRender::QAttribute *texCoordAttribute() const;
+ Qt3DRender::QAttribute *tangentAttribute() const;
+ Qt3DRender::QAttribute *indexAttribute() const;
+
+public Q_SLOTS:
+ void setRings(int rings);
+ void setSlices(int slices);
+ void setRadius(float radius);
+ void setGenerateTangents(bool gen);
+
+Q_SIGNALS:
+ void radiusChanged(float radius);
+ void ringsChanged(int rings);
+ void slicesChanged(int slices);
+ void generateTangentsChanged(bool generateTangents);
+
+protected:
+ QSphereGeometry(QSphereGeometryPrivate &dd, QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QSphereGeometry)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QSPHEREGEOMETRY_H
diff --git a/src/extras/geometries/qspheregeometry_p.h b/src/extras/geometries/qspheregeometry_p.h
new file mode 100644
index 000000000..dc96766e1
--- /dev/null
+++ b/src/extras/geometries/qspheregeometry_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QSPHEREGEOMETRY_P_H
+#define QT3DEXTRAS_QSPHEREGEOMETRY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qgeometry_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+class QBuffer;
+
+} // Qt3DRender
+
+namespace Qt3DExtras {
+
+class QSphereGeometryPrivate : public Qt3DRender::QGeometryPrivate
+{
+public:
+ QSphereGeometryPrivate();
+ void init();
+
+ bool m_generateTangents;
+ int m_rings;
+ int m_slices;
+ float m_radius;
+ Qt3DRender::QAttribute *m_positionAttribute;
+ Qt3DRender::QAttribute *m_normalAttribute;
+ Qt3DRender::QAttribute *m_texCoordAttribute;
+ Qt3DRender::QAttribute *m_tangentAttribute;
+ Qt3DRender::QAttribute *m_indexAttribute;
+ Qt3DRender::QBuffer *m_vertexBuffer;
+ Qt3DRender::QBuffer *m_indexBuffer;
+
+ Q_DECLARE_PUBLIC(QSphereGeometry);
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif //QT3DEXTRAS_QSPHEREGEOMETRY_P_H
+
diff --git a/src/extras/geometries/qspheremesh.cpp b/src/extras/geometries/qspheremesh.cpp
new file mode 100644
index 000000000..205f6437f
--- /dev/null
+++ b/src/extras/geometries/qspheremesh.cpp
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qspheremesh.h"
+#include "qspheregeometry.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+/*!
+ * \qmltype SphereMesh
+ * \instantiates Qt3DRender::QSphereMesh
+ * \inqmlmodule Qt3D.Render
+ * \brief A spherical mesh.
+ */
+
+/*!
+ * \qmlproperty int SphereMesh::rings
+ *
+ * Holds the number of rings in the mesh.
+ */
+
+/*!
+ * \qmlproperty int SphereMesh::slices
+ *
+ * Holds the number of slices in the mesh.
+ */
+
+/*!
+ * \qmlproperty float SphereMesh::radius
+ *
+ * Holds the radius of the sphere.
+ */
+
+/*!
+ * \qmlproperty bool SphereMesh::generateTangents
+ *
+ * Holds the value of the automatic tangent generation flag.
+ */
+
+/*!
+ * \class Qt3DRender::QSphereMesh
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometryRenderer
+ *
+ * \brief A spherical mesh.
+ */
+
+/*!
+ * Constructs a new QSphereMesh with \a parent.
+ */
+QSphereMesh::QSphereMesh(QNode *parent)
+ : QGeometryRenderer(parent)
+{
+ QSphereGeometry *geometry = new QSphereGeometry(this);
+ QObject::connect(geometry, &QSphereGeometry::radiusChanged, this, &QSphereMesh::radiusChanged);
+ QObject::connect(geometry, &QSphereGeometry::ringsChanged, this, &QSphereMesh::ringsChanged);
+ QObject::connect(geometry, &QSphereGeometry::slicesChanged, this, &QSphereMesh::slicesChanged);
+ QObject::connect(geometry, &QSphereGeometry::generateTangentsChanged, this, &QSphereMesh::generateTangentsChanged);
+ QGeometryRenderer::setGeometry(geometry);
+}
+
+/*! \internal */
+QSphereMesh::~QSphereMesh()
+{
+}
+
+void QSphereMesh::setRings(int rings)
+{
+ static_cast<QSphereGeometry *>(geometry())->setRings(rings);
+}
+
+void QSphereMesh::setSlices(int slices)
+{
+ static_cast<QSphereGeometry *>(geometry())->setSlices(slices);
+}
+
+void QSphereMesh::setRadius(float radius)
+{
+ static_cast<QSphereGeometry *>(geometry())->setRadius(radius);
+}
+
+void QSphereMesh::setGenerateTangents(bool gen)
+{
+ static_cast<QSphereGeometry *>(geometry())->setGenerateTangents(gen);
+}
+
+/*!
+ * \property QSphereMesh::generateTangents
+ *
+ * Holds the value of the automatic tangent generation flag.
+ */
+bool QSphereMesh::generateTangents() const
+{
+ return static_cast<QSphereGeometry *>(geometry())->generateTangents();
+}
+
+/*!
+ * \property QSphereMesh::rings
+ *
+ * Holds the number of rings in the mesh.
+ */
+int QSphereMesh::rings() const
+{
+ return static_cast<QSphereGeometry *>(geometry())->rings();
+}
+
+/*!
+ * \property QSphereMesh::slices
+ *
+ * Holds the number of slices in the mesh.
+ */
+int QSphereMesh::slices() const
+{
+ return static_cast<QSphereGeometry *>(geometry())->slices();
+}
+
+/*!
+ * \property QSphereMesh::radius
+ *
+ * Holds the radius of the sphere.
+ */
+float QSphereMesh::radius() const
+{
+ return static_cast<QSphereGeometry *>(geometry())->radius();
+}
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qspheremesh.h b/src/extras/geometries/qspheremesh.h
new file mode 100644
index 000000000..58e77dcab
--- /dev/null
+++ b/src/extras/geometries/qspheremesh.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QSPHEREMESH_H
+#define QT3DEXTRAS_QSPHEREMESH_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometryrenderer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QSphereMeshPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QSphereMesh : public Qt3DRender::QGeometryRenderer
+{
+ Q_OBJECT
+ Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
+ Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+ Q_PROPERTY(bool generateTangents READ generateTangents WRITE setGenerateTangents NOTIFY generateTangentsChanged)
+
+public:
+ explicit QSphereMesh(Qt3DCore::QNode *parent = nullptr);
+ ~QSphereMesh();
+
+ int rings() const;
+ int slices() const;
+ float radius() const;
+ bool generateTangents() const;
+
+public Q_SLOTS:
+ void setRings(int rings);
+ void setSlices(int slices);
+ void setRadius(float radius);
+ void setGenerateTangents(bool gen);
+
+Q_SIGNALS:
+ void radiusChanged(float radius);
+ void ringsChanged(int rings);
+ void slicesChanged(int slices);
+ void generateTangentsChanged(bool generateTangents);
+
+private:
+ // As this is a default provided geometry renderer, no one should be able
+ // to modify the QGeometryRenderer's properties
+
+ void setVertexCount(int vertexCount);
+ void setIndexOffset(int indexOffset);
+ void setFirstInstance(int firstInstance);
+ void setRestartIndexValue(int index);
+ void setPrimitiveRestartEnabled(bool enabled);
+ void setGeometry(Qt3DRender::QGeometry *geometry);
+ void setPrimitiveType(PrimitiveType primitiveType);
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QSPHEREMESH_H
diff --git a/src/extras/geometries/qtorusgeometry.cpp b/src/extras/geometries/qtorusgeometry.cpp
new file mode 100644
index 000000000..5ca8c3ce1
--- /dev/null
+++ b/src/extras/geometries/qtorusgeometry.cpp
@@ -0,0 +1,510 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtorusgeometry.h"
+#include "qtorusgeometry_p.h"
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/qattribute.h>
+#include <qmath.h>
+#include <QVector3D>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DRender;
+
+namespace Qt3DExtras {
+
+namespace {
+
+QByteArray createTorusVertexData(double radius, double minorRadius,
+ int rings, int sides)
+{
+ const int nVerts = sides * (rings + 1);
+ QByteArray bufferBytes;
+ // vec3 pos, vec2 texCoord, vec3 normal
+ const quint32 elementSize = 3 + 2 + 3;
+ const quint32 stride = elementSize * sizeof(float);
+ bufferBytes.resize(stride * nVerts);
+
+ float* fptr = reinterpret_cast<float*>(bufferBytes.data());
+
+ const float ringFactor = (M_PI * 2) / static_cast<float>( rings );
+ const float sideFactor = (M_PI * 2) / static_cast<float>( sides );
+
+ for (int ring = 0; ring <= rings; ++ring) {
+ const float u = ring * ringFactor;
+ const float cu = qCos( u );
+ const float su = qSin( u );
+
+ for (int side = 0; side < sides; ++side) {
+ const float v = side * sideFactor;
+ const float cv = qCos( v );
+ const float sv = qSin( v );
+ const float r = (radius + minorRadius * cv);
+
+ *fptr++ = r * cu;
+ *fptr++ = r * su;
+ *fptr++ = minorRadius * sv;
+
+ *fptr++ = u / (M_PI * 2);
+ *fptr++ = v / (M_PI * 2);
+
+ QVector3D n(cv * cu * r, cv * su * r, sv * r);
+ n.normalize();
+ *fptr++ = n.x();
+ *fptr++ = n.y();
+ *fptr++ = n.z();
+ }
+ }
+
+ return bufferBytes;
+}
+
+QByteArray createTorusIndexData(int rings, int sides)
+{
+ QByteArray indexBytes;
+ int faces = (sides * 2) * rings; // two tris per side, for all rings
+ int indices = faces * 3;
+ Q_ASSERT(indices < 65536);
+ indexBytes.resize(indices * sizeof(quint16));
+ quint16* indexPtr = reinterpret_cast<quint16*>(indexBytes.data());
+
+ for (int ring = 0; ring < rings; ++ring) {
+ const int ringStart = ring * sides;
+ const int nextRingStart = (ring + 1) * sides;
+ for (int side = 0; side < sides; ++side) {
+ const int nextSide = (side + 1) % sides;
+ *indexPtr++ = (ringStart + side);
+ *indexPtr++ = (nextRingStart + side);
+ *indexPtr++ = (nextRingStart + nextSide);
+ *indexPtr++ = ringStart + side;
+ *indexPtr++ = nextRingStart + nextSide;
+ *indexPtr++ = (ringStart + nextSide);
+ }
+ }
+
+ return indexBytes;
+}
+
+} // anonymous
+
+class TorusVertexDataFunctor : public QBufferDataGenerator
+{
+public:
+ TorusVertexDataFunctor(int rings, int slices, float radius, float minorRadius)
+ : m_rings(rings)
+ , m_sides(slices)
+ , m_radius(radius)
+ , m_minorRadius(minorRadius)
+ {
+ }
+
+ QByteArray operator ()() Q_DECL_OVERRIDE
+ {
+ return createTorusVertexData(m_radius, m_minorRadius, m_rings, m_sides);
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
+ {
+ const TorusVertexDataFunctor *otherFunctor = functor_cast<TorusVertexDataFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_rings == m_rings &&
+ otherFunctor->m_sides == m_sides &&
+ otherFunctor->m_radius == m_radius &&
+ otherFunctor->m_minorRadius == m_minorRadius);
+ return false;
+ }
+
+ QT3D_FUNCTOR(TorusVertexDataFunctor)
+
+private:
+ int m_rings;
+ int m_sides;
+ float m_radius;
+ float m_minorRadius;
+};
+
+class TorusIndexDataFunctor : public QBufferDataGenerator
+{
+public:
+ TorusIndexDataFunctor(int rings, int slices)
+ : m_rings(rings)
+ , m_sides(slices)
+ {
+ }
+
+ QByteArray operator ()() Q_DECL_OVERRIDE
+ {
+ return createTorusIndexData(m_rings, m_sides);
+ }
+
+ bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
+ {
+ const TorusIndexDataFunctor *otherFunctor = functor_cast<TorusIndexDataFunctor>(&other);
+ if (otherFunctor != nullptr)
+ return (otherFunctor->m_rings == m_rings &&
+ otherFunctor->m_sides == m_sides);
+ return false;
+ }
+
+ QT3D_FUNCTOR(TorusIndexDataFunctor)
+
+private:
+ int m_rings;
+ int m_sides;
+};
+
+QTorusGeometryPrivate::QTorusGeometryPrivate()
+ : QGeometryPrivate()
+ , m_rings(16)
+ , m_slices(16)
+ , m_radius(1.0f)
+ , m_minorRadius(1.0f)
+ , m_positionAttribute(nullptr)
+ , m_normalAttribute(nullptr)
+ , m_texCoordAttribute(nullptr)
+ , m_indexAttribute(nullptr)
+ , m_vertexBuffer(nullptr)
+ , m_indexBuffer(nullptr)
+{
+}
+
+void QTorusGeometryPrivate::init()
+{
+ Q_Q(QTorusGeometry);
+ m_positionAttribute = new QAttribute(q);
+ m_normalAttribute = new QAttribute(q);
+ m_texCoordAttribute = new QAttribute(q);
+ m_indexAttribute = new QAttribute(q);
+ m_vertexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, q);
+ m_indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, q);
+ // vec3 pos, vec2 tex, vec3 normal
+ const quint32 elementSize = 3 + 2 + 3;
+ const quint32 stride = elementSize * sizeof(float);
+ const int nVerts = (m_slices + 1) * (m_rings + 1);
+ const int faces = (m_slices * 2) * m_rings;
+
+ m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
+ m_positionAttribute->setDataType(QAttribute::Float);
+ m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_positionAttribute->setBuffer(m_vertexBuffer);
+ m_positionAttribute->setByteStride(stride);
+ m_positionAttribute->setCount(nVerts);
+
+ m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
+ m_texCoordAttribute->setDataType(QAttribute::Float);
+ m_texCoordAttribute->setDataSize(2);
+ m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_texCoordAttribute->setBuffer(m_vertexBuffer);
+ m_texCoordAttribute->setByteStride(stride);
+ m_texCoordAttribute->setByteOffset(3 * sizeof(float));
+ m_texCoordAttribute->setCount(nVerts);
+
+ m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
+ m_normalAttribute->setDataType(QAttribute::Float);
+ m_normalAttribute->setDataSize(3);
+ m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_normalAttribute->setBuffer(m_vertexBuffer);
+ m_normalAttribute->setByteStride(stride);
+ m_normalAttribute->setByteOffset(5 * sizeof(float));
+ m_normalAttribute->setCount(nVerts);
+
+ m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
+ m_indexAttribute->setDataType(QAttribute::UnsignedShort);
+ m_indexAttribute->setBuffer(m_indexBuffer);
+
+ m_indexAttribute->setCount(faces * 3);
+
+ m_vertexBuffer->setDataGenerator(QSharedPointer<TorusVertexDataFunctor>::create(m_rings, m_slices, m_radius, m_minorRadius));
+ m_indexBuffer->setDataGenerator(QSharedPointer<TorusIndexDataFunctor>::create(m_rings, m_slices));
+
+ q->addAttribute(m_positionAttribute);
+ q->addAttribute(m_texCoordAttribute);
+ q->addAttribute(m_normalAttribute);
+ q->addAttribute(m_indexAttribute);
+}
+
+/*!
+ * \qmltype TorusGeometry
+ * \instantiates Qt3DRender::QTorusGeometry
+ * \inqmlmodule Qt3D.Render
+ */
+
+/*!
+ * \qmlproperty int TorusGeometry::rings
+ *
+ * Holds the number of rings in the torus.
+ */
+
+/*!
+ * \qmlproperty int TorusGeometry::slices
+ *
+ * Holds the number of slices in the torus.
+ */
+
+/*!
+ * \qmlproperty float TorusGeometry::radius
+ *
+ * Holds the outer radius of the torus.
+ */
+
+/*!
+ * \qmlproperty float TorusGeometry::minorRadius
+ *
+ * Holds the inner radius of the torus.
+ */
+
+/*!
+ * \qmlproperty Attribute TorusGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute TorusGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute TorusGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+
+/*!
+ * \qmlproperty Attribute TorusGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+
+/*!
+ * \class Qt3DRender::QTorusGeometry
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometry
+ */
+
+/*!
+ * Constructs a new QTorusGeometry with \a parent.
+ */
+QTorusGeometry::QTorusGeometry(QNode *parent)
+ : QGeometry(*new QTorusGeometryPrivate(), parent)
+{
+ Q_D(QTorusGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QTorusGeometry::QTorusGeometry(QTorusGeometryPrivate &dd, QNode *parent)
+ : QGeometry(dd, parent)
+{
+ Q_D(QTorusGeometry);
+ d->init();
+}
+
+/*!
+ * \internal
+ */
+QTorusGeometry::~QTorusGeometry()
+{
+}
+
+/*!
+ * Updates vertices based on rings and slices.
+ */
+void QTorusGeometry::updateVertices()
+{
+ Q_D(QTorusGeometry);
+ const int nVerts = d->m_slices * (d->m_rings + 1);
+ d->m_positionAttribute->setCount(nVerts);
+ d->m_texCoordAttribute->setCount(nVerts);
+ d->m_normalAttribute->setCount(nVerts);
+ d->m_vertexBuffer->setDataGenerator(QSharedPointer<TorusVertexDataFunctor>::create(d->m_rings, d->m_slices, d->m_radius, d->m_minorRadius));
+}
+
+/*!
+ * Updates indices based on rings and slices.
+ */
+void QTorusGeometry::updateIndices()
+{
+ Q_D(QTorusGeometry);
+ const int faces = (d->m_slices * 2) * d->m_rings;
+ d->m_indexAttribute->setCount(faces * 3);
+ d->m_indexBuffer->setDataGenerator(QSharedPointer<TorusIndexDataFunctor>::create(d->m_rings, d->m_slices));
+
+}
+
+void QTorusGeometry::setRings(int rings)
+{
+ Q_D(QTorusGeometry);
+ if (rings != d->m_rings) {
+ d->m_rings = rings;
+ updateVertices();
+ updateIndices();
+ emit ringsChanged(rings);
+ }
+}
+
+void QTorusGeometry::setSlices(int slices)
+{
+ Q_D(QTorusGeometry);
+ if (slices != d->m_slices) {
+ d->m_slices = slices;
+ updateVertices();
+ updateIndices();
+ emit slicesChanged(slices);
+ }
+}
+
+void QTorusGeometry::setRadius(float radius)
+{
+ Q_D(QTorusGeometry);
+ if (radius != d->m_radius) {
+ d->m_radius = radius;
+ updateVertices();
+ emit radiusChanged(radius);
+ }
+}
+
+void QTorusGeometry::setMinorRadius(float minorRadius)
+{
+ Q_D(QTorusGeometry);
+ if (minorRadius != d->m_minorRadius) {
+ d->m_minorRadius = minorRadius;
+ updateVertices();
+ emit minorRadiusChanged(minorRadius);
+ }
+}
+
+/*!
+ * \property QTorusGeometry::rings
+ *
+ * Holds the number of rings in the torus.
+ */
+int QTorusGeometry::rings() const
+{
+ Q_D(const QTorusGeometry);
+ return d->m_rings;
+}
+
+/*!
+ * \property QTorusGeometry::slices
+ *
+ * Holds the number of slices in the torus.
+ */
+int QTorusGeometry::slices() const
+{
+ Q_D(const QTorusGeometry);
+ return d->m_slices;
+}
+
+/*!
+ * \property QTorusGeometry::radius
+ *
+ * Holds the outer radius of the torus.
+ */
+float QTorusGeometry::radius() const
+{
+ Q_D(const QTorusGeometry);
+ return d->m_radius;
+}
+
+/*!
+ * \property QTorusGeometry::minorRadius
+ *
+ * Holds the inner radius of the torus.
+ */
+float QTorusGeometry::minorRadius() const
+{
+ Q_D(const QTorusGeometry);
+ return d->m_minorRadius;
+}
+
+/*!
+ * \property QTorusGeometry::positionAttribute
+ *
+ * Holds the geometry position attribute.
+ */
+QAttribute *QTorusGeometry::positionAttribute() const
+{
+ Q_D(const QTorusGeometry);
+ return d->m_positionAttribute;
+}
+
+/*!
+ * \property QTorusGeometry::normalAttribute
+ *
+ * Holds the geometry normal attribute.
+ */
+QAttribute *QTorusGeometry::normalAttribute() const
+{
+ Q_D(const QTorusGeometry);
+ return d->m_normalAttribute;
+}
+
+/*!
+ * \property QTorusGeometry::texCoordAttribute
+ *
+ * Holds the geometry texture coordinate attribute.
+ */
+QAttribute *QTorusGeometry::texCoordAttribute() const
+{
+ Q_D(const QTorusGeometry);
+ return d->m_texCoordAttribute;
+}
+
+/*!
+ * \property QTorusGeometry::indexAttribute
+ *
+ * Holds the geometry index attribute.
+ */
+QAttribute *QTorusGeometry::indexAttribute() const
+{
+ Q_D(const QTorusGeometry);
+ return d->m_indexAttribute;
+}
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qtorusgeometry.h b/src/extras/geometries/qtorusgeometry.h
new file mode 100644
index 000000000..ebde32bd8
--- /dev/null
+++ b/src/extras/geometries/qtorusgeometry.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QTORUSGEOMETRY_H
+#define QT3DEXTRAS_QTORUSGEOMETRY_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometry.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+
+} // Qt3DRender
+
+namespace Qt3DExtras {
+
+class QTorusGeometryPrivate;
+
+class QT3DEXTRASSHARED_EXPORT QTorusGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+ Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
+ Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+ Q_PROPERTY(float minorRadius READ minorRadius WRITE setMinorRadius NOTIFY minorRadiusChanged)
+ Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
+
+public:
+ explicit QTorusGeometry(QNode *parent = nullptr);
+ ~QTorusGeometry();
+
+ void updateVertices();
+ void updateIndices();
+
+ int rings() const;
+ int slices() const;
+ float radius() const;
+ float minorRadius() const;
+
+ Qt3DRender::QAttribute *positionAttribute() const;
+ Qt3DRender::QAttribute *normalAttribute() const;
+ Qt3DRender::QAttribute *texCoordAttribute() const;
+ Qt3DRender::QAttribute *indexAttribute() const;
+
+public Q_SLOTS:
+ void setRings(int rings);
+ void setSlices(int slices);
+ void setRadius(float radius);
+ void setMinorRadius(float minorRadius);
+
+Q_SIGNALS:
+ void radiusChanged(float radius);
+ void ringsChanged(int rings);
+ void slicesChanged(int slices);
+ void minorRadiusChanged(float minorRadius);
+
+
+protected:
+ QTorusGeometry(QTorusGeometryPrivate &dd, QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QTorusGeometry)
+};
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QTORUSGEOMETRY_H
diff --git a/src/extras/geometries/qtorusgeometry_p.h b/src/extras/geometries/qtorusgeometry_p.h
new file mode 100644
index 000000000..b4bcbde9f
--- /dev/null
+++ b/src/extras/geometries/qtorusgeometry_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QTORUSGEOMETRY_P_H
+#define QT3DEXTRAS_QTORUSGEOMETRY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qgeometry_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAttribute;
+class QBuffer;
+
+} // Qt3DRender
+
+namespace Qt3DExtras {
+
+class QTorusGeometryPrivate : public Qt3DRender::QGeometryPrivate
+{
+public:
+ QTorusGeometryPrivate();
+ void init();
+
+ int m_rings;
+ int m_slices;
+ float m_radius;
+ float m_minorRadius;
+ Qt3DRender::QAttribute *m_positionAttribute;
+ Qt3DRender::QAttribute *m_normalAttribute;
+ Qt3DRender::QAttribute *m_texCoordAttribute;
+ Qt3DRender::QAttribute *m_indexAttribute;
+ Qt3DRender::QBuffer *m_vertexBuffer;
+ Qt3DRender::QBuffer *m_indexBuffer;
+
+ Q_DECLARE_PUBLIC(QTorusGeometry)
+};
+
+} // Qt3DExtras
+
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QTORUSGEOMETRY_P_H
+
diff --git a/src/extras/geometries/qtorusmesh.cpp b/src/extras/geometries/qtorusmesh.cpp
new file mode 100644
index 000000000..e3b5b61d0
--- /dev/null
+++ b/src/extras/geometries/qtorusmesh.cpp
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef _USE_MATH_DEFINES
+# define _USE_MATH_DEFINES // For MSVC
+#endif
+
+#include "qtorusmesh.h"
+#include "qtorusgeometry.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+/*!
+ * \qmltype TorusMesh
+ * \instantiates Qt3DRender::QTorusMesh
+ * \inqmlmodule Qt3D.Render
+ * \brief A custom mesh.
+ */
+
+/*!
+ * \qmlproperty int TorusMesh::rings
+ *
+ * Holds the number of rings in the mesh.
+ */
+
+/*!
+ * \qmlproperty int TorusMesh::slices
+ *
+ * Holds the number of slices in the mesh.
+ */
+
+/*!
+ * \qmlproperty float TorusMesh::radius
+ *
+ * Holds the outer radius of the torus.
+ */
+
+/*!
+ * \qmlproperty float TorusMesh::minorRadius
+ *
+ * Holds the inner radius of the torus.
+ */
+
+/*!
+ * \class Qt3DRender::QTorusMesh
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DRender::QGeometryRenderer
+ *
+ * \brief A custom mesh.
+ */
+
+/*!
+ * Constructs a new QTorusMesh with \a parent.
+ */
+QTorusMesh::QTorusMesh(QNode *parent)
+ : QGeometryRenderer(parent)
+{
+ QTorusGeometry *geometry = new QTorusGeometry(this);
+ QObject::connect(geometry, &QTorusGeometry::radiusChanged, this, &QTorusMesh::radiusChanged);
+ QObject::connect(geometry, &QTorusGeometry::ringsChanged, this, &QTorusMesh::ringsChanged);
+ QObject::connect(geometry, &QTorusGeometry::slicesChanged, this, &QTorusMesh::slicesChanged);
+ QObject::connect(geometry, &QTorusGeometry::minorRadiusChanged, this, &QTorusMesh::minorRadiusChanged);
+
+ QGeometryRenderer::setGeometry(geometry);
+}
+
+/*! \internal */
+QTorusMesh::~QTorusMesh()
+{
+}
+
+void QTorusMesh::setRings(int rings)
+{
+ static_cast<QTorusGeometry *>(geometry())->setRings(rings);
+}
+
+void QTorusMesh::setSlices(int slices)
+{
+ static_cast<QTorusGeometry *>(geometry())->setSlices(slices);
+}
+
+void QTorusMesh::setRadius(float radius)
+{
+ static_cast<QTorusGeometry *>(geometry())->setRadius(radius);
+}
+
+void QTorusMesh::setMinorRadius(float minorRadius)
+{
+ static_cast<QTorusGeometry *>(geometry())->setMinorRadius(minorRadius);
+}
+
+/*!
+ * \property QTorusMesh::rings
+ *
+ * Holds the number of rings in the mesh.
+ */
+int QTorusMesh::rings() const
+{
+ return static_cast<QTorusGeometry *>(geometry())->rings();
+}
+
+/*!
+ * \property QTorusMesh::slices
+ *
+ * Holds the number of slices in the mesh.
+ */
+int QTorusMesh::slices() const
+{
+ return static_cast<QTorusGeometry *>(geometry())->slices();
+}
+
+/*!
+ * \property QTorusMesh::radius
+ *
+ * Holds the outer radius of the torus.
+ */
+float QTorusMesh::radius() const
+{
+ return static_cast<QTorusGeometry *>(geometry())->radius();
+}
+
+/*!
+ * \property QTorusMesh::minorRadius
+ *
+ * Holds the inner radius of the torus.
+ */
+float QTorusMesh::minorRadius() const
+{
+ return static_cast<QTorusGeometry *>(geometry())->minorRadius();
+}
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/extras/geometries/qtorusmesh.h b/src/extras/geometries/qtorusmesh.h
new file mode 100644
index 000000000..69ad00efe
--- /dev/null
+++ b/src/extras/geometries/qtorusmesh.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QTORUSMESH_H
+#define QT3DEXTRAS_QTORUSMESH_H
+
+#include <Qt3DExtras/qt3dextras_global.h>
+#include <Qt3DRender/qgeometryrenderer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+class QT3DEXTRASSHARED_EXPORT QTorusMesh : public Qt3DRender::QGeometryRenderer
+{
+ Q_OBJECT
+ Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
+ Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+ Q_PROPERTY(float minorRadius READ minorRadius WRITE setMinorRadius NOTIFY minorRadiusChanged)
+public:
+ explicit QTorusMesh(Qt3DCore::QNode *parent = nullptr);
+ ~QTorusMesh();
+
+ int rings() const;
+ int slices() const;
+ float radius() const;
+ float minorRadius() const;
+
+public Q_SLOTS:
+ void setRings(int rings);
+ void setSlices(int slices);
+ void setRadius(float radius);
+ void setMinorRadius(float minorRadius);
+
+Q_SIGNALS:
+ void radiusChanged(float radius);
+ void ringsChanged(int rings);
+ void slicesChanged(int slices);
+ void minorRadiusChanged(float minorRadius);
+
+private:
+ // As this is a default provided geometry renderer, no one should be able
+ // to modify the QGeometryRenderer's properties
+
+ void setInstanceCount(int instanceCount);
+ void setVertexCount(int vertexCount);
+ void setIndexOffset(int indexOffset);
+ void setFirstInstance(int firstInstance);
+ void setRestartIndexValue(int index);
+ void setPrimitiveRestartEnabled(bool enabled);
+ void setGeometry(Qt3DRender::QGeometry *geometry);
+ void setPrimitiveType(PrimitiveType primitiveType);
+};
+
+} // namespace Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QTORUSMESH_H
diff --git a/src/extras/qt3dextras_global.h b/src/extras/qt3dextras_global.h
new file mode 100644
index 000000000..ee2111bcc
--- /dev/null
+++ b/src/extras/qt3dextras_global.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_GLOBAL_H
+#define QT3DEXTRAS_GLOBAL_H
+
+#include <Qt3DCore/qt3dcore_global.h>
+
+QT_BEGIN_NAMESPACE
+
+#if defined(QT_SHARED) || !defined(QT_STATIC)
+# if defined(QT3DEXTRAS_LIBRARY)
+# define QT3DEXTRASSHARED_EXPORT Q_DECL_EXPORT
+# else
+# define QT3DEXTRASSHARED_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define QT3DEXTRASSHARED_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_GLOBAL_H
diff --git a/src/render/shaders/es2/diffusemap.frag b/src/extras/shaders/es2/diffusemap.frag
index 7d06d8e2c..7d06d8e2c 100644
--- a/src/render/shaders/es2/diffusemap.frag
+++ b/src/extras/shaders/es2/diffusemap.frag
diff --git a/src/render/shaders/es2/diffusemap.vert b/src/extras/shaders/es2/diffusemap.vert
index 13798279e..13798279e 100644
--- a/src/render/shaders/es2/diffusemap.vert
+++ b/src/extras/shaders/es2/diffusemap.vert
diff --git a/src/render/shaders/es2/diffusespecularmap.frag b/src/extras/shaders/es2/diffusespecularmap.frag
index 4d776772c..4d776772c 100644
--- a/src/render/shaders/es2/diffusespecularmap.frag
+++ b/src/extras/shaders/es2/diffusespecularmap.frag
diff --git a/src/render/shaders/es2/gooch.frag b/src/extras/shaders/es2/gooch.frag
index 622aaf0b4..622aaf0b4 100644
--- a/src/render/shaders/es2/gooch.frag
+++ b/src/extras/shaders/es2/gooch.frag
diff --git a/src/render/shaders/es2/gooch.vert b/src/extras/shaders/es2/gooch.vert
index dd162a66b..dd162a66b 100644
--- a/src/render/shaders/es2/gooch.vert
+++ b/src/extras/shaders/es2/gooch.vert
diff --git a/src/extras/shaders/es2/light.inc.frag b/src/extras/shaders/es2/light.inc.frag
new file mode 100644
index 000000000..cdec536cf
--- /dev/null
+++ b/src/extras/shaders/es2/light.inc.frag
@@ -0,0 +1,131 @@
+const int MAX_LIGHTS = 8;
+const int TYPE_POINT = 0;
+const int TYPE_DIRECTIONAL = 1;
+const int TYPE_SPOT = 2;
+struct Light {
+ int type;
+ FP vec3 position;
+ FP vec3 color;
+ FP float intensity;
+ FP vec3 direction;
+ FP vec3 attenuation;
+ FP float cutOffAngle;
+};
+uniform Light lights[MAX_LIGHTS];
+uniform int lightCount;
+
+void adsModelNormalMapped(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess,
+ const in FP mat3 tangentMatrix,
+ out FP vec3 diffuseColor, out FP vec3 specularColor)
+{
+ diffuseColor = vec3(0.0);
+ specularColor = vec3(0.0);
+
+ FP vec3 n = normalize( vnormal );
+
+ int i;
+ FP vec3 s;
+ for (i = 0; i < lightCount; ++i) {
+ FP float att = 1.0;
+ if ( lights[i].type != TYPE_DIRECTIONAL ) {
+ s = tangentMatrix * ( lights[i].position - vpos );
+ if (length( lights[i].attenuation ) != 0.0) {
+ FP float dist = length(s);
+ att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
+ }
+ s = normalize( s );
+ if ( lights[i].type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
+ att = 0.0;
+ }
+ } else {
+ s = normalize( tangentMatrix * -lights[i].direction );
+ }
+
+ FP float diffuse = max( dot( s, n ), 0.0 );
+
+ FP float specular = 0.0;
+ if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
+ FP vec3 r = reflect( -s, n );
+ FP vec3 v = normalize( tangentMatrix * ( eye - vpos ) );
+ FP float normFactor = ( shininess + 2.0 ) / 2.0;
+ specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
+ }
+
+ diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
+ specularColor += att * lights[i].intensity * specular * lights[i].color;
+ }
+}
+
+void adsModel(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess,
+ out FP vec3 diffuseColor, out FP vec3 specularColor)
+{
+ diffuseColor = vec3(0.0);
+ specularColor = vec3(0.0);
+
+ FP vec3 n = normalize( vnormal );
+
+ int i;
+ FP vec3 s;
+ for (i = 0; i < lightCount; ++i) {
+ FP float att = 1.0;
+ if ( lights[i].type != TYPE_DIRECTIONAL ) {
+ s = lights[i].position - vpos;
+ if (length( lights[i].attenuation ) != 0.0) {
+ FP float dist = length(s);
+ att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
+ }
+ s = normalize( s );
+ if ( lights[i].type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
+ att = 0.0;
+ }
+ } else {
+ s = normalize( -lights[i].direction );
+ }
+
+ FP float diffuse = max( dot( s, n ), 0.0 );
+
+ FP float specular = 0.0;
+ if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
+ FP vec3 r = reflect( -s, n );
+ FP vec3 v = normalize( eye - vpos );
+ FP float normFactor = ( shininess + 2.0 ) / 2.0;
+ specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
+ }
+
+ diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
+ specularColor += att * lights[i].intensity * specular * lights[i].color;
+ }
+}
+
+void adModel(const in FP vec3 vpos, const in FP vec3 vnormal, out FP vec3 diffuseColor)
+{
+ diffuseColor = vec3(0.0);
+
+ FP vec3 n = normalize( vnormal );
+
+ int i;
+ FP vec3 s;
+ for (i = 0; i < lightCount; ++i) {
+ FP float att = 1.0;
+ if ( lights[i].type != TYPE_DIRECTIONAL ) {
+ s = lights[i].position - vpos;
+ if (length( lights[i].attenuation ) != 0.0) {
+ FP float dist = length(s);
+ att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
+ }
+ s = normalize( s );
+ if ( lights[i].type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
+ att = 0.0;
+ }
+ } else {
+ s = normalize( -lights[i].direction );
+ }
+
+ FP float diffuse = max( dot( s, n ), 0.0 );
+
+ diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
+ }
+}
diff --git a/src/render/shaders/es2/light.inc.frag100 b/src/extras/shaders/es2/light.inc.frag100
index b4988ad82..b4988ad82 100644
--- a/src/render/shaders/es2/light.inc.frag100
+++ b/src/extras/shaders/es2/light.inc.frag100
diff --git a/src/render/shaders/es2/normaldiffusemap.frag b/src/extras/shaders/es2/normaldiffusemap.frag
index c69aa8b81..c69aa8b81 100644
--- a/src/render/shaders/es2/normaldiffusemap.frag
+++ b/src/extras/shaders/es2/normaldiffusemap.frag
diff --git a/src/render/shaders/es2/normaldiffusemap.vert b/src/extras/shaders/es2/normaldiffusemap.vert
index ecc689f69..ecc689f69 100644
--- a/src/render/shaders/es2/normaldiffusemap.vert
+++ b/src/extras/shaders/es2/normaldiffusemap.vert
diff --git a/src/render/shaders/es2/normaldiffusemapalpha.frag b/src/extras/shaders/es2/normaldiffusemapalpha.frag
index 98acbf01d..98acbf01d 100644
--- a/src/render/shaders/es2/normaldiffusemapalpha.frag
+++ b/src/extras/shaders/es2/normaldiffusemapalpha.frag
diff --git a/src/render/shaders/es2/normaldiffusespecularmap.frag b/src/extras/shaders/es2/normaldiffusespecularmap.frag
index b30c1bd5f..b30c1bd5f 100644
--- a/src/render/shaders/es2/normaldiffusespecularmap.frag
+++ b/src/extras/shaders/es2/normaldiffusespecularmap.frag
diff --git a/src/render/shaders/es2/pervertexcolor.frag b/src/extras/shaders/es2/pervertexcolor.frag
index ab429d942..ab429d942 100644
--- a/src/render/shaders/es2/pervertexcolor.frag
+++ b/src/extras/shaders/es2/pervertexcolor.frag
diff --git a/src/render/shaders/es2/pervertexcolor.vert b/src/extras/shaders/es2/pervertexcolor.vert
index 7fc3e649f..7fc3e649f 100644
--- a/src/render/shaders/es2/pervertexcolor.vert
+++ b/src/extras/shaders/es2/pervertexcolor.vert
diff --git a/src/extras/shaders/es2/phong.frag b/src/extras/shaders/es2/phong.frag
new file mode 100644
index 000000000..c00f89db0
--- /dev/null
+++ b/src/extras/shaders/es2/phong.frag
@@ -0,0 +1,20 @@
+#define FP highp
+
+uniform FP vec3 ka; // Ambient reflectivity
+uniform FP vec3 kd; // Diffuse reflectivity
+uniform FP vec3 ks; // Specular reflectivity
+uniform FP float shininess; // Specular shininess factor
+
+uniform FP vec3 eyePosition;
+
+varying FP vec3 worldPosition;
+varying FP vec3 worldNormal;
+
+#pragma include light.inc.frag
+
+void main()
+{
+ FP vec3 diffuseColor, specularColor;
+ adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor);
+ gl_FragColor = vec4( ka + kd * diffuseColor + ks * specularColor, 1.0 );
+}
diff --git a/src/extras/shaders/es2/phong.vert b/src/extras/shaders/es2/phong.vert
new file mode 100644
index 000000000..2b4c51b14
--- /dev/null
+++ b/src/extras/shaders/es2/phong.vert
@@ -0,0 +1,17 @@
+attribute vec3 vertexPosition;
+attribute vec3 vertexNormal;
+
+varying vec3 worldPosition;
+varying vec3 worldNormal;
+
+uniform mat4 modelMatrix;
+uniform mat3 modelNormalMatrix;
+uniform mat4 modelViewProjection;
+
+void main()
+{
+ worldNormal = normalize( modelNormalMatrix * vertexNormal );
+ worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) );
+
+ gl_Position = modelViewProjection * vec4( vertexPosition, 1.0 );
+}
diff --git a/src/render/shaders/es2/phongalpha.frag b/src/extras/shaders/es2/phongalpha.frag
index c5ec43049..c5ec43049 100644
--- a/src/render/shaders/es2/phongalpha.frag
+++ b/src/extras/shaders/es2/phongalpha.frag
diff --git a/src/render/shaders/es2/skybox.frag b/src/extras/shaders/es2/skybox.frag
index 3de08be44..3de08be44 100644
--- a/src/render/shaders/es2/skybox.frag
+++ b/src/extras/shaders/es2/skybox.frag
diff --git a/src/render/shaders/es2/skybox.vert b/src/extras/shaders/es2/skybox.vert
index e2de1d88b..e2de1d88b 100644
--- a/src/render/shaders/es2/skybox.vert
+++ b/src/extras/shaders/es2/skybox.vert
diff --git a/src/render/shaders/es2/unlittexture.frag b/src/extras/shaders/es2/unlittexture.frag
index 66752ed32..66752ed32 100644
--- a/src/render/shaders/es2/unlittexture.frag
+++ b/src/extras/shaders/es2/unlittexture.frag
diff --git a/src/render/shaders/es2/unlittexture.vert b/src/extras/shaders/es2/unlittexture.vert
index 050b2b7e2..050b2b7e2 100644
--- a/src/render/shaders/es2/unlittexture.vert
+++ b/src/extras/shaders/es2/unlittexture.vert
diff --git a/src/render/shaders/gl3/diffusemap.frag b/src/extras/shaders/gl3/diffusemap.frag
index 7810fdb68..7810fdb68 100644
--- a/src/render/shaders/gl3/diffusemap.frag
+++ b/src/extras/shaders/gl3/diffusemap.frag
diff --git a/src/render/shaders/gl3/diffusemap.vert b/src/extras/shaders/gl3/diffusemap.vert
index 439be6e99..439be6e99 100644
--- a/src/render/shaders/gl3/diffusemap.vert
+++ b/src/extras/shaders/gl3/diffusemap.vert
diff --git a/src/render/shaders/gl3/diffusespecularmap.frag b/src/extras/shaders/gl3/diffusespecularmap.frag
index fb809393a..fb809393a 100644
--- a/src/render/shaders/gl3/diffusespecularmap.frag
+++ b/src/extras/shaders/gl3/diffusespecularmap.frag
diff --git a/src/render/shaders/gl3/gooch.frag b/src/extras/shaders/gl3/gooch.frag
index 1beab1c01..1beab1c01 100644
--- a/src/render/shaders/gl3/gooch.frag
+++ b/src/extras/shaders/gl3/gooch.frag
diff --git a/src/render/shaders/gl3/gooch.vert b/src/extras/shaders/gl3/gooch.vert
index 5230fb70e..5230fb70e 100644
--- a/src/render/shaders/gl3/gooch.vert
+++ b/src/extras/shaders/gl3/gooch.vert
diff --git a/src/extras/shaders/gl3/light.inc.frag b/src/extras/shaders/gl3/light.inc.frag
new file mode 100644
index 000000000..7ed8cfdc4
--- /dev/null
+++ b/src/extras/shaders/gl3/light.inc.frag
@@ -0,0 +1,139 @@
+const int MAX_LIGHTS = 8;
+const int TYPE_POINT = 0;
+const int TYPE_DIRECTIONAL = 1;
+const int TYPE_SPOT = 2;
+struct Light {
+ int type;
+ vec3 position;
+ vec3 color;
+ float intensity;
+ vec3 direction;
+ float constantAttenuation;
+ float linearAttenuation;
+ float quadraticAttenuation;
+ float cutOffAngle;
+};
+uniform Light lights[MAX_LIGHTS];
+uniform int lightCount;
+
+void adsModelNormalMapped(const in vec3 vpos, const in vec3 vnormal, const in vec3 eye, const in float shininess,
+ const in mat3 tangentMatrix,
+ out vec3 diffuseColor, out vec3 specularColor)
+{
+ diffuseColor = vec3(0.0);
+ specularColor = vec3(0.0);
+
+ vec3 n = normalize( vnormal );
+
+ int i;
+ vec3 s;
+ for (i = 0; i < lightCount; ++i) {
+ float att = 1.0;
+ if ( lights[i].type != TYPE_DIRECTIONAL ) {
+ s = tangentMatrix * ( lights[i].position - vpos );
+ if (lights[i].constantAttenuation != 0.0
+ || lights[i].linearAttenuation != 0.0
+ || lights[i].quadraticAttenuation != 0.0) {
+ float dist = length(s);
+ att = 1.0 / (lights[i].constantAttenuation + lights[i].linearAttenuation * dist + lights[i].quadraticAttenuation * dist * dist);
+ }
+ s = normalize( s );
+ if ( lights[i].type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
+ att = 0.0;
+ }
+ } else {
+ s = normalize( tangentMatrix * -lights[i].direction );
+ }
+
+ float diffuse = max( dot( s, n ), 0.0 );
+
+ float specular = 0.0;
+ if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
+ vec3 r = reflect( -s, n );
+ vec3 v = normalize( tangentMatrix * ( eye - vpos ) );
+ float normFactor = ( shininess + 2.0 ) / 2.0;
+ specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
+ }
+
+ diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
+ specularColor += att * lights[i].intensity * specular * lights[i].color;
+ }
+}
+
+void adsModel(const in vec3 vpos, const in vec3 vnormal, const in vec3 eye, const in float shininess,
+ out vec3 diffuseColor, out vec3 specularColor)
+{
+ diffuseColor = vec3(0.0);
+ specularColor = vec3(0.0);
+
+ vec3 n = normalize( vnormal );
+
+ int i;
+ vec3 s;
+ for (i = 0; i < lightCount; ++i) {
+ float att = 1.0;
+ if ( lights[i].type != TYPE_DIRECTIONAL ) {
+ s = lights[i].position - vpos;
+ if (lights[i].constantAttenuation != 0.0
+ || lights[i].linearAttenuation != 0.0
+ || lights[i].quadraticAttenuation != 0.0) {
+ float dist = length(s);
+ att = 1.0 / (lights[i].constantAttenuation + lights[i].linearAttenuation * dist + lights[i].quadraticAttenuation * dist * dist);
+ }
+ s = normalize( s );
+ if ( lights[i].type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
+ att = 0.0;
+ }
+ } else {
+ s = normalize( -lights[i].direction );
+ }
+
+ float diffuse = max( dot( s, n ), 0.0 );
+
+ float specular = 0.0;
+ if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
+ vec3 r = reflect( -s, n );
+ vec3 v = normalize( eye - vpos );
+ float normFactor = ( shininess + 2.0 ) / 2.0;
+ specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
+ }
+
+ diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
+ specularColor += att * lights[i].intensity * specular * lights[i].color;
+ }
+}
+
+void adModel(const in vec3 vpos, const in vec3 vnormal, out vec3 diffuseColor)
+{
+ diffuseColor = vec3(0.0);
+
+ vec3 n = normalize( vnormal );
+
+ int i;
+ vec3 s;
+ for (i = 0; i < lightCount; ++i) {
+ float att = 1.0;
+ if ( lights[i].type != TYPE_DIRECTIONAL ) {
+ s = lights[i].position - vpos;
+ if (lights[i].constantAttenuation != 0.0
+ || lights[i].linearAttenuation != 0.0
+ || lights[i].quadraticAttenuation != 0.0) {
+ float dist = length(s);
+ att = 1.0 / (lights[i].constantAttenuation + lights[i].linearAttenuation * dist + lights[i].quadraticAttenuation * dist * dist);
+ }
+ s = normalize( s );
+ if ( lights[i].type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
+ att = 0.0;
+ }
+ } else {
+ s = normalize( -lights[i].direction );
+ }
+
+ float diffuse = max( dot( s, n ), 0.0 );
+
+ diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
+ }
+}
diff --git a/src/render/shaders/gl3/normaldiffusemap.frag b/src/extras/shaders/gl3/normaldiffusemap.frag
index a99a7ed73..a99a7ed73 100644
--- a/src/render/shaders/gl3/normaldiffusemap.frag
+++ b/src/extras/shaders/gl3/normaldiffusemap.frag
diff --git a/src/render/shaders/gl3/normaldiffusemap.vert b/src/extras/shaders/gl3/normaldiffusemap.vert
index 306a562fb..306a562fb 100644
--- a/src/render/shaders/gl3/normaldiffusemap.vert
+++ b/src/extras/shaders/gl3/normaldiffusemap.vert
diff --git a/src/render/shaders/gl3/normaldiffusemapalpha.frag b/src/extras/shaders/gl3/normaldiffusemapalpha.frag
index ce5cf0e90..ce5cf0e90 100644
--- a/src/render/shaders/gl3/normaldiffusemapalpha.frag
+++ b/src/extras/shaders/gl3/normaldiffusemapalpha.frag
diff --git a/src/render/shaders/gl3/normaldiffusespecularmap.frag b/src/extras/shaders/gl3/normaldiffusespecularmap.frag
index b62932ffd..b62932ffd 100644
--- a/src/render/shaders/gl3/normaldiffusespecularmap.frag
+++ b/src/extras/shaders/gl3/normaldiffusespecularmap.frag
diff --git a/src/render/shaders/gl3/pervertexcolor.frag b/src/extras/shaders/gl3/pervertexcolor.frag
index b5ed5a33d..b5ed5a33d 100644
--- a/src/render/shaders/gl3/pervertexcolor.frag
+++ b/src/extras/shaders/gl3/pervertexcolor.frag
diff --git a/src/render/shaders/gl3/pervertexcolor.vert b/src/extras/shaders/gl3/pervertexcolor.vert
index 87713a520..87713a520 100644
--- a/src/render/shaders/gl3/pervertexcolor.vert
+++ b/src/extras/shaders/gl3/pervertexcolor.vert
diff --git a/src/extras/shaders/gl3/phong.frag b/src/extras/shaders/gl3/phong.frag
new file mode 100644
index 000000000..a4d7e0969
--- /dev/null
+++ b/src/extras/shaders/gl3/phong.frag
@@ -0,0 +1,22 @@
+#version 150 core
+
+uniform vec3 ka; // Ambient reflectivity
+uniform vec3 kd; // Diffuse reflectivity
+uniform vec3 ks; // Specular reflectivity
+uniform float shininess; // Specular shininess factor
+
+uniform vec3 eyePosition;
+
+in vec3 worldPosition;
+in vec3 worldNormal;
+
+out vec4 fragColor;
+
+#pragma include light.inc.frag
+
+void main()
+{
+ vec3 diffuseColor, specularColor;
+ adsModel(worldPosition, worldNormal, eyePosition, shininess, diffuseColor, specularColor);
+ fragColor = vec4( ka + kd * diffuseColor + ks * specularColor, 1.0 );
+}
diff --git a/src/extras/shaders/gl3/phong.vert b/src/extras/shaders/gl3/phong.vert
new file mode 100644
index 000000000..cdb3c70e9
--- /dev/null
+++ b/src/extras/shaders/gl3/phong.vert
@@ -0,0 +1,19 @@
+#version 150 core
+
+in vec3 vertexPosition;
+in vec3 vertexNormal;
+
+out vec3 worldPosition;
+out vec3 worldNormal;
+
+uniform mat4 modelMatrix;
+uniform mat3 modelNormalMatrix;
+uniform mat4 modelViewProjection;
+
+void main()
+{
+ worldNormal = normalize( modelNormalMatrix * vertexNormal );
+ worldPosition = vec3( modelMatrix * vec4( vertexPosition, 1.0 ) );
+
+ gl_Position = modelViewProjection * vec4( vertexPosition, 1.0 );
+}
diff --git a/src/render/shaders/gl3/phongalpha.frag b/src/extras/shaders/gl3/phongalpha.frag
index cb019e9aa..cb019e9aa 100644
--- a/src/render/shaders/gl3/phongalpha.frag
+++ b/src/extras/shaders/gl3/phongalpha.frag
diff --git a/src/render/shaders/gl3/skybox.frag b/src/extras/shaders/gl3/skybox.frag
index 99c8f111b..99c8f111b 100644
--- a/src/render/shaders/gl3/skybox.frag
+++ b/src/extras/shaders/gl3/skybox.frag
diff --git a/src/render/shaders/gl3/skybox.vert b/src/extras/shaders/gl3/skybox.vert
index 17bb2b00b..17bb2b00b 100644
--- a/src/render/shaders/gl3/skybox.vert
+++ b/src/extras/shaders/gl3/skybox.vert
diff --git a/src/render/shaders/gl3/unlittexture.frag b/src/extras/shaders/gl3/unlittexture.frag
index 8abbeee8f..8abbeee8f 100644
--- a/src/render/shaders/gl3/unlittexture.frag
+++ b/src/extras/shaders/gl3/unlittexture.frag
diff --git a/src/render/shaders/gl3/unlittexture.vert b/src/extras/shaders/gl3/unlittexture.vert
index 4aaa10a8f..4aaa10a8f 100644
--- a/src/render/shaders/gl3/unlittexture.vert
+++ b/src/extras/shaders/gl3/unlittexture.vert
diff --git a/src/input/backend/abstractaxisinput.cpp b/src/input/backend/abstractaxisinput.cpp
new file mode 100644
index 000000000..1038a64b1
--- /dev/null
+++ b/src/input/backend/abstractaxisinput.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "abstractaxisinput_p.h"
+#include <Qt3DInput/qabstractaxisinput.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/private/qabstractaxisinput_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+AbstractAxisInput::AbstractAxisInput()
+ : Qt3DCore::QBackendNode()
+{
+}
+
+void AbstractAxisInput::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAbstractAxisInputData>>(change);
+ const auto &data = typedChange->data;
+ m_sourceDevice = data.sourceDeviceId;
+}
+
+void AbstractAxisInput::cleanup()
+{
+ QBackendNode::setEnabled(false);
+ m_sourceDevice = Qt3DCore::QNodeId();
+}
+
+void AbstractAxisInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("sourceDevice")) {
+ m_sourceDevice = propertyChange->value().value<Qt3DCore::QNodeId>();
+ }
+ }
+ QBackendNode::sceneChangeEvent(e);
+}
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/abstractaxisinput_p.h b/src/input/backend/abstractaxisinput_p.h
new file mode 100644
index 000000000..3e9b2287c
--- /dev/null
+++ b/src/input/backend/abstractaxisinput_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_AXISINPUT_H
+#define QT3DINPUT_INPUT_AXISINPUT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class Q_AUTOTEST_EXPORT AbstractAxisInput : public Qt3DCore::QBackendNode
+{
+public:
+ virtual void cleanup();
+
+ inline Qt3DCore::QNodeId sourceDevice() const { return m_sourceDevice; }
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+protected:
+ AbstractAxisInput();
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_OVERRIDE;
+
+ Qt3DCore::QNodeId m_sourceDevice;
+};
+
+} // namespace Input
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_AXISINPUT_H
diff --git a/src/input/backend/action.cpp b/src/input/backend/action.cpp
index 97dc33d73..67ccda11b 100644
--- a/src/input/backend/action.cpp
+++ b/src/input/backend/action.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,8 +39,11 @@
#include "action_p.h"
#include <Qt3DInput/qaction.h>
-#include <Qt3DInput/qactioninput.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DInput/qabstractactioninput.h>
+#include <Qt3DInput/private/qaction_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -46,50 +52,59 @@ namespace Qt3DInput {
namespace Input {
Action::Action()
- : Qt3DCore::QBackendNode()
- , m_enabled(false)
+ : Qt3DCore::QBackendNode(ReadWrite)
, m_actionTriggered(false)
{
}
-void Action::updateFromPeer(Qt3DCore::QNode *peer)
+void Action::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QAction *action = static_cast<QAction *>(peer);
- m_enabled = action->isEnabled();
- m_name = action->name();
- Q_FOREACH (QActionInput *input, action->inputs())
- m_inputs.push_back(input->id());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QActionData>>(change);
+ const auto &data = typedChange->data;
+ m_inputs = data.inputIds;
}
void Action::cleanup()
{
- m_enabled = false;
+ QBackendNode::setEnabled(false);
m_inputs.clear();
- m_name.clear();
m_actionTriggered = false;
}
void Action::setActionTriggered(bool actionTriggered)
{
- m_actionTriggered = actionTriggered;
+ if (actionTriggered != m_actionTriggered) {
+ m_actionTriggered = actionTriggered;
+
+ // Send change to the frontend
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("active");
+ e->setValue(m_actionTriggered);
+ notifyObservers(e);
+ }
}
void Action::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (e->type() == Qt3DCore::NodeUpdated) {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().toBool();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("name")) {
- m_name = propertyChange->value().toString();
- }
- } else if (e->type() == Qt3DCore::NodeAdded) {
- if (propertyChange->propertyName() == QByteArrayLiteral("input"))
- m_inputs.push_back(propertyChange->value().value<Qt3DCore::QNodeId>());
- } else if (e->type() == Qt3DCore::NodeRemoved) {
- if (propertyChange->propertyName() == QByteArrayLiteral("input"))
- m_inputs.removeOne(propertyChange->value().value<Qt3DCore::QNodeId>());
+ switch (e->type()) {
+ case Qt3DCore::PropertyValueAdded: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("input"))
+ m_inputs.push_back(change->addedNodeId());
+ break;
+ }
+
+ case Qt3DCore::PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("input"))
+ m_inputs.removeOne(change->removedNodeId());
+ }
+
+ default:
+ break;
}
+ QBackendNode::sceneChangeEvent(e);
}
} // Input
diff --git a/src/input/backend/action_p.h b/src/input/backend/action_p.h
index 350225b97..ee686413f 100644
--- a/src/input/backend/action_p.h
+++ b/src/input/backend/action_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,19 +64,16 @@ class Q_AUTOTEST_EXPORT Action : public Qt3DCore::QBackendNode
{
public:
Action();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void cleanup();
- inline bool isEnabled() const { return m_enabled; }
inline QVector<Qt3DCore::QNodeId> inputs() const { return m_inputs; }
inline bool actionTriggered() const { return m_actionTriggered; }
- inline QString name() const { return m_name; }
void setActionTriggered(bool actionTriggered);
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QVector<Qt3DCore::QNodeId> m_inputs;
- QString m_name;
- bool m_enabled;
bool m_actionTriggered;
};
diff --git a/src/input/backend/actioninput.cpp b/src/input/backend/actioninput.cpp
index 3371c978d..b4cdd77ca 100644
--- a/src/input/backend/actioninput.cpp
+++ b/src/input/backend/actioninput.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,8 @@
#include "actioninput_p.h"
#include <Qt3DInput/qactioninput.h>
#include <Qt3DInput/qabstractphysicaldevice.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DInput/private/qactioninput_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -45,54 +49,38 @@ namespace Qt3DInput {
namespace Input {
-namespace {
-
-QVector<int> listToIntArray(const QVariantList &l)
-{
- QVector<int> array;
- array.reserve(l.size());
- Q_FOREACH (const QVariant &v, l)
- array.push_back(v.toInt());
- return array;
-}
-
-} // anonymous
-
ActionInput::ActionInput()
: Qt3DCore::QBackendNode()
- , m_keys(0)
- , m_enabled(false)
+ , m_buttons(0)
{
}
-void ActionInput::updateFromPeer(Qt3DCore::QNode *peer)
+void ActionInput::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QActionInput *input = static_cast<QActionInput *>(peer);
- m_enabled = input->isEnabled();
- m_keys = listToIntArray(input->keys());
- if (input->sourceDevice())
- m_sourceDevice = input->sourceDevice()->id();
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QActionInputData>>(change);
+ const auto &data = typedChange->data;
+ m_buttons = data.buttons;
+ m_sourceDevice = data.sourceDeviceId;
}
void ActionInput::cleanup()
{
- m_enabled = false;
+ QBackendNode::setEnabled(false);
m_sourceDevice = Qt3DCore::QNodeId();
- m_keys.clear();
+ m_buttons.clear();
}
void ActionInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- if (e->type() == Qt3DCore::NodeUpdated) {
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("sourceDevice")) {
m_sourceDevice = propertyChange->value().value<Qt3DCore::QNodeId>();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().toBool();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("keys")) {
- m_keys = listToIntArray(propertyChange->value().toList());
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("buttons")) {
+ m_buttons = propertyChange->value().value<QVector<int>>();
}
}
+ QBackendNode::sceneChangeEvent(e);
}
} // namespace Input
diff --git a/src/input/backend/actioninput_p.h b/src/input/backend/actioninput_p.h
index 66cf88ccd..c3e80ba63 100644
--- a/src/input/backend/actioninput_p.h
+++ b/src/input/backend/actioninput_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,18 +64,17 @@ class Q_AUTOTEST_EXPORT ActionInput : public Qt3DCore::QBackendNode
{
public:
ActionInput();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void cleanup();
- inline QVector<int> keys() const { return m_keys; }
+ inline QVector<int> buttons() const { return m_buttons; }
inline Qt3DCore::QNodeId sourceDevice() const { return m_sourceDevice; }
- inline bool isEnabled() const { return m_enabled; }
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
- QVector<int> m_keys;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<int> m_buttons;
Qt3DCore::QNodeId m_sourceDevice;
- bool m_enabled;
};
} // namespace Input
diff --git a/src/input/backend/analogaxisinput.cpp b/src/input/backend/analogaxisinput.cpp
new file mode 100644
index 000000000..713390992
--- /dev/null
+++ b/src/input/backend/analogaxisinput.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "analogaxisinput_p.h"
+#include <Qt3DInput/qanalogaxisinput.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/private/qanalogaxisinput_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+AnalogAxisInput::AnalogAxisInput()
+ : AbstractAxisInput()
+ , m_axis(0)
+{
+}
+
+void AnalogAxisInput::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAnalogAxisInputData>>(change);
+ const auto &data = typedChange->data;
+ m_axis = data.axis;
+ AbstractAxisInput::initializeFromPeer(change);
+}
+
+void AnalogAxisInput::cleanup()
+{
+ m_axis = 0;
+ AbstractAxisInput::cleanup();
+}
+
+void AnalogAxisInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("axis")) {
+ m_axis = propertyChange->value().toInt();
+ }
+ }
+ AbstractAxisInput::sceneChangeEvent(e);
+}
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/analogaxisinput_p.h b/src/input/backend/analogaxisinput_p.h
new file mode 100644
index 000000000..8febb10e7
--- /dev/null
+++ b/src/input/backend/analogaxisinput_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_ANALOGAXISINPUT_H
+#define QT3DINPUT_INPUT_ANALOGAXISINPUT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/abstractaxisinput_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class Q_AUTOTEST_EXPORT AnalogAxisInput : public AbstractAxisInput
+{
+public:
+ AnalogAxisInput();
+ void cleanup() Q_DECL_FINAL;
+
+ inline int axis() const { return m_axis; }
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_FINAL;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ int m_axis;
+};
+
+} // namespace Input
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_ANALOGAXISINPUT_H
diff --git a/src/input/backend/assignkeyboardfocusjob.cpp b/src/input/backend/assignkeyboardfocusjob.cpp
index 095732d22..43f5950b3 100644
--- a/src/input/backend/assignkeyboardfocusjob.cpp
+++ b/src/input/backend/assignkeyboardfocusjob.cpp
@@ -1,42 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "assignkeyboardfocusjob_p.h"
-#include "keyboardcontroller_p.h"
-#include "keyboardinput_p.h"
+#include "keyboarddevice_p.h"
+#include "keyboardhandler_p.h"
#include "inputhandler_p.h"
#include "inputmanagers_p.h"
@@ -45,10 +48,10 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
namespace Input {
-AssignKeyboardFocusJob::AssignKeyboardFocusJob(const Qt3DCore::QNodeId &controller)
+AssignKeyboardFocusJob::AssignKeyboardFocusJob(Qt3DCore::QNodeId keyboardDevice)
: QAspectJob()
- , m_inputHandler(Q_NULLPTR)
- , m_keyboardController(controller)
+ , m_inputHandler(nullptr)
+ , m_keyboardDevice(keyboardDevice)
{
}
@@ -59,14 +62,15 @@ void AssignKeyboardFocusJob::setInputHandler(InputHandler *handler)
void AssignKeyboardFocusJob::run()
{
- KeyboardController *controller = m_inputHandler->keyboardControllerManager()->lookupResource(m_keyboardController);
- Q_FOREACH (const HKeyboardInput handle, controller->keyboardInputsHandles()) {
- KeyboardInput *input = m_inputHandler->keyboardInputManager()->data(handle);
+ KeyboardDevice *keyboardDevice = m_inputHandler->keyboardDeviceManager()->lookupResource(m_keyboardDevice);
+ const auto handles = keyboardDevice->keyboardInputsHandles();
+ for (const HKeyboardHandler handle : handles) {
+ KeyboardHandler *input = m_inputHandler->keyboardInputManager()->data(handle);
if (input) {
- bool hasFocus = input->peerUuid() == controller->lastKeyboardInputRequester();
+ bool hasFocus = input->peerId() == keyboardDevice->lastKeyboardInputRequester();
input->setFocus(hasFocus);
if (hasFocus)
- controller->setCurrentFocusItem(input->peerUuid());
+ keyboardDevice->setCurrentFocusItem(input->peerId());
}
}
}
diff --git a/src/input/backend/assignkeyboardfocusjob_p.h b/src/input/backend/assignkeyboardfocusjob_p.h
index fcb251c5a..44966554d 100644
--- a/src/input/backend/assignkeyboardfocusjob_p.h
+++ b/src/input/backend/assignkeyboardfocusjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,13 +64,13 @@ class InputHandler;
class AssignKeyboardFocusJob : public Qt3DCore::QAspectJob
{
public:
- explicit AssignKeyboardFocusJob(const Qt3DCore::QNodeId &controller);
+ explicit AssignKeyboardFocusJob(Qt3DCore::QNodeId keyboardDevice);
void setInputHandler(InputHandler *handler);
void run() Q_DECL_OVERRIDE;
private:
InputHandler *m_inputHandler;
- const Qt3DCore::QNodeId m_keyboardController;
+ const Qt3DCore::QNodeId m_keyboardDevice;
};
} // namespace Input
diff --git a/src/input/backend/axis.cpp b/src/input/backend/axis.cpp
index b4f45f930..b64173626 100644
--- a/src/input/backend/axis.cpp
+++ b/src/input/backend/axis.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,8 +39,11 @@
#include "axis_p.h"
#include <Qt3DInput/qaxis.h>
-#include <Qt3DInput/qaxisinput.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DInput/qabstractaxisinput.h>
+#include <Qt3DInput/private/qaxis_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -46,50 +52,59 @@ namespace Qt3DInput {
namespace Input {
Axis::Axis()
- : Qt3DCore::QBackendNode()
- , m_enabled(false)
+ : Qt3DCore::QBackendNode(ReadWrite)
, m_axisValue(0.0f)
{
}
-void Axis::updateFromPeer(Qt3DCore::QNode *peer)
+void Axis::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QAxis *axis = static_cast<QAxis *>(peer);
- m_enabled = axis->isEnabled();
- m_name = axis->name();
- Q_FOREACH (QAxisInput *input, axis->inputs())
- m_inputs.push_back(input->id());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAxisData>>(change);
+ const auto &data = typedChange->data;
+ m_inputs = data.inputIds;
}
void Axis::cleanup()
{
- m_enabled = false;
+ QBackendNode::setEnabled(false);
m_inputs.clear();
- m_name.clear();
m_axisValue = 0.0f;
}
void Axis::setAxisValue(float axisValue)
{
- m_axisValue = axisValue;
+ if (axisValue != m_axisValue) {
+ m_axisValue = axisValue;
+
+ // Send a change to the frontend
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("value");
+ e->setValue(m_axisValue);
+ notifyObservers(e);
+ }
}
void Axis::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (e->type() == Qt3DCore::NodeUpdated) {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().toBool();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("name")) {
- m_name = propertyChange->value().toString();
- }
- } else if (e->type() == Qt3DCore::NodeAdded) {
- if (propertyChange->propertyName() == QByteArrayLiteral("input"))
- m_inputs.push_back(propertyChange->value().value<Qt3DCore::QNodeId>());
- } else if (e->type() == Qt3DCore::NodeRemoved) {
- if (propertyChange->propertyName() == QByteArrayLiteral("input"))
- m_inputs.removeOne(propertyChange->value().value<Qt3DCore::QNodeId>());
+ switch (e->type()) {
+ case Qt3DCore::PropertyValueAdded: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("input"))
+ m_inputs.push_back(change->addedNodeId());
+ break;
+ }
+
+ case Qt3DCore::PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("input"))
+ m_inputs.removeOne(change->removedNodeId());
+ }
+
+ default:
+ break;
}
+ QBackendNode::sceneChangeEvent(e);
}
} // namespace Input
diff --git a/src/input/backend/axis_p.h b/src/input/backend/axis_p.h
index fbb2dcccb..e62f70d34 100644
--- a/src/input/backend/axis_p.h
+++ b/src/input/backend/axis_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,19 +64,16 @@ class Q_AUTOTEST_EXPORT Axis : public Qt3DCore::QBackendNode
{
public:
Axis();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void cleanup();
- inline bool isEnabled() const { return m_enabled; }
inline QVector<Qt3DCore::QNodeId> inputs() const { return m_inputs; }
inline float axisValue() const { return m_axisValue; }
- inline QString name() const { return m_name; }
void setAxisValue(float axisValue);
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QVector<Qt3DCore::QNodeId> m_inputs;
- QString m_name;
- bool m_enabled;
float m_axisValue;
};
diff --git a/src/input/backend/axisactionhandler.cpp b/src/input/backend/axisactionhandler.cpp
deleted file mode 100644
index a7cbfc378..000000000
--- a/src/input/backend/axisactionhandler.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "axisactionhandler_p.h"
-#include <Qt3DInput/qaxisactionhandler.h>
-#include <Qt3DInput/qlogicaldevice.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DInput/private/inputmanagers_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-namespace Input {
-
-AxisActionHandler::AxisActionHandler()
- : Qt3DCore::QBackendNode(ReadWrite)
- , m_logicalDevice()
-{
-
-}
-
-void AxisActionHandler::updateFromPeer(Qt3DCore::QNode *peer)
-{
- Qt3DInput::QAxisActionHandler *handler = static_cast<Qt3DInput::QAxisActionHandler *>(peer);
- if (handler->logicalDevice())
- m_logicalDevice = handler->logicalDevice()->id();
- // TO DO: Store the state of the actions
-}
-
-void AxisActionHandler::cleanup()
-{
- m_logicalDevice = Qt3DCore::QNodeId();
-}
-
-void AxisActionHandler::setAndTransmitActionPayload(const ActionStates &actionStates, const ActionPayload &deltaPayload)
-{
- if (m_lastActionStates != actionStates) {
- m_lastActionStates = actionStates;
-
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
- e->setTargetNode(peerUuid());
- e->setPropertyName("actionPayload");
- e->setValue(QVariant::fromValue(deltaPayload));
- notifyObservers(e);
- }
-}
-
-void AxisActionHandler::setAndTransmitAxisPayload(const AxisPayload &payload)
-{
- if (m_lastAxisPayload != payload) {
- m_lastAxisPayload = payload;
-
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
- e->setTargetNode(peerUuid());
- e->setPropertyName("axisPayload");
- e->setValue(QVariant::fromValue(payload));
- notifyObservers(e);
- }
-}
-
-void AxisActionHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- if (e->type() == Qt3DCore::NodeUpdated) {
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("logicalDevice")) {
- m_logicalDevice = propertyChange->value().value<Qt3DCore::QNodeId>();
- }
- }
-}
-
-AxisActionHandlerNodeFunctor::AxisActionHandlerNodeFunctor(AxisActionHandlerManager *manager)
- : m_manager(manager)
-{
-}
-
-Qt3DCore::QBackendNode *AxisActionHandlerNodeFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
-{
- HAxisActionHandler handle = m_manager->getOrAcquireHandle(frontend->id());
- AxisActionHandler *backend = m_manager->data(handle);
- m_manager->addActiveAxisActionHandler(handle);
- backend->setFactory(factory);
- backend->setPeer(frontend);
- return backend;
-}
-
-Qt3DCore::QBackendNode *AxisActionHandlerNodeFunctor::get(const Qt3DCore::QNodeId &id) const
-{
- return m_manager->lookupResource(id);
-}
-
-void AxisActionHandlerNodeFunctor::destroy(const Qt3DCore::QNodeId &id) const
-{
- HAxisActionHandler handle = m_manager->lookupHandle(id);
- m_manager->releaseResource(id);
- m_manager->removeActiveAxisActionHandler(handle);
-}
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/axisactionhandler_p.h b/src/input/backend/axisactionhandler_p.h
deleted file mode 100644
index dd3d7431d..000000000
--- a/src/input/backend/axisactionhandler_p.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QINPUTASPECT_INPUT_AXISACTIONHANDLER_P_H
-#define QINPUTASPECT_INPUT_AXISACTIONHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
-#include <Qt3DInput/private/axisactionpayload_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-namespace Input {
-
-class AxisActionHandlerManager;
-
-class AxisActionHandler : public Qt3DCore::QBackendNode
-{
-public:
- AxisActionHandler();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- void cleanup();
- inline Qt3DCore::QNodeId logicalDevice() const { return m_logicalDevice; }
- void setAndTransmitActionPayload(const ActionStates &actionStates, const ActionPayload &deltaPayload);
- void setAndTransmitAxisPayload(const AxisPayload &payload);
- inline AxisPayload lastAxisPayload() const { return m_lastAxisPayload; }
- inline ActionPayload lastActionStates() const { return m_lastActionStates; }
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-
-private:
- Qt3DCore::QNodeId m_logicalDevice;
- AxisPayload m_lastAxisPayload;
- ActionPayload m_lastActionStates;
-};
-
-class AxisActionHandlerNodeFunctor : public Qt3DCore::QBackendNodeFunctor
-{
-public:
- explicit AxisActionHandlerNodeFunctor(AxisActionHandlerManager *manager);
-
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
-
-private:
- AxisActionHandlerManager *m_manager;
-};
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QINPUTASPECT_INPUT_AXISACTIONHANDLER_P_H
diff --git a/src/input/backend/axisactionpayload_p.h b/src/input/backend/axisactionpayload_p.h
deleted file mode 100644
index f31faba46..000000000
--- a/src/input/backend/axisactionpayload_p.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_AXISACTIONPAYLOAD_P_H
-#define QT3DINPUT_INPUT_AXISACTIONPAYLOAD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-struct AxisUpdate
-{
- Qt3DCore::QNodeId id;
- QString name;
- float value;
-
- bool operator ==(const AxisUpdate &other) const
- {
- return (id == other.id) && qFuzzyCompare(value, other.value);
- }
-};
-
-struct ActionUpdate
-{
- Qt3DCore::QNodeId id;
- QString name;
- bool triggered;
-
- bool operator ==(const ActionUpdate &other) const
- {
- return (id == other.id) && (triggered == other.triggered);
- }
-};
-
-struct ActionPayload
-{
- QVector<ActionUpdate> actions;
-
- bool operator ==(const ActionPayload &other) const
- {
- return actions == other.actions;
- }
-
- bool operator !=(const ActionPayload &other) const
- {
- return !(*this == other);
- }
-};
-
-typedef ActionPayload ActionStates;
-
-struct AxisPayload
-{
- QVector<AxisUpdate> axes;
-
- bool operator ==(const AxisPayload &other) const
- {
- return axes == other.axes;
- }
-
- bool operator !=(const AxisPayload &other) const
- {
- return !(*this == other);
- }
-};
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Qt3DInput::Input::AxisPayload);
-Q_DECLARE_METATYPE(Qt3DInput::Input::ActionPayload);
-
-#endif // QT3DINPUT_INPUT_AXISACTIONPAYLOAD_P_H
-
diff --git a/src/input/backend/axisinput.cpp b/src/input/backend/axisinput.cpp
deleted file mode 100644
index f7bb32246..000000000
--- a/src/input/backend/axisinput.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "axisinput_p.h"
-#include <Qt3DInput/qaxisinput.h>
-#include <Qt3DInput/qabstractphysicaldevice.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-namespace {
-
-QVector<int> listToIntArray(const QVariantList &l)
-{
- QVector<int> array;
- array.reserve(l.size());
- Q_FOREACH (const QVariant &v, l)
- array.push_back(v.toInt());
- return array;
-}
-
-} // anonymous
-
-AxisInput::AxisInput()
- : Qt3DCore::QBackendNode()
- , m_axis(0)
- , m_scale(0.0f)
- , m_enabled(false)
-{
-}
-
-// AxisInput can have two types of behavior
-// Axis input with source device and axis -> will retrieve the axis value from the source device
-// Axis input with source device and scale + keys -> will be used as a multiplication factor with other AxisInput
-void AxisInput::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QAxisInput *input = static_cast<QAxisInput *>(peer);
- m_axis = input->axis();
- m_scale = input->scale();
- m_enabled = input->isEnabled();
- m_keys = listToIntArray(input->keys());
- if (input->sourceDevice())
- m_sourceDevice = input->sourceDevice()->id();
-}
-
-void AxisInput::cleanup()
-{
- m_axis = 0;
- m_enabled = false;
- m_scale = 0.0f;
- m_keys.clear();
- m_sourceDevice = Qt3DCore::QNodeId();
-}
-
-void AxisInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- if (e->type() == Qt3DCore::NodeUpdated) {
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("sourceDevice")) {
- m_sourceDevice = propertyChange->value().value<Qt3DCore::QNodeId>();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("scale")) {
- m_scale = propertyChange->value().toFloat();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("axis")) {
- m_axis = propertyChange->value().toInt();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().toBool();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("keys")) {
- m_keys = listToIntArray(propertyChange->value().toList());
- }
- }
-}
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/axisinput_p.h b/src/input/backend/axisinput_p.h
deleted file mode 100644
index 2b27e2c42..000000000
--- a/src/input/backend/axisinput_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_AXISINPUT_H
-#define QT3DINPUT_INPUT_AXISINPUT_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-class Q_AUTOTEST_EXPORT AxisInput : public Qt3DCore::QBackendNode
-{
-public:
- AxisInput();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- void cleanup();
-
- inline int axis() const { return m_axis; }
- inline float scale() const { return m_scale; }
- inline QVector<int> keys() const { return m_keys; }
- inline Qt3DCore::QNodeId sourceDevice() const { return m_sourceDevice; }
- inline bool isEnabled() const { return m_enabled; }
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-
-private:
- int m_axis;
- QVector<int> m_keys;
- Qt3DCore::QNodeId m_sourceDevice;
- float m_scale;
- bool m_enabled;
-};
-
-} // namespace Input
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_INPUT_AXISINPUT_H
diff --git a/src/input/backend/axissetting.cpp b/src/input/backend/axissetting.cpp
index 407308649..c915e018c 100644
--- a/src/input/backend/axissetting.cpp
+++ b/src/input/backend/axissetting.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,8 @@
#include "axissetting_p.h"
#include <Qt3DInput/qaxissetting.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DInput/private/qaxissetting_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -46,9 +50,8 @@ QVector<int> variantListToVector(const QVariantList &list)
{
QVector<int> v(list.size());
int i = 0;
- Q_FOREACH (const QVariant &e, list) {
+ for (const QVariant &e : list)
v[i++] = e.toInt();
- }
return v;
}
@@ -59,39 +62,42 @@ namespace Input {
AxisSetting::AxisSetting()
: Qt3DCore::QBackendNode()
- , m_deadZone(0.0f)
+ , m_deadZoneRadius(0.0f)
, m_axes(0)
- , m_filter(false)
+ , m_smooth(false)
{
}
-void AxisSetting::updateFromPeer(Qt3DCore::QNode *peer)
+void AxisSetting::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QAxisSetting *setting = static_cast<QAxisSetting *>(peer);
- m_deadZone = setting->deadZone();
- m_axes = variantListToVector(setting->axes());
- m_filter = setting->isFilterEnabled();
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAxisSettingData>>(change);
+ const auto &data = typedChange->data;
+ m_deadZoneRadius = data.deadZoneRadius;
+ m_axes = variantListToVector(data.axes);
+ m_smooth = data.smooth;
}
void AxisSetting::cleanup()
{
- m_deadZone = 0.0f;
+ QBackendNode::setEnabled(false);
+ m_deadZoneRadius = 0.0f;
m_axes.clear();
- m_filter = false;
+ m_smooth = false;
}
void AxisSetting::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- if (e->type() == Qt3DCore::NodeUpdated) {
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("deadZone")) {
- m_deadZone = propertyChange->value().toFloat();
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("deadZoneRadius")) {
+ m_deadZoneRadius = propertyChange->value().toFloat();
} else if (propertyChange->propertyName() == QByteArrayLiteral("axes")) {
m_axes = variantListToVector(propertyChange->value().toList());
- } else if (propertyChange->propertyName() == QByteArrayLiteral("filter")) {
- m_filter = propertyChange->value().toBool();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("smooth")) {
+ m_smooth = propertyChange->value().toBool();
}
}
+ QBackendNode::sceneChangeEvent(e);
}
} // namespace Input
diff --git a/src/input/backend/axissetting_p.h b/src/input/backend/axissetting_p.h
index 7464a5b08..cd4959d69 100644
--- a/src/input/backend/axissetting_p.h
+++ b/src/input/backend/axissetting_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -59,21 +62,21 @@ class AxisSetting : public Qt3DCore::QBackendNode
{
public:
AxisSetting();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void cleanup();
- inline float deadZone() const { return m_deadZone; }
+ inline float deadZoneRadius() const { return m_deadZoneRadius; }
inline QVector<int> axes() const { return m_axes; }
- inline bool isFilterEnabled() const { return m_filter; }
+ inline bool isSmoothEnabled() const { return m_smooth; }
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
- float m_deadZone;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ float m_deadZoneRadius;
QVector<int> m_axes;
- bool m_filter;
+ bool m_smooth;
};
} // namespace Input
diff --git a/src/input/backend/backend.pri b/src/input/backend/backend.pri
index 4a9ee79d0..4dd8b9e83 100644
--- a/src/input/backend/backend.pri
+++ b/src/input/backend/backend.pri
@@ -1,56 +1,63 @@
HEADERS += \
- $$PWD/cameracontroller_p.h \
- $$PWD/keyboardcontroller_p.h \
- $$PWD/keyboardinput_p.h \
+ $$PWD/keyboarddevice_p.h \
+ $$PWD/keyboardhandler_p.h \
$$PWD/inputhandler_p.h \
$$PWD/inputmanagers_p.h \
$$PWD/handle_types_p.h \
$$PWD/keyboardeventfilter_p.h \
$$PWD/assignkeyboardfocusjob_p.h \
$$PWD/keyeventdispatcherjob_p.h \
- $$PWD/mousecontroller_p.h \
- $$PWD/mouseinput_p.h \
+ $$PWD/mousehandler_p.h \
+ $$PWD/mousedevice_p.h \
$$PWD/mouseeventdispatcherjob_p.h \
$$PWD/mouseeventfilter_p.h \
- $$PWD/axisinput_p.h \
+ $$PWD/abstractaxisinput_p.h \
$$PWD/actioninput_p.h \
$$PWD/axis_p.h \
$$PWD/action_p.h \
+ $$PWD/analogaxisinput_p.h \
+ $$PWD/buttonaxisinput_p.h \
$$PWD/logicaldevice_p.h \
$$PWD/inputbackendnodefunctor_p.h \
- $$PWD/qabstractphysicaldevicebackendnode.h \
+ $$PWD/qabstractphysicaldevicebackendnode_p.h \
$$PWD/movingaverage_p.h \
$$PWD/axissetting_p.h \
- $$PWD/qabstractphysicaldevicebackendnode_p.h \
+ $$PWD/qabstractphysicaldevicebackendnode_p_p.h \
$$PWD/updateaxisactionjob_p.h \
- $$PWD/axisactionhandler_p.h \
- $$PWD/updatehandlerjob_p.h \
- $$PWD/axisactionpayload_p.h \
- $$PWD/keyboardmousedeviceintegration_p.h
+ $$PWD/keyboardmousegenericdeviceintegration_p.h \
+ $$PWD/genericdevicebackendnode_p.h \
+ $$PWD/inputchord_p.h \
+ $$PWD/inputsequence_p.h \
+ $$PWD/inputsettings_p.h \
+ $$PWD/eventsourcesetterhelper_p.h
SOURCES += \
- $$PWD/cameracontroller.cpp \
- $$PWD/keyboardcontroller.cpp \
- $$PWD/keyboardinput.cpp \
+ $$PWD/keyboarddevice.cpp \
+ $$PWD/keyboardhandler.cpp \
$$PWD/inputhandler.cpp \
$$PWD/keyboardeventfilter.cpp \
$$PWD/assignkeyboardfocusjob.cpp \
$$PWD/keyeventdispatcherjob.cpp \
- $$PWD/mousecontroller.cpp \
- $$PWD/mouseinput.cpp \
+ $$PWD/mousehandler.cpp \
+ $$PWD/mousedevice.cpp \
$$PWD/mouseeventfilter.cpp \
$$PWD/mouseeventdispatcherjob.cpp \
- $$PWD/axisinput.cpp \
+ $$PWD/abstractaxisinput.cpp \
$$PWD/actioninput.cpp \
$$PWD/axis.cpp \
$$PWD/action.cpp \
+ $$PWD/analogaxisinput.cpp \
+ $$PWD/buttonaxisinput.cpp \
$$PWD/logicaldevice.cpp \
$$PWD/qabstractphysicaldevicebackendnode.cpp \
$$PWD/movingaverage.cpp \
$$PWD/axissetting.cpp \
$$PWD/updateaxisactionjob.cpp \
- $$PWD/axisactionhandler.cpp \
- $$PWD/updatehandlerjob.cpp \
- $$PWD/keyboardmousedeviceintegration.cpp
+ $$PWD/keyboardmousegenericdeviceintegration.cpp \
+ $$PWD/genericdevicebackendnode.cpp \
+ $$PWD/inputchord.cpp \
+ $$PWD/inputsequence.cpp \
+ $$PWD/inputsettings.cpp \
+ $$PWD/eventsourcesetterhelper.cpp
INCLUDEPATH += $$PWD
diff --git a/src/input/backend/buttonaxisinput.cpp b/src/input/backend/buttonaxisinput.cpp
new file mode 100644
index 000000000..6042b2eff
--- /dev/null
+++ b/src/input/backend/buttonaxisinput.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "buttonaxisinput_p.h"
+#include <Qt3DInput/qbuttonaxisinput.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/private/qbuttonaxisinput_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+ButtonAxisInput::ButtonAxisInput()
+ : AbstractAxisInput()
+ , m_scale(0.0f)
+ , m_acceleration(-1.0f)
+ , m_deceleration(-1.0f)
+ , m_speedRatio(0.0f)
+ , m_lastUpdateTime(0)
+{
+}
+
+void ButtonAxisInput::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QButtonAxisInputData>>(change);
+ const auto &data = typedChange->data;
+ m_buttons = data.buttons;
+ m_scale = data.scale;
+ m_acceleration = data.acceleration;
+ m_deceleration = data.deceleration;
+ AbstractAxisInput::initializeFromPeer(change);
+}
+
+void ButtonAxisInput::cleanup()
+{
+ m_scale = 0.0f;
+ m_buttons.clear();
+ m_acceleration = -1.0f;
+ m_deceleration = -1.0f;
+ AbstractAxisInput::cleanup();
+}
+
+void ButtonAxisInput::updateSpeedRatio(qint64 currentTime, ButtonAxisInput::UpdateType type)
+{
+ const float accel = (type == Accelerate) ? acceleration() : -deceleration();
+
+ // Was in nanoseconds, while acceleration will be in units per square seconds
+ const float delta = m_lastUpdateTime ? (currentTime - m_lastUpdateTime) / 1000000000.0f : 0.0f;
+ const float speedRatio = m_speedRatio + delta * accel;
+
+ // Clamp it
+ m_speedRatio = qMax(0.0f, qMin(speedRatio, 1.0f));
+
+ // If we stopped, time to start over
+ if (type == Decelerate && m_speedRatio == 0.0f)
+ m_lastUpdateTime = 0;
+ else
+ m_lastUpdateTime = currentTime;
+}
+
+void ButtonAxisInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("scale")) {
+ m_scale = propertyChange->value().toFloat();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("buttons")) {
+ m_buttons = propertyChange->value().value<QVector<int>>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("acceleration")) {
+ m_acceleration = propertyChange->value().toFloat();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("deceleration")) {
+ m_deceleration = propertyChange->value().toFloat();
+ }
+ }
+ AbstractAxisInput::sceneChangeEvent(e);
+}
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/buttonaxisinput_p.h b/src/input/backend/buttonaxisinput_p.h
new file mode 100644
index 000000000..9e82a6ebc
--- /dev/null
+++ b/src/input/backend/buttonaxisinput_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_BUTTONAXISINPUT_H
+#define QT3DINPUT_INPUT_BUTTONAXISINPUT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/abstractaxisinput_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class Q_AUTOTEST_EXPORT ButtonAxisInput : public AbstractAxisInput
+{
+public:
+ enum UpdateType {
+ Accelerate,
+ Decelerate
+ };
+
+ ButtonAxisInput();
+ void cleanup() Q_DECL_FINAL;
+
+ inline float scale() const { return m_scale; }
+ inline QVector<int> buttons() const { return m_buttons; }
+
+ inline float acceleration() const { return m_acceleration < 0.0f ? qInf() : m_acceleration; }
+ inline float deceleration() const { return m_deceleration < 0.0f ? qInf() : m_deceleration; }
+ inline float speedRatio() const { return m_speedRatio; }
+ inline qint64 lastUpdateTime() const { return m_lastUpdateTime; }
+
+ void updateSpeedRatio(qint64 currentTime, UpdateType type);
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_FINAL;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<int> m_buttons;
+ float m_scale;
+ float m_acceleration;
+ float m_deceleration;
+ float m_speedRatio;
+ qint64 m_lastUpdateTime;
+};
+
+} // namespace Input
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_BUTTONAXISINPUT_H
diff --git a/src/input/backend/cameracontroller.cpp b/src/input/backend/cameracontroller.cpp
deleted file mode 100644
index 7001a9020..000000000
--- a/src/input/backend/cameracontroller.cpp
+++ /dev/null
@@ -1,365 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cameracontroller_p.h"
-
-#include <QMouseEvent>
-#include <QKeyEvent>
-#include <QTimer>
-
-#include <qcamera.h>
-#include <qcameralens.h>
-#include <qentity.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DInput {
-namespace Input {
-
-CameraController::CameraController(QObject *parent) :
- QObject(parent),
- m_camera( 0 ),
- m_vx( 0.0f ),
- m_vy( 0.0f ),
- m_vz( 0.0f ),
- m_viewCenterFixed( false ),
- m_panAngle( 0.0f ),
- m_tiltAngle( 0.0f ),
- m_leftButtonPressed( false ),
- m_orbitMode( false ),
- m_linearSpeed( 40.0f ),
- m_time( 0.0f ),
- m_orbitRate( -0.3f ),
- m_lookRate( 0.1f ),
- m_translateFast( false ),
- m_multisampleEnabled( true ),
- m_controlMode( FirstPerson ),
- m_firstPersonUp( QVector3D( 0.0f, 1.0f, 0.0f ) ),
- m_updateTimer(new QTimer(this))
-{
- m_updateTimer->setInterval(16);
- connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(onUpdate()));
-}
-
-/*!
- * CameraController expects to find a Camera entity.
- * That means if you have built you Camera yourself using
- * an Entity, a CameraLens and a Transform instead of using the
- * ready made Camera element, it won't work.
- */
-void CameraController::setCamera( Qt3DCore::QCamera* cam )
-{
- m_camera = cam;
- m_cameraEntity = cam;
-
- if (m_camera)
- m_updateTimer->start();
- else
- m_updateTimer->stop();
-}
-
-Qt3DCore::QCamera *CameraController::camera() const
-{
- return m_camera;
-}
-
-void CameraController::setLinearSpeed( float speed )
-{
- if ( qFuzzyCompare( m_linearSpeed, speed ) )
- return;
- m_linearSpeed = speed;
- emit linearSpeedChanged(speed);
-}
-
-float CameraController::linearSpeed() const
-{
- return m_linearSpeed;
-}
-
-float CameraController::orbitRate() const
-{
- return m_orbitRate;
-}
-
-void CameraController::setOrbitRate( float rate )
-{
- if ( qFuzzyCompare( m_orbitRate, rate ) )
- return;
- m_orbitRate = rate;
- emit orbitRateChanged(rate);
-}
-
-float CameraController::lookRate() const
-{
- return m_lookRate;
-}
-
-void CameraController::setLookRate( float rate )
-{
- if ( qFuzzyCompare( m_lookRate, rate ) )
- return;
- m_lookRate = rate;
- emit lookRateChanged(rate);
-}
-
-void CameraController::update(double dt)
-{
- if ( !m_camera )
- return;
-
- if (m_translateFast)
- dt *= 10;
-
- // Update the camera position and orientation
- QCamera::CameraTranslationOption option = m_viewCenterFixed
- ? QCamera::DontTranslateViewCenter
- : QCamera::TranslateViewCenter;
- m_camera->translate(dt * QVector3D(m_vx, m_vy, m_vz), option);
-
- if (!qFuzzyIsNull(m_panAngle)) {
- m_camera->pan(m_panAngle);
- m_panAngle = 0.0f;
- }
-
- if (!qFuzzyIsNull(m_tiltAngle)) {
- m_camera->tilt(m_tiltAngle);
- m_tiltAngle = 0.0f;
- }
-}
-
-bool CameraController::keyPressEvent( QT_PREPEND_NAMESPACE(QKeyEvent*) e )
-{
- m_translateFast = e->modifiers().testFlag(Qt::AltModifier);
- m_viewCenterFixed = e->modifiers().testFlag(Qt::ShiftModifier);
-
- switch ( e->key() )
- {
- case Qt::Key_Right:
- m_vx = m_linearSpeed;
- break;
-
- case Qt::Key_Left:
- m_vx = -m_linearSpeed;
- break;
-
- case Qt::Key_Up:
- m_vz = m_linearSpeed;
- break;
-
- case Qt::Key_Down:
- m_vz = -m_linearSpeed;
- break;
-
- case Qt::Key_PageUp:
- m_vy = m_linearSpeed;
- break;
-
- case Qt::Key_PageDown:
- m_vy = -m_linearSpeed;
- break;
-
- case Qt::Key_A:
- toggleMSAA();
- break;
-
- default:
- return false;
- }
-
- return true;
-}
-
-bool CameraController::keyReleaseEvent( QT_PREPEND_NAMESPACE(QKeyEvent*) e )
-{
- switch ( e->key() )
- {
- case Qt::Key_Right:
- case Qt::Key_Left:
- m_vx = 0.0;
- break;
-
- case Qt::Key_Up:
- case Qt::Key_Down:
- m_vz = 0.0;
- break;
-
- case Qt::Key_PageUp:
- case Qt::Key_PageDown:
- m_vy = 0.0;
- break;
-
- default:
- return false;
- }
-
- return true;
-}
-
-void CameraController::mousePressEvent( QT_PREPEND_NAMESPACE(QMouseEvent*) e )
-{
- if ( e->button() == Qt::LeftButton )
- {
- m_leftButtonPressed = true;
- m_pos = m_prevPos = e->pos();
- }
- else if ( e->button() == Qt::RightButton )
- {
- m_orbitMode = true;
- m_pos = m_prevPos = e->pos();
- }
-}
-
-void CameraController::mouseReleaseEvent( QT_PREPEND_NAMESPACE(QMouseEvent*) e )
-{
- if ( e->button() == Qt::LeftButton )
- {
- m_leftButtonPressed = false;
- }
- else if ( e->button() == Qt::RightButton )
- {
- m_orbitMode = false;
- }
-}
-
-void CameraController::mouseMoveEvent( QT_PREPEND_NAMESPACE(QMouseEvent*) e )
-{
- if (!m_camera )
- return;
-
- if (!m_leftButtonPressed && !m_orbitMode)
- return;
-
- m_pos = e->pos();
- float dx = m_pos.x() - m_prevPos.x();
- float dy = -(m_pos.y() - m_prevPos.y());
- m_prevPos = m_pos;
-
- if (m_leftButtonPressed) {
- switch (m_controlMode) {
- case FreeLook:
- m_camera->pan(dx * m_lookRate);
- break;
-
- case FirstPerson:
- m_camera->pan(dx * m_lookRate, m_firstPersonUp);
- break;
- }
-
- m_camera->tilt(dy * m_lookRate);
- } else if (m_orbitMode) {
- switch (m_controlMode) {
- case FreeLook:
- m_camera->panAboutViewCenter(dx * m_orbitRate);
- break;
-
- case FirstPerson:
- m_camera->panAboutViewCenter(dx * m_orbitRate, m_firstPersonUp);
- break;
- }
-
- m_camera->tiltAboutViewCenter(dy * m_orbitRate);
- }
-}
-
-bool CameraController::isMultisampleEnabled() const
-{
- return m_multisampleEnabled;
-}
-
-void CameraController::toggleMSAA()
-{
- m_multisampleEnabled = !m_multisampleEnabled;
- emit multisampleEnabledChanged(m_multisampleEnabled);
-}
-
-void CameraController::setControlMode(ControlMode controlMode)
-{
- if (controlMode != m_controlMode) {
- m_controlMode = controlMode;
- emit controlModeChanged(controlMode);
- }
-}
-
-CameraController::ControlMode CameraController::controlMode() const
-{
- return m_controlMode;
-}
-
-void CameraController::setFirstPersonUpVector(const QVector3D &up)
-{
- if (m_firstPersonUp != up) {
- m_firstPersonUp = up;
- emit firstPersonUpVectorChanged(up);
- }
-}
-
-QVector3D CameraController::firstPersonUpVector() const
-{
- return m_firstPersonUp;
-}
-
-bool CameraController::eventFilter(QObject *receiver, QEvent *event)
-{
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- mousePressEvent(static_cast<QT_PREPEND_NAMESPACE(QMouseEvent*)>(event));
- return true;
- case QEvent::MouseButtonRelease:
- mouseReleaseEvent(static_cast<QT_PREPEND_NAMESPACE(QMouseEvent*)>(event));
- return true;
- case QEvent::MouseMove:
- mouseMoveEvent(static_cast<QT_PREPEND_NAMESPACE(QMouseEvent*)>(event));
- return true;
- case QEvent::KeyPress:
- return keyPressEvent(static_cast<QT_PREPEND_NAMESPACE(QKeyEvent)*>(event));
- case QEvent::KeyRelease:
- return keyReleaseEvent(static_cast<QT_PREPEND_NAMESPACE(QKeyEvent)*>(event));
- default:
- return QObject::eventFilter(receiver, event);
- }
-}
-
-void CameraController::onUpdate()
-{
- update(1.0 / 60.0);
-}
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/cameracontroller_p.h b/src/input/backend/cameracontroller_p.h
deleted file mode 100644
index a539aa586..000000000
--- a/src/input/backend/cameracontroller_p.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERA_CONTROLLER_H
-#define CAMERA_CONTROLLER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QObject>
-
-#include <QPoint>
-#include <QtGui/qvector3d.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMouseEvent;
-class QWheelEvent;
-class QKeyEvent;
-class QTimer;
-
-namespace Qt3DCore {
-class QCamera;
-class QEntity;
-}
-
-namespace Qt3DInput {
-namespace Input {
-
-class CameraController : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY( float linearSpeed READ linearSpeed WRITE setLinearSpeed NOTIFY linearSpeedChanged )
- Q_PROPERTY( float orbitRate READ orbitRate WRITE setOrbitRate NOTIFY orbitRateChanged )
- Q_PROPERTY( float lookRate READ lookRate WRITE setLookRate NOTIFY lookRateChanged )
- Q_PROPERTY( bool multisampleEnabled READ isMultisampleEnabled NOTIFY multisampleEnabledChanged )
-
- Q_PROPERTY( ControlMode controlMode READ controlMode WRITE setControlMode NOTIFY controlModeChanged )
- Q_PROPERTY( QVector3D firstPersonUpVector READ firstPersonUpVector WRITE setFirstPersonUpVector NOTIFY firstPersonUpVectorChanged )
-
-public:
- explicit CameraController(QObject *parent = 0);
-
- void setCamera( Qt3DCore::QCamera* cam );
- Qt3DCore::QCamera *camera() const;
-
- void setLinearSpeed( float speed );
- float linearSpeed() const;
-
- float orbitRate() const;
- void setOrbitRate( float rate );
-
- float lookRate() const;
- void setLookRate( float rate );
-
- void mousePressEvent( QMouseEvent* aEvent );
- void mouseReleaseEvent( QMouseEvent* aEvent );
- void mouseMoveEvent( QMouseEvent* aEvent );
-
- bool keyPressEvent( QKeyEvent* aEvent );
- bool keyReleaseEvent( QKeyEvent* aEvent );
-
- void update( double t );
-
- bool isMultisampleEnabled() const;
-
- enum ControlMode {
- FreeLook,
- FirstPerson
- };
- Q_ENUM(ControlMode)
-
- void setControlMode( ControlMode controlMode );
- ControlMode controlMode() const;
-
- void setFirstPersonUpVector( const QVector3D &up );
- QVector3D firstPersonUpVector() const;
-
-public Q_SLOTS:
- void toggleMSAA();
-
-protected:
- bool eventFilter(QObject *receiver, QEvent *event) Q_DECL_OVERRIDE;
-
-Q_SIGNALS:
- void linearSpeedChanged(float speed);
- void orbitRateChanged(float rate);
- void lookRateChanged(float rate);
-
- void multisampleEnabledChanged(bool enabled);
-
- void controlModeChanged(ControlMode controlMode);
- void firstPersonUpVectorChanged(const QVector3D &up);
-
-private Q_SLOTS:
- void onUpdate();
-
-private:
- Qt3DCore::QCamera* m_camera;
- Qt3DCore::QEntity* m_cameraEntity;
-
- float m_vx;
- float m_vy;
- float m_vz;
- bool m_viewCenterFixed;
- float m_panAngle;
- float m_tiltAngle;
-
- bool m_leftButtonPressed;
- QPoint m_prevPos;
- QPoint m_pos;
- bool m_orbitMode;
-
- float m_linearSpeed;
- float m_time;
- float m_orbitRate;
- float m_lookRate;
-
- bool m_translateFast;
- bool m_multisampleEnabled;
-
- ControlMode m_controlMode;
- QVector3D m_firstPersonUp;
-
- QTimer *m_updateTimer;
-};
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // of CAMERA_CONTROLLER_H
diff --git a/src/input/backend/eventsourcesetterhelper.cpp b/src/input/backend/eventsourcesetterhelper.cpp
new file mode 100644
index 000000000..45ca68c39
--- /dev/null
+++ b/src/input/backend/eventsourcesetterhelper.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "eventsourcesetterhelper_p.h"
+#include "inputhandler_p.h"
+#include <Qt3DCore/private/qeventfilterservice_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+EventSourceSetterHelper::EventSourceSetterHelper(InputHandler *inputHandler)
+ : QObject()
+ , m_service(nullptr)
+ , m_inputHandler(inputHandler)
+ , m_lastEventSource(nullptr)
+{
+}
+
+// Aspect thread
+void EventSourceSetterHelper::setEventFilterService(Qt3DCore::QEventFilterService *service)
+{
+ QMutexLocker lock(&m_mutex);
+ m_service = service;
+}
+
+// Any thread
+void EventSourceSetterHelper::setEventSource(QObject *eventSource)
+{
+ if (eventSource && m_lastEventSource != eventSource) {
+ QMetaObject::invokeMethod(this,
+ "setEventSourceHelper",
+ Qt::BlockingQueuedConnection,
+ Q_ARG(QObject *, eventSource));
+ }
+}
+
+// Main Thread
+void EventSourceSetterHelper::setEventSourceHelper(QObject *eventSource)
+{
+ QMutexLocker lock(&m_mutex);
+ if (m_service) {
+ m_service->initialize(eventSource);
+ m_inputHandler->registerEventFilters(m_service);
+ m_lastEventSource = eventSource;
+ }
+}
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/eventsourcesetterhelper_p.h b/src/input/backend/eventsourcesetterhelper_p.h
new file mode 100644
index 000000000..8b2538a91
--- /dev/null
+++ b/src/input/backend/eventsourcesetterhelper_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef EVENTSOURCESETTERHELPER_H
+#define EVENTSOURCESETTERHELPER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QMutex>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QEventFilterService;
+}
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class InputHandler;
+
+class EventSourceSetterHelper : public QObject
+{
+ Q_OBJECT
+public:
+ explicit EventSourceSetterHelper(InputHandler *inputHandler);
+
+ // Called from aspect thread
+ void setEventFilterService(Qt3DCore::QEventFilterService *service);
+
+ // Called from any thread
+ void setEventSource(QObject *eventSource);
+
+private Q_SLOTS:
+ // Called in main thread
+ void setEventSourceHelper(QObject *);
+
+private:
+ Qt3DCore::QEventFilterService *m_service;
+ InputHandler *m_inputHandler;
+ QObject *m_lastEventSource;
+ QMutex m_mutex;
+};
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // EVENTSOURCESETTERHELPER_H
diff --git a/src/input/backend/genericdevicebackendnode.cpp b/src/input/backend/genericdevicebackendnode.cpp
new file mode 100644
index 000000000..093acd966
--- /dev/null
+++ b/src/input/backend/genericdevicebackendnode.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "genericdevicebackendnode_p.h"
+#include "inputhandler_p.h"
+#include "inputmanagers_p.h"
+
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+
+GenericDeviceBackendNode::GenericDeviceBackendNode(QBackendNode::Mode mode)
+ : QAbstractPhysicalDeviceBackendNode(mode)
+ , m_mutex()
+{
+}
+
+GenericDeviceBackendNode::~GenericDeviceBackendNode()
+{
+}
+
+void GenericDeviceBackendNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ if (propertyChange->propertyName() == QByteArrayLiteral("axisEvent")) {
+ QPair<int, qreal> val = propertyChange->value().value<QPair<int, qreal>>();
+ const QMutexLocker lock(&m_mutex);
+ m_axesValues[val.first] = val.second;
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("buttonEvent")) {
+ QPair<int, qreal> val = propertyChange->value().value<QPair<int, qreal>>();
+ const QMutexLocker lock(&m_mutex);
+ m_buttonsValues[val.first] = val.second;
+ }
+ }
+}
+
+void GenericDeviceBackendNode::cleanup()
+{
+ const QMutexLocker lock(&m_mutex);
+ m_axesValues.clear();
+ m_buttonsValues.clear();
+ QAbstractPhysicalDeviceBackendNode::cleanup();
+}
+
+float GenericDeviceBackendNode::axisValue(int axisIdentifier) const
+{
+ const QMutexLocker lock(&m_mutex);
+ return m_axesValues[axisIdentifier];
+}
+
+bool GenericDeviceBackendNode::isButtonPressed(int buttonIdentifier) const
+{
+ const QMutexLocker lock(&m_mutex);
+ return m_buttonsValues[buttonIdentifier];
+}
+
+GenericDeviceBackendFunctor::GenericDeviceBackendFunctor(QInputAspect *inputaspect, InputHandler *handler)
+ : m_inputAspect(inputaspect)
+ , m_handler(handler)
+{
+}
+
+Qt3DCore::QBackendNode *GenericDeviceBackendFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
+{
+ GenericDeviceBackendNode *backendNode = m_handler->genericDeviceBackendNodeManager()->getOrCreateResource(change->subjectId());
+ backendNode->setInputAspect(m_inputAspect);
+ m_handler->appendGenericDevice(m_handler->genericDeviceBackendNodeManager()->lookupHandle(change->subjectId()));
+ return backendNode;
+}
+
+Qt3DCore::QBackendNode *GenericDeviceBackendFunctor::get(Qt3DCore::QNodeId id) const
+{
+ return m_handler->genericDeviceBackendNodeManager()->lookupResource(id);
+}
+
+void GenericDeviceBackendFunctor::destroy(Qt3DCore::QNodeId id) const
+{
+ m_handler->removeGenericDevice(m_handler->genericDeviceBackendNodeManager()->lookupHandle(id));
+ m_handler->genericDeviceBackendNodeManager()->releaseResource(id);
+}
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/genericdevicebackendnode_p.h b/src/input/backend/genericdevicebackendnode_p.h
new file mode 100644
index 000000000..8c0ffcfde
--- /dev/null
+++ b/src/input/backend/genericdevicebackendnode_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GENERICDEVICEBACKENDNODE_H
+#define GENERICDEVICEBACKENDNODE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qabstractphysicaldevicebackendnode_p.h>
+#include <QHash>
+#include <QMutex>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractPhysicalDevice;
+
+namespace Input {
+class InputHandler;
+class GenericDeviceBackendNodeData;
+class GenericDeviceBackendNode : public QAbstractPhysicalDeviceBackendNode
+{
+public:
+ explicit GenericDeviceBackendNode(QBackendNode::Mode mode = QBackendNode::ReadWrite);
+ ~GenericDeviceBackendNode();
+ void updateEvents();
+
+ // QAbstractPhysicalDeviceBackendNode interface
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ void cleanup() Q_DECL_OVERRIDE;
+ float axisValue(int axisIdentifier) const Q_DECL_OVERRIDE;
+ bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE;
+
+private:
+ QHash<int, qreal> m_axesValues;
+ QHash<int, qreal> m_buttonsValues;
+ mutable QMutex m_mutex;
+};
+
+class GenericDeviceBackendFunctor : public Qt3DCore::QBackendNodeMapper
+{
+public:
+ explicit GenericDeviceBackendFunctor(QInputAspect *inputaspect, InputHandler *handler);
+
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+
+private:
+ QInputAspect *m_inputAspect;
+ InputHandler *m_handler;
+};
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // GENERICDEVICEBACKENDNODE_H
diff --git a/src/input/backend/handle_types_p.h b/src/input/backend/handle_types_p.h
index 03d8dee3c..d81a1225b 100644
--- a/src/input/backend/handle_types_p.h
+++ b/src/input/backend/handle_types_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,29 +58,35 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
namespace Input {
-class KeyboardController;
-class KeyboardInput;
-class MouseController;
-class MouseInput;
+class KeyboardDevice;
+class KeyboardHandler;
+class MouseHandler;
+class MouseDevice;
class Axis;
class AxisActionHandler;
-class AxisInput;
+class AbstractAxisInput;
class AxisSetting;
class Action;
class ActionInput;
+class InputSequence;
+class InputChord;
class LogicalDevice;
+class GenericDeviceBackendNode;
-typedef Qt3DCore::QHandle<KeyboardController, 8> HKeyboardController;
-typedef Qt3DCore::QHandle<KeyboardInput, 16> HKeyboardInput;
-typedef Qt3DCore::QHandle<MouseController, 8> HMouseController;
-typedef Qt3DCore::QHandle<MouseInput, 16> HMouseInput;
+typedef Qt3DCore::QHandle<KeyboardDevice, 8> HKeyboardDevice;
+typedef Qt3DCore::QHandle<KeyboardHandler, 16> HKeyboardHandler;
+typedef Qt3DCore::QHandle<MouseHandler, 16> HMouseHandler;
+typedef Qt3DCore::QHandle<MouseDevice, 8> HMouseDevice;
typedef Qt3DCore::QHandle<Axis, 16> HAxis;
typedef Qt3DCore::QHandle<AxisActionHandler, 16> HAxisActionHandler;
typedef Qt3DCore::QHandle<AxisSetting, 16> HAxisSetting;
typedef Qt3DCore::QHandle<Action, 16> HAction;
-typedef Qt3DCore::QHandle<AxisInput, 16> HAxisInput;
+typedef Qt3DCore::QHandle<AbstractAxisInput, 16> HAxisInput;
typedef Qt3DCore::QHandle<ActionInput, 16> HActionInput;
+typedef Qt3DCore::QHandle<InputSequence, 16> HInputSequence;
+typedef Qt3DCore::QHandle<InputChord, 16> HInputChord;
typedef Qt3DCore::QHandle<LogicalDevice, 16> HLogicalDevice;
+typedef Qt3DCore::QHandle<GenericDeviceBackendNode, 8> HGenericDeviceBackendNode;
} // namespace Input
} // namespace Qt3DInput
diff --git a/src/input/backend/inputbackendnodefunctor_p.h b/src/input/backend/inputbackendnodefunctor_p.h
index c885af075..f72ad4d94 100644
--- a/src/input/backend/inputbackendnodefunctor_p.h
+++ b/src/input/backend/inputbackendnodefunctor_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,7 +61,7 @@ namespace Qt3DInput {
namespace Input {
template<class Backend, class Manager>
-class InputNodeFunctor : public Qt3DCore::QBackendNodeFunctor
+class InputNodeFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
explicit InputNodeFunctor(Manager *manager)
@@ -66,20 +69,18 @@ public:
{
}
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_FINAL
{
- Backend *backend = m_manager->getOrCreateResource(frontend->id());
- backend->setFactory(factory);
- backend->setPeer(frontend);
+ Backend *backend = m_manager->getOrCreateResource(change->subjectId());
return backend;
}
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_FINAL
{
return m_manager->lookupResource(id);
}
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_FINAL
{
m_manager->releaseResource(id);
}
diff --git a/src/input/backend/inputchord.cpp b/src/input/backend/inputchord.cpp
new file mode 100644
index 000000000..7ecd611a8
--- /dev/null
+++ b/src/input/backend/inputchord.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "inputchord_p.h"
+#include <Qt3DInput/qinputchord.h>
+#include <Qt3DInput/private/qinputchord_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+InputChord::InputChord()
+ : Qt3DCore::QBackendNode()
+ , m_chords()
+ , m_inputsToTrigger()
+ , m_timeout(0)
+ , m_startTime(0)
+{
+}
+
+void InputChord::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QInputChordData>>(change);
+ const QInputChordData &data = typedChange->data;
+ m_chords = data.chordIds;
+ m_timeout = data.timeout;
+}
+
+void InputChord::cleanup()
+{
+ QBackendNode::setEnabled(false);
+ m_timeout = 0;
+ m_startTime = 0;
+ m_chords.clear();
+ m_inputsToTrigger.clear();
+}
+
+void InputChord::reset()
+{
+ m_startTime = 0;
+ m_inputsToTrigger = m_chords;
+}
+
+bool InputChord::actionTriggered(Qt3DCore::QNodeId input)
+{
+ m_inputsToTrigger.removeOne(input);
+ if (m_inputsToTrigger.isEmpty()) {
+ //All Triggered
+ reset();
+ return true;
+ }
+ return false;
+}
+
+void InputChord::setStartTime(qint64 time)
+{
+ m_startTime = time;
+}
+
+void InputChord::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ switch (e->type()) {
+ case Qt3DCore::PropertyUpdated: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("timeout"))
+ m_timeout = change->value().toInt();
+ break;
+ }
+
+ case Qt3DCore::PropertyValueAdded: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("chord")) {
+ m_chords.push_back(change->addedNodeId());
+ m_inputsToTrigger.push_back(change->addedNodeId());
+ }
+ break;
+ }
+
+ case Qt3DCore::PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("chord")) {
+ m_chords.removeOne(change->removedNodeId());
+ m_inputsToTrigger.removeOne(change->removedNodeId());
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ QBackendNode::sceneChangeEvent(e);
+}
+
+} // namespace Input
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
diff --git a/src/input/backend/inputchord_p.h b/src/input/backend/inputchord_p.h
new file mode 100644
index 000000000..db197df3c
--- /dev/null
+++ b/src/input/backend/inputchord_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_INPUTCHORD_H
+#define QT3DINPUT_INPUT_INPUTCHORD_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class Q_AUTOTEST_EXPORT InputChord : public Qt3DCore::QBackendNode
+{
+public:
+ InputChord();
+ void cleanup();
+
+ inline QVector<Qt3DCore::QNodeId> chords() const { return m_chords; }
+ inline int timeout() const { return m_timeout; }
+ inline qint64 startTime() const { return m_startTime; }
+ void setStartTime(qint64 time);
+ void reset();
+ bool actionTriggered(Qt3DCore::QNodeId input);
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<Qt3DCore::QNodeId> m_chords;
+ QVector<Qt3DCore::QNodeId> m_inputsToTrigger;
+ int m_timeout;
+ qint64 m_startTime;
+};
+
+} // namespace Input
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_INPUTCHORD_H
diff --git a/src/input/backend/inputhandler.cpp b/src/input/backend/inputhandler.cpp
index f81015dfe..6208c902f 100644
--- a/src/input/backend/inputhandler.cpp
+++ b/src/input/backend/inputhandler.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,6 +45,8 @@
#include "keyeventdispatcherjob_p.h"
#include "mouseeventdispatcherjob_p.h"
#include <Qt3DCore/private/qeventfilterservice_p.h>
+#include "inputsettings_p.h"
+#include "eventsourcesetterhelper_p.h"
QT_BEGIN_NAMESPACE
@@ -51,25 +56,53 @@ namespace Qt3DInput {
namespace Input {
InputHandler::InputHandler()
- : m_keyboardControllerManager(new KeyboardControllerManager())
+ : m_keyboardDeviceManager(new KeyboardDeviceManager())
, m_keyboardInputManager(new KeyboardInputManager())
- , m_mouseControllerManager(new MouseControllerManager())
+ , m_mouseDeviceManager(new MouseDeviceManager())
, m_mouseInputManager(new MouseInputManager())
, m_keyboardEventFilter(new KeyboardEventFilter())
, m_mouseEventFilter(new MouseEventFilter())
, m_axisManager(new AxisManager())
, m_actionManager(new ActionManager())
- , m_axisInputManager(new AxisInputManager())
- , m_axisActionHandlerManager(new AxisActionHandlerManager())
, m_axisSettingManager(new AxisSettingManager())
, m_actionInputManager(new ActionInputManager())
+ , m_analogAxisInputManager(new AnalogAxisInputManager())
+ , m_buttonAxisInputManager(new ButtonAxisInputManager())
+ , m_inputChordManager(new InputChordManager())
+ , m_inputSequenceManager(new InputSequenceManager())
, m_logicalDeviceManager(new LogicalDeviceManager())
+ , m_genericPhysicalDeviceBackendNodeManager(new GenericDeviceBackendNodeManager)
+ , m_settings(nullptr)
+ , m_eventSourceSetter(new Qt3DInput::Input::EventSourceSetterHelper(this))
{
m_keyboardEventFilter->setInputHandler(this);
m_mouseEventFilter->setInputHandler(this);
+
+ // Created in the main thread
+ // m_eventSourceSetter needs to be in the main thread
}
-// Called in MainThread
+InputHandler::~InputHandler()
+{
+ delete m_keyboardDeviceManager;
+ delete m_keyboardInputManager;
+ delete m_mouseDeviceManager;
+ delete m_mouseInputManager;
+ delete m_keyboardEventFilter;
+ delete m_mouseEventFilter;
+ delete m_axisManager;
+ delete m_actionManager;
+ delete m_axisSettingManager;
+ delete m_analogAxisInputManager;
+ delete m_buttonAxisInputManager;
+ delete m_actionInputManager;
+ delete m_inputChordManager;
+ delete m_inputSequenceManager;
+ delete m_logicalDeviceManager;
+ delete m_genericPhysicalDeviceBackendNodeManager;
+}
+
+// Called in MainThread (by the EventSourceHelperSetter)
void InputHandler::registerEventFilters(QEventFilterService *service)
{
clearPendingKeyEvents();
@@ -83,23 +116,21 @@ void InputHandler::registerEventFilters(QEventFilterService *service)
void InputHandler::appendKeyEvent(const QT_PREPEND_NAMESPACE(QKeyEvent) &event)
{
QMutexLocker lock(&m_mutex);
- m_pendingEvents.append(event);
+ m_pendingKeyEvents.append(event);
}
// Called by QInputASpect::jobsToExecute (aspectThread)
QList<QT_PREPEND_NAMESPACE(QKeyEvent)> InputHandler::pendingKeyEvents()
{
QMutexLocker lock(&m_mutex);
- QList<QT_PREPEND_NAMESPACE(QKeyEvent)> pendingEvents = m_pendingEvents;
- m_pendingEvents.clear();
- return pendingEvents;
+ return std::move(m_pendingKeyEvents);
}
// Called by QInputASpect::jobsToExecute (aspectThread)
void InputHandler::clearPendingKeyEvents()
{
QMutexLocker lock(&m_mutex);
- m_pendingEvents.clear();
+ m_pendingKeyEvents.clear();
}
void InputHandler::appendMouseEvent(const QT_PREPEND_NAMESPACE(QMouseEvent) &event)
@@ -111,9 +142,7 @@ void InputHandler::appendMouseEvent(const QT_PREPEND_NAMESPACE(QMouseEvent) &eve
QList<QT_PREPEND_NAMESPACE(QMouseEvent)> InputHandler::pendingMouseEvents()
{
QMutexLocker lock(&m_mutex);
- QList<QT_PREPEND_NAMESPACE(QMouseEvent)> pendingEvents = m_pendingMouseEvents;
- m_pendingMouseEvents.clear();
- return pendingEvents;
+ return std::move(m_pendingMouseEvents);
}
void InputHandler::clearPendingMouseEvents()
@@ -122,53 +151,82 @@ void InputHandler::clearPendingMouseEvents()
m_pendingMouseEvents.clear();
}
-void InputHandler::appendKeyboardController(HKeyboardController controller)
+void InputHandler::appendWheelEvent(const QT_PREPEND_NAMESPACE(QWheelEvent) &event)
+{
+ QMutexLocker lock(&m_mutex);
+ m_pendingWheelEvents.append(event);
+}
+
+QList<QT_PREPEND_NAMESPACE (QWheelEvent)> Qt3DInput::Input::InputHandler::pendingWheelEvents()
+{
+ QMutexLocker lock(&m_mutex);
+ return std::move(m_pendingWheelEvents);
+}
+
+void InputHandler::clearPendingWheelEvents()
+{
+ QMutexLocker lock(&m_mutex);
+ m_pendingWheelEvents.clear();
+}
+
+
+void InputHandler::appendKeyboardDevice(HKeyboardDevice device)
+{
+ m_activeKeyboardDevices.append(device);
+}
+
+void InputHandler::removeKeyboardDevice(HKeyboardDevice device)
+{
+ m_activeKeyboardDevices.removeAll(device);
+}
+
+void InputHandler::appendMouseDevice(HMouseDevice device)
{
- m_activeKeyboardControllers.append(controller);
+ m_activeMouseDevices.append(device);
}
-void InputHandler::removeKeyboardController(HKeyboardController controller)
+void InputHandler::removeMouseDevice(HMouseDevice device)
{
- m_activeKeyboardControllers.removeAll(controller);
+ m_activeMouseDevices.removeAll(device);
}
-void InputHandler::appendMouseController(HMouseController controller)
+void Qt3DInput::Input::InputHandler::appendGenericDevice(HGenericDeviceBackendNode device)
{
- m_activeMouseControllers.append(controller);
+ m_activeGenericPhysicalDevices.append(device);
}
-void InputHandler::removeMouseController(HMouseController controller)
+void Qt3DInput::Input::InputHandler::removeGenericDevice(HGenericDeviceBackendNode device)
{
- m_activeMouseControllers.removeAll(controller);
+ m_activeGenericPhysicalDevices.removeAll(device);
}
// Return a vector of jobs to be performed for keyboard events
// Handles all dependencies between jobs
QVector<Qt3DCore::QAspectJobPtr> InputHandler::keyboardJobs()
{
- // One job for Keyboard focus change event per Keyboard Controller
+ // One job for Keyboard focus change event per Keyboard device
QVector<QAspectJobPtr> jobs;
const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> events = pendingKeyEvents();
- Q_FOREACH (const HKeyboardController cHandle, m_activeKeyboardControllers) {
- KeyboardController *controller = m_keyboardControllerManager->data(cHandle);
- controller->updateKeyEvents(events);
- if (controller) {
- QAspectJobPtr focusChangeJob;
- if (controller->lastKeyboardInputRequester() != controller->currentFocusItem()) {
- AssignKeyboardFocusJob *job = new AssignKeyboardFocusJob(controller->peerUuid());
+ for (const HKeyboardDevice cHandle : qAsConst(m_activeKeyboardDevices)) {
+ KeyboardDevice *keyboardDevice = m_keyboardDeviceManager->data(cHandle);
+ if (keyboardDevice) {
+ keyboardDevice->updateKeyEvents(events);
+ bool haveFocusChangeJob = false;
+ if (keyboardDevice->lastKeyboardInputRequester() != keyboardDevice->currentFocusItem()) {
+ auto job = QSharedPointer<AssignKeyboardFocusJob>::create(keyboardDevice->peerId());
job->setInputHandler(this);
- focusChangeJob.reset(job);
- jobs.append(focusChangeJob);
+ haveFocusChangeJob= true;
+ jobs.append(std::move(job));
// One job for Keyboard events (depends on the focus change job if there was one)
}
// Event dispacthing job
if (!events.isEmpty()) {
- KeyEventDispatcherJob *job = new KeyEventDispatcherJob(controller->currentFocusItem(), events);
+ auto job = QSharedPointer<KeyEventDispatcherJob>::create(keyboardDevice->currentFocusItem(), events);
job->setInputHandler(this);
- if (focusChangeJob)
- job->addDependency(focusChangeJob);
- jobs.append(QAspectJobPtr(job));
+ if (haveFocusChangeJob)
+ job->addDependency(qAsConst(jobs).back());
+ jobs.append(std::move(job));
}
}
}
@@ -178,16 +236,20 @@ QVector<Qt3DCore::QAspectJobPtr> InputHandler::keyboardJobs()
QVector<Qt3DCore::QAspectJobPtr> InputHandler::mouseJobs()
{
QVector<QAspectJobPtr> jobs;
- const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> events = pendingMouseEvents();
+ const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> mouseEvents = pendingMouseEvents();
+ const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> wheelEvents = pendingWheelEvents();
- Q_FOREACH (const HMouseController cHandle, m_activeMouseControllers) {
- MouseController *controller = m_mouseControllerManager->data(cHandle);
+ for (const HMouseDevice cHandle : qAsConst(m_activeMouseDevices)) {
+ MouseDevice *controller = m_mouseDeviceManager->data(cHandle);
- controller->updateMouseEvents(events);
+ controller->updateMouseEvents(mouseEvents);
// Event dispacthing job
- if (!events.isEmpty()) {
- Q_FOREACH (const QNodeId &input, controller->mouseInputs()) {
- MouseEventDispatcherJob *job = new MouseEventDispatcherJob(input, events);
+ if (!mouseEvents.isEmpty() || !wheelEvents.empty()) {
+ const QVector<Qt3DCore::QNodeId> mouseInputs = controller->mouseInputs();
+ for (QNodeId input : mouseInputs) {
+ MouseEventDispatcherJob *job = new MouseEventDispatcherJob(input,
+ mouseEvents,
+ wheelEvents);
job->setInputHandler(this);
jobs.append(QAspectJobPtr(job));
}
@@ -207,6 +269,31 @@ void InputHandler::addInputDeviceIntegration(QInputDeviceIntegration *inputInteg
m_inputDeviceIntegrations.push_back(inputIntegration);
}
+void InputHandler::setInputSettings(InputSettings *settings)
+{
+ m_settings = settings;
+}
+
+void InputHandler::setEventSourceHelper(EventSourceSetterHelper *helper)
+{
+ m_eventSourceSetter.reset(helper);
+}
+
+EventSourceSetterHelper *InputHandler::eventSourceHelper() const
+{
+ return m_eventSourceSetter.data();
+}
+
+void InputHandler::updateEventSource()
+{
+ if (m_settings != nullptr) {
+ // Will be updated only if eventSource is different than
+ // what was set last
+ QObject *eventSource = m_settings->eventSource();
+ m_eventSourceSetter->setEventSource(eventSource);
+ }
+}
+
} // namespace Input
} // namespace Qt3DInput
diff --git a/src/input/backend/inputhandler_p.h b/src/input/backend/inputhandler_p.h
index e08e916e7..4f785bc9f 100644
--- a/src/input/backend/inputhandler_p.h
+++ b/src/input/backend/inputhandler_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -67,51 +70,67 @@ class QInputDeviceIntegration;
namespace Input {
class KeyboardInputManager;
-class KeyboardControllerManager;
+class KeyboardDeviceManager;
class KeyboardEventFilter;
-class MouseControllerManager;
+class MouseDeviceManager;
class MouseInputManager;
class MouseEventFilter;
class AxisManager;
-class AxisActionHandlerManager;
class ActionManager;
-class AxisInputManager;
class AxisSettingManager;
class ActionInputManager;
+class AnalogAxisInputManager;
+class ButtonAxisInputManager;
+class InputChordManager;
+class InputSequenceManager;
class LogicalDeviceManager;
+class GenericPhysicalDeviceManager;
+class GenericDeviceBackendNodeManager;
+class InputSettings;
+class EventSourceSetterHelper;
class InputHandler
{
public:
InputHandler();
+ ~InputHandler();
- void registerEventFilters(Qt3DCore::QEventFilterService *service);
-
- inline KeyboardControllerManager *keyboardControllerManager() const { return m_keyboardControllerManager; }
+ inline KeyboardDeviceManager *keyboardDeviceManager() const { return m_keyboardDeviceManager; }
inline KeyboardInputManager *keyboardInputManager() const { return m_keyboardInputManager; }
- inline MouseControllerManager *mouseControllerManager() const { return m_mouseControllerManager; }
+ inline MouseDeviceManager *mouseDeviceManager() const { return m_mouseDeviceManager; }
inline MouseInputManager *mouseInputManager() const { return m_mouseInputManager; }
inline AxisManager *axisManager() const { return m_axisManager; }
inline ActionManager *actionManager() const { return m_actionManager; }
- inline AxisInputManager *axisInputManager() const { return m_axisInputManager; }
- inline AxisActionHandlerManager *axisActionHandlerManager() const { return m_axisActionHandlerManager; }
inline AxisSettingManager *axisSettingManager() const { return m_axisSettingManager; }
inline ActionInputManager *actionInputManager() const { return m_actionInputManager; }
+ inline AnalogAxisInputManager *analogAxisInputManager() const { return m_analogAxisInputManager; }
+ inline ButtonAxisInputManager *buttonAxisInputManager() const { return m_buttonAxisInputManager; }
+ inline InputChordManager *inputChordManager() const { return m_inputChordManager; }
+ inline InputSequenceManager *inputSequenceManager() const { return m_inputSequenceManager; }
inline LogicalDeviceManager *logicalDeviceManager() const { return m_logicalDeviceManager; }
+ inline GenericDeviceBackendNodeManager *genericDeviceBackendNodeManager() const { return m_genericPhysicalDeviceBackendNodeManager; }
+ inline InputSettings *inputSettings() const { return m_settings; }
void appendKeyEvent(const QT_PREPEND_NAMESPACE(QKeyEvent) &event);
QList<QT_PREPEND_NAMESPACE(QKeyEvent)> pendingKeyEvents();
void clearPendingKeyEvents();
- void appendMouseEvent(const QMouseEvent &event);
- QList<QMouseEvent> pendingMouseEvents();
+ void appendMouseEvent(const QT_PREPEND_NAMESPACE(QMouseEvent) &event);
+ QList<QT_PREPEND_NAMESPACE(QMouseEvent)> pendingMouseEvents();
void clearPendingMouseEvents();
- void appendKeyboardController(HKeyboardController controller);
- void removeKeyboardController(HKeyboardController controller);
+ void appendWheelEvent(const QT_PREPEND_NAMESPACE(QWheelEvent) &event);
+ QList<QT_PREPEND_NAMESPACE(QWheelEvent)> pendingWheelEvents();
+ void clearPendingWheelEvents();
+
+ void appendKeyboardDevice(HKeyboardDevice device);
+ void removeKeyboardDevice(HKeyboardDevice device);
- void appendMouseController(HMouseController controller);
- void removeMouseController(HMouseController controller);
+ void appendMouseDevice(HMouseDevice device);
+ void removeMouseDevice(HMouseDevice device);
+
+ void appendGenericDevice(HGenericDeviceBackendNode device);
+ void removeGenericDevice(HGenericDeviceBackendNode device);
QVector<Qt3DCore::QAspectJobPtr> keyboardJobs();
QVector<Qt3DCore::QAspectJobPtr> mouseJobs();
@@ -119,28 +138,45 @@ public:
QVector<Qt3DInput::QInputDeviceIntegration *> inputDeviceIntegrations() const;
void addInputDeviceIntegration(QInputDeviceIntegration *inputIntegration);
+ void setInputSettings(InputSettings *settings);
+ void setEventSourceHelper(EventSourceSetterHelper *helper);
+ EventSourceSetterHelper *eventSourceHelper() const;
+
+ void updateEventSource();
+
private:
- KeyboardControllerManager *m_keyboardControllerManager;
+ KeyboardDeviceManager *m_keyboardDeviceManager;
KeyboardInputManager *m_keyboardInputManager;
- MouseControllerManager *m_mouseControllerManager;
+ MouseDeviceManager *m_mouseDeviceManager;
MouseInputManager *m_mouseInputManager;
- QVector<HKeyboardController> m_activeKeyboardControllers;
- QVector<HMouseController> m_activeMouseControllers;
+ QVector<HKeyboardDevice> m_activeKeyboardDevices;
+ QVector<HMouseDevice> m_activeMouseDevices;
+ QVector<HGenericDeviceBackendNode> m_activeGenericPhysicalDevices;
KeyboardEventFilter *m_keyboardEventFilter;
- QList<QT_PREPEND_NAMESPACE(QKeyEvent)> m_pendingEvents;
MouseEventFilter *m_mouseEventFilter;
- QList<QMouseEvent> m_pendingMouseEvents;
+
+ QList<QT_PREPEND_NAMESPACE(QKeyEvent)> m_pendingKeyEvents;
+ QList<QT_PREPEND_NAMESPACE(QMouseEvent)> m_pendingMouseEvents;
+ QList<QT_PREPEND_NAMESPACE(QWheelEvent)> m_pendingWheelEvents;
mutable QMutex m_mutex;
AxisManager *m_axisManager;
ActionManager *m_actionManager;
- AxisInputManager *m_axisInputManager;
- AxisActionHandlerManager *m_axisActionHandlerManager;
AxisSettingManager *m_axisSettingManager;
ActionInputManager *m_actionInputManager;
+ AnalogAxisInputManager *m_analogAxisInputManager;
+ ButtonAxisInputManager *m_buttonAxisInputManager;
+ InputChordManager *m_inputChordManager;
+ InputSequenceManager *m_inputSequenceManager;
LogicalDeviceManager *m_logicalDeviceManager;
+ GenericDeviceBackendNodeManager *m_genericPhysicalDeviceBackendNodeManager;
QVector<Qt3DInput::QInputDeviceIntegration *> m_inputDeviceIntegrations;
+ InputSettings *m_settings;
+ QScopedPointer<EventSourceSetterHelper> m_eventSourceSetter;
+
+ void registerEventFilters(Qt3DCore::QEventFilterService *service);
+ friend class EventSourceSetterHelper;
};
} // namespace Input
diff --git a/src/input/backend/inputmanagers_p.h b/src/input/backend/inputmanagers_p.h
index eb7cc8800..9473dbf45 100644
--- a/src/input/backend/inputmanagers_p.h
+++ b/src/input/backend/inputmanagers_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,18 +53,21 @@
#include <QtGlobal>
#include <Qt3DInput/private/handle_types_p.h>
-#include <Qt3DInput/private/keyboardcontroller_p.h>
-#include <Qt3DInput/private/keyboardinput_p.h>
-#include <Qt3DInput/private/mousecontroller_p.h>
-#include <Qt3DInput/private/mouseinput_p.h>
+#include <Qt3DInput/private/keyboarddevice_p.h>
+#include <Qt3DInput/private/keyboardhandler_p.h>
+#include <Qt3DInput/private/mousehandler_p.h>
+#include <Qt3DInput/private/mousedevice_p.h>
#include <Qt3DCore/private/qresourcemanager_p.h>
#include <Qt3DInput/private/actioninput_p.h>
-#include <Qt3DInput/private/axisinput_p.h>
+#include <Qt3DInput/private/inputsequence_p.h>
+#include <Qt3DInput/private/inputchord_p.h>
#include <Qt3DInput/private/action_p.h>
#include <Qt3DInput/private/axis_p.h>
-#include <Qt3DInput/private/axisactionhandler_p.h>
#include <Qt3DInput/private/axissetting_p.h>
+#include <Qt3DInput/private/analogaxisinput_p.h>
+#include <Qt3DInput/private/buttonaxisinput_p.h>
#include <Qt3DInput/private/logicaldevice_p.h>
+#include <Qt3DInput/private/genericdevicebackendnode_p.h>
QT_BEGIN_NAMESPACE
@@ -69,7 +75,7 @@ namespace Qt3DInput {
namespace Input {
class KeyboardInputManager : public Qt3DCore::QResourceManager<
- KeyboardInput,
+ KeyboardHandler,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy>
@@ -78,28 +84,28 @@ public:
KeyboardInputManager() {}
};
-class KeyboardControllerManager : public Qt3DCore::QResourceManager<
- KeyboardController,
+class KeyboardDeviceManager : public Qt3DCore::QResourceManager<
+ KeyboardDevice,
Qt3DCore::QNodeId,
8,
Qt3DCore::ArrayAllocatingPolicy>
{
public:
- KeyboardControllerManager() {}
+ KeyboardDeviceManager() {}
};
-class MouseControllerManager : public Qt3DCore::QResourceManager<
- MouseController,
+class MouseDeviceManager : public Qt3DCore::QResourceManager<
+ MouseDevice,
Qt3DCore::QNodeId,
8,
Qt3DCore::ArrayAllocatingPolicy>
{
public:
- MouseControllerManager() {}
+ MouseDeviceManager() {}
};
class MouseInputManager : public Qt3DCore::QResourceManager<
- MouseInput,
+ MouseHandler,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy>
@@ -118,61 +124,74 @@ public:
AxisManager() {}
};
-class AxisActionHandlerManager : public Qt3DCore::QResourceManager<
- AxisActionHandler,
+class AxisSettingManager : public Qt3DCore::QResourceManager<
+ AxisSetting,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy>
{
public:
- AxisActionHandlerManager() {}
+ AxisSettingManager() {}
+};
- void addActiveAxisActionHandler(HAxisActionHandler handle) { m_activeAxisActionHandlers.push_back(handle); }
- void removeActiveAxisActionHandler(HAxisActionHandler handle) { m_activeAxisActionHandlers.removeOne(handle); }
- QVector<HAxisActionHandler> activeAxisActionHandlers() const { return m_activeAxisActionHandlers; }
+class ActionManager : public Qt3DCore::QResourceManager<
+ Action,
+ Qt3DCore::QNodeId,
+ 16,
+ Qt3DCore::ArrayAllocatingPolicy>
+{
+public:
+ ActionManager() {}
+};
-private:
- QVector<HAxisActionHandler> m_activeAxisActionHandlers;
+class ActionInputManager : public Qt3DCore::QResourceManager<
+ ActionInput,
+ Qt3DCore::QNodeId,
+ 16,
+ Qt3DCore::ArrayAllocatingPolicy>
+{
+public:
+ ActionInputManager() {}
};
-class AxisSettingManager : public Qt3DCore::QResourceManager<
- AxisSetting,
+class AnalogAxisInputManager : public Qt3DCore::QResourceManager<
+ AnalogAxisInput,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy>
{
public:
- AxisSettingManager() {}
+ AnalogAxisInputManager() {}
};
-class AxisInputManager : public Qt3DCore::QResourceManager<
- AxisInput,
+class ButtonAxisInputManager : public Qt3DCore::QResourceManager<
+ ButtonAxisInput,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy>
{
public:
- AxisInputManager() {}
+ ButtonAxisInputManager() {}
};
-class ActionManager : public Qt3DCore::QResourceManager<
- Action,
+class InputChordManager : public Qt3DCore::QResourceManager<
+ InputChord,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy>
{
public:
- ActionManager() {}
+ InputChordManager() {}
};
-class ActionInputManager : public Qt3DCore::QResourceManager<
- ActionInput,
+class InputSequenceManager : public Qt3DCore::QResourceManager<
+ InputSequence,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy>
{
public:
- ActionInputManager() {}
+ InputSequenceManager() {}
};
class LogicalDeviceManager : public Qt3DCore::QResourceManager<
@@ -192,6 +211,16 @@ private:
QVector<HLogicalDevice> m_activeDevices;
};
+class GenericDeviceBackendNodeManager : public Qt3DCore::QResourceManager<
+ GenericDeviceBackendNode,
+ Qt3DCore::QNodeId,
+ 8,
+ Qt3DCore::ArrayAllocatingPolicy>
+{
+public:
+ GenericDeviceBackendNodeManager() {}
+};
+
} // namespace Input
} // namespace Qt3DInput
diff --git a/src/input/backend/inputsequence.cpp b/src/input/backend/inputsequence.cpp
new file mode 100644
index 000000000..aae88f9a1
--- /dev/null
+++ b/src/input/backend/inputsequence.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "inputsequence_p.h"
+#include <Qt3DInput/qinputsequence.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/private/qinputsequence_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <QDateTime>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+InputSequence::InputSequence()
+ : Qt3DCore::QBackendNode()
+ , m_sequences()
+ , m_inputsToTrigger()
+ , m_timeout(0)
+ , m_buttonInterval(0)
+ , m_startTime(0)
+ , m_lastInputTime(0)
+{
+}
+
+void InputSequence::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QInputSequenceData>>(change);
+ const QInputSequenceData &data = typedChange->data;
+ m_sequences = data.sequenceIds;
+ m_timeout = data.timeout;
+ m_buttonInterval = data.buttonInterval;
+}
+
+void InputSequence::cleanup()
+{
+ QBackendNode::setEnabled(false);
+ m_timeout = 0;
+ m_buttonInterval = 0;
+ m_startTime = 0;
+ m_lastInputTime = 0;
+ m_lastInputId = Qt3DCore::QNodeId();
+ m_sequences.clear();
+ m_inputsToTrigger.clear();
+}
+
+void InputSequence::setStartTime(qint64 time)
+{
+ m_startTime = time;
+}
+
+void InputSequence::reset()
+{
+ m_startTime = 0;
+ m_lastInputTime = 0;
+ m_inputsToTrigger = m_sequences;
+ m_lastInputId = Qt3DCore::QNodeId();
+}
+
+bool InputSequence::actionTriggered(Qt3DCore::QNodeId input, const qint64 currentTime)
+{
+ // Save the last input
+ m_lastInputId = input;
+ // Return false if we've spent too much time in between two sequences
+ if ((m_lastInputTime != 0) && ((currentTime - m_lastInputTime) > m_buttonInterval)) {
+ reset();
+ return false;
+ }
+
+ // Update lastInputTime and remove the inputs to trigger from the sequence
+ m_lastInputTime = currentTime;
+ m_inputsToTrigger.removeOne(input);
+
+ // If we have no more remaining inputs in the sequences of inputs
+ if (m_inputsToTrigger.isEmpty()) {
+ // All Triggered
+ reset();
+ return true;
+ }
+ return false;
+}
+
+void InputSequence::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ switch (e->type()) {
+ case Qt3DCore::PropertyUpdated: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("timeout")) {
+ m_timeout = change->value().toInt();
+ } else if (change->propertyName() == QByteArrayLiteral("buttonInterval")) {
+ m_buttonInterval = change->value().toInt();
+ }
+ break;
+ }
+
+ case Qt3DCore::PropertyValueAdded: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("sequence")) {
+ m_sequences.push_back(change->addedNodeId());
+ m_inputsToTrigger.push_back(change->addedNodeId());
+ }
+ break;
+ }
+
+ case Qt3DCore::PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("sequence")) {
+ m_sequences.removeOne(change->removedNodeId());
+ m_inputsToTrigger.removeOne(change->removedNodeId());
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ QBackendNode::sceneChangeEvent(e);
+}
+
+} // namespace Input
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
diff --git a/src/input/backend/inputsequence_p.h b/src/input/backend/inputsequence_p.h
new file mode 100644
index 000000000..a76457f4e
--- /dev/null
+++ b/src/input/backend/inputsequence_p.h
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_INPUTSEQUENCE_H
+#define QT3DINPUT_INPUT_INPUTSEQUENCE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class Q_AUTOTEST_EXPORT InputSequence : public Qt3DCore::QBackendNode
+{
+public:
+ InputSequence();
+ void cleanup();
+
+ inline QVector<Qt3DCore::QNodeId> sequences() const { return m_sequences; }
+ inline int timeout() const { return m_timeout; }
+ inline int buttonInterval() const { return m_buttonInterval; }
+ inline qint64 startTime() const { return m_startTime; }
+ void setStartTime(qint64 time);
+ bool sequenceTriggered() const;
+ void reset();
+ bool actionTriggered(Qt3DCore::QNodeId input, const qint64 currentTime);
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<Qt3DCore::QNodeId> m_sequences;
+ QVector<Qt3DCore::QNodeId> m_inputsToTrigger;
+ int m_timeout;
+ int m_buttonInterval;
+ qint64 m_startTime;
+ qint64 m_lastInputTime;
+ Qt3DCore::QNodeId m_lastInputId;
+};
+
+} // namespace Input
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_INPUTSEQUENCE_H
diff --git a/src/input/backend/inputsettings.cpp b/src/input/backend/inputsettings.cpp
new file mode 100644
index 000000000..587e4ce1a
--- /dev/null
+++ b/src/input/backend/inputsettings.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "inputsettings_p.h"
+#include <Qt3DInput/qinputsettings.h>
+#include <Qt3DInput/private/inputhandler_p.h>
+#include <Qt3DInput/private/qinputsettings_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+InputSettings::InputSettings()
+ : QBackendNode(QBackendNode::ReadOnly)
+ , m_eventSource(nullptr)
+{
+}
+
+void InputSettings::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QInputSettingsData>>(change);
+ const auto &data = typedChange->data;
+ m_eventSource = data.eventSource;
+}
+
+void InputSettings::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("eventSource"))
+ m_eventSource = propertyChange->value().value<QObject *>();
+ }
+ QBackendNode::sceneChangeEvent(e);
+}
+
+InputSettingsFunctor::InputSettingsFunctor(InputHandler *handler)
+ : m_handler(handler)
+{
+}
+
+Qt3DCore::QBackendNode *InputSettingsFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
+{
+ Q_UNUSED(change);
+ if (m_handler->inputSettings() != nullptr) {
+ qWarning() << "Input settings already specified";
+ return nullptr;
+ }
+
+ InputSettings *settings = new InputSettings();
+ m_handler->setInputSettings(settings);
+ return settings;
+}
+
+Qt3DCore::QBackendNode *InputSettingsFunctor::get(Qt3DCore::QNodeId id) const
+{
+ InputSettings *settings = m_handler->inputSettings();
+ if (settings != nullptr && settings->peerId() == id)
+ return settings;
+ return nullptr;
+}
+
+void InputSettingsFunctor::destroy(Qt3DCore::QNodeId id) const
+{
+ InputSettings *settings = m_handler->inputSettings();
+ if (settings != nullptr && settings->peerId() == id) {
+ m_handler->setInputSettings(nullptr);
+ delete settings;
+ }
+}
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/inputsettings_p.h b/src/input/backend/inputsettings_p.h
new file mode 100644
index 000000000..386716bc5
--- /dev/null
+++ b/src/input/backend/inputsettings_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_INPUTSETTINGS_H
+#define QT3DINPUT_INPUT_INPUTSETTINGS_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QPointer>
+#include <Qt3DCore/qbackendnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class InputHandler;
+
+class InputSettings : public Qt3DCore::QBackendNode
+{
+public:
+ InputSettings();
+ inline QObject *eventSource() const { return m_eventSource; }
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QPointer<QObject> m_eventSource;
+};
+
+class InputSettingsFunctor : public Qt3DCore::QBackendNodeMapper
+{
+public:
+ explicit InputSettingsFunctor(InputHandler *handler);
+
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+
+private:
+ InputHandler *m_handler;
+};
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_INPUTSETTINGS_H
diff --git a/src/input/backend/keyboardcontroller.cpp b/src/input/backend/keyboardcontroller.cpp
deleted file mode 100644
index 30e1a2af3..000000000
--- a/src/input/backend/keyboardcontroller.cpp
+++ /dev/null
@@ -1,480 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "keyboardcontroller_p.h"
-#include "inputhandler_p.h"
-#include "inputmanagers_p.h"
-#include <Qt3DCore/qnode.h>
-
-#include <QKeyEvent>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-namespace Input {
-
-namespace {
-
-QPair<int, int> getKeyPosition(int key)
-{
- QPair<int, int> position;
-
- switch (key) {
- case Qt::Key_Escape:
- return QPair<int, int>(0, 0);
- case Qt::Key_Tab:
- return QPair<int, int>(0, 1);
- case Qt::Key_Backtab:
- return QPair<int, int>(0, 2);
- case Qt::Key_Backspace:
- return QPair<int, int>(0, 3);
- case Qt::Key_Return:
- return QPair<int, int>(0, 4);
- case Qt::Key_Enter:
- return QPair<int, int>(0, 5);
- case Qt::Key_Insert:
- return QPair<int, int>(0, 6);
- case Qt::Key_Delete:
- return QPair<int, int>(0, 7);
- case Qt::Key_Pause:
- return QPair<int, int>(0, 8);
- case Qt::Key_Print:
- return QPair<int, int>(0, 9);
- case Qt::Key_SysReq:
- return QPair<int, int>(0, 10);
- case Qt::Key_Clear:
- return QPair<int, int>(0, 11);
- case Qt::Key_Home:
- return QPair<int, int>(0, 12);
- case Qt::Key_End:
- return QPair<int, int>(0, 13);
- case Qt::Key_Left:
- return QPair<int, int>(0, 14);
- case Qt::Key_Right:
- return QPair<int, int>(0, 16);
- case Qt::Key_Up:
- return QPair<int, int>(0, 15);
- case Qt::Key_Down:
- return QPair<int, int>(0, 17);
- case Qt::Key_PageUp:
- return QPair<int, int>(0, 18);
- case Qt::Key_PageDown:
- return QPair<int, int>(0, 19);
- case Qt::Key_Shift:
- return QPair<int, int>(0, 20);
- case Qt::Key_Alt:
- return QPair<int, int>(0, 23);
- case Qt::Key_Control:
- return QPair<int, int>(0, 21);
- case Qt::Key_Meta:
- return QPair<int, int>(0, 22);
- case Qt::Key_CapsLock:
- return QPair<int, int>(0, 24);
- case Qt::Key_NumLock:
- return QPair<int, int>(0, 25);
- case Qt::Key_ScrollLock:
- return QPair<int, int>(0, 26);
- case Qt::Key_F1:
- return QPair<int, int>(0, 27);
- case Qt::Key_F2:
- return QPair<int, int>(0, 28);
- case Qt::Key_F3:
- return QPair<int, int>(0, 29);
- case Qt::Key_F4:
- return QPair<int, int>(0, 30);
- case Qt::Key_F5:
- return QPair<int, int>(0, 31);
- case Qt::Key_F6:
- return QPair<int, int>(1, 0);
- case Qt::Key_F7:
- return QPair<int, int>(1, 1);
- case Qt::Key_F8:
- return QPair<int, int>(1, 2);
- case Qt::Key_F9:
- return QPair<int, int>(1, 3);
- case Qt::Key_F10:
- return QPair<int, int>(1, 4);
- case Qt::Key_F11:
- return QPair<int, int>(1, 5);
- case Qt::Key_F12:
- return QPair<int, int>(1, 6);
- case Qt::Key_F13:
- return QPair<int, int>(1, 7);
- case Qt::Key_F14:
- return QPair<int, int>(1, 8);
- case Qt::Key_F15:
- return QPair<int, int>(1, 9);
- case Qt::Key_F16:
- return QPair<int, int>(1, 10);
- case Qt::Key_F17:
- return QPair<int, int>(1, 11);
- case Qt::Key_F18:
- return QPair<int, int>(1, 12);
- case Qt::Key_F19:
- return QPair<int, int>(1, 13);
- case Qt::Key_F20:
- return QPair<int, int>(1, 14);
- case Qt::Key_F21:
- return QPair<int, int>(1, 15);
- case Qt::Key_F22:
- return QPair<int, int>(1, 16);
- case Qt::Key_F23:
- return QPair<int, int>(1, 17);
- case Qt::Key_F24:
- return QPair<int, int>(1, 18);
- case Qt::Key_F25:
- return QPair<int, int>(1, 19);
- case Qt::Key_F26:
- return QPair<int, int>(1, 20);
- case Qt::Key_F27:
- return QPair<int, int>(1, 21);
- case Qt::Key_F28:
- return QPair<int, int>(1, 22);
- case Qt::Key_F29:
- return QPair<int, int>(1, 23);
- case Qt::Key_F30:
- return QPair<int, int>(1, 24);
- case Qt::Key_F31:
- return QPair<int, int>(1, 25);
- case Qt::Key_F32:
- return QPair<int, int>(1, 26);
- case Qt::Key_F33:
- return QPair<int, int>(1, 27);
- case Qt::Key_F34:
- return QPair<int, int>(1, 28);
- case Qt::Key_F35:
- return QPair<int, int>(1, 29);
- case Qt::Key_Super_L:
- return QPair<int, int>(1, 30);
- case Qt::Key_Super_R:
- return QPair<int, int>(1, 31);
- case Qt::Key_Menu:
- return QPair<int, int>(2, 1);
- case Qt::Key_Help:
- return QPair<int, int>(2, 4);
- case Qt::Key_Hyper_L:
- return QPair<int, int>(2, 2);
- case Qt::Key_Hyper_R:
- return QPair<int, int>(2, 3);
- case Qt::Key_Direction_L:
- return QPair<int, int>(2, 5);
- case Qt::Key_Direction_R:
- return QPair<int, int>(2, 6);
- case Qt::Key_Space:
- return QPair<int, int>(2, 7);
- case Qt::Key_Exclam:
- return QPair<int, int>(2, 9);
- case Qt::Key_QuoteDbl:
- return QPair<int, int>(2, 10);
- case Qt::Key_NumberSign:
- return QPair<int, int>(2, 11);
- case Qt::Key_Dollar:
- return QPair<int, int>(2, 12);
- case Qt::Key_Percent:
- return QPair<int, int>(2, 13);
- case Qt::Key_Ampersand:
- return QPair<int, int>(2, 14);
- case Qt::Key_Apostrophe:
- return QPair<int, int>(2, 15);
- case Qt::Key_ParenLeft:
- return QPair<int, int>(2, 16);
- case Qt::Key_ParenRight:
- return QPair<int, int>(2, 17);
- case Qt::Key_Asterisk:
- return QPair<int, int>(2, 18);
- case Qt::Key_Plus:
- return QPair<int, int>(2, 19);
- case Qt::Key_Comma:
- return QPair<int, int>(2, 20);
- case Qt::Key_Minus:
- return QPair<int, int>(2, 21);
- case Qt::Key_Period:
- return QPair<int, int>(2, 22);
- case Qt::Key_Slash:
- return QPair<int, int>(2, 23);
- case Qt::Key_0:
- return QPair<int, int>(2, 24);
- case Qt::Key_1:
- return QPair<int, int>(2, 25);
- case Qt::Key_2:
- return QPair<int, int>(2, 26);
- case Qt::Key_3:
- return QPair<int, int>(2, 27);
- case Qt::Key_4:
- return QPair<int, int>(2, 28);
- case Qt::Key_5:
- return QPair<int, int>(2, 29);
- case Qt::Key_6:
- return QPair<int, int>(2, 30);
- case Qt::Key_7:
- return QPair<int, int>(2, 31);
- case Qt::Key_8:
- return QPair<int, int>(3, 0);
- case Qt::Key_9:
- return QPair<int, int>(3, 1);
- case Qt::Key_Colon:
- return QPair<int, int>(3, 2);
- case Qt::Key_Semicolon:
- return QPair<int, int>(3, 3);
- case Qt::Key_Less:
- return QPair<int, int>(3, 4);
- case Qt::Key_Equal:
- return QPair<int, int>(3, 5);
- case Qt::Key_Greater:
- return QPair<int, int>(3, 6);
- case Qt::Key_Question:
- return QPair<int, int>(3, 7);
- case Qt::Key_At:
- return QPair<int, int>(3, 8);
- case Qt::Key_A:
- return QPair<int, int>(3, 9);
- case Qt::Key_B:
- return QPair<int, int>(3, 10);
- case Qt::Key_C:
- return QPair<int, int>(3, 11);
- case Qt::Key_D:
- return QPair<int, int>(3, 12);
- case Qt::Key_E:
- return QPair<int, int>(3, 13);
- case Qt::Key_F:
- return QPair<int, int>(3, 14);
- case Qt::Key_G:
- return QPair<int, int>(3, 15);
- case Qt::Key_H:
- return QPair<int, int>(3, 16);
- case Qt::Key_I:
- return QPair<int, int>(3, 17);
- case Qt::Key_J:
- return QPair<int, int>(3, 18);
- case Qt::Key_K:
- return QPair<int, int>(3, 19);
- case Qt::Key_L:
- return QPair<int, int>(3, 20);
- case Qt::Key_M:
- return QPair<int, int>(3, 21);
- case Qt::Key_N:
- return QPair<int, int>(3, 22);
- case Qt::Key_O:
- return QPair<int, int>(3, 23);
- case Qt::Key_P:
- return QPair<int, int>(3, 24);
- case Qt::Key_Q:
- return QPair<int, int>(3, 25);
- case Qt::Key_R:
- return QPair<int, int>(3, 26);
- case Qt::Key_S:
- return QPair<int, int>(3, 27);
- case Qt::Key_T:
- return QPair<int, int>(3, 28);
- case Qt::Key_U:
- return QPair<int, int>(3, 29);
- case Qt::Key_V:
- return QPair<int, int>(3, 30);
- case Qt::Key_W:
- return QPair<int, int>(3, 31);
- case Qt::Key_X:
- return QPair<int, int>(4, 0);
- case Qt::Key_Y:
- return QPair<int, int>(4, 1);
- case Qt::Key_Z:
- return QPair<int, int>(4, 2);
- case Qt::Key_BracketLeft:
- return QPair<int, int>(4, 3);
- case Qt::Key_Backslash:
- return QPair<int, int>(4, 4);
- case Qt::Key_BracketRight:
- return QPair<int, int>(4, 5);
- case Qt::Key_AsciiCircum:
- return QPair<int, int>(4, 6);
- case Qt::Key_Underscore:
- return QPair<int, int>(4, 7);
- case Qt::Key_QuoteLeft:
- return QPair<int, int>(4, 8);
- case Qt::Key_BraceLeft:
- return QPair<int, int>(4, 9);
- case Qt::Key_Bar:
- return QPair<int, int>(4, 10);
- case Qt::Key_BraceRight:
- return QPair<int, int>(4, 11);
- case Qt::Key_AsciiTilde:
- return QPair<int, int>(4, 12);
- case Qt::Key_plusminus:
- return QPair<int, int>(4, 13);
- case Qt::Key_onesuperior:
- return QPair<int, int>(4, 14);
- case Qt::Key_multiply:
- return QPair<int, int>(4, 15);
- case Qt::Key_division:
- return QPair<int, int>(4, 16);
- case Qt::Key_diaeresis:
- return QPair<int, int>(4, 17);
- default:
- return QPair<int, int>(-1, -1);
- }
- return position;
-}
-
-} // anonymous
-
-
-// TO DO: Send change to frontend when activeInput changes
-
-KeyboardController::KeyboardController()
- : QAbstractPhysicalDeviceBackendNode(QBackendNode::ReadOnly)
- , m_inputHandler(Q_NULLPTR)
-{
- m_keyStates.keys[0] = 0;
- m_keyStates.keys[1] = 0;
- m_keyStates.keys[2] = 0;
- m_keyStates.keys[3] = 0;
- m_keyStates.keys[4] = 0;
-}
-
-void KeyboardController::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QAbstractPhysicalDeviceBackendNode::updateFromPeer(peer);
-}
-
-void KeyboardController::cleanup()
-{
- QAbstractPhysicalDeviceBackendNode::cleanup();
- m_keyStates.keys[0] = 0;
- m_keyStates.keys[1] = 0;
- m_keyStates.keys[2] = 0;
- m_keyStates.keys[3] = 0;
- m_keyStates.keys[4] = 0;
-}
-
-void KeyboardController::requestFocusForInput(const Qt3DCore::QNodeId &inputId)
-{
- // Saves the last inputId, this will then be used in an Aspect Job to determine which
- // input will have the focus. This in turn will call KeyboardInput::setFocus which will
- // decide if sending a notification to the frontend is necessary
- m_lastRequester = inputId;
-}
-
-void KeyboardController::setInputHandler(InputHandler *handler)
-{
- m_inputHandler = handler;
-}
-
-void KeyboardController::addKeyboardInput(const Qt3DCore::QNodeId &input)
-{
- if (!m_keyboardInputs.contains(input)) {
- m_keyboardInputs.append(input);
- m_keyboardInputHandles.append(m_inputHandler->keyboardInputManager()->lookupHandle(input));
- }
-}
-
-void KeyboardController::removeKeyboardInput(const Qt3DCore::QNodeId &input)
-{
- m_keyboardInputs.removeAll(input);
- m_keyboardInputHandles.removeAll(m_inputHandler->keyboardInputManager()->lookupHandle(input));
-}
-
-void KeyboardController::setCurrentFocusItem(const Qt3DCore::QNodeId &input)
-{
- m_currentFocusItem = input;
-}
-
-float KeyboardController::axisValue(int axisIdentifier) const
-{
- Q_UNUSED(axisIdentifier);
- return 0.0f;
-}
-
-bool KeyboardController::isButtonPressed(int buttonIdentifier) const
-{
- QPair<int, int> position = getKeyPosition(buttonIdentifier);
- if (position.first != -1 && position.second != -1)
- return m_keyStates.keys[position.first] & (1 << position.second);
- return false;
-}
-
-void KeyboardController::setButtonValue(int key, bool value)
-{
- QPair<int, int> position = getKeyPosition(key);
- if (position.first != -1 && position.second != -1) {
- if (value)
- m_keyStates.keys[position.first] |= (1 << position.second);
- else
- m_keyStates.keys[position.first] &= ~(1 << position.second);
- }
-}
-
-void KeyboardController::updateKeyEvents(const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> &events)
-{
- Q_FOREACH (const QT_PREPEND_NAMESPACE(QKeyEvent) &e, events)
- setButtonValue(e.key(), e.type() == QT_PREPEND_NAMESPACE(QKeyEvent)::KeyPress ? true : false);
-}
-
-
-void KeyboardController::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &)
-{
-}
-
-KeyboardControllerFunctor::KeyboardControllerFunctor(QInputAspect *inputaspect, InputHandler *handler)
- : m_inputAspect(inputaspect)
- , m_handler(handler)
-{
-}
-
-Qt3DCore::QBackendNode *KeyboardControllerFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
-{
- KeyboardController *controller = m_handler->keyboardControllerManager()->getOrCreateResource(frontend->id());
- controller->setFactory(factory);
- controller->setInputAspect(m_inputAspect);
- controller->setInputHandler(m_handler);
- controller->setPeer(frontend);
- m_handler->appendKeyboardController(m_handler->keyboardControllerManager()->lookupHandle(frontend->id()));
- return controller;
-}
-
-Qt3DCore::QBackendNode *KeyboardControllerFunctor::get(const Qt3DCore::QNodeId &id) const
-{
- return m_handler->keyboardControllerManager()->lookupResource(id);
-}
-
-void KeyboardControllerFunctor::destroy(const Qt3DCore::QNodeId &id) const
-{
- m_handler->removeKeyboardController(m_handler->keyboardControllerManager()->lookupHandle(id));
- m_handler->keyboardControllerManager()->releaseResource(id);
-}
-
-} // namespace Inputs
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/keyboardcontroller_p.h b/src/input/backend/keyboardcontroller_p.h
deleted file mode 100644
index 6933222f4..000000000
--- a/src/input/backend/keyboardcontroller_p.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_KEYBOARDCONTROLLER_P_H
-#define QT3DINPUT_INPUT_KEYBOARDCONTROLLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DInput/qabstractphysicaldevicebackendnode.h>
-#include <Qt3DCore/qnodeid.h>
-#include <Qt3DInput/private/handle_types_p.h>
-#include <QKeyEvent>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QInputAspect;
-
-namespace Input {
-
-class InputHandler;
-
-class KeyboardController : public Qt3DInput::QAbstractPhysicalDeviceBackendNode
-{
-public:
- KeyboardController();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
- void cleanup() Q_DECL_OVERRIDE;
-
- void requestFocusForInput(const Qt3DCore::QNodeId &inputId);
- void setInputHandler(InputHandler *handler);
-
- void addKeyboardInput(const Qt3DCore::QNodeId &input);
- void removeKeyboardInput(const Qt3DCore::QNodeId &input);
-
- void setCurrentFocusItem(const Qt3DCore::QNodeId &input);
-
- float axisValue(int axisIdentifier) const Q_DECL_OVERRIDE;
- bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE;
-
- void updateKeyEvents(const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> &events);
-
- inline Qt3DCore::QNodeId currentFocusItem() const { return m_currentFocusItem; }
- inline Qt3DCore::QNodeId lastKeyboardInputRequester() const { return m_lastRequester; }
- inline QVector<Qt3DCore::QNodeId> keyboardInputs() const { return m_keyboardInputs; }
- inline QVector<HKeyboardInput> keyboardInputsHandles() const { return m_keyboardInputHandles; }
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) Q_DECL_OVERRIDE;
-
-private:
- void setButtonValue(int key, bool value);
-
- InputHandler *m_inputHandler;
- QVector<Qt3DCore::QNodeId> m_keyboardInputs;
- QVector<HKeyboardInput> m_keyboardInputHandles;
- Qt3DCore::QNodeId m_lastRequester;
- Qt3DCore::QNodeId m_currentFocusItem;
-
- union KeyStates {
-
- struct Buttons
- {
- // first 4 bytes
- bool keyEscape:1; // 0
- bool keyTab:1; // 1
- bool keyBacktab:1; // 2
- bool keyBackspace:1; // 3
- bool keyReturn:1; // 4
- bool keyEnter:1; // 5
- bool keyInsert:1; // 6
- bool keyDelete:1; // 7
- bool keyPause:1; // 8
- bool keyPrint:1; // 9
- bool keySysReq:1; // 10
- bool keyClear:1; // 11
- bool keyHome:1; // 12
- bool keyEnd:1; // 13
- bool keyLeft:1; // 14
- bool keyUp:1; // 15
- bool keyRight:1; // 16
- bool keyDown:1; // 17
- bool keyPageUp:1; // 18
- bool keyPageDown:1; // 19
- bool keyShift:1; // 20
- bool keyControl:1; // 21
- bool keyMeta:1; // 22
- bool keyAlt:1; // 23
- bool keyCapsLock:1; // 24
- bool keyNumLock:1; // 25
- bool keyScrollLock:1; // 26
- bool keyF1:1; // 27
- bool keyF2:1; // 28
- bool keyF3:1; // 29
- bool keyF4:1; // 30
- bool keyF5:1; // 31
-
- // second 4 bytes
- bool keyF6:1; // 0
- bool keyF7:1; // 1
- bool keyF8:1; // 2
- bool keyF9:1; // 3
- bool keyF10:1; // 4
- bool keyF11:1; // 5
- bool keyF12:1; // 6
- bool keyF13:1; // 7
- bool keyF14:1; // 8
- bool keyF15:1; // 9
- bool keyF16:1; // 10
- bool keyF17:1; // 11
- bool keyF18:1; // 12
- bool keyF19:1; // 13
- bool keyF20:1; // 14
- bool keyF21:1; // 15
- bool keyF22:1; // 16
- bool keyF23:1; // 17
- bool keyF24:1; // 18
- bool keyF25:1; // 19
- bool keyF26:1; // 20
- bool keyF27:1; // 21
- bool keyF28:1; // 22
- bool keyF29:1; // 23
- bool keyF30:1; // 24
- bool keyF31:1; // 25
- bool keyF32:1; // 26
- bool keyF33:1; // 27
- bool keyF34:1; // 28
- bool keyF35:1; // 29
- bool keySuper_L:1; // 30
- bool keySuper_R:1; // 31
-
- // third 4 bytes
- // unused // 0
- bool keyMenu:1; // 1
- bool keyHyper_L:1; // 2
- bool keyHyper_R:1; // 3
- bool keyHelp:1; // 4
- bool keyDirection_L:1; // 5
- bool keyDirection_R:1; // 6
- bool keySpace:1; // 7
- bool keyAny:1; // 8
- bool keyExclam:1; // 9
- bool keyQuoteDbl:1; // 10
- bool keyNumberSign:1; // 11
- bool keyDollar:1; // 12
- bool keyPercent:1; // 13
- bool keyAmpersand:1; // 14
- bool keyApostrophe:1; // 15
- bool keyParenLeft:1; // 16
- bool keyParenRight:1; // 17
- bool keyAsterisk:1; // 18
- bool keyPlus:1; // 19
- bool keyComma:1; // 20
- bool keyMinus:1; // 21
- bool keyPeriod:1; // 22
- bool keySlash:1; // 23
- bool key0:1; // 24
- bool key1:1; // 25
- bool key2:1; // 26
- bool key3:1; // 27
- bool key4:1; // 28
- bool key5:1; // 29
- bool key6:1; // 30
- bool key7:1; // 31
-
- // fourth 4 bytes
- bool key8:1; // 0
- bool key9:1; // 1
- bool keyColon:1; // 2
- bool keySemicolon:1; // 3
- bool keyLess:1; // 4
- bool keyEqual:1; // 5
- bool keyGreater:1; // 6
- bool keyQuestion:1; // 7
- bool keyAt:1; // 8
- bool keyA:1; // 9
- bool keyB:1; // 10
- bool keyC:1; // 11
- bool keyD:1; // 12
- bool keyE:1; // 13
- bool keyF:1; // 14
- bool keyG:1; // 15
- bool keyH:1; // 16
- bool keyI:1; // 17
- bool keyJ:1; // 18
- bool keyK:1; // 19
- bool keyL:1; // 20
- bool keyM:1; // 21
- bool keyN:1; // 22
- bool keyO:1; // 23
- bool keyP:1; // 24
- bool keyQ:1; // 25
- bool keyR:1; // 26
- bool keyS:1; // 27
- bool keyT:1; // 28
- bool keyU:1; // 29
- bool keyV:1; // 30
- bool keyW:1; // 31
-
- // fifth 4 bytes
- bool keyX:1; // 0
- bool keyY:1; // 1
- bool keyZ:1; // 2
- bool keyBracketLeft:1; // 3
- bool keyBackslash:1; // 4
- bool keyBracketRight:1; // 5
- bool keyAsciiCircum:1; // 6
- bool keyUnderscore:1; // 7
- bool keyQuoteLeft:1; // 8
- bool keyBraceLeft:1; // 9
- bool keyBar:1; // 10
- bool keyBraceRight:1; // 11
- bool keyAsciiTilde:1; // 12
- bool keyplusminus:1; // 13
- bool keyonesuperior:1; // 14
- bool keymultiply:1; // 15
- bool keydivision:1; // 16
- bool keyydiaeresis:1; // 17
- };
- qint32 keys[5];
- };
-
- KeyStates m_keyStates;
-};
-
-class KeyboardControllerFunctor : public Qt3DCore::QBackendNodeFunctor
-{
-public:
- explicit KeyboardControllerFunctor(QInputAspect *inputaspect, InputHandler *handler);
-
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
-
-private:
- QInputAspect *m_inputAspect;
- InputHandler *m_handler;
-};
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_INPUT_KEYBOARDCONTROLLER_P_H
diff --git a/src/input/backend/keyboarddevice.cpp b/src/input/backend/keyboarddevice.cpp
new file mode 100644
index 000000000..70e1f9615
--- /dev/null
+++ b/src/input/backend/keyboarddevice.cpp
@@ -0,0 +1,476 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "keyboarddevice_p.h"
+#include "inputhandler_p.h"
+#include "inputmanagers_p.h"
+#include <Qt3DCore/qnode.h>
+
+#include <QKeyEvent>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+
+namespace {
+
+QPair<int, int> getKeyPosition(int key)
+{
+ QPair<int, int> position;
+
+ switch (key) {
+ case Qt::Key_Escape:
+ return QPair<int, int>(0, 0);
+ case Qt::Key_Tab:
+ return QPair<int, int>(0, 1);
+ case Qt::Key_Backtab:
+ return QPair<int, int>(0, 2);
+ case Qt::Key_Backspace:
+ return QPair<int, int>(0, 3);
+ case Qt::Key_Return:
+ return QPair<int, int>(0, 4);
+ case Qt::Key_Enter:
+ return QPair<int, int>(0, 5);
+ case Qt::Key_Insert:
+ return QPair<int, int>(0, 6);
+ case Qt::Key_Delete:
+ return QPair<int, int>(0, 7);
+ case Qt::Key_Pause:
+ return QPair<int, int>(0, 8);
+ case Qt::Key_Print:
+ return QPair<int, int>(0, 9);
+ case Qt::Key_SysReq:
+ return QPair<int, int>(0, 10);
+ case Qt::Key_Clear:
+ return QPair<int, int>(0, 11);
+ case Qt::Key_Home:
+ return QPair<int, int>(0, 12);
+ case Qt::Key_End:
+ return QPair<int, int>(0, 13);
+ case Qt::Key_Left:
+ return QPair<int, int>(0, 14);
+ case Qt::Key_Right:
+ return QPair<int, int>(0, 16);
+ case Qt::Key_Up:
+ return QPair<int, int>(0, 15);
+ case Qt::Key_Down:
+ return QPair<int, int>(0, 17);
+ case Qt::Key_PageUp:
+ return QPair<int, int>(0, 18);
+ case Qt::Key_PageDown:
+ return QPair<int, int>(0, 19);
+ case Qt::Key_Shift:
+ return QPair<int, int>(0, 20);
+ case Qt::Key_Alt:
+ return QPair<int, int>(0, 23);
+ case Qt::Key_Control:
+ return QPair<int, int>(0, 21);
+ case Qt::Key_Meta:
+ return QPair<int, int>(0, 22);
+ case Qt::Key_CapsLock:
+ return QPair<int, int>(0, 24);
+ case Qt::Key_NumLock:
+ return QPair<int, int>(0, 25);
+ case Qt::Key_ScrollLock:
+ return QPair<int, int>(0, 26);
+ case Qt::Key_F1:
+ return QPair<int, int>(0, 27);
+ case Qt::Key_F2:
+ return QPair<int, int>(0, 28);
+ case Qt::Key_F3:
+ return QPair<int, int>(0, 29);
+ case Qt::Key_F4:
+ return QPair<int, int>(0, 30);
+ case Qt::Key_F5:
+ return QPair<int, int>(0, 31);
+ case Qt::Key_F6:
+ return QPair<int, int>(1, 0);
+ case Qt::Key_F7:
+ return QPair<int, int>(1, 1);
+ case Qt::Key_F8:
+ return QPair<int, int>(1, 2);
+ case Qt::Key_F9:
+ return QPair<int, int>(1, 3);
+ case Qt::Key_F10:
+ return QPair<int, int>(1, 4);
+ case Qt::Key_F11:
+ return QPair<int, int>(1, 5);
+ case Qt::Key_F12:
+ return QPair<int, int>(1, 6);
+ case Qt::Key_F13:
+ return QPair<int, int>(1, 7);
+ case Qt::Key_F14:
+ return QPair<int, int>(1, 8);
+ case Qt::Key_F15:
+ return QPair<int, int>(1, 9);
+ case Qt::Key_F16:
+ return QPair<int, int>(1, 10);
+ case Qt::Key_F17:
+ return QPair<int, int>(1, 11);
+ case Qt::Key_F18:
+ return QPair<int, int>(1, 12);
+ case Qt::Key_F19:
+ return QPair<int, int>(1, 13);
+ case Qt::Key_F20:
+ return QPair<int, int>(1, 14);
+ case Qt::Key_F21:
+ return QPair<int, int>(1, 15);
+ case Qt::Key_F22:
+ return QPair<int, int>(1, 16);
+ case Qt::Key_F23:
+ return QPair<int, int>(1, 17);
+ case Qt::Key_F24:
+ return QPair<int, int>(1, 18);
+ case Qt::Key_F25:
+ return QPair<int, int>(1, 19);
+ case Qt::Key_F26:
+ return QPair<int, int>(1, 20);
+ case Qt::Key_F27:
+ return QPair<int, int>(1, 21);
+ case Qt::Key_F28:
+ return QPair<int, int>(1, 22);
+ case Qt::Key_F29:
+ return QPair<int, int>(1, 23);
+ case Qt::Key_F30:
+ return QPair<int, int>(1, 24);
+ case Qt::Key_F31:
+ return QPair<int, int>(1, 25);
+ case Qt::Key_F32:
+ return QPair<int, int>(1, 26);
+ case Qt::Key_F33:
+ return QPair<int, int>(1, 27);
+ case Qt::Key_F34:
+ return QPair<int, int>(1, 28);
+ case Qt::Key_F35:
+ return QPair<int, int>(1, 29);
+ case Qt::Key_Super_L:
+ return QPair<int, int>(1, 30);
+ case Qt::Key_Super_R:
+ return QPair<int, int>(1, 31);
+ case Qt::Key_Menu:
+ return QPair<int, int>(2, 1);
+ case Qt::Key_Help:
+ return QPair<int, int>(2, 4);
+ case Qt::Key_Hyper_L:
+ return QPair<int, int>(2, 2);
+ case Qt::Key_Hyper_R:
+ return QPair<int, int>(2, 3);
+ case Qt::Key_Direction_L:
+ return QPair<int, int>(2, 5);
+ case Qt::Key_Direction_R:
+ return QPair<int, int>(2, 6);
+ case Qt::Key_Space:
+ return QPair<int, int>(2, 7);
+ case Qt::Key_Exclam:
+ return QPair<int, int>(2, 9);
+ case Qt::Key_QuoteDbl:
+ return QPair<int, int>(2, 10);
+ case Qt::Key_NumberSign:
+ return QPair<int, int>(2, 11);
+ case Qt::Key_Dollar:
+ return QPair<int, int>(2, 12);
+ case Qt::Key_Percent:
+ return QPair<int, int>(2, 13);
+ case Qt::Key_Ampersand:
+ return QPair<int, int>(2, 14);
+ case Qt::Key_Apostrophe:
+ return QPair<int, int>(2, 15);
+ case Qt::Key_ParenLeft:
+ return QPair<int, int>(2, 16);
+ case Qt::Key_ParenRight:
+ return QPair<int, int>(2, 17);
+ case Qt::Key_Asterisk:
+ return QPair<int, int>(2, 18);
+ case Qt::Key_Plus:
+ return QPair<int, int>(2, 19);
+ case Qt::Key_Comma:
+ return QPair<int, int>(2, 20);
+ case Qt::Key_Minus:
+ return QPair<int, int>(2, 21);
+ case Qt::Key_Period:
+ return QPair<int, int>(2, 22);
+ case Qt::Key_Slash:
+ return QPair<int, int>(2, 23);
+ case Qt::Key_0:
+ return QPair<int, int>(2, 24);
+ case Qt::Key_1:
+ return QPair<int, int>(2, 25);
+ case Qt::Key_2:
+ return QPair<int, int>(2, 26);
+ case Qt::Key_3:
+ return QPair<int, int>(2, 27);
+ case Qt::Key_4:
+ return QPair<int, int>(2, 28);
+ case Qt::Key_5:
+ return QPair<int, int>(2, 29);
+ case Qt::Key_6:
+ return QPair<int, int>(2, 30);
+ case Qt::Key_7:
+ return QPair<int, int>(2, 31);
+ case Qt::Key_8:
+ return QPair<int, int>(3, 0);
+ case Qt::Key_9:
+ return QPair<int, int>(3, 1);
+ case Qt::Key_Colon:
+ return QPair<int, int>(3, 2);
+ case Qt::Key_Semicolon:
+ return QPair<int, int>(3, 3);
+ case Qt::Key_Less:
+ return QPair<int, int>(3, 4);
+ case Qt::Key_Equal:
+ return QPair<int, int>(3, 5);
+ case Qt::Key_Greater:
+ return QPair<int, int>(3, 6);
+ case Qt::Key_Question:
+ return QPair<int, int>(3, 7);
+ case Qt::Key_At:
+ return QPair<int, int>(3, 8);
+ case Qt::Key_A:
+ return QPair<int, int>(3, 9);
+ case Qt::Key_B:
+ return QPair<int, int>(3, 10);
+ case Qt::Key_C:
+ return QPair<int, int>(3, 11);
+ case Qt::Key_D:
+ return QPair<int, int>(3, 12);
+ case Qt::Key_E:
+ return QPair<int, int>(3, 13);
+ case Qt::Key_F:
+ return QPair<int, int>(3, 14);
+ case Qt::Key_G:
+ return QPair<int, int>(3, 15);
+ case Qt::Key_H:
+ return QPair<int, int>(3, 16);
+ case Qt::Key_I:
+ return QPair<int, int>(3, 17);
+ case Qt::Key_J:
+ return QPair<int, int>(3, 18);
+ case Qt::Key_K:
+ return QPair<int, int>(3, 19);
+ case Qt::Key_L:
+ return QPair<int, int>(3, 20);
+ case Qt::Key_M:
+ return QPair<int, int>(3, 21);
+ case Qt::Key_N:
+ return QPair<int, int>(3, 22);
+ case Qt::Key_O:
+ return QPair<int, int>(3, 23);
+ case Qt::Key_P:
+ return QPair<int, int>(3, 24);
+ case Qt::Key_Q:
+ return QPair<int, int>(3, 25);
+ case Qt::Key_R:
+ return QPair<int, int>(3, 26);
+ case Qt::Key_S:
+ return QPair<int, int>(3, 27);
+ case Qt::Key_T:
+ return QPair<int, int>(3, 28);
+ case Qt::Key_U:
+ return QPair<int, int>(3, 29);
+ case Qt::Key_V:
+ return QPair<int, int>(3, 30);
+ case Qt::Key_W:
+ return QPair<int, int>(3, 31);
+ case Qt::Key_X:
+ return QPair<int, int>(4, 0);
+ case Qt::Key_Y:
+ return QPair<int, int>(4, 1);
+ case Qt::Key_Z:
+ return QPair<int, int>(4, 2);
+ case Qt::Key_BracketLeft:
+ return QPair<int, int>(4, 3);
+ case Qt::Key_Backslash:
+ return QPair<int, int>(4, 4);
+ case Qt::Key_BracketRight:
+ return QPair<int, int>(4, 5);
+ case Qt::Key_AsciiCircum:
+ return QPair<int, int>(4, 6);
+ case Qt::Key_Underscore:
+ return QPair<int, int>(4, 7);
+ case Qt::Key_QuoteLeft:
+ return QPair<int, int>(4, 8);
+ case Qt::Key_BraceLeft:
+ return QPair<int, int>(4, 9);
+ case Qt::Key_Bar:
+ return QPair<int, int>(4, 10);
+ case Qt::Key_BraceRight:
+ return QPair<int, int>(4, 11);
+ case Qt::Key_AsciiTilde:
+ return QPair<int, int>(4, 12);
+ case Qt::Key_plusminus:
+ return QPair<int, int>(4, 13);
+ case Qt::Key_onesuperior:
+ return QPair<int, int>(4, 14);
+ case Qt::Key_multiply:
+ return QPair<int, int>(4, 15);
+ case Qt::Key_division:
+ return QPair<int, int>(4, 16);
+ case Qt::Key_diaeresis:
+ return QPair<int, int>(4, 17);
+ default:
+ return QPair<int, int>(-1, -1);
+ }
+ return position;
+}
+
+} // anonymous
+
+
+// TO DO: Send change to frontend when activeInput changes
+
+KeyboardDevice::KeyboardDevice()
+ : QAbstractPhysicalDeviceBackendNode(QBackendNode::ReadOnly)
+ , m_inputHandler(nullptr)
+{
+ m_keyStates.keys[0] = 0;
+ m_keyStates.keys[1] = 0;
+ m_keyStates.keys[2] = 0;
+ m_keyStates.keys[3] = 0;
+ m_keyStates.keys[4] = 0;
+}
+
+void KeyboardDevice::cleanup()
+{
+ QAbstractPhysicalDeviceBackendNode::cleanup();
+ m_keyStates.keys[0] = 0;
+ m_keyStates.keys[1] = 0;
+ m_keyStates.keys[2] = 0;
+ m_keyStates.keys[3] = 0;
+ m_keyStates.keys[4] = 0;
+}
+
+void KeyboardDevice::requestFocusForInput(Qt3DCore::QNodeId inputId)
+{
+ // Saves the last inputId, this will then be used in an Aspect Job to determine which
+ // input will have the focus. This in turn will call KeyboardInput::setFocus which will
+ // decide if sending a notification to the frontend is necessary
+ m_lastRequester = inputId;
+}
+
+void KeyboardDevice::setInputHandler(InputHandler *handler)
+{
+ m_inputHandler = handler;
+}
+
+void KeyboardDevice::addKeyboardInput(Qt3DCore::QNodeId input)
+{
+ if (!m_keyboardInputs.contains(input)) {
+ m_keyboardInputs.append(input);
+ m_keyboardInputHandles.append(m_inputHandler->keyboardInputManager()->lookupHandle(input));
+ }
+}
+
+void KeyboardDevice::removeKeyboardInput(Qt3DCore::QNodeId input)
+{
+ m_keyboardInputs.removeAll(input);
+ m_keyboardInputHandles.removeAll(m_inputHandler->keyboardInputManager()->lookupHandle(input));
+}
+
+void KeyboardDevice::setCurrentFocusItem(Qt3DCore::QNodeId input)
+{
+ m_currentFocusItem = input;
+}
+
+float KeyboardDevice::axisValue(int axisIdentifier) const
+{
+ Q_UNUSED(axisIdentifier);
+ return 0.0f;
+}
+
+bool KeyboardDevice::isButtonPressed(int buttonIdentifier) const
+{
+ QPair<int, int> position = getKeyPosition(buttonIdentifier);
+ if (position.first != -1 && position.second != -1)
+ return m_keyStates.keys[position.first] & (1 << position.second);
+ return false;
+}
+
+void KeyboardDevice::setButtonValue(int key, bool value)
+{
+ QPair<int, int> position = getKeyPosition(key);
+ if (position.first != -1 && position.second != -1) {
+ if (value)
+ m_keyStates.keys[position.first] |= (1 << position.second);
+ else
+ m_keyStates.keys[position.first] &= ~(1 << position.second);
+ }
+}
+
+void KeyboardDevice::updateKeyEvents(const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> &events)
+{
+ for (const QT_PREPEND_NAMESPACE(QKeyEvent) &e : events)
+ setButtonValue(e.key(), e.type() == QT_PREPEND_NAMESPACE(QKeyEvent)::KeyPress ? true : false);
+}
+
+
+void KeyboardDevice::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &)
+{
+}
+
+KeyboardDeviceFunctor::KeyboardDeviceFunctor(QInputAspect *inputaspect, InputHandler *handler)
+ : m_inputAspect(inputaspect)
+ , m_handler(handler)
+{
+}
+
+Qt3DCore::QBackendNode *KeyboardDeviceFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
+{
+ KeyboardDevice *keyboardDevice = m_handler->keyboardDeviceManager()->getOrCreateResource(change->subjectId());
+ keyboardDevice->setInputAspect(m_inputAspect);
+ keyboardDevice->setInputHandler(m_handler);
+ m_handler->appendKeyboardDevice(m_handler->keyboardDeviceManager()->lookupHandle(change->subjectId()));
+ return keyboardDevice;
+}
+
+Qt3DCore::QBackendNode *KeyboardDeviceFunctor::get(Qt3DCore::QNodeId id) const
+{
+ return m_handler->keyboardDeviceManager()->lookupResource(id);
+}
+
+void KeyboardDeviceFunctor::destroy(Qt3DCore::QNodeId id) const
+{
+ m_handler->removeKeyboardDevice(m_handler->keyboardDeviceManager()->lookupHandle(id));
+ m_handler->keyboardDeviceManager()->releaseResource(id);
+}
+
+} // namespace Inputs
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/keyboarddevice_p.h b/src/input/backend/keyboarddevice_p.h
new file mode 100644
index 000000000..19f90e683
--- /dev/null
+++ b/src/input/backend/keyboarddevice_p.h
@@ -0,0 +1,290 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_KEYBOARDDEVICE_P_H
+#define QT3DINPUT_INPUT_KEYBOARDDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qabstractphysicaldevicebackendnode_p.h>
+#include <Qt3DCore/qnodeid.h>
+#include <Qt3DInput/private/handle_types_p.h>
+#include <QKeyEvent>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QInputAspect;
+
+namespace Input {
+
+class InputHandler;
+
+class KeyboardDevice : public Qt3DInput::QAbstractPhysicalDeviceBackendNode
+{
+public:
+ KeyboardDevice();
+ void cleanup() Q_DECL_OVERRIDE;
+
+ void requestFocusForInput(Qt3DCore::QNodeId inputId);
+ void setInputHandler(InputHandler *handler);
+
+ void addKeyboardInput(Qt3DCore::QNodeId input);
+ void removeKeyboardInput(Qt3DCore::QNodeId input);
+
+ void setCurrentFocusItem(Qt3DCore::QNodeId input);
+
+ float axisValue(int axisIdentifier) const Q_DECL_OVERRIDE;
+ bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE;
+
+ void updateKeyEvents(const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> &events);
+
+ inline Qt3DCore::QNodeId currentFocusItem() const { return m_currentFocusItem; }
+ inline Qt3DCore::QNodeId lastKeyboardInputRequester() const { return m_lastRequester; }
+ inline QVector<Qt3DCore::QNodeId> keyboardInputs() const { return m_keyboardInputs; }
+ inline QVector<HKeyboardHandler> keyboardInputsHandles() const { return m_keyboardInputHandles; }
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) Q_DECL_OVERRIDE;
+
+private:
+ void setButtonValue(int key, bool value);
+
+ InputHandler *m_inputHandler;
+ QVector<Qt3DCore::QNodeId> m_keyboardInputs;
+ QVector<HKeyboardHandler> m_keyboardInputHandles;
+ Qt3DCore::QNodeId m_lastRequester;
+ Qt3DCore::QNodeId m_currentFocusItem;
+
+ union KeyStates {
+
+ struct Buttons
+ {
+ // first 4 bytes
+ bool keyEscape:1; // 0
+ bool keyTab:1; // 1
+ bool keyBacktab:1; // 2
+ bool keyBackspace:1; // 3
+ bool keyReturn:1; // 4
+ bool keyEnter:1; // 5
+ bool keyInsert:1; // 6
+ bool keyDelete:1; // 7
+ bool keyPause:1; // 8
+ bool keyPrint:1; // 9
+ bool keySysReq:1; // 10
+ bool keyClear:1; // 11
+ bool keyHome:1; // 12
+ bool keyEnd:1; // 13
+ bool keyLeft:1; // 14
+ bool keyUp:1; // 15
+ bool keyRight:1; // 16
+ bool keyDown:1; // 17
+ bool keyPageUp:1; // 18
+ bool keyPageDown:1; // 19
+ bool keyShift:1; // 20
+ bool keyControl:1; // 21
+ bool keyMeta:1; // 22
+ bool keyAlt:1; // 23
+ bool keyCapsLock:1; // 24
+ bool keyNumLock:1; // 25
+ bool keyScrollLock:1; // 26
+ bool keyF1:1; // 27
+ bool keyF2:1; // 28
+ bool keyF3:1; // 29
+ bool keyF4:1; // 30
+ bool keyF5:1; // 31
+
+ // second 4 bytes
+ bool keyF6:1; // 0
+ bool keyF7:1; // 1
+ bool keyF8:1; // 2
+ bool keyF9:1; // 3
+ bool keyF10:1; // 4
+ bool keyF11:1; // 5
+ bool keyF12:1; // 6
+ bool keyF13:1; // 7
+ bool keyF14:1; // 8
+ bool keyF15:1; // 9
+ bool keyF16:1; // 10
+ bool keyF17:1; // 11
+ bool keyF18:1; // 12
+ bool keyF19:1; // 13
+ bool keyF20:1; // 14
+ bool keyF21:1; // 15
+ bool keyF22:1; // 16
+ bool keyF23:1; // 17
+ bool keyF24:1; // 18
+ bool keyF25:1; // 19
+ bool keyF26:1; // 20
+ bool keyF27:1; // 21
+ bool keyF28:1; // 22
+ bool keyF29:1; // 23
+ bool keyF30:1; // 24
+ bool keyF31:1; // 25
+ bool keyF32:1; // 26
+ bool keyF33:1; // 27
+ bool keyF34:1; // 28
+ bool keyF35:1; // 29
+ bool keySuper_L:1; // 30
+ bool keySuper_R:1; // 31
+
+ // third 4 bytes
+ // unused // 0
+ bool keyMenu:1; // 1
+ bool keyHyper_L:1; // 2
+ bool keyHyper_R:1; // 3
+ bool keyHelp:1; // 4
+ bool keyDirection_L:1; // 5
+ bool keyDirection_R:1; // 6
+ bool keySpace:1; // 7
+ bool keyAny:1; // 8
+ bool keyExclam:1; // 9
+ bool keyQuoteDbl:1; // 10
+ bool keyNumberSign:1; // 11
+ bool keyDollar:1; // 12
+ bool keyPercent:1; // 13
+ bool keyAmpersand:1; // 14
+ bool keyApostrophe:1; // 15
+ bool keyParenLeft:1; // 16
+ bool keyParenRight:1; // 17
+ bool keyAsterisk:1; // 18
+ bool keyPlus:1; // 19
+ bool keyComma:1; // 20
+ bool keyMinus:1; // 21
+ bool keyPeriod:1; // 22
+ bool keySlash:1; // 23
+ bool key0:1; // 24
+ bool key1:1; // 25
+ bool key2:1; // 26
+ bool key3:1; // 27
+ bool key4:1; // 28
+ bool key5:1; // 29
+ bool key6:1; // 30
+ bool key7:1; // 31
+
+ // fourth 4 bytes
+ bool key8:1; // 0
+ bool key9:1; // 1
+ bool keyColon:1; // 2
+ bool keySemicolon:1; // 3
+ bool keyLess:1; // 4
+ bool keyEqual:1; // 5
+ bool keyGreater:1; // 6
+ bool keyQuestion:1; // 7
+ bool keyAt:1; // 8
+ bool keyA:1; // 9
+ bool keyB:1; // 10
+ bool keyC:1; // 11
+ bool keyD:1; // 12
+ bool keyE:1; // 13
+ bool keyF:1; // 14
+ bool keyG:1; // 15
+ bool keyH:1; // 16
+ bool keyI:1; // 17
+ bool keyJ:1; // 18
+ bool keyK:1; // 19
+ bool keyL:1; // 20
+ bool keyM:1; // 21
+ bool keyN:1; // 22
+ bool keyO:1; // 23
+ bool keyP:1; // 24
+ bool keyQ:1; // 25
+ bool keyR:1; // 26
+ bool keyS:1; // 27
+ bool keyT:1; // 28
+ bool keyU:1; // 29
+ bool keyV:1; // 30
+ bool keyW:1; // 31
+
+ // fifth 4 bytes
+ bool keyX:1; // 0
+ bool keyY:1; // 1
+ bool keyZ:1; // 2
+ bool keyBracketLeft:1; // 3
+ bool keyBackslash:1; // 4
+ bool keyBracketRight:1; // 5
+ bool keyAsciiCircum:1; // 6
+ bool keyUnderscore:1; // 7
+ bool keyQuoteLeft:1; // 8
+ bool keyBraceLeft:1; // 9
+ bool keyBar:1; // 10
+ bool keyBraceRight:1; // 11
+ bool keyAsciiTilde:1; // 12
+ bool keyplusminus:1; // 13
+ bool keyonesuperior:1; // 14
+ bool keymultiply:1; // 15
+ bool keydivision:1; // 16
+ bool keyydiaeresis:1; // 17
+ };
+ qint32 keys[5];
+ };
+
+ KeyStates m_keyStates;
+};
+
+class KeyboardDeviceFunctor : public Qt3DCore::QBackendNodeMapper
+{
+public:
+ explicit KeyboardDeviceFunctor(QInputAspect *inputaspect, InputHandler *handler);
+
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+
+private:
+ QInputAspect *m_inputAspect;
+ InputHandler *m_handler;
+};
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_KEYBOARDDEVICE_P_H
diff --git a/src/input/backend/keyboardeventfilter.cpp b/src/input/backend/keyboardeventfilter.cpp
index 5eb8990d8..e94af9ade 100644
--- a/src/input/backend/keyboardeventfilter.cpp
+++ b/src/input/backend/keyboardeventfilter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/input/backend/keyboardeventfilter_p.h b/src/input/backend/keyboardeventfilter_p.h
index 11974d73a..a06b4cdd5 100644
--- a/src/input/backend/keyboardeventfilter_p.h
+++ b/src/input/backend/keyboardeventfilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/input/backend/keyboardhandler.cpp b/src/input/backend/keyboardhandler.cpp
new file mode 100644
index 000000000..2132496b1
--- /dev/null
+++ b/src/input/backend/keyboardhandler.cpp
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "keyboardhandler_p.h"
+#include <Qt3DInput/qkeyboardhandler.h>
+#include <Qt3DInput/private/qkeyboardhandler_p.h>
+#include "qkeyboarddevice.h"
+#include "inputhandler_p.h"
+#include "inputmanagers_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DInput {
+namespace Input {
+
+KeyboardHandler::KeyboardHandler()
+ : QBackendNode(QBackendNode::ReadWrite)
+ , m_inputHandler(nullptr)
+ , m_focus(false)
+{
+}
+
+void KeyboardHandler::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QKeyboardHandlerData>>(change);
+ const auto &data = typedChange->data;
+ setSourcerDevice(data.keyboardDeviceId);
+ m_focus = false;
+ if (data.focus)
+ requestFocus();
+}
+
+Qt3DCore::QNodeId KeyboardHandler::keyboardDevice() const
+{
+ return m_keyboardDevice;
+}
+
+void KeyboardHandler::setInputHandler(InputHandler *handler)
+{
+ m_inputHandler = handler;
+}
+
+// Called by the KeyboadDevice when the focus for the KeyboardHandler has changed
+// Sends a change notification so that the frontend can update itself
+void KeyboardHandler::setFocus(bool focus)
+{
+ if (focus != m_focus) {
+ m_focus = focus;
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("focus");
+ e->setValue(m_focus);
+ notifyObservers(e);
+ }
+}
+
+void KeyboardHandler::keyEvent(const QKeyEventPtr &event)
+{
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("event");
+ e->setValue(QVariant::fromValue(event));
+ notifyObservers(e);
+}
+
+void KeyboardHandler::sceneChangeEvent(const QSceneChangePtr &e)
+{
+ bool focusRequest = false;
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("device")) {
+ const QNodeId newId = propertyChange->value().value<QNodeId>();
+ if (m_keyboardDevice != newId) {
+ setSourcerDevice(newId);
+ focusRequest = m_focus;
+ }
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("focus")) {
+ focusRequest = propertyChange->value().toBool();
+ }
+ }
+ if (focusRequest)
+ requestFocus();
+ QBackendNode::sceneChangeEvent(e);
+}
+
+void KeyboardHandler::requestFocus()
+{
+ KeyboardDevice *keyboardDevice = m_inputHandler->keyboardDeviceManager()->lookupResource(m_keyboardDevice);
+ if (keyboardDevice && isEnabled())
+ keyboardDevice->requestFocusForInput(peerId());
+}
+
+void KeyboardHandler::setSourcerDevice(QNodeId device)
+{
+ if (!m_keyboardDevice.isNull()) {
+ KeyboardDevice *device = m_inputHandler->keyboardDeviceManager()->lookupResource(m_keyboardDevice);
+ if (device)
+ device->removeKeyboardInput(peerId());
+ }
+ m_keyboardDevice = device;
+ if (!m_keyboardDevice.isNull()) {
+ KeyboardDevice *device = m_inputHandler->keyboardDeviceManager()->lookupResource(m_keyboardDevice);
+ if (device)
+ device->addKeyboardInput(peerId());
+ }
+}
+
+KeyboardHandlerFunctor::KeyboardHandlerFunctor(InputHandler *handler)
+ : m_handler(handler)
+{
+}
+
+Qt3DCore::QBackendNode *KeyboardHandlerFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
+{
+ KeyboardHandler *input = m_handler->keyboardInputManager()->getOrCreateResource(change->subjectId());
+ input->setInputHandler(m_handler);
+ return input;
+}
+
+QBackendNode *KeyboardHandlerFunctor::get(QNodeId id) const
+{
+ return m_handler->keyboardInputManager()->lookupResource(id);
+}
+
+void KeyboardHandlerFunctor::destroy(QNodeId id) const
+{
+ m_handler->keyboardInputManager()->releaseResource(id);
+}
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/keyboardhandler_p.h b/src/input/backend/keyboardhandler_p.h
new file mode 100644
index 000000000..e1dfe8fa0
--- /dev/null
+++ b/src/input/backend/keyboardhandler_p.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_KEYBOARDHANDLER_P_H
+#define QT3DINPUT_INPUT_KEYBOARDHANDLER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DCore/qnodeid.h>
+#include <Qt3DInput/qkeyevent.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class InputHandler;
+
+class KeyboardHandler : public Qt3DCore::QBackendNode
+{
+public:
+ KeyboardHandler();
+
+ Qt3DCore::QNodeId keyboardDevice() const;
+ void setInputHandler(InputHandler *handler);
+ void setFocus(bool focus);
+ void keyEvent(const QKeyEventPtr &event);
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ void requestFocus();
+ void setSourcerDevice(Qt3DCore::QNodeId device);
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ InputHandler *m_inputHandler;
+ Qt3DCore::QNodeId m_keyboardDevice;
+ bool m_focus;
+};
+
+class KeyboardHandlerFunctor : public Qt3DCore::QBackendNodeMapper
+{
+public:
+ explicit KeyboardHandlerFunctor(InputHandler *handler);
+
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+
+private:
+ InputHandler *m_handler;
+};
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_KEYBOARDHANDLER_P_H
diff --git a/src/input/backend/keyboardinput.cpp b/src/input/backend/keyboardinput.cpp
deleted file mode 100644
index 4e77eccb5..000000000
--- a/src/input/backend/keyboardinput.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "keyboardinput_p.h"
-#include "qkeyboardinput.h"
-#include "qkeyboardcontroller.h"
-#include "inputhandler_p.h"
-#include "inputmanagers_p.h"
-#include <QVariant>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DInput {
-namespace Input {
-
-KeyboardInput::KeyboardInput()
- : QBackendNode(QBackendNode::ReadWrite)
- , m_inputHandler(Q_NULLPTR)
- , m_focus(false)
-{
-}
-
-void KeyboardInput::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QKeyboardInput *input = static_cast<QKeyboardInput *>(peer);
- if (input->controller() != Q_NULLPTR)
- setController(input->controller()->id());
- m_focus = false;
- m_enabled = input->isEnabled();
- if (input->focus())
- requestFocus();
-}
-
-Qt3DCore::QNodeId KeyboardInput::keyboardController() const
-{
- return m_keyboardController;
-}
-
-void KeyboardInput::setInputHandler(InputHandler *handler)
-{
- m_inputHandler = handler;
-}
-
-// Called by the KeyboadController when the focus for the KeyboardInput has changed
-// Sends a change notification so that the frontend can update itself
-void KeyboardInput::setFocus(bool focus)
-{
- if (focus != m_focus) {
- m_focus = focus;
- QBackendScenePropertyChangePtr e(new QBackendScenePropertyChange(NodeUpdated, peerUuid()));
- e->setTargetNode(peerUuid());
- e->setPropertyName("focus");
- e->setValue(m_focus);
- notifyObservers(e);
- }
-}
-
-void KeyboardInput::keyEvent(const QKeyEventPtr &event)
-{
- QBackendScenePropertyChangePtr e(new QBackendScenePropertyChange(NodeUpdated, peerUuid()));
- e->setTargetNode(peerUuid());
- e->setPropertyName("event");
- e->setValue(QVariant::fromValue(event));
- notifyObservers(e);
-}
-
-void KeyboardInput::sceneChangeEvent(const QSceneChangePtr &e)
-{
- bool focusRequest = false;
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("controller")) {
- const QNodeId newId = propertyChange->value().value<QNodeId>();
- if (m_keyboardController != newId) {
- setController(newId);
- focusRequest = m_focus;
- }
- } else if (propertyChange->propertyName() == QByteArrayLiteral("focus")) {
- focusRequest = propertyChange->value().toBool();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().toBool();
- }
- }
- if (focusRequest)
- requestFocus();
-}
-
-void KeyboardInput::requestFocus()
-{
- KeyboardController *controller = m_inputHandler->keyboardControllerManager()->lookupResource(m_keyboardController);
- if (controller && m_enabled)
- controller->requestFocusForInput(peerUuid());
-}
-
-void KeyboardInput::setController(const QNodeId &controller)
-{
- if (!m_keyboardController.isNull()) {
- KeyboardController *controller = m_inputHandler->keyboardControllerManager()->lookupResource(m_keyboardController);
- if (controller)
- controller->removeKeyboardInput(peerUuid());
- }
- m_keyboardController = controller;
- if (!m_keyboardController.isNull()) {
- KeyboardController *controller = m_inputHandler->keyboardControllerManager()->lookupResource(m_keyboardController);
- if (controller)
- controller->addKeyboardInput(peerUuid());
- }
-}
-
-KeyboardInputFunctor::KeyboardInputFunctor(InputHandler *handler)
- : m_handler(handler)
-{
-}
-
-QBackendNode *KeyboardInputFunctor::create(QNode *frontend, const QBackendNodeFactory *factory) const
-{
- KeyboardInput *input = m_handler->keyboardInputManager()->getOrCreateResource(frontend->id());
- input->setFactory(factory);
- input->setInputHandler(m_handler);
- input->setPeer(frontend);
- return input;
-}
-
-QBackendNode *KeyboardInputFunctor::get(const QNodeId &id) const
-{
- return m_handler->keyboardInputManager()->lookupResource(id);
-}
-
-void KeyboardInputFunctor::destroy(const QNodeId &id) const
-{
- m_handler->keyboardInputManager()->releaseResource(id);
-}
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/keyboardinput_p.h b/src/input/backend/keyboardinput_p.h
deleted file mode 100644
index 92aef0ab8..000000000
--- a/src/input/backend/keyboardinput_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_KEYBOARDINPUT_P_H
-#define QT3DINPUT_INPUT_KEYBOARDINPUT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
-#include <Qt3DInput/qkeyevent.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-class InputHandler;
-
-class KeyboardInput : public Qt3DCore::QBackendNode
-{
-public:
- KeyboardInput();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- Qt3DCore::QNodeId keyboardController() const;
- void setInputHandler(InputHandler *handler);
- void setFocus(bool focus);
- void keyEvent(const QKeyEventPtr &event);
-
- inline bool isEnabled() const { return m_enabled; }
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- void requestFocus();
- void setController(const Qt3DCore::QNodeId &controller);
-
-private:
- InputHandler *m_inputHandler;
- Qt3DCore::QNodeId m_keyboardController;
- bool m_focus;
- bool m_enabled;
-};
-
-class KeyboardInputFunctor : public Qt3DCore::QBackendNodeFunctor
-{
-public:
- explicit KeyboardInputFunctor(InputHandler *handler);
-
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
-
-private:
- InputHandler *m_handler;
-};
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_INPUT_KEYBOARDINPUT_P_H
diff --git a/src/input/backend/keyboardmousedeviceintegration.cpp b/src/input/backend/keyboardmousedeviceintegration.cpp
deleted file mode 100644
index f7cc02bf5..000000000
--- a/src/input/backend/keyboardmousedeviceintegration.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "keyboardmousedeviceintegration_p.h"
-#include <Qt3DInput/private/inputhandler_p.h>
-#include <Qt3DInput/private/inputmanagers_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-KeyboardMouseDeviceIntegration::KeyboardMouseDeviceIntegration(InputHandler *handler)
- : Qt3DInput::QInputDeviceIntegration()
- , m_handler(handler)
-{
-}
-
-KeyboardMouseDeviceIntegration::~KeyboardMouseDeviceIntegration()
-{
-}
-
-void KeyboardMouseDeviceIntegration::onInitialize()
-{
-}
-
-QVector<Qt3DCore::QAspectJobPtr> KeyboardMouseDeviceIntegration::jobsToExecute(qint64 time)
-{
- Q_UNUSED(time)
- return QVector<Qt3DCore::QAspectJobPtr>();
-}
-
-QAbstractPhysicalDevice *KeyboardMouseDeviceIntegration::createPhysicalDevice(const QString &name)
-{
- Q_UNUSED(name)
- return Q_NULLPTR;
-}
-
-QVector<Qt3DCore::QNodeId> KeyboardMouseDeviceIntegration::physicalDevices() const
-{
- // TO DO: could return the ids of active KeyboardController/MouseController
- return QVector<Qt3DCore::QNodeId>();
-}
-
-QAbstractPhysicalDeviceBackendNode *KeyboardMouseDeviceIntegration::physicalDevice(Qt3DCore::QNodeId id) const
-{
- QAbstractPhysicalDeviceBackendNode *device = m_handler->keyboardControllerManager()->lookupResource(id);
- if (!device)
- device = m_handler->mouseControllerManager()->lookupResource(id);
- return device;
-}
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/keyboardmousedeviceintegration_p.h b/src/input/backend/keyboardmousedeviceintegration_p.h
deleted file mode 100644
index 5cbbcd9d5..000000000
--- a/src/input/backend/keyboardmousedeviceintegration_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_KEYBOARDMOUSEDEVICEINTEGRATION_P_H
-#define QT3DINPUT_INPUT_KEYBOARDMOUSEDEVICEINTEGRATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DInput/qinputdeviceintegration.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-class InputHandler;
-
-class KeyboardMouseDeviceIntegration : public Qt3DInput::QInputDeviceIntegration
-{
- Q_OBJECT
-public:
- explicit KeyboardMouseDeviceIntegration(InputHandler *handleer);
- ~KeyboardMouseDeviceIntegration();
-
- QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_FINAL;
- QAbstractPhysicalDevice *createPhysicalDevice(const QString &name) Q_DECL_FINAL;
- QVector<Qt3DCore::QNodeId> physicalDevices() const Q_DECL_FINAL;
- QAbstractPhysicalDeviceBackendNode *physicalDevice(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
-
-private:
- void onInitialize() Q_DECL_FINAL;
-
- InputHandler *m_handler;
-};
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_INPUT_KEYBOARDMOUSEDEVICEINTEGRATION_P_H
diff --git a/src/input/backend/keyboardmousegenericdeviceintegration.cpp b/src/input/backend/keyboardmousegenericdeviceintegration.cpp
new file mode 100644
index 000000000..31d0ea981
--- /dev/null
+++ b/src/input/backend/keyboardmousegenericdeviceintegration.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "keyboardmousegenericdeviceintegration_p.h"
+#include <Qt3DInput/private/inputhandler_p.h>
+#include <Qt3DInput/private/inputmanagers_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+KeyboardMouseGenericDeviceIntegration::KeyboardMouseGenericDeviceIntegration(InputHandler *handler)
+ : Qt3DInput::QInputDeviceIntegration()
+ , m_handler(handler)
+{
+}
+
+KeyboardMouseGenericDeviceIntegration::~KeyboardMouseGenericDeviceIntegration()
+{
+}
+
+void KeyboardMouseGenericDeviceIntegration::onInitialize()
+{
+}
+
+QVector<Qt3DCore::QAspectJobPtr> KeyboardMouseGenericDeviceIntegration::jobsToExecute(qint64 time)
+{
+ Q_UNUSED(time)
+ return QVector<Qt3DCore::QAspectJobPtr>();
+}
+
+QAbstractPhysicalDevice *KeyboardMouseGenericDeviceIntegration::createPhysicalDevice(const QString &name)
+{
+ Q_UNUSED(name)
+ return nullptr;
+}
+
+QVector<Qt3DCore::QNodeId> KeyboardMouseGenericDeviceIntegration::physicalDevices() const
+{
+ // TO DO: could return the ids of active KeyboardDevice/MouseDevice
+ return QVector<Qt3DCore::QNodeId>();
+}
+
+QAbstractPhysicalDeviceBackendNode *KeyboardMouseGenericDeviceIntegration::physicalDevice(Qt3DCore::QNodeId id) const
+{
+ QAbstractPhysicalDeviceBackendNode *device = m_handler->keyboardDeviceManager()->lookupResource(id);
+ if (!device)
+ device = m_handler->mouseDeviceManager()->lookupResource(id);
+ if (!device)
+ device = m_handler->genericDeviceBackendNodeManager()->lookupResource(id);
+ return device;
+}
+
+QStringList KeyboardMouseGenericDeviceIntegration::deviceNames() const
+{
+ return QStringList() << tr("Keyboard") << tr("Mouse");
+}
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/keyboardmousegenericdeviceintegration_p.h b/src/input/backend/keyboardmousegenericdeviceintegration_p.h
new file mode 100644
index 000000000..c2512f673
--- /dev/null
+++ b/src/input/backend/keyboardmousegenericdeviceintegration_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_KEYBOARDMOUSEGENERICDEVICEINTEGRATION_P_H
+#define QT3DINPUT_INPUT_KEYBOARDMOUSEGENERICDEVICEINTEGRATION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qinputdeviceintegration_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+namespace Input {
+
+class InputHandler;
+
+class KeyboardMouseGenericDeviceIntegration : public Qt3DInput::QInputDeviceIntegration
+{
+ Q_OBJECT
+public:
+ explicit KeyboardMouseGenericDeviceIntegration(InputHandler *handleer);
+ ~KeyboardMouseGenericDeviceIntegration();
+
+ QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_FINAL;
+ QAbstractPhysicalDevice *createPhysicalDevice(const QString &name) Q_DECL_FINAL;
+ QVector<Qt3DCore::QNodeId> physicalDevices() const Q_DECL_FINAL;
+ QAbstractPhysicalDeviceBackendNode *physicalDevice(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
+ QStringList deviceNames() const Q_DECL_FINAL;
+
+private:
+ void onInitialize() Q_DECL_FINAL;
+
+ InputHandler *m_handler;
+};
+
+} // Input
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_KEYBOARDMOUSEGENERICDEVICEINTEGRATION_P_H
diff --git a/src/input/backend/keyeventdispatcherjob.cpp b/src/input/backend/keyeventdispatcherjob.cpp
index 16d97b464..d38961704 100644
--- a/src/input/backend/keyeventdispatcherjob.cpp
+++ b/src/input/backend/keyeventdispatcherjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "keyeventdispatcherjob_p.h"
#include "inputhandler_p.h"
-#include "keyboardinput_p.h"
+#include "keyboardhandler_p.h"
#include "inputmanagers_p.h"
QT_BEGIN_NAMESPACE
@@ -44,10 +47,10 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
namespace Input {
-KeyEventDispatcherJob::KeyEventDispatcherJob(const Qt3DCore::QNodeId &input, const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> &events)
+KeyEventDispatcherJob::KeyEventDispatcherJob(Qt3DCore::QNodeId input, const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> &events)
: QAspectJob()
- , m_inputHandler(Q_NULLPTR)
- , m_keyboardInput(input)
+ , m_inputHandler(nullptr)
+ , m_keyboardHandler(input)
, m_events(events)
{
}
@@ -59,9 +62,9 @@ void KeyEventDispatcherJob::setInputHandler(InputHandler *handler)
void KeyEventDispatcherJob::run()
{
- KeyboardInput *input = m_inputHandler->keyboardInputManager()->lookupResource(m_keyboardInput);
+ KeyboardHandler *input = m_inputHandler->keyboardInputManager()->lookupResource(m_keyboardHandler);
if (input)
- Q_FOREACH (const QT_PREPEND_NAMESPACE(QKeyEvent) &e, m_events) {
+ for (const QT_PREPEND_NAMESPACE(QKeyEvent) &e : qAsConst(m_events)) {
// Send events to frontend
input->keyEvent(QKeyEventPtr(new QKeyEvent(e)));
}
diff --git a/src/input/backend/keyeventdispatcherjob_p.h b/src/input/backend/keyeventdispatcherjob_p.h
index 4ce875723..b89d8ced2 100644
--- a/src/input/backend/keyeventdispatcherjob_p.h
+++ b/src/input/backend/keyeventdispatcherjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,13 +65,13 @@ class InputHandler;
class KeyEventDispatcherJob : public Qt3DCore::QAspectJob
{
public:
- explicit KeyEventDispatcherJob(const Qt3DCore::QNodeId &input, const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> &events);
+ explicit KeyEventDispatcherJob(Qt3DCore::QNodeId input, const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> &events);
void setInputHandler(InputHandler *handler);
void run() Q_DECL_OVERRIDE;
private:
InputHandler *m_inputHandler;
- const Qt3DCore::QNodeId m_keyboardInput;
+ const Qt3DCore::QNodeId m_keyboardHandler;
const QList<QT_PREPEND_NAMESPACE(QKeyEvent)> m_events;
};
diff --git a/src/input/backend/logicaldevice.cpp b/src/input/backend/logicaldevice.cpp
index 32e81f8a6..fd4a637f2 100644
--- a/src/input/backend/logicaldevice.cpp
+++ b/src/input/backend/logicaldevice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,8 +41,11 @@
#include <Qt3DInput/qlogicaldevice.h>
#include <Qt3DInput/qaxis.h>
#include <Qt3DInput/qaction.h>
-#include <Qt3DCore/qscenepropertychange.h>
#include <Qt3DInput/private/inputmanagers_p.h>
+#include <Qt3DInput/private/qlogicaldevice_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -48,46 +54,50 @@ namespace Qt3DInput {
namespace Input {
LogicalDevice::LogicalDevice()
- : QBackendNode(),
- m_enabled(false)
+ : QBackendNode()
{
}
-void LogicalDevice::updateFromPeer(Qt3DCore::QNode *peer)
+void LogicalDevice::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QLogicalDevice *device = static_cast<QLogicalDevice *>(peer);
- m_enabled = device->isEnabled();
- Q_FOREACH (QAxis *axis, device->axes())
- m_axes.push_back(axis->id());
- Q_FOREACH (QAction *action, device->actions())
- m_actions.push_back(action->id());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QLogicalDeviceData>>(change);
+ const auto &data = typedChange->data;
+ m_actions = data.actionIds;
+ m_axes = data.axisIds;
}
void LogicalDevice::cleanup()
{
- m_enabled = false;
+ QBackendNode::setEnabled(false);
m_actions.clear();
m_axes.clear();
}
void LogicalDevice::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (e->type() == Qt3DCore::NodeUpdated) {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().toBool();
- } else if (e->type() == Qt3DCore::NodeAdded) {
- if (propertyChange->propertyName() == QByteArrayLiteral("axis"))
- m_axes.push_back(propertyChange->value().value<Qt3DCore::QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("action"))
- m_actions.push_back(propertyChange->value().value<Qt3DCore::QNodeId>());
- } else if (e->type() == Qt3DCore::NodeRemoved) {
- if (propertyChange->propertyName() == QByteArrayLiteral("axis"))
- m_axes.removeOne(propertyChange->value().value<Qt3DCore::QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("action"))
- m_actions.removeOne(propertyChange->value().value<Qt3DCore::QNodeId>());
- }
+ switch (e->type()) {
+ case Qt3DCore::PropertyValueAdded: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("axis"))
+ m_axes.push_back(change->addedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("action"))
+ m_actions.push_back(change->addedNodeId());
+ break;
}
+
+ case Qt3DCore::PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("axis"))
+ m_axes.removeOne(change->removedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("action"))
+ m_actions.removeOne(change->removedNodeId());
+ break;
+ }
+
+ default:
+ break;
+ }
+ QBackendNode::sceneChangeEvent(e);
}
LogicalDeviceNodeFunctor::LogicalDeviceNodeFunctor(LogicalDeviceManager *manager)
@@ -95,22 +105,20 @@ LogicalDeviceNodeFunctor::LogicalDeviceNodeFunctor(LogicalDeviceManager *manager
{
}
-Qt3DCore::QBackendNode *LogicalDeviceNodeFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *LogicalDeviceNodeFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- HLogicalDevice handle = m_manager->getOrAcquireHandle(frontend->id());
+ HLogicalDevice handle = m_manager->getOrAcquireHandle(change->subjectId());
LogicalDevice *backend = m_manager->data(handle);
m_manager->addActiveDevice(handle);
- backend->setFactory(factory);
- backend->setPeer(frontend);
return backend;
}
-Qt3DCore::QBackendNode *LogicalDeviceNodeFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *LogicalDeviceNodeFunctor::get(Qt3DCore::QNodeId id) const
{
return m_manager->lookupResource(id);
}
-void LogicalDeviceNodeFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void LogicalDeviceNodeFunctor::destroy(Qt3DCore::QNodeId id) const
{
HLogicalDevice handle = m_manager->lookupHandle(id);
m_manager->releaseResource(id);
diff --git a/src/input/backend/logicaldevice_p.h b/src/input/backend/logicaldevice_p.h
index f65527dbc..a7fdcd0ef 100644
--- a/src/input/backend/logicaldevice_p.h
+++ b/src/input/backend/logicaldevice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -63,9 +66,8 @@ class LogicalDevice : public Qt3DCore::QBackendNode
{
public:
LogicalDevice();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void cleanup();
- inline bool isEnabled() const { return m_enabled; }
+
inline QVector<Qt3DCore::QNodeId> axes() const { return m_axes; }
inline QVector<Qt3DCore::QNodeId> actions() const { return m_actions; }
@@ -73,20 +75,21 @@ protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QVector<Qt3DCore::QNodeId> m_axes;
QVector<Qt3DCore::QNodeId> m_actions;
- bool m_enabled;
};
-class LogicalDeviceNodeFunctor : public Qt3DCore::QBackendNodeFunctor
+class LogicalDeviceNodeFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
explicit LogicalDeviceNodeFunctor(LogicalDeviceManager *manager);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
private:
LogicalDeviceManager *m_manager;
diff --git a/src/input/backend/mousecontroller.cpp b/src/input/backend/mousecontroller.cpp
deleted file mode 100644
index f5db6780e..000000000
--- a/src/input/backend/mousecontroller.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mousecontroller_p.h"
-#include "inputmanagers_p.h"
-#include "inputhandler_p.h"
-#include "qmousecontroller.h"
-
-#include <Qt3DCore/qnode.h>
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-namespace Input {
-
-MouseController::MouseController()
- : QAbstractPhysicalDeviceBackendNode(ReadOnly)
- , m_sensitivity(0.1f)
-{
-}
-
-MouseController::~MouseController()
-{
-}
-
-void MouseController::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QAbstractPhysicalDeviceBackendNode::updateFromPeer(peer);
- QMouseController *object = static_cast<QMouseController *>(peer);
- m_sensitivity = object->sensitivity();
-}
-
-void MouseController::setInputHandler(InputHandler *handler)
-{
- m_inputHandler = handler;
-}
-
-void MouseController::addMouseInput(const Qt3DCore::QNodeId &input)
-{
- if (!m_mouseInputs.contains(input))
- m_mouseInputs.append(input);
-}
-
-void MouseController::removeMouseInput(const Qt3DCore::QNodeId &input)
-{
- m_mouseInputs.removeOne(input);
-}
-
-float MouseController::axisValue(int axisIdentifier) const
-{
- switch (axisIdentifier) {
- case QMouseController::X:
- return m_mouseState.xAxis;
- case QMouseController::Y:
- return m_mouseState.yAxis;
- break;
- default:
- break;
- }
- return 0.0f;
-}
-
-bool MouseController::isButtonPressed(int buttonIdentifier) const
-{
- switch (buttonIdentifier) {
- case QMouseController::Left:
- return m_mouseState.leftPressed;
- case QMouseController::Center:
- return m_mouseState.centerPressed;
- case QMouseController::Right:
- return m_mouseState.rightPressed;
- default:
- break;
- }
- return false;
-}
-
-QVector<Qt3DCore::QNodeId> MouseController::mouseInputs() const
-{
- return m_mouseInputs;
-}
-
-void MouseController::updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events)
-{
- if (!events.isEmpty()) {
- Q_FOREACH (const QT_PREPEND_NAMESPACE(QMouseEvent) &e, events) {
- m_mouseState.leftPressed = e.buttons() & (Qt::LeftButton);
- m_mouseState.centerPressed = e.buttons() & (Qt::MiddleButton);
- m_mouseState.rightPressed = e.buttons() & (Qt::RightButton);
- m_mouseState.xAxis = m_sensitivity * (e.screenPos().x() - m_previousPos.x());
- m_mouseState.yAxis = m_sensitivity * (m_previousPos.y() - e.screenPos().y());
- m_previousPos = e.screenPos();
- }
- } else {
- m_mouseState = MouseState();
- }
-}
-
-void MouseController::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- if (e->type() == Qt3DCore::NodeUpdated) {
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("sensitivity"))
- m_sensitivity = propertyChange->value().toFloat();
- }
-}
-
-MouseControllerFunctor::MouseControllerFunctor(QInputAspect *inputAspect, InputHandler *handler)
- : m_inputAspect(inputAspect)
- , m_handler(handler)
-{
-}
-
-Qt3DCore::QBackendNode *MouseControllerFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
-{
- MouseController *controller = m_handler->mouseControllerManager()->getOrCreateResource(frontend->id());
- controller->setFactory(factory);
- controller->setInputAspect(m_inputAspect);
- controller->setInputHandler(m_handler);
- controller->setPeer(frontend);
- m_handler->appendMouseController(m_handler->mouseControllerManager()->lookupHandle(frontend->id()));
- return controller;
-}
-
-Qt3DCore::QBackendNode *MouseControllerFunctor::get(const Qt3DCore::QNodeId &id) const
-{
- return m_handler->mouseControllerManager()->lookupResource(id);
-}
-
-void MouseControllerFunctor::destroy(const Qt3DCore::QNodeId &id) const
-{
- m_handler->removeMouseController(m_handler->mouseControllerManager()->lookupHandle(id));
- m_handler->mouseControllerManager()->releaseResource(id);
-}
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/mousecontroller_p.h b/src/input/backend/mousecontroller_p.h
deleted file mode 100644
index b1aa7185a..000000000
--- a/src/input/backend/mousecontroller_p.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_MOUSECONTROLLER_H
-#define QT3DINPUT_INPUT_MOUSECONTROLLER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DInput/qabstractphysicaldevicebackendnode.h>
-#include <QMouseEvent>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QInputAspect;
-
-namespace Input {
-
-class InputHandler;
-
-class MouseController : public Qt3DInput::QAbstractPhysicalDeviceBackendNode
-{
-public:
- MouseController();
- ~MouseController();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- void setInputHandler(InputHandler *handler);
-
- void addMouseInput(const Qt3DCore::QNodeId &input);
- void removeMouseInput(const Qt3DCore::QNodeId &input);
-
- float axisValue(int axisIdentifier) const Q_DECL_OVERRIDE;
- bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE;
-
- QVector<Qt3DCore::QNodeId> mouseInputs() const;
-
- void updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events);
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-
-private:
- QVector<Qt3DCore::QNodeId> m_mouseInputs;
- InputHandler *m_inputHandler;
-
- struct MouseState {
-
- MouseState()
- : xAxis(0.0f)
- , yAxis(0.0f)
- , leftPressed(false)
- , rightPressed(false)
- , centerPressed(false)
- {}
-
- float xAxis;
- float yAxis;
- bool leftPressed;
- bool rightPressed;
- bool centerPressed;
- };
-
- MouseState m_mouseState;
- QPointF m_previousPos;
- float m_sensitivity;
-};
-
-class MouseControllerFunctor : public Qt3DCore::QBackendNodeFunctor
-{
-public:
- explicit MouseControllerFunctor(Qt3DInput::QInputAspect *inputAspect, InputHandler *handler);
-
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
-
-private:
- QInputAspect *m_inputAspect;
- InputHandler *m_handler;
-};
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // MOUSECONTROLLER_H
diff --git a/src/input/backend/mousedevice.cpp b/src/input/backend/mousedevice.cpp
new file mode 100644
index 000000000..25f0a6682
--- /dev/null
+++ b/src/input/backend/mousedevice.cpp
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mousedevice_p.h"
+#include "inputmanagers_p.h"
+#include "inputhandler_p.h"
+#include "qmousedevice.h"
+#include <Qt3DInput/private/qmousedevice_p.h>
+
+#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+
+MouseDevice::MouseDevice()
+ : QAbstractPhysicalDeviceBackendNode(ReadOnly)
+ , m_sensitivity(0.1f)
+{
+}
+
+MouseDevice::~MouseDevice()
+{
+}
+
+void MouseDevice::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QMouseDeviceData>>(change);
+ const auto &data = typedChange->data;
+ m_sensitivity = data.sensitivity;
+ QAbstractPhysicalDeviceBackendNode::initializeFromPeer(change);
+}
+
+void MouseDevice::setInputHandler(InputHandler *handler)
+{
+ m_inputHandler = handler;
+}
+
+void MouseDevice::addMouseInput(Qt3DCore::QNodeId input)
+{
+ if (!m_mouseInputs.contains(input))
+ m_mouseInputs.append(input);
+}
+
+void MouseDevice::removeMouseInput(Qt3DCore::QNodeId input)
+{
+ m_mouseInputs.removeOne(input);
+}
+
+float MouseDevice::axisValue(int axisIdentifier) const
+{
+ switch (axisIdentifier) {
+ case QMouseDevice::X:
+ return m_mouseState.xAxis;
+ case QMouseDevice::Y:
+ return m_mouseState.yAxis;
+ break;
+ default:
+ break;
+ }
+ return 0.0f;
+}
+
+bool MouseDevice::isButtonPressed(int buttonIdentifier) const
+{
+ switch (buttonIdentifier) {
+ case QMouseEvent::LeftButton:
+ return m_mouseState.leftPressed;
+ case QMouseEvent::MiddleButton:
+ return m_mouseState.centerPressed;
+ case QMouseEvent::RightButton:
+ return m_mouseState.rightPressed;
+ default:
+ break;
+ }
+ return false;
+}
+
+QVector<Qt3DCore::QNodeId> MouseDevice::mouseInputs() const
+{
+ return m_mouseInputs;
+}
+
+void MouseDevice::updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events)
+{
+ if (!events.isEmpty()) {
+ for (const QT_PREPEND_NAMESPACE(QMouseEvent) &e : events) {
+ m_mouseState.leftPressed = e.buttons() & (Qt::LeftButton);
+ m_mouseState.centerPressed = e.buttons() & (Qt::MiddleButton);
+ m_mouseState.rightPressed = e.buttons() & (Qt::RightButton);
+ m_mouseState.xAxis = m_sensitivity * (e.screenPos().x() - m_previousPos.x());
+ m_mouseState.yAxis = m_sensitivity * (m_previousPos.y() - e.screenPos().y());
+ m_previousPos = e.screenPos();
+ }
+ } else {
+ m_mouseState = MouseState();
+ }
+}
+
+void MouseDevice::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("sensitivity"))
+ m_sensitivity = propertyChange->value().toFloat();
+ }
+}
+
+MouseDeviceFunctor::MouseDeviceFunctor(QInputAspect *inputAspect, InputHandler *handler)
+ : m_inputAspect(inputAspect)
+ , m_handler(handler)
+{
+}
+
+Qt3DCore::QBackendNode *MouseDeviceFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
+{
+ MouseDevice *controller = m_handler->mouseDeviceManager()->getOrCreateResource(change->subjectId());
+ controller->setInputAspect(m_inputAspect);
+ controller->setInputHandler(m_handler);
+ m_handler->appendMouseDevice(m_handler->mouseDeviceManager()->lookupHandle(change->subjectId()));
+ return controller;
+}
+
+Qt3DCore::QBackendNode *MouseDeviceFunctor::get(Qt3DCore::QNodeId id) const
+{
+ return m_handler->mouseDeviceManager()->lookupResource(id);
+}
+
+void MouseDeviceFunctor::destroy(Qt3DCore::QNodeId id) const
+{
+ m_handler->removeMouseDevice(m_handler->mouseDeviceManager()->lookupHandle(id));
+ m_handler->mouseDeviceManager()->releaseResource(id);
+}
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/mousedevice_p.h b/src/input/backend/mousedevice_p.h
new file mode 100644
index 000000000..3624aa8af
--- /dev/null
+++ b/src/input/backend/mousedevice_p.h
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_MOUSEDEVICE_H
+#define QT3DINPUT_INPUT_MOUSEDEVICE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qabstractphysicaldevicebackendnode_p.h>
+#include <QMouseEvent>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QInputAspect;
+
+namespace Input {
+
+class InputHandler;
+
+class MouseDevice : public Qt3DInput::QAbstractPhysicalDeviceBackendNode
+{
+public:
+ MouseDevice();
+ ~MouseDevice();
+
+ void setInputHandler(InputHandler *handler);
+
+ void addMouseInput(Qt3DCore::QNodeId input);
+ void removeMouseInput(Qt3DCore::QNodeId input);
+
+ float axisValue(int axisIdentifier) const Q_DECL_OVERRIDE;
+ bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE;
+
+ QVector<Qt3DCore::QNodeId> mouseInputs() const;
+
+ void updateMouseEvents(const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events);
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<Qt3DCore::QNodeId> m_mouseInputs;
+ InputHandler *m_inputHandler;
+
+ struct MouseState {
+
+ MouseState()
+ : xAxis(0.0f)
+ , yAxis(0.0f)
+ , leftPressed(false)
+ , rightPressed(false)
+ , centerPressed(false)
+ {}
+
+ float xAxis;
+ float yAxis;
+ bool leftPressed;
+ bool rightPressed;
+ bool centerPressed;
+ };
+
+ MouseState m_mouseState;
+ QPointF m_previousPos;
+ float m_sensitivity;
+};
+
+class MouseDeviceFunctor : public Qt3DCore::QBackendNodeMapper
+{
+public:
+ explicit MouseDeviceFunctor(Qt3DInput::QInputAspect *inputAspect, InputHandler *handler);
+
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+
+private:
+ QInputAspect *m_inputAspect;
+ InputHandler *m_handler;
+};
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // MOUSEDEVICE_H
diff --git a/src/input/backend/mouseeventdispatcherjob.cpp b/src/input/backend/mouseeventdispatcherjob.cpp
index 2c2fc1eec..f49f18571 100644
--- a/src/input/backend/mouseeventdispatcherjob.cpp
+++ b/src/input/backend/mouseeventdispatcherjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "mouseeventdispatcherjob_p.h"
#include "inputhandler_p.h"
-#include "mouseinput_p.h"
+#include "mousehandler_p.h"
#include "inputmanagers_p.h"
QT_BEGIN_NAMESPACE
@@ -44,11 +47,14 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
namespace Input {
-MouseEventDispatcherJob::MouseEventDispatcherJob(const Qt3DCore::QNodeId &input, const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events)
+MouseEventDispatcherJob::MouseEventDispatcherJob(Qt3DCore::QNodeId input,
+ const QList<QT_PREPEND_NAMESPACE (QMouseEvent)> &mouseEvents,
+ const QList<QT_PREPEND_NAMESPACE (QWheelEvent)> &wheelEvents)
: QAspectJob()
- , m_inputHandler(Q_NULLPTR)
+ , m_inputHandler(nullptr)
, m_mouseInput(input)
- , m_events(events)
+ , m_mouseEvents(mouseEvents)
+ , m_wheelEvents(wheelEvents)
{
}
@@ -59,12 +65,13 @@ void MouseEventDispatcherJob::setInputHandler(InputHandler *handler)
void MouseEventDispatcherJob::run()
{
- MouseInput *input = m_inputHandler->mouseInputManager()->lookupResource(m_mouseInput);
+ MouseHandler *input = m_inputHandler->mouseInputManager()->lookupResource(m_mouseInput);
if (input) {
- Q_FOREACH (const QT_PREPEND_NAMESPACE(QMouseEvent) &e, m_events) {
- // Send events to frontend
+ // Send mouse and wheel events to frontend
+ for (const QT_PREPEND_NAMESPACE(QMouseEvent) &e : m_mouseEvents)
input->mouseEvent(QMouseEventPtr(new QMouseEvent(e)));
- }
+ for (const QT_PREPEND_NAMESPACE(QWheelEvent) &e : m_wheelEvents)
+ input->wheelEvent(QWheelEventPtr(new QWheelEvent(e)));
}
}
diff --git a/src/input/backend/mouseeventdispatcherjob_p.h b/src/input/backend/mouseeventdispatcherjob_p.h
index 576a6d2e7..defe3c3a3 100644
--- a/src/input/backend/mouseeventdispatcherjob_p.h
+++ b/src/input/backend/mouseeventdispatcherjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,14 +65,17 @@ class InputHandler;
class MouseEventDispatcherJob : public Qt3DCore::QAspectJob
{
public:
- explicit MouseEventDispatcherJob(const Qt3DCore::QNodeId &input, const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &events);
+ explicit MouseEventDispatcherJob(Qt3DCore::QNodeId input,
+ const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> &mouseEvents,
+ const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> &wheelEvents);
void setInputHandler(InputHandler *handler);
void run() Q_DECL_FINAL;
private:
InputHandler *m_inputHandler;
const Qt3DCore::QNodeId m_mouseInput;
- const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> m_events;
+ const QList<QT_PREPEND_NAMESPACE(QMouseEvent)> m_mouseEvents;
+ const QList<QT_PREPEND_NAMESPACE(QWheelEvent)> m_wheelEvents;
};
} // namespace Input
diff --git a/src/input/backend/mouseeventfilter.cpp b/src/input/backend/mouseeventfilter.cpp
index fcf8eb922..f12127c3b 100644
--- a/src/input/backend/mouseeventfilter.cpp
+++ b/src/input/backend/mouseeventfilter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,12 +64,24 @@ bool MouseEventFilter::eventFilter(QObject *obj, QEvent *e)
{
Q_UNUSED(obj);
switch (e->type()) {
+ // When dealing with QtQuick events, there are nove MouseMove events
+ // only hover events which are transmitted if hoverEnabled was set to true on the Scene3D
+ case QEvent::HoverMove:
+ {
+ const QHoverEvent *event = static_cast<QHoverEvent *>(e);
+ m_inputHandler->appendMouseEvent(QMouseEvent(QEvent::MouseMove, event->posF(), Qt::NoButton, Qt::NoButton, event->modifiers()));
+ break;
+ }
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseMove:
- // Store event to be processed later on in an InputAspect job
+ // Creates copy and store event to be processed later on in an InputAspect job
m_inputHandler->appendMouseEvent(QMouseEvent(*static_cast<QMouseEvent *>(e)));
break;
+ case QEvent::Wheel:
+ // Creates copy and store event to be processed later on in an InputAspect job
+ m_inputHandler->appendWheelEvent(QWheelEvent(*static_cast<QWheelEvent *>(e)));
+ break;
default:
break;
}
diff --git a/src/input/backend/mouseeventfilter_p.h b/src/input/backend/mouseeventfilter_p.h
index 6fba946b8..a733b3ad1 100644
--- a/src/input/backend/mouseeventfilter_p.h
+++ b/src/input/backend/mouseeventfilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/input/backend/mousehandler.cpp b/src/input/backend/mousehandler.cpp
new file mode 100644
index 000000000..638c090e5
--- /dev/null
+++ b/src/input/backend/mousehandler.cpp
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mousehandler_p.h"
+#include "inputmanagers_p.h"
+#include "inputhandler_p.h"
+#include "mousedevice_p.h"
+
+#include <Qt3DInput/qmousehandler.h>
+#include <Qt3DInput/private/qmousehandler_p.h>
+#include <Qt3DInput/qmousedevice.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DInput {
+namespace Input {
+
+MouseHandler::MouseHandler()
+ : QBackendNode(ReadWrite)
+ , m_inputHandler(nullptr)
+{
+}
+
+MouseHandler::~MouseHandler()
+{
+}
+
+void MouseHandler::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QMouseHandlerData>>(change);
+ const auto &data = typedChange->data;
+ setDevice(data.mouseDeviceId);
+}
+
+Qt3DCore::QNodeId MouseHandler::mouseDevice() const
+{
+ return m_mouseDevice;
+}
+
+void MouseHandler::setInputHandler(InputHandler *handler)
+{
+ m_inputHandler = handler;
+}
+
+void MouseHandler::mouseEvent(const QMouseEventPtr &event)
+{
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("mouse");
+ e->setValue(QVariant::fromValue(event));
+ notifyObservers(e);
+}
+
+void MouseHandler::wheelEvent(const QWheelEventPtr &event)
+{
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("wheel");
+ e->setValue(QVariant::fromValue(event));
+ notifyObservers(e);
+}
+
+void MouseHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("device")) {
+ const QNodeId newId = propertyChange->value().value<QNodeId>();
+ if (m_mouseDevice != newId) {
+ setDevice(newId);
+ }
+ }
+ }
+ QBackendNode::sceneChangeEvent(e);
+}
+
+void MouseHandler::setDevice(Qt3DCore::QNodeId device)
+{
+ if (!m_mouseDevice.isNull()) {
+ MouseDevice *device = m_inputHandler->mouseDeviceManager()->lookupResource(m_mouseDevice);
+ if (device)
+ device->removeMouseInput(peerId());
+ }
+ m_mouseDevice = device;
+ if (!m_mouseDevice.isNull()) {
+ MouseDevice *device = m_inputHandler->mouseDeviceManager()->lookupResource(m_mouseDevice);
+ if (device)
+ device->addMouseInput(peerId());
+ }
+}
+
+MouseHandlerFunctor::MouseHandlerFunctor(InputHandler *handler)
+ : m_handler(handler)
+{
+}
+
+Qt3DCore::QBackendNode *MouseHandlerFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
+{
+ MouseHandler *input = m_handler->mouseInputManager()->getOrCreateResource(change->subjectId());
+ input->setInputHandler(m_handler);
+ return input;
+}
+
+Qt3DCore::QBackendNode *MouseHandlerFunctor::get(Qt3DCore::QNodeId id) const
+{
+ return m_handler->mouseInputManager()->lookupResource(id);
+}
+
+void MouseHandlerFunctor::destroy(Qt3DCore::QNodeId id) const
+{
+ m_handler->mouseInputManager()->releaseResource(id);
+}
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/backend/mousehandler_p.h b/src/input/backend/mousehandler_p.h
new file mode 100644
index 000000000..b2ae4f9ed
--- /dev/null
+++ b/src/input/backend/mousehandler_p.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_MOUSEHANDLER_H
+#define QT3DINPUT_INPUT_MOUSEHANDLER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DInput/qmouseevent.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+
+class InputHandler;
+
+class MouseHandler : public Qt3DCore::QBackendNode
+{
+public:
+ MouseHandler();
+ ~MouseHandler();
+
+ Qt3DCore::QNodeId mouseDevice() const;
+ void setInputHandler(InputHandler *handler);
+ void mouseEvent(const QMouseEventPtr &event);
+ void wheelEvent(const QWheelEventPtr &event);
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ void setDevice(Qt3DCore::QNodeId device);
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ Qt3DCore::QNodeId m_mouseDevice;
+ InputHandler *m_inputHandler;
+};
+
+class MouseHandlerFunctor : public Qt3DCore::QBackendNodeMapper
+{
+public:
+ explicit MouseHandlerFunctor(InputHandler *handler);
+
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+
+private:
+ InputHandler *m_handler;
+};
+
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_MOUSEHANDLER_H
diff --git a/src/input/backend/mouseinput.cpp b/src/input/backend/mouseinput.cpp
deleted file mode 100644
index 518519602..000000000
--- a/src/input/backend/mouseinput.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mouseinput_p.h"
-#include "mousecontroller_p.h"
-#include "inputmanagers_p.h"
-#include "inputhandler_p.h"
-
-#include <Qt3DInput/qmouseinput.h>
-#include <Qt3DInput/qmousecontroller.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DInput {
-namespace Input {
-
-MouseInput::MouseInput()
- : QBackendNode(ReadWrite)
- , m_enabled(false)
- , m_inputHandler(Q_NULLPTR)
-{
-}
-
-MouseInput::~MouseInput()
-{
-}
-
-void MouseInput::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QMouseInput *input = static_cast<QMouseInput *>(peer);
- if (input->controller() != Q_NULLPTR)
- setController(input->controller()->id());
- m_enabled = input->isEnabled();
-}
-
-Qt3DCore::QNodeId MouseInput::mouseController() const
-{
- return m_mouseController;
-}
-
-void MouseInput::setInputHandler(InputHandler *handler)
-{
- m_inputHandler = handler;
-}
-
-void MouseInput::mouseEvent(const QMouseEventPtr &event)
-{
- QBackendScenePropertyChangePtr e(new QBackendScenePropertyChange(NodeUpdated, peerUuid()));
- e->setTargetNode(peerUuid());
- e->setPropertyName("mouse");
- e->setValue(QVariant::fromValue(event));
- notifyObservers(e);
-}
-
-void MouseInput::wheelEvent(const QWheelEventPtr &event)
-{
- QBackendScenePropertyChangePtr e(new QBackendScenePropertyChange(NodeUpdated, peerUuid()));
- e->setTargetNode(peerUuid());
- e->setPropertyName("wheel");
- e->setValue(QVariant::fromValue(event));
- notifyObservers(e);
-}
-
-void MouseInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("controller")) {
- const QNodeId newId = propertyChange->value().value<QNodeId>();
- if (m_mouseController != newId) {
- setController(newId);
- }
- }
- }
-}
-
-void MouseInput::setController(const Qt3DCore::QNodeId &controller)
-{
- if (!m_mouseController.isNull()) {
- MouseController *controller = m_inputHandler->mouseControllerManager()->lookupResource(m_mouseController);
- if (controller)
- controller->removeMouseInput(peerUuid());
- }
- m_mouseController = controller;
- if (!m_mouseController.isNull()) {
- MouseController *controller = m_inputHandler->mouseControllerManager()->lookupResource(m_mouseController);
- if (controller)
- controller->addMouseInput(peerUuid());
- }
-}
-
-MouseInputFunctor::MouseInputFunctor(InputHandler *handler)
- : m_handler(handler)
-{
-}
-
-Qt3DCore::QBackendNode *MouseInputFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
-{
- MouseInput *input = m_handler->mouseInputManager()->getOrCreateResource(frontend->id());
- input->setFactory(factory);
- input->setInputHandler(m_handler);
- input->setPeer(frontend);
- return input;
-}
-
-Qt3DCore::QBackendNode *MouseInputFunctor::get(const Qt3DCore::QNodeId &id) const
-{
- return m_handler->mouseInputManager()->lookupResource(id);
-}
-
-void MouseInputFunctor::destroy(const Qt3DCore::QNodeId &id) const
-{
- m_handler->mouseInputManager()->releaseResource(id);
-}
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/backend/mouseinput_p.h b/src/input/backend/mouseinput_p.h
deleted file mode 100644
index cd03234f5..000000000
--- a/src/input/backend/mouseinput_p.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_MOUSEINPUT_H
-#define QT3DINPUT_INPUT_MOUSEINPUT_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DInput/qmouseevent.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-namespace Input {
-
-class InputHandler;
-
-class MouseInput : public Qt3DCore::QBackendNode
-{
-public:
- MouseInput();
- ~MouseInput();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- Qt3DCore::QNodeId mouseController() const;
- void setInputHandler(InputHandler *handler);
- void mouseEvent(const QMouseEventPtr &event);
- void wheelEvent(const QWheelEventPtr &event);
-
- inline bool isEnabled() const { return m_enabled; }
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- void setController(const Qt3DCore::QNodeId &controller);
-
-private:
- bool m_enabled;
- Qt3DCore::QNodeId m_mouseController;
- InputHandler *m_inputHandler;
-};
-
-class MouseInputFunctor : public Qt3DCore::QBackendNodeFunctor
-{
-public:
- explicit MouseInputFunctor(InputHandler *handler);
-
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
-
-private:
- InputHandler *m_handler;
-};
-
-} // namespace Input
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // MOUSEINPUT_H
diff --git a/src/input/backend/movingaverage.cpp b/src/input/backend/movingaverage.cpp
index b954ce9ee..36b204341 100644
--- a/src/input/backend/movingaverage.cpp
+++ b/src/input/backend/movingaverage.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/input/backend/movingaverage_p.h b/src/input/backend/movingaverage_p.h
index 8c5ae7bcb..096f359d1 100644
--- a/src/input/backend/movingaverage_p.h
+++ b/src/input/backend/movingaverage_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/input/backend/qabstractphysicaldevicebackendnode.cpp b/src/input/backend/qabstractphysicaldevicebackendnode.cpp
index 92eaffd41..eb66f4188 100644
--- a/src/input/backend/qabstractphysicaldevicebackendnode.cpp
+++ b/src/input/backend/qabstractphysicaldevicebackendnode.cpp
@@ -1,50 +1,56 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qabstractphysicaldevicebackendnode.h"
#include "qabstractphysicaldevicebackendnode_p.h"
+#include "qabstractphysicaldevicebackendnode_p_p.h"
#include "qabstractphysicaldevice.h"
#include "qaxissetting.h"
#include "inputhandler_p.h"
#include "inputmanagers_p.h"
#include <Qt3DInput/qinputaspect.h>
+#include <Qt3DInput/qphysicaldevicecreatedchange.h>
#include <Qt3DInput/private/qinputaspect_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <Qt3DCore/private/qabstractaspect_p.h>
#include <cmath>
@@ -53,16 +59,6 @@ QT_BEGIN_NAMESPACE
namespace {
-QVector<int> variantListToVector(const QVariantList &list)
-{
- QVector<int> v(list.size());
- int i = 0;
- Q_FOREACH (const QVariant &e, list) {
- v[i++] = e.toInt();
- }
- return v;
-}
-
Q_DECL_CONSTEXPR int signum(float v)
{
return (v > 0.0f) - (v < 0.0f);
@@ -75,8 +71,7 @@ namespace Qt3DInput {
QAbstractPhysicalDeviceBackendNodePrivate::QAbstractPhysicalDeviceBackendNodePrivate(Qt3DCore::QBackendNode::Mode mode)
: Qt3DCore::QBackendNodePrivate(mode)
, m_axisSettings()
- , m_inputAspect(Q_NULLPTR)
- , m_enabled(false)
+ , m_inputAspect(nullptr)
{
}
@@ -145,47 +140,67 @@ QAbstractPhysicalDeviceBackendNode::QAbstractPhysicalDeviceBackendNode(QAbstract
{
}
-void QAbstractPhysicalDeviceBackendNode::updateFromPeer(Qt3DCore::QNode *peer)
+// TODO: Fold this into a job as described below
+//void QAbstractPhysicalDeviceBackendNode::updateFromPeer(Qt3DCore::QNode *peer)
+//{
+// Q_D(QAbstractPhysicalDeviceBackendNode);
+// QAbstractPhysicalDevice *physicalDevice = static_cast<QAbstractPhysicalDevice *>(peer);
+// const auto axisSettings = physicalDevice->axisSettings();
+// for (QAxisSetting *axisSetting : axisSettings) {
+// // Each axis setting can apply to more than one axis. If an axis is
+// // mentioned in more than one setting, we use the last one
+// const auto axisIds = variantListToVector(axisSetting->axes());
+// for (int axisId : axisIds)
+// d->addAxisSetting(axisId, axisSetting->id());
+// }
+//}
+
+void QAbstractPhysicalDeviceBackendNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
+ const auto deviceChange = qSharedPointerCast<QPhysicalDeviceCreatedChangeBase>(change);
Q_D(QAbstractPhysicalDeviceBackendNode);
- QAbstractPhysicalDevice *physicalDevice = static_cast<QAbstractPhysicalDevice *>(peer);
- d->m_enabled = physicalDevice->isEnabled();
- Q_FOREACH (QAxisSetting *axisSetting, physicalDevice->axisSettings()) {
- // Each axis setting can apply to more than one axis. If an axis is
- // mentioned in more than one setting, we use the last one
- Q_FOREACH (int axisId, variantListToVector(axisSetting->axes()))
- d->addAxisSetting(axisId, axisSetting->id());
- }
+ // Store the axis setting Ids. We will update the settings themselves from
+ // a job scheduled on the next frame.
+ // TODO: Create such a job once all types can be created this way.
+ d->m_pendingAxisSettingIds = deviceChange->axisSettingIds();
}
void QAbstractPhysicalDeviceBackendNode::cleanup()
{
Q_D(QAbstractPhysicalDeviceBackendNode);
- d->m_enabled = false;
+ QBackendNode::setEnabled(false);
d->m_axisSettings.clear();
d->m_axisFilters.clear();
- d->m_inputAspect = Q_NULLPTR;
+ d->m_inputAspect = nullptr;
}
void QAbstractPhysicalDeviceBackendNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
Q_D(QAbstractPhysicalDeviceBackendNode);
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- if (e->type() == Qt3DCore::NodeUpdated) {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- d->m_enabled = propertyChange->value().toBool();
- }
- } else if (e->type() == Qt3DCore::NodeAdded) {
- if (propertyChange->propertyName() == QByteArrayLiteral("axisSettings")) {
- const Qt3DCore::QNodeId axisSettingId = propertyChange->value().value<Qt3DCore::QNodeId>();
+ switch (e->type()) {
+ case Qt3DCore::PropertyValueAdded: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("axisSettings")) {
+ const auto axisSettingId = change->addedNodeId();
Input::AxisSetting *axisSetting = d->getAxisSetting(axisSettingId);
- Q_FOREACH (int axisId, axisSetting->axes())
+ const auto axisIds = axisSetting->axes();
+ for (int axisId : axisIds)
d->addAxisSetting(axisId, axisSettingId);
}
- } else if (e->type() == Qt3DCore::NodeRemoved) {
- if (propertyChange->propertyName() == QByteArrayLiteral("axisSettings"))
- d->removeAxisSetting(propertyChange->value().value<Qt3DCore::QNodeId>());
+ break;
+ }
+
+ case Qt3DCore::PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("axisSettings"))
+ d->removeAxisSetting(change->removedNodeId());
+ break;
+ }
+
+ default:
+ break;
}
+ QBackendNode::sceneChangeEvent(e);
}
void QAbstractPhysicalDeviceBackendNode::setInputAspect(QInputAspect *aspect)
@@ -225,8 +240,8 @@ float QAbstractPhysicalDeviceBackendNode::processedAxisValue(int axisIdentifier)
Q_ASSERT(axisSetting);
float val = rawAxisValue;
- // Low pass filtering
- if (axisSetting->isFilterEnabled()) {
+ // Low pass smoothing
+ if (axisSetting->isSmoothEnabled()) {
// Get the filter corresponding to this axis
Input::MovingAverage &filter = d->getOrCreateFilter(axisIdentifier);
filter.addSample(val);
@@ -234,7 +249,7 @@ float QAbstractPhysicalDeviceBackendNode::processedAxisValue(int axisIdentifier)
}
// Deadzone handling
- const float d = axisSetting->deadZone();
+ const float d = axisSetting->deadZoneRadius();
if (!qFuzzyIsNull(d)) {
if (std::abs(val) <= d) {
val = 0.0f;
diff --git a/src/input/backend/qabstractphysicaldevicebackendnode.h b/src/input/backend/qabstractphysicaldevicebackendnode.h
deleted file mode 100644
index 3846d1a1e..000000000
--- a/src/input/backend/qabstractphysicaldevicebackendnode.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QABSTRACTPHYSICALDEVICEBACKENDNODE_H
-#define QT3DINPUT_QABSTRACTPHYSICALDEVICEBACKENDNODE_H
-
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DInput/qt3dinput_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-class QBackendNodePrivate;
-}
-
-namespace Qt3DInput {
-
-class QInputAspect;
-class QAbstractPhysicalDeviceBackendNodePrivate;
-
-class QT3DINPUTSHARED_EXPORT QAbstractPhysicalDeviceBackendNode : public Qt3DCore::QBackendNode
-{
-public:
- explicit QAbstractPhysicalDeviceBackendNode(QBackendNode::Mode mode);
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- virtual void cleanup();
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-
- void setInputAspect(QInputAspect *aspect);
- QInputAspect *inputAspect() const;
-
- float processedAxisValue(int axisIdentifier);
- virtual float axisValue(int axisIdentifier) const = 0;
- virtual bool isButtonPressed(int buttonIdentifier) const = 0;
-
-protected:
- QAbstractPhysicalDeviceBackendNode(QAbstractPhysicalDeviceBackendNodePrivate &dd);
- Q_DECLARE_PRIVATE(QAbstractPhysicalDeviceBackendNode)
-};
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QABSTRACTPHYSICALDEVICEBACKENDNODE_H
diff --git a/src/input/backend/qabstractphysicaldevicebackendnode_p.h b/src/input/backend/qabstractphysicaldevicebackendnode_p.h
index 52853550b..aa789fe27 100644
--- a/src/input/backend/qabstractphysicaldevicebackendnode_p.h
+++ b/src/input/backend/qabstractphysicaldevicebackendnode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,60 +51,44 @@
// We mean it.
//
-#include <Qt3DCore/private/qbackendnode_p.h>
-#include <Qt3DCore/qnodeid.h>
-#include <QtCore/qvector.h>
+#include <Qt3DCore/qbackendnode.h>
#include <Qt3DInput/private/qt3dinput_global_p.h>
-#include <Qt3DInput/private/movingaverage_p.h>
QT_BEGIN_NAMESPACE
+namespace Qt3DCore {
+class QBackendNodePrivate;
+}
+
namespace Qt3DInput {
-class QAxisSetting;
class QInputAspect;
+class QAbstractPhysicalDeviceBackendNodePrivate;
-namespace Input {
-
-struct AxisIdSetting
-{
- int m_axisIdentifier;
- Qt3DCore::QNodeId m_axisSettingsId;
-};
-
-struct AxisIdFilter
-{
- int m_axisIdentifier;
- MovingAverage m_filter;
-};
-
-class AxisSetting;
-
-}
-
-class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceBackendNodePrivate : public Qt3DCore::QBackendNodePrivate
+class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceBackendNode : public Qt3DCore::QBackendNode
{
public:
- explicit QAbstractPhysicalDeviceBackendNodePrivate(Qt3DCore::QBackendNode::Mode mode = Qt3DCore::QBackendNode::ReadOnly);
+ explicit QAbstractPhysicalDeviceBackendNode(QBackendNode::Mode mode);
+ virtual void cleanup();
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- Q_DECLARE_PUBLIC(QAbstractPhysicalDeviceBackendNode)
+ void setInputAspect(QInputAspect *aspect);
+ QInputAspect *inputAspect() const;
- void addAxisSetting(int axisIdentifier, Qt3DCore::QNodeId axisSettingId);
- void removeAxisSetting(Qt3DCore::QNodeId axisSettingsId);
+ float processedAxisValue(int axisIdentifier);
+ virtual float axisValue(int axisIdentifier) const = 0;
+ virtual bool isButtonPressed(int buttonIdentifier) const = 0;
- Input::MovingAverage &getOrCreateFilter(int axisIdentifier);
+protected:
+ QAbstractPhysicalDeviceBackendNode(QAbstractPhysicalDeviceBackendNodePrivate &dd);
- Input::AxisSetting *getAxisSetting(Qt3DCore::QNodeId axisSettingId) const;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_OVERRIDE;
- QVector<Input::AxisIdSetting> m_axisSettings;
- QVector<Input::AxisIdFilter> m_axisFilters;
- QInputAspect *m_inputAspect;
- bool m_enabled;
+ Q_DECLARE_PRIVATE(QAbstractPhysicalDeviceBackendNode)
};
-}
+} // Qt3DInput
QT_END_NAMESPACE
-#endif // QT3DINPUT_QABSTRACTPHYSICALDEVICEBACKENDNODE_P_H
-
+#endif // QT3DINPUT_QABSTRACTPHYSICALDEVICEBACKENDNODE_H
diff --git a/src/input/backend/qabstractphysicaldevicebackendnode_p_p.h b/src/input/backend/qabstractphysicaldevicebackendnode_p_p.h
new file mode 100644
index 000000000..ce47181fa
--- /dev/null
+++ b/src/input/backend/qabstractphysicaldevicebackendnode_p_p.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QABSTRACTPHYSICALDEVICEBACKENDNODE_P_P_H
+#define QT3DINPUT_QABSTRACTPHYSICALDEVICEBACKENDNODE_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qbackendnode_p.h>
+#include <Qt3DCore/qnodeid.h>
+#include <QtCore/qvector.h>
+#include <Qt3DInput/private/qt3dinput_global_p.h>
+#include <Qt3DInput/private/movingaverage_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAxisSetting;
+class QInputAspect;
+
+namespace Input {
+
+struct AxisIdSetting
+{
+ int m_axisIdentifier;
+ Qt3DCore::QNodeId m_axisSettingsId;
+};
+
+struct AxisIdFilter
+{
+ int m_axisIdentifier;
+ MovingAverage m_filter;
+};
+
+class AxisSetting;
+
+}
+
+class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDeviceBackendNodePrivate : public Qt3DCore::QBackendNodePrivate
+{
+public:
+ explicit QAbstractPhysicalDeviceBackendNodePrivate(Qt3DCore::QBackendNode::Mode mode = Qt3DCore::QBackendNode::ReadOnly);
+
+ Q_DECLARE_PUBLIC(QAbstractPhysicalDeviceBackendNode)
+
+ void addAxisSetting(int axisIdentifier, Qt3DCore::QNodeId axisSettingId);
+ void removeAxisSetting(Qt3DCore::QNodeId axisSettingsId);
+
+ Input::MovingAverage &getOrCreateFilter(int axisIdentifier);
+
+ Input::AxisSetting *getAxisSetting(Qt3DCore::QNodeId axisSettingId) const;
+
+ Qt3DCore::QNodeIdVector m_pendingAxisSettingIds;
+ QVector<Input::AxisIdSetting> m_axisSettings;
+ QVector<Input::AxisIdFilter> m_axisFilters;
+ QInputAspect *m_inputAspect;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QABSTRACTPHYSICALDEVICEBACKENDNODE_P_P_H
+
diff --git a/src/input/backend/updateaxisactionjob.cpp b/src/input/backend/updateaxisactionjob.cpp
index 406aa952c..f811c9ac0 100644
--- a/src/input/backend/updateaxisactionjob.cpp
+++ b/src/input/backend/updateaxisactionjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,8 +40,8 @@
#include "updateaxisactionjob_p.h"
#include <Qt3DInput/private/inputhandler_p.h>
#include <Qt3DInput/private/inputmanagers_p.h>
-#include <Qt3DInput/qabstractphysicaldevicebackendnode.h>
-#include <Qt3DInput/qinputdeviceintegration.h>
+#include <Qt3DInput/private/qabstractphysicaldevicebackendnode_p.h>
+#include <Qt3DInput/private/qinputdeviceintegration_p.h>
QT_BEGIN_NAMESPACE
@@ -48,22 +51,23 @@ namespace Input {
namespace {
-bool anyOfRequiredKeysPressed(const QVector<int> &keys, QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend)
+bool anyOfRequiredButtonsPressed(const QVector<int> &buttons, QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend)
{
- bool validKeyWasPressed = false;
- Q_FOREACH (int key, keys) {
- if (physicalDeviceBackend->isButtonPressed(key)) {
- validKeyWasPressed = true;
+ bool validButtonWasPressed = false;
+ for (int button : buttons) {
+ if (physicalDeviceBackend->isButtonPressed(button)) {
+ validButtonWasPressed = true;
break;
}
}
- return validKeyWasPressed;
+ return validButtonWasPressed;
}
} // anonymous
-UpdateAxisActionJob::UpdateAxisActionJob(InputHandler *handler, HLogicalDevice handle)
+UpdateAxisActionJob::UpdateAxisActionJob(qint64 currentTime, InputHandler *handler, HLogicalDevice handle)
: Qt3DCore::QAspectJob()
+ , m_currentTime(currentTime)
, m_handler(handler)
, m_handle(handle)
{
@@ -80,55 +84,122 @@ void UpdateAxisActionJob::run()
void UpdateAxisActionJob::updateAction(LogicalDevice *device)
{
- Q_FOREACH (const Qt3DCore::QNodeId actionId, device->actions()) {
+ const auto actionIds = device->actions();
+ for (const Qt3DCore::QNodeId actionId : actionIds) {
bool actionTriggered = false;
Action *action = m_handler->actionManager()->lookupResource(actionId);
- Q_FOREACH (const Qt3DCore::QNodeId actionInputId, action->inputs()) {
- ActionInput *actionInput = m_handler->actionInputManager()->lookupResource(actionInputId);
- QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend = Q_NULLPTR;
+ const auto actionInputIds = action->inputs();
+ for (const Qt3DCore::QNodeId actionInputId : actionInputIds)
+ actionTriggered |= processActionInput(actionInputId);
- Q_FOREACH (QInputDeviceIntegration *integration, m_handler->inputDeviceIntegrations()) {
- if ((physicalDeviceBackend = integration->physicalDevice(actionInput->sourceDevice())) != Q_NULLPTR)
- break;
- }
+ action->setActionTriggered(actionTriggered);
+ }
+}
+
+bool UpdateAxisActionJob::processActionInput(const Qt3DCore::QNodeId actionInputId)
+{
+
+ if (m_handler->actionInputManager()->lookupResource(actionInputId)) {
+ ActionInput *actionInput = m_handler->actionInputManager()->lookupResource(actionInputId);
+ QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend = nullptr;
- if (physicalDeviceBackend != Q_NULLPTR) {
- // Update the value
- actionTriggered |= anyOfRequiredKeysPressed(actionInput->keys(), physicalDeviceBackend);
+ const auto integrations = m_handler->inputDeviceIntegrations();
+ for (QInputDeviceIntegration *integration : integrations) {
+ if ((physicalDeviceBackend = integration->physicalDevice(actionInput->sourceDevice())) != nullptr)
+ break;
+ }
+
+ if (physicalDeviceBackend != nullptr) {
+ // Update the value
+ return anyOfRequiredButtonsPressed(actionInput->buttons(), physicalDeviceBackend);
+ }
+ } else if (m_handler->inputSequenceManager()->lookupResource(actionInputId)) {
+ InputSequence *inputSequence = m_handler->inputSequenceManager()->lookupResource(actionInputId);
+ const qint64 startTime = inputSequence->startTime();
+ if (startTime != 0) {
+ // Check if we are still inside the time limit for the chord
+ if ((m_currentTime - startTime) > inputSequence->timeout()) {
+ inputSequence->reset();
+ return false;
}
}
- action->setActionTriggered(actionTriggered);
+ bool actionTriggered = false;
+ const auto actionInputIds = inputSequence->sequences();
+ for (const Qt3DCore::QNodeId actionInputId : actionInputIds) {
+ if (processActionInput(actionInputId)){
+ actionTriggered |= inputSequence->actionTriggered(actionInputId, m_currentTime);
+ // Set the start time if it wasn't set before
+ if (startTime == 0)
+ inputSequence->setStartTime(m_currentTime);
+ }
+ }
+ return actionTriggered;
+ } else if (m_handler->inputChordManager()->lookupResource(actionInputId)) {
+ InputChord *inputChord = m_handler->inputChordManager()->lookupResource(actionInputId);
+ const qint64 startTime = inputChord->startTime();
+ if (startTime != 0) {
+ // Check if we are still inside the time limit for the chord
+ if ((m_currentTime - startTime) > inputChord->timeout()) {
+ inputChord->reset();
+ return false;
+ }
+ }
+ bool actionTriggered = false;
+ const auto actionInputIds = inputChord->chords();
+ for (const Qt3DCore::QNodeId actionInputId : actionInputIds) {
+ if (processActionInput(actionInputId)){
+ actionTriggered |= inputChord->actionTriggered(actionInputId);
+ if (startTime == 0)
+ inputChord->setStartTime(m_currentTime);
+ }
+ }
+ return actionTriggered;
}
+ //Should Never reach this point
+ return false;
}
void UpdateAxisActionJob::updateAxis(LogicalDevice *device)
{
- Q_FOREACH (const Qt3DCore::QNodeId axisId, device->axes()) {
+ const auto axisIds = device->axes();
+ for (const Qt3DCore::QNodeId axisId : axisIds) {
Axis *axis = m_handler->axisManager()->lookupResource(axisId);
float axisValue = 0.0f;
- Q_FOREACH (const Qt3DCore::QNodeId axisInputId, axis->inputs()) {
- AxisInput *axisInput = m_handler->axisInputManager()->lookupResource(axisInputId);
- QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend = Q_NULLPTR;
-
- Q_FOREACH (QInputDeviceIntegration *integration, m_handler->inputDeviceIntegrations()) {
- if ((physicalDeviceBackend = integration->physicalDevice(axisInput->sourceDevice())) != Q_NULLPTR)
- break;
+ const auto axisInputIds = axis->inputs();
+ for (const Qt3DCore::QNodeId axisInputId : axisInputIds) {
+ AnalogAxisInput *analogInput = m_handler->analogAxisInputManager()->lookupResource(axisInputId);
+ if (analogInput) {
+ QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend = findAxisInputPhysicalDevice(analogInput);
+ if (physicalDeviceBackend && analogInput->axis() != -1) {
+ // Update the value
+ axisValue += physicalDeviceBackend->processedAxisValue(analogInput->axis());
+ }
+ continue;
}
- if (physicalDeviceBackend != Q_NULLPTR) {
- // Update the value
- const QVector<int> keys = axisInput->keys();
- // Axis was specified -> we take this as the base value
- if (axisInput->axis() != -1)
- axisValue += physicalDeviceBackend->processedAxisValue(axisInput->axis());
- else if (!keys.isEmpty()) {
- // TO DO: Linear Curver for the progression of the scale value
- if (anyOfRequiredKeysPressed(keys, physicalDeviceBackend))
- axisValue += axisInput->scale();
+ ButtonAxisInput *buttonInput = m_handler->buttonAxisInputManager()->lookupResource(axisInputId);
+ if (buttonInput) {
+ QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend = findAxisInputPhysicalDevice(buttonInput);
+ if (physicalDeviceBackend != nullptr) {
+ // Update the value
+ const QVector<int> buttons = buttonInput ? buttonInput->buttons() : QVector<int>();
+ if (!buttons.isEmpty()) {
+ // TO DO: Linear Curver for the progression of the scale value
+ if (anyOfRequiredButtonsPressed(buttons, physicalDeviceBackend))
+ buttonInput->updateSpeedRatio(m_currentTime, ButtonAxisInput::Accelerate);
+ else if (buttonInput->speedRatio() != 0.0f)
+ buttonInput->updateSpeedRatio(m_currentTime, ButtonAxisInput::Decelerate);
+
+ axisValue += buttonInput->speedRatio() * buttonInput->scale();
+ }
}
+
+ continue;
}
+
+ Q_UNREACHABLE();
}
// Clamp the axisValue -1/1
@@ -137,6 +208,18 @@ void UpdateAxisActionJob::updateAxis(LogicalDevice *device)
}
}
+QAbstractPhysicalDeviceBackendNode *UpdateAxisActionJob::findAxisInputPhysicalDevice(AbstractAxisInput *axisInput)
+{
+ const auto integrations = m_handler->inputDeviceIntegrations();
+ for (QInputDeviceIntegration *integration : integrations) {
+ QAbstractPhysicalDeviceBackendNode *physicalDeviceBackend = integration->physicalDevice(axisInput->sourceDevice());
+ if (physicalDeviceBackend)
+ return physicalDeviceBackend;
+ }
+
+ return nullptr;
+}
+
} // Input
} // Qt3DInput
diff --git a/src/input/backend/updateaxisactionjob_p.h b/src/input/backend/updateaxisactionjob_p.h
index 7d2aa5ec6..3b71e7a88 100644
--- a/src/input/backend/updateaxisactionjob_p.h
+++ b/src/input/backend/updateaxisactionjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,26 +52,34 @@
//
#include <Qt3DCore/qaspectjob.h>
+#include <Qt3DCore/qnodeid.h>
#include <Qt3DInput/private/handle_types_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
+class QAbstractPhysicalDeviceBackendNode;
+
namespace Input {
+class AbstractAxisInput;
+class ButtonAxisInput;
class InputHandler;
class UpdateAxisActionJob : public Qt3DCore::QAspectJob
{
public:
- explicit UpdateAxisActionJob(InputHandler *handler, HLogicalDevice handle);
+ explicit UpdateAxisActionJob(qint64 currentTime, InputHandler *handler, HLogicalDevice handle);
void run() Q_DECL_FINAL;
private:
void updateAction(LogicalDevice *device);
+ bool processActionInput(const Qt3DCore::QNodeId actionInputId);
void updateAxis(LogicalDevice *device);
+ QAbstractPhysicalDeviceBackendNode *findAxisInputPhysicalDevice(AbstractAxisInput *axisInput);
+ const qint64 m_currentTime;
InputHandler *m_handler;
HLogicalDevice m_handle;
};
diff --git a/src/input/backend/updatehandlerjob.cpp b/src/input/backend/updatehandlerjob.cpp
deleted file mode 100644
index 08b2633cb..000000000
--- a/src/input/backend/updatehandlerjob.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "updatehandlerjob_p.h"
-#include <Qt3DInput/private/inputhandler_p.h>
-#include <Qt3DInput/private/inputmanagers_p.h>
-#include <Qt3DInput/private/axisactionpayload_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput
-{
-
-namespace Input
-{
-
-namespace {
-
-int containsAxis(const Qt3DCore::QNodeId axisId, const AxisPayload &payload)
-{
- for (int i = 0, m = payload.axes.size(); i < m; ++i)
- if (payload.axes.at(i).id == axisId)
- return i;
- return -1;
-}
-
-int containsAction(const Qt3DCore::QNodeId actionId, const ActionPayload &payload)
-{
- for (int i = 0, m = payload.actions.size(); i < m; ++i)
- if (payload.actions.at(i).id == actionId)
- return i;
- return -1;
-}
-
-} // anonymous
-
-UpdateHandlerJob::UpdateHandlerJob(AxisActionHandler *axisActionHandler, HLogicalDevice logicalDeviceHandler, InputHandler *handler)
- : m_axisActionHandler(axisActionHandler)
- , m_logicalDeviceHandle(logicalDeviceHandler)
- , m_handler(handler)
-{
-}
-
-void UpdateHandlerJob::run()
-{
- // Find the LogicalDevice
- // Find each Axis
- // Check if their values have changed since the last time
- // If so -> add to notification payload
-
- // Find each Action
- // Check if action state has changed since last frame
- // If so -> add to notification payload
-
- LogicalDevice *logicalDevice = m_handler->logicalDeviceManager()->data(m_logicalDeviceHandle);
- updateActions(logicalDevice);
- updateAxes(logicalDevice);
-}
-
-void UpdateHandlerJob::updateAxes(LogicalDevice *device)
-{
- AxisPayload payload = m_axisActionHandler->lastAxisPayload();
-
- Q_FOREACH (const Qt3DCore::QNodeId axisId, device->axes()) {
- const Axis *axis = m_handler->axisManager()->lookupResource(axisId);
- const int axisPositionInPayload = containsAxis(axisId, payload);
-
- if (axisPositionInPayload < 0) {
- // Not contained in the payload
- AxisUpdate axisUpdate;
- axisUpdate.name = axis->name();
- axisUpdate.id = axisId;
- axisUpdate.value = axis->axisValue();
- payload.axes.push_back(axisUpdate);
- } else {
- // The axis has the same value as before -> remove from the payload
- if (payload.axes.at(axisPositionInPayload).value != axis->axisValue())
- payload.axes[axisPositionInPayload].value = axis->axisValue();
- }
- }
-
- m_axisActionHandler->setAndTransmitAxisPayload(payload);
-}
-
-void UpdateHandlerJob::updateActions(LogicalDevice *device)
-{
- ActionStates actionStates;
-
- // Push each action into the payload to build the current action state for the frame
- Q_FOREACH (const Qt3DCore::QNodeId actionId, device->actions()) {
- const Action *action = m_handler->actionManager()->lookupResource(actionId);
- ActionUpdate actionState;
- actionState.id = actionId;
- actionState.name = action->name();
- actionState.triggered = action->actionTriggered();
- actionStates.actions.push_back(actionState);
- }
-
- // Compare the action state against the previous payload state
- ActionStates oldActionStates = m_axisActionHandler->lastActionStates();
- ActionPayload updatePayload;
-
- // Build up a delta payload
- Q_FOREACH (const ActionUpdate &actionUpdate, actionStates.actions) {
- const int posOfActionInOldPayload = containsAction(actionUpdate.id, oldActionStates);
- // If the action is not in the old payload or
- // is in the old payload state but has a different value
- // we add it to the delta payload
- if (posOfActionInOldPayload < 0 ||
- oldActionStates.actions.at(posOfActionInOldPayload).triggered != actionUpdate.triggered)
- updatePayload.actions.push_back(actionUpdate);
- }
-
- m_axisActionHandler->setAndTransmitActionPayload(actionStates, updatePayload);
-}
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
diff --git a/src/input/backend/updatehandlerjob_p.h b/src/input/backend/updatehandlerjob_p.h
deleted file mode 100644
index 9d94f44c1..000000000
--- a/src/input/backend/updatehandlerjob_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QINPUTASPECT_INPUT_UPDATEHANDLERSJOBS_H
-#define QINPUTASPECT_INPUT_UPDATEHANDLERSJOBS_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qaspectjob.h>
-#include <Qt3DInput/private/handle_types_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-namespace Input {
-
-class InputHandler;
-
-class UpdateHandlerJob : public Qt3DCore::QAspectJob
-{
-public:
- explicit UpdateHandlerJob(AxisActionHandler *axisActionHandler,
- HLogicalDevice logicalDeviceHandler,
- InputHandler *handler);
-
- void run() Q_DECL_FINAL;
-
-private:
- AxisActionHandler *m_axisActionHandler;
- HLogicalDevice m_logicalDeviceHandle;
- InputHandler *m_handler;
-
- void updateAxes(LogicalDevice *device);
- void updateActions(LogicalDevice *device);
-};
-
-typedef QScopedPointer<UpdateHandlerJob> UpdateHandlerJobPtr;
-
-} // Input
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QINPUTASPECT_INPUT_UPDATEHANDLERSJOBS_H
diff --git a/src/input/frontend/frontend.pri b/src/input/frontend/frontend.pri
index 9d90c567f..93b3e0839 100644
--- a/src/input/frontend/frontend.pri
+++ b/src/input/frontend/frontend.pri
@@ -1,49 +1,84 @@
HEADERS += \
$$PWD/qinputaspect.h \
- $$PWD/qkeyboardcontroller.h \
- $$PWD/qkeyboardcontroller_p.h \
- $$PWD/qkeyboardinput.h \
- $$PWD/qkeyboardinput_p.h \
+ $$PWD/qkeyboarddevice.h \
+ $$PWD/qkeyboarddevice_p.h \
+ $$PWD/qkeyboardhandler.h \
+ $$PWD/qkeyboardhandler_p.h \
$$PWD/qinputaspect_p.h \
$$PWD/qkeyevent.h \
- $$PWD/qmousecontroller.h \
- $$PWD/qmouseinput.h \
- $$PWD/qmouseinput_p.h \
- $$PWD/qmousecontroller_p.h \
+ $$PWD/qmousedevice.h \
+ $$PWD/qmousedevice_p.h \
+ $$PWD/qmousehandler.h \
+ $$PWD/qmousehandler_p.h \
$$PWD/qmouseevent.h \
- $$PWD/qinputdeviceplugin.h \
+ $$PWD/qinputdeviceplugin_p.h \
$$PWD/qactioninput.h \
$$PWD/qaction.h \
- $$PWD/qaxisinput.h \
+ $$PWD/qabstractaxisinput.h \
$$PWD/qaxis.h \
+ $$PWD/qanalogaxisinput.h \
+ $$PWD/qbuttonaxisinput.h \
$$PWD/qlogicaldevice.h \
- $$PWD/qinputdeviceintegration.h \
$$PWD/qinputdeviceintegration_p.h \
+ $$PWD/qinputdeviceintegration_p_p.h \
$$PWD/qabstractphysicaldevice.h \
$$PWD/qinputdeviceintegrationfactory_p.h \
$$PWD/qaxissetting.h \
$$PWD/qabstractphysicaldevice_p.h \
- $$PWD/qaxisactionhandler_p.h \
- $$PWD/qaxisactionhandler.h
+ $$PWD/qgenericinputdevice_p.h \
+ $$PWD/qabstractactioninput.h \
+ $$PWD/qabstractactioninput_p.h \
+ $$PWD/qinputchord.h \
+ $$PWD/qinputsequence.h \
+ $$PWD/qinputsettings.h \
+ $$PWD/qinputsettings_p.h \
+ $$PWD/qaction_p.h \
+ $$PWD/qactioninput_p.h \
+ $$PWD/qaxis_p.h \
+ $$PWD/qabstractaxisinput_p.h \
+ $$PWD/qanalogaxisinput_p.h \
+ $$PWD/qbuttonaxisinput_p.h \
+ $$PWD/qlogicaldevice_p.h \
+ $$PWD/qaxissetting_p.h \
+ $$PWD/qinputsequence_p.h \
+ $$PWD/qinputchord_p.h \
+ $$PWD/qphysicaldevicecreatedchange.h \
+ $$PWD/qphysicaldevicecreatedchange_p.h
+
SOURCES += \
$$PWD/qinputaspect.cpp \
- $$PWD/qkeyboardcontroller.cpp \
- $$PWD/qkeyboardinput.cpp \
+ $$PWD/qkeyboarddevice.cpp \
+ $$PWD/qkeyboardhandler.cpp \
$$PWD/qkeyevent.cpp \
- $$PWD/qmouseinput.cpp \
- $$PWD/qmousecontroller.cpp \
+ $$PWD/qmousehandler.cpp \
+ $$PWD/qmousedevice.cpp \
$$PWD/qmouseevent.cpp \
$$PWD/qinputdeviceplugin.cpp \
$$PWD/qactioninput.cpp \
$$PWD/qaction.cpp \
- $$PWD/qaxisinput.cpp \
+ $$PWD/qabstractaxisinput.cpp \
$$PWD/qaxis.cpp \
+ $$PWD/qanalogaxisinput.cpp \
+ $$PWD/qbuttonaxisinput.cpp \
$$PWD/qlogicaldevice.cpp \
$$PWD/qinputdeviceintegration.cpp \
$$PWD/qabstractphysicaldevice.cpp \
$$PWD/qinputdeviceintegrationfactory.cpp \
$$PWD/qaxissetting.cpp \
- $$PWD/qaxisactionhandler.cpp
+ $$PWD/qgenericinputdevice.cpp \
+ $$PWD/qabstractactioninput.cpp \
+ $$PWD/qinputchord.cpp \
+ $$PWD/qinputsequence.cpp \
+ $$PWD/qinputsettings.cpp \
+ $$PWD/qphysicaldevicecreatedchange.cpp
+
+qtHaveModule(gamepad) {
+ QT += gamepad
+ DEFINES += HAVE_QGAMEPAD
+ HEADERS += $$PWD/qgamepadinput_p.h
+ SOURCES += $$PWD/qgamepadinput.cpp
+}
INCLUDEPATH += $$PWD
+
diff --git a/src/input/frontend/qabstractactioninput.cpp b/src/input/frontend/qabstractactioninput.cpp
new file mode 100644
index 000000000..5d8f76fab
--- /dev/null
+++ b/src/input/frontend/qabstractactioninput.cpp
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+****************************************************************************/
+
+#include "qabstractactioninput_p.h"
+#include <Qt3DCore/private/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+/*!
+ \class Qt3DInput::QAbstractActionInput
+ \inherits QNode
+
+ \inmodule Qt3DInput
+ \since 5.7
+
+ \brief QAbstractActionInput is the base class for the Action Input and all Aggregate Action Inputs.
+*/
+
+/*!
+ \qmltype QAbstractActionInput
+ \inqmlmodule Qt3D.Input
+ \instantiates Qt3DInput::QAbstractActionInput
+ \brief QML frontend for the abstract Qt3DInput::QAbstractActionInput C++ class.
+
+ The base class for the Action Input and all Aggregate Action Inputs.
+ \since 5.7
+*/
+
+/*!
+ \internal
+*/
+QAbstractActionInput::QAbstractActionInput(QAbstractActionInputPrivate &dd, Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(dd, parent)
+{
+}
+
+/*!
+ \internal
+*/
+QAbstractActionInput::~QAbstractActionInput()
+{
+}
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qabstractactioninput.h b/src/input/frontend/qabstractactioninput.h
new file mode 100644
index 000000000..a0c18cb54
--- /dev/null
+++ b/src/input/frontend/qabstractactioninput.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+****************************************************************************/
+
+#ifndef QT3DINPUT_QABSTRACTACTIONINPUT_H
+#define QT3DINPUT_QABSTRACTACTIONINPUT_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractActionInputPrivate;
+
+class QT3DINPUTSHARED_EXPORT QAbstractActionInput : public Qt3DCore::QNode
+{
+ Q_OBJECT
+public:
+ ~QAbstractActionInput();
+
+protected:
+ explicit QAbstractActionInput(QAbstractActionInputPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QABSTRACTACTIONINPUT_H
diff --git a/src/input/frontend/qabstractactioninput_p.h b/src/input/frontend/qabstractactioninput_p.h
new file mode 100644
index 000000000..6741bc4dc
--- /dev/null
+++ b/src/input/frontend/qabstractactioninput_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+****************************************************************************/
+
+#ifndef QT3DINPUT_QABSTRACTACTIONINPUT_P_H
+#define QT3DINPUT_QABSTRACTACTIONINPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/qabstractactioninput.h>
+#include <Qt3DCore/private/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractActionInputPrivate : public Qt3DCore::QNodePrivate
+{
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QABSTRACTACTIONINPUT_H
diff --git a/src/input/frontend/qabstractaxisinput.cpp b/src/input/frontend/qabstractaxisinput.cpp
new file mode 100644
index 000000000..77966eb1d
--- /dev/null
+++ b/src/input/frontend/qabstractaxisinput.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractaxisinput.h"
+#include "qabstractaxisinput_p.h"
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+/*!
+ * \qmltype AxisInput
+ * \instantiates Qt3DInput::QAxisInput
+ * \inqmlmodule Qt3D.Input
+ * \since 5.5
+ * \TODO
+ *
+ */
+
+/*!
+ * \class Qt3DInput::QAxisInput
+ * \inmodule Qt3DInput
+ * \since 5.5
+ * \TODO
+ *
+ */
+
+QAbstractAxisInput::QAbstractAxisInput(QAbstractAxisInputPrivate &dd, Qt3DCore::QNode *parent)
+ : QNode(dd, parent)
+{
+}
+
+void QAbstractAxisInput::setSourceDevice(QAbstractPhysicalDevice *sourceDevice)
+{
+ Q_D(QAbstractAxisInput);
+ if (d->m_sourceDevice != sourceDevice) {
+
+ if (sourceDevice && !sourceDevice->parent())
+ sourceDevice->setParent(this);
+
+ d->m_sourceDevice = sourceDevice;
+ emit sourceDeviceChanged(sourceDevice);
+ }
+}
+
+QAbstractAxisInput::~QAbstractAxisInput()
+{
+}
+
+QAbstractPhysicalDevice *QAbstractAxisInput::sourceDevice() const
+{
+ Q_D(const QAbstractAxisInput);
+ return d->m_sourceDevice;
+}
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qabstractaxisinput.h b/src/input/frontend/qabstractaxisinput.h
new file mode 100644
index 000000000..d78722474
--- /dev/null
+++ b/src/input/frontend/qabstractaxisinput.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QABSTRACTAXISINPUT_H
+#define QT3DINPUT_QABSTRACTAXISINPUT_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractPhysicalDevice;
+class QAbstractAxisInputPrivate;
+
+class QT3DINPUTSHARED_EXPORT QAbstractAxisInput : public Qt3DCore::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DInput::QAbstractPhysicalDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
+
+public:
+ ~QAbstractAxisInput();
+
+ QAbstractPhysicalDevice *sourceDevice() const;
+
+public Q_SLOTS:
+ void setSourceDevice(QAbstractPhysicalDevice *sourceDevice);
+
+Q_SIGNALS:
+ void sourceDeviceChanged(QAbstractPhysicalDevice *sourceDevice);
+
+protected:
+ QAbstractAxisInput(QAbstractAxisInputPrivate &dd, QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QAbstractAxisInput)
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QQT3DINPUT_ABSTRACTAXISINPUT_H
diff --git a/src/input/frontend/qabstractaxisinput_p.h b/src/input/frontend/qabstractaxisinput_p.h
new file mode 100644
index 000000000..f64a140f4
--- /dev/null
+++ b/src/input/frontend/qabstractaxisinput_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QABSTRACTAXISINPUT_P_H
+#define QT3DINPUT_QABSTRACTAXISINPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/qnodeid.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractPhysicalDevice;
+
+class QAbstractAxisInputPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QAbstractAxisInputPrivate()
+ : Qt3DCore::QNodePrivate()
+ , m_sourceDevice(nullptr)
+ {}
+
+ QAbstractPhysicalDevice *m_sourceDevice;
+};
+
+struct QAbstractAxisInputData
+{
+ Qt3DCore::QNodeId sourceDeviceId;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QABSTRACTAXISINPUT_P_H
+
diff --git a/src/input/frontend/qabstractphysicaldevice.cpp b/src/input/frontend/qabstractphysicaldevice.cpp
index 4dab89bdf..98313773e 100644
--- a/src/input/frontend/qabstractphysicaldevice.cpp
+++ b/src/input/frontend/qabstractphysicaldevice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,6 +39,11 @@
#include "qabstractphysicaldevice.h"
#include "qabstractphysicaldevice_p.h"
+#include <Qt3DInput/qphysicaldevicecreatedchange.h>
+#include <Qt3DInput/qaxissetting.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <Qt3DCore/private/qnode_p.h>
QT_BEGIN_NAMESPACE
@@ -48,62 +56,180 @@ QAbstractPhysicalDevicePrivate::QAbstractPhysicalDevicePrivate()
{
}
+/*! \internal */
+QAbstractPhysicalDevicePrivate::~QAbstractPhysicalDevicePrivate()
+{
+}
+
/*!
- * \qmltype AbstractPhysicalDevice
- * \instantiates Qt3DInput::QAbstractPhysicalDevice
- * \inqmlmodule Qt3D.Input
- * \since 5.6
- * \TODO
- *
- */
+ \class Qt3DInput::QAbstractPhysicalDevice
+ \inmodule Qt3DInput
+ \inherits Qt3DCore::QNode
+ \brief QAbstractPhysicalDevice is the base class used by Qt3d to interact with arbitrary input devices.
+
+ \since 5.6
+*/
/*!
- * \class Qt3DInput::QAbstractPhysicalDevice
- * \inmodule Qt3DInput
- * \since 5.6
- * \TODO
- *
+ \qmltype AbstractPhysicalDevice
+ \inqmlmodule Qt3D.Input
+ \instantiates Qt3DInput::QAbstractPhysicalDevice
+ \brief QML frontend for the abstract Qt3DInput::QAbstractPhysicalDevice C++ class.
+
+ The base class used by Qt3d to interact with arbitrary input devices.
+
+ \since 5.6
+*/
+
+/*!
+ Constructs a new QAbstractPhysicalDevice instance with parent \a parent.
*/
QAbstractPhysicalDevice::QAbstractPhysicalDevice(Qt3DCore::QNode *parent)
: Qt3DCore::QNode(*new QAbstractPhysicalDevicePrivate, parent)
{
}
+/*! \internal */
+QAbstractPhysicalDevice::~QAbstractPhysicalDevice()
+{
+}
+
QAbstractPhysicalDevice::QAbstractPhysicalDevice(QAbstractPhysicalDevicePrivate &dd, Qt3DCore::QNode *parent)
: Qt3DCore::QNode(dd, parent)
{
}
-QAbstractPhysicalDevice::~QAbstractPhysicalDevice()
+/*!
+ Return the number of axis this device has.
+ */
+int QAbstractPhysicalDevice::axisCount() const
{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DInput::QAbstractPhysicalDevice subclass didn't call QNode::cleanup in its destructor");
+ Q_D(const QAbstractPhysicalDevice);
+ return d->m_axesHash.size();
}
+/*!
+ Return the number of buttons this device has.
+ */
+int QAbstractPhysicalDevice::buttonCount() const
+{
+ Q_D(const QAbstractPhysicalDevice);
+ return d->m_buttonsHash.size();
+}
+
+/*!
+ Return a list of the names of device's axis.
+ */
+QStringList QAbstractPhysicalDevice::axisNames() const
+{
+ Q_D(const QAbstractPhysicalDevice);
+ return d->m_axesHash.keys();
+}
+
+/*!
+ Return a list of the names of device's buttons.
+ */
+QStringList QAbstractPhysicalDevice::buttonNames() const
+{
+ Q_D(const QAbstractPhysicalDevice);
+ return d->m_buttonsHash.keys();
+}
+
+/*!
+ Return the integer identifer of the axis /a name or -1 if it does not exist on this device.
+ */
+int QAbstractPhysicalDevice::axisIdentifier(const QString &name) const
+{
+ Q_D(const QAbstractPhysicalDevice);
+ auto it = d->m_axesHash.find(name);
+ if (it != d->m_axesHash.end())
+ return *it;
+ return -1;
+}
+
+/*!
+ Return the integer identifer of the button /a name or -1 if it does not exist on this device.
+ */
+int QAbstractPhysicalDevice::buttonIdentifier(const QString &name) const
+{
+ Q_D(const QAbstractPhysicalDevice);
+ auto it = d->m_buttonsHash.find(name);
+ if (it != d->m_buttonsHash.end())
+ return *it;
+ return -1;
+}
+
+/*!
+ Add the axisSetting /a axisSetting to this device.
+ */
void QAbstractPhysicalDevice::addAxisSetting(QAxisSetting *axisSetting)
{
Q_D(QAbstractPhysicalDevice);
- if (!d->m_axisSettings.contains(axisSetting))
+ if (axisSetting && !d->m_axisSettings.contains(axisSetting)) {
+ if (d->m_changeArbiter) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), axisSetting);
+ change->setPropertyName("axisSettings");
+ d->notifyObservers(change);
+ }
+
d->m_axisSettings.push_back(axisSetting);
+ }
}
+/*!
+ Remove the axisSetting /a axisSetting to this device.
+ */
void QAbstractPhysicalDevice::removeAxisSetting(QAxisSetting *axisSetting)
{
Q_D(QAbstractPhysicalDevice);
- if (d->m_axisSettings.contains(axisSetting))
+ if (axisSetting && d->m_axisSettings.contains(axisSetting)) {
+ if (d->m_changeArbiter) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), axisSetting);
+ change->setPropertyName("axisSettings");
+ d->notifyObservers(change);
+ }
+
d->m_axisSettings.removeOne(axisSetting);
+ }
}
+/*!
+ Return the axisSettings /ascociated with this device.
+ */
QVector<QAxisSetting *> QAbstractPhysicalDevice::axisSettings() const
{
Q_D(const QAbstractPhysicalDevice);
return d->m_axisSettings;
}
-void QAbstractPhysicalDevice::copy(const QNode *ref)
+/*!
+ Used to notify observers that an axis value has been changed.
+ */
+void QAbstractPhysicalDevicePrivate::postAxisEvent(int axis, qreal value)
+{
+ Q_Q(QAbstractPhysicalDevice);
+ Qt3DCore::QPropertyUpdatedChangePtr change(new Qt3DCore::QPropertyUpdatedChange(q->id()));
+ change->setPropertyName("axisEvent");
+ change->setValue(QVariant::fromValue(QPair<int, qreal>(axis, value)));
+ notifyObservers(change);
+}
+
+/*!
+ Used to notify observers that an button value has been changed.
+ */
+void QAbstractPhysicalDevicePrivate::postButtonEvent(int button, qreal value)
+{
+ Q_Q(QAbstractPhysicalDevice);
+ Qt3DCore::QPropertyUpdatedChangePtr change(new Qt3DCore::QPropertyUpdatedChange(q->id()));
+ change->setPropertyName("buttonEvent");
+ change->setValue(QVariant::fromValue(QPair<int, qreal>(button, value)));
+ notifyObservers(change);
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QAbstractPhysicalDevice::createNodeCreationChange() const
{
- QNode::copy(ref);
- const QAbstractPhysicalDevice *physicalDevice = static_cast<const QAbstractPhysicalDevice *>(ref);
- d_func()->m_axisSettings = physicalDevice->axisSettings();
+ auto creationChange = QPhysicalDeviceCreatedChangeBasePtr::create(this);
+ return creationChange;
}
}
diff --git a/src/input/frontend/qabstractphysicaldevice.h b/src/input/frontend/qabstractphysicaldevice.h
index 5565bbaeb..8c0abae4e 100644
--- a/src/input/frontend/qabstractphysicaldevice.h
+++ b/src/input/frontend/qabstractphysicaldevice.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,25 +57,25 @@ class QT3DINPUTSHARED_EXPORT QAbstractPhysicalDevice : public Qt3DCore::QNode
{
Q_OBJECT
public:
- explicit QAbstractPhysicalDevice(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QAbstractPhysicalDevice(Qt3DCore::QNode *parent = nullptr);
~QAbstractPhysicalDevice();
- virtual int axisCount() const = 0;
- virtual int buttonCount() const = 0;
- virtual QStringList axisNames() const = 0;
- virtual QStringList buttonNames() const = 0;
+ virtual int axisCount() const;
+ virtual int buttonCount() const;
+ virtual QStringList axisNames() const;
+ virtual QStringList buttonNames() const;
- virtual int axisIdentifier(const QString &name) const = 0;
- virtual int buttonIdentifier(const QString &name) const = 0;
+ virtual int axisIdentifier(const QString &name) const;
+ virtual int buttonIdentifier(const QString &name) const;
void addAxisSetting(QAxisSetting *axisSetting);
void removeAxisSetting(QAxisSetting *axisSetting);
QVector<QAxisSetting *> axisSettings() const;
protected:
- QAbstractPhysicalDevice(QAbstractPhysicalDevicePrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
+ QAbstractPhysicalDevice(QAbstractPhysicalDevicePrivate &dd, Qt3DCore::QNode *parent = nullptr);
Q_DECLARE_PRIVATE(QAbstractPhysicalDevice)
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // Qt3DInput
diff --git a/src/input/frontend/qabstractphysicaldevice_p.h b/src/input/frontend/qabstractphysicaldevice_p.h
index 6900fc54a..55e98723c 100644
--- a/src/input/frontend/qabstractphysicaldevice_p.h
+++ b/src/input/frontend/qabstractphysicaldevice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,6 +53,8 @@
#include <Qt3DInput/qt3dinput_global.h>
#include <Qt3DCore/private/qnode_p.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qmutex.h>
#include <QtCore/qvector.h>
#include <Qt3DInput/private/qt3dinput_global_p.h>
@@ -63,9 +68,15 @@ class QT3DINPUTSHARED_PRIVATE_EXPORT QAbstractPhysicalDevicePrivate : public Qt3
{
public:
QAbstractPhysicalDevicePrivate();
+ ~QAbstractPhysicalDevicePrivate();
Q_DECLARE_PUBLIC(QAbstractPhysicalDevice)
QVector<QAxisSetting *> m_axisSettings;
+ QHash<QString, int> m_axesHash;
+ QHash<QString, int> m_buttonsHash;
+
+ void postAxisEvent(int axis, qreal value);
+ void postButtonEvent(int button, qreal value);
};
}
diff --git a/src/input/frontend/qaction.cpp b/src/input/frontend/qaction.cpp
index 6c46e9c62..11a8d3ab6 100644
--- a/src/input/frontend/qaction.cpp
+++ b/src/input/frontend/qaction.cpp
@@ -1,101 +1,122 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qaction.h"
+#include "qaction_p.h"
#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DInput/qactioninput.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DInput/qabstractactioninput.h>
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
-class QActionPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QActionPrivate()
- : Qt3DCore::QNodePrivate()
- {}
-
- QString m_name;
- QVector<QActionInput *> m_inputs;
-};
+/*!
+ \class Qt3DInput::QActionInput
+ \inmodule Qt3DInput
+ \inherits QAbstractActionInput
+ \brief QActionInput stores Device and Keys used to trigger an input event.
+ \since 5.7
+*/
/*!
- * \qmltype Action
- * \inqmlmodule Qt3D.Input
- * \since 5.6
- * \TODO
- *
- */
+ \qmltype Action
+ \inqmlmodule Qt3D.Input
+ \instantiates Qt3DInput::QAction
+ \brief QML frontend for the Qt3DInput::QAction C++ class.
+
+ Links a set of QAbstractActionInputs that trigger the same event.
+ \since 5.7
+*/
/*!
- * \class Qt3DInput::QAction
- * \inmodule Qt3DInput
- * \since 5.6
- * \TODO
- *
+ Constructs a new QAction instance with parent \a parent.
*/
-
QAction::QAction(Qt3DCore::QNode *parent)
: Qt3DCore::QNode(*new QActionPrivate(), parent)
{
}
+/*! \internal */
QAction::~QAction()
{
- QNode::cleanup();
}
-void QAction::setName(const QString &name)
-{
- Q_D(QAction);
- if (d->m_name != name) {
- d->m_name = name;
- emit nameChanged(name);
- }
-}
+/*!
+ \fn QAction::nameChanged()
+
+ This signal is emitted when the name of the Action is changed.
+*/
+
+/*!
+ \qmlproperty QString Qt3D.Input::Action::name
+
+ the name used to identify this action
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::Action::nameChanged()
-QString QAction::name() const
+ This signal is emitted when the name of the Action is changed.
+
+ The corresponding handeler is \c onNameChanged
+*/
+
+bool QAction::isActive() const
{
Q_D(const QAction);
- return d->m_name;
+ return d->m_active;
}
-void QAction::addInput(QActionInput *input)
+/*!
+ \qmlproperty QQmlListProperty<Qt3DInput::QAbstractActionInput> Qt3D.Input::Action::inputs
+
+ the list of QAbstractActionInput that must be triggered to trigger this Action.
+*/
+
+/*!
+ Append QAbstractActionInput \a input to the list of inputs that can trigger this action.
+ */
+void QAction::addInput(QAbstractActionInput *input)
{
Q_D(QAction);
if (!d->m_inputs.contains(input)) {
@@ -104,24 +125,25 @@ void QAction::addInput(QActionInput *input)
if (!input->parent())
input->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- Qt3DCore::QScenePropertyChangePtr change(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), input);
change->setPropertyName("input");
- change->setValue(QVariant::fromValue(input->id()));
d->notifyObservers(change);
}
}
}
-void QAction::removeInput(QActionInput *input)
+/*!
+ Remove QAbstractActionInput \a input to the list of inputs that can trigger this action.
+ */
+void QAction::removeInput(QAbstractActionInput *input)
{
Q_D(QAction);
if (d->m_inputs.contains(input)) {
- if (d->m_changeArbiter != Q_NULLPTR) {
- Qt3DCore::QScenePropertyChangePtr change(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), input);
change->setPropertyName("input");
- change->setValue(QVariant::fromValue(input->id()));
d->notifyObservers(change);
}
@@ -129,19 +151,30 @@ void QAction::removeInput(QActionInput *input)
}
}
-QVector<QActionInput *> QAction::inputs() const
+/*!
+ Returns the list of inputs that can trigger this action.
+ */
+QVector<QAbstractActionInput *> QAction::inputs() const
{
Q_D(const QAction);
return d->m_inputs;
}
-void QAction::copy(const Qt3DCore::QNode *ref)
+void QAction::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
+{
+ Q_D(QAction);
+ Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
+ if (e->type() == Qt3DCore::PropertyUpdated && e->propertyName() == QByteArrayLiteral("active")) {
+ d->setActive(e->value().toBool());
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QAction::createNodeCreationChange() const
{
- QNode::copy(ref);
- const QAction *action = static_cast<const QAction *>(ref);
- d_func()->m_name = action->d_func()->m_name;
- Q_FOREACH (QActionInput *input, action->inputs())
- d_func()->m_inputs.append(qobject_cast<QActionInput *>(QNode::clone(input)));
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QActionData>::create(this);
+ auto &data = creationChange->data;
+ data.inputIds = qIdsForNodes(inputs());
+ return creationChange;
}
} // Qt3DInput
diff --git a/src/input/frontend/qaction.h b/src/input/frontend/qaction.h
index 80c0a264d..937f2ec99 100644
--- a/src/input/frontend/qaction.h
+++ b/src/input/frontend/qaction.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -45,37 +48,31 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
class QActionPrivate;
-class QActionInput;
+class QAbstractActionInput;
class QT3DINPUTSHARED_EXPORT QAction : public Qt3DCore::QNode
{
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
public:
- explicit QAction(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QAction(Qt3DCore::QNode *parent = nullptr);
~QAction();
- QString name() const;
+ bool isActive() const;
- void addInput(QActionInput *input);
- void removeInput(QActionInput *input);
- QVector<QActionInput *> inputs() const;
-
-public Q_SLOTS:
- void setName(const QString &name);
+ void addInput(QAbstractActionInput *input);
+ void removeInput(QAbstractActionInput *input);
+ QVector<QAbstractActionInput *> inputs() const;
Q_SIGNALS:
- void nameChanged(const QString &name);
-
- void started(const QString &name);
- void finished(const QString &name);
+ void activeChanged(bool isActive);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QAction)
- QT3D_CLONEABLE(QAction)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // Qt3DInput
diff --git a/src/input/frontend/qaction_p.h b/src/input/frontend/qaction_p.h
new file mode 100644
index 000000000..99d47f90b
--- /dev/null
+++ b/src/input/frontend/qaction_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QACTION_P_H
+#define QT3DINPUT_QACTION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+/*!
+ \class Qt3DInput::QActionPrivate
+ \internal
+*/
+class QActionPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QActionPrivate()
+ : Qt3DCore::QNodePrivate()
+ , m_active(false)
+ {}
+
+ Q_DECLARE_PUBLIC(QAction)
+
+ QVector<QAbstractActionInput *> m_inputs;
+ bool m_active;
+
+ void setActive(bool active)
+ {
+ if (active != m_active) {
+ m_active = active;
+ q_func()->activeChanged(active);
+ }
+ }
+};
+
+struct QActionData
+{
+ QVector<Qt3DCore::QNodeId> inputIds;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QACTION_P_H
+
diff --git a/src/input/frontend/qactioninput.cpp b/src/input/frontend/qactioninput.cpp
index fddc22680..d3441d284 100644
--- a/src/input/frontend/qactioninput.cpp
+++ b/src/input/frontend/qactioninput.cpp
@@ -1,91 +1,137 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
****************************************************************************/
#include "qactioninput.h"
-#include <Qt3DCore/private/qnode_p.h>
+#include "qactioninput_p.h"
#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/QAbstractActionInput>
+#include <Qt3DCore/qnodecreatedchange.h>
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
-class QActionInputPrivate : public Qt3DCore::QNodePrivate
+QActionInputPrivate::QActionInputPrivate()
+ : QAbstractActionInputPrivate(),
+ m_sourceDevice(nullptr)
{
-public:
- QActionInputPrivate()
- : Qt3DCore::QNodePrivate()
- , m_sourceDevice(Q_NULLPTR)
- {}
+}
+
+/*!
+ \class Qt3DInput::QActionInput
+ \inmodule Qt3DInput
+ \inherits QAbstractActionInput
+ \brief QActionInput stores Device and Buttons used to trigger an input event.
- QVariantList m_keys;
- QAbstractPhysicalDevice *m_sourceDevice;
-};
+ \since 5.7
+*/
/*!
- * \qmltype ActionInput
- * \instantiates Qt3DInput::QActionInput
- * \inqmlmodule Qt3D.Input
- * \since 5.5
- * \TODO
- *
- */
+ \qmltype ActionInput
+ \inqmlmodule Qt3D.Input
+ \inherits QAbstractActionInput
+ \instantiates Qt3DInput::QActionInput
+ \brief QML frontend for the Qt3DInput::QActionInput C++ class.
+
+ Links a physical device and selected buttons on it which can trigger this action.
+
+ Each Action input can be triggered by one or many buttons on a source device
+ \qml
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_A]
+ }
+ \endqml
+ \qml
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_A,Qt.Key_B]
+ }
+ \endqml
+ \since 5.7
+*/
/*!
- * \class Qt3DInput::QActionInput
- * \inmodule Qt3DInput
- * \since 5.5
- * \TODO
- *
+ Constructs a new QActionInput instance with parent \a parent.
*/
-
QActionInput::QActionInput(Qt3DCore::QNode *parent)
- : Qt3DCore::QNode(*new QActionInputPrivate(), parent)
+ : Qt3DInput::QAbstractActionInput(*new QActionInputPrivate(), parent)
{
+
}
+/*! \internal */
QActionInput::~QActionInput()
{
- QNode::cleanup();
}
-QVariantList QActionInput::keys() const
+/*!
+ Return the Buttons to trigger the QActionInput instance.
+ */
+QVector<int> QActionInput::buttons() const
{
Q_D(const QActionInput);
- return d->m_keys;
+ return d->m_buttons;
}
+/*!
+ \fn QAbstractPhysicalDevice::sourceDeviceChanged()
+
+ This signal is emitted when the source device ascociated with the action input is changed.
+*/
+
+/*!
+ \qmlproperty QAbstractPhysicalDevice Qt3D.Input::ActionInput::sourceDevice
+
+ The current source device of the ActionInput
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::ActionInput::sourceDeviceChanged()
+
+ This signal is emitted when the source device ascociated with the action input is changed.
+
+ The corresponding handeler is \c onSourceDeviceChanged
+*/
+
+/*!
+ Set the current source device of the QActionInput instance.
+ */
void QActionInput::setSourceDevice(QAbstractPhysicalDevice *sourceDevice)
{
Q_D(QActionInput);
@@ -101,27 +147,57 @@ void QActionInput::setSourceDevice(QAbstractPhysicalDevice *sourceDevice)
}
}
+/*!
+ Returns the current source device of the QActionInput instance.
+ */
QAbstractPhysicalDevice *QActionInput::sourceDevice() const
{
Q_D(const QActionInput);
return d->m_sourceDevice;
}
-void QActionInput::setKeys(const QVariantList &keys)
+/*!
+ \fn QAbstractPhysicalDevice::buttonsChanged()
+
+ This signal is emitted when the buttons ascociated with the action input is changed.
+*/
+
+/*!
+ \qmlproperty QVariantList Qt3D.Input::ActionInput::buttons
+
+ The Buttons that can trigger this Action
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::ActionInput::buttonsChanged()
+
+ This signal is emitted when the buttons ascociated with the action input is changed.
+
+ The corresponding handeler is \c onbuttonsChanged
+*/
+
+/*!
+ Set the buttons to trigger the QActionInput instance.
+ */
+void QActionInput::setButtons(const QVector<int> &buttons)
{
Q_D(QActionInput);
- if (d->m_keys != keys) {
- d->m_keys = keys;
- emit keysChanged(keys);
+ if (buttons != d->m_buttons) {
+ d->m_buttons = buttons;
+ emit buttonsChanged(buttons);
}
}
-void QActionInput::copy(const Qt3DCore::QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QActionInput::createNodeCreationChange() const
{
- QNode::copy(ref);
- const QActionInput *input = static_cast<const QActionInput *>(ref);
- d_func()->m_sourceDevice = qobject_cast<QAbstractPhysicalDevice *>(QNode::clone(input->d_func()->m_sourceDevice));
- d_func()->m_keys = input->d_func()->m_keys;
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QActionInputData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QActionInput);
+ data.sourceDeviceId = qIdForNode(d->m_sourceDevice);
+ data.buttons = d->m_buttons;
+
+ return creationChange;
}
} // Qt3DInput
diff --git a/src/input/frontend/qactioninput.h b/src/input/frontend/qactioninput.h
index 1b895832d..9b06047b2 100644
--- a/src/input/frontend/qactioninput.h
+++ b/src/input/frontend/qactioninput.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,6 +42,7 @@
#include <Qt3DInput/qt3dinput_global.h>
#include <Qt3DCore/qnode.h>
+#include <Qt3DInput/qabstractactioninput.h>
QT_BEGIN_NAMESPACE
@@ -47,37 +51,34 @@ namespace Qt3DInput {
class QAbstractPhysicalDevice;
class QActionInputPrivate;
-class QT3DINPUTSHARED_EXPORT QActionInput : public Qt3DCore::QNode
+class QT3DINPUTSHARED_EXPORT QActionInput : public Qt3DInput::QAbstractActionInput
{
Q_OBJECT
Q_PROPERTY(Qt3DInput::QAbstractPhysicalDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
- Q_PROPERTY(QVariantList keys READ keys WRITE setKeys NOTIFY keysChanged)
+ Q_PROPERTY(QVector<int> buttons READ buttons WRITE setButtons NOTIFY buttonsChanged)
public:
- explicit QActionInput(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QActionInput(Qt3DCore::QNode *parent = nullptr);
~QActionInput();
QAbstractPhysicalDevice *sourceDevice() const;
- QVariantList keys() const;
+ QVector<int> buttons() const;
public Q_SLOTS:
void setSourceDevice(QAbstractPhysicalDevice *sourceDevice);
- void setKeys(const QVariantList &keys);
+ void setButtons(const QVector<int> &buttons);
Q_SIGNALS:
void sourceDeviceChanged(QAbstractPhysicalDevice *sourceDevice);
- void keysChanged(const QVariantList &keys);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void buttonsChanged(const QVector<int> &buttons);
private:
Q_DECLARE_PRIVATE(QActionInput)
- QT3D_CLONEABLE(QActionInput)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // Qt3DInput
QT_END_NAMESPACE
-#endif // QACTIONINPUT_H
+#endif // QT3DINPUT_QACTIONINPUT_H
diff --git a/src/input/frontend/qactioninput_p.h b/src/input/frontend/qactioninput_p.h
new file mode 100644
index 000000000..d1e9f88dc
--- /dev/null
+++ b/src/input/frontend/qactioninput_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QACTIONINPUT_P_H
+#define QT3DINPUT_QACTIONINPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qabstractactioninput_p.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractPhysicalDevice;
+
+/*!
+ \class Qt3DInput::QActionInputPrivate
+ \internal
+*/
+class QActionInputPrivate : public QAbstractActionInputPrivate
+{
+public:
+ QActionInputPrivate();
+
+ QVector<int> m_buttons;
+ QAbstractPhysicalDevice *m_sourceDevice;
+};
+
+struct QActionInputData
+{
+ Qt3DCore::QNodeId sourceDeviceId;
+ QVector<int> buttons;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QACTIONINPUT_P_H
+
diff --git a/src/input/frontend/qanalogaxisinput.cpp b/src/input/frontend/qanalogaxisinput.cpp
new file mode 100644
index 000000000..92f3f5beb
--- /dev/null
+++ b/src/input/frontend/qanalogaxisinput.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qanalogaxisinput.h"
+#include "qanalogaxisinput_p.h"
+#include <Qt3DInput/qabstractphysicaldevice.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+/*!
+ * \qmltype AnalogAxisInput
+ * \instantiates Qt3DInput::QAnalogAxisInput
+ * \inqmlmodule Qt3D.Input
+ * \since 5.7
+ * \TODO
+ *
+ */
+
+/*!
+ * \class Qt3DInput::QAnalogAxisInput
+ * \inmodule Qt3DInput
+ * \since 5.7
+ * \TODO
+ *
+ */
+QAnalogAxisInput::QAnalogAxisInput(Qt3DCore::QNode *parent)
+ : QAbstractAxisInput(*new QAnalogAxisInputPrivate, parent)
+{
+}
+
+/*! \internal */
+QAnalogAxisInput::~QAnalogAxisInput()
+{
+}
+
+void QAnalogAxisInput::setAxis(int axis)
+{
+ Q_D(QAnalogAxisInput);
+ if (d->m_axis != axis) {
+ d->m_axis = axis;
+ emit axisChanged(axis);
+ }
+}
+
+int QAnalogAxisInput::axis() const
+{
+ Q_D(const QAnalogAxisInput);
+ return d->m_axis;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QAnalogAxisInput::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAnalogAxisInputData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QAnalogAxisInput);
+ data.sourceDeviceId = qIdForNode(d->m_sourceDevice);
+ data.axis = d->m_axis;
+
+ return creationChange;
+}
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qanalogaxisinput.h b/src/input/frontend/qanalogaxisinput.h
new file mode 100644
index 000000000..f5523d0dd
--- /dev/null
+++ b/src/input/frontend/qanalogaxisinput.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QANALOGAXISINPUT_H
+#define QT3DINPUT_QANALOGAXISINPUT_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DInput/QAbstractAxisInput>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAnalogAxisInputPrivate;
+
+class QT3DINPUTSHARED_EXPORT QAnalogAxisInput : public QAbstractAxisInput
+{
+ Q_OBJECT
+ Q_PROPERTY(int axis READ axis WRITE setAxis NOTIFY axisChanged)
+
+public:
+ explicit QAnalogAxisInput(Qt3DCore::QNode *parent = nullptr);
+ ~QAnalogAxisInput();
+
+ int axis() const;
+
+public Q_SLOTS:
+ void setAxis(int axis);
+
+Q_SIGNALS:
+ void axisChanged(int axis);
+
+private:
+ Q_DECLARE_PRIVATE(QAnalogAxisInput)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QANALOGAXISINPUT_H
diff --git a/src/input/frontend/qanalogaxisinput_p.h b/src/input/frontend/qanalogaxisinput_p.h
new file mode 100644
index 000000000..1dbe58ac7
--- /dev/null
+++ b/src/input/frontend/qanalogaxisinput_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QANALOGAXISINPUT_P_H
+#define QT3DINPUT_QANALOGAXISINPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qabstractaxisinput_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAnalogAxisInputPrivate : public QAbstractAxisInputPrivate
+{
+public:
+ QAnalogAxisInputPrivate()
+ : QAbstractAxisInputPrivate()
+ , m_axis(-1)
+ {}
+
+ int m_axis;
+};
+
+struct QAnalogAxisInputData : public QAbstractAxisInputData
+{
+ int axis;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QBUTTONAXISINPUT_P_H
+
diff --git a/src/input/frontend/qaxis.cpp b/src/input/frontend/qaxis.cpp
index d7587d51b..a12b277e9 100644
--- a/src/input/frontend/qaxis.cpp
+++ b/src/input/frontend/qaxis.cpp
@@ -1,58 +1,53 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
****************************************************************************/
#include "qaxis.h"
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DInput/qaxisinput.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qaxis_p.h"
+#include <Qt3DInput/qabstractaxisinput.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/qnodecreatedchange.h>
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
-class QAxisPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QAxisPrivate()
- : Qt3DCore::QNodePrivate()
- {}
-
- QString m_name;
- QVector<QAxisInput *> m_inputs;
-};
-
/*!
* \qmltype Axis
* \inqmlmodule Qt3D.Input
@@ -74,27 +69,12 @@ QAxis::QAxis(Qt3DCore::QNode *parent)
{
}
+/*! \internal */
QAxis::~QAxis()
{
- QNode::cleanup();
-}
-
-void QAxis::setName(const QString &name)
-{
- Q_D(QAxis);
- if (d->m_name != name) {
- d->m_name = name;
- emit nameChanged(name);
- }
-}
-
-QString QAxis::name() const
-{
- Q_D(const QAxis);
- return d->m_name;
}
-void QAxis::addInput(QAxisInput *input)
+void QAxis::addInput(QAbstractAxisInput *input)
{
Q_D(QAxis);
if (!d->m_inputs.contains(input)) {
@@ -103,24 +83,22 @@ void QAxis::addInput(QAxisInput *input)
if (!input->parent())
input->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- Qt3DCore::QScenePropertyChangePtr change(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), input);
change->setPropertyName("input");
- change->setValue(QVariant::fromValue(input->id()));
d->notifyObservers(change);
}
}
}
-void QAxis::removeInput(QAxisInput *input)
+void QAxis::removeInput(QAbstractAxisInput *input)
{
Q_D(QAxis);
if (d->m_inputs.contains(input)) {
- if (d->m_changeArbiter != Q_NULLPTR) {
- Qt3DCore::QScenePropertyChangePtr change(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), input);
change->setPropertyName("input");
- change->setValue(QVariant::fromValue(input->id()));
d->notifyObservers(change);
}
@@ -128,20 +106,33 @@ void QAxis::removeInput(QAxisInput *input)
}
}
-QVector<QAxisInput *> QAxis::inputs() const
+QVector<QAbstractAxisInput *> QAxis::inputs() const
{
Q_D(const QAxis);
return d->m_inputs;
}
-void QAxis::copy(const Qt3DCore::QNode *ref)
+float QAxis::value() const
+{
+ Q_D(const QAxis);
+ return d->m_value;
+}
+
+void QAxis::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
- QNode::copy(ref);
- const QAxis *axis = static_cast<const QAxis *>(ref);
- d_func()->m_name = axis->d_func()->m_name;
- Q_FOREACH (QAxisInput *input, axis->inputs())
- d_func()->m_inputs.append(qobject_cast<QAxisInput *>(QNode::clone(input)));
+ Q_D(QAxis);
+ Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
+ if (e->type() == Qt3DCore::PropertyUpdated && e->propertyName() == QByteArrayLiteral("value")) {
+ d->setValue(e->value().toFloat());
+ }
+}
+Qt3DCore::QNodeCreatedChangeBasePtr QAxis::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAxisData>::create(this);
+ auto &data = creationChange->data;
+ data.inputIds = qIdsForNodes(inputs());
+ return creationChange;
}
} // Qt3DInput
diff --git a/src/input/frontend/qaxis.h b/src/input/frontend/qaxis.h
index b326d5ee6..92abd9c0d 100644
--- a/src/input/frontend/qaxis.h
+++ b/src/input/frontend/qaxis.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
****************************************************************************/
@@ -44,34 +47,31 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
class QAxisPrivate;
-class QAxisInput;
+class QAbstractAxisInput;
class QT3DINPUTSHARED_EXPORT QAxis : public Qt3DCore::QNode
{
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(float value READ value NOTIFY valueChanged)
public:
- explicit QAxis(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QAxis(Qt3DCore::QNode *parent = nullptr);
~QAxis();
- QString name() const;
+ void addInput(QAbstractAxisInput *input);
+ void removeInput(QAbstractAxisInput *input);
+ QVector<QAbstractAxisInput *> inputs() const;
- void addInput(QAxisInput *input);
- void removeInput(QAxisInput *input);
- QVector<QAxisInput *> inputs() const;
-
-public Q_SLOTS:
- void setName(const QString &name);
+ float value() const;
Q_SIGNALS:
- void nameChanged(const QString &name);
+ void valueChanged(float value);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QAxis)
- QT3D_CLONEABLE(QAxis)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // Qt3DInput
diff --git a/src/input/frontend/qaxis_p.h b/src/input/frontend/qaxis_p.h
new file mode 100644
index 000000000..146de1a4d
--- /dev/null
+++ b/src/input/frontend/qaxis_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QAXIS_P_H
+#define QT3DINPUT_QAXIS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractAxisInput;
+
+class QAxisPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QAxisPrivate()
+ : Qt3DCore::QNodePrivate()
+ , m_value(0.0f)
+ {}
+
+ Q_DECLARE_PUBLIC(QAxis)
+
+ QVector<QAbstractAxisInput *> m_inputs;
+ float m_value;
+
+ void setValue(float value)
+ {
+ if (value != m_value) {
+ m_value = value;
+ q_func()->valueChanged(m_value);
+ }
+ }
+};
+
+struct QAxisData
+{
+ QVector<Qt3DCore::QNodeId> inputIds;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QAXIS_P_H
+
diff --git a/src/input/frontend/qaxisactionhandler.cpp b/src/input/frontend/qaxisactionhandler.cpp
deleted file mode 100644
index d6999c607..000000000
--- a/src/input/frontend/qaxisactionhandler.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaxisactionhandler.h"
-#include "qaxisactionhandler_p.h"
-
-#include <Qt3DInput/qlogicaldevice.h>
-#include <Qt3DInput/private/axisactionpayload_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-/*! \internal */
-QAxisActionHandlerPrivate::QAxisActionHandlerPrivate()
- : Qt3DCore::QComponentPrivate()
- , m_logicalDevice(Q_NULLPTR)
-{
-}
-
-/*!
- * \qmltype AxisActionHandler
- * \instantiates Qt3DInput::QAxisActionHandler
- * \inqmlmodule Qt3D.Input
- * \since 5.5
- * \TODO
- *
- */
-
-/*!
- * \class Qt3DInput::QAxisActionHandler
- * \inmodule Qt3DInput
- * \since 5.5
- * \TODO
- *
- */
-
-QAxisActionHandler::QAxisActionHandler(Qt3DCore::QNode *parent)
- : Qt3DCore::QComponent(*new QAxisActionHandlerPrivate, parent)
-{
-}
-
-QAxisActionHandler::QAxisActionHandler(QAxisActionHandlerPrivate &dd, Qt3DCore::QNode *parent)
- : Qt3DCore::QComponent(dd, parent)
-{
-
-}
-
-QAxisActionHandler::~QAxisActionHandler()
-{
- QNode::cleanup();
-}
-
-Qt3DInput::QLogicalDevice *QAxisActionHandler::logicalDevice() const
-{
- Q_D(const QAxisActionHandler);
- return d->m_logicalDevice;
-}
-
-void QAxisActionHandler::setLogicalDevice(Qt3DInput::QLogicalDevice *logicalDevice)
-{
- Q_D(QAxisActionHandler);
- if (d->m_logicalDevice == logicalDevice)
- return;
-
- d->m_logicalDevice = logicalDevice;
- emit logicalDeviceChanged(logicalDevice);
-}
-
-void QAxisActionHandler::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QAxisActionHandler *component = static_cast<const QAxisActionHandler *>(ref);
- d_func()->m_logicalDevice = qobject_cast<QLogicalDevice *>(QNode::clone(component->d_func()->m_logicalDevice));
-}
-
-void QAxisActionHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
-{
- Qt3DCore::QBackendScenePropertyChangePtr e = qSharedPointerCast<Qt3DCore::QBackendScenePropertyChange>(change);
- if (e->type() == Qt3DCore::NodeUpdated) {
- if (e->propertyName() == QByteArrayLiteral("axisPayload")) {
- Qt3DInput::Input::AxisPayload payload = e->value().value<Qt3DInput::Input::AxisPayload>();
- Q_FOREACH (const Qt3DInput::Input::AxisUpdate &axisUpdate, payload.axes)
- axisValueChanged(axisUpdate.name, axisUpdate.value);
-
- } else if (e->propertyName() == QByteArrayLiteral("actionPayload")) {
- Qt3DInput::Input::ActionPayload payload = e->value().value<Qt3DInput::Input::ActionPayload>();
- Q_FOREACH (const Qt3DInput::Input::ActionUpdate &actionUpdate, payload.actions) {
- if (actionUpdate.triggered)
- actionStarted(actionUpdate.name);
- else
- actionFinished(actionUpdate.name);
- }
- }
- }
-}
-
-QT_END_NAMESPACE
-
-} // namespace Qt3DInput
-
diff --git a/src/input/frontend/qaxisactionhandler.h b/src/input/frontend/qaxisactionhandler.h
deleted file mode 100644
index ed3c17884..000000000
--- a/src/input/frontend/qaxisactionhandler.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QAXISACTIONHANDLER_H
-#define QT3DINPUT_QAXISACTIONHANDLER_H
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DCore/qcomponent.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QAxisActionHandlerPrivate;
-class QLogicalDevice;
-
-class QT3DINPUTSHARED_EXPORT QAxisActionHandler : public Qt3DCore::QComponent
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DInput::QLogicalDevice* logicalDevice READ logicalDevice WRITE setLogicalDevice NOTIFY logicalDeviceChanged)
-
-public:
- explicit QAxisActionHandler(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QAxisActionHandler();
-
- Qt3DInput::QLogicalDevice *logicalDevice() const;
-
-public Q_SLOTS:
- void setLogicalDevice(Qt3DInput::QLogicalDevice *logicalDevice);
-
-Q_SIGNALS:
- void logicalDeviceChanged(Qt3DInput::QLogicalDevice *logicalDevice);
-
- void actionStarted(QString name);
- void actionFinished(QString name);
- void axisValueChanged(QString name, float axisValue);
-
-protected:
- Q_DECLARE_PRIVATE(QAxisActionHandler)
- QAxisActionHandler(QAxisActionHandlerPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
-
-private:
- QT3D_CLONEABLE(QAxisActionHandler)
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QAXISACTIONHANDLER_H
diff --git a/src/input/frontend/qaxisactionhandler_p.h b/src/input/frontend/qaxisactionhandler_p.h
deleted file mode 100644
index 9b97a51df..000000000
--- a/src/input/frontend/qaxisactionhandler_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QACTIONHANDLER_P_H
-#define QT3DINPUT_QACTIONHANDLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/private/qcomponent_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QLogicalDevice;
-
-class QAxisActionHandlerPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QAxisActionHandlerPrivate();
-
- QLogicalDevice *m_logicalDevice;
-};
-
-}
-
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QACTIONHANDLER_P_H
-
diff --git a/src/input/frontend/qaxisinput.cpp b/src/input/frontend/qaxisinput.cpp
deleted file mode 100644
index e236ab5fb..000000000
--- a/src/input/frontend/qaxisinput.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaxisinput.h"
-#include <Qt3DInput/qabstractphysicaldevice.h>
-#include <Qt3DCore/private/qnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QAxisInputPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QAxisInputPrivate()
- : Qt3DCore::QNodePrivate()
- , m_sourceDevice(Q_NULLPTR)
- , m_scale(0.0f)
- , m_axis(-1)
- {}
-
- QVariantList m_keys;
- QAbstractPhysicalDevice *m_sourceDevice;
- float m_scale;
- int m_axis;
-};
-
-/*!
- * \qmltype AxisInput
- * \instantiates Qt3DInput::QAxisInput
- * \inqmlmodule Qt3D.Input
- * \since 5.5
- * \TODO
- *
- */
-
-/*!
- * \class Qt3DInput::QAxisInput
- * \inmodule Qt3DInput
- * \since 5.5
- * \TODO
- *
- */
-QAxisInput::QAxisInput(Qt3DCore::QNode *parent)
- : QNode(*new QAxisInputPrivate(), parent)
-{
-}
-
-QAxisInput::~QAxisInput()
-{
- QNode::cleanup();
-}
-
-void QAxisInput::setSourceDevice(QAbstractPhysicalDevice *sourceDevice)
-{
- Q_D(QAxisInput);
- if (d->m_sourceDevice != sourceDevice) {
-
- if (sourceDevice && !sourceDevice->parent())
- sourceDevice->setParent(this);
-
- d->m_sourceDevice = sourceDevice;
- emit sourceDeviceChanged(sourceDevice);
- }
-}
-
-QAbstractPhysicalDevice *QAxisInput::sourceDevice() const
-{
- Q_D(const QAxisInput);
- return d->m_sourceDevice;
-}
-
-void QAxisInput::setScale(float scale)
-{
- Q_D(QAxisInput);
- if (d->m_scale != scale) {
- d->m_scale = scale;
- emit scaleChanged(scale);
- }
-}
-
-float QAxisInput::scale() const
-{
- Q_D(const QAxisInput);
- return d->m_scale;
-}
-
-void QAxisInput::setAxis(int axis)
-{
- Q_D(QAxisInput);
- if (d->m_axis != axis) {
- d->m_axis = axis;
- emit axisChanged(axis);
- }
-}
-
-int QAxisInput::axis() const
-{
- Q_D(const QAxisInput);
- return d->m_axis;
-}
-
-void QAxisInput::setKeys(const QVariantList &keys)
-{
- Q_D(QAxisInput);
- if (keys != d->m_keys) {
- d->m_keys = keys;
- emit keysChanged(keys);
- }
-}
-
-QVariantList QAxisInput::keys() const
-{
- Q_D(const QAxisInput);
- return d->m_keys;
-}
-
-void QAxisInput::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QAxisInput *input = static_cast<const QAxisInput *>(ref);
- d_func()->m_sourceDevice = qobject_cast<QAbstractPhysicalDevice *>(QNode::clone(input->d_func()->m_sourceDevice));
- d_func()->m_keys = input->d_func()->m_keys;
- d_func()->m_scale = input->d_func()->m_scale;
- d_func()->m_axis = input->d_func()->m_axis;
-}
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/frontend/qaxisinput.h b/src/input/frontend/qaxisinput.h
deleted file mode 100644
index 9ba3f8ef1..000000000
--- a/src/input/frontend/qaxisinput.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QAXISINPUT_H
-#define QT3DINPUT_QAXISINPUT_H
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DCore/qnode.h>
-#include <QVector3D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QAbstractPhysicalDevice;
-class QAxisInputPrivate;
-
-class QT3DINPUTSHARED_EXPORT QAxisInput : public Qt3DCore::QNode
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DInput::QAbstractPhysicalDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
- Q_PROPERTY(float scale READ scale WRITE setScale NOTIFY scaleChanged)
- Q_PROPERTY(int axis READ axis WRITE setAxis NOTIFY axisChanged)
- Q_PROPERTY(QVariantList keys READ keys WRITE setKeys NOTIFY keysChanged)
-
-public:
- explicit QAxisInput(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QAxisInput();
-
- QAbstractPhysicalDevice *sourceDevice() const;
- float scale() const;
- int axis() const;
- QVariantList keys() const;
-
-public Q_SLOTS:
- void setSourceDevice(QAbstractPhysicalDevice *sourceDevice);
- void setScale(float scale);
- void setAxis(int axis);
- void setKeys(const QVariantList &keys);
-
-Q_SIGNALS:
- void sourceDeviceChanged(QAbstractPhysicalDevice *sourceDevice);
- void scaleChanged(float scale);
- void axisChanged(int axis);
- void keysChanged(const QVariantList &keys);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QAxisInput)
- QT3D_CLONEABLE(QAxisInput)
-};
-
-} // Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QQT3DINPUT_AXISINPUT_H
diff --git a/src/input/frontend/qaxissetting.cpp b/src/input/frontend/qaxissetting.cpp
index 91d049839..bd21097ef 100644
--- a/src/input/frontend/qaxissetting.cpp
+++ b/src/input/frontend/qaxissetting.cpp
@@ -1,61 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qaxissetting.h"
-#include <Qt3DCore/private/qnode_p.h>
+#include "qaxissetting_p.h"
+#include <Qt3DCore/qnodecreatedchange.h>
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
-class QAxisSettingPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QAxisSettingPrivate()
- : Qt3DCore::QNodePrivate()
- , m_deadZone(0.0f)
- , m_axes()
- , m_filter(false)
- {}
-
- float m_deadZone;
- QVariantList m_axes;
- bool m_filter;
-};
-
/*!
* \qmltype AxisSetting
* \instantiates Qt3DInput::QAxisSetting
@@ -73,15 +62,14 @@ public:
*
*/
-
QAxisSetting::QAxisSetting(Qt3DCore::QNode *parent)
: QNode(*new QAxisSettingPrivate(), parent)
{
}
+/*! \internal */
QAxisSetting::~QAxisSetting()
{
- QNode::cleanup();
}
QVariantList QAxisSetting::axes() const
@@ -90,26 +78,26 @@ QVariantList QAxisSetting::axes() const
return d->m_axes;
}
-float QAxisSetting::deadZone() const
+float QAxisSetting::deadZoneRadius() const
{
Q_D(const QAxisSetting);
- return d->m_deadZone;
+ return d->m_deadZoneRadius;
}
-bool QAxisSetting::isFilterEnabled() const
+bool QAxisSetting::isSmoothEnabled() const
{
Q_D(const QAxisSetting);
- return d->m_filter;
+ return d->m_smooth;
}
-void QAxisSetting::setDeadZone(float deadZone)
+void QAxisSetting::setDeadZoneRadius(float deadZoneRadius)
{
Q_D(QAxisSetting);
- if (d->m_deadZone == deadZone)
+ if (d->m_deadZoneRadius == deadZoneRadius)
return;
- d->m_deadZone = deadZone;
- emit deadZoneChanged(deadZone);
+ d->m_deadZoneRadius = deadZoneRadius;
+ emit deadZoneRadiusChanged(deadZoneRadius);
}
void QAxisSetting::setAxes(const QVariantList &axes)
@@ -122,23 +110,27 @@ void QAxisSetting::setAxes(const QVariantList &axes)
emit axesChanged(axes);
}
-void QAxisSetting::setFilterEnabled(bool enabled)
+void QAxisSetting::setSmoothEnabled(bool enabled)
{
Q_D(QAxisSetting);
- if (d->m_filter == enabled)
+ if (d->m_smooth == enabled)
return;
- d->m_filter = enabled;
- emit filterChanged(enabled);
+ d->m_smooth = enabled;
+ emit smoothChanged(enabled);
}
-void QAxisSetting::copy(const Qt3DCore::QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QAxisSetting::createNodeCreationChange() const
{
- QNode::copy(ref);
- const QAxisSetting *setting = static_cast<const QAxisSetting *>(ref);
- d_func()->m_deadZone = setting->d_func()->m_deadZone;
- d_func()->m_axes = setting->d_func()->m_axes;
- d_func()->m_filter = setting->d_func()->m_filter;
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAxisSettingData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QAxisSetting);
+ data.deadZoneRadius = d->m_deadZoneRadius;
+ data.axes = d->m_axes;
+ data.smooth = d->m_smooth;
+
+ return creationChange;
}
} // namespace Qt3DInput
diff --git a/src/input/frontend/qaxissetting.h b/src/input/frontend/qaxissetting.h
index 8c6c2ac25..6298dcb40 100644
--- a/src/input/frontend/qaxissetting.h
+++ b/src/input/frontend/qaxissetting.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -51,34 +54,31 @@ class QAxisSettingPrivate;
class QT3DINPUTSHARED_EXPORT QAxisSetting : public Qt3DCore::QNode
{
Q_OBJECT
- Q_PROPERTY(float deadZone READ deadZone WRITE setDeadZone NOTIFY deadZoneChanged)
+ Q_PROPERTY(float deadZoneRadius READ deadZoneRadius WRITE setDeadZoneRadius NOTIFY deadZoneRadiusChanged)
Q_PROPERTY(QVariantList axes READ axes WRITE setAxes NOTIFY axesChanged)
- Q_PROPERTY(bool filter READ isFilterEnabled WRITE setFilterEnabled NOTIFY filterChanged)
+ Q_PROPERTY(bool smooth READ isSmoothEnabled WRITE setSmoothEnabled NOTIFY smoothChanged)
public:
- explicit QAxisSetting(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QAxisSetting(Qt3DCore::QNode *parent = nullptr);
~QAxisSetting();
- float deadZone() const;
+ float deadZoneRadius() const;
QVariantList axes() const;
- bool isFilterEnabled() const;
+ bool isSmoothEnabled() const;
public Q_SLOTS:
- void setDeadZone(float deadZone);
+ void setDeadZoneRadius(float deadZoneRadius);
void setAxes(const QVariantList &axes);
- void setFilterEnabled(bool enabled);
+ void setSmoothEnabled(bool enabled);
Q_SIGNALS:
- void deadZoneChanged(float deadZone);
+ void deadZoneRadiusChanged(float deadZoneRadius);
void axesChanged(QVariantList axes);
- void filterChanged(bool filter);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void smoothChanged(bool smooth);
private:
Q_DECLARE_PRIVATE(QAxisSetting)
- QT3D_CLONEABLE(QAxisSetting)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DInput
diff --git a/src/input/frontend/qaxissetting_p.h b/src/input/frontend/qaxissetting_p.h
new file mode 100644
index 000000000..e7d841f60
--- /dev/null
+++ b/src/input/frontend/qaxissetting_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QAXISSETTING_P_H
+#define QT3DINPUT_QAXISSETTING_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnode_p.h>
+#include <QtCore/qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAxisSettingPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QAxisSettingPrivate()
+ : Qt3DCore::QNodePrivate()
+ , m_deadZoneRadius(0.0f)
+ , m_axes()
+ , m_smooth(false)
+ {}
+
+ float m_deadZoneRadius;
+ QVariantList m_axes;
+ bool m_smooth;
+};
+
+struct QAxisSettingData
+{
+ float deadZoneRadius;
+ QVariantList axes;
+ bool smooth;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QAXISSETTING_P_H
+
diff --git a/src/input/frontend/qbuttonaxisinput.cpp b/src/input/frontend/qbuttonaxisinput.cpp
new file mode 100644
index 000000000..1586cc0dc
--- /dev/null
+++ b/src/input/frontend/qbuttonaxisinput.cpp
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbuttonaxisinput.h"
+#include "qbuttonaxisinput_p.h"
+#include <Qt3DInput/qabstractphysicaldevice.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+/*!
+ * \qmltype ButtonAxisInput
+ * \instantiates Qt3DInput::QButtonAxisInput
+ * \inqmlmodule Qt3D.Input
+ * \since 5.7
+ * \TODO
+ *
+ */
+
+/*!
+ * \class Qt3DInput::QButtonAxisInput
+ * \inmodule Qt3DInput
+ * \since 5.7
+ * \TODO
+ *
+ */
+QButtonAxisInput::QButtonAxisInput(Qt3DCore::QNode *parent)
+ : QAbstractAxisInput(*new QButtonAxisInputPrivate, parent)
+{
+}
+
+/*! \internal */
+QButtonAxisInput::~QButtonAxisInput()
+{
+}
+
+void QButtonAxisInput::setScale(float scale)
+{
+ Q_D(QButtonAxisInput);
+ if (d->m_scale != scale) {
+ d->m_scale = scale;
+ emit scaleChanged(scale);
+ }
+}
+
+float QButtonAxisInput::scale() const
+{
+ Q_D(const QButtonAxisInput);
+ return d->m_scale;
+}
+
+void QButtonAxisInput::setButtons(const QVector<int> &buttons)
+{
+ Q_D(QButtonAxisInput);
+ if (buttons != d->m_buttons) {
+ d->m_buttons = buttons;
+ emit buttonsChanged(buttons);
+ }
+}
+
+QVector<int> QButtonAxisInput::buttons() const
+{
+ Q_D(const QButtonAxisInput);
+ return d->m_buttons;
+}
+
+float QButtonAxisInput::acceleration() const
+{
+ Q_D(const QButtonAxisInput);
+ return d->m_acceleration;
+}
+
+void QButtonAxisInput::setAcceleration(float acceleration)
+{
+ Q_D(QButtonAxisInput);
+ if (d->m_acceleration != acceleration) {
+ d->m_acceleration = acceleration;
+ emit accelerationChanged(acceleration);
+ }
+}
+
+float QButtonAxisInput::deceleration() const
+{
+ Q_D(const QButtonAxisInput);
+ return d->m_deceleration;
+}
+
+void QButtonAxisInput::setDeceleration(float deceleration)
+{
+ Q_D(QButtonAxisInput);
+ if (d->m_deceleration != deceleration) {
+ d->m_deceleration = deceleration;
+ emit decelerationChanged(deceleration);
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QButtonAxisInput::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QButtonAxisInputData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QButtonAxisInput);
+ data.sourceDeviceId = qIdForNode(d->m_sourceDevice);
+ data.buttons = d->m_buttons;
+ data.scale = d->m_scale;
+ data.acceleration = d->m_acceleration;
+ data.deceleration = d->m_deceleration;
+
+ return creationChange;
+}
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qbuttonaxisinput.h b/src/input/frontend/qbuttonaxisinput.h
new file mode 100644
index 000000000..3e9aacc00
--- /dev/null
+++ b/src/input/frontend/qbuttonaxisinput.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QBUTTONAXISINPUT_H
+#define QT3DINPUT_QBUTTONAXISINPUT_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DInput/QAbstractAxisInput>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QButtonAxisInputPrivate;
+
+class QT3DINPUTSHARED_EXPORT QButtonAxisInput : public QAbstractAxisInput
+{
+ Q_OBJECT
+ Q_PROPERTY(float scale READ scale WRITE setScale NOTIFY scaleChanged)
+ Q_PROPERTY(QVector<int> buttons READ buttons WRITE setButtons NOTIFY buttonsChanged)
+ Q_PROPERTY(float acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged)
+ Q_PROPERTY(float deceleration READ deceleration WRITE setDeceleration NOTIFY decelerationChanged)
+
+public:
+ explicit QButtonAxisInput(Qt3DCore::QNode *parent = nullptr);
+ ~QButtonAxisInput();
+
+ float scale() const;
+ QVector<int> buttons() const;
+
+ float acceleration() const;
+ float deceleration() const;
+
+public Q_SLOTS:
+ void setScale(float scale);
+ void setButtons(const QVector<int> &buttons);
+
+ void setAcceleration(float acceleration);
+ void setDeceleration(float deceleration);
+
+Q_SIGNALS:
+ void scaleChanged(float scale);
+ void buttonsChanged(const QVector<int> &buttons);
+
+ void accelerationChanged(float acceleration);
+ void decelerationChanged(float deceleration);
+
+private:
+ Q_DECLARE_PRIVATE(QButtonAxisInput)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QBUTTONAXISINPUT_H
diff --git a/src/input/frontend/qbuttonaxisinput_p.h b/src/input/frontend/qbuttonaxisinput_p.h
new file mode 100644
index 000000000..e56e58575
--- /dev/null
+++ b/src/input/frontend/qbuttonaxisinput_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QBUTTONAXISINPUT_P_H
+#define QT3DINPUT_QBUTTONAXISINPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qabstractaxisinput_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QButtonAxisInputPrivate : public QAbstractAxisInputPrivate
+{
+public:
+ QButtonAxisInputPrivate()
+ : QAbstractAxisInputPrivate()
+ , m_scale(0.0f)
+ , m_acceleration(-1.0f)
+ , m_deceleration(-1.0f)
+ {}
+
+ QVector<int> m_buttons;
+ float m_scale;
+ float m_acceleration;
+ float m_deceleration;
+};
+
+struct QButtonAxisInputData : public QAbstractAxisInputData
+{
+ QVector<int> buttons;
+ float scale;
+ float acceleration;
+ float deceleration;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QBUTTONAXISINPUT_P_H
+
diff --git a/src/input/frontend/qgamepadinput.cpp b/src/input/frontend/qgamepadinput.cpp
new file mode 100644
index 000000000..faf62ae88
--- /dev/null
+++ b/src/input/frontend/qgamepadinput.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgamepadinput_p.h"
+#include "qabstractphysicaldevice_p.h"
+
+#include <QGamepadManager>
+#include <QMetaEnum>
+
+QT_BEGIN_NAMESPACE
+namespace Qt3DInput {
+class QGamepadInputPrivate : public QAbstractPhysicalDevicePrivate {
+public:
+ QGamepadInputPrivate()
+ : QAbstractPhysicalDevicePrivate()
+ , m_deviceId(0)
+ {}
+
+ int m_deviceId;
+};
+
+static void setValuesFromEnum(QHash<QString, int> &hash, const QMetaEnum &metaEnum)
+{
+ hash.reserve(metaEnum.keyCount() - 1);
+ for (int i = 0; i < metaEnum.keyCount(); i++) {
+ if (metaEnum.value(i) != -1)
+ hash[QLatin1String(metaEnum.key(i))] = metaEnum.value(i);
+ }
+}
+
+QGamepadInput::QGamepadInput(Qt3DCore::QNode *parent)
+ : QAbstractPhysicalDevice(*new QGamepadInputPrivate, parent)
+{
+ Q_D(QGamepadInput);
+ auto metaObject = QGamepadManager::instance()->metaObject();
+ for (int i = metaObject->enumeratorOffset(); i < metaObject->enumeratorCount(); ++i) {
+ auto metaEnum = metaObject->enumerator(i);
+ if (metaEnum.name() == std::string("GamepadButton"))
+ setValuesFromEnum(d->m_buttonsHash, metaEnum);
+ else if (metaEnum.name() == std::string("GamepadAxis"))
+ setValuesFromEnum(d->m_axesHash, metaEnum);
+ }
+ connect(QGamepadManager::instance(), &QGamepadManager::gamepadAxisEvent, this, [this, d](int deviceId, QGamepadManager::GamepadAxis axis, double value) {
+ if (deviceId == d_func()->m_deviceId)
+ d->postAxisEvent(axis, value);
+ });
+ connect(QGamepadManager::instance(), &QGamepadManager::gamepadButtonPressEvent, this, [this, d](int deviceId, QGamepadManager::GamepadButton button, double value) {
+ if (deviceId == d_func()->m_deviceId)
+ d->postButtonEvent(button, value);
+ });
+ connect(QGamepadManager::instance(), &QGamepadManager::gamepadButtonReleaseEvent, this, [this, d](int deviceId, QGamepadManager::GamepadButton button) {
+ if (deviceId == d_func()->m_deviceId)
+ d->postButtonEvent(button, 0);
+ });
+}
+
+int QGamepadInput::deviceId() const
+{
+ return d_func()->m_deviceId;
+}
+
+void QGamepadInput::setDeviceId(int deviceId)
+{
+ Q_D(QGamepadInput);
+ if (d->m_deviceId == deviceId)
+ return;
+
+ d->m_deviceId = deviceId;
+ emit deviceIdChanged();
+}
+
+} // Qt3DInput
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qgamepadinput_p.h b/src/input/frontend/qgamepadinput_p.h
new file mode 100644
index 000000000..c1990030e
--- /dev/null
+++ b/src/input/frontend/qgamepadinput_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGAMEPADINPUT_P_H
+#define QGAMEPADINPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/private/qt3dinput_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+class QGamepadInputPrivate;
+
+class QT3DINPUTSHARED_PRIVATE_EXPORT QGamepadInput : public QAbstractPhysicalDevice
+{
+ Q_OBJECT
+ Q_PROPERTY(int deviceId READ deviceId WRITE setDeviceId NOTIFY deviceIdChanged)
+public:
+ explicit QGamepadInput(Qt3DCore::QNode *parent = nullptr);
+
+ int deviceId() const;
+ void setDeviceId(int deviceId);
+
+Q_SIGNALS:
+ void deviceIdChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QGamepadInput)
+};
+
+} // Qt3DInput
+QT_END_NAMESPACE
+
+#endif // QGAMEPADINPUT_P_H
diff --git a/src/input/frontend/qgenericinputdevice.cpp b/src/input/frontend/qgenericinputdevice.cpp
new file mode 100644
index 000000000..8c4b44992
--- /dev/null
+++ b/src/input/frontend/qgenericinputdevice.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgenericinputdevice_p.h"
+
+#include "qabstractphysicaldevice_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+
+QGenericInputDevice::QGenericInputDevice(Qt3DCore::QNode *parent)
+ : QAbstractPhysicalDevice(parent)
+{}
+
+static void setHashFromVariantMap(QHash<QString, int> &hash, const QVariantMap &map)
+{
+ hash.clear();
+ for (QVariantMap::const_iterator it = map.cbegin(); it != map.cend(); ++it) {
+ bool ok;
+ int value = it.value().toInt(&ok);
+ if (ok)
+ hash[it.key()] = value;
+ }
+}
+
+static QVariantMap hash2VariantMap(const QHash<QString, int> &hash)
+{
+ QVariantMap ret;
+ for (QHash<QString, int>::const_iterator it = hash.cbegin(); it != hash.cend(); ++it)
+ ret[it.key()] = it.value();
+ return ret;
+}
+
+QVariantMap QGenericInputDevice::axesMap() const
+{
+ Q_D(const QAbstractPhysicalDevice);
+ return hash2VariantMap(d->m_axesHash);
+}
+
+void QGenericInputDevice::setAxesMap(const QVariantMap &axesMap)
+{
+ Q_D(QAbstractPhysicalDevice);
+ setHashFromVariantMap(d->m_axesHash, axesMap);
+ emit axesMapChanged();
+}
+
+QVariantMap QGenericInputDevice::buttonsMap() const
+{
+ Q_D(const QAbstractPhysicalDevice);
+ return hash2VariantMap(d->m_buttonsHash);
+}
+
+void QGenericInputDevice::setButtonsMap(const QVariantMap &buttonsMap)
+{
+ Q_D(QAbstractPhysicalDevice);
+ setHashFromVariantMap(d->m_buttonsHash, buttonsMap);
+ emit axesMapChanged();
+}
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qgenericinputdevice_p.h b/src/input/frontend/qgenericinputdevice_p.h
new file mode 100644
index 000000000..f4af03975
--- /dev/null
+++ b/src/input/frontend/qgenericinputdevice_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GENERICDEVICE_P_H
+#define GENERICDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/private/qt3dinput_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QT3DINPUTSHARED_PRIVATE_EXPORT QGenericInputDevice : public QAbstractPhysicalDevice
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariantMap axesMap READ axesMap WRITE setAxesMap NOTIFY axesMapChanged)
+ Q_PROPERTY(QVariantMap buttonsMap READ buttonsMap WRITE setButtonsMap NOTIFY buttonsMapChanged)
+public:
+ QGenericInputDevice(Qt3DCore::QNode *parent = nullptr);
+
+ QVariantMap axesMap() const;
+ void setAxesMap(const QVariantMap &axesMap);
+ QVariantMap buttonsMap() const;
+ void setButtonsMap(const QVariantMap &buttonsMap);
+
+Q_SIGNALS:
+ void axesMapChanged();
+ void buttonsMapChanged();
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // GENERICDEVICE_P_H
diff --git a/src/input/frontend/qinputaspect.cpp b/src/input/frontend/qinputaspect.cpp
index cb938585b..0a364e27b 100644
--- a/src/input/frontend/qinputaspect.cpp
+++ b/src/input/frontend/qinputaspect.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,17 +39,19 @@
#include "qinputaspect.h"
#include "qinputaspect_p.h"
-#include "cameracontroller_p.h"
#include "inputhandler_p.h"
-#include "keyboardcontroller_p.h"
-#include "keyboardinput_p.h"
-#include "mousecontroller_p.h"
-#include "mouseinput_p.h"
-#include <Qt3DInput/qkeyboardcontroller.h>
-#include <Qt3DInput/qkeyboardinput.h>
-#include <Qt3DInput/qmousecontroller.h>
-#include <Qt3DInput/qmouseinput.h>
-#include <Qt3DInput/qinputdeviceintegration.h>
+#include "buttonaxisinput_p.h"
+#include "keyboarddevice_p.h"
+#include "keyboardhandler_p.h"
+#include "mousedevice_p.h"
+#include "mousehandler_p.h"
+#include <Qt3DInput/qkeyboarddevice.h>
+#include <Qt3DInput/qkeyboardhandler.h>
+#include <Qt3DInput/qmousedevice.h>
+#include <Qt3DInput/qmousehandler.h>
+#include <Qt3DInput/private/qinputdeviceintegration_p.h>
+#include <Qt3DInput/qinputsettings.h>
+#include <Qt3DInput/private/qgenericinputdevice_p.h>
#include <Qt3DInput/private/qinputdeviceintegrationfactory_p.h>
#include <Qt3DCore/private/qservicelocator_p.h>
#include <Qt3DCore/private/qeventfilterservice_p.h>
@@ -56,25 +61,33 @@
#include <QPluginLoader>
#include <Qt3DInput/qaxis.h>
-#include <Qt3DInput/qaxisactionhandler.h>
#include <Qt3DInput/qaction.h>
-#include <Qt3DInput/qaxisinput.h>
#include <Qt3DInput/qaxissetting.h>
#include <Qt3DInput/qactioninput.h>
+#include <Qt3DInput/qanalogaxisinput.h>
+#include <Qt3DInput/qbuttonaxisinput.h>
+#include <Qt3DInput/qinputchord.h>
+#include <Qt3DInput/qinputsequence.h>
#include <Qt3DInput/qlogicaldevice.h>
#include <Qt3DInput/qabstractphysicaldevice.h>
#include <Qt3DInput/private/axis_p.h>
-#include <Qt3DInput/private/axisactionhandler_p.h>
#include <Qt3DInput/private/action_p.h>
-#include <Qt3DInput/private/axisinput_p.h>
#include <Qt3DInput/private/axissetting_p.h>
#include <Qt3DInput/private/actioninput_p.h>
+#include <Qt3DInput/private/inputchord_p.h>
+#include <Qt3DInput/private/inputsequence_p.h>
#include <Qt3DInput/private/logicaldevice_p.h>
#include <Qt3DInput/private/inputbackendnodefunctor_p.h>
#include <Qt3DInput/private/inputmanagers_p.h>
#include <Qt3DInput/private/updateaxisactionjob_p.h>
-#include <Qt3DInput/private/updatehandlerjob_p.h>
-#include <Qt3DInput/private/keyboardmousedeviceintegration_p.h>
+#include <Qt3DInput/private/keyboardmousegenericdeviceintegration_p.h>
+#include <Qt3DInput/private/genericdevicebackendnode_p.h>
+#include <Qt3DInput/private/inputsettings_p.h>
+#include <Qt3DInput/private/eventsourcesetterhelper_p.h>
+
+#ifdef HAVE_QGAMEPAD
+# include <Qt3DInput/private/qgamepadinput_p.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -85,8 +98,7 @@ namespace Qt3DInput {
QInputAspectPrivate::QInputAspectPrivate()
: QAbstractAspectPrivate()
, m_inputHandler(new Input::InputHandler())
- , m_cameraController(new Input::CameraController())
- , m_keyboardMouseIntegration(new Input::KeyboardMouseDeviceIntegration(m_inputHandler.data()))
+ , m_keyboardMouseIntegration(new Input::KeyboardMouseGenericDeviceIntegration(m_inputHandler.data()))
{
}
@@ -97,67 +109,84 @@ QInputAspectPrivate::QInputAspectPrivate()
*/
QInputAspect::QInputAspect(QObject *parent)
- : QAbstractAspect(*new QInputAspectPrivate, parent)
+ : QInputAspect(*new QInputAspectPrivate, parent)
{
- registerBackendType<QKeyboardController>(QBackendNodeFunctorPtr(new Input::KeyboardControllerFunctor(this, d_func()->m_inputHandler.data())));
- registerBackendType<QKeyboardInput>(QBackendNodeFunctorPtr(new Input::KeyboardInputFunctor(d_func()->m_inputHandler.data())));
- registerBackendType<QMouseController>(QBackendNodeFunctorPtr(new Input::MouseControllerFunctor(this, d_func()->m_inputHandler.data())));
- registerBackendType<QMouseInput>(QBackendNodeFunctorPtr(new Input::MouseInputFunctor(d_func()->m_inputHandler.data())));
- registerBackendType<QAxis>(QBackendNodeFunctorPtr(new Input::InputNodeFunctor<Input::Axis, Input::AxisManager>(d_func()->m_inputHandler->axisManager())));
- registerBackendType<QAxisInput>(QBackendNodeFunctorPtr(new Input::InputNodeFunctor<Input::AxisInput, Input::AxisInputManager>(d_func()->m_inputHandler->axisInputManager())));
- registerBackendType<QAxisSetting>(QBackendNodeFunctorPtr(new Input::InputNodeFunctor<Input::AxisSetting, Input::AxisSettingManager>(d_func()->m_inputHandler->axisSettingManager())));
- registerBackendType<Qt3DInput::QAction>(QBackendNodeFunctorPtr(new Input::InputNodeFunctor<Input::Action, Input::ActionManager>(d_func()->m_inputHandler->actionManager())));
- registerBackendType<QActionInput>(QBackendNodeFunctorPtr(new Input::InputNodeFunctor<Input::ActionInput, Input::ActionInputManager>(d_func()->m_inputHandler->actionInputManager())));
- registerBackendType<Qt3DInput::QAxisActionHandler>(QBackendNodeFunctorPtr(new Input::AxisActionHandlerNodeFunctor(d_func()->m_inputHandler->axisActionHandlerManager())));
- registerBackendType<QLogicalDevice>(QBackendNodeFunctorPtr(new Input::LogicalDeviceNodeFunctor(d_func()->m_inputHandler->logicalDeviceManager())));
+}
- // Plugins are QInputDeviceIntegration instances
- loadInputDevicePlugins();
+/*! \internal */
+QInputAspect::QInputAspect(QInputAspectPrivate &dd, QObject *parent)
+ : QAbstractAspect(dd, parent)
+{
+ setObjectName(QStringLiteral("Input Aspect"));
+ registerBackendType<QKeyboardDevice>(QBackendNodeMapperPtr(new Input::KeyboardDeviceFunctor(this, d_func()->m_inputHandler.data())));
+ registerBackendType<QKeyboardHandler>(QBackendNodeMapperPtr(new Input::KeyboardHandlerFunctor(d_func()->m_inputHandler.data())));
+ registerBackendType<QMouseDevice>(QBackendNodeMapperPtr(new Input::MouseDeviceFunctor(this, d_func()->m_inputHandler.data())));
+ registerBackendType<QMouseHandler>(QBackendNodeMapperPtr(new Input::MouseHandlerFunctor(d_func()->m_inputHandler.data())));
+ registerBackendType<QAxis>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::Axis, Input::AxisManager>(d_func()->m_inputHandler->axisManager())));
+ registerBackendType<QAnalogAxisInput>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::AnalogAxisInput, Input::AnalogAxisInputManager>(d_func()->m_inputHandler->analogAxisInputManager())));
+ registerBackendType<QButtonAxisInput>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::ButtonAxisInput, Input::ButtonAxisInputManager>(d_func()->m_inputHandler->buttonAxisInputManager())));
+ registerBackendType<QAxisSetting>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::AxisSetting, Input::AxisSettingManager>(d_func()->m_inputHandler->axisSettingManager())));
+ registerBackendType<Qt3DInput::QAction>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::Action, Input::ActionManager>(d_func()->m_inputHandler->actionManager())));
+ registerBackendType<QActionInput>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::ActionInput, Input::ActionInputManager>(d_func()->m_inputHandler->actionInputManager())));
+ registerBackendType<QInputChord>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::InputChord, Input::InputChordManager>(d_func()->m_inputHandler->inputChordManager())));
+ registerBackendType<QInputSequence>(QBackendNodeMapperPtr(new Input::InputNodeFunctor<Input::InputSequence, Input::InputSequenceManager>(d_func()->m_inputHandler->inputSequenceManager())));
+ registerBackendType<QLogicalDevice>(QBackendNodeMapperPtr(new Input::LogicalDeviceNodeFunctor(d_func()->m_inputHandler->logicalDeviceManager())));
+ registerBackendType<QGenericInputDevice>(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data())));
+ registerBackendType<QInputSettings>(QBackendNodeMapperPtr(new Input::InputSettingsFunctor(d_func()->m_inputHandler.data())));
+
+#ifdef HAVE_QGAMEPAD
+ registerBackendType<QGamepadInput>(QBackendNodeMapperPtr(new Input::GenericDeviceBackendFunctor(this, d_func()->m_inputHandler.data())));
+#endif
- // KeyboardController and MouseController also provide their own QInputDeviceIntegration
Q_D(QInputAspect);
+ // Plugins are QInputDeviceIntegration instances
+ d->loadInputDevicePlugins();
+
+ // KeyboardDevice and MouseDevice also provide their own QInputDeviceIntegration
d->m_inputHandler->addInputDeviceIntegration(d->m_keyboardMouseIntegration.data());
}
-void QInputAspect::loadInputDevicePlugins()
+/*! \internal */
+QInputAspect::~QInputAspect()
{
- Q_D(QInputAspect);
- QStringList keys = QInputDeviceIntegrationFactory::keys();
- Q_FOREACH (QString key, keys) {
+}
+
+void QInputAspectPrivate::loadInputDevicePlugins()
+{
+ const QStringList keys = QInputDeviceIntegrationFactory::keys();
+ for (const QString &key : keys) {
Qt3DInput::QInputDeviceIntegration *integration = QInputDeviceIntegrationFactory::create(key, QStringList());
- if (integration != Q_NULLPTR) {
- d->m_inputHandler->addInputDeviceIntegration(integration);
+ if (integration != nullptr) {
+ m_inputHandler->addInputDeviceIntegration(integration);
// Initialize will allow the InputDeviceIntegration to
// register their frontend / backend types,
// create their managers
// launch a thread to listen to the actual physical device....
- integration->initialize(this);
+ integration->initialize(q_func());
}
}
}
-Qt3DCore::QCamera *QInputAspect::camera() const
-{
- Q_D(const QInputAspect);
- return d->m_cameraController->camera();
-}
-
// Note: caller is responsible for ownership
QAbstractPhysicalDevice *QInputAspect::createPhysicalDevice(const QString &name)
{
Q_D(QInputAspect);
- QAbstractPhysicalDevice *device = Q_NULLPTR;
- Q_FOREACH (Qt3DInput::QInputDeviceIntegration *integration, d->m_inputHandler->inputDeviceIntegrations()) {
- if ((device = integration->createPhysicalDevice(name)) != Q_NULLPTR)
- break;
+ const auto integrations = d->m_inputHandler->inputDeviceIntegrations();
+ for (Qt3DInput::QInputDeviceIntegration *integration : integrations) {
+ if (auto dev = integration->createPhysicalDevice(name))
+ return dev;
}
- return device;
+ return nullptr;
}
-void QInputAspect::setCamera(Qt3DCore::QCamera *camera)
+QStringList QInputAspect::availablePhysicalDevices() const
{
- Q_D(QInputAspect);
- d->m_cameraController->setCamera(camera);
+ Q_D(const QInputAspect);
+ QStringList deviceNamesList;
+ const auto deviceIntegrations = d->m_inputHandler->inputDeviceIntegrations();
+ for (const QInputDeviceIntegration *integration : deviceIntegrations)
+ deviceNamesList += integration->deviceNames();
+ return deviceNamesList;
}
QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time)
@@ -166,56 +195,47 @@ QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time)
Q_D(QInputAspect);
QVector<QAspectJobPtr> jobs;
+ d->m_inputHandler->updateEventSource();
+
jobs.append(d->m_inputHandler->keyboardJobs());
jobs.append(d->m_inputHandler->mouseJobs());
- Q_FOREACH (QInputDeviceIntegration *integration, d->m_inputHandler->inputDeviceIntegrations())
+ const auto integrations = d->m_inputHandler->inputDeviceIntegrations();
+ for (QInputDeviceIntegration *integration : integrations)
jobs += integration->jobsToExecute(time);
- // Jobs that update Axis/Action (store combined axis/action value)
- QHash<Input::HLogicalDevice, QAspectJobPtr> logicalDeviceJobs;
-
- Q_FOREACH (Input::HLogicalDevice devHandle, d->m_inputHandler->logicalDeviceManager()->activeDevices()) {
- QAspectJobPtr updateAxisActionJob(new Input::UpdateAxisActionJob(d->m_inputHandler.data(), devHandle));
- logicalDeviceJobs.insert(devHandle, updateAxisActionJob);
+ // All the jobs added up until this point are independents
+ // but the axis action jobs will be dependent on these
+ const QVector<QAspectJobPtr> dependsOnJobs = jobs;
- Q_FOREACH (const QAspectJobPtr job, jobs)
+ // Jobs that update Axis/Action (store combined axis/action value)
+ const auto devHandles = d->m_inputHandler->logicalDeviceManager()->activeDevices();
+ for (Input::HLogicalDevice devHandle : devHandles) {
+ QAspectJobPtr updateAxisActionJob(new Input::UpdateAxisActionJob(time, d->m_inputHandler.data(), devHandle));
+ jobs += updateAxisActionJob;
+ for (const QAspectJobPtr &job : dependsOnJobs)
updateAxisActionJob->addDependency(job);
}
- // Jobs that update the axisactionhandlers
- Q_FOREACH (Input::HAxisActionHandler handlerHandle, d->m_inputHandler->axisActionHandlerManager()->activeAxisActionHandlers()) {
- Input::AxisActionHandler *axisActionHandler = d->m_inputHandler->axisActionHandlerManager()->data(handlerHandle);
- Input::HLogicalDevice logicalDeviceHandle = d->m_inputHandler->logicalDeviceManager()->lookupHandle(axisActionHandler->logicalDevice());
- QAspectJobPtr updateHandlerJob(new Input::UpdateHandlerJob(axisActionHandler, logicalDeviceHandle, d->m_inputHandler.data()));
-
- // Create AxisActionHandler Job
- jobs += updateHandlerJob;
-
- QAspectJobPtr logicalDeviceJob = logicalDeviceJobs.value(logicalDeviceHandle);
- if (logicalDeviceJob) {
- updateHandlerJob->addDependency(logicalDeviceJob);
- jobs += logicalDeviceJob;
- }
- }
-
return jobs;
}
-void QInputAspect::onInitialize(const QVariantMap &)
+void QInputAspect::onRegistered()
{
Q_D(QInputAspect);
Qt3DCore::QEventFilterService *eventService = d->services()->eventFilterService();
- eventService->registerEventFilter(d->m_cameraController.data(), 128);
- d->m_inputHandler->registerEventFilters(eventService);
+ Q_ASSERT(eventService);
+
+ // Set it on the input handler which will also handle its lifetime
+ d->m_inputHandler->eventSourceHelper()->setEventFilterService(eventService);
}
-void QInputAspect::onCleanup()
+void QInputAspect::onUnregistered()
{
Q_D(QInputAspect);
// At this point it is too late to call removeEventFilter as the eventSource (Window)
// may already be destroyed
- d->m_inputHandler.reset(Q_NULLPTR);
+ d->m_inputHandler.reset(nullptr);
}
} // namespace Qt3DInput
diff --git a/src/input/frontend/qinputaspect.h b/src/input/frontend/qinputaspect.h
index 4d81a2a51..bc35256b6 100644
--- a/src/input/frontend/qinputaspect.h
+++ b/src/input/frontend/qinputaspect.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,10 +45,6 @@
QT_BEGIN_NAMESPACE
-namespace Qt3DCore {
-class QCamera;
-}
-
namespace Qt3DInput {
class QAbstractPhysicalDevice;
@@ -55,25 +54,21 @@ class QInputDeviceIntegration;
class QT3DINPUTSHARED_EXPORT QInputAspect : public Qt3DCore::QAbstractAspect
{
Q_OBJECT
- Q_PROPERTY(Qt3DCore::QCamera* camera READ camera WRITE setCamera)
public:
- explicit QInputAspect(QObject *parent = Q_NULLPTR);
+ explicit QInputAspect(QObject *parent = nullptr);
+ ~QInputAspect();
- Qt3DCore::QCamera *camera() const;
QAbstractPhysicalDevice *createPhysicalDevice(const QString &name);
-
- QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_OVERRIDE;
-
-public Q_SLOTS:
- void setCamera(Qt3DCore::QCamera *camera);
+ QStringList availablePhysicalDevices() const;
private:
- void onInitialize(const QVariantMap &data) Q_DECL_OVERRIDE;
- void onCleanup() Q_DECL_OVERRIDE;
+ QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_OVERRIDE;
- void loadInputDevicePlugins();
+ void onRegistered() Q_DECL_OVERRIDE;
+ void onUnregistered() Q_DECL_OVERRIDE;
Q_DECLARE_PRIVATE(QInputAspect)
+ explicit QInputAspect(QInputAspectPrivate &dd, QObject *parent);
friend class QInputDeviceIntegration;
};
diff --git a/src/input/frontend/qinputaspect_p.h b/src/input/frontend/qinputaspect_p.h
index e4adfad0a..d123e6216 100644
--- a/src/input/frontend/qinputaspect_p.h
+++ b/src/input/frontend/qinputaspect_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,20 +60,19 @@ namespace Qt3DInput {
class QInputAspect;
namespace Input {
-class CameraController;
class InputHandler;
-class KeyboardMouseDeviceIntegration;
+class KeyboardMouseGenericDeviceIntegration;
}
class QInputAspectPrivate : public Qt3DCore::QAbstractAspectPrivate
{
public:
QInputAspectPrivate();
+ void loadInputDevicePlugins();
Q_DECLARE_PUBLIC(QInputAspect)
QScopedPointer<Input::InputHandler> m_inputHandler;
- QScopedPointer<Input::CameraController> m_cameraController;
- QScopedPointer<Input::KeyboardMouseDeviceIntegration> m_keyboardMouseIntegration;
+ QScopedPointer<Input::KeyboardMouseGenericDeviceIntegration> m_keyboardMouseIntegration;
};
} // namespace Qt3DInput
diff --git a/src/input/frontend/qinputchord.cpp b/src/input/frontend/qinputchord.cpp
new file mode 100644
index 000000000..a85efa0d2
--- /dev/null
+++ b/src/input/frontend/qinputchord.cpp
@@ -0,0 +1,215 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+****************************************************************************/
+
+#include "qinputchord.h"
+#include "qinputchord_p.h"
+#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+/*!
+ \class Qt3DInput::QInputChord
+ \inmodule Qt3DInput
+ \inherits QAbstractActionInput
+ \brief QInputChord represents a set of QAbstractActionInput's that must be triggerd at once.
+
+ \since 5.7
+*/
+
+/*!
+ \qmltype InputChord
+ \inqmlmodule Qt3D.Input
+ \inherits QAbstractActionInput
+ \instantiates Qt3DInput::QInputChord
+ \brief QML frontend for the Qt3DInput::QInputChord C++ class.
+
+ Represents a set of QAbstractActionInput's that must be triggerd at once.
+
+ The following example shows an sequence that will be triggered by pressing the G, D, and J keys in that order with a maximum time between key presses of 1 second and overall maximum input time of 3 seconds.
+ \qml
+ InputChord {
+ interval: 1000
+ timeout: 3000
+ chords: [
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_G]
+ },
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_D]
+ },
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_J]
+ }
+ ]
+ }
+ \end
+ \since 5.7
+*/
+
+/*!
+ Constructs a new QInputChord with parent \a parent.
+ */
+QInputChord::QInputChord(Qt3DCore::QNode *parent)
+ : Qt3DInput::QAbstractActionInput(*new QInputChordPrivate(), parent)
+{
+
+}
+
+/*! \internal */
+QInputChord::~QInputChord()
+{
+}
+
+/*!
+ \fn QInputChord::timeoutChanged()
+
+ This signal is emitted when the timeout of the input chord is changed.
+*/
+
+
+
+/*!
+ \qmlproperty QQmlListProperty<Qt3DInput::QAbstractActionInput> Qt3D.Input::QInputChord::chords
+
+ The list of QAbstractActionInput that must be triggered to trigger this aggregate input.
+*/
+
+/*!
+ Returns the time in which all QAbstractActionInput's in the input chord must triggered within.
+ The time is in milliseconds
+ */
+int QInputChord::timeout() const
+{
+ Q_D(const QInputChord);
+ return d->m_timeout;
+}
+
+/*!
+ Sets the time in which all QAbstractActionInput's in the input chord must triggered within.
+ The time is in milliseconds
+ */
+void QInputChord::setTimeout(int timeout)
+{
+ Q_D(QInputChord);
+ if (d->m_timeout != timeout) {
+ d->m_timeout = timeout;
+ emit timeoutChanged(timeout);
+ }
+}
+
+/*!
+ Append the QAbstractActionInput \a input to the end of this QInputChord's chord vector.
+
+ \sa removeInput
+ */
+void QInputChord::addChord(QAbstractActionInput *input)
+{
+ Q_D(QInputChord);
+ if (!d->m_chords.contains(input)) {
+ d->m_chords.push_back(input);
+
+ if (!input->parent())
+ input->setParent(this);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), input);
+ change->setPropertyName("chord");
+ d->notifyObservers(change);
+ }
+ }
+}
+
+/*!
+ Remove the QAbstractActionInput \a input from this QInputChord's chord vector.
+
+ \sa addInput
+ */
+void QInputChord::removeChord(QAbstractActionInput *input)
+{
+ Q_D(QInputChord);
+ if (d->m_chords.contains(input)) {
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), input);
+ change->setPropertyName("chord");
+ d->notifyObservers(change);
+ }
+
+ d->m_chords.removeOne(input);
+ }
+}
+
+/*!
+ Returns the QInputChord's chord vector.
+ */
+QVector<QAbstractActionInput *> QInputChord::chords() const
+{
+ Q_D(const QInputChord);
+ return d->m_chords;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QInputChord::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QInputChordData>::create(this);
+ QInputChordData &data = creationChange->data;
+
+ Q_D(const QInputChord);
+ data.chordIds = qIdsForNodes(chords());
+ data.timeout = d->m_timeout;
+
+ return creationChange;
+}
+
+QInputChordPrivate::QInputChordPrivate()
+ : QAbstractActionInputPrivate(),
+ m_timeout(0)
+{
+}
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qinputchord.h b/src/input/frontend/qinputchord.h
new file mode 100644
index 000000000..f3e603eb5
--- /dev/null
+++ b/src/input/frontend/qinputchord.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QINPUTCHORD_H
+#define QT3DINPUT_QINPUTCHORD_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DCore/qnode.h>
+#include <Qt3DInput/qabstractactioninput.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractPhysicalDevice;
+class QInputChordPrivate;
+
+class QT3DINPUTSHARED_EXPORT QInputChord : public Qt3DInput::QAbstractActionInput
+{
+ Q_OBJECT
+ Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
+
+public:
+ explicit QInputChord(Qt3DCore::QNode *parent = nullptr);
+ ~QInputChord();
+
+ int timeout() const;
+
+ void addChord(QAbstractActionInput *input);
+ void removeChord(QAbstractActionInput *input);
+ QVector<QAbstractActionInput *> chords() const;
+
+public Q_SLOTS:
+ void setTimeout(int timeout);
+
+Q_SIGNALS:
+ void timeoutChanged(int timeout);
+
+private:
+ Q_DECLARE_PRIVATE(QInputChord)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QINPUTCHORD_H
diff --git a/src/input/frontend/qinputchord_p.h b/src/input/frontend/qinputchord_p.h
new file mode 100644
index 000000000..bd49f93d6
--- /dev/null
+++ b/src/input/frontend/qinputchord_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QINPUTCHORD_P_H
+#define QT3DINPUT_QINPUTCHORD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qabstractactioninput_p.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractActionInput;
+
+/*!
+ \class Qt3DInput::QInputChordPrivate
+ \internal
+*/
+class QInputChordPrivate : public QAbstractActionInputPrivate
+{
+public:
+ QInputChordPrivate();
+
+ int m_timeout;
+ QVector<QAbstractActionInput *> m_chords;
+};
+
+struct QInputChordData
+{
+ Qt3DCore::QNodeIdVector chordIds;
+ int timeout;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QINPUTCHORD_P_H
+
diff --git a/src/input/frontend/qinputdeviceintegration.cpp b/src/input/frontend/qinputdeviceintegration.cpp
index d8cc67bc8..db48fd059 100644
--- a/src/input/frontend/qinputdeviceintegration.cpp
+++ b/src/input/frontend/qinputdeviceintegration.cpp
@@ -1,41 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qinputdeviceintegration.h"
#include "qinputdeviceintegration_p.h"
+#include "qinputdeviceintegration_p_p.h"
#include <Qt3DInput/QInputAspect>
@@ -45,7 +48,7 @@ namespace Qt3DInput {
QInputDeviceIntegrationPrivate::QInputDeviceIntegrationPrivate()
: QObjectPrivate()
- , m_aspect(Q_NULLPTR)
+ , m_aspect(nullptr)
{
}
@@ -59,7 +62,7 @@ QInputDeviceIntegration::QInputDeviceIntegration(QInputDeviceIntegrationPrivate
{
}
-void QInputDeviceIntegration::registerBackendType(const QMetaObject &metaObject, const Qt3DCore::QBackendNodeFunctorPtr &functor)
+void QInputDeviceIntegration::registerBackendType(const QMetaObject &metaObject, const Qt3DCore::QBackendNodeMapperPtr &functor)
{
Q_D(QInputDeviceIntegration);
d->m_aspect->registerBackendType(metaObject, functor);
diff --git a/src/input/frontend/qinputdeviceintegration.h b/src/input/frontend/qinputdeviceintegration.h
deleted file mode 100644
index 4816f2989..000000000
--- a/src/input/frontend/qinputdeviceintegration.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QINPUTDEVICEINTEGRATION_H
-#define QT3DINPUT_QINPUTDEVICEINTEGRATION_H
-
-#include <QObject>
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DInput/qabstractphysicaldevicebackendnode.h>
-
-#include <Qt3DCore/qaspectjob.h>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-class QBackendNodeFunctor;
-typedef QSharedPointer<QBackendNodeFunctor> QBackendNodeFunctorPtr;
-}
-
-
-namespace Qt3DInput {
-
-class QInputAspect;
-class QAbstractPhysicalDevice;
-class QInputDeviceIntegrationPrivate;
-
-class QT3DINPUTSHARED_EXPORT QInputDeviceIntegration : public QObject
-{
- Q_OBJECT
-protected:
- explicit QInputDeviceIntegration(QObject *parent = Q_NULLPTR);
- explicit QInputDeviceIntegration(QInputDeviceIntegrationPrivate &dd, QObject *parent = Q_NULLPTR);
-
- template<class Frontend>
- void registerBackendType(const Qt3DCore::QBackendNodeFunctorPtr &functor)
- {
- registerBackendType(Frontend::staticMetaObject, functor);
- }
-
- void registerBackendType(const QMetaObject &metaObject, const Qt3DCore::QBackendNodeFunctorPtr &functor);
-
-public:
- void initialize(Qt3DInput::QInputAspect *aspect);
-
- virtual QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) = 0;
- virtual QAbstractPhysicalDevice *createPhysicalDevice(const QString &name) = 0;
- virtual QVector<Qt3DCore::QNodeId> physicalDevices() const = 0;
- virtual QAbstractPhysicalDeviceBackendNode *physicalDevice(Qt3DCore::QNodeId id) const = 0;
-
-protected:
- QInputAspect *inputAspect() const;
-
-private:
- virtual void onInitialize() = 0;
-
- Q_DECLARE_PRIVATE(QInputDeviceIntegration)
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QINPUTDEVICEINTEGRATION_H
diff --git a/src/input/frontend/qinputdeviceintegration_p.h b/src/input/frontend/qinputdeviceintegration_p.h
index e54080af1..248243fa2 100644
--- a/src/input/frontend/qinputdeviceintegration_p.h
+++ b/src/input/frontend/qinputdeviceintegration_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,27 +51,61 @@
// We mean it.
//
-#include <private/qobject_p.h>
-#include <private/qt3dinput_global_p.h>
+#include <QObject>
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DInput/private/qabstractphysicaldevicebackendnode_p.h>
+
+#include <Qt3DCore/qaspectjob.h>
+#include <Qt3DCore/qnodeid.h>
QT_BEGIN_NAMESPACE
+namespace Qt3DCore {
+class QBackendNodeMapper;
+typedef QSharedPointer<QBackendNodeMapper> QBackendNodeMapperPtr;
+}
+
+
namespace Qt3DInput {
class QInputAspect;
-class QInputDeviceIntegration;
+class QAbstractPhysicalDevice;
+class QInputDeviceIntegrationPrivate;
-class QT3DINPUTSHARED_PRIVATE_EXPORT QInputDeviceIntegrationPrivate : public QObjectPrivate
+class QT3DINPUTSHARED_PRIVATE_EXPORT QInputDeviceIntegration : public QObject
{
+ Q_OBJECT
+protected:
+ explicit QInputDeviceIntegration(QObject *parent = nullptr);
+ explicit QInputDeviceIntegration(QInputDeviceIntegrationPrivate &dd, QObject *parent = nullptr);
+
+ template<class Frontend>
+ void registerBackendType(const Qt3DCore::QBackendNodeMapperPtr &functor)
+ {
+ registerBackendType(Frontend::staticMetaObject, functor);
+ }
+
+ void registerBackendType(const QMetaObject &metaObject, const Qt3DCore::QBackendNodeMapperPtr &functor);
+
public:
- QInputDeviceIntegrationPrivate();
+ void initialize(Qt3DInput::QInputAspect *aspect);
+
+ virtual QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) = 0;
+ virtual QAbstractPhysicalDevice *createPhysicalDevice(const QString &name) = 0;
+ virtual QVector<Qt3DCore::QNodeId> physicalDevices() const = 0;
+ virtual QAbstractPhysicalDeviceBackendNode *physicalDevice(Qt3DCore::QNodeId id) const = 0;
+ virtual QStringList deviceNames() const = 0;
+
+protected:
+ QInputAspect *inputAspect() const;
- Q_DECLARE_PUBLIC(QInputDeviceIntegration)
+private:
+ virtual void onInitialize() = 0;
- QInputAspect *m_aspect;
+ Q_DECLARE_PRIVATE(QInputDeviceIntegration)
};
-} // Qt3DInput
+} // namespace Qt3DInput
QT_END_NAMESPACE
diff --git a/src/input/frontend/qinputdeviceintegration_p_p.h b/src/input/frontend/qinputdeviceintegration_p_p.h
new file mode 100644
index 000000000..c8557eac5
--- /dev/null
+++ b/src/input/frontend/qinputdeviceintegration_p_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QINPUTDEVICEINTEGRATION_P_P_H
+#define QT3DINPUT_QINPUTDEVICEINTEGRATION_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qobject_p.h>
+#include <private/qt3dinput_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QInputAspect;
+class QInputDeviceIntegration;
+
+class QT3DINPUTSHARED_PRIVATE_EXPORT QInputDeviceIntegrationPrivate : public QObjectPrivate
+{
+public:
+ QInputDeviceIntegrationPrivate();
+
+ Q_DECLARE_PUBLIC(QInputDeviceIntegration)
+
+ QInputAspect *m_aspect;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QINPUTDEVICEINTEGRATION_P_P_H
diff --git a/src/input/frontend/qinputdeviceintegrationfactory.cpp b/src/input/frontend/qinputdeviceintegrationfactory.cpp
index 1cb0650e9..22e93294e 100644
--- a/src/input/frontend/qinputdeviceintegrationfactory.cpp
+++ b/src/input/frontend/qinputdeviceintegrationfactory.cpp
@@ -1,42 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qinputdeviceintegrationfactory_p.h"
-#include <Qt3DInput/qinputdeviceintegration.h>
-#include <Qt3DInput/qinputdeviceplugin.h>
+#include <Qt3DInput/private/qinputdeviceintegration_p.h>
+#include <Qt3DInput/private/qinputdeviceplugin_p.h>
#include <QtCore/private/qfactoryloader_p.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
@@ -46,7 +49,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QInputDevicePlugin_iid, QLatin1String("/inputdevices"), Qt::CaseInsensitive))
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QInputDevicePlugin_iid, QLatin1String("/3dinputdevices"), Qt::CaseInsensitive))
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QInputDevicePlugin_iid, QLatin1String(""), Qt::CaseInsensitive))
#endif
@@ -78,13 +81,13 @@ QInputDeviceIntegration *QInputDeviceIntegrationFactory::create(const QString &n
#ifndef QT_NO_LIBRARY
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
- if (QInputDeviceIntegration *ret = qLoadPlugin1<QInputDeviceIntegration, QInputDevicePlugin>(directLoader(), name, args))
+ if (QInputDeviceIntegration *ret = qLoadPlugin<QInputDeviceIntegration, QInputDevicePlugin>(directLoader(), name, args))
return ret;
}
- if (QInputDeviceIntegration *ret = qLoadPlugin1<QInputDeviceIntegration, QInputDevicePlugin>(loader(), name, args))
+ if (QInputDeviceIntegration *ret = qLoadPlugin<QInputDeviceIntegration, QInputDevicePlugin>(loader(), name, args))
return ret;
#endif
- return Q_NULLPTR;
+ return nullptr;
}
} // Qt3DInput
diff --git a/src/input/frontend/qinputdeviceintegrationfactory_p.h b/src/input/frontend/qinputdeviceintegrationfactory_p.h
index 326f06390..e3d775932 100644
--- a/src/input/frontend/qinputdeviceintegrationfactory_p.h
+++ b/src/input/frontend/qinputdeviceintegrationfactory_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/input/frontend/qinputdeviceplugin.cpp b/src/input/frontend/qinputdeviceplugin.cpp
index b6b56e805..cae80c05b 100644
--- a/src/input/frontend/qinputdeviceplugin.cpp
+++ b/src/input/frontend/qinputdeviceplugin.cpp
@@ -1,40 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qinputdeviceplugin.h"
+#include "qinputdeviceplugin_p.h"
QT_BEGIN_NAMESPACE
@@ -53,7 +56,7 @@ QInputDeviceIntegration *QInputDevicePlugin::create(const QString &key, const QS
{
Q_UNUSED(key)
Q_UNUSED(paramList)
- return Q_NULLPTR;
+ return nullptr;
}
} // Qt3DInput
diff --git a/src/input/frontend/qinputdeviceplugin.h b/src/input/frontend/qinputdeviceplugin.h
deleted file mode 100644
index 2d3678134..000000000
--- a/src/input/frontend/qinputdeviceplugin.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QINPUTDEVICEPLUGIN_H
-#define QT3DINPUT_QINPUTDEVICEPLUGIN_H
-
-#include <QtCore/QObject>
-#include <QtCore/QtPlugin>
-#include <QtCore/QFactoryInterface>
-
-#include <Qt3DInput/qt3dinput_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QInputDeviceIntegration;
-
-class QT3DINPUTSHARED_EXPORT QInputDevicePlugin : public QObject
-{
- Q_OBJECT
-public:
- explicit QInputDevicePlugin(QObject *parent = Q_NULLPTR);
- ~QInputDevicePlugin();
-
- virtual QInputDeviceIntegration *create(const QString &key, const QStringList &paramList);
-};
-
-} // Qt3DInput
-
-#define QInputDevicePlugin_iid "org.qt-project.Qt3DInput.QInputDevicePlugin 5.6"
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QINPUTDEVICEPLUGIN_H
diff --git a/src/input/frontend/qinputdeviceplugin_p.h b/src/input/frontend/qinputdeviceplugin_p.h
new file mode 100644
index 000000000..ca77441af
--- /dev/null
+++ b/src/input/frontend/qinputdeviceplugin_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QINPUTDEVICEPLUGIN_P_H
+#define QT3DINPUT_QINPUTDEVICEPLUGIN_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QObject>
+#include <QtCore/QtPlugin>
+#include <QtCore/QFactoryInterface>
+
+#include <Qt3DInput/private/qt3dinput_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QInputDeviceIntegration;
+
+class QT3DINPUTSHARED_PRIVATE_EXPORT QInputDevicePlugin : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QInputDevicePlugin(QObject *parent = nullptr);
+ ~QInputDevicePlugin();
+
+ virtual QInputDeviceIntegration *create(const QString &key, const QStringList &paramList);
+};
+
+} // Qt3DInput
+
+#define QInputDevicePlugin_iid "org.qt-project.Qt3DInput.QInputDevicePlugin 5.6"
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QINPUTDEVICEPLUGIN_P_H
diff --git a/src/input/frontend/qinputsequence.cpp b/src/input/frontend/qinputsequence.cpp
new file mode 100644
index 000000000..1786a9584
--- /dev/null
+++ b/src/input/frontend/qinputsequence.cpp
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+****************************************************************************/
+
+#include "qinputsequence.h"
+#include "qinputsequence_p.h"
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/qabstractactioninput.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+QInputSequencePrivate::QInputSequencePrivate()
+ : QAbstractActionInputPrivate(),
+ m_timeout(0),
+ m_buttonInterval(0)
+{
+}
+
+/*!
+ \class Qt3DInput::QInputSequence
+ \inmodule Qt3DInput
+ \inherits QAbstractAggregateActionInput
+ \brief QInputSequence represents a set of QAbstractActionInput's that must be triggerd one after the other.
+ \since 5.7
+*/
+
+/*!
+ \qmltype InputSequence
+ \inqmlmodule Qt3D.Input
+ \inherits QAbstractAggregateActionInput
+ \instantiates Qt3DInput::QInputSequence
+ \brief QML frontend for the Qt3DInput::QInputSequence C++ class.
+
+ Represents a set of QAbstractActionInput's that must be triggerd one after the other.
+
+ The following example shows a chord that will be triggered by pressing the A and S keys together with a tolerence of 10 miliseconds between presses.
+ \qml
+ InputChord {
+ tolerance: 10
+ inputs: [
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_A]
+ },
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_S]
+ }
+ ]
+ }
+ \endqml
+
+ \since 5.7
+*/
+
+/*!
+ Constructs a new QInputSequence with parent \a parent.
+ */
+QInputSequence::QInputSequence(Qt3DCore::QNode *parent)
+ : Qt3DInput::QAbstractActionInput(*new QInputSequencePrivate(), parent)
+{
+
+}
+
+/*! \internal */
+QInputSequence::~QInputSequence()
+{
+}
+
+/*!
+ \fn QInputSequence::timeoutChanged()
+
+ This signal is emitted when the timeout of the input sequence is changed.
+*/
+
+/*!
+ \qmlproperty int Qt3D.Input::InputSequence::timeout
+
+ The time in milliseconds in which all QAbstractActionInput's in the input sequence must triggered within.
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::InputSequence::timeoutChanged()
+
+ This signal is emitted when the timeout of the input sequence is changed.
+
+ The corresponding handeler is \c onTimeoutChanged
+*/
+
+/*!
+ Returns the time in which all QAbstractActionInput's in the input sequence must triggered within.
+ The time is in milliseconds
+ */
+int QInputSequence::timeout() const
+{
+ Q_D(const QInputSequence);
+ return d->m_timeout;
+}
+
+/*!
+ \fn QInputSequence::buttonIntervalChanged()
+
+ This signal is emitted when the buttonInterval of the input sequence is changed.
+*/
+
+/*!
+ \qmlproperty int Qt3D.Input::InputSequence::buttonInterval
+
+ The maximum time in milliseconds in between consecutive QAbstractActionInput's in the input sequence.
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::InputSequence::buttonIntervalChanged()
+
+ This signal is emitted when the buttonInterval of the input sequence is changed.
+
+ The corresponding handeler is \c onButtonIntervalChanged
+*/
+
+/*!
+ Returns the maximum time in between consecutive QAbstractActionInput's in the input sequence.
+ The time is in milliseconds
+ */
+int QInputSequence::buttonInterval() const
+{
+ Q_D(const QInputSequence);
+ return d->m_buttonInterval;
+}
+
+/*!
+ Set the time in which all QAbstractActionInput's in the input sequence must triggered within.
+ The time is in milliseconds
+ */
+void QInputSequence::setTimeout(int timeout)
+{
+ Q_D(QInputSequence);
+ if (d->m_timeout != timeout) {
+ d->m_timeout = timeout;
+ emit timeoutChanged(timeout);
+ }
+}
+
+/*!
+ Set the maximum time in between consecutive QAbstractActionInput's in the input sequence.
+ The time is in milliseconds
+ */
+void QInputSequence::setButtonInterval(int buttonInterval)
+{
+ Q_D(QInputSequence);
+ if (d->m_buttonInterval != buttonInterval) {
+ d->m_buttonInterval = buttonInterval;
+ emit buttonIntervalChanged(buttonInterval);
+ }
+}
+
+/*!
+ Append the QAbstractActionInput \a input to the end of this QInputSequence's sequence vector.
+
+ \sa removeInput
+ */
+void QInputSequence::addSequence(QAbstractActionInput *input)
+{
+ Q_D(QInputSequence);
+ if (!d->m_sequences.contains(input)) {
+ d->m_sequences.push_back(input);
+
+ if (!input->parent())
+ input->setParent(this);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), input);
+ change->setPropertyName("sequence");
+ d->notifyObservers(change);
+ }
+ }
+}
+
+/*!
+ Remove the QAbstractActionInput \a input from this QInputSequence's sequence vector.
+
+ \sa addInput
+ */
+void QInputSequence::removeSequence(QAbstractActionInput *input)
+{
+ Q_D(QInputSequence);
+ if (d->m_sequences.contains(input)) {
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), input);
+ change->setPropertyName("sequence");
+ d->notifyObservers(change);
+ }
+
+ d->m_sequences.removeOne(input);
+ }
+}
+
+/*!
+ Returns the QInputSequence's sequence vector.
+ */
+QVector<QAbstractActionInput *> QInputSequence::sequences() const
+{
+ Q_D(const QInputSequence);
+ return d->m_sequences;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QInputSequence::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QInputSequenceData>::create(this);
+ QInputSequenceData &data = creationChange->data;
+
+ Q_D(const QInputSequence);
+ data.sequenceIds = qIdsForNodes(sequences());
+ data.timeout = d->m_timeout;
+ data.buttonInterval = d->m_buttonInterval;
+
+ return creationChange;
+}
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qinputsequence.h b/src/input/frontend/qinputsequence.h
new file mode 100644
index 000000000..2baeb40b8
--- /dev/null
+++ b/src/input/frontend/qinputsequence.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QINPUTSEQUENCE_H
+#define QT3DINPUT_QINPUTSEQUENCE_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DCore/qnode.h>
+#include <Qt3DInput/qabstractactioninput.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractPhysicalDevice;
+class QInputSequencePrivate;
+
+class QT3DINPUTSHARED_EXPORT QInputSequence : public Qt3DInput::QAbstractActionInput
+{
+ Q_OBJECT
+ Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged)
+ Q_PROPERTY(int buttonInterval READ buttonInterval WRITE setButtonInterval NOTIFY buttonIntervalChanged)
+
+public:
+ explicit QInputSequence(Qt3DCore::QNode *parent = nullptr);
+ ~QInputSequence();
+
+ int timeout() const;
+ int buttonInterval() const;
+
+ void addSequence(QAbstractActionInput *input);
+ void removeSequence(QAbstractActionInput *input);
+ QVector<QAbstractActionInput *> sequences() const;
+
+public Q_SLOTS:
+ void setTimeout(int timeout);
+ void setButtonInterval(int buttonInterval);
+
+Q_SIGNALS:
+ void timeoutChanged(int timeout);
+ void buttonIntervalChanged(int buttonInterval);
+
+private:
+ Q_DECLARE_PRIVATE(QInputSequence)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QINPUTSEQUENCE_H
diff --git a/src/input/frontend/qinputsequence_p.h b/src/input/frontend/qinputsequence_p.h
new file mode 100644
index 000000000..3290e4dcc
--- /dev/null
+++ b/src/input/frontend/qinputsequence_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QINPUTSEQUENCE_P_H
+#define QT3DINPUT_QINPUTSEQUENCE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DInput/private/qabstractactioninput_p.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractActionInput;
+
+/*!
+ \class Qt3DInput::QInputChordSequence
+ \internal
+*/
+class QInputSequencePrivate : public QAbstractActionInputPrivate
+{
+public:
+ QInputSequencePrivate();
+
+ int m_timeout;
+ int m_buttonInterval;
+ QVector<QAbstractActionInput *> m_sequences;
+};
+
+struct QInputSequenceData
+{
+ Qt3DCore::QNodeIdVector sequenceIds;
+ int timeout;
+ int buttonInterval;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QINPUTSEQUENCE_P_H
+
diff --git a/src/input/frontend/qinputsettings.cpp b/src/input/frontend/qinputsettings.cpp
new file mode 100644
index 000000000..fde2feb55
--- /dev/null
+++ b/src/input/frontend/qinputsettings.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qinputsettings.h"
+#include "qinputsettings_p.h"
+#include <Qt3DCore/qnodecreatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+QInputSettingsPrivate::QInputSettingsPrivate()
+ : Qt3DCore::QComponentPrivate()
+ , m_eventSource(nullptr)
+{
+}
+
+QInputSettings::QInputSettings(Qt3DCore::QNode *parent)
+ : Qt3DCore::QComponent(*new QInputSettingsPrivate(), parent)
+{
+}
+
+/*! \internal */
+QInputSettings::~QInputSettings()
+{
+}
+
+QObject *QInputSettings::eventSource() const
+{
+ Q_D(const QInputSettings);
+ return d->m_eventSource;
+}
+
+void QInputSettings::setEventSource(QObject *eventSource)
+{
+ Q_D(QInputSettings);
+ if (d->m_eventSource != eventSource) {
+ d->m_eventSource = eventSource;
+ emit eventSourceChanged(eventSource);
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QInputSettings::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QInputSettingsData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QInputSettings);
+ data.eventSource = d->m_eventSource;
+
+ return creationChange;
+}
+
+} // Qt3DInput
+
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qinputsettings.h b/src/input/frontend/qinputsettings.h
new file mode 100644
index 000000000..8eb3b6bf2
--- /dev/null
+++ b/src/input/frontend/qinputsettings.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QINPUTSETTINGS_H
+#define QT3DINPUT_QINPUTSETTINGS_H
+
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DInput/qt3dinput_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QInputSettingsPrivate;
+
+class QT3DINPUTSHARED_EXPORT QInputSettings : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *eventSource READ eventSource WRITE setEventSource NOTIFY eventSourceChanged)
+public:
+ explicit QInputSettings(Qt3DCore::QNode *parent = nullptr);
+ ~QInputSettings();
+
+ QObject *eventSource() const;
+
+public Q_SLOTS:
+ void setEventSource(QObject *eventSource);
+
+Q_SIGNALS:
+ void eventSourceChanged(QObject *);
+
+private:
+ Q_DECLARE_PRIVATE(QInputSettings)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QINPUTSETTINGS_H
diff --git a/src/input/frontend/qinputsettings_p.h b/src/input/frontend/qinputsettings_p.h
new file mode 100644
index 000000000..e1ba18542
--- /dev/null
+++ b/src/input/frontend/qinputsettings_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QINPUTSETTINGS_P_H
+#define QT3DINPUT_QINPUTSETTINGS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qcomponent_p.h>
+#include <QtCore/qpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QInputSettingsPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QInputSettingsPrivate();
+
+ QObject *m_eventSource;
+};
+
+struct QInputSettingsData
+{
+ QPointer<QObject> eventSource;
+};
+
+} // Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QINPUTSETTINGS_P_H
diff --git a/src/input/frontend/qkeyboardcontroller.cpp b/src/input/frontend/qkeyboardcontroller.cpp
deleted file mode 100644
index 4b6be9314..000000000
--- a/src/input/frontend/qkeyboardcontroller.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkeyboardcontroller.h"
-#include "qkeyboardcontroller_p.h"
-#include "qkeyboardinput.h"
-#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DInput {
-
-QKeyboardControllerPrivate::QKeyboardControllerPrivate()
- : QAbstractPhysicalDevicePrivate()
-{
- m_keyMap[QStringLiteral("escape")] = Qt::Key_Escape;
- m_keyMap[QStringLiteral("tab")] = Qt::Key_Tab;
- m_keyMap[QStringLiteral("backtab")] = Qt::Key_Backtab;
- m_keyMap[QStringLiteral("backspace")] = Qt::Key_Backspace;
- m_keyMap[QStringLiteral("return")] = Qt::Key_Return;
- m_keyMap[QStringLiteral("enter")] = Qt::Key_Enter;
- m_keyMap[QStringLiteral("insert")] = Qt::Key_Insert;
- m_keyMap[QStringLiteral("delete")] = Qt::Key_Delete;
- m_keyMap[QStringLiteral("pause")] = Qt::Key_Pause;
- m_keyMap[QStringLiteral("print")] = Qt::Key_Print;
- m_keyMap[QStringLiteral("sysreq")] = Qt::Key_SysReq;
- m_keyMap[QStringLiteral("clear")] = Qt::Key_Clear;
- m_keyMap[QStringLiteral("home")] = Qt::Key_Home;
- m_keyMap[QStringLiteral("end")] = Qt::Key_End;
- m_keyMap[QStringLiteral("left")] = Qt::Key_Left;
- m_keyMap[QStringLiteral("right")] = Qt::Key_Right;
- m_keyMap[QStringLiteral("up")] = Qt::Key_Up;
- m_keyMap[QStringLiteral("down")] = Qt::Key_Down;
- m_keyMap[QStringLiteral("pageUp")] = Qt::Key_PageUp;
- m_keyMap[QStringLiteral("pageDown")] = Qt::Key_PageDown;
- m_keyMap[QStringLiteral("shift")] = Qt::Key_Shift;
- m_keyMap[QStringLiteral("control")] = Qt::Key_Control;
- m_keyMap[QStringLiteral("meta")] = Qt::Key_Meta;
- m_keyMap[QStringLiteral("alt")] = Qt::Key_Alt;
- m_keyMap[QStringLiteral("capLock")] = Qt::Key_CapsLock;
- m_keyMap[QStringLiteral("numLock")] = Qt::Key_NumLock;
- m_keyMap[QStringLiteral("scrollLock")] = Qt::Key_ScrollLock;
- m_keyMap[QStringLiteral("F1")] = Qt::Key_F1;
- m_keyMap[QStringLiteral("F2")] = Qt::Key_F2;
- m_keyMap[QStringLiteral("F3")] = Qt::Key_F3;
- m_keyMap[QStringLiteral("F4")] = Qt::Key_F4;
- m_keyMap[QStringLiteral("F5")] = Qt::Key_F5;
- m_keyMap[QStringLiteral("F6")] = Qt::Key_F6;
- m_keyMap[QStringLiteral("F7")] = Qt::Key_F7;
- m_keyMap[QStringLiteral("F8")] = Qt::Key_F8;
- m_keyMap[QStringLiteral("F9")] = Qt::Key_F9;
- m_keyMap[QStringLiteral("F10")] = Qt::Key_F10;
- m_keyMap[QStringLiteral("F11")] = Qt::Key_F11;
- m_keyMap[QStringLiteral("F12")] = Qt::Key_F12;
- m_keyMap[QStringLiteral("F13")] = Qt::Key_F13;
- m_keyMap[QStringLiteral("F14")] = Qt::Key_F14;
- m_keyMap[QStringLiteral("F15")] = Qt::Key_F15;
- m_keyMap[QStringLiteral("F16")] = Qt::Key_F16;
- m_keyMap[QStringLiteral("F17")] = Qt::Key_F17;
- m_keyMap[QStringLiteral("F18")] = Qt::Key_F18;
- m_keyMap[QStringLiteral("F19")] = Qt::Key_F19;
- m_keyMap[QStringLiteral("F20")] = Qt::Key_F20;
- m_keyMap[QStringLiteral("F21")] = Qt::Key_F21;
- m_keyMap[QStringLiteral("F22")] = Qt::Key_F22;
- m_keyMap[QStringLiteral("F23")] = Qt::Key_F23;
- m_keyMap[QStringLiteral("F24")] = Qt::Key_F24;
- m_keyMap[QStringLiteral("F25")] = Qt::Key_F25;
- m_keyMap[QStringLiteral("F26")] = Qt::Key_F26;
- m_keyMap[QStringLiteral("F27")] = Qt::Key_F27;
- m_keyMap[QStringLiteral("F28")] = Qt::Key_F28;
- m_keyMap[QStringLiteral("F29")] = Qt::Key_F29;
- m_keyMap[QStringLiteral("F30")] = Qt::Key_F30;
- m_keyMap[QStringLiteral("F31")] = Qt::Key_F31;
- m_keyMap[QStringLiteral("F32")] = Qt::Key_F32;
- m_keyMap[QStringLiteral("F33")] = Qt::Key_F33;
- m_keyMap[QStringLiteral("F34")] = Qt::Key_F34;
- m_keyMap[QStringLiteral("F35")] = Qt::Key_F35;
- m_keyMap[QStringLiteral("superL")] = Qt::Key_Super_L;
- m_keyMap[QStringLiteral("superR")] = Qt::Key_Super_R;
- m_keyMap[QStringLiteral("menu")] = Qt::Key_Menu;
- m_keyMap[QStringLiteral("hyperL")] = Qt::Key_Hyper_L;
- m_keyMap[QStringLiteral("hyperR")] = Qt::Key_Hyper_R;
- m_keyMap[QStringLiteral("help")] = Qt::Key_Help;
- m_keyMap[QStringLiteral("directionL")] = Qt::Key_Direction_L;
- m_keyMap[QStringLiteral("directionR")] = Qt::Key_Direction_R;
- m_keyMap[QStringLiteral("space")] = Qt::Key_Space;
- m_keyMap[QStringLiteral("any")] = Qt::Key_Any;
- m_keyMap[QStringLiteral("exclam")] = Qt::Key_Exclam;
- m_keyMap[QStringLiteral("quoteDbl")] = Qt::Key_QuoteDbl;
- m_keyMap[QStringLiteral("numberSign")] = Qt::Key_NumberSign;
- m_keyMap[QStringLiteral("dollar")] = Qt::Key_Dollar;
- m_keyMap[QStringLiteral("percent")] = Qt::Key_Percent;
- m_keyMap[QStringLiteral("ampersand")] = Qt::Key_Ampersand;
- m_keyMap[QStringLiteral("apostrophe")] = Qt::Key_Apostrophe;
- m_keyMap[QStringLiteral("parenLeft")] = Qt::Key_ParenLeft;
- m_keyMap[QStringLiteral("parenRight")] = Qt::Key_ParenRight;
- m_keyMap[QStringLiteral("asterisk")] = Qt::Key_Asterisk;
- m_keyMap[QStringLiteral("plus")] = Qt::Key_Plus;
- m_keyMap[QStringLiteral("comma")] = Qt::Key_Comma;
- m_keyMap[QStringLiteral("minus")] = Qt::Key_Minus;
- m_keyMap[QStringLiteral("period")] = Qt::Key_Period;
- m_keyMap[QStringLiteral("slash")] = Qt::Key_Slash;
- m_keyMap[QStringLiteral("0")] = Qt::Key_0;
- m_keyMap[QStringLiteral("1")] = Qt::Key_1;
- m_keyMap[QStringLiteral("2")] = Qt::Key_2;
- m_keyMap[QStringLiteral("3")] = Qt::Key_3;
- m_keyMap[QStringLiteral("4")] = Qt::Key_4;
- m_keyMap[QStringLiteral("5")] = Qt::Key_5;
- m_keyMap[QStringLiteral("6")] = Qt::Key_6;
- m_keyMap[QStringLiteral("7")] = Qt::Key_7;
- m_keyMap[QStringLiteral("8")] = Qt::Key_8;
- m_keyMap[QStringLiteral("9")] = Qt::Key_9;
- m_keyMap[QStringLiteral("colon")] = Qt::Key_Colon;
- m_keyMap[QStringLiteral("semiColon")] = Qt::Key_Semicolon;
- m_keyMap[QStringLiteral("less")] = Qt::Key_Less;
- m_keyMap[QStringLiteral("equal")] = Qt::Key_Equal;
- m_keyMap[QStringLiteral("greater")] = Qt::Key_Greater;
- m_keyMap[QStringLiteral("question")] = Qt::Key_Question;
- m_keyMap[QStringLiteral("at")] = Qt::Key_At;
- m_keyMap[QStringLiteral("a")] = Qt::Key_A;
- m_keyMap[QStringLiteral("b")] = Qt::Key_B;
- m_keyMap[QStringLiteral("c")] = Qt::Key_C;
- m_keyMap[QStringLiteral("d")] = Qt::Key_D;
- m_keyMap[QStringLiteral("e")] = Qt::Key_E;
- m_keyMap[QStringLiteral("f")] = Qt::Key_F;
- m_keyMap[QStringLiteral("g")] = Qt::Key_G;
- m_keyMap[QStringLiteral("h")] = Qt::Key_H;
- m_keyMap[QStringLiteral("i")] = Qt::Key_I;
- m_keyMap[QStringLiteral("j")] = Qt::Key_J;
- m_keyMap[QStringLiteral("k")] = Qt::Key_K;
- m_keyMap[QStringLiteral("l")] = Qt::Key_L;
- m_keyMap[QStringLiteral("m")] = Qt::Key_M;
- m_keyMap[QStringLiteral("n")] = Qt::Key_N;
- m_keyMap[QStringLiteral("o")] = Qt::Key_O;
- m_keyMap[QStringLiteral("p")] = Qt::Key_P;
- m_keyMap[QStringLiteral("q")] = Qt::Key_Q;
- m_keyMap[QStringLiteral("r")] = Qt::Key_R;
- m_keyMap[QStringLiteral("s")] = Qt::Key_S;
- m_keyMap[QStringLiteral("t")] = Qt::Key_T;
- m_keyMap[QStringLiteral("u")] = Qt::Key_U;
- m_keyMap[QStringLiteral("v")] = Qt::Key_V;
- m_keyMap[QStringLiteral("w")] = Qt::Key_W;
- m_keyMap[QStringLiteral("x")] = Qt::Key_X;
- m_keyMap[QStringLiteral("y")] = Qt::Key_Y;
- m_keyMap[QStringLiteral("z")] = Qt::Key_Z;
- m_keyMap[QStringLiteral("bracketLeft")] = Qt::Key_BracketLeft;
- m_keyMap[QStringLiteral("backslash")] = Qt::Key_Backslash;
- m_keyMap[QStringLiteral("bracketRight")] = Qt::Key_BracketRight;
- m_keyMap[QStringLiteral("asciiCircum")] = Qt::Key_AsciiCircum;
- m_keyMap[QStringLiteral("underscore")] = Qt::Key_Underscore;
- m_keyMap[QStringLiteral("quoteLeft")] = Qt::Key_QuoteLeft;
- m_keyMap[QStringLiteral("braceLeft")] = Qt::Key_BraceLeft;
- m_keyMap[QStringLiteral("bar")] = Qt::Key_Bar;
- m_keyMap[QStringLiteral("braceRight")] = Qt::Key_BraceRight;
- m_keyMap[QStringLiteral("asciiTilde")] = Qt::Key_AsciiTilde;
- m_keyMap[QStringLiteral("plusminus")] = Qt::Key_plusminus;
- m_keyMap[QStringLiteral("onesuperior")] = Qt::Key_onesuperior;
- m_keyMap[QStringLiteral("multiply")] = Qt::Key_multiply;
- m_keyMap[QStringLiteral("division")] = Qt::Key_division;
- m_keyMap[QStringLiteral("diaeresis")] = Qt::Key_diaeresis;
-
- m_keyNames = m_keyMap.keys();
-}
-
-/*!
- \class Qt3DInput::QKeyboardController
- \inmodule Qt3DInput
- \since 5.5
-*/
-
-/*!
- \qmltype KeyboardController
- \inqmlmodule Qt3D.Input
- \since 5.5
- \instantiates Qt3DInput::QKeyboardController
- \inherits Node
-*/
-
-QKeyboardController::QKeyboardController(QNode *parent)
- : QAbstractPhysicalDevice(*new QKeyboardControllerPrivate, parent)
-{
-}
-
-QKeyboardController::~QKeyboardController()
-{
- QNode::cleanup();
-}
-
-/*!
- \qmlproperty KeyboardInput Qt3D.Input::KeyboardController::activeInput
- \readonly
-*/
-QKeyboardInput *QKeyboardController::activeInput() const
-{
- Q_D(const QKeyboardController);
- return d->m_activeInput;
-}
-
-int QKeyboardController::axisCount() const
-{
- return 0;
-}
-
-int QKeyboardController::buttonCount() const
-{
- Q_D(const QKeyboardController);
- return d->m_keyNames.size();
-}
-
-QStringList QKeyboardController::axisNames() const
-{
- return QStringList();
-}
-
-QStringList QKeyboardController::buttonNames() const
-{
- Q_D(const QKeyboardController);
- return d->m_keyNames;
-}
-
-int QKeyboardController::axisIdentifier(const QString &name) const
-{
- Q_UNUSED(name);
- return 0;
-}
-
-int QKeyboardController::buttonIdentifier(const QString &name) const
-{
- Q_D(const QKeyboardController);
- return d->m_keyMap.value(name, 0);
-}
-
-/*! \internal */
-QKeyboardController::QKeyboardController(QKeyboardControllerPrivate &dd, QNode *parent)
- : QAbstractPhysicalDevice(dd, parent)
-{
-}
-
-void QKeyboardController::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
-{
- Q_D(QKeyboardController);
- QBackendScenePropertyChangePtr e = qSharedPointerCast<QBackendScenePropertyChange>(change);
- if (e->type() == NodeUpdated && e->propertyName() == QByteArrayLiteral("activeInput")) {
- QNodeId activeInputId = e->value().value<QNodeId>();
- setActiveInput(qobject_cast<QKeyboardInput *>(d->scene()->lookupNode(activeInputId)));
- }
-}
-
-void QKeyboardController::setActiveInput(QKeyboardInput *activeInput)
-{
- Q_D(QKeyboardController);
- if (d->m_activeInput != activeInput) {
- d->m_activeInput = activeInput;
- emit activeInputChanged(activeInput);
- }
-}
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/frontend/qkeyboardcontroller.h b/src/input/frontend/qkeyboardcontroller.h
deleted file mode 100644
index da57604b4..000000000
--- a/src/input/frontend/qkeyboardcontroller.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_QKEYBOARDCONTROLLER_H
-#define QT3DINPUT_INPUT_QKEYBOARDCONTROLLER_H
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DInput/qabstractphysicaldevice.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QKeyboardControllerPrivate;
-class QKeyboardInput;
-
-class QT3DINPUTSHARED_EXPORT QKeyboardController : public Qt3DInput::QAbstractPhysicalDevice
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DInput::QKeyboardInput *activeInput READ activeInput NOTIFY activeInputChanged)
-
-public:
- explicit QKeyboardController(QNode *parent = Q_NULLPTR);
- ~QKeyboardController();
-
- QKeyboardInput *activeInput() const;
-
- int axisCount() const Q_DECL_FINAL;
- int buttonCount() const Q_DECL_FINAL;
- QStringList axisNames() const Q_DECL_FINAL;
- QStringList buttonNames() const Q_DECL_FINAL;
- int axisIdentifier(const QString &name) const Q_DECL_FINAL;
- int buttonIdentifier(const QString &name) const Q_DECL_FINAL;
-
-protected:
- QKeyboardController(QKeyboardControllerPrivate &dd, QNode *parent = Q_NULLPTR);
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
-
-Q_SIGNALS:
- void activeInputChanged(QKeyboardInput *activeInput);
-
-private:
- Q_DECLARE_PRIVATE(QKeyboardController)
- QT3D_CLONEABLE(QKeyboardController)
- void setActiveInput(QKeyboardInput *activeInput);
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_INPUT_QKEYBOARDCONTROLLER_H
diff --git a/src/input/frontend/qkeyboardcontroller_p.h b/src/input/frontend/qkeyboardcontroller_p.h
deleted file mode 100644
index 06799ff14..000000000
--- a/src/input/frontend/qkeyboardcontroller_p.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_QKEYBOARDCONTROLLER_P_H
-#define QT3DINPUT_INPUT_QKEYBOARDCONTROLLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qabstractphysicaldevice_p.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qstring.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QKeyboardController;
-class QKeyboardInput;
-
-class QKeyboardControllerPrivate : public Qt3DInput::QAbstractPhysicalDevicePrivate
-{
-public:
- QKeyboardControllerPrivate();
-
- Q_DECLARE_PUBLIC(QKeyboardController)
- QKeyboardInput *m_activeInput;
- QHash<QString, int> m_keyMap;
- QStringList m_keyNames;
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_INPUT_QKEYBOARDCONTROLLER_P_H
diff --git a/src/input/frontend/qkeyboarddevice.cpp b/src/input/frontend/qkeyboarddevice.cpp
new file mode 100644
index 000000000..e2ade6efb
--- /dev/null
+++ b/src/input/frontend/qkeyboarddevice.cpp
@@ -0,0 +1,298 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qkeyboarddevice.h"
+#include "qkeyboarddevice_p.h"
+#include "qkeyboardhandler.h"
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+QKeyboardDevicePrivate::QKeyboardDevicePrivate()
+ : QAbstractPhysicalDevicePrivate()
+ , m_activeInput(nullptr)
+{
+ m_keyMap[QStringLiteral("escape")] = Qt::Key_Escape;
+ m_keyMap[QStringLiteral("tab")] = Qt::Key_Tab;
+ m_keyMap[QStringLiteral("backtab")] = Qt::Key_Backtab;
+ m_keyMap[QStringLiteral("backspace")] = Qt::Key_Backspace;
+ m_keyMap[QStringLiteral("return")] = Qt::Key_Return;
+ m_keyMap[QStringLiteral("enter")] = Qt::Key_Enter;
+ m_keyMap[QStringLiteral("insert")] = Qt::Key_Insert;
+ m_keyMap[QStringLiteral("delete")] = Qt::Key_Delete;
+ m_keyMap[QStringLiteral("pause")] = Qt::Key_Pause;
+ m_keyMap[QStringLiteral("print")] = Qt::Key_Print;
+ m_keyMap[QStringLiteral("sysreq")] = Qt::Key_SysReq;
+ m_keyMap[QStringLiteral("clear")] = Qt::Key_Clear;
+ m_keyMap[QStringLiteral("home")] = Qt::Key_Home;
+ m_keyMap[QStringLiteral("end")] = Qt::Key_End;
+ m_keyMap[QStringLiteral("left")] = Qt::Key_Left;
+ m_keyMap[QStringLiteral("right")] = Qt::Key_Right;
+ m_keyMap[QStringLiteral("up")] = Qt::Key_Up;
+ m_keyMap[QStringLiteral("down")] = Qt::Key_Down;
+ m_keyMap[QStringLiteral("pageUp")] = Qt::Key_PageUp;
+ m_keyMap[QStringLiteral("pageDown")] = Qt::Key_PageDown;
+ m_keyMap[QStringLiteral("shift")] = Qt::Key_Shift;
+ m_keyMap[QStringLiteral("control")] = Qt::Key_Control;
+ m_keyMap[QStringLiteral("meta")] = Qt::Key_Meta;
+ m_keyMap[QStringLiteral("alt")] = Qt::Key_Alt;
+ m_keyMap[QStringLiteral("capLock")] = Qt::Key_CapsLock;
+ m_keyMap[QStringLiteral("numLock")] = Qt::Key_NumLock;
+ m_keyMap[QStringLiteral("scrollLock")] = Qt::Key_ScrollLock;
+ m_keyMap[QStringLiteral("F1")] = Qt::Key_F1;
+ m_keyMap[QStringLiteral("F2")] = Qt::Key_F2;
+ m_keyMap[QStringLiteral("F3")] = Qt::Key_F3;
+ m_keyMap[QStringLiteral("F4")] = Qt::Key_F4;
+ m_keyMap[QStringLiteral("F5")] = Qt::Key_F5;
+ m_keyMap[QStringLiteral("F6")] = Qt::Key_F6;
+ m_keyMap[QStringLiteral("F7")] = Qt::Key_F7;
+ m_keyMap[QStringLiteral("F8")] = Qt::Key_F8;
+ m_keyMap[QStringLiteral("F9")] = Qt::Key_F9;
+ m_keyMap[QStringLiteral("F10")] = Qt::Key_F10;
+ m_keyMap[QStringLiteral("F11")] = Qt::Key_F11;
+ m_keyMap[QStringLiteral("F12")] = Qt::Key_F12;
+ m_keyMap[QStringLiteral("F13")] = Qt::Key_F13;
+ m_keyMap[QStringLiteral("F14")] = Qt::Key_F14;
+ m_keyMap[QStringLiteral("F15")] = Qt::Key_F15;
+ m_keyMap[QStringLiteral("F16")] = Qt::Key_F16;
+ m_keyMap[QStringLiteral("F17")] = Qt::Key_F17;
+ m_keyMap[QStringLiteral("F18")] = Qt::Key_F18;
+ m_keyMap[QStringLiteral("F19")] = Qt::Key_F19;
+ m_keyMap[QStringLiteral("F20")] = Qt::Key_F20;
+ m_keyMap[QStringLiteral("F21")] = Qt::Key_F21;
+ m_keyMap[QStringLiteral("F22")] = Qt::Key_F22;
+ m_keyMap[QStringLiteral("F23")] = Qt::Key_F23;
+ m_keyMap[QStringLiteral("F24")] = Qt::Key_F24;
+ m_keyMap[QStringLiteral("F25")] = Qt::Key_F25;
+ m_keyMap[QStringLiteral("F26")] = Qt::Key_F26;
+ m_keyMap[QStringLiteral("F27")] = Qt::Key_F27;
+ m_keyMap[QStringLiteral("F28")] = Qt::Key_F28;
+ m_keyMap[QStringLiteral("F29")] = Qt::Key_F29;
+ m_keyMap[QStringLiteral("F30")] = Qt::Key_F30;
+ m_keyMap[QStringLiteral("F31")] = Qt::Key_F31;
+ m_keyMap[QStringLiteral("F32")] = Qt::Key_F32;
+ m_keyMap[QStringLiteral("F33")] = Qt::Key_F33;
+ m_keyMap[QStringLiteral("F34")] = Qt::Key_F34;
+ m_keyMap[QStringLiteral("F35")] = Qt::Key_F35;
+ m_keyMap[QStringLiteral("superL")] = Qt::Key_Super_L;
+ m_keyMap[QStringLiteral("superR")] = Qt::Key_Super_R;
+ m_keyMap[QStringLiteral("menu")] = Qt::Key_Menu;
+ m_keyMap[QStringLiteral("hyperL")] = Qt::Key_Hyper_L;
+ m_keyMap[QStringLiteral("hyperR")] = Qt::Key_Hyper_R;
+ m_keyMap[QStringLiteral("help")] = Qt::Key_Help;
+ m_keyMap[QStringLiteral("directionL")] = Qt::Key_Direction_L;
+ m_keyMap[QStringLiteral("directionR")] = Qt::Key_Direction_R;
+ m_keyMap[QStringLiteral("space")] = Qt::Key_Space;
+ m_keyMap[QStringLiteral("any")] = Qt::Key_Any;
+ m_keyMap[QStringLiteral("exclam")] = Qt::Key_Exclam;
+ m_keyMap[QStringLiteral("quoteDbl")] = Qt::Key_QuoteDbl;
+ m_keyMap[QStringLiteral("numberSign")] = Qt::Key_NumberSign;
+ m_keyMap[QStringLiteral("dollar")] = Qt::Key_Dollar;
+ m_keyMap[QStringLiteral("percent")] = Qt::Key_Percent;
+ m_keyMap[QStringLiteral("ampersand")] = Qt::Key_Ampersand;
+ m_keyMap[QStringLiteral("apostrophe")] = Qt::Key_Apostrophe;
+ m_keyMap[QStringLiteral("parenLeft")] = Qt::Key_ParenLeft;
+ m_keyMap[QStringLiteral("parenRight")] = Qt::Key_ParenRight;
+ m_keyMap[QStringLiteral("asterisk")] = Qt::Key_Asterisk;
+ m_keyMap[QStringLiteral("plus")] = Qt::Key_Plus;
+ m_keyMap[QStringLiteral("comma")] = Qt::Key_Comma;
+ m_keyMap[QStringLiteral("minus")] = Qt::Key_Minus;
+ m_keyMap[QStringLiteral("period")] = Qt::Key_Period;
+ m_keyMap[QStringLiteral("slash")] = Qt::Key_Slash;
+ m_keyMap[QStringLiteral("0")] = Qt::Key_0;
+ m_keyMap[QStringLiteral("1")] = Qt::Key_1;
+ m_keyMap[QStringLiteral("2")] = Qt::Key_2;
+ m_keyMap[QStringLiteral("3")] = Qt::Key_3;
+ m_keyMap[QStringLiteral("4")] = Qt::Key_4;
+ m_keyMap[QStringLiteral("5")] = Qt::Key_5;
+ m_keyMap[QStringLiteral("6")] = Qt::Key_6;
+ m_keyMap[QStringLiteral("7")] = Qt::Key_7;
+ m_keyMap[QStringLiteral("8")] = Qt::Key_8;
+ m_keyMap[QStringLiteral("9")] = Qt::Key_9;
+ m_keyMap[QStringLiteral("colon")] = Qt::Key_Colon;
+ m_keyMap[QStringLiteral("semiColon")] = Qt::Key_Semicolon;
+ m_keyMap[QStringLiteral("less")] = Qt::Key_Less;
+ m_keyMap[QStringLiteral("equal")] = Qt::Key_Equal;
+ m_keyMap[QStringLiteral("greater")] = Qt::Key_Greater;
+ m_keyMap[QStringLiteral("question")] = Qt::Key_Question;
+ m_keyMap[QStringLiteral("at")] = Qt::Key_At;
+ m_keyMap[QStringLiteral("a")] = Qt::Key_A;
+ m_keyMap[QStringLiteral("b")] = Qt::Key_B;
+ m_keyMap[QStringLiteral("c")] = Qt::Key_C;
+ m_keyMap[QStringLiteral("d")] = Qt::Key_D;
+ m_keyMap[QStringLiteral("e")] = Qt::Key_E;
+ m_keyMap[QStringLiteral("f")] = Qt::Key_F;
+ m_keyMap[QStringLiteral("g")] = Qt::Key_G;
+ m_keyMap[QStringLiteral("h")] = Qt::Key_H;
+ m_keyMap[QStringLiteral("i")] = Qt::Key_I;
+ m_keyMap[QStringLiteral("j")] = Qt::Key_J;
+ m_keyMap[QStringLiteral("k")] = Qt::Key_K;
+ m_keyMap[QStringLiteral("l")] = Qt::Key_L;
+ m_keyMap[QStringLiteral("m")] = Qt::Key_M;
+ m_keyMap[QStringLiteral("n")] = Qt::Key_N;
+ m_keyMap[QStringLiteral("o")] = Qt::Key_O;
+ m_keyMap[QStringLiteral("p")] = Qt::Key_P;
+ m_keyMap[QStringLiteral("q")] = Qt::Key_Q;
+ m_keyMap[QStringLiteral("r")] = Qt::Key_R;
+ m_keyMap[QStringLiteral("s")] = Qt::Key_S;
+ m_keyMap[QStringLiteral("t")] = Qt::Key_T;
+ m_keyMap[QStringLiteral("u")] = Qt::Key_U;
+ m_keyMap[QStringLiteral("v")] = Qt::Key_V;
+ m_keyMap[QStringLiteral("w")] = Qt::Key_W;
+ m_keyMap[QStringLiteral("x")] = Qt::Key_X;
+ m_keyMap[QStringLiteral("y")] = Qt::Key_Y;
+ m_keyMap[QStringLiteral("z")] = Qt::Key_Z;
+ m_keyMap[QStringLiteral("bracketLeft")] = Qt::Key_BracketLeft;
+ m_keyMap[QStringLiteral("backslash")] = Qt::Key_Backslash;
+ m_keyMap[QStringLiteral("bracketRight")] = Qt::Key_BracketRight;
+ m_keyMap[QStringLiteral("asciiCircum")] = Qt::Key_AsciiCircum;
+ m_keyMap[QStringLiteral("underscore")] = Qt::Key_Underscore;
+ m_keyMap[QStringLiteral("quoteLeft")] = Qt::Key_QuoteLeft;
+ m_keyMap[QStringLiteral("braceLeft")] = Qt::Key_BraceLeft;
+ m_keyMap[QStringLiteral("bar")] = Qt::Key_Bar;
+ m_keyMap[QStringLiteral("braceRight")] = Qt::Key_BraceRight;
+ m_keyMap[QStringLiteral("asciiTilde")] = Qt::Key_AsciiTilde;
+ m_keyMap[QStringLiteral("plusminus")] = Qt::Key_plusminus;
+ m_keyMap[QStringLiteral("onesuperior")] = Qt::Key_onesuperior;
+ m_keyMap[QStringLiteral("multiply")] = Qt::Key_multiply;
+ m_keyMap[QStringLiteral("division")] = Qt::Key_division;
+ m_keyMap[QStringLiteral("diaeresis")] = Qt::Key_diaeresis;
+
+ m_keyNames = m_keyMap.keys();
+}
+
+/*!
+ \class Qt3DInput::QKeyboardDevice
+ \inmodule Qt3DInput
+ \since 5.5
+*/
+
+/*!
+ \qmltype KeyboardDevice
+ \inqmlmodule Qt3D.Input
+ \since 5.5
+ \instantiates Qt3DInput::QKeyboardDevice
+ \inherits Node
+*/
+
+QKeyboardDevice::QKeyboardDevice(QNode *parent)
+ : QAbstractPhysicalDevice(*new QKeyboardDevicePrivate, parent)
+{
+}
+
+/*! \internal */
+QKeyboardDevice::~QKeyboardDevice()
+{
+}
+
+/*!
+ \qmlproperty KeyboardHandler Qt3D.Input::KeyboardDevice::activeInput
+ \readonly
+*/
+QKeyboardHandler *QKeyboardDevice::activeInput() const
+{
+ Q_D(const QKeyboardDevice);
+ return d->m_activeInput;
+}
+
+int QKeyboardDevice::axisCount() const
+{
+ return 0;
+}
+
+int QKeyboardDevice::buttonCount() const
+{
+ Q_D(const QKeyboardDevice);
+ return d->m_keyNames.size();
+}
+
+QStringList QKeyboardDevice::axisNames() const
+{
+ return QStringList();
+}
+
+QStringList QKeyboardDevice::buttonNames() const
+{
+ Q_D(const QKeyboardDevice);
+ return d->m_keyNames;
+}
+
+int QKeyboardDevice::axisIdentifier(const QString &name) const
+{
+ Q_UNUSED(name);
+ return 0;
+}
+
+int QKeyboardDevice::buttonIdentifier(const QString &name) const
+{
+ Q_D(const QKeyboardDevice);
+ return d->m_keyMap.value(name, 0);
+}
+
+/*! \internal */
+QKeyboardDevice::QKeyboardDevice(QKeyboardDevicePrivate &dd, QNode *parent)
+ : QAbstractPhysicalDevice(dd, parent)
+{
+}
+
+void QKeyboardDevice::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
+{
+ Q_D(QKeyboardDevice);
+ Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
+ if (e->type() == Qt3DCore::PropertyUpdated && e->propertyName() == QByteArrayLiteral("activeInput")) {
+ Qt3DCore::QNodeId activeInputId = e->value().value<Qt3DCore::QNodeId>();
+ setActiveInput(qobject_cast<QKeyboardHandler *>(d->scene()->lookupNode(activeInputId)));
+ }
+}
+
+void QKeyboardDevice::setActiveInput(QKeyboardHandler *activeInput)
+{
+ Q_D(QKeyboardDevice);
+ if (d->m_activeInput != activeInput) {
+ d->m_activeInput = activeInput;
+ emit activeInputChanged(activeInput);
+ }
+}
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qkeyboarddevice.h b/src/input/frontend/qkeyboarddevice.h
new file mode 100644
index 000000000..a86687769
--- /dev/null
+++ b/src/input/frontend/qkeyboarddevice.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_QKEYBOARDDEVICE_H
+#define QT3DINPUT_INPUT_QKEYBOARDDEVICE_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/QKeyboardHandler>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QKeyboardDevicePrivate;
+class QKeyboardHandler;
+
+class QT3DINPUTSHARED_EXPORT QKeyboardDevice : public Qt3DInput::QAbstractPhysicalDevice
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DInput::QKeyboardHandler *activeInput READ activeInput NOTIFY activeInputChanged)
+
+public:
+ explicit QKeyboardDevice(QNode *parent = nullptr);
+ ~QKeyboardDevice();
+
+ QKeyboardHandler *activeInput() const;
+
+ int axisCount() const Q_DECL_FINAL;
+ int buttonCount() const Q_DECL_FINAL;
+ QStringList axisNames() const Q_DECL_FINAL;
+ QStringList buttonNames() const Q_DECL_FINAL;
+ int axisIdentifier(const QString &name) const Q_DECL_FINAL;
+ int buttonIdentifier(const QString &name) const Q_DECL_FINAL;
+
+protected:
+ explicit QKeyboardDevice(QKeyboardDevicePrivate &dd, QNode *parent = nullptr);
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void activeInputChanged(QKeyboardHandler *activeInput);
+
+private:
+ Q_DECLARE_PRIVATE(QKeyboardDevice)
+ void setActiveInput(QKeyboardHandler *activeInput);
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_QKEYBOARDDEVICE_H
diff --git a/src/input/frontend/qkeyboarddevice_p.h b/src/input/frontend/qkeyboarddevice_p.h
new file mode 100644
index 000000000..e05f7549b
--- /dev/null
+++ b/src/input/frontend/qkeyboarddevice_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_QKEYBOARDDEVICE_P_H
+#define QT3DINPUT_INPUT_QKEYBOARDDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qabstractphysicaldevice_p.h>
+#include <Qt3DCore/qnodeid.h>
+#include <QtCore/qhash.h>
+#include <QtCore/qstring.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QKeyboardDevice;
+class QKeyboardHandler;
+
+class QKeyboardDevicePrivate : public Qt3DInput::QAbstractPhysicalDevicePrivate
+{
+public:
+ QKeyboardDevicePrivate();
+
+ Q_DECLARE_PUBLIC(QKeyboardDevice)
+ QKeyboardHandler *m_activeInput;
+ QHash<QString, int> m_keyMap;
+ QStringList m_keyNames;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_QKEYBOARDDEVICE_P_H
diff --git a/src/input/frontend/qkeyboardhandler.cpp b/src/input/frontend/qkeyboardhandler.cpp
new file mode 100644
index 000000000..a55e8ce9e
--- /dev/null
+++ b/src/input/frontend/qkeyboardhandler.cpp
@@ -0,0 +1,420 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qkeyboardhandler.h"
+#include "qkeyboardhandler_p.h"
+#include "qkeyboarddevice.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DInput {
+
+namespace {
+
+
+// SigMap and the sigMap table are taken from QQ2 QQuickKeysAttached
+struct SigMap {
+ int key;
+ const char *sig;
+};
+
+const SigMap sigMap[] = {
+ { Qt::Key_Left, "leftPressed" },
+ { Qt::Key_Right, "rightPressed" },
+ { Qt::Key_Up, "upPressed" },
+ { Qt::Key_Down, "downPressed" },
+ { Qt::Key_Tab, "tabPressed" },
+ { Qt::Key_Backtab, "backtabPressed" },
+ { Qt::Key_Asterisk, "asteriskPressed" },
+ { Qt::Key_NumberSign, "numberSignPressed" },
+ { Qt::Key_Escape, "escapePressed" },
+ { Qt::Key_Return, "returnPressed" },
+ { Qt::Key_Enter, "enterPressed" },
+ { Qt::Key_Delete, "deletePressed" },
+ { Qt::Key_Space, "spacePressed" },
+ { Qt::Key_Back, "backPressed" },
+ { Qt::Key_Cancel, "cancelPressed" },
+ { Qt::Key_Select, "selectPressed" },
+ { Qt::Key_Yes, "yesPressed" },
+ { Qt::Key_No, "noPressed" },
+ { Qt::Key_Context1, "context1Pressed" },
+ { Qt::Key_Context2, "context2Pressed" },
+ { Qt::Key_Context3, "context3Pressed" },
+ { Qt::Key_Context4, "context4Pressed" },
+ { Qt::Key_Call, "callPressed" },
+ { Qt::Key_Hangup, "hangupPressed" },
+ { Qt::Key_Flip, "flipPressed" },
+ { Qt::Key_Menu, "menuPressed" },
+ { Qt::Key_VolumeUp, "volumeUpPressed" },
+ { Qt::Key_VolumeDown, "volumeDownPressed" },
+ { 0, 0 }
+};
+
+const QByteArray keyToSignal(int key)
+{
+ QByteArray keySignal;
+ if (key >= Qt::Key_0 && key <= Qt::Key_9) {
+ keySignal = "digit0Pressed";
+ keySignal[5] = '0' + (key - Qt::Key_0);
+ } else {
+ int i = 0;
+ while (sigMap[i].key && sigMap[i].key != key)
+ ++i;
+ keySignal = sigMap[i].sig;
+ }
+ return keySignal;
+}
+
+} // anonymous
+
+QKeyboardHandlerPrivate::QKeyboardHandlerPrivate()
+ : QComponentPrivate()
+ , m_keyboardDevice(nullptr)
+ , m_focus(false)
+{
+ m_shareable = false;
+}
+
+QKeyboardHandlerPrivate::~QKeyboardHandlerPrivate()
+{
+}
+
+void QKeyboardHandlerPrivate::keyEvent(QKeyEvent *event)
+{
+ Q_Q(QKeyboardHandler);
+ if (event->type() == QEvent::KeyPress) {
+ emit q->pressed(event);
+
+ QByteArray keySignal = keyToSignal(event->key());
+ if (!keySignal.isEmpty()) {
+ keySignal += "(Qt3DInput::QKeyEvent*)";
+ // TO DO: Finding if the signal is connected to anything before doing the invocation
+ // could be an improvement
+ // That's what QQ2 does but since it accesses QML private classes to do so, that may not be
+ // applicable in our case
+ int idx = QKeyboardHandler::staticMetaObject.indexOfSignal(keySignal);
+ q->metaObject()->method(idx).invoke(q, Qt::DirectConnection, Q_ARG(QKeyEvent *, event));
+ }
+ } else if (event->type() == QEvent::KeyRelease) {
+ emit q->released(event);
+ }
+}
+
+
+/*!
+ \class Qt3DInput::QKeyboardHandler
+ \inmodule Qt3DInput
+ \since 5.5
+*/
+
+/*!
+ \qmltype KeyboardHandler
+ \inqmlmodule Qt3D.Input
+ \instantiates Qt3DInput::QKeyboardHandler
+ \inherits Component3D
+ \since 5.5
+*/
+
+/*!
+ Constructs a new QKeyboardHandler instance with parent \a parent.
+ */
+QKeyboardHandler::QKeyboardHandler(QNode *parent)
+ : QComponent(*new QKeyboardHandlerPrivate, parent)
+{
+}
+
+/*! \internal */
+QKeyboardHandler::~QKeyboardHandler()
+{
+}
+
+void QKeyboardHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
+{
+ Q_D(QKeyboardHandler);
+ QPropertyUpdatedChangePtr e = qSharedPointerCast<QPropertyUpdatedChange>(change);
+ if (e->type() == PropertyUpdated) {
+ if (e->propertyName() == QByteArrayLiteral("focus")) {
+ bool block = blockNotifications(true);
+ setFocus(e->value().toBool());
+ blockNotifications(block);
+ } else if (e->propertyName() == QByteArrayLiteral("event")) {
+ QKeyEventPtr ev = e->value().value<QKeyEventPtr>();
+ d->keyEvent(ev.data());
+ }
+ }
+}
+
+/*!
+ \qmlproperty KeyboardDevice Qt3D.Input::KeyboardHandler::device
+*/
+
+/*!
+ Sets the keyboard device to \a keyboardDevice. Without a valid device,
+ the QKeyboardHandler won't receive any event.
+ */
+void QKeyboardHandler::setSourceDevice(QKeyboardDevice *keyboardDevice)
+{
+ Q_D(QKeyboardHandler);
+ if (d->m_keyboardDevice != keyboardDevice) {
+
+ if (keyboardDevice && !keyboardDevice->parent())
+ keyboardDevice->setParent(this);
+
+ d->m_keyboardDevice = keyboardDevice;
+ emit sourceDeviceChanged(keyboardDevice);
+ }
+}
+
+/*!
+ Returns the current keyboard device.
+ */
+QKeyboardDevice *QKeyboardHandler::sourceDevice() const
+{
+ Q_D(const QKeyboardHandler);
+ return d->m_keyboardDevice;
+}
+
+/*!
+ \qmlproperty bool Qt3D.Input::KeyboardHandler::focus
+*/
+
+/*!
+ Returns the current focus.
+ */
+bool QKeyboardHandler::focus() const
+{
+ Q_D(const QKeyboardHandler);
+ return d->m_focus;
+}
+
+/*!
+ Sets the focus to \a focus. If focus is not currently set to \c true,
+ this component will receive keyboard focus.
+ */
+void QKeyboardHandler::setFocus(bool focus)
+{
+ Q_D(QKeyboardHandler);
+ if (d->m_focus != focus) {
+ d->m_focus = focus;
+ emit focusChanged(focus);
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QKeyboardHandler::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QKeyboardHandlerData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QKeyboardHandler);
+ data.keyboardDeviceId = qIdForNode(d->m_keyboardDevice);
+ data.focus = d->m_focus;
+
+ return creationChange;
+}
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit0Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit1Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit2Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit3Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit4Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit5Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit6Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit7Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit8Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::digit9Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::leftPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::rightPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::upPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::downPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::tabPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::backtabPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::asteriskPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::numberSignPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::backtabPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::escapePressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::returnPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::enterPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::deletePressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::spacePressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::backPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::cancelPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::selectPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::yesPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::noPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::context1Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::context2Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::context3Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::context4Pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::callPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::hangupPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::flipPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::menuPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::volumeUpPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::volumeDownPressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::pressed(KeyEvent event)
+*/
+
+/*!
+ \qmlsignal Qt3D.Input::KeyboardHandler::released(KeyEvent event)
+*/
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qkeyboardhandler.h b/src/input/frontend/qkeyboardhandler.h
new file mode 100644
index 000000000..ba1959bfe
--- /dev/null
+++ b/src/input/frontend/qkeyboardhandler.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_QKEYBOARDHANDLER_H
+#define QT3DINPUT_INPUT_QKEYBOARDHANDLER_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DInput/qkeyevent.h>
+#include <Qt3DCore/qcomponent.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QKeyboardDevice;
+class QKeyboardHandlerPrivate;
+
+class QT3DINPUTSHARED_EXPORT QKeyboardHandler : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DInput::QKeyboardDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
+ Q_PROPERTY(bool focus READ focus WRITE setFocus NOTIFY focusChanged)
+public:
+ explicit QKeyboardHandler(QNode *parent = nullptr);
+ ~QKeyboardHandler();
+
+ Qt3DInput::QKeyboardDevice *sourceDevice() const;
+ bool focus() const;
+
+public Q_SLOTS:
+ void setSourceDevice(Qt3DInput::QKeyboardDevice *keyboardDevice);
+ void setFocus(bool focus);
+
+Q_SIGNALS:
+ void sourceDeviceChanged(QKeyboardDevice *keyboardDevice);
+ void focusChanged(bool focus);
+
+ void digit0Pressed(Qt3DInput::QKeyEvent *event);
+ void digit1Pressed(Qt3DInput::QKeyEvent *event);
+ void digit2Pressed(Qt3DInput::QKeyEvent *event);
+ void digit3Pressed(Qt3DInput::QKeyEvent *event);
+ void digit4Pressed(Qt3DInput::QKeyEvent *event);
+ void digit5Pressed(Qt3DInput::QKeyEvent *event);
+ void digit6Pressed(Qt3DInput::QKeyEvent *event);
+ void digit7Pressed(Qt3DInput::QKeyEvent *event);
+ void digit8Pressed(Qt3DInput::QKeyEvent *event);
+ void digit9Pressed(Qt3DInput::QKeyEvent *event);
+
+ void leftPressed(Qt3DInput::QKeyEvent *event);
+ void rightPressed(Qt3DInput::QKeyEvent *event);
+ void upPressed(Qt3DInput::QKeyEvent *event);
+ void downPressed(Qt3DInput::QKeyEvent *event);
+ void tabPressed(Qt3DInput::QKeyEvent *event);
+ void backtabPressed(Qt3DInput::QKeyEvent *event);
+
+ void asteriskPressed(Qt3DInput::QKeyEvent *event);
+ void numberSignPressed(Qt3DInput::QKeyEvent *event);
+ void escapePressed(Qt3DInput::QKeyEvent *event);
+ void returnPressed(Qt3DInput::QKeyEvent *event);
+ void enterPressed(Qt3DInput::QKeyEvent *event);
+ void deletePressed(Qt3DInput::QKeyEvent *event);
+ void spacePressed(Qt3DInput::QKeyEvent *event);
+ void backPressed(Qt3DInput::QKeyEvent *event);
+ void cancelPressed(Qt3DInput::QKeyEvent *event);
+ void selectPressed(Qt3DInput::QKeyEvent *event);
+ void yesPressed(Qt3DInput::QKeyEvent *event);
+ void noPressed(Qt3DInput::QKeyEvent *event);
+ void context1Pressed(Qt3DInput::QKeyEvent *event);
+ void context2Pressed(Qt3DInput::QKeyEvent *event);
+ void context3Pressed(Qt3DInput::QKeyEvent *event);
+ void context4Pressed(Qt3DInput::QKeyEvent *event);
+ void callPressed(Qt3DInput::QKeyEvent *event);
+ void hangupPressed(Qt3DInput::QKeyEvent *event);
+ void flipPressed(Qt3DInput::QKeyEvent *event);
+ void menuPressed(Qt3DInput::QKeyEvent *event);
+ void volumeUpPressed(Qt3DInput::QKeyEvent *event);
+ void volumeDownPressed(Qt3DInput::QKeyEvent *event);
+
+ void pressed(Qt3DInput::QKeyEvent *event);
+ void released(Qt3DInput::QKeyEvent *event);
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QKeyboardHandler)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_QKEYBOARDHANDLER_H
diff --git a/src/input/frontend/qkeyboardhandler_p.h b/src/input/frontend/qkeyboardhandler_p.h
new file mode 100644
index 000000000..339d36d26
--- /dev/null
+++ b/src/input/frontend/qkeyboardhandler_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_QKEYBOARDHANDLER_P_H
+#define QT3DINPUT_INPUT_QKEYBOARDHANDLER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qcomponent_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QKeyboardHandler;
+class QKeyboardDevice;
+
+class QKeyboardHandlerPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QKeyboardHandlerPrivate();
+ ~QKeyboardHandlerPrivate();
+
+ void keyEvent(QKeyEvent *event);
+
+ Q_DECLARE_PUBLIC(QKeyboardHandler)
+ QKeyboardDevice *m_keyboardDevice;
+ bool m_focus;
+};
+
+struct QKeyboardHandlerData
+{
+ Qt3DCore::QNodeId keyboardDeviceId;
+ bool focus;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_INPUT_QKEYBOARDHANDLER_P_H
diff --git a/src/input/frontend/qkeyboardinput.cpp b/src/input/frontend/qkeyboardinput.cpp
deleted file mode 100644
index 583cb1bd3..000000000
--- a/src/input/frontend/qkeyboardinput.cpp
+++ /dev/null
@@ -1,410 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qkeyboardinput.h"
-#include "qkeyboardinput_p.h"
-#include "qkeyboardcontroller.h"
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DInput {
-
-QKeyboardInputPrivate::QKeyboardInputPrivate()
- : QComponentPrivate()
- , m_controller(Q_NULLPTR)
- , m_focus(false)
-{
- m_shareable = false;
-}
-
-/*!
- \class Qt3DInput::QKeyboardInput
- \inmodule Qt3DInput
- \since 5.5
-*/
-
-/*!
- \qmltype KeyboardInput
- \inqmlmodule Qt3D.Input
- \instantiates Qt3DInput::QKeyboardInput
- \inherits Component3D
- \since 5.5
-*/
-
-/*!
- Constructs a new QKeyboardInput instance with parent \a parent.
- */
-QKeyboardInput::QKeyboardInput(QNode *parent)
- : QComponent(*new QKeyboardInputPrivate, parent)
-{
-}
-
-QKeyboardInput::~QKeyboardInput()
-{
- QNode::cleanup();
-}
-
-/*! \internal */
-QKeyboardInput::QKeyboardInput(QKeyboardInputPrivate &dd, QNode *parent)
- : QComponent(dd, parent)
-{
-}
-
-void QKeyboardInput::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QKeyboardInput *input = static_cast<const QKeyboardInput *>(ref);
-
- // TO DO: We may want to store the controller id and only send a clone when we are the parent
- // of the controller
- if (input->d_func()->m_controller != Q_NULLPTR && input->d_func()->m_controller->parent() == ref)
- setController(qobject_cast<QKeyboardController *>(QNode::clone(input->d_func()->m_controller)));
-}
-
-// SigMap and the sigMap table are taken from QQ2 QQuickKeysAttached
-struct SigMap {
- int key;
- const char *sig;
-};
-
-const SigMap sigMap[] = {
- { Qt::Key_Left, "leftPressed" },
- { Qt::Key_Right, "rightPressed" },
- { Qt::Key_Up, "upPressed" },
- { Qt::Key_Down, "downPressed" },
- { Qt::Key_Tab, "tabPressed" },
- { Qt::Key_Backtab, "backtabPressed" },
- { Qt::Key_Asterisk, "asteriskPressed" },
- { Qt::Key_NumberSign, "numberSignPressed" },
- { Qt::Key_Escape, "escapePressed" },
- { Qt::Key_Return, "returnPressed" },
- { Qt::Key_Enter, "enterPressed" },
- { Qt::Key_Delete, "deletePressed" },
- { Qt::Key_Space, "spacePressed" },
- { Qt::Key_Back, "backPressed" },
- { Qt::Key_Cancel, "cancelPressed" },
- { Qt::Key_Select, "selectPressed" },
- { Qt::Key_Yes, "yesPressed" },
- { Qt::Key_No, "noPressed" },
- { Qt::Key_Context1, "context1Pressed" },
- { Qt::Key_Context2, "context2Pressed" },
- { Qt::Key_Context3, "context3Pressed" },
- { Qt::Key_Context4, "context4Pressed" },
- { Qt::Key_Call, "callPressed" },
- { Qt::Key_Hangup, "hangupPressed" },
- { Qt::Key_Flip, "flipPressed" },
- { Qt::Key_Menu, "menuPressed" },
- { Qt::Key_VolumeUp, "volumeUpPressed" },
- { Qt::Key_VolumeDown, "volumeDownPressed" },
- { 0, 0 }
-};
-
-const QByteArray keyToSignal(int key)
-{
- QByteArray keySignal;
- if (key >= Qt::Key_0 && key <= Qt::Key_9) {
- keySignal = "digit0Pressed";
- keySignal[5] = '0' + (key - Qt::Key_0);
- } else {
- int i = 0;
- while (sigMap[i].key && sigMap[i].key != key)
- ++i;
- keySignal = sigMap[i].sig;
- }
- return keySignal;
-}
-
-void QKeyboardInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
-{
- QBackendScenePropertyChangePtr e = qSharedPointerCast<QBackendScenePropertyChange>(change);
- if (e->type() == NodeUpdated) {
- if (e->propertyName() == QByteArrayLiteral("focus")) {
- bool block = blockNotifications(true);
- setFocus(e->value().toBool());
- blockNotifications(block);
- } else if (e->propertyName() == QByteArrayLiteral("event")) {
- QKeyEventPtr ev = e->value().value<QKeyEventPtr>();
- keyEvent(ev.data());
- }
- }
-}
-
-void QKeyboardInput::keyEvent(QKeyEvent *event)
-{
- if (event->type() == QEvent::KeyPress) {
- emit pressed(event);
-
- QByteArray keySignal = keyToSignal(event->key());
- if (!keySignal.isEmpty()) {
- keySignal += "(Qt3DInput::QKeyEvent*)";
- // TO DO: Finding if the signal is connected to anything before doing the invocation
- // could be an improvement
- // That's what QQ2 does but since it accesses QML private classes to do so, that may not be
- // applicable in our case
- int idx = QKeyboardInput::staticMetaObject.indexOfSignal(keySignal);
- metaObject()->method(idx).invoke(this, Qt::DirectConnection, Q_ARG(QKeyEvent *, event));
- }
- } else if (event->type() == QEvent::KeyRelease) {
- emit released(event);
- }
-}
-
-/*!
- \qmlproperty KeyboardController Qt3D.Input::KeyboardInput::controller
-*/
-
-/*!
- Sets the keyboard controller to \a controller. Without a valid controller,
- the QKeyboardInput won't receive any event.
- */
-void QKeyboardInput::setController(QKeyboardController *controller)
-{
- Q_D(QKeyboardInput);
- if (d->m_controller != controller) {
-
- if (controller && !controller->parent())
- controller->setParent(this);
-
- d->m_controller = controller;
- emit controllerChanged(controller);
- }
-}
-
-/*!
- Returns the current keyboard controller.
- */
-QKeyboardController *QKeyboardInput::controller() const
-{
- Q_D(const QKeyboardInput);
- return d->m_controller;
-}
-
-/*!
- \qmlproperty bool Qt3D.Input::KeyboardInput::focus
-*/
-
-/*!
- Returns the current focus.
- */
-bool QKeyboardInput::focus() const
-{
- Q_D(const QKeyboardInput);
- return d->m_focus;
-}
-
-/*!
- Sets the focus to \a focus. If focus is not currently set to \c true,
- this component will receive keyboard focus.
- */
-void QKeyboardInput::setFocus(bool focus)
-{
- Q_D(QKeyboardInput);
- if (d->m_focus != focus) {
- d->m_focus = focus;
- emit focusChanged(focus);
- }
-}
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit0Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit1Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit2Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit3Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit4Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit5Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit6Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit7Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit8Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::digit9Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::leftPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::rightPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::upPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::downPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::tabPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::backtabPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::asteriskPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::numberSignPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::backtabPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::escapePressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::returnPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::enterPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::deletePressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::spacePressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::backPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::cancelPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::selectPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::yesPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::noPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::context1Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::context2Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::context3Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::context4Pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::callPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::hangupPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::flipPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::menuPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::volumeUpPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::volumeDownPressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::pressed(KeyEvent event)
-*/
-
-/*!
- \qmlsignal Qt3D.Input::KeyboardInput::released(KeyEvent event)
-*/
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/frontend/qkeyboardinput.h b/src/input/frontend/qkeyboardinput.h
deleted file mode 100644
index 0640ffc45..000000000
--- a/src/input/frontend/qkeyboardinput.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_QKEYBOARDINPUT_H
-#define QT3DINPUT_INPUT_QKEYBOARDINPUT_H
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DInput/qkeyevent.h>
-#include <Qt3DCore/qcomponent.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QKeyboardController;
-class QKeyboardInputPrivate;
-
-class QT3DINPUTSHARED_EXPORT QKeyboardInput : public Qt3DCore::QComponent
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DInput::QKeyboardController *controller READ controller WRITE setController NOTIFY controllerChanged)
- Q_PROPERTY(bool focus READ focus WRITE setFocus NOTIFY focusChanged)
-public:
- explicit QKeyboardInput(QNode *parent = Q_NULLPTR);
- ~QKeyboardInput();
-
- QKeyboardController *controller() const;
- bool focus() const;
-
-public Q_SLOTS:
- void setController(QKeyboardController *controller);
- void setFocus(bool focus);
-
-Q_SIGNALS:
- void controllerChanged(QKeyboardController *controller);
- void focusChanged(bool focus);
-
- void digit0Pressed(Qt3DInput::QKeyEvent *event);
- void digit1Pressed(Qt3DInput::QKeyEvent *event);
- void digit2Pressed(Qt3DInput::QKeyEvent *event);
- void digit3Pressed(Qt3DInput::QKeyEvent *event);
- void digit4Pressed(Qt3DInput::QKeyEvent *event);
- void digit5Pressed(Qt3DInput::QKeyEvent *event);
- void digit6Pressed(Qt3DInput::QKeyEvent *event);
- void digit7Pressed(Qt3DInput::QKeyEvent *event);
- void digit8Pressed(Qt3DInput::QKeyEvent *event);
- void digit9Pressed(Qt3DInput::QKeyEvent *event);
-
- void leftPressed(Qt3DInput::QKeyEvent *event);
- void rightPressed(Qt3DInput::QKeyEvent *event);
- void upPressed(Qt3DInput::QKeyEvent *event);
- void downPressed(Qt3DInput::QKeyEvent *event);
- void tabPressed(Qt3DInput::QKeyEvent *event);
- void backtabPressed(Qt3DInput::QKeyEvent *event);
-
- void asteriskPressed(Qt3DInput::QKeyEvent *event);
- void numberSignPressed(Qt3DInput::QKeyEvent *event);
- void escapePressed(Qt3DInput::QKeyEvent *event);
- void returnPressed(Qt3DInput::QKeyEvent *event);
- void enterPressed(Qt3DInput::QKeyEvent *event);
- void deletePressed(Qt3DInput::QKeyEvent *event);
- void spacePressed(Qt3DInput::QKeyEvent *event);
- void backPressed(Qt3DInput::QKeyEvent *event);
- void cancelPressed(Qt3DInput::QKeyEvent *event);
- void selectPressed(Qt3DInput::QKeyEvent *event);
- void yesPressed(Qt3DInput::QKeyEvent *event);
- void noPressed(Qt3DInput::QKeyEvent *event);
- void context1Pressed(Qt3DInput::QKeyEvent *event);
- void context2Pressed(Qt3DInput::QKeyEvent *event);
- void context3Pressed(Qt3DInput::QKeyEvent *event);
- void context4Pressed(Qt3DInput::QKeyEvent *event);
- void callPressed(Qt3DInput::QKeyEvent *event);
- void hangupPressed(Qt3DInput::QKeyEvent *event);
- void flipPressed(Qt3DInput::QKeyEvent *event);
- void menuPressed(Qt3DInput::QKeyEvent *event);
- void volumeUpPressed(Qt3DInput::QKeyEvent *event);
- void volumeDownPressed(Qt3DInput::QKeyEvent *event);
-
- void pressed(Qt3DInput::QKeyEvent *event);
- void released(Qt3DInput::QKeyEvent *event);
-
-protected:
- QKeyboardInput(QKeyboardInputPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
- void keyEvent(QKeyEvent *event);
-
-private:
- Q_DECLARE_PRIVATE(QKeyboardInput)
- QT3D_CLONEABLE(QKeyboardInput)
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_INPUT_QKEYBOARDINPUT_H
diff --git a/src/input/frontend/qkeyboardinput_p.h b/src/input/frontend/qkeyboardinput_p.h
deleted file mode 100644
index 7ee0560b6..000000000
--- a/src/input/frontend/qkeyboardinput_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_INPUT_QKEYBOARDINPUT_P_H
-#define QT3DINPUT_INPUT_QKEYBOARDINPUT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qcomponent_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QKeyboardInput;
-class QKeyboardController;
-
-class QKeyboardInputPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QKeyboardInputPrivate();
-
- Q_DECLARE_PUBLIC(QKeyboardInput)
- QKeyboardController *m_controller;
- bool m_focus;
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_INPUT_QKEYBOARDINPUT_P_H
diff --git a/src/input/frontend/qkeyevent.cpp b/src/input/frontend/qkeyevent.cpp
index 229bbd57d..d3b346da0 100644
--- a/src/input/frontend/qkeyevent.cpp
+++ b/src/input/frontend/qkeyevent.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,7 +58,7 @@ namespace Qt3DInput {
\since 5.5
The KeyEvent QML type cannot be directly created. Objects of this type
- are used as signal parameters in KeyboardInput.
+ are used as signal parameters in KeyboardHandler.
*/
QKeyEvent::QKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text, bool autorep, ushort count)
@@ -72,6 +75,11 @@ QKeyEvent::QKeyEvent(const QT_PREPEND_NAMESPACE(QKeyEvent) &ke)
m_event.setAccepted(false);
}
+/*! \internal */
+QKeyEvent::~QKeyEvent()
+{
+}
+
/*!
\qmlproperty int Qt3D.Input::KeyEvent::key
\readonly
diff --git a/src/input/frontend/qkeyevent.h b/src/input/frontend/qkeyevent.h
index ee246e828..0978a45e7 100644
--- a/src/input/frontend/qkeyevent.h
+++ b/src/input/frontend/qkeyevent.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,8 +65,9 @@ class QT3DINPUTSHARED_EXPORT QKeyEvent : public QObject
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
public:
- QKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1);
- QKeyEvent(const QT_PREPEND_NAMESPACE(QKeyEvent) &ke);
+ explicit QKeyEvent(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, ushort count=1);
+ explicit QKeyEvent(const QT_PREPEND_NAMESPACE(QKeyEvent) &ke);
+ ~QKeyEvent();
inline int key() const { return m_event.key(); }
inline QString text() const { return m_event.text(); }
diff --git a/src/input/frontend/qlogicaldevice.cpp b/src/input/frontend/qlogicaldevice.cpp
index 5d92e27f3..f84b45001 100644
--- a/src/input/frontend/qlogicaldevice.cpp
+++ b/src/input/frontend/qlogicaldevice.cpp
@@ -1,86 +1,167 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qlogicaldevice.h"
-#include <Qt3DCore/private/qnode_p.h>
+#include "qlogicaldevice_p.h"
#include <Qt3DInput/qaction.h>
#include <Qt3DInput/qaxis.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
namespace Qt3DInput {
-class QLogicalDevicePrivate : public Qt3DCore::QNodePrivate
+QLogicalDevicePrivate::QLogicalDevicePrivate()
+ : Qt3DCore::QComponentPrivate()
{
-public:
- QLogicalDevicePrivate()
- : Qt3DCore::QNodePrivate()
- {}
+}
- QVector<QAction *> m_actions;
- QVector<QAxis *> m_axes;
-};
+QLogicalDevicePrivate::~QLogicalDevicePrivate()
+{
+}
/*!
- * \qmltype LogicalDevice
- * \inqmlmodule Qt3D.Input
- * \since 5.5
- * \TODO
- *
- */
+ \class Qt3DInput::QLogicalDevice
+ \inmodule Qt3DInput
+ \inherits Qt3DCore::QNode
+ \brief QLogicalDevice allows the user to define a set of actions that they wish to use within an application.
+
+ \since 5.6
+*/
/*!
- * \class Qt3DInput::QLogicalDevice
- * \inmodule Qt3DInput
- * \since 5.5
- * \TODO
- *
- */
+ \qmltype LogicalDevice
+ \inqmlmodule Qt3D.Input
+ \instantiates Qt3DInput::QLogicalDevice
+ \brief QML frontend for the Qt3DInput::QLogicalDevice C++ class.
+
+ Allows the user to define a set of actions that they wish to use within an application.
+
+ \qml
+ LogicalDevice {
+ id: keyboardLogicalDevice
+ actions: [
+ Action {
+ name: "fire"
+ inputs: [
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_Space]
+ },
+ InputChord {
+ tolerance: 10
+ inputs: [
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_A]
+ },
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_S]
+ }
+ ]
+ },
+ ]
+ },
+ Action {
+ name: "reload"
+ inputs: [
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_Alt]
+ }
+ ]
+ }
+ Action {
+ name: "combo"
+ inputs: [
+ InputSequence {
+ interval: 1000
+ timeout: 10000
+ inputs: [
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_G]
+ },
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_D]
+ },
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ keys: [Qt.Key_J]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ \endqml
+
+ \since 5.6
+*/
+
+/*!
+ Constructs a new QLogicalDevice instance with parent \a parent.
+ */
QLogicalDevice::QLogicalDevice(Qt3DCore::QNode *parent)
- : Qt3DCore::QNode(*new QLogicalDevicePrivate(), parent)
+ : Qt3DCore::QComponent(*new QLogicalDevicePrivate(), parent)
{
}
QLogicalDevice::~QLogicalDevice()
{
- QNode::cleanup();
}
+/*!
+ \qmlproperty QQmlListProperty<Action> Qt3D.Input::LogicalDevice::actions
+
+ The actions used by this Logical Device
+*/
+
+/*!
+ Add an action to the list of actions.
+ */
void QLogicalDevice::addAction(QAction *action)
{
Q_D(QLogicalDevice);
@@ -90,24 +171,25 @@ void QLogicalDevice::addAction(QAction *action)
if (!action->parent())
action->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- Qt3DCore::QScenePropertyChangePtr change(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), action);
change->setPropertyName("action");
- change->setValue(QVariant::fromValue(action->id()));
d->notifyObservers(change);
}
}
}
+/*!
+ Remove an action from the list of actions.
+ */
void QLogicalDevice::removeAction(QAction *action)
{
Q_D(QLogicalDevice);
if (d->m_actions.contains(action)) {
- if (d->m_changeArbiter != Q_NULLPTR) {
- Qt3DCore::QScenePropertyChangePtr change(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), action);
change->setPropertyName("action");
- change->setValue(QVariant::fromValue(action->id()));
d->notifyObservers(change);
}
@@ -115,12 +197,24 @@ void QLogicalDevice::removeAction(QAction *action)
}
}
+/*!
+ Returns the list of actions.
+ */
QVector<QAction *> QLogicalDevice::actions() const
{
Q_D(const QLogicalDevice);
return d->m_actions;
}
+/*!
+ \qmlproperty QQmlListProperty<Axis> Qt3D.Input::LogicalDevice::axis
+
+ The axis used by this Logical Device
+*/
+
+/*!
+ Add an axis to the list of axis.
+ */
void QLogicalDevice::addAxis(QAxis *axis)
{
Q_D(QLogicalDevice);
@@ -131,23 +225,24 @@ void QLogicalDevice::addAxis(QAxis *axis)
if (!axis->parent())
axis->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- Qt3DCore::QScenePropertyChangePtr change(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), axis);
change->setPropertyName("axis");
- change->setValue(QVariant::fromValue(axis->id()));
d->notifyObservers(change);
}
}
}
+/*!
+ Remove an axis drom the list of axis.
+ */
void QLogicalDevice::removeAxis(QAxis *axis)
{
Q_D(QLogicalDevice);
if (d->m_axes.contains(axis)) {
- if (d->m_changeArbiter != Q_NULLPTR) {
- Qt3DCore::QScenePropertyChangePtr change(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), axis);
change->setPropertyName("axis");
- change->setValue(QVariant::fromValue(axis->id()));
d->notifyObservers(change);
}
@@ -155,20 +250,22 @@ void QLogicalDevice::removeAxis(QAxis *axis)
}
}
+/*!
+ Returns the list of axis.
+ */
QVector<QAxis *> QLogicalDevice::axes() const
{
Q_D(const QLogicalDevice);
return d->m_axes;
}
-void QLogicalDevice::copy(const Qt3DCore::QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QLogicalDevice::createNodeCreationChange() const
{
- QNode::copy(ref);
- const QLogicalDevice *device = static_cast<const QLogicalDevice *>(ref);
- Q_FOREACH (QAction *action, device->actions())
- d_func()->m_actions.push_back(qobject_cast<QAction *>(QNode::clone(action)));
- Q_FOREACH (QAxis *axis, device->axes())
- d_func()->m_axes.push_back(qobject_cast<QAxis *>(QNode::clone(axis)));
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QLogicalDeviceData>::create(this);
+ auto &data = creationChange->data;
+ data.actionIds = qIdsForNodes(actions());
+ data.axisIds = qIdsForNodes(axes());
+ return creationChange;
}
} // Qt3DInput
diff --git a/src/input/frontend/qlogicaldevice.h b/src/input/frontend/qlogicaldevice.h
index fb3ed35ac..f60cfe2b1 100644
--- a/src/input/frontend/qlogicaldevice.h
+++ b/src/input/frontend/qlogicaldevice.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,7 +41,7 @@
#define QT3DINPUT_QLOGICALDEVICE_H
#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qcomponent.h>
QT_BEGIN_NAMESPACE
@@ -48,11 +51,11 @@ class QLogicalDevicePrivate;
class QAction;
class QAxis;
-class QT3DINPUTSHARED_EXPORT QLogicalDevice : public Qt3DCore::QNode
+class QT3DINPUTSHARED_EXPORT QLogicalDevice : public Qt3DCore::QComponent
{
Q_OBJECT
public:
- explicit QLogicalDevice(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QLogicalDevice(Qt3DCore::QNode *parent = nullptr);
~QLogicalDevice();
void addAction(QAction *action);
@@ -63,12 +66,9 @@ public:
void removeAxis(QAxis *axis);
QVector<QAxis *> axes() const;
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QLogicalDevice)
- QT3D_CLONEABLE(QLogicalDevice)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // Qt3DInput
diff --git a/src/input/frontend/qlogicaldevice_p.h b/src/input/frontend/qlogicaldevice_p.h
new file mode 100644
index 000000000..c8940e6b9
--- /dev/null
+++ b/src/input/frontend/qlogicaldevice_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QLOGICALDEVICE_P_H
+#define QT3DINPUT_QLOGICALDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qcomponent_p.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+/*!
+ \internal
+*/
+class QLogicalDevicePrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QLogicalDevicePrivate();
+ ~QLogicalDevicePrivate();
+
+ QVector<QAction *> m_actions;
+ QVector<QAxis *> m_axes;
+};
+
+struct QLogicalDeviceData
+{
+ QVector<Qt3DCore::QNodeId> actionIds;
+ QVector<Qt3DCore::QNodeId> axisIds;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QLOGICALDEVICE_P_H
+
diff --git a/src/input/frontend/qmousecontroller.cpp b/src/input/frontend/qmousecontroller.cpp
deleted file mode 100644
index bc38b624e..000000000
--- a/src/input/frontend/qmousecontroller.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmousecontroller.h"
-#include "qmousecontroller_p.h"
-
-#include <Qt3DCore/qentity.h>
-
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-/*! \internal */
-QMouseControllerPrivate::QMouseControllerPrivate()
- : QAbstractPhysicalDevicePrivate()
- , m_sensitivity(0.1f)
-{
-}
-/*!
- * \qmltype MouseController
- * \instantiates Qt3DInput::QMouseController
- * \inqmlmodule Qt3D.Input
- * \since 5.5
- * \brief Delegates mouse events to the attached MouseInput objects.
- * \TODO
- * \sa MouseInput
- */
-
-/*!
- * \class Qt3DInput::QMouseController
- * \inmodule Qt3DInput
- *
- * \brief QMouseController is in charge of dispatching mouse events to
- * attached QMouseInput objects.
- *
- * \since 5.5
- * \sa QMouseInput
- */
-QMouseController::QMouseController(QNode *parent)
- : QAbstractPhysicalDevice(*new QMouseControllerPrivate, parent)
-{
-}
-
-/*!
- \internal
-*/
-QMouseController::QMouseController(QMouseControllerPrivate &dd, QNode *parent)
- : QAbstractPhysicalDevice(dd, parent)
-{
-}
-
-/*!
- Destroys this QMouseController object.
-*/
-QMouseController::~QMouseController()
-{
- QNode::cleanup();
-}
-
-int QMouseController::axisCount() const
-{
- // TO DO: we could have mouse wheel later on
- return 2;
-}
-
-int QMouseController::buttonCount() const
-{
- return 3;
-}
-
-QStringList QMouseController::axisNames() const
-{
- return QStringList()
- << QStringLiteral("X")
- << QStringLiteral("Y");
-}
-
-QStringList QMouseController::buttonNames() const
-{
- return QStringList()
- << QStringLiteral("Left")
- << QStringLiteral("Right")
- << QStringLiteral("Center");
-}
-
-int QMouseController::axisIdentifier(const QString &name) const
-{
- if (name == QStringLiteral("X"))
- return X;
- else if (name == QStringLiteral("Y"))
- return Y;
- return -1;
-}
-
-int QMouseController::buttonIdentifier(const QString &name) const
-{
- if (name == QStringLiteral("Left"))
- return Left;
- else if (name == QStringLiteral("Right"))
- return Right;
- else if (name == QStringLiteral("Center"))
- return Center;
- return -1;
-}
-
-float QMouseController::sensitivity() const
-{
- Q_D(const QMouseController);
- return d->m_sensitivity;
-}
-
-void QMouseController::setSensitivity(float value)
-{
- Q_D(QMouseController);
- if (qFuzzyCompare(value, d->m_sensitivity))
- return;
-
- d->m_sensitivity = value;
- emit sensitivityChanged(value);
-}
-
-void QMouseController::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QMouseController *object = static_cast<const QMouseController *>(ref);
- d_func()->m_sensitivity = object->d_func()->m_sensitivity;
-}
-
-void QMouseController::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
-{
- Q_UNUSED(change);
- // TODO: To be completed as the mouse input aspect takes shape
-}
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/frontend/qmousecontroller.h b/src/input/frontend/qmousecontroller.h
deleted file mode 100644
index 0394522ea..000000000
--- a/src/input/frontend/qmousecontroller.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QMOUSECONTROLLER_H
-#define QT3DINPUT_QMOUSECONTROLLER_H
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DInput/qabstractphysicaldevice.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QMouseControllerPrivate;
-class QMouseInput;
-
-class QT3DINPUTSHARED_EXPORT QMouseController : public Qt3DInput::QAbstractPhysicalDevice
-{
- Q_OBJECT
- Q_PROPERTY(float sensitivity READ sensitivity WRITE setSensitivity NOTIFY sensitivityChanged)
-public:
- explicit QMouseController(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QMouseController();
-
- enum Axis {
- X,
- Y
- };
- Q_ENUM(Axis)
-
- enum Button {
- Left,
- Center,
- Right
- };
- Q_ENUM(Button)
-
- int axisCount() const Q_DECL_FINAL;
- int buttonCount() const Q_DECL_FINAL;
- QStringList axisNames() const Q_DECL_FINAL;
- QStringList buttonNames() const Q_DECL_FINAL;
- int axisIdentifier(const QString &name) const Q_DECL_FINAL;
- int buttonIdentifier(const QString &name) const Q_DECL_FINAL;
-
- float sensitivity() const;
-
-public Q_SLOTS:
- void setSensitivity(float value);
-
-Q_SIGNALS:
- void sensitivityChanged(float value);
-
-protected:
- QMouseController(QMouseControllerPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QMouseController)
- QT3D_CLONEABLE(QMouseController)
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Qt3DInput::QMouseController*)
-
-#endif // QT3DINPUT_QMOUSECONTROLLER_H
diff --git a/src/input/frontend/qmousecontroller_p.h b/src/input/frontend/qmousecontroller_p.h
deleted file mode 100644
index 4e0faa6f2..000000000
--- a/src/input/frontend/qmousecontroller_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QMOUSECONTROLLER_P_H
-#define QT3DINPUT_QMOUSECONTROLLER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qabstractphysicaldevice_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QMouseController;
-
-class QMouseControllerPrivate : public Qt3DInput::QAbstractPhysicalDevicePrivate
-{
-public:
- QMouseControllerPrivate();
-
- Q_DECLARE_PUBLIC(QMouseController)
-
- float m_sensitivity;
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QMOUSECONTROLLER_P_H
-
diff --git a/src/input/frontend/qmousedevice.cpp b/src/input/frontend/qmousedevice.cpp
new file mode 100644
index 000000000..ec0a24f46
--- /dev/null
+++ b/src/input/frontend/qmousedevice.cpp
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmousedevice.h"
+#include "qmousedevice_p.h"
+#include <Qt3DInput/qphysicaldevicecreatedchange.h>
+#include <Qt3DCore/qentity.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+/*! \internal */
+QMouseDevicePrivate::QMouseDevicePrivate()
+ : QAbstractPhysicalDevicePrivate()
+ , m_sensitivity(0.1f)
+{
+}
+/*!
+ * \qmltype MouseDevice
+ * \instantiates Qt3DInput::QMouseDevice
+ * \inqmlmodule Qt3D.Input
+ * \since 5.5
+ * \brief Delegates mouse events to the attached MouseHandler objects.
+ * \TODO
+ * \sa MouseHandler
+ */
+
+/*!
+ * \class Qt3DInput::QMouseDevice
+ * \inmodule Qt3DInput
+ *
+ * \brief QMouseDevice is in charge of dispatching mouse events to
+ * attached QMouseHandler objects.
+ *
+ * \since 5.5
+ * \sa QMouseHandler
+ */
+QMouseDevice::QMouseDevice(QNode *parent)
+ : QAbstractPhysicalDevice(*new QMouseDevicePrivate, parent)
+{
+}
+
+/*! \internal */
+QMouseDevice::~QMouseDevice()
+{
+}
+
+int QMouseDevice::axisCount() const
+{
+ // TO DO: we could have mouse wheel later on
+ return 2;
+}
+
+int QMouseDevice::buttonCount() const
+{
+ return 3;
+}
+
+QStringList QMouseDevice::axisNames() const
+{
+ return QStringList()
+ << QStringLiteral("X")
+ << QStringLiteral("Y");
+}
+
+QStringList QMouseDevice::buttonNames() const
+{
+ return QStringList()
+ << QStringLiteral("Left")
+ << QStringLiteral("Right")
+ << QStringLiteral("Center");
+}
+
+int QMouseDevice::axisIdentifier(const QString &name) const
+{
+ if (name == QLatin1String("X"))
+ return X;
+ else if (name == QLatin1String("Y"))
+ return Y;
+ return -1;
+}
+
+float QMouseDevice::sensitivity() const
+{
+ Q_D(const QMouseDevice);
+ return d->m_sensitivity;
+}
+
+void QMouseDevice::setSensitivity(float value)
+{
+ Q_D(QMouseDevice);
+ if (qFuzzyCompare(value, d->m_sensitivity))
+ return;
+
+ d->m_sensitivity = value;
+ emit sensitivityChanged(value);
+}
+
+void QMouseDevice::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
+{
+ Q_UNUSED(change);
+ // TODO: To be completed as the mouse input aspect takes shape
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QMouseDevice::createNodeCreationChange() const
+{
+ auto creationChange = QPhysicalDeviceCreatedChangePtr<QMouseDeviceData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QMouseDevice);
+ data.sensitivity = d->m_sensitivity;
+
+ return creationChange;
+}
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qmousedevice.h b/src/input/frontend/qmousedevice.h
new file mode 100644
index 000000000..fe43c6c84
--- /dev/null
+++ b/src/input/frontend/qmousedevice.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QMOUSEDEVICE_H
+#define QT3DINPUT_QMOUSEDEVICE_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DInput/qabstractphysicaldevice.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QMouseDevicePrivate;
+class QMouseHandler;
+
+class QMouseInput;
+
+
+class QT3DINPUTSHARED_EXPORT QMouseDevice : public Qt3DInput::QAbstractPhysicalDevice
+{
+ Q_OBJECT
+ Q_PROPERTY(float sensitivity READ sensitivity WRITE setSensitivity NOTIFY sensitivityChanged)
+public:
+ explicit QMouseDevice(Qt3DCore::QNode *parent = nullptr);
+ ~QMouseDevice();
+
+ enum Axis {
+ X,
+ Y
+ };
+ Q_ENUM(Axis)
+
+ int axisCount() const Q_DECL_FINAL;
+ int buttonCount() const Q_DECL_FINAL;
+ QStringList axisNames() const Q_DECL_FINAL;
+ QStringList buttonNames() const Q_DECL_FINAL;
+ int axisIdentifier(const QString &name) const Q_DECL_FINAL;
+
+ float sensitivity() const;
+
+public Q_SLOTS:
+ void setSensitivity(float value);
+
+Q_SIGNALS:
+ void sensitivityChanged(float value);
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QMouseDevice)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DInput::QMouseDevice*)
+
+#endif // QT3DINPUT_QMOUSEDEVICE_H
diff --git a/src/input/frontend/qmousedevice_p.h b/src/input/frontend/qmousedevice_p.h
new file mode 100644
index 000000000..92718dffa
--- /dev/null
+++ b/src/input/frontend/qmousedevice_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QMOUSEDEVICE_P_H
+#define QT3DINPUT_QMOUSEDEVICE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qabstractphysicaldevice_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QMouseDevice;
+
+class QMouseDevicePrivate : public Qt3DInput::QAbstractPhysicalDevicePrivate
+{
+public:
+ QMouseDevicePrivate();
+
+ Q_DECLARE_PUBLIC(QMouseDevice)
+
+ float m_sensitivity;
+};
+
+struct QMouseDeviceData
+{
+ float sensitivity;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QMOUSEDEVICE_P_H
+
diff --git a/src/input/frontend/qmouseevent.cpp b/src/input/frontend/qmouseevent.cpp
index 1a78cda27..b14e2bb34 100644
--- a/src/input/frontend/qmouseevent.cpp
+++ b/src/input/frontend/qmouseevent.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,7 +61,7 @@ namespace Qt3DInput {
* traversing the view, originating from the mouse position intersects with one
* or more elements of the scene.
*
- * \sa KeyEvent, WheelEvent, MouseInput
+ * \sa KeyEvent, WheelEvent, MouseHandler
*/
/*!
@@ -73,7 +76,7 @@ namespace Qt3DInput {
*
* \since 5.5
*
- * \sa QKeyEvent, QWheelEvent, QMouseInput
+ * \sa QKeyEvent, QWheelEvent, QMouseHandler
*
*/
@@ -152,9 +155,9 @@ int QMouseEvent::buttons() const
}
/*!
- * Returns the keyboard modifier that may be accompanying the mouse event.
+ * Returns the keyboard modifiers that may be accompanying the mouse event.
*/
-QMouseEvent::Modifiers QMouseEvent::modifier() const
+QMouseEvent::Modifiers QMouseEvent::modifiers() const
{
switch (m_event.modifiers()) {
case Qt::ShiftModifier:
@@ -181,7 +184,7 @@ QMouseEvent::Modifiers QMouseEvent::modifier() const
*
* Mouse wheel events occur when the mouse wheel is rotated.
*
- * \sa KeyEvent, MouseEvent, MouseInput
+ * \sa KeyEvent, MouseEvent, MouseHandler
*
*/
@@ -195,7 +198,7 @@ QMouseEvent::Modifiers QMouseEvent::modifier() const
*
* \since 5.5
*
- * \sa QKeyEvent, QMouseEvent, QMouseInput
+ * \sa QKeyEvent, QMouseEvent, QMouseHandler
*
*/
@@ -264,9 +267,9 @@ int QWheelEvent::buttons() const
}
/*!
- * Returns the keyboard modifier that may be accompanying the wheel event.
+ * Returns the keyboard modifiers that may be accompanying the wheel event.
*/
-QWheelEvent::Modifiers QWheelEvent::modifier() const
+QWheelEvent::Modifiers QWheelEvent::modifiers() const
{
switch (m_event.modifiers()) {
case Qt::ShiftModifier:
diff --git a/src/input/frontend/qmouseevent.h b/src/input/frontend/qmouseevent.h
index 1b5f41798..337ae06d8 100644
--- a/src/input/frontend/qmouseevent.h
+++ b/src/input/frontend/qmouseevent.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,7 +57,7 @@ class QT3DINPUTSHARED_EXPORT QMouseEvent : public QObject
Q_PROPERTY(bool wasHeld READ wasHeld CONSTANT)
Q_PROPERTY(Qt3DInput::QMouseEvent::Buttons button READ button CONSTANT)
Q_PROPERTY(int buttons READ buttons CONSTANT)
- Q_PROPERTY(Qt3DInput::QMouseEvent::Modifiers modifier READ modifier CONSTANT)
+ Q_PROPERTY(Qt3DInput::QMouseEvent::Modifiers modifiers READ modifiers CONSTANT)
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
public:
@@ -85,7 +88,7 @@ public:
inline bool wasHeld() const { return static_cast<Qt::GestureType>(m_event.type()) == Qt::TapAndHoldGesture; }
Buttons button() const;
int buttons() const;
- Modifiers modifier() const;
+ Modifiers modifiers() const;
inline bool isAccepted() const { return m_event.isAccepted(); }
inline void setAccepted(bool accepted) { m_event.setAccepted(accepted); }
@@ -104,7 +107,7 @@ class QT3DINPUTSHARED_EXPORT QWheelEvent : public QObject
Q_PROPERTY(int y READ y CONSTANT)
Q_PROPERTY(QPoint angleDelta READ angleDelta CONSTANT)
Q_PROPERTY(int buttons READ buttons CONSTANT)
- Q_PROPERTY(Qt3DInput::QWheelEvent::Modifiers modifier READ modifier CONSTANT)
+ Q_PROPERTY(Qt3DInput::QWheelEvent::Modifiers modifiers READ modifiers CONSTANT)
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
public:
@@ -134,7 +137,7 @@ public:
inline int y() const { return m_event.y(); }
inline QPoint angleDelta() const { return m_event.angleDelta(); }
int buttons() const;
- Modifiers modifier() const;
+ Modifiers modifiers() const;
inline bool isAccepted() const { return m_event.isAccepted(); }
inline void setAccepted(bool accepted) { m_event.setAccepted(accepted); }
diff --git a/src/input/frontend/qmousehandler.cpp b/src/input/frontend/qmousehandler.cpp
new file mode 100644
index 000000000..7fa7f9f2d
--- /dev/null
+++ b/src/input/frontend/qmousehandler.cpp
@@ -0,0 +1,200 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmousehandler.h"
+#include "qmousehandler_p.h"
+#include "qmousedevice.h"
+#include "qmouseevent.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DInput {
+/*! \internal */
+QMouseHandlerPrivate::QMouseHandlerPrivate()
+ : QComponentPrivate()
+ , m_mouseDevice(nullptr)
+ , m_containsMouse(false)
+{
+ m_shareable = false;
+}
+
+QMouseHandlerPrivate::~QMouseHandlerPrivate()
+{
+}
+
+void QMouseHandlerPrivate::mouseEvent(QMouseEvent *event)
+{
+ Q_Q(QMouseHandler);
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ if (event->wasHeld())
+ emit q->pressAndHold(event);
+ else
+ emit q->pressed(event);
+ break;
+ case QEvent::MouseButtonRelease:
+ emit q->released(event);
+ break;
+ case Qt::TapGesture:
+ emit q->clicked(event);
+ break;
+ case QEvent::MouseButtonDblClick:
+ emit q->doubleClicked(event);
+ break;
+ case QEvent::MouseMove:
+ emit q->positionChanged(event);
+ break;
+ default:
+ break;
+ }
+}
+
+/*!
+ * \qmltype MouseHandler
+ * \instantiates Qt3DInput::QMouseHandler
+ * \inqmlmodule Qt3D.Input
+ * \since 5.5
+ * \brief Provides mouse event notification
+ *
+ * \TODO
+ * \sa MouseDevice
+ */
+
+/*!
+ * \class Qt3DInput::QMouseHandler
+ * \inmodule Qt3DInput
+ *
+ * \brief Provides a means of being notified about mouse events when attached to
+ * a QMouseDevice instance.
+ *
+ * \since 5.5
+ *
+ * \note QMouseHandler components shouldn't be shared, not respecting that
+ * condition will most likely result in undefined behaviors.
+ *
+ * \sa QMouseDevice
+ */
+
+/*!
+ * Constructs a new QMouseHandler instance with parent \a parent.
+ */
+QMouseHandler::QMouseHandler(QNode *parent)
+ : QComponent(*new QMouseHandlerPrivate, parent)
+{
+}
+
+QMouseHandler::~QMouseHandler()
+{
+}
+
+/*!
+ * Sets the mouse device of the QMouseHandler instance to \a mouseDevice.
+ */
+void QMouseHandler::setSourceDevice(QMouseDevice *mouseDevice)
+{
+ Q_D(QMouseHandler);
+ if (d->m_mouseDevice != mouseDevice) {
+ d->m_mouseDevice = mouseDevice;
+ emit sourceDeviceChanged(mouseDevice);
+ }
+}
+
+/*!
+ * Returns the current mouse source device of the QMouseHandler instance.
+ */
+QMouseDevice *QMouseHandler::sourceDevice() const
+{
+ Q_D(const QMouseHandler);
+ return d->m_mouseDevice;
+}
+
+/*!
+ * Returns \c true if the QMouseHandler currently contains the mouse.
+ *
+ * \note In this context, contains mean that the ray originating from the
+ * mouse is intersecting with the Qt3DCore::QEntity that aggregates the current
+ * QMouseHandler instance component.
+ */
+bool QMouseHandler::containsMouse() const
+{
+ Q_D(const QMouseHandler);
+ return d->m_containsMouse;
+}
+
+void QMouseHandler::setContainsMouse(bool contains)
+{
+ Q_D(QMouseHandler);
+ if (contains != d->m_containsMouse) {
+ d->m_containsMouse = contains;
+ emit containsMouseChanged(contains);
+ }
+}
+
+void QMouseHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
+{
+ Q_D(QMouseHandler);
+ QPropertyUpdatedChangePtr e = qSharedPointerCast<QPropertyUpdatedChange>(change);
+ if (e->type() == PropertyUpdated) {
+ if (e->propertyName() == QByteArrayLiteral("mouse")) {
+ QMouseEventPtr ev = e->value().value<QMouseEventPtr>();
+ d->mouseEvent(ev.data());
+ } else if (e->propertyName() == QByteArrayLiteral("wheel")) {
+ QWheelEventPtr ev = e->value().value<QWheelEventPtr>();
+ emit wheel(ev.data());
+ }
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QMouseHandler::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QMouseHandlerData>::create(this);
+ auto &data = creationChange->data;
+
+ Q_D(const QMouseHandler);
+ data.mouseDeviceId = qIdForNode(d->m_mouseDevice);
+
+ return creationChange;
+}
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/input/frontend/qmousehandler.h b/src/input/frontend/qmousehandler.h
new file mode 100644
index 000000000..750ed394d
--- /dev/null
+++ b/src/input/frontend/qmousehandler.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QMOUSEHANDLER_H
+#define QT3DINPUT_QMOUSEHANDLER_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DInput/qmouseevent.h>
+#include <Qt3DCore/qcomponent.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QMouseDevice;
+class QMouseHandlerPrivate;
+
+class QT3DINPUTSHARED_EXPORT QMouseHandler : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DInput::QMouseDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
+ Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged)
+
+public:
+ explicit QMouseHandler(QNode *parent = nullptr);
+ ~QMouseHandler();
+
+ QMouseDevice *sourceDevice() const;
+ bool containsMouse() const;
+
+public Q_SLOTS:
+ void setSourceDevice(QMouseDevice *mouseDevice);
+
+Q_SIGNALS:
+ void sourceDeviceChanged(QMouseDevice *mouseDevice);
+ void containsMouseChanged(bool containsMouse);
+
+ void clicked(Qt3DInput::QMouseEvent *mouse);
+ void doubleClicked(Qt3DInput::QMouseEvent *mouse);
+
+ void entered();
+ void exited();
+
+ void pressed(Qt3DInput::QMouseEvent *mouse);
+ void released(Qt3DInput::QMouseEvent *mouse);
+ void pressAndHold(Qt3DInput::QMouseEvent *mouse);
+ void positionChanged(Qt3DInput::QMouseEvent *mouse);
+
+ void wheel(Qt3DInput::QWheelEvent *wheel);
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
+ void setContainsMouse(bool contains);
+
+private:
+ Q_DECLARE_PRIVATE(QMouseHandler)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QMOUSEHANDLER_H
diff --git a/src/input/frontend/qmousehandler_p.h b/src/input/frontend/qmousehandler_p.h
new file mode 100644
index 000000000..a35fcb5d7
--- /dev/null
+++ b/src/input/frontend/qmousehandler_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QMOUSEHANDLER_P_H
+#define QT3DINPUT_QMOUSEHANDLER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qcomponent_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QMouseHandler;
+class QMouseDevice;
+
+class QMouseHandlerPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QMouseHandlerPrivate();
+ ~QMouseHandlerPrivate();
+
+ QMouseDevice *m_mouseDevice;
+ bool m_containsMouse;
+
+ void mouseEvent(Qt3DInput::QMouseEvent *event);
+
+ Q_DECLARE_PUBLIC(QMouseHandler)
+};
+
+struct QMouseHandlerData
+{
+ Qt3DCore::QNodeId mouseDeviceId;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QMOUSEHANDLER_P_H
+
diff --git a/src/input/frontend/qmouseinput.cpp b/src/input/frontend/qmouseinput.cpp
deleted file mode 100644
index 07fd9b52d..000000000
--- a/src/input/frontend/qmouseinput.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmouseinput.h"
-#include "qmouseinput_p.h"
-#include "qmousecontroller.h"
-#include "qmouseevent.h"
-#include <Qt3DCore/qbackendscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DInput {
-/*! \internal */
-QMouseInputPrivate::QMouseInputPrivate()
- : QComponentPrivate()
- , m_controller(Q_NULLPTR)
- , m_containsMouse(false)
-{
- m_shareable = false;
-}
-
-/*!
- * \qmltype MouseInput
- * \instantiates Qt3DInput::QMouseInput
- * \inqmlmodule Qt3D.Input
- * \since 5.5
- * \brief Provides mouse event notification
- *
- * \TODO
- * \sa MouseController
- */
-
-/*!
- * \class Qt3DInput::QMouseInput
- * \inmodule Qt3DInput
- *
- * \brief Provides a means of being notified about mouse events when attached to
- * a QMouseController instance.
- *
- * \since 5.5
- *
- * \note QMouseInput components shouldn't be shared, not respecting that
- * condition will most likely result in undefined behaviors.
- *
- * \sa QMouseController
- */
-
-/*!
- * Constructs a new QMouseInput instance with parent \a parent.
- */
-QMouseInput::QMouseInput(QNode *parent)
- : QComponent(*new QMouseInputPrivate, parent)
-{
-}
-
-/*!
- \internal
-*/
-QMouseInput::QMouseInput(QMouseInputPrivate &dd, QNode *parent)
- : QComponent(dd, parent)
-{
-}
-
-/*!
- Destroys this QMouseInput object
-*/
-QMouseInput::~QMouseInput()
-{
- QNode::cleanup();
-}
-
-/*!
- * Sets the mouse controller of the QMouseInput instance to \a controller.
- */
-void QMouseInput::setController(QMouseController *controller)
-{
- Q_D(QMouseInput);
- if (d->m_controller != controller) {
- d->m_controller = controller;
- emit controllerChanged(controller);
- }
-}
-
-/*!
- * Returns the current mouse controller of the QMouseInput instance.
- */
-QMouseController *QMouseInput::controller() const
-{
- Q_D(const QMouseInput);
- return d->m_controller;
-}
-
-/*!
- * Returns \c true if the QMouseInput currently contains the mouse.
- *
- * \note In this context, contains mean that the ray originating from the
- * mouse is intersecting with the Qt3DCore::QEntity that aggregates the current
- * QMouseInput instance component.
- */
-bool QMouseInput::containsMouse() const
-{
- Q_D(const QMouseInput);
- return d->m_containsMouse;
-}
-
-void QMouseInput::copy(const QNode *ref)
-{
- Q_D(QMouseInput);
- const QMouseInput *refInput = static_cast<const QMouseInput *>(ref);
- d->m_containsMouse = refInput->containsMouse();
-
- // TODO: We may want to store the controller id and only send a clone when we are the parent
- // of the controller.
- // Perhaps it's time to investigate sending a "kernel" or "seed" over to the backend rather
- // than a complete clone.
- if (refInput && refInput->controller()->parent() == ref)
- d->m_controller = static_cast<QMouseController *>(QNode::clone(refInput->controller()));
-}
-
-void QMouseInput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
-{
- QBackendScenePropertyChangePtr e = qSharedPointerCast<QBackendScenePropertyChange>(change);
- if (e->type() == NodeUpdated) {
- if (e->propertyName() == QByteArrayLiteral("mouse")) {
- QMouseEventPtr ev = e->value().value<QMouseEventPtr>();
- mouseEvent(ev.data());
- } else if (e->propertyName() == QByteArrayLiteral("wheel")) {
- QWheelEventPtr ev = e->value().value<QWheelEventPtr>();
- emit wheel(ev.data());
- }
- }
-}
-
-void QMouseInput::mouseEvent(QMouseEvent *event)
-{
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- if (event->wasHeld())
- emit pressAndHold(event);
- else
- emit pressed(event);
- break;
- case QEvent::MouseButtonRelease:
- emit released(event);
- break;
- case Qt::TapGesture:
- emit clicked(event);
- break;
- case QEvent::MouseButtonDblClick:
- emit doubleClicked(event);
- break;
- case QEvent::MouseMove:
- emit positionChanged(event);
- break;
- default:
- break;
- }
-}
-
-void QMouseInput::setContainsMouse(bool contains)
-{
- Q_D(QMouseInput);
- if (contains != d->m_containsMouse) {
- d->m_containsMouse = contains;
- emit containsMouseChanged(contains);
- }
-}
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
diff --git a/src/input/frontend/qmouseinput.h b/src/input/frontend/qmouseinput.h
deleted file mode 100644
index 72183bd12..000000000
--- a/src/input/frontend/qmouseinput.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QMOUSEINPUT_H
-#define QT3DINPUT_QMOUSEINPUT_H
-
-#include <Qt3DInput/qt3dinput_global.h>
-#include <Qt3DInput/qmouseevent.h>
-#include <Qt3DCore/qcomponent.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QMouseController;
-class QMouseInputPrivate;
-
-class QT3DINPUTSHARED_EXPORT QMouseInput : public Qt3DCore::QComponent
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DInput::QMouseController *controller READ controller WRITE setController NOTIFY controllerChanged)
- Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged)
-
-public:
- explicit QMouseInput(QNode *parent = Q_NULLPTR);
- ~QMouseInput();
-
- QMouseController *controller() const;
- bool containsMouse() const;
-
-public Q_SLOTS:
- void setController(QMouseController *controller);
-
-Q_SIGNALS:
- void controllerChanged(QMouseController *controller);
- void containsMouseChanged(bool containsMouse);
-
- void clicked(Qt3DInput::QMouseEvent *mouse);
- void doubleClicked(Qt3DInput::QMouseEvent *mouse);
-
- void entered();
- void exited();
-
- void pressed(Qt3DInput::QMouseEvent *mouse);
- void released(Qt3DInput::QMouseEvent *mouse);
- void pressAndHold(Qt3DInput::QMouseEvent *mouse);
- void positionChanged(Qt3DInput::QMouseEvent *mouse);
-
- void wheel(Qt3DInput::QWheelEvent *wheel);
-
-protected:
- QMouseInput(QMouseInputPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
- void mouseEvent(Qt3DInput::QMouseEvent *event);
- void setContainsMouse(bool contains);
-
-private:
- Q_DECLARE_PRIVATE(QMouseInput)
- QT3D_CLONEABLE(QMouseInput)
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QMOUSEINPUT_H
diff --git a/src/input/frontend/qmouseinput_p.h b/src/input/frontend/qmouseinput_p.h
deleted file mode 100644
index d8f7c3fff..000000000
--- a/src/input/frontend/qmouseinput_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DINPUT_QMOUSEINPUT_P_H
-#define QT3DINPUT_QMOUSEINPUT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qcomponent_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DInput {
-
-class QMouseInput;
-class QMouseController;
-
-class QMouseInputPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QMouseInputPrivate();
-
- QMouseController *m_controller;
- bool m_containsMouse;
-
- Q_DECLARE_PUBLIC(QMouseInput)
-};
-
-} // namespace Qt3DInput
-
-QT_END_NAMESPACE
-
-#endif // QT3DINPUT_QMOUSEINPUT_P_H
-
diff --git a/src/input/frontend/qphysicaldevicecreatedchange.cpp b/src/input/frontend/qphysicaldevicecreatedchange.cpp
new file mode 100644
index 000000000..17edde76a
--- /dev/null
+++ b/src/input/frontend/qphysicaldevicecreatedchange.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qphysicaldevicecreatedchange.h"
+#include "qphysicaldevicecreatedchange_p.h"
+#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/qaxissetting.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+QPhysicalDeviceCreatedChangeBasePrivate::QPhysicalDeviceCreatedChangeBasePrivate(const QAbstractPhysicalDevice *device)
+ : Qt3DCore::QNodeCreatedChangeBasePrivate(device)
+ , m_axisSettingIds(Qt3DCore::qIdsForNodes(device->axisSettings()))
+{
+
+}
+
+QPhysicalDeviceCreatedChangeBase::QPhysicalDeviceCreatedChangeBase(const QAbstractPhysicalDevice *device)
+ : Qt3DCore::QNodeCreatedChangeBase(*new QPhysicalDeviceCreatedChangeBasePrivate(device), device)
+{
+}
+
+/*! \internal */
+QPhysicalDeviceCreatedChangeBase::~QPhysicalDeviceCreatedChangeBase()
+{
+}
+
+Qt3DCore::QNodeIdVector QPhysicalDeviceCreatedChangeBase::axisSettingIds() const
+{
+ Q_D(const QPhysicalDeviceCreatedChangeBase);
+ return d->m_axisSettingIds;
+}
+
+QT_END_NAMESPACE
+
+} // namespace Qt3DInput
diff --git a/src/input/frontend/qphysicaldevicecreatedchange.h b/src/input/frontend/qphysicaldevicecreatedchange.h
new file mode 100644
index 000000000..65cc4004a
--- /dev/null
+++ b/src/input/frontend/qphysicaldevicecreatedchange.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QPHYSICALDEVICECREATIONCHANGEBASE_H
+#define QT3DINPUT_QPHYSICALDEVICECREATIONCHANGEBASE_H
+
+#include <Qt3DInput/qt3dinput_global.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractPhysicalDevice;
+class QPhysicalDeviceCreatedChangeBasePrivate;
+
+class QT3DINPUTSHARED_EXPORT QPhysicalDeviceCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
+{
+public:
+ explicit QPhysicalDeviceCreatedChangeBase(const QAbstractPhysicalDevice *device);
+ ~QPhysicalDeviceCreatedChangeBase();
+
+ Qt3DCore::QNodeIdVector axisSettingIds() const;
+
+private:
+ Q_DECLARE_PRIVATE(QPhysicalDeviceCreatedChangeBase)
+};
+
+typedef QSharedPointer<QPhysicalDeviceCreatedChangeBase> QPhysicalDeviceCreatedChangeBasePtr;
+
+template<typename T>
+class QPhysicalDeviceCreatedChange : public QPhysicalDeviceCreatedChangeBase
+{
+public:
+ explicit QPhysicalDeviceCreatedChange(const QAbstractPhysicalDevice *_device)
+ : QPhysicalDeviceCreatedChangeBase(_device)
+ , data()
+ {
+ }
+
+ T data;
+};
+
+template<typename T>
+using QPhysicalDeviceCreatedChangePtr = QSharedPointer<QPhysicalDeviceCreatedChange<T>>;
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QPHYSICALDEVICECREATIONCHANGEBASE_H
diff --git a/src/input/frontend/qphysicaldevicecreatedchange_p.h b/src/input/frontend/qphysicaldevicecreatedchange_p.h
new file mode 100644
index 000000000..7dcc7eb47
--- /dev/null
+++ b/src/input/frontend/qphysicaldevicecreatedchange_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_QPHYSICALDEVICECREATEDCHANGEBASE_P_H
+#define QT3DINPUT_QPHYSICALDEVICECREATEDCHANGEBASE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnodecreatedchange_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+
+class QAbstractPhysicalDevice;
+
+class QPhysicalDeviceCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate
+{
+public:
+ QPhysicalDeviceCreatedChangeBasePrivate(const QAbstractPhysicalDevice *device);
+
+ Qt3DCore::QNodeIdVector m_axisSettingIds;
+};
+
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+#endif // QT3DINPUT_QPHYSICALDEVICECREATEDCHANGEBASE_P_H
diff --git a/src/input/input.pro b/src/input/input.pro
index 51b5798f7..73a571c9f 100644
--- a/src/input/input.pro
+++ b/src/input/input.pro
@@ -1,5 +1,12 @@
TARGET = Qt3DInput
+
+DEFINES += QT3DINPUT_LIBRARY
+
MODULE = 3dinput
+MODULE_PLUGIN_TYPES = 3dinputdevices
+
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
QT += core-private 3dcore-private
diff --git a/src/input/qt3dinput_global.h b/src/input/qt3dinput_global.h
index 33dd3dd54..9c76435f9 100644
--- a/src/input/qt3dinput_global.h
+++ b/src/input/qt3dinput_global.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DINPUT_GLOBAL_H
#define QT3DINPUT_GLOBAL_H
-#include <QtCore/qglobal.h>
+#include <Qt3DCore/qt3dcore_global.h>
QT_BEGIN_NAMESPACE
diff --git a/src/input/qt3dinput_global_p.h b/src/input/qt3dinput_global_p.h
index eb00c6183..1bbc488dc 100644
--- a/src/input/qt3dinput_global_p.h
+++ b/src/input/qt3dinput_global_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/logic/callbackjob.cpp b/src/logic/callbackjob.cpp
index 77e23b3a0..9eec09bf5 100644
--- a/src/logic/callbackjob.cpp
+++ b/src/logic/callbackjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -44,7 +47,7 @@ namespace Logic {
CallbackJob::CallbackJob()
: QAspectJob()
- , m_logicManager(Q_NULLPTR)
+ , m_logicManager(nullptr)
{
}
diff --git a/src/logic/callbackjob_p.h b/src/logic/callbackjob_p.h
index 0e8cb2996..3aed3447f 100644
--- a/src/logic/callbackjob_p.h
+++ b/src/logic/callbackjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/logic/executor.cpp b/src/logic/executor.cpp
index e34299fed..74267379e 100644
--- a/src/logic/executor.cpp
+++ b/src/logic/executor.cpp
@@ -1,41 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "executor_p.h"
-#include <Qt3DLogic/qlogiccomponent.h>
+#include <Qt3DLogic/qframeaction.h>
#include <Qt3DCore/qnode.h>
#include <Qt3DCore/private/qscene_p.h>
#include <QtCore/qsemaphore.h>
@@ -49,7 +52,7 @@ namespace Logic {
Executor::Executor(QObject *parent)
: QObject(parent)
- , m_scene(Q_NULLPTR)
+ , m_scene(nullptr)
{
}
@@ -88,11 +91,11 @@ void Executor::processLogicFrameUpdates(float dt)
{
Q_ASSERT(m_scene);
Q_ASSERT(m_semaphore);
- QVector<QNode *> nodes = m_scene->lookupNodes(m_nodeIds);
- foreach (QNode *node, nodes) {
- QLogicComponent *logicComponent = qobject_cast<QLogicComponent *>(node);
- if (logicComponent)
- logicComponent->onFrameUpdate(dt);
+ const QVector<QNode *> nodes = m_scene->lookupNodes(m_nodeIds);
+ for (QNode *node : nodes) {
+ QFrameAction *frameAction = qobject_cast<QFrameAction *>(node);
+ if (frameAction)
+ frameAction->onTriggered(dt);
}
// Release the semaphore so the calling Manager can continue
diff --git a/src/logic/executor_p.h b/src/logic/executor_p.h
index 79effddb3..e33ff842e 100644
--- a/src/logic/executor_p.h
+++ b/src/logic/executor_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/logic/handle_types_p.h b/src/logic/handle_types_p.h
index 3b25cdc02..d137a4047 100644
--- a/src/logic/handle_types_p.h
+++ b/src/logic/handle_types_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/logic/handler.cpp b/src/logic/handler.cpp
index 81a4645e4..777637640 100644
--- a/src/logic/handler.cpp
+++ b/src/logic/handler.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -45,18 +48,19 @@ namespace Qt3DLogic {
namespace Logic {
Handler::Handler()
- : m_logicManager(Q_NULLPTR)
+ : m_logicManager(nullptr)
{
}
-void Handler::updateFromPeer(Qt3DCore::QNode *peer)
+void Handler::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- Q_UNUSED(peer);
+ Q_UNUSED(change);
+ m_logicManager->appendHandler(this);
}
void Handler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- Q_UNUSED(e);
+ QBackendNode::sceneChangeEvent(e);
}
HandlerFunctor::HandlerFunctor(Manager *manager)
@@ -64,22 +68,19 @@ HandlerFunctor::HandlerFunctor(Manager *manager)
{
}
-Qt3DCore::QBackendNode *HandlerFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *HandlerFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- Handler *handler = m_manager->logicHandlerManager()->getOrCreateResource(frontend->id());
- handler->setFactory(factory);
+ Handler *handler = m_manager->logicHandlerManager()->getOrCreateResource(change->subjectId());
handler->setManager(m_manager);
- handler->setPeer(frontend);
- m_manager->appendHandler(handler);
return handler;
}
-Qt3DCore::QBackendNode *HandlerFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *HandlerFunctor::get(Qt3DCore::QNodeId id) const
{
return m_manager->logicHandlerManager()->lookupResource(id);
}
-void HandlerFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void HandlerFunctor::destroy(Qt3DCore::QNodeId id) const
{
m_manager->removeHandler(id);
}
diff --git a/src/logic/handler_p.h b/src/logic/handler_p.h
index cddfc864d..7b1fad788 100644
--- a/src/logic/handler_p.h
+++ b/src/logic/handler_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -64,8 +67,6 @@ class Handler : public Qt3DCore::QBackendNode
public:
Handler();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
void setManager(Manager *manager) { m_logicManager = manager; }
Manager *logicManager() const { return m_logicManager; }
@@ -73,18 +74,20 @@ protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
Manager *m_logicManager;
};
-class HandlerFunctor : public Qt3DCore::QBackendNodeFunctor
+class HandlerFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
explicit HandlerFunctor(Manager *handler);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
private:
Manager *m_manager;
diff --git a/src/logic/logic.pri b/src/logic/logic.pri
index b8291f075..a8a3573a8 100644
--- a/src/logic/logic.pri
+++ b/src/logic/logic.pri
@@ -4,9 +4,9 @@ HEADERS += \
$$PWD/qt3dlogic_global.h \
$$PWD/qlogicaspect.h \
$$PWD/qlogicaspect_p.h \
- $$PWD/qlogiccomponent.h \
+ $$PWD/qframeaction.h \
$$PWD/handle_types_p.h \
- $$PWD/qlogiccomponent_p.h \
+ $$PWD/qframeaction_p.h \
$$PWD/callbackjob_p.h \
$$PWD/executor_p.h \
$$PWD/handler_p.h \
@@ -15,7 +15,7 @@ HEADERS += \
SOURCES += \
$$PWD/qlogicaspect.cpp \
- $$PWD/qlogiccomponent.cpp \
+ $$PWD/qframeaction.cpp \
$$PWD/manager.cpp \
$$PWD/handler.cpp \
$$PWD/executor.cpp \
diff --git a/src/logic/logic.pro b/src/logic/logic.pro
index 4facdda3d..50ff01748 100644
--- a/src/logic/logic.pro
+++ b/src/logic/logic.pro
@@ -3,6 +3,9 @@ MODULE = 3dlogic
QT = core-private gui-private 3dcore 3dcore-private
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
gcov {
CONFIG += static
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
diff --git a/src/logic/manager.cpp b/src/logic/manager.cpp
index a20dffe9a..7f0a6b4eb 100644
--- a/src/logic/manager.cpp
+++ b/src/logic/manager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -71,12 +74,12 @@ void Manager::setExecutor(Executor *executor)
void Manager::appendHandler(Handler *handler)
{
- HHandler handle = m_logicHandlerManager->lookupHandle(handler->peerUuid());
+ HHandler handle = m_logicHandlerManager->lookupHandle(handler->peerId());
m_logicHandlers.append(handle);
- m_logicComponentIds.append(handler->peerUuid());
+ m_logicComponentIds.append(handler->peerId());
}
-void Manager::removeHandler(const Qt3DCore::QNodeId &id)
+void Manager::removeHandler(Qt3DCore::QNodeId id)
{
HHandler handle = m_logicHandlerManager->lookupHandle(id);
m_logicComponentIds.removeAll(id);
diff --git a/src/logic/manager_p.h b/src/logic/manager_p.h
index 25b9d958b..58e6e655b 100644
--- a/src/logic/manager_p.h
+++ b/src/logic/manager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -78,7 +81,7 @@ public:
HandlerManager *logicHandlerManager() const { return m_logicHandlerManager.data(); }
void appendHandler(Handler *handler);
- void removeHandler(const Qt3DCore::QNodeId &id);
+ void removeHandler(Qt3DCore::QNodeId id);
void triggerLogicFrameUpdates();
diff --git a/src/logic/managers_p.h b/src/logic/managers_p.h
index f25600e26..b09104850 100644
--- a/src/logic/managers_p.h
+++ b/src/logic/managers_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/logic/qframeaction.cpp b/src/logic/qframeaction.cpp
new file mode 100644
index 000000000..d99f2d33e
--- /dev/null
+++ b/src/logic/qframeaction.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qframeaction.h"
+#include "qframeaction_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DLogic {
+
+QFrameActionPrivate::QFrameActionPrivate()
+ : QComponentPrivate()
+{
+}
+
+/*!
+ \class Qt3DLogic::QFrameAction
+ \inmodule Qt3DLogic
+ \since 5.5
+ \brief Provides a way to have a synchronous function executed each frame.
+
+ The QFrameAction provides a way to perform tasks each frame in
+ synchronized with the Qt3D backend. This is useful to implement some
+ aspects of application logic and to prototype functionality that can later
+ be folded into an additional Qt3D aspect.
+
+ For example, the QFrameAction can be used to animate a property in sync
+ with the Qt3D engine where a Qt Quick animation element is not perfectly
+ synchronized and may lead to stutters in some cases.
+
+ To execute your own code each frame override the onTriggered function.
+*/
+
+/*!
+ \qmltype FrameAction
+ \inqmlmodule Qt3D.Logic
+ \instantiates Qt3DLogic::QFrameAction
+ \inherits Component3D
+ \since 5.5
+*/
+
+/*!
+ Constructs a new QFrameAction instance with parent \a parent.
+ */
+QFrameAction::QFrameAction(QNode *parent)
+ : QComponent(*new QFrameActionPrivate, parent)
+{
+}
+
+/*! \internal */
+QFrameAction::~QFrameAction()
+{
+}
+
+/*! \internal */
+QFrameAction::QFrameAction(QFrameActionPrivate &dd, QNode *parent)
+ : QComponent(dd, parent)
+{
+}
+
+/*!
+ \internal
+ This function will be called in a synchronous manner once each frame by
+ the Logic aspect.
+*/
+void QFrameAction::onTriggered(float dt)
+{
+ // Emit signal so that QML instances get the onTriggered() signal
+ // handler called
+ emit triggered(dt);
+}
+
+} // namespace Qt3DLogic
+
+QT_END_NAMESPACE
diff --git a/src/logic/qframeaction.h b/src/logic/qframeaction.h
new file mode 100644
index 000000000..f67bb9631
--- /dev/null
+++ b/src/logic/qframeaction.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DLOGIC_QFRAMEACTION_H
+#define QT3DLOGIC_QFRAMEACTION_H
+
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DLogic/qt3dlogic_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DLogic {
+
+class QLogicAspect;
+class QFrameActionPrivate;
+
+namespace Logic {
+class Executor;
+}
+
+class QT3DLOGICSHARED_EXPORT QFrameAction : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+
+public:
+ explicit QFrameAction(Qt3DCore::QNode *parent = nullptr);
+ ~QFrameAction();
+
+protected:
+ QFrameAction(QFrameActionPrivate &dd, QNode *parent = nullptr);
+
+Q_SIGNALS:
+ void triggered(float dt);
+
+private:
+ Q_DECLARE_PRIVATE(QFrameAction)
+ void onTriggered(float dt);
+
+ friend class Logic::Executor;
+};
+
+} // namespace Qt3DLogic
+
+QT_END_NAMESPACE
+
+#endif // QT3DLOGIC_QFRAMEACTION_H
diff --git a/src/logic/qframeaction_p.h b/src/logic/qframeaction_p.h
new file mode 100644
index 000000000..17155ffd3
--- /dev/null
+++ b/src/logic/qframeaction_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DLOGIC_QFRAMEACTION_P_H
+#define QT3DLOGIC_QFRAMEACTION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qcomponent_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DLogic {
+
+class QFrameAction;
+
+class QFrameActionPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QFrameActionPrivate();
+
+ Q_DECLARE_PUBLIC(QFrameAction)
+};
+
+} // namespace Qt3DLogic
+
+QT_END_NAMESPACE
+
+#endif // QT3DLOGIC_QFRAMEACTION_P_H
diff --git a/src/logic/qlogicaspect.cpp b/src/logic/qlogicaspect.cpp
index 3c7ccc40e..560282e95 100644
--- a/src/logic/qlogicaspect.cpp
+++ b/src/logic/qlogicaspect.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,7 +42,7 @@
#include "executor_p.h"
#include "handler_p.h"
#include "manager_p.h"
-#include "qlogiccomponent.h"
+#include "qframeaction.h"
#include <Qt3DCore/qnode.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
@@ -67,24 +70,35 @@ QLogicAspectPrivate::QLogicAspectPrivate()
m_manager->setExecutor(m_executor.data());
}
-QLogicAspect::QLogicAspect(QObject *parent)
- : QAbstractAspect(*new QLogicAspectPrivate(), parent)
+void QLogicAspectPrivate::onEngineAboutToShutdown()
{
- registerBackendTypes();
- d_func()->m_manager->setLogicAspect(this);
+ // Throw away any pending work that may deadlock during the shutdown procedure
+ // when the main thread waits for any queued jobs to finish.
+ m_executor->clearQueueAndProceed();
+}
+
+void QLogicAspectPrivate::registerBackendTypes()
+{
+ Q_Q(QLogicAspect);
+ q->registerBackendType<QFrameAction>(QBackendNodeMapperPtr(new Logic::HandlerFunctor(m_manager.data())));
}
+QLogicAspect::QLogicAspect(QObject *parent)
+ : QLogicAspect(*new QLogicAspectPrivate(), parent) {}
+
/*! \internal */
QLogicAspect::QLogicAspect(QLogicAspectPrivate &dd, QObject *parent)
: QAbstractAspect(dd, parent)
{
- registerBackendTypes();
+ Q_D(QLogicAspect);
+ setObjectName(QStringLiteral("Logic Aspect"));
+ d->registerBackendTypes();
d_func()->m_manager->setLogicAspect(this);
}
-void QLogicAspect::registerBackendTypes()
+/*! \internal */
+QLogicAspect::~QLogicAspect()
{
- registerBackendType<QLogicComponent>(QBackendNodeFunctorPtr(new Logic::HandlerFunctor(d_func()->m_manager.data())));
}
QVector<QAspectJobPtr> QLogicAspect::jobsToExecute(qint64 time)
@@ -101,29 +115,16 @@ QVector<QAspectJobPtr> QLogicAspect::jobsToExecute(qint64 time)
return jobs;
}
-void QLogicAspect::onInitialize(const QVariantMap &data)
+void QLogicAspect::onRegistered()
{
- Q_UNUSED(data);
}
-void QLogicAspect::onCleanup()
-{
-}
-
-void QLogicAspect::onStartup()
+void QLogicAspect::onEngineStartup()
{
Q_D(QLogicAspect);
d->m_executor->setScene(d->m_arbiter->scene());
}
-void QLogicAspect::onShutdown()
-{
- Q_D(QLogicAspect);
- // Throw away any pending work that may deadlock during the shutdown procedure
- // when the main thread waits for any queued jobs to finish.
- d->m_executor->clearQueueAndProceed();
-}
-
} // namespace Qt3DLogic
QT_END_NAMESPACE
diff --git a/src/logic/qlogicaspect.h b/src/logic/qlogicaspect.h
index b70d4801f..3d7e8b957 100644
--- a/src/logic/qlogicaspect.h
+++ b/src/logic/qlogicaspect.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,21 +53,17 @@ class QT3DLOGICSHARED_EXPORT QLogicAspect : public Qt3DCore::QAbstractAspect
{
Q_OBJECT
public:
- explicit QLogicAspect(QObject *parent = Q_NULLPTR);
+ explicit QLogicAspect(QObject *parent = nullptr);
+ ~QLogicAspect();
QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_OVERRIDE;
-protected:
- void registerBackendTypes();
-
private:
- void onInitialize(const QVariantMap &data) Q_DECL_OVERRIDE;
- void onStartup() Q_DECL_OVERRIDE;
- void onShutdown() Q_DECL_OVERRIDE;
- void onCleanup() Q_DECL_OVERRIDE;
+ void onRegistered() Q_DECL_OVERRIDE;
+ void onEngineStartup() Q_DECL_OVERRIDE;
Q_DECLARE_PRIVATE(QLogicAspect)
- QLogicAspect(QLogicAspectPrivate &dd, QObject *parent);
+ explicit QLogicAspect(QLogicAspectPrivate &dd, QObject *parent);
};
} // namespace Qt3DLogic
diff --git a/src/logic/qlogicaspect_p.h b/src/logic/qlogicaspect_p.h
index 6df90bcf6..052fdb244 100644
--- a/src/logic/qlogicaspect_p.h
+++ b/src/logic/qlogicaspect_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -67,6 +70,9 @@ class QLogicAspectPrivate : public Qt3DCore::QAbstractAspectPrivate
Q_DECLARE_PUBLIC(QLogicAspect)
+ void onEngineAboutToShutdown() Q_DECL_OVERRIDE;
+ void registerBackendTypes();
+
qint64 m_time;
bool m_initialized;
QScopedPointer<Logic::Manager> m_manager;
diff --git a/src/logic/qlogiccomponent.cpp b/src/logic/qlogiccomponent.cpp
deleted file mode 100644
index 6aab91cc1..000000000
--- a/src/logic/qlogiccomponent.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlogiccomponent.h"
-#include "qlogiccomponent_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DLogic {
-
-QLogicComponentPrivate::QLogicComponentPrivate()
- : QComponentPrivate()
-{
-}
-
-/*!
- \class Qt3DLogic::QLogicComponent
- \inmodule Qt3DLogic
- \since 5.5
- \brief Provides a way to have a synchronous function executed each frame.
-
- The QLogicComponent provides a way to perform tasks each frame in
- synchronized with the Qt3D backend. This is useful to implement some
- aspects of application logic and to prototype functionality that can later
- be folded into an additional Qt3D aspect.
-
- For example, the QLogicComponent can be used to animate a property in sync
- with the Qt3D engine where a Qt Quick animation element is not perfectly
- synchronized and may lead to stutters in some cases.
-
- To execute your own code each frame override the onFrameUpdate function.
-*/
-
-/*!
- \qmltype LogicComponent
- \inqmlmodule Qt3D.Logic
- \instantiates Qt3DLogic::QLogicComponent
- \inherits Component3D
- \since 5.5
-*/
-
-/*!
- Constructs a new QLogicComponent instance with parent \a parent.
- */
-QLogicComponent::QLogicComponent(QNode *parent)
- : QComponent(*new QLogicComponentPrivate, parent)
-{
-}
-
-/*! \internal */
-QLogicComponent::QLogicComponent(QLogicComponentPrivate &dd, QNode *parent)
- : QComponent(dd, parent)
-{
-}
-
-QLogicComponent::~QLogicComponent()
-{
- QNode::cleanup();
-}
-
-/*!
- This virtual function will be called in a synchronous manner once each frame by
- the Logic aspect.
-*/
-void QLogicComponent::onFrameUpdate(float dt)
-{
- // Emit signal so that QML instances get the onFrameUpdate() signal
- // handler called
- emit frameUpdate(dt);
-}
-
-} // namespace Qt3DLogic
-
-QT_END_NAMESPACE
diff --git a/src/logic/qlogiccomponent.h b/src/logic/qlogiccomponent.h
deleted file mode 100644
index 3d2e9739a..000000000
--- a/src/logic/qlogiccomponent.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DLOGIC_QLOGICCOMPONENT_H
-#define QT3DLOGIC_QLOGICCOMPONENT_H
-
-#include <Qt3DCore/qcomponent.h>
-#include <Qt3DLogic/qt3dlogic_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DLogic {
-
-class QLogicAspect;
-class QLogicComponentPrivate;
-
-namespace Logic {
-class Executor;
-}
-
-class QT3DLOGICSHARED_EXPORT QLogicComponent : public Qt3DCore::QComponent
-{
- Q_OBJECT
-
-public:
- explicit QLogicComponent(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QLogicComponent();
-
-protected:
- QLogicComponent(QLogicComponentPrivate &dd, QNode *parent = Q_NULLPTR);
-
-Q_SIGNALS:
- void frameUpdate(float dt);
-
-private:
- Q_DECLARE_PRIVATE(QLogicComponent)
- QT3D_CLONEABLE(QLogicComponent)
-
- virtual void onFrameUpdate(float dt);
-
- friend class Logic::Executor;
-};
-
-} // namespace Qt3DLogic
-
-QT_END_NAMESPACE
-
-#endif // QT3DLOGIC_QLOGICCOMPONENT_H
diff --git a/src/logic/qlogiccomponent_p.h b/src/logic/qlogiccomponent_p.h
deleted file mode 100644
index 245c1b7c7..000000000
--- a/src/logic/qlogiccomponent_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DLOGIC_QLOGICCOMPONENT_P_H
-#define QT3DLOGIC_QLOGICCOMPONENT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qcomponent_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DLogic {
-
-class QLogicComponent;
-
-class QLogicComponentPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QLogicComponentPrivate();
-
- Q_DECLARE_PUBLIC(QLogicComponent)
-};
-
-} // namespace Qt3DLogic
-
-QT_END_NAMESPACE
-
-#endif // QT3DLOGIC_QLOGICCOMPONENT_P_H
diff --git a/src/logic/qt3dlogic_global.h b/src/logic/qt3dlogic_global.h
index 129e7f52c..1e6610058 100644
--- a/src/logic/qt3dlogic_global.h
+++ b/src/logic/qt3dlogic_global.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DLOGIC_GLOBAL_H
#define QT3DLOGIC_GLOBAL_H
-#include <QtCore/qglobal.h>
+#include <Qt3DCore/qt3dcore_global.h>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/sceneparsers/assimp/assimp.pro b/src/plugins/sceneparsers/assimp/assimp.pro
index 71fffe2e7..8d472b149 100644
--- a/src/plugins/sceneparsers/assimp/assimp.pro
+++ b/src/plugins/sceneparsers/assimp/assimp.pro
@@ -1,21 +1,23 @@
-TARGET = assimpsceneparser
-
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private
+TARGET = assimpsceneio
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private 3dextras
include(../../../3rdparty/assimp/assimp_dependency.pri)
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
HEADERS += \
assimphelpers.h \
- assimpparser.h
+ assimpio.h
SOURCES += \
- assimpparser.cpp \
assimphelpers.cpp \
- main.cpp
+ main.cpp \
+ assimpio.cpp
DISTFILES += \
assimp.json
PLUGIN_TYPE = sceneparsers
-PLUGIN_CLASS_NAME = AssimpParserPlugin
+PLUGIN_CLASS_NAME = AssimpSceneIOPlugin
load(qt_plugin)
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers.cpp b/src/plugins/sceneparsers/assimp/assimphelpers.cpp
index 474885bd3..a8d935216 100644
--- a/src/plugins/sceneparsers/assimp/assimphelpers.cpp
+++ b/src/plugins/sceneparsers/assimp/assimphelpers.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,7 +65,7 @@ AssimpIOStream::AssimpIOStream(QIODevice *device) :
Assimp::IOStream(),
m_device(device)
{
- Q_ASSERT(m_device != Q_NULLPTR);
+ Q_ASSERT(m_device != nullptr);
}
/*!
@@ -210,7 +213,7 @@ Assimp::IOStream *AssimpIOSystem::Open(const char *pFile, const char *pMode)
if (file->open(openMode))
return new AssimpIOStream(file.take());
- return Q_NULLPTR;
+ return nullptr;
}
/*!
diff --git a/src/plugins/sceneparsers/assimp/assimphelpers.h b/src/plugins/sceneparsers/assimp/assimphelpers.h
index 8f7855730..21ac1b1ef 100644
--- a/src/plugins/sceneparsers/assimp/assimphelpers.h
+++ b/src/plugins/sceneparsers/assimp/assimphelpers.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/plugins/sceneparsers/assimp/assimpio.cpp b/src/plugins/sceneparsers/assimp/assimpio.cpp
new file mode 100644
index 000000000..3240b8891
--- /dev/null
+++ b/src/plugins/sceneparsers/assimp/assimpio.cpp
@@ -0,0 +1,984 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "assimpio.h"
+
+#include <Qt3DCore/private/qabstractnodefactory_p.h>
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qtransform.h>
+#include <Qt3DRender/qcameralens.h>
+#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qmesh.h>
+#include <Qt3DRender/qmaterial.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qattribute.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DExtras/qdiffusemapmaterial.h>
+#include <Qt3DExtras/qdiffusespecularmapmaterial.h>
+#include <Qt3DExtras/qphongmaterial.h>
+#include <QFileInfo>
+#include <QColor>
+#include <qmath.h>
+#include <Qt3DRender/private/renderlogging_p.h>
+#include <Qt3DRender/private/qurlhelper_p.h>
+#include <Qt3DRender/qgeometryrenderer.h>
+#include <Qt3DRender/qgeometry.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+using namespace Qt3DExtras;
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::AssimpIO
+ \inmodule Qt3DRender
+ \since 5.5
+
+ \brief Provides a generic way of loading various 3D assets
+ format into a Qt3D scene.
+
+ It should be noted that Assimp aiString is explicitly defined to be UTF-8.
+
+ \sa GLTFPIO
+*/
+
+Q_LOGGING_CATEGORY(AssimpIOLog, "Qt3D.AssimpIO")
+
+namespace {
+
+const QString ASSIMP_MATERIAL_DIFFUSE_COLOR = QStringLiteral("kd");
+const QString ASSIMP_MATERIAL_SPECULAR_COLOR = QStringLiteral("ks");
+const QString ASSIMP_MATERIAL_AMBIENT_COLOR = QStringLiteral("ka");
+const QString ASSIMP_MATERIAL_EMISSIVE_COLOR = QStringLiteral("emissive");
+const QString ASSIMP_MATERIAL_TRANSPARENT_COLOR = QStringLiteral("transparent");
+const QString ASSIMP_MATERIAL_REFLECTIVE_COLOR = QStringLiteral("reflective");
+
+const QString ASSIMP_MATERIAL_DIFFUSE_TEXTURE = QStringLiteral("diffuseTexture");
+const QString ASSIMP_MATERIAL_AMBIENT_TEXTURE = QStringLiteral("ambientTex");
+const QString ASSIMP_MATERIAL_SPECULAR_TEXTURE = QStringLiteral("specularTexture");
+const QString ASSIMP_MATERIAL_EMISSIVE_TEXTURE = QStringLiteral("emissiveTex");
+const QString ASSIMP_MATERIAL_NORMALS_TEXTURE = QStringLiteral("normalsTex");
+const QString ASSIMP_MATERIAL_OPACITY_TEXTURE = QStringLiteral("opacityTex");
+const QString ASSIMP_MATERIAL_REFLECTION_TEXTURE = QStringLiteral("reflectionTex");
+const QString ASSIMP_MATERIAL_HEIGHT_TEXTURE = QStringLiteral("heightTex");
+const QString ASSIMP_MATERIAL_LIGHTMAP_TEXTURE = QStringLiteral("opacityTex");
+const QString ASSIMP_MATERIAL_DISPLACEMENT_TEXTURE = QStringLiteral("displacementTex");
+const QString ASSIMP_MATERIAL_SHININESS_TEXTURE = QStringLiteral("shininessTex");
+
+const QString ASSIMP_MATERIAL_IS_TWOSIDED = QStringLiteral("twosided");
+const QString ASSIMP_MATERIAL_IS_WIREFRAME = QStringLiteral("wireframe");
+
+const QString ASSIMP_MATERIAL_OPACITY = QStringLiteral("opacity");
+const QString ASSIMP_MATERIAL_SHININESS = QStringLiteral("shininess");
+const QString ASSIMP_MATERIAL_SHININESS_STRENGTH = QStringLiteral("shininess_strength");
+const QString ASSIMP_MATERIAL_REFRACTI = QStringLiteral("refracti");
+const QString ASSIMP_MATERIAL_REFLECTIVITY = QStringLiteral("reflectivity");
+
+const QString ASSIMP_MATERIAL_NAME = QStringLiteral("name");
+
+const QString VERTICES_ATTRIBUTE_NAME = QAttribute::defaultPositionAttributeName();
+const QString NORMAL_ATTRIBUTE_NAME = QAttribute::defaultNormalAttributeName();
+const QString TANGENT_ATTRIBUTE_NAME = QAttribute::defaultTangentAttributeName();
+const QString TEXTCOORD_ATTRIBUTE_NAME = QAttribute::defaultTextureCoordinateAttributeName();
+const QString COLOR_ATTRIBUTE_NAME = QAttribute::defaultColorAttributeName();
+
+/*!
+ * Returns a QMatrix4x4 from \a matrix;
+ */
+QMatrix4x4 aiMatrix4x4ToQMatrix4x4(const aiMatrix4x4 &matrix) Q_DECL_NOEXCEPT
+{
+ return QMatrix4x4(matrix.a1, matrix.a2, matrix.a3, matrix.a4,
+ matrix.b1, matrix.b2, matrix.b3, matrix.b4,
+ matrix.c1, matrix.c2, matrix.c3, matrix.c4,
+ matrix.d1, matrix.d2, matrix.d3, matrix.d4);
+}
+
+/*!
+ * Returns a QString from \a str;
+ */
+static inline QString aiStringToQString(const aiString &str)
+{
+ return QString::fromUtf8(str.data, int(str.length));
+}
+
+QMaterial *createBestApproachingMaterial(const aiMaterial *assimpMaterial) Q_DECL_NOEXCEPT
+{
+ aiString path; // unused but necessary
+ const bool hasDiffuseTexture = (assimpMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &path) == AI_SUCCESS);
+ const bool hasSpecularTexture = (assimpMaterial->GetTexture(aiTextureType_SPECULAR, 0, &path) == AI_SUCCESS);
+
+ if (hasDiffuseTexture && hasSpecularTexture)
+ return QAbstractNodeFactory::createNode<QDiffuseSpecularMapMaterial>("QDiffuseSpecularMapMaterial");
+ if (hasDiffuseTexture)
+ return QAbstractNodeFactory::createNode<QDiffuseMapMaterial>("QDiffuseMapMaterial");
+ return QAbstractNodeFactory::createNode<QPhongMaterial>("QPhongMaterial");
+}
+
+QString texturePath(const aiString &path)
+{
+ QString p = aiStringToQString(path);
+ if (p.startsWith('/'))
+ p.remove(0, 1);
+ return p;
+}
+
+/*!
+ * Returns the Qt3DRender::QParameter with named \a name if contained by the material
+ * \a material. If the material doesn't contain the named parameter, a new
+ * Qt3DRender::QParameter is created and inserted into the material.
+ */
+QParameter *findNamedParameter(const QString &name, QMaterial *material)
+{
+ // Does the material contain the parameter ?
+ const auto params = material->parameters();
+ for (QParameter *p : params) {
+ if (p->name() == name)
+ return p;
+ }
+
+ // Does the material's effect contain the parameter ?
+ if (material->effect()) {
+ const QEffect *e = material->effect();
+ const auto params = e->parameters();
+ for (QParameter *p : params) {
+ if (p->name() == name)
+ return p;
+ }
+ }
+
+ // Create and add parameter to material
+ QParameter *p = QAbstractNodeFactory::createNode<QParameter>("QParameter");
+ p->setParent(material);
+ p->setName(name);
+ material->addParameter(p);
+ return p;
+}
+
+void setParameterValue(const QString &name, QMaterial *material, const QVariant &value)
+{
+ QParameter *p = findNamedParameter(name, material);
+ p->setValue(value);
+}
+
+QAttribute *createAttribute(QBuffer *buffer,
+ const QString &name,
+ QAttribute::VertexBaseType vertexBaseType,
+ uint vertexSize,
+ uint count,
+ uint byteOffset = 0,
+ uint byteStride = 0,
+ QNode *parent = nullptr)
+{
+ QAttribute *attribute = QAbstractNodeFactory::createNode<QAttribute>("QAttribute");
+ attribute->setBuffer(buffer);
+ attribute->setName(name);
+ attribute->setDataType(vertexBaseType);
+ attribute->setDataSize(vertexSize);
+ attribute->setCount(count);
+ attribute->setByteOffset(byteOffset);
+ attribute->setByteStride(byteStride);
+ attribute->setParent(parent);
+ return attribute;
+}
+
+QAttribute *createAttribute(QBuffer *buffer,
+ QAttribute::VertexBaseType vertexBaseType,
+ uint vertexSize,
+ uint count,
+ uint byteOffset = 0,
+ uint byteStride = 0,
+ QNode *parent = nullptr)
+{
+ QAttribute *attribute = QAbstractNodeFactory::createNode<QAttribute>("QAttribute");
+ attribute->setBuffer(buffer);
+ attribute->setDataType(vertexBaseType);
+ attribute->setDataSize(vertexSize);
+ attribute->setCount(count);
+ attribute->setByteOffset(byteOffset);
+ attribute->setByteStride(byteStride);
+ attribute->setParent(parent);
+ return attribute;
+}
+
+} // anonymous
+
+QStringList AssimpIO::assimpSupportedFormatsList = AssimpIO::assimpSupportedFormats();
+
+/*!
+ * Returns a QStringlist with the suffixes of the various supported asset formats.
+ */
+QStringList AssimpIO::assimpSupportedFormats()
+{
+ QStringList formats;
+
+ formats.reserve(60);
+ formats.append(QStringLiteral("3d"));
+ formats.append(QStringLiteral("3ds"));
+ formats.append(QStringLiteral("ac"));
+ formats.append(QStringLiteral("ac3d"));
+ formats.append(QStringLiteral("acc"));
+ formats.append(QStringLiteral("ase"));
+ formats.append(QStringLiteral("ask"));
+ formats.append(QStringLiteral("b3d"));
+ formats.append(QStringLiteral("blend"));
+ formats.append(QStringLiteral("bvh"));
+ formats.append(QStringLiteral("cob"));
+ formats.append(QStringLiteral("csm"));
+ formats.append(QStringLiteral("dae"));
+ formats.append(QStringLiteral("dxf"));
+ formats.append(QStringLiteral("enff"));
+ formats.append(QStringLiteral("hmp"));
+ formats.append(QStringLiteral("irr"));
+ formats.append(QStringLiteral("irrmesh"));
+ formats.append(QStringLiteral("lwo"));
+ formats.append(QStringLiteral("lws"));
+ formats.append(QStringLiteral("lxo"));
+ formats.append(QStringLiteral("md2"));
+ formats.append(QStringLiteral("md3"));
+ formats.append(QStringLiteral("md5anim"));
+ formats.append(QStringLiteral("md5camera"));
+ formats.append(QStringLiteral("md5mesh"));
+ formats.append(QStringLiteral("mdc"));
+ formats.append(QStringLiteral("mdl"));
+ formats.append(QStringLiteral("mesh.xml"));
+ formats.append(QStringLiteral("mot"));
+ formats.append(QStringLiteral("ms3d"));
+ formats.append(QStringLiteral("ndo"));
+ formats.append(QStringLiteral("nff"));
+ formats.append(QStringLiteral("obj"));
+ formats.append(QStringLiteral("off"));
+ formats.append(QStringLiteral("pk3"));
+ formats.append(QStringLiteral("ply"));
+ formats.append(QStringLiteral("prj"));
+ formats.append(QStringLiteral("q3o"));
+ formats.append(QStringLiteral("q3s"));
+ formats.append(QStringLiteral("raw"));
+ formats.append(QStringLiteral("scn"));
+ formats.append(QStringLiteral("smd"));
+ formats.append(QStringLiteral("stl"));
+ formats.append(QStringLiteral("ter"));
+ formats.append(QStringLiteral("uc"));
+ formats.append(QStringLiteral("vta"));
+ formats.append(QStringLiteral("x"));
+ formats.append(QStringLiteral("xml"));
+
+ return formats;
+}
+
+class AssimpRawTextureImage : public QAbstractTextureImage
+{
+ Q_OBJECT
+public:
+ explicit AssimpRawTextureImage(QNode *parent = 0);
+
+ QTextureImageDataGeneratorPtr dataGenerator() const Q_DECL_FINAL;
+
+ void setData(const QByteArray &data);
+
+private:
+ QByteArray m_data;
+
+ class AssimpRawTextureImageFunctor : public QTextureImageDataGenerator
+ {
+ public:
+ explicit AssimpRawTextureImageFunctor(const QByteArray &data);
+
+ QTextureImageDataPtr operator()() Q_DECL_FINAL;
+ bool operator ==(const QTextureImageDataGenerator &other) const Q_DECL_FINAL;
+
+ QT3D_FUNCTOR(AssimpRawTextureImageFunctor)
+ private:
+ QByteArray m_data;
+ };
+};
+
+/*!
+ * Constructor. Initializes a new instance of AssimpIO.
+ */
+AssimpIO::AssimpIO() : QSceneIOHandler(),
+ m_sceneParsed(false),
+ m_scene(nullptr)
+{
+}
+
+/*!
+ * Destructor. Cleans the parser properly before destroying it.
+ */
+AssimpIO::~AssimpIO()
+{
+ cleanup();
+}
+
+/*!
+ * Returns \c true if the provided \a path has a suffix supported
+ * by the Assimp Assets importer.
+ */
+bool AssimpIO::isAssimpPath(const QString &path)
+{
+ QFileInfo fileInfo(path);
+
+ if (!fileInfo.exists() ||
+ !AssimpIO::assimpSupportedFormatsList.contains(fileInfo.suffix().toLower()))
+ return false;
+ return true;
+}
+
+/*!
+ * Sets the \a source used by the parser to load the asset file.
+ * If the file is valid, this will trigger parsing of the file.
+ */
+void AssimpIO::setSource(const QUrl &source)
+{
+ const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
+ QFileInfo file(path);
+ m_sceneDir = file.absoluteDir();
+ if (!file.exists()) {
+ qCWarning(AssimpIOLog) << "File missing " << path;
+ return ;
+ }
+ readSceneFile(path);
+}
+
+/*!
+ * Returns \c true if the extension of \a source is supported by
+ * the assimp parser.
+ */
+bool AssimpIO::isFileTypeSupported(const QUrl &source) const
+{
+ const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
+ return AssimpIO::isAssimpPath(path);
+}
+
+/*!
+ * Returns a Entity node which is the root node of the scene
+ * node specified by \a id. If \a id is empty, the scene is assumed to be
+ * the root node of the scene.
+ *
+ * Returns \c nullptr if \a id was specified but no node matching it was found.
+ */
+Qt3DCore::QEntity *AssimpIO::scene(const QString &id)
+{
+ // m_aiScene shouldn't be null.
+ // If it is either, the file failed to be imported or
+ // setFilePath was not called
+ if (m_scene == nullptr || m_scene->m_aiScene == nullptr)
+ return nullptr;
+
+ aiNode *rootNode = m_scene->m_aiScene->mRootNode;
+ // if id specified, tries to find node
+ if (!id.isEmpty() &&
+ !(rootNode = rootNode->FindNode(id.toUtf8().constData()))) {
+ qCDebug(AssimpIOLog) << Q_FUNC_INFO << " Couldn't find requested scene node";
+ return nullptr;
+ }
+
+ // Builds the Qt3D scene using the Assimp aiScene
+ // and the various dicts filled previously by parse
+ return node(rootNode);
+}
+
+/*!
+ * Returns a Node from the scene identified by \a id.
+ * Returns \c nullptr if the node was not found.
+ */
+Qt3DCore::QEntity *AssimpIO::node(const QString &id)
+{
+ if (m_scene == nullptr || m_scene->m_aiScene == nullptr)
+ return nullptr;
+ parse();
+ aiNode *n = m_scene->m_aiScene->mRootNode->FindNode(id.toUtf8().constData());
+ return node(n);
+}
+
+/*!
+ * Returns a Node from an Assimp aiNode \a node.
+ */
+Qt3DCore::QEntity *AssimpIO::node(aiNode *node)
+{
+ if (node == nullptr)
+ return nullptr;
+ QEntity *entityNode = QAbstractNodeFactory::createNode<Qt3DCore::QEntity>("QEntity");
+ entityNode->setObjectName(aiStringToQString(node->mName));
+
+ // Add Meshes to the node
+ for (uint i = 0; i < node->mNumMeshes; i++) {
+ uint meshIdx = node->mMeshes[i];
+ QGeometryRenderer *mesh = m_scene->m_meshes[meshIdx];
+ // mesh material
+ uint materialIndex = m_scene->m_aiScene->mMeshes[meshIdx]->mMaterialIndex;
+ if (m_scene->m_materials.contains(materialIndex))
+ entityNode->addComponent(m_scene->m_materials[materialIndex]);
+ // mesh
+ entityNode->addComponent(mesh);
+ }
+
+ // Add Children to Node
+ for (uint i = 0; i < node->mNumChildren; i++) {
+ // this-> is necessary here otherwise
+ // it conflicts with the variable node
+ QEntity *child = this->node(node->mChildren[i]);
+ // Are we sure each child are unique ???
+ if (child != nullptr)
+ child->setParent(entityNode);
+ }
+
+ // Add Transformations
+ const QMatrix4x4 qTransformMatrix = aiMatrix4x4ToQMatrix4x4(node->mTransformation);
+ Qt3DCore::QTransform *transform = QAbstractNodeFactory::createNode<Qt3DCore::QTransform>("QTransform");
+ transform->setMatrix(qTransformMatrix);
+ entityNode->addComponent(transform);
+
+ // Add Camera
+ if (m_scene->m_cameras.contains(node))
+ m_scene->m_cameras[node]->setParent(entityNode);
+
+ // TO DO : Add lights ....
+
+ return entityNode;
+}
+
+/*!
+ * Reads the scene file pointed by \a path and launches the parsing of
+ * the scene using Assimp, after having cleaned up previously saved values
+ * from eventual previous parsings.
+ */
+void AssimpIO::readSceneFile(const QString &path)
+{
+ cleanup();
+
+ m_scene = new SceneImporter();
+
+ // SET THIS TO REMOVE POINTS AND LINES -> HAVE ONLY TRIANGLES
+ m_scene->m_importer->SetPropertyInteger(AI_CONFIG_PP_SBP_REMOVE, aiPrimitiveType_LINE|aiPrimitiveType_POINT);
+ // SET CUSTOM FILE HANDLER TO HANDLE FILE READING THROUGH QT (RESOURCES, SOCKET ...)
+ m_scene->m_importer->SetIOHandler(new AssimpHelper::AssimpIOSystem());
+
+ // type and aiProcess_Triangulate discompose polygons with more than 3 points in triangles
+ // aiProcess_SortByPType makes sur that meshes data are triangles
+ m_scene->m_aiScene = m_scene->m_importer->ReadFile(path.toUtf8().constData(),
+ aiProcess_SortByPType|
+ aiProcess_Triangulate|
+ aiProcess_JoinIdenticalVertices|
+ aiProcess_GenSmoothNormals|
+ aiProcess_FlipUVs);
+ if (m_scene->m_aiScene == nullptr) {
+ qCWarning(AssimpIOLog) << "Assimp scene import failed";
+ return ;
+ }
+ parse();
+}
+
+/*!
+ * Cleans the various dictionaries holding the scene's information.
+ */
+void AssimpIO::cleanup()
+{
+ m_sceneParsed = false;
+ delete m_scene;
+ m_scene = nullptr;
+}
+
+/*!
+ * Parses the aiScene provided py Assimp and converts Assimp
+ * values to Qt3D values.
+ */
+void AssimpIO::parse()
+{
+ if (!m_sceneParsed) {
+ // Set parsed flags
+ m_sceneParsed = !m_sceneParsed;
+
+ for (uint i = 0; i < m_scene->m_aiScene->mNumTextures; i++)
+ loadEmbeddedTexture(i);
+ for (uint i = 0; i < m_scene->m_aiScene->mNumMaterials; i++)
+ loadMaterial(i);
+ for (uint i = 0; i < m_scene->m_aiScene->mNumMeshes; i++)
+ loadMesh(i);
+ for (uint i = 0; i < m_scene->m_aiScene->mNumCameras; i++)
+ loadCamera(i);
+ for (uint i = 0; i < m_scene->m_aiScene->mNumLights; i++)
+ loadLight(i);
+ for (uint i = 0; i < m_scene->m_aiScene->mNumAnimations; i++)
+ loadAnimation(i);
+ }
+}
+
+/*!
+ * Converts the provided Assimp aiMaterial identified by \a materialIndex to a
+ * Qt3D material and adds it to a dictionary of materials.
+ * \sa Material
+ */
+void AssimpIO::loadMaterial(uint materialIndex)
+{
+ // Generates default material based on what the assimp material contains
+ aiMaterial *assimpMaterial = m_scene->m_aiScene->mMaterials[materialIndex];
+ QMaterial *material = createBestApproachingMaterial(assimpMaterial);
+ // Material Name
+ copyMaterialName(material, assimpMaterial);
+ copyMaterialColorProperties(material, assimpMaterial);
+ copyMaterialBoolProperties(material, assimpMaterial);
+ copyMaterialFloatProperties(material, assimpMaterial);
+
+ // Add textures to materials dict
+ copyMaterialTextures(material, assimpMaterial);
+
+ m_scene->m_materials.insert(materialIndex, material);
+}
+
+/*!
+ * Converts the Assimp aiMesh mesh identified by \a meshIndex to a QGeometryRenderer
+ * and adds it to a dictionary of meshes.
+ * \sa QGeometryRenderer
+ */
+void AssimpIO::loadMesh(uint meshIndex)
+{
+ aiMesh *mesh = m_scene->m_aiScene->mMeshes[meshIndex];
+
+ QGeometryRenderer *geometryRenderer = QAbstractNodeFactory::createNode<QGeometryRenderer>("QGeometryRenderer");
+ QGeometry *meshGeometry = QAbstractNodeFactory::createNode<QGeometry>("QGeometry");
+ meshGeometry->setParent(geometryRenderer);
+ Qt3DRender::QBuffer *vertexBuffer = QAbstractNodeFactory::createNode<Qt3DRender::QBuffer>("QBuffer");
+ vertexBuffer->setParent(meshGeometry);
+ vertexBuffer->setType(Qt3DRender::QBuffer::VertexBuffer);
+ Qt3DRender::QBuffer *indexBuffer = QAbstractNodeFactory::createNode<Qt3DRender::QBuffer>("QBuffer");
+ indexBuffer->setParent(meshGeometry);
+ indexBuffer->setType(Qt3DRender::QBuffer::IndexBuffer);
+
+ geometryRenderer->setGeometry(meshGeometry);
+
+ // Primitive are always triangles with the current Assimp's configuration
+
+ // Vertices and Normals always present with the current Assimp's configuration
+ aiVector3D *vertices = mesh->mVertices;
+ aiVector3D *normals = mesh->mNormals;
+ aiColor4D *colors = mesh->mColors[0];
+ // Tangents and TextureCoord not always present
+ bool hasTangent = mesh->HasTangentsAndBitangents();
+ bool hasTexture = mesh->HasTextureCoords(0);
+ bool hasColor = (colors != NULL); // NULL defined by Assimp
+ aiVector3D *tangents = hasTangent ? mesh->mTangents : nullptr;
+ aiVector3D *textureCoord = hasTexture ? mesh->mTextureCoords[0] : nullptr;
+
+ // Add values in raw float array
+ ushort chunkSize = 6 + (hasTangent ? 3 : 0) + (hasTexture ? 2 : 0) + (hasColor ? 4 : 0);
+ QByteArray bufferArray;
+ bufferArray.resize(chunkSize * mesh->mNumVertices * sizeof(float));
+ float *vbufferContent = reinterpret_cast<float*>(bufferArray.data());
+ for (uint i = 0; i < mesh->mNumVertices; i++) {
+ uint idx = i * chunkSize;
+ // position
+ vbufferContent[idx] = vertices[i].x;
+ vbufferContent[idx + 1] = vertices[i].y;
+ vbufferContent[idx + 2] = vertices[i].z;
+ // normals
+ vbufferContent[idx + 3] = normals[i].x;
+ vbufferContent[idx + 4] = normals[i].y;
+ vbufferContent[idx + 5] = normals[i].z;
+
+ if (hasTangent) {
+ vbufferContent[idx + 6] = tangents[i].x;
+ vbufferContent[idx + 7] = tangents[i].y;
+ vbufferContent[idx + 8] = tangents[i].z;
+ }
+ if (hasTexture) {
+ char offset = (hasTangent ? 9 : 6);
+ vbufferContent[idx + offset] = textureCoord[i].x;
+ vbufferContent[idx + offset + 1] = textureCoord[i].y;
+ }
+ if (hasColor) {
+ char offset = 6 + (hasTangent ? 3 : 0) + (hasTexture ? 2 : 0);
+ vbufferContent[idx + offset] = colors[i].r;
+ vbufferContent[idx + offset + 1] = colors[i].g;
+ vbufferContent[idx + offset + 2] = colors[i].b;
+ vbufferContent[idx + offset + 3] = colors[i].a;
+ }
+ }
+
+ vertexBuffer->setData(bufferArray);
+
+ // Add vertex attributes to the mesh with the right array
+ QAttribute *positionAttribute = createAttribute(vertexBuffer, VERTICES_ATTRIBUTE_NAME,
+ QAttribute::Float, 3,
+ mesh->mNumVertices,
+ 0,
+ chunkSize * sizeof(float));
+
+ QAttribute *normalAttribute = createAttribute(vertexBuffer, NORMAL_ATTRIBUTE_NAME,
+ QAttribute::Float, 3,
+ mesh->mNumVertices,
+ 3 * sizeof(float),
+ chunkSize * sizeof(float));
+
+ meshGeometry->addAttribute(positionAttribute);
+ meshGeometry->addAttribute(normalAttribute);
+
+ if (hasTangent) {
+ QAttribute *tangentsAttribute = createAttribute(vertexBuffer, TANGENT_ATTRIBUTE_NAME,
+ QAttribute::Float, 3,
+ mesh->mNumVertices,
+ 6 * sizeof(float),
+ chunkSize * sizeof(float));
+ meshGeometry->addAttribute(tangentsAttribute);
+ }
+
+ if (hasTexture) {
+ QAttribute *textureCoordAttribute = createAttribute(vertexBuffer, TEXTCOORD_ATTRIBUTE_NAME,
+ QAttribute::Float, 2,
+ mesh->mNumVertices,
+ (hasTangent ? 9 : 6) * sizeof(float),
+ chunkSize * sizeof(float));
+ meshGeometry->addAttribute(textureCoordAttribute);
+ }
+
+ if (hasColor) {
+ QAttribute *colorAttribute = createAttribute(vertexBuffer, COLOR_ATTRIBUTE_NAME,
+ QAttribute::Float, 4,
+ mesh->mNumVertices,
+ (6 + (hasTangent ? 3 : 0) + (hasTexture ? 2 : 0)) * sizeof(float),
+ chunkSize * sizeof(float));
+ meshGeometry->addAttribute(colorAttribute);
+ }
+
+ QAttribute::VertexBaseType indiceType;
+ QByteArray ibufferContent;
+ uint indices = mesh->mNumFaces * 3;
+ // If there are less than 65535 indices, indices can then fit in ushort
+ // which saves video memory
+ if (indices >= USHRT_MAX) {
+ indiceType = QAttribute::UnsignedInt;
+ ibufferContent.resize(indices * sizeof(quint32));
+ for (uint i = 0; i < mesh->mNumFaces; i++) {
+ aiFace face = mesh->mFaces[i];
+ Q_ASSERT(face.mNumIndices == 3);
+ memcpy(&reinterpret_cast<quint32*>(ibufferContent.data())[i * 3], face.mIndices, 3 * sizeof(uint));
+ }
+ }
+ else {
+ indiceType = QAttribute::UnsignedShort;
+ ibufferContent.resize(indices * sizeof(quint16));
+ for (uint i = 0; i < mesh->mNumFaces; i++) {
+ aiFace face = mesh->mFaces[i];
+ Q_ASSERT(face.mNumIndices == 3);
+ for (ushort j = 0; j < face.mNumIndices; j++)
+ reinterpret_cast<quint16*>(ibufferContent.data())[i * 3 + j] = face.mIndices[j];
+ }
+ }
+
+ indexBuffer->setData(ibufferContent);
+
+ // Add indices attributes
+ QAttribute *indexAttribute = createAttribute(indexBuffer, indiceType, 1, indices);
+ indexAttribute->setAttributeType(QAttribute::IndexAttribute);
+
+ meshGeometry->addAttribute(indexAttribute);
+
+ m_scene->m_meshes[meshIndex] = geometryRenderer;
+
+ qCDebug(AssimpIOLog) << Q_FUNC_INFO << " Mesh " << aiStringToQString(mesh->mName)
+ << " Vertices " << mesh->mNumVertices << " Faces " << mesh->mNumFaces << " Indices " << indices;
+}
+
+/*!
+ * Converts the provided Assimp aiTexture at \a textureIndex to a Texture and
+ * adds it to a dictionary of textures.
+ * \sa Texture
+ */
+void AssimpIO::loadEmbeddedTexture(uint textureIndex)
+{
+ aiTexture *assimpTexture = m_scene->m_aiScene->mTextures[textureIndex];
+ QAbstractTexture *texture = QAbstractNodeFactory::createNode<QTexture2D>("QTexture2D");
+ AssimpRawTextureImage *imageData = new AssimpRawTextureImage();
+
+ bool isCompressed = assimpTexture->mHeight == 0;
+ uint textureSize = assimpTexture->mWidth *
+ (isCompressed ? assimpTexture->mHeight : 1);
+ // Set texture to RGBA8888
+ QByteArray textureContent;
+ textureContent.reserve(textureSize * 4);
+ for (uint i = 0; i < textureSize; i++) {
+ uint idx = i * 4;
+ aiTexel texel = assimpTexture->pcData[i];
+ textureContent[idx] = texel.r;
+ textureContent[idx + 1] = texel.g;
+ textureContent[idx + 2] = texel.b;
+ textureContent[idx + 3] = texel.a;
+ }
+ imageData->setData(textureContent);
+ texture->addTextureImage(imageData);
+ m_scene->m_embeddedTextures[textureIndex] = texture;
+}
+
+/*!
+ * Loads the light in the current scene located at \a lightIndex.
+ */
+void AssimpIO::loadLight(uint lightIndex)
+{
+ aiLight *light = m_scene->m_aiScene->mLights[lightIndex];
+ // TODO: Implement me!
+ Q_UNUSED(light);
+}
+
+/*!
+ * Parses the camera at cameraIndex and saves it to a dictionary of cameras.
+ */
+void AssimpIO::loadCamera(uint cameraIndex)
+{
+ aiCamera *assimpCamera = m_scene->m_aiScene->mCameras[cameraIndex];
+ aiNode *cameraNode = m_scene->m_aiScene->mRootNode->FindNode(assimpCamera->mName);
+
+ // If no node is associated to the camera in the scene, camera not saved
+ if (cameraNode == nullptr)
+ return ;
+
+ QEntity *camera = QAbstractNodeFactory::createNode<Qt3DCore::QEntity>("QEntity");
+ QCameraLens *lens = QAbstractNodeFactory::createNode<QCameraLens>("QCameraLens");
+
+ lens->setObjectName(aiStringToQString(assimpCamera->mName));
+ lens->setPerspectiveProjection(qRadiansToDegrees(assimpCamera->mHorizontalFOV),
+ qMax(assimpCamera->mAspect, 1.0f),
+ assimpCamera->mClipPlaneNear,
+ assimpCamera->mClipPlaneFar);
+ camera->addComponent(lens);
+
+ QMatrix4x4 m;
+ m.lookAt(QVector3D(assimpCamera->mPosition.x, assimpCamera->mPosition.y, assimpCamera->mPosition.z),
+ QVector3D(assimpCamera->mLookAt.x, assimpCamera->mLookAt.y, assimpCamera->mLookAt.z),
+ QVector3D(assimpCamera->mUp.x, assimpCamera->mUp.y, assimpCamera->mUp.z));
+ Qt3DCore::QTransform *transform = QAbstractNodeFactory::createNode<Qt3DCore::QTransform>("QTransform");
+ transform->setMatrix(m);
+ camera->addComponent(transform);
+
+ m_scene->m_cameras[cameraNode] = camera;
+}
+
+// OPTIONAL
+void AssimpIO::loadAnimation(uint animationIndex)
+{
+ Q_UNUSED(animationIndex);
+}
+
+/*!
+ * Sets the object name of \a material to the name of \a assimpMaterial.
+ */
+void AssimpIO::copyMaterialName(QMaterial *material, aiMaterial *assimpMaterial)
+{
+ aiString name;
+ if (assimpMaterial->Get(AI_MATKEY_NAME, name) == aiReturn_SUCCESS) {
+ // May not be necessary
+ // Kept for debug purposes at the moment
+ material->setObjectName(aiStringToQString(name));
+ qCDebug(AssimpIOLog) << Q_FUNC_INFO << "Assimp Material " << material->objectName();
+ }
+}
+
+/*!
+ * Fills \a material color properties with \a assimpMaterial color properties.
+ */
+void AssimpIO::copyMaterialColorProperties(QMaterial *material, aiMaterial *assimpMaterial)
+{
+ aiColor3D color;
+ if (assimpMaterial->Get(AI_MATKEY_COLOR_DIFFUSE, color) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_DIFFUSE_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
+ if (assimpMaterial->Get(AI_MATKEY_COLOR_SPECULAR, color) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_SPECULAR_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
+ if (assimpMaterial->Get(AI_MATKEY_COLOR_AMBIENT, color) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_AMBIENT_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
+ if (assimpMaterial->Get(AI_MATKEY_COLOR_EMISSIVE, color) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_EMISSIVE_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
+ if (assimpMaterial->Get(AI_MATKEY_COLOR_TRANSPARENT, color) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_TRANSPARENT_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
+ if (assimpMaterial->Get(AI_MATKEY_COLOR_REFLECTIVE, color) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_REFLECTIVE_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
+}
+
+/*!
+ * Retrieves a \a material bool property.
+ */
+void AssimpIO::copyMaterialBoolProperties(QMaterial *material, aiMaterial *assimpMaterial)
+{
+ int value;
+ if (assimpMaterial->Get(AI_MATKEY_TWOSIDED, value) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_IS_TWOSIDED, material, (value == 0) ? false : true);
+ if (assimpMaterial->Get(AI_MATKEY_ENABLE_WIREFRAME, value) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_IS_WIREFRAME, material, (value == 0) ? false : true);
+}
+
+void AssimpIO::copyMaterialShadingModel(QMaterial *material, aiMaterial *assimpMaterial)
+{
+ Q_UNUSED(material);
+ Q_UNUSED(assimpMaterial);
+ // TODO
+ // Match each shading function with a default shader
+
+ // AssimpIO::assimpMaterialAttributesMap[AI_MATKEY_SHADING_MODEL] = &AssimpIO::getMaterialShadingModel;
+ // AssimpIO::assimpMaterialAttributesMap[AI_MATKEY_BLEND_FUNC] = &AssimpIO::getMaterialBlendingFunction;
+}
+
+void AssimpIO::copyMaterialBlendingFunction(QMaterial *material, aiMaterial *assimpMaterial)
+{
+ Q_UNUSED(material);
+ Q_UNUSED(assimpMaterial);
+ // TO DO
+}
+
+/*!
+ *
+ */
+void AssimpIO::copyMaterialTextures(QMaterial *material, aiMaterial *assimpMaterial)
+{
+ static const aiTextureType textureType[] = {aiTextureType_AMBIENT,
+ aiTextureType_DIFFUSE,
+ aiTextureType_DISPLACEMENT,
+ aiTextureType_EMISSIVE,
+ aiTextureType_HEIGHT,
+ aiTextureType_LIGHTMAP,
+ aiTextureType_NORMALS,
+ aiTextureType_OPACITY,
+ aiTextureType_REFLECTION,
+ aiTextureType_SHININESS,
+ aiTextureType_SPECULAR};
+
+ if (m_scene->m_textureToParameterName.isEmpty()) {
+ m_scene->m_textureToParameterName.insert(aiTextureType_AMBIENT, ASSIMP_MATERIAL_AMBIENT_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_DIFFUSE, ASSIMP_MATERIAL_DIFFUSE_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_DISPLACEMENT, ASSIMP_MATERIAL_DISPLACEMENT_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_EMISSIVE, ASSIMP_MATERIAL_EMISSIVE_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_HEIGHT, ASSIMP_MATERIAL_HEIGHT_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_LIGHTMAP, ASSIMP_MATERIAL_LIGHTMAP_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_NORMALS, ASSIMP_MATERIAL_NORMALS_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_OPACITY, ASSIMP_MATERIAL_OPACITY_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_REFLECTION, ASSIMP_MATERIAL_REFLECTION_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_SHININESS, ASSIMP_MATERIAL_SHININESS_TEXTURE);
+ m_scene->m_textureToParameterName.insert(aiTextureType_SPECULAR, ASSIMP_MATERIAL_SPECULAR_TEXTURE);
+ }
+
+ for (unsigned int i = 0; i < sizeof(textureType)/sizeof(textureType[0]); i++) {
+ aiString path;
+ if (assimpMaterial->GetTexture(textureType[i], 0, &path) == AI_SUCCESS) {
+ QString fullPath = m_sceneDir.absoluteFilePath(texturePath(path));
+ // Load texture if not already loaded
+ if (!m_scene->m_materialTextures.contains(fullPath)) {
+ QAbstractTexture *tex = QAbstractNodeFactory::createNode<QTexture2D>("QTexture2D");
+ QTextureImage *texImage = QAbstractNodeFactory::createNode<QTextureImage>("QTextureImage");
+ texImage->setSource(QUrl::fromLocalFile(fullPath));
+ tex->addTextureImage(texImage);
+ m_scene->m_materialTextures.insert(fullPath, tex);
+ qCDebug(AssimpIOLog) << Q_FUNC_INFO << " Loaded Texture " << fullPath;
+ }
+ setParameterValue(m_scene->m_textureToParameterName[textureType[i]],
+ material, QVariant::fromValue(m_scene->m_materialTextures[fullPath]));
+ }
+ }
+}
+
+/*!
+ * Retrieves a \a material float property.
+ */
+void AssimpIO::copyMaterialFloatProperties(QMaterial *material, aiMaterial *assimpMaterial)
+{
+ float value = 0;
+ if (assimpMaterial->Get(AI_MATKEY_OPACITY, value) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_OPACITY, material, value);
+ if (assimpMaterial->Get(AI_MATKEY_SHININESS, value) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_SHININESS, material, value);
+ if (assimpMaterial->Get(AI_MATKEY_SHININESS_STRENGTH, value) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_SHININESS_STRENGTH, material, value);
+ if (assimpMaterial->Get(AI_MATKEY_REFRACTI, value) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_REFRACTI, material, value);
+ if (assimpMaterial->Get(AI_MATKEY_REFLECTIVITY, value) == aiReturn_SUCCESS)
+ setParameterValue(ASSIMP_MATERIAL_REFLECTIVITY, material, value);
+}
+
+AssimpRawTextureImage::AssimpRawTextureImage(QNode *parent)
+ : QAbstractTextureImage(parent)
+{
+}
+
+QTextureImageDataGeneratorPtr AssimpRawTextureImage::dataGenerator() const
+{
+ return QTextureImageDataGeneratorPtr(new AssimpRawTextureImageFunctor(m_data));
+}
+
+void AssimpRawTextureImage::setData(const QByteArray &data)
+{
+ if (data != m_data) {
+ m_data = data;
+ notifyDataGeneratorChanged();
+ }
+}
+
+AssimpRawTextureImage::AssimpRawTextureImageFunctor::AssimpRawTextureImageFunctor(const QByteArray &data)
+ : QTextureImageDataGenerator()
+ , m_data(data)
+{
+}
+
+QTextureImageDataPtr AssimpRawTextureImage::AssimpRawTextureImageFunctor::operator()()
+{
+ QTextureImageDataPtr dataPtr;
+ dataPtr->setData(m_data, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
+ return dataPtr;
+}
+
+bool AssimpRawTextureImage::AssimpRawTextureImageFunctor::operator ==(const QTextureImageDataGenerator &other) const
+{
+ const AssimpRawTextureImageFunctor *otherFunctor = functor_cast<AssimpRawTextureImageFunctor>(&other);
+ return (otherFunctor != nullptr && otherFunctor->m_data == m_data);
+}
+
+AssimpIO::SceneImporter::SceneImporter()
+ : m_importer(new Assimp::Importer())
+ , m_aiScene(nullptr)
+{
+ // The Assimp::Importer manages the lifetime of the aiScene object
+}
+
+AssimpIO::SceneImporter::~SceneImporter()
+{
+ delete m_importer;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#include "assimpio.moc"
diff --git a/src/plugins/sceneparsers/assimp/assimpio.h b/src/plugins/sceneparsers/assimp/assimpio.h
new file mode 100644
index 000000000..e3a7c96fa
--- /dev/null
+++ b/src/plugins/sceneparsers/assimp/assimpio.h
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3D_ASSIMPIO_H
+#define QT3D_ASSIMPIO_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// ASSIMP LIBRARY INCLUDE
+#include <assimp/Importer.hpp>
+#include <assimp/scene.h>
+#include <assimp/postprocess.h>
+#include <assimp/DefaultLogger.hpp>
+#include <Qt3DRender/private/qsceneiohandler_p.h>
+#include "assimphelpers.h"
+
+#include <QMap>
+#include <QDir>
+#include <QLoggingCategory>
+
+QT_BEGIN_NAMESPACE
+
+class QFile;
+
+namespace Qt3DCore {
+class QCamera;
+}
+
+namespace Qt3DRender {
+
+class QMaterial;
+class QShaderProgram;
+class QEffect;
+class QAbstractTexture;
+class QMesh;
+class QGeometryRenderer;
+
+Q_DECLARE_LOGGING_CATEGORY(AssimpIOLog)
+
+class AssimpIO : public QSceneIOHandler
+{
+ Q_OBJECT
+
+public:
+ AssimpIO();
+ ~AssimpIO();
+
+ // SceneParserInterface interface
+ void setSource(const QUrl& source) Q_DECL_OVERRIDE;
+ bool isFileTypeSupported(const QUrl &source) const Q_DECL_OVERRIDE;
+ Qt3DCore::QEntity *scene(const QString &id = QString()) Q_DECL_OVERRIDE;
+ Qt3DCore::QEntity *node(const QString &id) Q_DECL_OVERRIDE;
+
+private:
+ static bool isAssimpPath(const QString &path);
+ static QStringList assimpSupportedFormats();
+
+ Qt3DCore::QEntity *node(aiNode *node);
+
+ void readSceneFile(const QString &file);
+
+ void cleanup();
+ void parse();
+
+ void loadMaterial(uint materialIndex);
+ void loadMesh(uint meshIndex);
+ void loadEmbeddedTexture(uint textureIndex);
+ void loadLight(uint lightIndex);
+ void loadCamera(uint cameraIndex);
+ void loadAnimation(uint animationIndex);
+
+ void copyMaterialName(QMaterial *material, aiMaterial *assimpMaterial);
+ void copyMaterialColorProperties(QMaterial *material, aiMaterial *assimpMaterial);
+ void copyMaterialFloatProperties(QMaterial *material, aiMaterial *assimpMaterial);
+ void copyMaterialBoolProperties(QMaterial *material, aiMaterial *assimpMaterial);
+ void copyMaterialShadingModel(QMaterial *material, aiMaterial *assimpMaterial);
+ void copyMaterialBlendingFunction(QMaterial *material, aiMaterial *assimpMaterial);
+ void copyMaterialTextures(QMaterial *material, aiMaterial *assimpMaterial);
+
+ class SceneImporter {
+ public :
+
+ SceneImporter();
+ ~SceneImporter();
+
+ Assimp::Importer *m_importer;
+ mutable const aiScene *m_aiScene;
+
+ QMap<uint, QGeometryRenderer *> m_meshes;
+ QMap<uint, QMaterial*> m_materials;
+ QMap<uint, QEffect *> m_effects;
+ QMap<uint, QAbstractTexture *> m_embeddedTextures;
+ QMap<QString, QAbstractTexture *> m_materialTextures;
+ QMap<aiNode*, Qt3DCore::QEntity*> m_cameras;
+ QHash<aiTextureType, QString> m_textureToParameterName;
+// QMap<aiNode*, Light*> m_lights;
+ };
+
+ QDir m_sceneDir;
+ bool m_sceneParsed;
+ AssimpIO::SceneImporter *m_scene;
+ static QStringList assimpSupportedFormatsList;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3D_ASSIMPIO_H
diff --git a/src/plugins/sceneparsers/assimp/assimpparser.cpp b/src/plugins/sceneparsers/assimp/assimpparser.cpp
deleted file mode 100644
index 040fc3a8a..000000000
--- a/src/plugins/sceneparsers/assimp/assimpparser.cpp
+++ /dev/null
@@ -1,930 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "assimpparser.h"
-
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qtransform.h>
-#include <Qt3DCore/qcameralens.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qmesh.h>
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qattribute.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qdiffusemapmaterial.h>
-#include <Qt3DRender/qdiffusespecularmapmaterial.h>
-#include <Qt3DRender/qphongmaterial.h>
-#include <QFileInfo>
-#include <QColor>
-#include <qmath.h>
-#include <Qt3DRender/private/renderlogging_p.h>
-#include <Qt3DRender/private/qurlhelper_p.h>
-#include <Qt3DRender/qgeometryrenderer.h>
-#include <Qt3DRender/qgeometry.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-
-/*!
- \class Qt3DRender::AssimpParser
- \inmodule Qt3DRender
- \since 5.5
-
- \brief Provides a generic way of loading various 3D assets
- format into a Qt3D scene.
-
- It should be noted that Assimp aiString is explicitly defined to be UTF-8.
-
- \sa GLTFParser
-*/
-
-Q_LOGGING_CATEGORY(AssimpParserLog, "Qt3D.AssimpParser")
-
-namespace {
-
-const QString ASSIMP_MATERIAL_DIFFUSE_COLOR = QStringLiteral("kd");
-const QString ASSIMP_MATERIAL_SPECULAR_COLOR = QStringLiteral("ks");
-const QString ASSIMP_MATERIAL_AMBIENT_COLOR = QStringLiteral("ka");
-const QString ASSIMP_MATERIAL_EMISSIVE_COLOR = QStringLiteral("emissive");
-const QString ASSIMP_MATERIAL_TRANSPARENT_COLOR = QStringLiteral("transparent");
-const QString ASSIMP_MATERIAL_REFLECTIVE_COLOR = QStringLiteral("reflective");
-
-const QString ASSIMP_MATERIAL_DIFFUSE_TEXTURE = QStringLiteral("diffuseTexture");
-const QString ASSIMP_MATERIAL_AMBIENT_TEXTURE = QStringLiteral("ambientTex");
-const QString ASSIMP_MATERIAL_SPECULAR_TEXTURE = QStringLiteral("specularTexture");
-const QString ASSIMP_MATERIAL_EMISSIVE_TEXTURE = QStringLiteral("emissiveTex");
-const QString ASSIMP_MATERIAL_NORMALS_TEXTURE = QStringLiteral("normalsTex");
-const QString ASSIMP_MATERIAL_OPACITY_TEXTURE = QStringLiteral("opacityTex");
-const QString ASSIMP_MATERIAL_REFLECTION_TEXTURE = QStringLiteral("reflectionTex");
-const QString ASSIMP_MATERIAL_HEIGHT_TEXTURE = QStringLiteral("heightTex");
-const QString ASSIMP_MATERIAL_LIGHTMAP_TEXTURE = QStringLiteral("opacityTex");
-const QString ASSIMP_MATERIAL_DISPLACEMENT_TEXTURE = QStringLiteral("displacementTex");
-const QString ASSIMP_MATERIAL_SHININESS_TEXTURE = QStringLiteral("shininessTex");
-
-const QString ASSIMP_MATERIAL_IS_TWOSIDED = QStringLiteral("twosided");
-const QString ASSIMP_MATERIAL_IS_WIREFRAME = QStringLiteral("wireframe");
-
-const QString ASSIMP_MATERIAL_OPACITY = QStringLiteral("opacity");
-const QString ASSIMP_MATERIAL_SHININESS = QStringLiteral("shininess");
-const QString ASSIMP_MATERIAL_SHININESS_STRENGTH = QStringLiteral("shininess_strength");
-const QString ASSIMP_MATERIAL_REFRACTI = QStringLiteral("refracti");
-const QString ASSIMP_MATERIAL_REFLECTIVITY = QStringLiteral("reflectivity");
-
-const QString ASSIMP_MATERIAL_NAME = QStringLiteral("name");
-
-const QString VERTICES_ATTRIBUTE_NAME = QAttribute::defaultPositionAttributeName();
-const QString NORMAL_ATTRIBUTE_NAME = QAttribute::defaultNormalAttributeName();
-const QString TANGENT_ATTRIBUTE_NAME = QAttribute::defaultTangentAttributeName();
-const QString TEXTCOORD_ATTRIBUTE_NAME = QAttribute::defaultTextureCoordinateAttributeName();
-const QString COLOR_ATTRIBUTE_NAME = QAttribute::defaultColorAttributeName();
-
-/*!
- * Returns a QMatrix4x4 from \a matrix;
- */
-QMatrix4x4 aiMatrix4x4ToQMatrix4x4(const aiMatrix4x4 &matrix) Q_DECL_NOEXCEPT
-{
- return QMatrix4x4(matrix.a1, matrix.a2, matrix.a3, matrix.a4,
- matrix.b1, matrix.b2, matrix.b3, matrix.b4,
- matrix.c1, matrix.c2, matrix.c3, matrix.c4,
- matrix.d1, matrix.d2, matrix.d3, matrix.d4);
-}
-
-/*!
- * Returns a QString from \a str;
- */
-static inline QString aiStringToQString(const aiString &str)
-{
- return QString::fromUtf8(str.data, int(str.length));
-}
-
-QMaterial *createBestApproachingMaterial(const aiMaterial *assimpMaterial) Q_DECL_NOEXCEPT
-{
- aiString path; // unused but necessary
- const bool hasDiffuseTexture = (assimpMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &path) == AI_SUCCESS);
- const bool hasSpecularTexture = (assimpMaterial->GetTexture(aiTextureType_SPECULAR, 0, &path) == AI_SUCCESS);
-
- if (hasDiffuseTexture && hasSpecularTexture)
- return new QDiffuseSpecularMapMaterial();
- if (hasDiffuseTexture)
- return new QDiffuseMapMaterial();
- return new QPhongMaterial();
-}
-
-QString texturePath(const aiString &path)
-{
- QString p = aiStringToQString(path);
- if (p.startsWith('/'))
- p.remove(0, 1);
- return p;
-}
-
-/*!
- * Returns the Qt3DRender::QParameter with named \a name if contained by the material
- * \a material. If the material doesn't contain the named parameter, a new
- * Qt3DRender::QParameter is created and inserted into the material.
- */
-QParameter *findNamedParameter(const QString &name, QMaterial *material)
-{
- // Does the material contain the parameter ?
- foreach (QParameter *p , material->parameters())
- if (p->name() == name)
- return p;
-
- // Does the material's effect contain the parameter ?
- if (material->effect()) {
- const QEffect *e = material->effect();
- foreach (QParameter *p, e->parameters())
- if (p->name() == name)
- return p;
- }
-
- // Create and add parameter to material
- QParameter *p = new QParameter(material);
- p->setName(name);
- material->addParameter(p);
- return p;
-}
-
-void setParameterValue(const QString &name, QMaterial *material, const QVariant &value)
-{
- QParameter *p = findNamedParameter(name, material);
- p->setValue(value);
-}
-
-} // anonymous
-
-QStringList AssimpParser::assimpSupportedFormatsList = AssimpParser::assimpSupportedFormats();
-
-/*!
- * Returns a QStringlist with the suffixes of the various supported asset formats.
- */
-QStringList AssimpParser::assimpSupportedFormats()
-{
- QStringList formats;
-
- formats.reserve(60);
- formats.append(QStringLiteral("3d"));
- formats.append(QStringLiteral("3ds"));
- formats.append(QStringLiteral("ac"));
- formats.append(QStringLiteral("ac3d"));
- formats.append(QStringLiteral("acc"));
- formats.append(QStringLiteral("ase"));
- formats.append(QStringLiteral("ask"));
- formats.append(QStringLiteral("b3d"));
- formats.append(QStringLiteral("blend"));
- formats.append(QStringLiteral("bvh"));
- formats.append(QStringLiteral("cob"));
- formats.append(QStringLiteral("csm"));
- formats.append(QStringLiteral("dae"));
- formats.append(QStringLiteral("dxf"));
- formats.append(QStringLiteral("enff"));
- formats.append(QStringLiteral("hmp"));
- formats.append(QStringLiteral("irr"));
- formats.append(QStringLiteral("irrmesh"));
- formats.append(QStringLiteral("lwo"));
- formats.append(QStringLiteral("lws"));
- formats.append(QStringLiteral("lxo"));
- formats.append(QStringLiteral("md2"));
- formats.append(QStringLiteral("md3"));
- formats.append(QStringLiteral("md5anim"));
- formats.append(QStringLiteral("md5camera"));
- formats.append(QStringLiteral("md5mesh"));
- formats.append(QStringLiteral("mdc"));
- formats.append(QStringLiteral("mdl"));
- formats.append(QStringLiteral("mesh.xml"));
- formats.append(QStringLiteral("mot"));
- formats.append(QStringLiteral("ms3d"));
- formats.append(QStringLiteral("ndo"));
- formats.append(QStringLiteral("nff"));
- formats.append(QStringLiteral("obj"));
- formats.append(QStringLiteral("off"));
- formats.append(QStringLiteral("pk3"));
- formats.append(QStringLiteral("ply"));
- formats.append(QStringLiteral("prj"));
- formats.append(QStringLiteral("q3o"));
- formats.append(QStringLiteral("q3s"));
- formats.append(QStringLiteral("raw"));
- formats.append(QStringLiteral("scn"));
- formats.append(QStringLiteral("smd"));
- formats.append(QStringLiteral("stl"));
- formats.append(QStringLiteral("ter"));
- formats.append(QStringLiteral("uc"));
- formats.append(QStringLiteral("vta"));
- formats.append(QStringLiteral("x"));
- formats.append(QStringLiteral("xml"));
-
- return formats;
-}
-
-class AssimpRawTextureImage : public QAbstractTextureImage
-{
- Q_OBJECT
-public:
- explicit AssimpRawTextureImage(QNode *parent = 0);
-
- QTextureDataFunctorPtr dataFunctor() const Q_DECL_FINAL;
-
- void setData(const QByteArray &data);
-
-private:
- QByteArray m_data;
- QT3D_CLONEABLE(AssimpRawTextureImage)
-
- class AssimpRawTextureImageFunctor : public QTextureDataFunctor
- {
- public:
- explicit AssimpRawTextureImageFunctor(const QByteArray &data);
-
- QTexImageDataPtr operator()() Q_DECL_FINAL;
- bool operator ==(const QTextureDataFunctor &other) const Q_DECL_FINAL;
-
- QT3D_FUNCTOR(AssimpRawTextureImageFunctor)
- private:
- QByteArray m_data;
- };
-};
-
-/*!
- * Constructor. Initializes a new instance of AssimpParser.
- */
-AssimpParser::AssimpParser() : QAbstractSceneParser(),
- m_sceneParsed(false),
- m_scene(Q_NULLPTR)
-{
-}
-
-/*!
- * Destructor. Cleans the parser properly before destroying it.
- */
-AssimpParser::~AssimpParser()
-{
- cleanup();
-}
-
-/*!
- * Returns \c true if the provided \a path has a suffix supported
- * by the Assimp Assets importer.
- */
-bool AssimpParser::isAssimpPath(const QString &path)
-{
- QFileInfo fileInfo(path);
-
- if (!fileInfo.exists() ||
- !AssimpParser::assimpSupportedFormatsList.contains(fileInfo.suffix().toLower()))
- return false;
- return true;
-}
-
-/*!
- * Sets the \a source used by the parser to load the asset file.
- * If the file is valid, this will trigger parsing of the file.
- */
-void AssimpParser::setSource(const QUrl &source)
-{
- const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
- QFileInfo file(path);
- m_sceneDir = file.absoluteDir();
- if (!file.exists()) {
- qCWarning(AssimpParserLog) << "File missing " << path;
- return ;
- }
- readSceneFile(path);
-}
-
-/*!
- * Returns \c true if the extension of \a source is supported by
- * the assimp parser.
- */
-bool AssimpParser::isExtensionSupported(const QUrl &source) const
-{
- const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
- return AssimpParser::isAssimpPath(path);
-}
-
-/*!
- * Returns a Entity node which is the root node of the scene
- * node specified by \a id. If \a id is empty, the scene is assumed to be
- * the root node of the scene.
- *
- * Returns \c Q_NULLPTR if \a id was specified but no node matching it was found.
- */
-Qt3DCore::QEntity *AssimpParser::scene(const QString &id)
-{
- // m_aiScene shouldn't be null.
- // If it is either, the file failed to be imported or
- // setFilePath was not called
- if (m_scene == Q_NULLPTR || m_scene->m_aiScene == Q_NULLPTR)
- return Q_NULLPTR;
-
- aiNode *rootNode = m_scene->m_aiScene->mRootNode;
- // if id specified, tries to find node
- if (!id.isEmpty() &&
- !(rootNode = rootNode->FindNode(id.toUtf8().constData()))) {
- qCDebug(AssimpParserLog) << Q_FUNC_INFO << " Couldn't find requested scene node";
- return Q_NULLPTR;
- }
-
- // Builds the Qt3D scene using the Assimp aiScene
- // and the various dicts filled previously by parse
- return node(rootNode);
-}
-
-/*!
- * Returns a Node from the scene identified by \a id.
- * Returns \c Q_NULLPTR if the node was not found.
- */
-Qt3DCore::QEntity *AssimpParser::node(const QString &id)
-{
- if (m_scene == Q_NULLPTR || m_scene->m_aiScene == Q_NULLPTR)
- return Q_NULLPTR;
- parse();
- aiNode *n = m_scene->m_aiScene->mRootNode->FindNode(id.toUtf8().constData());
- return node(n);
-}
-
-/*!
- * Returns a Node from an Assimp aiNode \a node.
- */
-Qt3DCore::QEntity *AssimpParser::node(aiNode *node)
-{
- if (node == Q_NULLPTR)
- return Q_NULLPTR;
- QEntity *entityNode = new QEntity();
- entityNode->setObjectName(aiStringToQString(node->mName));
-
- // Add Meshes to the node
- for (uint i = 0; i < node->mNumMeshes; i++) {
- uint meshIdx = node->mMeshes[i];
- QGeometryRenderer *mesh = m_scene->m_meshes[meshIdx];
- // mesh material
- uint materialIndex = m_scene->m_aiScene->mMeshes[meshIdx]->mMaterialIndex;
- if (m_scene->m_materials.contains(materialIndex))
- entityNode->addComponent(m_scene->m_materials[materialIndex]);
- // mesh
- entityNode->addComponent(mesh);
- }
-
- // Add Children to Node
- for (uint i = 0; i < node->mNumChildren; i++) {
- // this-> is necessary here otherwise
- // it conflicts with the variable node
- QEntity *child = this->node(node->mChildren[i]);
- // Are we sure each child are unique ???
- if (child != Q_NULLPTR)
- child->setParent(entityNode);
- }
-
- // Add Transformations
- const QMatrix4x4 qTransformMatrix = aiMatrix4x4ToQMatrix4x4(node->mTransformation);
- Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
- transform->setMatrix(qTransformMatrix);
- entityNode->addComponent(transform);
-
- // Add Camera
- if (m_scene->m_cameras.contains(node))
- m_scene->m_cameras.value(node)->setParent(entityNode);
-
- // TO DO : Add lights ....
-
- return entityNode;
-}
-
-/*!
- * Reads the scene file pointed by \a path and launches the parsing of
- * the scene using Assimp, after having cleaned up previously saved values
- * from eventual previous parsings.
- */
-void AssimpParser::readSceneFile(const QString &path)
-{
- cleanup();
-
- m_scene = new SceneImporter();
-
- // SET THIS TO REMOVE POINTS AND LINES -> HAVE ONLY TRIANGLES
- m_scene->m_importer->SetPropertyInteger(AI_CONFIG_PP_SBP_REMOVE, aiPrimitiveType_LINE|aiPrimitiveType_POINT);
- // SET CUSTOM FILE HANDLER TO HANDLE FILE READING THROUGH QT (RESOURCES, SOCKET ...)
- m_scene->m_importer->SetIOHandler(new AssimpHelper::AssimpIOSystem());
-
- // type and aiProcess_Triangulate discompose polygons with more than 3 points in triangles
- // aiProcess_SortByPType makes sur that meshes data are triangles
- m_scene->m_aiScene = m_scene->m_importer->ReadFile(path.toUtf8().constData(),
- aiProcess_SortByPType|
- aiProcess_Triangulate|
- aiProcess_JoinIdenticalVertices|
- aiProcess_GenSmoothNormals|
- aiProcess_FlipUVs);
- if (m_scene->m_aiScene == Q_NULLPTR) {
- qCWarning(AssimpParserLog) << "Assimp scene import failed";
- return ;
- }
- parse();
-}
-
-/*!
- * Cleans the various dictionaries holding the scene's information.
- */
-void AssimpParser::cleanup()
-{
- m_sceneParsed = false;
- delete m_scene;
- m_scene = Q_NULLPTR;
-}
-
-/*!
- * Parses the aiScene provided py Assimp and converts Assimp
- * values to Qt3D values.
- */
-void AssimpParser::parse()
-{
- if (!m_sceneParsed) {
- // Set parsed flags
- m_sceneParsed = !m_sceneParsed;
-
- for (uint i = 0; i < m_scene->m_aiScene->mNumTextures; i++)
- loadEmbeddedTexture(i);
- for (uint i = 0; i < m_scene->m_aiScene->mNumMaterials; i++)
- loadMaterial(i);
- for (uint i = 0; i < m_scene->m_aiScene->mNumMeshes; i++)
- loadMesh(i);
- for (uint i = 0; i < m_scene->m_aiScene->mNumCameras; i++)
- loadCamera(i);
- for (uint i = 0; i < m_scene->m_aiScene->mNumLights; i++)
- loadLight(i);
- for (uint i = 0; i < m_scene->m_aiScene->mNumAnimations; i++)
- loadAnimation(i);
- }
-}
-
-/*!
- * Converts the provided Assimp aiMaterial identified by \a materialIndex to a
- * Qt3D material and adds it to a dictionary of materials.
- * \sa Material
- */
-void AssimpParser::loadMaterial(uint materialIndex)
-{
- // Generates default material based on what the assimp material contains
- aiMaterial *assimpMaterial = m_scene->m_aiScene->mMaterials[materialIndex];
- QMaterial *material = createBestApproachingMaterial(assimpMaterial);
- // Material Name
- copyMaterialName(material, assimpMaterial);
- copyMaterialColorProperties(material, assimpMaterial);
- copyMaterialBoolProperties(material, assimpMaterial);
- copyMaterialFloatProperties(material, assimpMaterial);
-
- // Add textures to materials dict
- copyMaterialTextures(material, assimpMaterial);
-
- m_scene->m_materials.insert(materialIndex, material);
-}
-
-/*!
- * Converts the Assimp aiMesh mesh identified by \a meshIndex to a QGeometryRenderer
- * and adds it to a dictionary of meshes.
- * \sa QGeometryRenderer
- */
-void AssimpParser::loadMesh(uint meshIndex)
-{
- aiMesh *mesh = m_scene->m_aiScene->mMeshes[meshIndex];
-
- QGeometryRenderer *geometryRenderer = new QGeometryRenderer();
- QGeometry *meshGeometry = new QGeometry(geometryRenderer);
- QBuffer *vertexBuffer = new QBuffer(QBuffer::VertexBuffer, meshGeometry);
- QBuffer *indexBuffer = new QBuffer(QBuffer::IndexBuffer, meshGeometry);
-
- geometryRenderer->setGeometry(meshGeometry);
-
- // Primitive are always triangles with the current Assimp's configuration
-
- // Vertices and Normals always present with the current Assimp's configuration
- aiVector3D *vertices = mesh->mVertices;
- aiVector3D *normals = mesh->mNormals;
- aiColor4D *colors = mesh->mColors[0];
- // Tangents and TextureCoord not always present
- bool hasTangent = mesh->HasTangentsAndBitangents();
- bool hasTexture = mesh->HasTextureCoords(0);
- bool hasColor = (colors != NULL); // NULL defined by Assimp
- aiVector3D *tangents = hasTangent ? mesh->mTangents : Q_NULLPTR;
- aiVector3D *textureCoord = hasTexture ? mesh->mTextureCoords[0] : Q_NULLPTR;
-
- // Add values in raw float array
- ushort chunkSize = 6 + (hasTangent ? 3 : 0) + (hasTexture ? 2 : 0) + (hasColor ? 4 : 0);
- QByteArray bufferArray;
- bufferArray.resize(chunkSize * mesh->mNumVertices * sizeof(float));
- float *vbufferContent = reinterpret_cast<float*>(bufferArray.data());
- for (uint i = 0; i < mesh->mNumVertices; i++) {
- uint idx = i * chunkSize;
- // position
- vbufferContent[idx] = vertices[i].x;
- vbufferContent[idx + 1] = vertices[i].y;
- vbufferContent[idx + 2] = vertices[i].z;
- // normals
- vbufferContent[idx + 3] = normals[i].x;
- vbufferContent[idx + 4] = normals[i].y;
- vbufferContent[idx + 5] = normals[i].z;
-
- if (hasTangent) {
- vbufferContent[idx + 6] = tangents[i].x;
- vbufferContent[idx + 7] = tangents[i].y;
- vbufferContent[idx + 8] = tangents[i].z;
- }
- if (hasTexture) {
- char offset = (hasTangent ? 9 : 6);
- vbufferContent[idx + offset] = textureCoord[i].x;
- vbufferContent[idx + offset + 1] = textureCoord[i].y;
- }
- if (hasColor) {
- char offset = 6 + (hasTangent ? 3 : 0) + (hasTexture ? 2 : 0);
- vbufferContent[idx + offset] = colors[i].r;
- vbufferContent[idx + offset + 1] = colors[i].g;
- vbufferContent[idx + offset + 2] = colors[i].b;
- vbufferContent[idx + offset + 3] = colors[i].a;
- }
- }
-
- vertexBuffer->setData(bufferArray);
-
- // Add vertex attributes to the mesh with the right array
- QAttribute *positionAttribute = new QAttribute(vertexBuffer, VERTICES_ATTRIBUTE_NAME,
- QAttribute::Float, 3,
- mesh->mNumVertices,
- 0,
- chunkSize * sizeof(float));
-
- QAttribute *normalAttribute = new QAttribute(vertexBuffer, NORMAL_ATTRIBUTE_NAME,
- QAttribute::Float, 3,
- mesh->mNumVertices,
- 3 * sizeof(float),
- chunkSize * sizeof(float));
-
- meshGeometry->addAttribute(positionAttribute);
- meshGeometry->addAttribute(normalAttribute);
-
- if (hasTangent) {
- QAttribute *tangentsAttribute = new QAttribute(vertexBuffer, TANGENT_ATTRIBUTE_NAME,
- QAttribute::Float, 3,
- mesh->mNumVertices,
- 6 * sizeof(float),
- chunkSize * sizeof(float));
- meshGeometry->addAttribute(tangentsAttribute);
- }
-
- if (hasTexture) {
- QAttribute *textureCoordAttribute = new QAttribute(vertexBuffer, TEXTCOORD_ATTRIBUTE_NAME,
- QAttribute::Float, 2,
- mesh->mNumVertices,
- (hasTangent ? 9 : 6) * sizeof(float),
- chunkSize * sizeof(float));
- meshGeometry->addAttribute(textureCoordAttribute);
- }
-
- if (hasColor) {
- QAttribute *colorAttribute = new QAttribute(vertexBuffer, COLOR_ATTRIBUTE_NAME,
- QAttribute::Float, 4,
- mesh->mNumVertices,
- (6 + (hasTangent ? 3 : 0) + (hasTexture ? 2 : 0)) * sizeof(float),
- chunkSize * sizeof(float));
- meshGeometry->addAttribute(colorAttribute);
- }
-
- QAttribute::DataType indiceType;
- QByteArray ibufferContent;
- uint indices = mesh->mNumFaces * 3;
- // If there are less than 65535 indices, indices can then fit in ushort
- // which saves video memory
- if (indices >= USHRT_MAX) {
- indiceType = QAttribute::UnsignedInt;
- ibufferContent.resize(indices * sizeof(quint32));
- for (uint i = 0; i < mesh->mNumFaces; i++) {
- aiFace face = mesh->mFaces[i];
- Q_ASSERT(face.mNumIndices == 3);
- memcpy(&reinterpret_cast<quint32*>(ibufferContent.data())[i * 3], face.mIndices, 3 * sizeof(uint));
- }
- }
- else {
- indiceType = QAttribute::UnsignedShort;
- ibufferContent.resize(indices * sizeof(quint16));
- for (uint i = 0; i < mesh->mNumFaces; i++) {
- aiFace face = mesh->mFaces[i];
- Q_ASSERT(face.mNumIndices == 3);
- for (ushort j = 0; j < face.mNumIndices; j++)
- reinterpret_cast<quint16*>(ibufferContent.data())[i * 3 + j] = face.mIndices[j];
- }
- }
-
- indexBuffer->setData(ibufferContent);
-
- // Add indices attributes
- QAttribute *indexAttribute = new QAttribute(indexBuffer, indiceType, 1, indices);
- indexAttribute->setAttributeType(QAttribute::IndexAttribute);
-
- meshGeometry->addAttribute(indexAttribute);
-
- m_scene->m_meshes[meshIndex] = geometryRenderer;
-
- qCDebug(AssimpParserLog) << Q_FUNC_INFO << " Mesh " << aiStringToQString(mesh->mName)
- << " Vertices " << mesh->mNumVertices << " Faces " << mesh->mNumFaces << " Indices " << indices;
-}
-
-/*!
- * Converts the provided Assimp aiTexture at \a textureIndex to a Texture and
- * adds it to a dictionary of textures.
- * \sa Texture
- */
-void AssimpParser::loadEmbeddedTexture(uint textureIndex)
-{
- aiTexture *assimpTexture = m_scene->m_aiScene->mTextures[textureIndex];
- QAbstractTextureProvider *texture = new QTexture2D();
- AssimpRawTextureImage *imageData = new AssimpRawTextureImage();
-
- bool isCompressed = assimpTexture->mHeight == 0;
- uint textureSize = assimpTexture->mWidth *
- (isCompressed ? assimpTexture->mHeight : 1);
- // Set texture to RGBA8888
- QByteArray textureContent;
- textureContent.reserve(textureSize * 4);
- for (uint i = 0; i < textureSize; i++) {
- uint idx = i * 4;
- aiTexel texel = assimpTexture->pcData[i];
- textureContent[idx] = texel.r;
- textureContent[idx + 1] = texel.g;
- textureContent[idx + 2] = texel.b;
- textureContent[idx + 3] = texel.a;
- }
- imageData->setData(textureContent);
- texture->addTextureImage(imageData);
- m_scene->m_embeddedTextures[textureIndex] = texture;
-}
-
-/*!
- * Loads the light in the current scene located at \a lightIndex.
- */
-void AssimpParser::loadLight(uint lightIndex)
-{
- aiLight *light = m_scene->m_aiScene->mLights[lightIndex];
- // TODO: Implement me!
- Q_UNUSED(light);
-}
-
-/*!
- * Parses the camera at cameraIndex and saves it to a dictionary of cameras.
- */
-void AssimpParser::loadCamera(uint cameraIndex)
-{
- aiCamera *assimpCamera = m_scene->m_aiScene->mCameras[cameraIndex];
- aiNode *cameraNode = m_scene->m_aiScene->mRootNode->FindNode(assimpCamera->mName);
-
- // If no node is associated to the camera in the scene, camera not saved
- if (cameraNode == Q_NULLPTR)
- return ;
-
- QEntity *camera = new QEntity();
- QCameraLens *lens = new QCameraLens();
-
- lens->setObjectName(aiStringToQString(assimpCamera->mName));
- lens->setPerspectiveProjection(qRadiansToDegrees(assimpCamera->mHorizontalFOV),
- qMax(assimpCamera->mAspect, 1.0f),
- assimpCamera->mClipPlaneNear,
- assimpCamera->mClipPlaneFar);
- camera->addComponent(lens);
-
- QMatrix4x4 m;
- m.lookAt(QVector3D(assimpCamera->mPosition.x, assimpCamera->mPosition.y, assimpCamera->mPosition.z),
- QVector3D(assimpCamera->mLookAt.x, assimpCamera->mLookAt.y, assimpCamera->mLookAt.z),
- QVector3D(assimpCamera->mUp.x, assimpCamera->mUp.y, assimpCamera->mUp.z));
- Qt3DCore::QTransform *transform = new Qt3DCore::QTransform();
- transform->setMatrix(m);
- camera->addComponent(transform);
-
- m_scene->m_cameras[cameraNode] = camera;
-}
-
-// OPTIONAL
-void AssimpParser::loadAnimation(uint animationIndex)
-{
- Q_UNUSED(animationIndex);
-}
-
-/*!
- * Sets the object name of \a material to the name of \a assimpMaterial.
- */
-void AssimpParser::copyMaterialName(QMaterial *material, aiMaterial *assimpMaterial)
-{
- aiString name;
- if (assimpMaterial->Get(AI_MATKEY_NAME, name) == aiReturn_SUCCESS) {
- // May not be necessary
- // Kept for debug purposes at the moment
- material->setObjectName(aiStringToQString(name));
- qCDebug(AssimpParserLog) << Q_FUNC_INFO << "Assimp Material " << material->objectName();
- }
-}
-
-/*!
- * Fills \a material color properties with \a assimpMaterial color properties.
- */
-void AssimpParser::copyMaterialColorProperties(QMaterial *material, aiMaterial *assimpMaterial)
-{
- aiColor3D color;
- if (assimpMaterial->Get(AI_MATKEY_COLOR_DIFFUSE, color) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_DIFFUSE_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
- if (assimpMaterial->Get(AI_MATKEY_COLOR_SPECULAR, color) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_SPECULAR_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
- if (assimpMaterial->Get(AI_MATKEY_COLOR_AMBIENT, color) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_AMBIENT_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
- if (assimpMaterial->Get(AI_MATKEY_COLOR_EMISSIVE, color) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_EMISSIVE_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
- if (assimpMaterial->Get(AI_MATKEY_COLOR_TRANSPARENT, color) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_TRANSPARENT_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
- if (assimpMaterial->Get(AI_MATKEY_COLOR_REFLECTIVE, color) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_REFLECTIVE_COLOR, material, QColor::fromRgbF(color.r, color.g, color.b));
-}
-
-/*!
- * Retrieves a \a material bool property.
- */
-void AssimpParser::copyMaterialBoolProperties(QMaterial *material, aiMaterial *assimpMaterial)
-{
- int value;
- if (assimpMaterial->Get(AI_MATKEY_TWOSIDED, value) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_IS_TWOSIDED, material, (value == 0) ? false : true);
- if (assimpMaterial->Get(AI_MATKEY_ENABLE_WIREFRAME, value) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_IS_WIREFRAME, material, (value == 0) ? false : true);
-}
-
-void AssimpParser::copyMaterialShadingModel(QMaterial *material, aiMaterial *assimpMaterial)
-{
- Q_UNUSED(material);
- Q_UNUSED(assimpMaterial);
- // TODO
- // Match each shading function with a default shader
-
- // AssimpParser::assimpMaterialAttributesMap[AI_MATKEY_SHADING_MODEL] = &AssimpParser::getMaterialShadingModel;
- // AssimpParser::assimpMaterialAttributesMap[AI_MATKEY_BLEND_FUNC] = &AssimpParser::getMaterialBlendingFunction;
-}
-
-void AssimpParser::copyMaterialBlendingFunction(QMaterial *material, aiMaterial *assimpMaterial)
-{
- Q_UNUSED(material);
- Q_UNUSED(assimpMaterial);
- // TO DO
-}
-
-/*!
- *
- */
-void AssimpParser::copyMaterialTextures(QMaterial *material, aiMaterial *assimpMaterial)
-{
- static const aiTextureType textureType[] = {aiTextureType_AMBIENT,
- aiTextureType_DIFFUSE,
- aiTextureType_DISPLACEMENT,
- aiTextureType_EMISSIVE,
- aiTextureType_HEIGHT,
- aiTextureType_LIGHTMAP,
- aiTextureType_NORMALS,
- aiTextureType_OPACITY,
- aiTextureType_REFLECTION,
- aiTextureType_SHININESS,
- aiTextureType_SPECULAR};
-
- if (m_scene->m_textureToParameterName.isEmpty()) {
- m_scene->m_textureToParameterName.insert(aiTextureType_AMBIENT, ASSIMP_MATERIAL_AMBIENT_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_DIFFUSE, ASSIMP_MATERIAL_DIFFUSE_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_DISPLACEMENT, ASSIMP_MATERIAL_DISPLACEMENT_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_EMISSIVE, ASSIMP_MATERIAL_EMISSIVE_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_HEIGHT, ASSIMP_MATERIAL_HEIGHT_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_LIGHTMAP, ASSIMP_MATERIAL_LIGHTMAP_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_NORMALS, ASSIMP_MATERIAL_NORMALS_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_OPACITY, ASSIMP_MATERIAL_OPACITY_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_REFLECTION, ASSIMP_MATERIAL_REFLECTION_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_SHININESS, ASSIMP_MATERIAL_SHININESS_TEXTURE);
- m_scene->m_textureToParameterName.insert(aiTextureType_SPECULAR, ASSIMP_MATERIAL_SPECULAR_TEXTURE);
- }
-
- for (unsigned int i = 0; i < sizeof(textureType)/sizeof(textureType[0]); i++) {
- aiString path;
- if (assimpMaterial->GetTexture(textureType[i], 0, &path) == AI_SUCCESS) {
- QString fullPath = m_sceneDir.absoluteFilePath(texturePath(path));
- // Load texture if not already loaded
- if (!m_scene->m_materialTextures.contains(fullPath)) {
- QAbstractTextureProvider *tex = new QTexture2D();
- QTextureImage *texImage = new QTextureImage();
- texImage->setSource(QUrl::fromLocalFile(fullPath));
- tex->addTextureImage(texImage);
- m_scene->m_materialTextures.insert(fullPath, tex);
- qCDebug(AssimpParserLog) << Q_FUNC_INFO << " Loaded Texture " << fullPath;
- }
- setParameterValue(m_scene->m_textureToParameterName[textureType[i]],
- material, QVariant::fromValue(m_scene->m_materialTextures[fullPath]));
- }
- }
-}
-
-/*!
- * Retrieves a \a material float property.
- */
-void AssimpParser::copyMaterialFloatProperties(QMaterial *material, aiMaterial *assimpMaterial)
-{
- float value = 0;
- if (assimpMaterial->Get(AI_MATKEY_OPACITY, value) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_OPACITY, material, value);
- if (assimpMaterial->Get(AI_MATKEY_SHININESS, value) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_SHININESS, material, value);
- if (assimpMaterial->Get(AI_MATKEY_SHININESS_STRENGTH, value) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_SHININESS_STRENGTH, material, value);
- if (assimpMaterial->Get(AI_MATKEY_REFRACTI, value) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_REFRACTI, material, value);
- if (assimpMaterial->Get(AI_MATKEY_REFLECTIVITY, value) == aiReturn_SUCCESS)
- setParameterValue(ASSIMP_MATERIAL_REFLECTIVITY, material, value);
-}
-
-AssimpRawTextureImage::AssimpRawTextureImage(QNode *parent)
- : QAbstractTextureImage(parent)
-{
-}
-
-QTextureDataFunctorPtr AssimpRawTextureImage::dataFunctor() const
-{
- return QTextureDataFunctorPtr(new AssimpRawTextureImageFunctor(m_data));
-}
-
-void AssimpRawTextureImage::setData(const QByteArray &data)
-{
- if (data != m_data) {
- m_data = data;
- update();
- }
-}
-
-AssimpRawTextureImage::AssimpRawTextureImageFunctor::AssimpRawTextureImageFunctor(const QByteArray &data)
- : QTextureDataFunctor()
- , m_data(data)
-{
-}
-
-QTexImageDataPtr AssimpRawTextureImage::AssimpRawTextureImageFunctor::operator()()
-{
- QTexImageDataPtr dataPtr;
- dataPtr->setData(m_data, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
- return dataPtr;
-}
-
-bool AssimpRawTextureImage::AssimpRawTextureImageFunctor::operator ==(const QTextureDataFunctor &other) const
-{
- const AssimpRawTextureImageFunctor *otherFunctor = functor_cast<AssimpRawTextureImageFunctor>(&other);
- return (otherFunctor != Q_NULLPTR && otherFunctor->m_data == m_data);
-}
-
-AssimpParser::SceneImporter::SceneImporter()
- : m_importer(new Assimp::Importer())
- , m_aiScene(Q_NULLPTR)
-{
- // The Assimp::Importer manages the lifetime of the aiScene object
-}
-
-AssimpParser::SceneImporter::~SceneImporter()
-{
- delete m_importer;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#include "assimpparser.moc"
diff --git a/src/plugins/sceneparsers/assimp/assimpparser.h b/src/plugins/sceneparsers/assimp/assimpparser.h
deleted file mode 100644
index f385206bd..000000000
--- a/src/plugins/sceneparsers/assimp/assimpparser.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3D_ASSIMPPARSER_H
-#define QT3D_ASSIMPPARSER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-// ASSIMP LIBRARY INCLUDE
-#include <assimp/Importer.hpp>
-#include <assimp/scene.h>
-#include <assimp/postprocess.h>
-#include <assimp/DefaultLogger.hpp>
-#include <Qt3DRender/qabstractsceneparser.h>
-#include "assimphelpers.h"
-
-#include <QMap>
-#include <QDir>
-#include <QLoggingCategory>
-
-QT_BEGIN_NAMESPACE
-
-class QFile;
-
-namespace Qt3DCore {
-class QCamera;
-}
-
-namespace Qt3DRender {
-
-class QMaterial;
-class QShaderProgram;
-class QEffect;
-class QAbstractTextureProvider;
-class QMesh;
-class QGeometryRenderer;
-
-Q_DECLARE_LOGGING_CATEGORY(AssimpParserLog)
-
-class AssimpParser : public QAbstractSceneParser
-{
- Q_OBJECT
-
-public:
- AssimpParser();
- ~AssimpParser();
-
- // SceneParserInterface interface
- void setSource(const QUrl& source) Q_DECL_OVERRIDE;
- bool isExtensionSupported(const QUrl &source) const Q_DECL_OVERRIDE;
- Qt3DCore::QEntity *scene(const QString &id = QString()) Q_DECL_OVERRIDE;
- Qt3DCore::QEntity *node(const QString &id) Q_DECL_OVERRIDE;
-
-private:
- static bool isAssimpPath(const QString &path);
- static QStringList assimpSupportedFormats();
-
- Qt3DCore::QEntity *node(aiNode *node);
-
- void readSceneFile(const QString &file);
-
- void cleanup();
- void parse();
-
- void loadMaterial(uint materialIndex);
- void loadMesh(uint meshIndex);
- void loadEmbeddedTexture(uint textureIndex);
- void loadLight(uint lightIndex);
- void loadCamera(uint cameraIndex);
- void loadAnimation(uint animationIndex);
-
- void copyMaterialName(QMaterial *material, aiMaterial *assimpMaterial);
- void copyMaterialColorProperties(QMaterial *material, aiMaterial *assimpMaterial);
- void copyMaterialFloatProperties(QMaterial *material, aiMaterial *assimpMaterial);
- void copyMaterialBoolProperties(QMaterial *material, aiMaterial *assimpMaterial);
- void copyMaterialShadingModel(QMaterial *material, aiMaterial *assimpMaterial);
- void copyMaterialBlendingFunction(QMaterial *material, aiMaterial *assimpMaterial);
- void copyMaterialTextures(QMaterial *material, aiMaterial *assimpMaterial);
-
- class SceneImporter {
- public :
-
- SceneImporter();
- ~SceneImporter();
-
- Assimp::Importer *m_importer;
- mutable const aiScene *m_aiScene;
-
- QMap<uint, QGeometryRenderer *> m_meshes;
- QMap<uint, QMaterial*> m_materials;
- QMap<uint, QEffect *> m_effects;
- QMap<uint, QAbstractTextureProvider *> m_embeddedTextures;
- QMap<QString, QAbstractTextureProvider *> m_materialTextures;
- QMap<aiNode*, Qt3DCore::QEntity*> m_cameras;
- QHash<aiTextureType, QString> m_textureToParameterName;
-// QMap<aiNode*, Light*> m_lights;
- };
-
- QDir m_sceneDir;
- bool m_sceneParsed;
- AssimpParser::SceneImporter *m_scene;
- static QStringList assimpSupportedFormatsList;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3D_ASSIMPPARSER_H
diff --git a/src/plugins/sceneparsers/assimp/main.cpp b/src/plugins/sceneparsers/assimp/main.cpp
index 39686a77b..9e62dcf36 100644
--- a/src/plugins/sceneparsers/assimp/main.cpp
+++ b/src/plugins/sceneparsers/assimp/main.cpp
@@ -1,55 +1,58 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "assimpparser.h"
+#include "assimpio.h"
-#include <Qt3DRender/QSceneParserPlugin>
+#include <Qt3DRender/private/qsceneioplugin_p.h>
QT_BEGIN_NAMESPACE
-class AssimpSceneParserPlugin : public Qt3DRender::QSceneParserPlugin
+class AssimpSceneIOPlugin : public Qt3DRender::QSceneIOPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QSceneParserFactoryInterface_iid FILE "assimp.json")
+ Q_PLUGIN_METADATA(IID QSceneIOFactoryInterface_iid FILE "assimp.json")
- Qt3DRender::QAbstractSceneParser *create(const QString &key, const QStringList &paramList) Q_DECL_OVERRIDE
+ Qt3DRender::QSceneIOHandler *create(const QString &key, const QStringList &paramList) Q_DECL_OVERRIDE
{
Q_UNUSED(key)
Q_UNUSED(paramList)
- return new Qt3DRender::AssimpParser();
+ return new Qt3DRender::AssimpIO();
}
};
diff --git a/src/plugins/sceneparsers/gltf/gltf.pro b/src/plugins/sceneparsers/gltf/gltf.pro
index 675d127da..59039504e 100644
--- a/src/plugins/sceneparsers/gltf/gltf.pro
+++ b/src/plugins/sceneparsers/gltf/gltf.pro
@@ -1,17 +1,19 @@
-TARGET = gltfsceneparser
+TARGET = gltfsceneio
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private 3dextras
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
HEADERS += \
- gltfparser.h
+ gltfio.h
SOURCES += \
- gltfparser.cpp \
- main.cpp
+ main.cpp \
+ gltfio.cpp
DISTFILES += \
gltf.json
PLUGIN_TYPE = sceneparsers
-PLUGIN_CLASS_NAME = GLTFSceneParserPlugin
+PLUGIN_CLASS_NAME = GLTFSceneIOPlugin
load(qt_plugin)
diff --git a/src/plugins/sceneparsers/gltf/gltfio.cpp b/src/plugins/sceneparsers/gltf/gltfio.cpp
new file mode 100644
index 000000000..68d43dc1b
--- /dev/null
+++ b/src/plugins/sceneparsers/gltf/gltfio.cpp
@@ -0,0 +1,1598 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gltfio.h"
+
+#include <QtCore/QDir>
+#include <QtCore/QFileInfo>
+#include <QtCore/QJsonArray>
+#include <QtCore/QJsonObject>
+
+#include <QtGui/QVector2D>
+
+#include <Qt3DRender/QCameraLens>
+#include <Qt3DCore/QEntity>
+#include <Qt3DCore/QTransform>
+
+#include <Qt3DRender/private/qurlhelper_p.h>
+
+#include <Qt3DRender/QAlphaCoverage>
+#include <Qt3DRender/QBlendEquation>
+#include <Qt3DRender/QBlendEquationArguments>
+#include <Qt3DRender/QColorMask>
+#include <Qt3DRender/QCullFace>
+#include <Qt3DRender/QNoDepthMask>
+#include <Qt3DRender/QDepthTest>
+#include <Qt3DRender/QEffect>
+#include <Qt3DRender/QFrontFace>
+#include <Qt3DRender/QGeometry>
+#include <Qt3DRender/QGeometryRenderer>
+#include <Qt3DRender/QMaterial>
+#include <Qt3DRender/QGraphicsApiFilter>
+#include <Qt3DRender/QParameter>
+#include <Qt3DRender/QPolygonOffset>
+#include <Qt3DRender/QRenderState>
+#include <Qt3DRender/QScissorTest>
+#include <Qt3DRender/QShaderProgram>
+#include <Qt3DRender/QTechnique>
+#include <Qt3DRender/QTexture>
+
+#include <Qt3DExtras/QPhongMaterial>
+#include <Qt3DExtras/QDiffuseMapMaterial>
+#include <Qt3DExtras/QDiffuseSpecularMapMaterial>
+#include <Qt3DExtras/QNormalDiffuseMapMaterial>
+#include <Qt3DExtras/QNormalDiffuseSpecularMapMaterial>
+
+#ifndef qUtf16PrintableImpl // -Impl is a Qt 5.8 feature
+# define qUtf16PrintableImpl(string) \
+ static_cast<const wchar_t*>(static_cast<const void*>(string.utf16()))
+#endif
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+using namespace Qt3DExtras;
+
+namespace Qt3DRender {
+
+Q_LOGGING_CATEGORY(GLTFIOLog, "Qt3D.GLTFIO")
+
+#define KEY_CAMERA QLatin1String("camera")
+#define KEY_CAMERAS QLatin1String("cameras")
+#define KEY_SCENES QLatin1String("scenes")
+#define KEY_NODES QLatin1String("nodes")
+#define KEY_MESHES QLatin1String("meshes")
+#define KEY_CHILDREN QLatin1String("children")
+#define KEY_MATRIX QLatin1String("matrix")
+#define KEY_ROTATION QLatin1String("rotation")
+#define KEY_SCALE QLatin1String("scale")
+#define KEY_TRANSLATION QLatin1String("translation")
+#define KEY_TYPE QLatin1String("type")
+#define KEY_PERSPECTIVE QLatin1String("perspective")
+#define KEY_NAME QLatin1String("name")
+#define KEY_COUNT QLatin1String("count")
+#define KEY_YFOV QLatin1String("yfov")
+#define KEY_ZNEAR QLatin1String("znear")
+#define KEY_ZFAR QLatin1String("zfar")
+#define KEY_MATERIALS QLatin1String("materials")
+#define KEY_EXTENSIONS QLatin1String("extensions")
+#define KEY_COMMON_MAT QLatin1String("KHR_materials_common")
+#define KEY_TECHNIQUE QLatin1String("technique")
+#define KEY_VALUES QLatin1String("values")
+#define KEY_BUFFERS QLatin1String("buffers")
+#define KEY_SHADERS QLatin1String("shaders")
+#define KEY_PROGRAMS QLatin1String("programs")
+#define KEY_PROGRAM QLatin1String("program")
+#define KEY_TECHNIQUES QLatin1String("techniques")
+#define KEY_ACCESSORS QLatin1String("accessors")
+#define KEY_IMAGES QLatin1String("images")
+#define KEY_TEXTURES QLatin1String("textures")
+#define KEY_SCENE QLatin1String("scene")
+#define KEY_BUFFER QLatin1String("buffer")
+#define KEY_TARGET QLatin1String("target")
+#define KEY_BYTE_OFFSET QLatin1String("byteOffset")
+#define KEY_BYTE_LENGTH QLatin1String("byteLength")
+#define KEY_BYTE_STRIDE QLatin1String("byteStride")
+#define KEY_PRIMITIVES QLatin1String("primitives")
+#define KEY_MODE QLatin1String("mode")
+#define KEY_MATERIAL QLatin1String("material")
+#define KEY_ATTRIBUTES QLatin1String("attributes")
+#define KEY_INDICES QLatin1String("indices")
+#define KEY_URI QLatin1String("uri")
+#define KEY_FORMAT QLatin1String("format")
+#define KEY_PASSES QLatin1String("passes")
+#define KEY_SOURCE QLatin1String("source")
+#define KEY_SAMPLER QLatin1String("sampler")
+#define KEY_SAMPLERS QLatin1String("samplers")
+#define KEY_SEMANTIC QLatin1String("semantic")
+#define KEY_STATES QLatin1String("states")
+#define KEY_UNIFORMS QLatin1String("uniforms")
+#define KEY_PARAMETERS QLatin1String("parameters")
+#define KEY_WRAP_S QLatin1String("wrapS")
+#define KEY_MIN_FILTER QLatin1String("minFilter")
+#define KEY_MAG_FILTER QLatin1String("magFilter")
+
+#define KEY_INSTANCE_TECHNIQUE QLatin1String("instanceTechnique")
+#define KEY_INSTANCE_PROGRAM QLatin1String("instanceProgram")
+#define KEY_BUFFER_VIEWS QLatin1String("bufferViews")
+#define KEY_BUFFER_VIEW QLatin1String("bufferView")
+#define KEY_VERTEX_SHADER QLatin1String("vertexShader")
+#define KEY_FRAGMENT_SHADER QLatin1String("fragmentShader")
+#define KEY_INTERNAL_FORMAT QLatin1String("internalFormat")
+#define KEY_COMPONENT_TYPE QLatin1String("componentType")
+#define KEY_ASPECT_RATIO QLatin1String("aspect_ratio")
+#define KEY_VALUE QLatin1String("value")
+#define KEY_ENABLE QLatin1String("enable")
+#define KEY_FUNCTIONS QLatin1String("functions")
+#define KEY_TECHNIQUE_CORE QLatin1String("techniqueCore")
+#define KEY_TECHNIQUE_GL2 QLatin1String("techniqueGL2")
+
+GLTFIO::GLTFIO() : QSceneIOHandler(),
+ m_parseDone(false)
+{
+}
+
+GLTFIO::~GLTFIO()
+{
+
+}
+
+void GLTFIO::setBasePath(const QString& path)
+{
+ m_basePath = path;
+}
+
+bool GLTFIO::setJSON(const QJsonDocument &json )
+{
+ if ( !json.isObject() ) {
+ return false;
+ }
+
+ m_json = json;
+ m_parseDone = false;
+
+ cleanup();
+
+ return true;
+}
+
+/*!
+ * Sets the \a path used by the parser to load the scene file.
+ * If the file is valid, parsing is automatically triggered.
+ */
+void GLTFIO::setSource(const QUrl &source)
+{
+ const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
+ QFileInfo finfo(path);
+ if (Q_UNLIKELY(!finfo.exists())) {
+ qCWarning(GLTFIOLog, "missing file: %ls", qUtf16PrintableImpl(path));
+ return;
+ }
+ QFile f(path);
+ f.open(QIODevice::ReadOnly);
+
+ QByteArray jsonData = f.readAll();
+ QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(jsonData);
+ if (sceneDocument.isNull())
+ sceneDocument = QJsonDocument::fromJson(jsonData);
+
+ if (Q_UNLIKELY(!setJSON(sceneDocument))) {
+ qCWarning(GLTFIOLog, "not a JSON document");
+ return;
+ }
+
+ setBasePath(finfo.dir().absolutePath());
+}
+
+/*!
+ * Returns true if the extension of \a path is supported by the
+ * GLTF parser.
+ */
+bool GLTFIO::isFileTypeSupported(const QUrl &source) const
+{
+ const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
+ return GLTFIO::isGLTFPath(path);
+}
+
+Qt3DCore::QEntity* GLTFIO::node(const QString &id)
+{
+ QJsonObject nodes = m_json.object().value(KEY_NODES).toObject();
+ const auto jsonVal = nodes.value(id);
+ if (Q_UNLIKELY(jsonVal.isUndefined())) {
+ qCWarning(GLTFIOLog, "unknown node %ls in GLTF file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return NULL;
+ }
+
+ const QJsonObject jsonObj = jsonVal.toObject();
+ QEntity* result = nullptr;
+
+ // Qt3D has a limitation that a QEntity can only have 1 mesh and 1 material component
+ // So if the node has only 1 mesh, we only create 1 QEntity
+ // Otherwise if there are n meshes, there is 1 QEntity, with n children for each mesh/material combo
+ {
+ QVector<QEntity *> entities;
+
+ const auto meshes = jsonObj.value(KEY_MESHES).toArray();
+ for (const QJsonValue &mesh : meshes) {
+ const QString meshName = mesh.toString();
+ const auto geometryRenderers = qAsConst(m_meshDict).equal_range(meshName);
+ if (Q_UNLIKELY(geometryRenderers.first == geometryRenderers.second)) {
+ qCWarning(GLTFIOLog, "node %ls references unknown mesh %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(meshName));
+ continue;
+ }
+
+ for (auto it = geometryRenderers.first; it != geometryRenderers.second; ++it) {
+ QGeometryRenderer *geometryRenderer = it.value();
+ QEntity *entity = new QEntity;
+ entity->addComponent(geometryRenderer);
+ QMaterial *mat = material(m_meshMaterialDict[geometryRenderer]);
+ if (mat)
+ entity->addComponent(mat);
+ entities.append(entity);
+ }
+
+ }
+
+ switch (entities.size()) {
+ case 0:
+ break;
+ case 1:
+ result = qAsConst(entities).first();
+ default:
+ result = new QEntity;
+ for (QEntity *entity : qAsConst(entities))
+ entity->setParent(result);
+ }
+ }
+
+ //If the entity contains no meshes, results will still be null here
+ if (result == nullptr)
+ result = new QEntity;
+
+ {
+ const auto children = jsonObj.value(KEY_CHILDREN).toArray();
+ for (const QJsonValue &c : children) {
+ QEntity* child = node(c.toString());
+ if (!child)
+ continue;
+ child->setParent(result);
+ }
+ }
+
+ renameFromJson(jsonObj, result);
+
+
+ // Node Transforms
+ Qt3DCore::QTransform *trans = nullptr;
+ const auto matrix = jsonObj.value(KEY_MATRIX);
+ if (!matrix.isUndefined()) {
+ QMatrix4x4 m(Qt::Uninitialized);
+
+ QJsonArray matrixValues = matrix.toArray();
+ for (int i=0; i<16; ++i) {
+ double v = matrixValues.at( i ).toDouble();
+ m(i % 4, i >> 2) = v;
+ }
+
+ // ADD MATRIX TRANSFORM COMPONENT TO ENTITY
+ if (trans == nullptr)
+ trans = new Qt3DCore::QTransform;
+ trans->setMatrix(m);
+ }
+
+ // Rotation quaternion
+ const auto rotation = jsonObj.value(KEY_ROTATION);
+ if (!rotation.isUndefined()) {
+ if (!trans)
+ trans = new Qt3DCore::QTransform;
+
+ const QJsonArray quaternionValues = rotation.toArray();
+ QQuaternion quaternion(quaternionValues[0].toDouble(),
+ quaternionValues[1].toDouble(),
+ quaternionValues[2].toDouble(),
+ quaternionValues[3].toDouble());
+ trans->setRotation(quaternion);
+ }
+
+ // Translation
+ const auto translation = jsonObj.value(KEY_TRANSLATION);
+ if (!translation.isUndefined()) {
+ if (!trans)
+ trans = new Qt3DCore::QTransform;
+
+ const QJsonArray translationValues = translation.toArray();
+ trans->setTranslation(QVector3D(translationValues[0].toDouble(),
+ translationValues[1].toDouble(),
+ translationValues[2].toDouble()));
+ }
+
+ // Scale
+ const auto scale = jsonObj.value(KEY_SCALE);
+ if (!scale.isUndefined()) {
+ if (!trans)
+ trans = new Qt3DCore::QTransform;
+
+ const QJsonArray scaleValues = scale.toArray();
+ trans->setScale3D(QVector3D(scaleValues[0].toDouble(),
+ scaleValues[1].toDouble(),
+ scaleValues[2].toDouble()));
+ }
+
+ // Add the Transform component
+ if (trans != nullptr)
+ result->addComponent(trans);
+
+ const auto cameraVal = jsonObj.value(KEY_CAMERA);
+ if (!cameraVal.isUndefined()) {
+ QCameraLens* cam = camera(cameraVal.toString());
+ if (Q_UNLIKELY(!cam)) {
+ qCWarning(GLTFIOLog) << "failed to build camera:" << cameraVal
+ << "on node" << id;
+ } else {
+ result->addComponent(cam);
+ }
+ } // of have camera attribute
+
+ return result;
+}
+
+Qt3DCore::QEntity* GLTFIO::scene(const QString &id)
+{
+ parse();
+
+ QJsonObject scenes = m_json.object().value(KEY_SCENES).toObject();
+ const auto sceneVal = scenes.value(id);
+ if (Q_UNLIKELY(sceneVal.isUndefined())) {
+ if (Q_UNLIKELY(!id.isNull()))
+ qCWarning(GLTFIOLog, "GLTF: no such scene %ls in file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return defaultScene();
+ }
+
+ QJsonObject sceneObj = sceneVal.toObject();
+ QEntity* sceneEntity = new QEntity;
+ const auto nodes = sceneObj.value(KEY_NODES).toArray();
+ for (const QJsonValue &nnv : nodes) {
+ QString nodeName = nnv.toString();
+ QEntity* child = node(nodeName);
+ if (!child)
+ continue;
+ child->setParent(sceneEntity);
+ }
+
+ return sceneEntity;
+}
+
+GLTFIO::BufferData::BufferData()
+ : length(0)
+ , data(nullptr)
+{
+}
+
+GLTFIO::BufferData::BufferData(const QJsonObject &json)
+ : length(json.value(KEY_BYTE_LENGTH).toInt()),
+ path(json.value(KEY_URI).toString()),
+ data(nullptr)
+{
+}
+
+GLTFIO::ParameterData::ParameterData() :
+ type(0)
+{
+
+}
+
+GLTFIO::ParameterData::ParameterData(const QJsonObject &json)
+ : semantic(json.value(KEY_SEMANTIC).toString()),
+ type(json.value(KEY_TYPE).toInt())
+{
+}
+
+GLTFIO::AccessorData::AccessorData()
+ : type(QAttribute::Float)
+ , dataSize(0)
+ , count(0)
+ , offset(0)
+ , stride(0)
+{
+
+}
+
+GLTFIO::AccessorData::AccessorData(const QJsonObject &json)
+ : bufferViewName(json.value(KEY_BUFFER_VIEW).toString()),
+ type(accessorTypeFromJSON(json.value(KEY_COMPONENT_TYPE).toInt())),
+ dataSize(accessorDataSizeFromJson(json.value(KEY_TYPE).toString())),
+ count(json.value(KEY_COUNT).toInt()),
+ offset(0),
+ stride(0)
+{
+ const auto byteOffset = json.value(KEY_BYTE_OFFSET);
+ if (!byteOffset.isUndefined())
+ offset = byteOffset.toInt();
+ const auto byteStride = json.value(KEY_BYTE_STRIDE);
+ if (!byteStride.isUndefined())
+ stride = byteStride.toInt();
+}
+
+bool GLTFIO::isGLTFPath(const QString& path)
+{
+ QFileInfo finfo(path);
+ if (!finfo.exists())
+ return false;
+
+ // might need to detect other things in the future, but would
+ // prefer to avoid doing a full parse.
+ QString suffix = finfo.suffix().toLower();
+ return suffix == QLatin1String("json") || suffix == QLatin1String("gltf") || suffix == QLatin1String("qgltf");
+}
+
+void GLTFIO::renameFromJson(const QJsonObject &json, QObject * const object)
+{
+ const auto name = json.value(KEY_NAME);
+ if (!name.isUndefined())
+ object->setObjectName(name.toString());
+}
+
+bool GLTFIO::hasStandardUniformNameFromSemantic(const QString &semantic)
+{
+ //Standard Uniforms
+ if (semantic.isEmpty())
+ return false;
+ switch (semantic.at(0).toLatin1()) {
+ case 'L':
+ // return semantic == QLatin1String("LOCAL");
+ return false;
+ case 'M':
+ return semantic == QLatin1String("MODEL")
+ || semantic == QLatin1String("MODELVIEW")
+ || semantic == QLatin1String("MODELVIEWPROJECTION")
+ || semantic == QLatin1String("MODELINVERSE")
+ || semantic == QLatin1String("MODELVIEWPROJECTIONINVERSE")
+ || semantic == QLatin1String("MODELINVERSETRANSPOSE")
+ || semantic == QLatin1String("MODELVIEWINVERSETRANSPOSE");
+ case 'V':
+ return semantic == QLatin1String("VIEW")
+ || semantic == QLatin1String("VIEWINVERSE")
+ || semantic == QLatin1String("VIEWPORT");
+ case 'P':
+ return semantic == QLatin1String("PROJECTION")
+ || semantic == QLatin1String("PROJECTIONINVERSE");
+ }
+ return false;
+}
+
+QString GLTFIO::standardAttributeNameFromSemantic(const QString &semantic)
+{
+ //Standard Attributes
+ if (semantic.startsWith(QLatin1String("POSITION")))
+ return QAttribute::defaultPositionAttributeName();
+ if (semantic.startsWith(QLatin1String("NORMAL")))
+ return QAttribute::defaultNormalAttributeName();
+ if (semantic.startsWith(QLatin1String("TEXCOORD")))
+ return QAttribute::defaultTextureCoordinateAttributeName();
+ if (semantic.startsWith(QLatin1String("COLOR")))
+ return QAttribute::defaultColorAttributeName();
+ if (semantic.startsWith(QLatin1String("TANGENT")))
+ return QAttribute::defaultTangentAttributeName();
+
+// if (semantic.startsWith(QLatin1String("JOINT")));
+// if (semantic.startsWith(QLatin1String("JOINTMATRIX")));
+// if (semantic.startsWith(QLatin1String("WEIGHT")));
+
+ return QString();
+}
+
+QParameter *GLTFIO::parameterFromTechnique(QTechnique *technique, const QString &parameterName)
+{
+ const auto parameters = technique->parameters();
+ for (QParameter *parameter : parameters) {
+ if (parameter->name() == parameterName) {
+ return parameter;
+ }
+ }
+
+ return nullptr;
+}
+
+Qt3DCore::QEntity* GLTFIO::defaultScene()
+{
+ if (Q_UNLIKELY(m_defaultScene.isEmpty())) {
+ qCWarning(GLTFIOLog, "no default scene");
+ return NULL;
+ }
+
+ return scene(m_defaultScene);
+}
+
+QMaterial *GLTFIO::materialWithCustomShader(const QString &id, const QJsonObject &jsonObj)
+{
+ //Default ES2 Technique
+ QString techniqueName = jsonObj.value(KEY_TECHNIQUE).toString();
+ const auto it = qAsConst(m_techniques).find(techniqueName);
+ if (Q_UNLIKELY(it == m_techniques.cend())) {
+ qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls",
+ qUtf16PrintableImpl(techniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return NULL;
+ }
+ QTechnique *technique = *it;
+ technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
+ technique->graphicsApiFilter()->setMajorVersion(2);
+ technique->graphicsApiFilter()->setMinorVersion(0);
+ technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+
+
+ //Optional Core technique
+ QTechnique *coreTechnique = nullptr;
+ QTechnique *gl2Technique = nullptr;
+ QString coreTechniqueName = jsonObj.value(KEY_TECHNIQUE_CORE).toString();
+ if (!coreTechniqueName.isNull()) {
+ const auto it = qAsConst(m_techniques).find(coreTechniqueName);
+ if (Q_UNLIKELY(it == m_techniques.cend())) {
+ qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls",
+ qUtf16PrintableImpl(coreTechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ } else {
+ coreTechnique = it.value();
+ coreTechnique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ coreTechnique->graphicsApiFilter()->setMajorVersion(3);
+ coreTechnique->graphicsApiFilter()->setMinorVersion(1);
+ coreTechnique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
+ }
+ }
+ //Optional GL2 technique
+ QString gl2TechniqueName = jsonObj.value(KEY_TECHNIQUE_GL2).toString();
+ if (!gl2TechniqueName.isNull()) {
+ const auto it = qAsConst(m_techniques).find(gl2TechniqueName);
+ if (Q_UNLIKELY(it == m_techniques.cend())) {
+ qCWarning(GLTFIOLog, "unknown technique %ls for material %ls in GLTF file %ls",
+ qUtf16PrintableImpl(gl2TechniqueName), qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ } else {
+ gl2Technique = it.value();
+ gl2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
+ gl2Technique->graphicsApiFilter()->setMajorVersion(2);
+ gl2Technique->graphicsApiFilter()->setMinorVersion(0);
+ gl2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
+ }
+ }
+
+
+ // glTF doesn't deal in effects, but we need a trivial one to wrap
+ // up our techniques
+ // However we need to create a unique effect for each material instead
+ // of caching because QMaterial does not keep up with effects
+ // its not the parent of.
+ QEffect* effect = new QEffect;
+ effect->setObjectName(techniqueName);
+ effect->addTechnique(technique);
+ if (coreTechnique != nullptr)
+ effect->addTechnique(coreTechnique);
+ if (gl2Technique != nullptr)
+ effect->addTechnique(gl2Technique);
+
+ QMaterial* mat = new QMaterial;
+ mat->setEffect(effect);
+
+ renameFromJson(jsonObj, mat);
+
+ const QJsonObject values = jsonObj.value(KEY_VALUES).toObject();
+ for (auto it = values.begin(), end = values.end(); it != end; ++it) {
+ const QString vName = it.key();
+ QParameter *param = parameterFromTechnique(technique, vName);
+
+ if (param == nullptr && coreTechnique != nullptr) {
+ param = parameterFromTechnique(coreTechnique, vName);
+ }
+
+ if (param == nullptr && gl2Technique != nullptr) {
+ param = parameterFromTechnique(gl2Technique, vName);
+ }
+
+ if (Q_UNLIKELY(!param)) {
+ qCWarning(GLTFIOLog, "unknown parameter: %ls in technique %ls processing material %ls",
+ qUtf16PrintableImpl(vName), qUtf16PrintableImpl(techniqueName), qUtf16PrintableImpl(id));
+ continue;
+ }
+
+ ParameterData paramData = m_parameterDataDict.value(param);
+ QVariant var = parameterValueFromJSON(paramData.type, it.value());
+
+ mat->addParameter(new QParameter(param->name(), var));
+ } // of material technique-instance values iteration
+
+ return mat;
+}
+
+static inline QVariant vec4ToRgb(const QVariant &vec4Var)
+{
+ const QVector4D v = vec4Var.value<QVector4D>();
+ return QVariant(QColor::fromRgbF(v.x(), v.y(), v.z()));
+}
+
+QMaterial *GLTFIO::commonMaterial(const QJsonObject &jsonObj)
+{
+ QVariantHash params;
+ bool hasDiffuseMap = false;
+ bool hasSpecularMap = false;
+ bool hasNormalMap = false;
+
+ const QJsonObject values = jsonObj.value(KEY_VALUES).toObject();
+ for (auto it = values.begin(), end = values.end(); it != end; ++it) {
+ const QString vName = it.key();
+ const QJsonValue val = it.value();
+ QVariant var;
+ QString propertyName = vName;
+ if (vName == QLatin1String("ambient") && val.isArray()) {
+ var = vec4ToRgb(parameterValueFromJSON(GL_FLOAT_VEC4, val));
+ } else if (vName == QLatin1String("diffuse")) {
+ if (val.isString()) {
+ var = parameterValueFromJSON(GL_SAMPLER_2D, val);
+ hasDiffuseMap = true;
+ } else if (val.isArray()) {
+ var = vec4ToRgb(parameterValueFromJSON(GL_FLOAT_VEC4, val));
+ }
+ } else if (vName == QLatin1String("specular")) {
+ if (val.isString()) {
+ var = parameterValueFromJSON(GL_SAMPLER_2D, val);
+ hasSpecularMap = true;
+ } else if (val.isArray()) {
+ var = vec4ToRgb(parameterValueFromJSON(GL_FLOAT_VEC4, val));
+ }
+ } else if (vName == QLatin1String("shininess") && val.isDouble()) {
+ var = parameterValueFromJSON(GL_FLOAT, val);
+ } else if (vName == QLatin1String("normalmap") && val.isString()) {
+ var = parameterValueFromJSON(GL_SAMPLER_2D, val);
+ propertyName = QStringLiteral("normal");
+ hasNormalMap = true;
+ } else if (vName == QLatin1String("transparency")) {
+ qCWarning(GLTFIOLog, "Semi-transparent common materials are not currently supported, ignoring alpha");
+ }
+ if (var.isValid())
+ params[propertyName] = var;
+ }
+
+ QMaterial *mat = nullptr;
+ if (hasNormalMap) {
+ if (hasSpecularMap) {
+ mat = new QNormalDiffuseSpecularMapMaterial;
+ } else {
+ if (Q_UNLIKELY(!hasDiffuseMap))
+ qCWarning(GLTFIOLog, "Common material with normal and specular maps needs a diffuse map as well");
+ else
+ mat = new QNormalDiffuseMapMaterial;
+ }
+ } else {
+ if (hasSpecularMap) {
+ if (Q_UNLIKELY(!hasDiffuseMap))
+ qCWarning(GLTFIOLog, "Common material with specular map needs a diffuse map as well");
+ else
+ mat = new QDiffuseSpecularMapMaterial;
+ } else if (hasDiffuseMap) {
+ mat = new QDiffuseMapMaterial;
+ } else {
+ mat = new QPhongMaterial;
+ }
+ }
+
+ if (Q_UNLIKELY(!mat)) {
+ qCWarning(GLTFIOLog, "Could not find a suitable built-in material for KHR_materials_common");
+ } else {
+ for (QVariantHash::const_iterator it = params.constBegin(), itEnd = params.constEnd(); it != itEnd; ++it)
+ mat->setProperty(it.key().toUtf8(), it.value());
+ }
+
+ return mat;
+}
+
+QMaterial* GLTFIO::material(const QString &id)
+{
+ const auto it = qAsConst(m_materialCache).find(id);
+ if (it != m_materialCache.cend())
+ return it.value();
+
+ QJsonObject mats = m_json.object().value(KEY_MATERIALS).toObject();
+ const auto jsonVal = mats.value(id);
+ if (Q_UNLIKELY(jsonVal.isUndefined())) {
+ qCWarning(GLTFIOLog, "unknown material %ls in GLTF file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return NULL;
+ }
+
+ const QJsonObject jsonObj = jsonVal.toObject();
+
+ QMaterial *mat = nullptr;
+
+ // Prefer common materials over custom shaders.
+ const auto extensionMat = jsonObj.value(KEY_EXTENSIONS).toObject().value(KEY_COMMON_MAT);
+ if (!extensionMat.isUndefined())
+ mat = commonMaterial(extensionMat.toObject());
+
+ if (!mat)
+ mat = materialWithCustomShader(id, jsonObj);
+
+ m_materialCache[id] = mat;
+ return mat;
+}
+
+QCameraLens* GLTFIO::camera(const QString &id) const
+{
+ const auto jsonVal = m_json.object().value(KEY_CAMERAS).toObject().value(id);
+ if (Q_UNLIKELY(jsonVal.isUndefined())) {
+ qCWarning(GLTFIOLog, "unknown camera %ls in GLTF file %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(m_basePath));
+ return nullptr;
+ }
+
+ QJsonObject jsonObj = jsonVal.toObject();
+ QString camTy = jsonObj.value(KEY_TYPE).toString();
+
+ if (camTy == QLatin1String("perspective")) {
+ const auto pVal = jsonObj.value(KEY_PERSPECTIVE);
+ if (Q_UNLIKELY(pVal.isUndefined())) {
+ qCWarning(GLTFIOLog, "camera: %ls missing 'perspective' object",
+ qUtf16PrintableImpl(id));
+ return nullptr;
+ }
+
+ const QJsonObject pObj = pVal.toObject();
+ double aspectRatio = pObj.value(KEY_ASPECT_RATIO).toDouble();
+ double yfov = pObj.value(KEY_YFOV).toDouble();
+ double frustumNear = pObj.value(KEY_ZNEAR).toDouble();
+ double frustumFar = pObj.value(KEY_ZFAR).toDouble();
+
+ QCameraLens* result = new QCameraLens;
+ result->setPerspectiveProjection(yfov, aspectRatio, frustumNear, frustumFar);
+ return result;
+ } else if (camTy == QLatin1String("orthographic")) {
+ qCWarning(GLTFIOLog, "implement me");
+
+ return nullptr;
+ } else {
+ qCWarning(GLTFIOLog, "camera: %ls has unsupported type: %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(camTy));
+ return nullptr;
+ }
+}
+
+
+void GLTFIO::parse()
+{
+ if (m_parseDone)
+ return;
+
+ const QJsonObject buffers = m_json.object().value(KEY_BUFFERS).toObject();
+ for (auto it = buffers.begin(), end = buffers.end(); it != end; ++it)
+ processJSONBuffer(it.key(), it.value().toObject());
+
+ const QJsonObject views = m_json.object().value(KEY_BUFFER_VIEWS).toObject();
+ loadBufferData();
+ for (auto it = views.begin(), end = views.end(); it != end; ++it)
+ processJSONBufferView(it.key(), it.value().toObject());
+ unloadBufferData();
+
+ const QJsonObject shaders = m_json.object().value(KEY_SHADERS).toObject();
+ for (auto it = shaders.begin(), end = shaders.end(); it != end; ++it)
+ processJSONShader(it.key(), it.value().toObject());
+
+ const QJsonObject programs = m_json.object().value(KEY_PROGRAMS).toObject();
+ for (auto it = programs.begin(), end = programs.end(); it != end; ++it)
+ processJSONProgram(it.key(), it.value().toObject());
+
+ const QJsonObject techniques = m_json.object().value(KEY_TECHNIQUES).toObject();
+ for (auto it = techniques.begin(), end = techniques.end(); it != end; ++it)
+ processJSONTechnique(it.key(), it.value().toObject());
+
+ const QJsonObject attrs = m_json.object().value(KEY_ACCESSORS).toObject();
+ for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it)
+ processJSONAccessor(it.key(), it.value().toObject());
+
+ const QJsonObject meshes = m_json.object().value(KEY_MESHES).toObject();
+ for (auto it = meshes.begin(), end = meshes.end(); it != end; ++it)
+ processJSONMesh(it.key(), it.value().toObject());
+
+ const QJsonObject images = m_json.object().value(KEY_IMAGES).toObject();
+ for (auto it = images.begin(), end = images.end(); it != end; ++it)
+ processJSONImage(it.key(), it.value().toObject());
+
+ const QJsonObject textures = m_json.object().value(KEY_TEXTURES).toObject();
+ for (auto it = textures.begin(), end = textures.end(); it != end; ++it)
+ processJSONTexture(it.key(), it.value().toObject());
+
+ m_defaultScene = m_json.object().value(KEY_SCENE).toString();
+ m_parseDone = true;
+}
+
+namespace {
+template <typename C>
+void delete_if_without_parent(const C &c)
+{
+ for (const auto *e : c) {
+ if (!e->parent())
+ delete e;
+ }
+}
+} // unnamed namespace
+
+void GLTFIO::cleanup()
+{
+ m_meshDict.clear();
+ m_meshMaterialDict.clear();
+ m_accessorDict.clear();
+ delete_if_without_parent(m_materialCache);
+ m_materialCache.clear();
+ m_bufferDatas.clear();
+ m_buffers.clear();
+ m_shaderPaths.clear();
+ delete_if_without_parent(m_programs);
+ m_programs.clear();
+ delete_if_without_parent(m_techniques);
+ m_techniques.clear();
+ delete_if_without_parent(m_textures);
+ m_textures.clear();
+ m_imagePaths.clear();
+ m_defaultScene.clear();
+ m_parameterDataDict.clear();
+}
+
+void GLTFIO::processJSONBuffer(const QString &id, const QJsonObject& json)
+{
+ // simply cache buffers for lookup by buffer-views
+ m_bufferDatas[id] = BufferData(json);
+}
+
+void GLTFIO::processJSONBufferView(const QString &id, const QJsonObject& json)
+{
+ QString bufName = json.value(KEY_BUFFER).toString();
+ const auto it = qAsConst(m_bufferDatas).find(bufName);
+ if (Q_UNLIKELY(it == m_bufferDatas.cend())) {
+ qCWarning(GLTFIOLog, "unknown buffer: %ls processing view: %ls",
+ qUtf16PrintableImpl(bufName), qUtf16PrintableImpl(id));
+ return;
+ }
+ const auto &bufferData = *it;
+
+ int target = json.value(KEY_TARGET).toInt();
+ Qt3DRender::QBuffer::BufferType ty(Qt3DRender::QBuffer::VertexBuffer);
+
+ switch (target) {
+ case GL_ARRAY_BUFFER: ty = Qt3DRender::QBuffer::VertexBuffer; break;
+ case GL_ELEMENT_ARRAY_BUFFER: ty = Qt3DRender::QBuffer::IndexBuffer; break;
+ default:
+ qCWarning(GLTFIOLog, "buffer %ls unsupported target: %d",
+ qUtf16PrintableImpl(id), target);
+ return;
+ }
+
+ quint64 offset = 0;
+ const auto byteOffset = json.value(KEY_BYTE_OFFSET);
+ if (!byteOffset.isUndefined()) {
+ offset = byteOffset.toInt();
+ qCDebug(GLTFIOLog, "bv: %ls has offset: %lld", qUtf16PrintableImpl(id), offset);
+ }
+
+ quint64 len = json.value(KEY_BYTE_LENGTH).toInt();
+
+ QByteArray bytes = bufferData.data->mid(offset, len);
+ if (Q_UNLIKELY(bytes.count() != int(len))) {
+ qCWarning(GLTFIOLog, "failed to read sufficient bytes from: %ls for view %ls",
+ qUtf16PrintableImpl(bufferData.path), qUtf16PrintableImpl(id));
+ }
+
+ Qt3DRender::QBuffer *b(new Qt3DRender::QBuffer(ty));
+ b->setData(bytes);
+ m_buffers[id] = b;
+}
+
+void GLTFIO::processJSONShader(const QString &id, const QJsonObject &jsonObject)
+{
+ // shaders are trivial for the moment, defer the real work
+ // to the program section
+ QString path = jsonObject.value(KEY_URI).toString();
+
+ QFileInfo info(m_basePath, path);
+ if (Q_UNLIKELY(!info.exists())) {
+ qCWarning(GLTFIOLog, "can't find shader %ls from path %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(path));
+ return;
+ }
+
+ m_shaderPaths[id] = info.absoluteFilePath();
+}
+
+void GLTFIO::processJSONProgram(const QString &id, const QJsonObject &jsonObject)
+{
+ QString fragName = jsonObject.value(KEY_FRAGMENT_SHADER).toString(),
+ vertName = jsonObject.value(KEY_VERTEX_SHADER).toString();
+ const auto fragIt = qAsConst(m_shaderPaths).find(fragName),
+ vertIt = qAsConst(m_shaderPaths).find(vertName);
+ if (Q_UNLIKELY(fragIt == m_shaderPaths.cend() || vertIt == m_shaderPaths.cend())) {
+ qCWarning(GLTFIOLog, "program: %ls missing shader: %ls %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(fragName), qUtf16PrintableImpl(vertName));
+ return;
+ }
+
+ QShaderProgram* prog = new QShaderProgram;
+ prog->setObjectName(id);
+ prog->setFragmentShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(fragIt.value())));
+ prog->setVertexShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(vertIt.value())));
+ m_programs[id] = prog;
+}
+
+void GLTFIO::processJSONTechnique(const QString &id, const QJsonObject &jsonObject )
+{
+ QTechnique *t = new QTechnique;
+ t->setObjectName(id);
+
+ // Parameters
+ QHash<QString, QParameter*> paramDict;
+ const QJsonObject params = jsonObject.value(KEY_PARAMETERS).toObject();
+ for (auto it = params.begin(), end = params.end(); it != end; ++it) {
+ const QString pname = it.key();
+ const QJsonObject po = it.value().toObject();
+
+ //QString semantic = po.value(KEY_SEMANTIC).toString();
+ QParameter *p = new QParameter(t);
+ p->setName(pname);
+ m_parameterDataDict.insert(p, ParameterData(po));
+
+ //If the parameter has default value, set it
+ QJsonValue value = po.value(KEY_VALUE);
+ if (!value.isUndefined()) {
+ int dataType = po.value(KEY_TYPE).toInt();
+ p->setValue(parameterValueFromJSON(dataType, value));
+ }
+
+ t->addParameter(p);
+
+ paramDict[pname] = p;
+ } // of parameters iteration
+
+ // Program
+ QString programName = jsonObject.value(KEY_PROGRAM).toString();
+ const auto progIt = qAsConst(m_programs).find(programName);
+ if (Q_UNLIKELY(progIt == m_programs.cend())) {
+ qCWarning(GLTFIOLog, "technique %ls: missing program %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(programName));
+ }
+
+ QRenderPass* pass = new QRenderPass;
+ pass->setShaderProgram(progIt.value());
+
+ // Attributes
+ const QJsonObject attrs = jsonObject.value(KEY_ATTRIBUTES).toObject();
+ for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it) {
+ QString pname = it.value().toString();
+ QParameter *parameter = paramDict.value(pname, nullptr);
+ QString attributeName = pname;
+ if (Q_UNLIKELY(!parameter)) {
+ qCWarning(GLTFIOLog, "attribute %ls defined in instanceProgram but not as parameter",
+ qUtf16PrintableImpl(pname));
+ continue;
+ }
+ //Check if the parameter has a standard attribute semantic
+ const auto paramDataIt = m_parameterDataDict.find(parameter);
+ QString standardAttributeName = standardAttributeNameFromSemantic(paramDataIt->semantic);
+ if (!standardAttributeName.isNull()) {
+ attributeName = standardAttributeName;
+ t->removeParameter(parameter);
+ m_parameterDataDict.erase(paramDataIt);
+ delete parameter;
+ }
+
+ } // of program-instance attributes
+
+ // Uniforms
+ const QJsonObject uniforms = jsonObject.value(KEY_UNIFORMS).toObject();
+ for (auto it = uniforms.begin(), end = uniforms.end(); it != end; ++it) {
+ const QString pname = it.value().toString();
+ QParameter *parameter = paramDict.value(pname, nullptr);
+ if (Q_UNLIKELY(!parameter)) {
+ qCWarning(GLTFIOLog, "uniform %ls defined in instanceProgram but not as parameter",
+ qUtf16PrintableImpl(pname));
+ continue;
+ }
+ //Check if the parameter has a standard uniform semantic
+ const auto paramDataIt = m_parameterDataDict.find(parameter);
+ if (hasStandardUniformNameFromSemantic(paramDataIt->semantic)) {
+ t->removeParameter(parameter);
+ m_parameterDataDict.erase(paramDataIt);
+ delete parameter;
+ }
+ } // of program-instance uniforms
+
+
+ // States
+ QJsonObject states = jsonObject.value(KEY_STATES).toObject();
+
+ //Process states to enable
+ const QJsonArray enableStatesArray = states.value(KEY_ENABLE).toArray();
+ QVector<int> enableStates;
+ for (const QJsonValue &enableValue : enableStatesArray)
+ enableStates.append(enableValue.toInt());
+
+ //Process the list of state functions
+ const QJsonObject functions = states.value(KEY_FUNCTIONS).toObject();
+ for (auto it = functions.begin(), end = functions.end(); it != end; ++it) {
+ int enableStateType = 0;
+ QRenderState *renderState = buildState(it.key(), it.value(), enableStateType);
+ if (renderState != nullptr) {
+ //Remove the need to set a default state values for enableStateType
+ enableStates.removeOne(enableStateType);
+ pass->addRenderState(renderState);
+ }
+ }
+
+ //Create render states with default values for any remaining enable states
+ for (int enableState : qAsConst(enableStates)) {
+ QRenderState *renderState = buildStateEnable(enableState);
+ if (renderState != nullptr)
+ pass->addRenderState(renderState);
+ }
+
+
+ t->addRenderPass(pass);
+
+ m_techniques[id] = t;
+}
+
+void GLTFIO::processJSONAccessor( const QString &id, const QJsonObject& json )
+{
+ m_accessorDict[id] = AccessorData(json);
+}
+
+void GLTFIO::processJSONMesh(const QString &id, const QJsonObject &json)
+{
+ const QJsonArray primitivesArray = json.value(KEY_PRIMITIVES).toArray();
+ for (const QJsonValue &primitiveValue : primitivesArray) {
+ QJsonObject primitiveObject = primitiveValue.toObject();
+ int type = primitiveObject.value(KEY_MODE).toInt();
+ QString material = primitiveObject.value(KEY_MATERIAL).toString();
+
+ if (Q_UNLIKELY(material.isEmpty())) {
+ qCWarning(GLTFIOLog, "malformed primitive on %ls, missing material value %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(material));
+ continue;
+ }
+
+ QGeometryRenderer *geometryRenderer = new QGeometryRenderer;
+ QGeometry *meshGeometry = new QGeometry(geometryRenderer);
+
+ //Set Primitive Type
+ geometryRenderer->setPrimitiveType(static_cast<QGeometryRenderer::PrimitiveType>(type));
+
+ //Save Material for mesh
+ m_meshMaterialDict[geometryRenderer] = material;
+
+ const QJsonObject attrs = primitiveObject.value(KEY_ATTRIBUTES).toObject();
+ for (auto it = attrs.begin(), end = attrs.end(); it != end; ++it) {
+ QString k = it.value().toString();
+ const auto accessorIt = qAsConst(m_accessorDict).find(k);
+ if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) {
+ qCWarning(GLTFIOLog, "unknown attribute accessor: %ls on mesh %ls",
+ qUtf16PrintableImpl(k), qUtf16PrintableImpl(id));
+ continue;
+ }
+
+ const QString attrName = it.key();
+ QString attributeName = standardAttributeNameFromSemantic(attrName);
+ if (attributeName.isEmpty())
+ attributeName = attrName;
+
+ //Get buffer handle for accessor
+ Qt3DRender::QBuffer *buffer = m_buffers.value(accessorIt->bufferViewName, nullptr);
+ if (Q_UNLIKELY(!buffer)) {
+ qCWarning(GLTFIOLog, "unknown buffer-view: %ls processing accessor: %ls",
+ qUtf16PrintableImpl(accessorIt->bufferViewName), qUtf16PrintableImpl(id));
+ continue;
+ }
+
+ QAttribute *attribute = new QAttribute(buffer,
+ attributeName,
+ accessorIt->type,
+ accessorIt->dataSize,
+ accessorIt->count,
+ accessorIt->offset,
+ accessorIt->stride);
+ attribute->setAttributeType(QAttribute::VertexAttribute);
+ meshGeometry->addAttribute(attribute);
+ }
+
+ const auto indices = primitiveObject.value(KEY_INDICES);
+ if (!indices.isUndefined()) {
+ QString k = indices.toString();
+ const auto accessorIt = qAsConst(m_accessorDict).find(k);
+ if (Q_UNLIKELY(accessorIt == m_accessorDict.cend())) {
+ qCWarning(GLTFIOLog, "unknown index accessor: %ls on mesh %ls",
+ qUtf16PrintableImpl(k), qUtf16PrintableImpl(id));
+ } else {
+ //Get buffer handle for accessor
+ Qt3DRender::QBuffer *buffer = m_buffers.value(accessorIt->bufferViewName, nullptr);
+ if (Q_UNLIKELY(!buffer)) {
+ qCWarning(GLTFIOLog, "unknown buffer-view: %ls processing accessor: %ls",
+ qUtf16PrintableImpl(accessorIt->bufferViewName), qUtf16PrintableImpl(id));
+ continue;
+ }
+
+ QAttribute *attribute = new QAttribute(buffer,
+ accessorIt->type,
+ accessorIt->dataSize,
+ accessorIt->count,
+ accessorIt->offset,
+ accessorIt->stride);
+ attribute->setAttributeType(QAttribute::IndexAttribute);
+ meshGeometry->addAttribute(attribute);
+ }
+ } // of has indices
+
+ geometryRenderer->setGeometry(meshGeometry);
+
+ m_meshDict.insert( id, geometryRenderer);
+ } // of primitives iteration
+}
+
+void GLTFIO::processJSONImage(const QString &id, const QJsonObject &jsonObject)
+{
+ QString path = jsonObject.value(KEY_URI).toString();
+ QFileInfo info(m_basePath, path);
+ if (Q_UNLIKELY(!info.exists())) {
+ qCWarning(GLTFIOLog, "can't find image %ls from path %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(path));
+ return;
+ }
+
+ m_imagePaths[id] = info.absoluteFilePath();
+}
+
+void GLTFIO::processJSONTexture(const QString &id, const QJsonObject &jsonObject)
+{
+ int target = jsonObject.value(KEY_TARGET).toInt(GL_TEXTURE_2D);
+ //TODO: support other targets that GL_TEXTURE_2D (though the spec doesn't support anything else)
+ if (Q_UNLIKELY(target != GL_TEXTURE_2D)) {
+ qCWarning(GLTFIOLog, "unsupported texture target: %d", target);
+ return;
+ }
+
+ QTexture2D* tex = new QTexture2D;
+
+ // TODO: Choose suitable internal format - may vary on OpenGL context type
+ //int pixelFormat = jsonObj.value(KEY_FORMAT).toInt(GL_RGBA);
+ int internalFormat = jsonObject.value(KEY_INTERNAL_FORMAT).toInt(GL_RGBA);
+
+ tex->setFormat(static_cast<QAbstractTexture::TextureFormat>(internalFormat));
+
+ QString samplerId = jsonObject.value(KEY_SAMPLER).toString();
+ QString source = jsonObject.value(KEY_SOURCE).toString();
+ const auto imagIt = qAsConst(m_imagePaths).find(source);
+ if (Q_UNLIKELY(imagIt == m_imagePaths.cend())) {
+ qCWarning(GLTFIOLog, "texture %ls references missing image %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(source));
+ return;
+ }
+
+ QTextureImage *texImage = new QTextureImage(tex);
+ texImage->setSource(QUrl::fromLocalFile(imagIt.value()));
+ tex->addTextureImage(texImage);
+
+ const auto samplersDictValue = m_json.object().value(KEY_SAMPLERS).toObject().value(samplerId);
+ if (Q_UNLIKELY(samplersDictValue.isUndefined())) {
+ qCWarning(GLTFIOLog, "texture %ls references unknown sampler %ls",
+ qUtf16PrintableImpl(id), qUtf16PrintableImpl(samplerId));
+ return;
+ }
+
+ QJsonObject sampler = samplersDictValue.toObject();
+
+ tex->setWrapMode(QTextureWrapMode(static_cast<QTextureWrapMode::WrapMode>(sampler.value(KEY_WRAP_S).toInt())));
+ tex->setMinificationFilter(static_cast<QAbstractTexture::Filter>(sampler.value(KEY_MIN_FILTER).toInt()));
+ if (tex->minificationFilter() == QAbstractTexture::NearestMipMapLinear ||
+ tex->minificationFilter() == QAbstractTexture::LinearMipMapNearest ||
+ tex->minificationFilter() == QAbstractTexture::NearestMipMapNearest ||
+ tex->minificationFilter() == QAbstractTexture::LinearMipMapLinear) {
+
+ tex->setGenerateMipMaps(true);
+ }
+ tex->setMagnificationFilter(static_cast<QAbstractTexture::Filter>(sampler.value(KEY_MAG_FILTER).toInt()));
+
+ m_textures[id] = tex;
+}
+
+void GLTFIO::loadBufferData()
+{
+ for (auto &bufferData : m_bufferDatas) {
+ if (!bufferData.data) {
+ bufferData.data = new QByteArray(resolveLocalData(bufferData.path));
+ }
+ }
+}
+
+void GLTFIO::unloadBufferData()
+{
+ for (const auto &bufferData : qAsConst(m_bufferDatas)) {
+ QByteArray *data = bufferData.data;
+ delete data;
+ }
+}
+
+QByteArray GLTFIO::resolveLocalData(const QString &path) const
+{
+ QDir d(m_basePath);
+ Q_ASSERT(d.exists());
+
+ QString absPath = d.absoluteFilePath(path);
+ QFile f(absPath);
+ f.open(QIODevice::ReadOnly);
+ return f.readAll();
+}
+
+QVariant GLTFIO::parameterValueFromJSON(int type, const QJsonValue &value) const
+{
+ if (value.isBool()) {
+ if (type == GL_BOOL)
+ return QVariant(static_cast<GLboolean>(value.toBool()));
+ } else if (value.isString()) {
+ if (type == GL_SAMPLER_2D) {
+ //Textures are special because we need to do a lookup to return the
+ //QAbstractTexture
+ QString textureId = value.toString();
+ const auto it = m_textures.find(textureId);
+ if (Q_UNLIKELY(it == m_textures.end())) {
+ qCWarning(GLTFIOLog, "unknown texture %ls", qUtf16PrintableImpl(textureId));
+ return QVariant();
+ } else {
+ return QVariant::fromValue(it.value());
+ }
+ }
+ } else if (value.isDouble()) {
+ switch (type) {
+ case GL_BYTE:
+ return QVariant(static_cast<GLbyte>(value.toInt()));
+ case GL_UNSIGNED_BYTE:
+ return QVariant(static_cast<GLubyte>(value.toInt()));
+ case GL_SHORT:
+ return QVariant(static_cast<GLshort>(value.toInt()));
+ case GL_UNSIGNED_SHORT:
+ return QVariant(static_cast<GLushort>(value.toInt()));
+ case GL_INT:
+ return QVariant(static_cast<GLint>(value.toInt()));
+ case GL_UNSIGNED_INT:
+ return QVariant(static_cast<GLuint>(value.toInt()));
+ case GL_FLOAT:
+ return QVariant(static_cast<GLfloat>(value.toDouble()));
+ }
+ } else if (value.isArray()) {
+
+ const QJsonArray valueArray = value.toArray();
+
+ QVector2D vector2D;
+ QVector3D vector3D;
+ QVector4D vector4D;
+ QVector<float> dataMat2(4, 0.0f);
+ QVector<float> dataMat3(9, 0.0f);
+
+ switch (type) {
+ case GL_BYTE:
+ return QVariant(static_cast<GLbyte>(valueArray.first().toInt()));
+ case GL_UNSIGNED_BYTE:
+ return QVariant(static_cast<GLubyte>(valueArray.first().toInt()));
+ case GL_SHORT:
+ return QVariant(static_cast<GLshort>(valueArray.first().toInt()));
+ case GL_UNSIGNED_SHORT:
+ return QVariant(static_cast<GLushort>(valueArray.first().toInt()));
+ case GL_INT:
+ return QVariant(static_cast<GLint>(valueArray.first().toInt()));
+ case GL_UNSIGNED_INT:
+ return QVariant(static_cast<GLuint>(valueArray.first().toInt()));
+ case GL_FLOAT:
+ return QVariant(static_cast<GLfloat>(valueArray.first().toDouble()));
+ case GL_FLOAT_VEC2:
+ vector2D.setX(static_cast<GLfloat>(valueArray.at(0).toDouble()));
+ vector2D.setY(static_cast<GLfloat>(valueArray.at(1).toDouble()));
+ return QVariant(vector2D);
+ case GL_FLOAT_VEC3:
+ vector3D.setX(static_cast<GLfloat>(valueArray.at(0).toDouble()));
+ vector3D.setY(static_cast<GLfloat>(valueArray.at(1).toDouble()));
+ vector3D.setZ(static_cast<GLfloat>(valueArray.at(2).toDouble()));
+ return QVariant(vector3D);
+ case GL_FLOAT_VEC4:
+ vector4D.setX(static_cast<GLfloat>(valueArray.at(0).toDouble()));
+ vector4D.setY(static_cast<GLfloat>(valueArray.at(1).toDouble()));
+ vector4D.setZ(static_cast<GLfloat>(valueArray.at(2).toDouble()));
+ vector4D.setW(static_cast<GLfloat>(valueArray.at(3).toDouble()));
+ return QVariant(vector4D);
+ case GL_INT_VEC2:
+ vector2D.setX(static_cast<GLint>(valueArray.at(0).toInt()));
+ vector2D.setY(static_cast<GLint>(valueArray.at(1).toInt()));
+ return QVariant(vector2D);
+ case GL_INT_VEC3:
+ vector3D.setX(static_cast<GLint>(valueArray.at(0).toInt()));
+ vector3D.setY(static_cast<GLint>(valueArray.at(1).toInt()));
+ vector3D.setZ(static_cast<GLint>(valueArray.at(2).toInt()));
+ return QVariant(vector3D);
+ case GL_INT_VEC4:
+ vector4D.setX(static_cast<GLint>(valueArray.at(0).toInt()));
+ vector4D.setY(static_cast<GLint>(valueArray.at(1).toInt()));
+ vector4D.setZ(static_cast<GLint>(valueArray.at(2).toInt()));
+ vector4D.setW(static_cast<GLint>(valueArray.at(3).toInt()));
+ return QVariant(vector4D);
+ case GL_BOOL:
+ return QVariant(static_cast<GLboolean>(valueArray.first().toBool()));
+ case GL_BOOL_VEC2:
+ vector2D.setX(static_cast<GLboolean>(valueArray.at(0).toBool()));
+ vector2D.setY(static_cast<GLboolean>(valueArray.at(1).toBool()));
+ return QVariant(vector2D);
+ case GL_BOOL_VEC3:
+ vector3D.setX(static_cast<GLboolean>(valueArray.at(0).toBool()));
+ vector3D.setY(static_cast<GLboolean>(valueArray.at(1).toBool()));
+ vector3D.setZ(static_cast<GLboolean>(valueArray.at(2).toBool()));
+ return QVariant(vector3D);
+ case GL_BOOL_VEC4:
+ vector4D.setX(static_cast<GLboolean>(valueArray.at(0).toBool()));
+ vector4D.setY(static_cast<GLboolean>(valueArray.at(1).toBool()));
+ vector4D.setZ(static_cast<GLboolean>(valueArray.at(2).toBool()));
+ vector4D.setW(static_cast<GLboolean>(valueArray.at(3).toBool()));
+ return QVariant(vector4D);
+ case GL_FLOAT_MAT2:
+ //Matrix2x2 is in Row Major ordering (so we need to convert)
+ dataMat2[0] = static_cast<GLfloat>(valueArray.at(0).toDouble());
+ dataMat2[1] = static_cast<GLfloat>(valueArray.at(2).toDouble());
+ dataMat2[2] = static_cast<GLfloat>(valueArray.at(1).toDouble());
+ dataMat2[3] = static_cast<GLfloat>(valueArray.at(3).toDouble());
+ return QVariant::fromValue(QMatrix2x2(dataMat2.constData()));
+ case GL_FLOAT_MAT3:
+ //Matrix3x3 is in Row Major ordering (so we need to convert)
+ dataMat3[0] = static_cast<GLfloat>(valueArray.at(0).toDouble());
+ dataMat3[1] = static_cast<GLfloat>(valueArray.at(3).toDouble());
+ dataMat3[2] = static_cast<GLfloat>(valueArray.at(6).toDouble());
+ dataMat3[3] = static_cast<GLfloat>(valueArray.at(1).toDouble());
+ dataMat3[4] = static_cast<GLfloat>(valueArray.at(4).toDouble());
+ dataMat3[5] = static_cast<GLfloat>(valueArray.at(7).toDouble());
+ dataMat3[6] = static_cast<GLfloat>(valueArray.at(2).toDouble());
+ dataMat3[7] = static_cast<GLfloat>(valueArray.at(5).toDouble());
+ dataMat3[8] = static_cast<GLfloat>(valueArray.at(8).toDouble());
+ return QVariant::fromValue(QMatrix3x3(dataMat3.constData()));
+ case GL_FLOAT_MAT4:
+ //Matrix4x4 is Column Major ordering
+ return QVariant(QMatrix4x4(static_cast<GLfloat>(valueArray.at(0).toDouble()),
+ static_cast<GLfloat>(valueArray.at(1).toDouble()),
+ static_cast<GLfloat>(valueArray.at(2).toDouble()),
+ static_cast<GLfloat>(valueArray.at(3).toDouble()),
+ static_cast<GLfloat>(valueArray.at(4).toDouble()),
+ static_cast<GLfloat>(valueArray.at(5).toDouble()),
+ static_cast<GLfloat>(valueArray.at(6).toDouble()),
+ static_cast<GLfloat>(valueArray.at(7).toDouble()),
+ static_cast<GLfloat>(valueArray.at(8).toDouble()),
+ static_cast<GLfloat>(valueArray.at(9).toDouble()),
+ static_cast<GLfloat>(valueArray.at(10).toDouble()),
+ static_cast<GLfloat>(valueArray.at(11).toDouble()),
+ static_cast<GLfloat>(valueArray.at(12).toDouble()),
+ static_cast<GLfloat>(valueArray.at(13).toDouble()),
+ static_cast<GLfloat>(valueArray.at(14).toDouble()),
+ static_cast<GLfloat>(valueArray.at(15).toDouble())));
+ case GL_SAMPLER_2D:
+ return QVariant(valueArray.at(0).toString());
+ }
+ }
+ return QVariant();
+}
+
+QAttribute::VertexBaseType GLTFIO::accessorTypeFromJSON(int componentType)
+{
+ if (componentType == GL_BYTE) {
+ return QAttribute::Byte;
+ } else if (componentType == GL_UNSIGNED_BYTE) {
+ return QAttribute::UnsignedByte;
+ } else if (componentType == GL_SHORT) {
+ return QAttribute::Short;
+ } else if (componentType == GL_UNSIGNED_SHORT) {
+ return QAttribute::UnsignedShort;
+ } else if (componentType == GL_UNSIGNED_INT) {
+ return QAttribute::UnsignedInt;
+ } else if (componentType == GL_FLOAT) {
+ return QAttribute::Float;
+ }
+
+ //There shouldn't be an invalid case here
+ qCWarning(GLTFIOLog, "unsupported accessor type %d", componentType);
+ return QAttribute::Float;
+}
+
+uint GLTFIO::accessorDataSizeFromJson(const QString &type)
+{
+ QString typeName = type.toUpper();
+ if (typeName == QLatin1String("SCALAR"))
+ return 1;
+ if (typeName == QLatin1String("VEC2"))
+ return 2;
+ if (typeName == QLatin1String("VEC3"))
+ return 3;
+ if (typeName == QLatin1String("VEC4"))
+ return 4;
+ if (typeName == QLatin1String("MAT2"))
+ return 4;
+ if (typeName == QLatin1String("MAT3"))
+ return 9;
+ if (typeName == QLatin1String("MAT4"))
+ return 16;
+
+ return 0;
+}
+
+QRenderState *GLTFIO::buildStateEnable(int state)
+{
+ int type = 0;
+ //By calling buildState with QJsonValue(), a Render State with
+ //default values is created.
+
+ if (state == GL_BLEND) {
+ //It doesn't make sense to handle this state alone
+ return nullptr;
+ }
+
+ if (state == GL_CULL_FACE) {
+ return buildState(QStringLiteral("cullFace"), QJsonValue(), type);
+ }
+
+ if (state == GL_DEPTH_TEST) {
+ return buildState(QStringLiteral("depthFunc"), QJsonValue(), type);
+ }
+
+ if (state == GL_POLYGON_OFFSET_FILL) {
+ return buildState(QStringLiteral("polygonOffset"), QJsonValue(), type);
+ }
+
+ if (state == GL_SAMPLE_ALPHA_TO_COVERAGE) {
+ return new QAlphaCoverage();
+ }
+
+ if (state == GL_SCISSOR_TEST) {
+ return buildState(QStringLiteral("scissor"), QJsonValue(), type);
+ }
+
+ qCWarning(GLTFIOLog, "unsupported render state: %d", state);
+
+ return nullptr;
+}
+
+QRenderState* GLTFIO::buildState(const QString& functionName, const QJsonValue &value, int &type)
+{
+ type = -1;
+ QJsonArray values = value.toArray();
+
+ if (functionName == QLatin1String("blendColor")) {
+ type = GL_BLEND;
+ //TODO: support render state blendColor
+ qCWarning(GLTFIOLog, "unsupported render state: %ls", qUtf16PrintableImpl(functionName));
+ return nullptr;
+ }
+
+ if (functionName == QLatin1String("blendEquationSeparate")) {
+ type = GL_BLEND;
+ //TODO: support settings blendEquation alpha
+ QBlendEquation *blendEquation = new QBlendEquation;
+ blendEquation->setBlendFunction((QBlendEquation::BlendFunction)values.at(0).toInt(GL_FUNC_ADD));
+ return blendEquation;
+ }
+
+ if (functionName == QLatin1String("blendFuncSeparate")) {
+ type = GL_BLEND;
+ QBlendEquationArguments *blendArgs = new QBlendEquationArguments;
+ blendArgs->setSourceRgb((QBlendEquationArguments::Blending)values.at(0).toInt(GL_ONE));
+ blendArgs->setSourceAlpha((QBlendEquationArguments::Blending)values.at(1).toInt(GL_ONE));
+ blendArgs->setDestinationRgb((QBlendEquationArguments::Blending)values.at(2).toInt(GL_ZERO));
+ blendArgs->setDestinationAlpha((QBlendEquationArguments::Blending)values.at(3).toInt(GL_ZERO));
+ return blendArgs;
+ }
+
+ if (functionName == QLatin1String("colorMask")) {
+ QColorMask *colorMask = new QColorMask;
+ colorMask->setRedMasked(values.at(0).toBool(true));
+ colorMask->setGreenMasked(values.at(1).toBool(true));
+ colorMask->setBlueMasked(values.at(2).toBool(true));
+ colorMask->setAlphaMasked(values.at(3).toBool(true));
+ return colorMask;
+ }
+
+ if (functionName == QLatin1String("cullFace")) {
+ type = GL_CULL_FACE;
+ QCullFace *cullFace = new QCullFace;
+ cullFace->setMode((QCullFace::CullingMode)values.at(0).toInt(GL_BACK));
+ return cullFace;
+ }
+
+ if (functionName == QLatin1String("depthFunc")) {
+ type = GL_DEPTH_TEST;
+ QDepthTest *depthTest = new QDepthTest;
+ depthTest->setDepthFunction((QDepthTest::DepthFunction)values.at(0).toInt(GL_LESS));
+ return depthTest;
+ }
+
+ if (functionName == QLatin1String("depthMask")) {
+ if (!values.at(0).toBool(true)) {
+ QNoDepthMask *depthMask = new QNoDepthMask;
+ return depthMask;
+ }
+ return nullptr;
+ }
+
+ if (functionName == QLatin1String("depthRange")) {
+ //TODO: support render state depthRange
+ qCWarning(GLTFIOLog, "unsupported render state: %ls", qUtf16PrintableImpl(functionName));
+ return nullptr;
+ }
+
+ if (functionName == QLatin1String("frontFace")) {
+ QFrontFace *frontFace = new QFrontFace;
+ frontFace->setDirection((QFrontFace::WindingDirection)values.at(0).toInt(GL_CCW));
+ return frontFace;
+ }
+
+ if (functionName == QLatin1String("lineWidth")) {
+ //TODO: support render state lineWidth
+ qCWarning(GLTFIOLog, "unsupported render state: %ls", qUtf16PrintableImpl(functionName));
+ return nullptr;
+ }
+
+ if (functionName == QLatin1String("polygonOffset")) {
+ type = GL_POLYGON_OFFSET_FILL;
+ QPolygonOffset *polygonOffset = new QPolygonOffset;
+ polygonOffset->setScaleFactor((float)values.at(0).toDouble(0.0f));
+ polygonOffset->setDepthSteps((float)values.at(1).toDouble(0.0f));
+ return polygonOffset;
+ }
+
+ if (functionName == QLatin1String("scissor")) {
+ type = GL_SCISSOR_TEST;
+ QScissorTest *scissorTest = new QScissorTest;
+ scissorTest->setLeft(values.at(0).toDouble(0.0f));
+ scissorTest->setBottom(values.at(1).toDouble(0.0f));
+ scissorTest->setWidth(values.at(2).toDouble(0.0f));
+ scissorTest->setHeight(values.at(3).toDouble(0.0f));
+ return scissorTest;
+ }
+
+ qCWarning(GLTFIOLog, "unsupported render state: %ls", qUtf16PrintableImpl(functionName));
+ return nullptr;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#include "moc_gltfio.cpp"
diff --git a/src/plugins/sceneparsers/gltf/gltfio.h b/src/plugins/sceneparsers/gltf/gltfio.h
new file mode 100644
index 000000000..15527c268
--- /dev/null
+++ b/src/plugins/sceneparsers/gltf/gltfio.h
@@ -0,0 +1,211 @@
+/****************************************************************************
+**
+** Copyright (C) 2014-2016 Klarälvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GLTFIO_H
+#define GLTFIO_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QJsonDocument>
+#include <QtCore/QMultiHash>
+
+#include <Qt3DRender/qattribute.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/private/qsceneiohandler_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QByteArray;
+
+namespace Qt3DCore {
+class QEntity;
+}
+
+namespace Qt3DRender {
+
+class QCamera;
+class QCameraLens;
+class QMaterial;
+class QShaderProgram;
+class QEffect;
+class QAbstractTexture;
+class QRenderState;
+class QTechnique;
+class QParameter;
+class QGeometryRenderer;
+
+Q_DECLARE_LOGGING_CATEGORY(GLTFIOLog)
+
+class GLTFIO : public QSceneIOHandler
+{
+ Q_OBJECT
+
+public:
+ GLTFIO();
+ ~GLTFIO();
+
+ void setBasePath(const QString& path);
+ bool setJSON( const QJsonDocument &json );
+
+ // SceneParserInterface interface
+ void setSource(const QUrl &source) Q_DECL_FINAL;
+ bool isFileTypeSupported(const QUrl &source) const Q_DECL_FINAL;
+ Qt3DCore::QEntity *node(const QString &id) Q_DECL_FINAL;
+ Qt3DCore::QEntity *scene(const QString &id = QString()) Q_DECL_FINAL;
+
+private:
+ class BufferData
+ {
+ public:
+ BufferData();
+ explicit BufferData(const QJsonObject &json);
+
+ quint64 length;
+ QString path;
+ QByteArray *data;
+ // type if ever useful
+ };
+
+ class ParameterData
+ {
+ public:
+ ParameterData();
+ explicit ParameterData(const QJsonObject &json);
+
+ QString semantic;
+ int type;
+ };
+
+ class AccessorData
+ {
+ public:
+ AccessorData();
+ explicit AccessorData(const QJsonObject& json);
+
+ QString bufferViewName;
+ QAttribute::VertexBaseType type;
+ uint dataSize;
+ int count;
+ int offset;
+ int stride;
+ };
+
+ static bool isGLTFPath(const QString &path);
+ static void renameFromJson(const QJsonObject& json, QObject * const object );
+ static bool hasStandardUniformNameFromSemantic(const QString &semantic);
+ static QString standardAttributeNameFromSemantic(const QString &semantic);
+ static QParameter *parameterFromTechnique(QTechnique *technique, const QString &parameterName);
+
+ Qt3DCore::QEntity *defaultScene();
+ QMaterial *material(const QString &id);
+ QCameraLens *camera(const QString &id) const;
+
+ void parse();
+ void cleanup();
+
+ void processJSONBuffer(const QString &id, const QJsonObject &json);
+ void processJSONBufferView(const QString &id, const QJsonObject &json);
+ void processJSONShader(const QString &id, const QJsonObject &jsonObject);
+ void processJSONProgram(const QString &id, const QJsonObject &jsonObject);
+ void processJSONTechnique(const QString &id, const QJsonObject &jsonObject);
+ void processJSONAccessor(const QString &id, const QJsonObject &json);
+ void processJSONMesh(const QString &id, const QJsonObject &json);
+ void processJSONImage(const QString &id, const QJsonObject &jsonObject);
+ void processJSONTexture(const QString &id, const QJsonObject &jsonObject);
+
+ void loadBufferData();
+ void unloadBufferData();
+
+ QByteArray resolveLocalData(const QString &path) const;
+
+ QVariant parameterValueFromJSON(int type, const QJsonValue &value) const;
+ static QAttribute::VertexBaseType accessorTypeFromJSON(int componentType);
+ static uint accessorDataSizeFromJson(const QString &type);
+
+ static QRenderState *buildStateEnable(int state);
+ static QRenderState *buildState(const QString& functionName, const QJsonValue &value, int &type);
+
+ QMaterial *materialWithCustomShader(const QString &id, const QJsonObject &jsonObj);
+ QMaterial *commonMaterial(const QJsonObject &jsonObj);
+
+ QJsonDocument m_json;
+ QString m_basePath;
+ bool m_parseDone;
+ QString m_defaultScene;
+
+ // multi-hash because our QMeshData corresponds to a single primitive
+ // in glTf.
+ QMultiHash<QString, QGeometryRenderer*> m_meshDict;
+
+ // GLTF assigns materials at the mesh level, but we do them as siblings,
+ // so record the association here for when we instantiate meshes
+ QHash<QGeometryRenderer*, QString> m_meshMaterialDict;
+
+ QHash<QString, AccessorData> m_accessorDict;
+
+ QHash<QString, QMaterial*> m_materialCache;
+
+ QHash<QString, BufferData> m_bufferDatas;
+ QHash<QString, Qt3DRender::QBuffer*> m_buffers;
+
+ QHash<QString, QString> m_shaderPaths;
+ QHash<QString, QShaderProgram*> m_programs;
+
+ QHash<QString, QTechnique *> m_techniques;
+ QHash<QParameter*, ParameterData> m_parameterDataDict;
+
+ QHash<QString, QAbstractTexture*> m_textures;
+ QHash<QString, QString> m_imagePaths;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // GLTFIO_H
diff --git a/src/plugins/sceneparsers/gltf/gltfparser.cpp b/src/plugins/sceneparsers/gltf/gltfparser.cpp
deleted file mode 100644
index 6bfca2b55..000000000
--- a/src/plugins/sceneparsers/gltf/gltfparser.cpp
+++ /dev/null
@@ -1,1562 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "gltfparser.h"
-
-#include <QtCore/QDir>
-#include <QtCore/QFileInfo>
-#include <QtCore/QJsonArray>
-#include <QtCore/QJsonObject>
-
-#include <QtGui/QVector2D>
-
-#include <Qt3DCore/QCameraLens>
-#include <Qt3DCore/QEntity>
-#include <Qt3DCore/QTransform>
-
-#include <Qt3DRender/private/qurlhelper_p.h>
-
-#include <Qt3DRender/QAlphaCoverage>
-#include <Qt3DRender/QBlendEquation>
-#include <Qt3DRender/QBlendStateSeparate>
-#include <Qt3DRender/QColorMask>
-#include <Qt3DRender/QCullFace>
-#include <Qt3DRender/QDepthMask>
-#include <Qt3DRender/QDepthTest>
-#include <Qt3DRender/QEffect>
-#include <Qt3DRender/QFrontFace>
-#include <Qt3DRender/QGeometry>
-#include <Qt3DRender/QGeometryRenderer>
-#include <Qt3DRender/QMaterial>
-#include <Qt3DRender/QGraphicsApiFilter>
-#include <Qt3DRender/QParameter>
-#include <Qt3DRender/QParameterMapping>
-#include <Qt3DRender/QPolygonOffset>
-#include <Qt3DRender/QRenderState>
-#include <Qt3DRender/QScissorTest>
-#include <Qt3DRender/QShaderProgram>
-#include <Qt3DRender/QTechnique>
-#include <Qt3DRender/QTexture>
-
-#include <Qt3DRender/QPhongMaterial>
-#include <Qt3DRender/QDiffuseMapMaterial>
-#include <Qt3DRender/QDiffuseSpecularMapMaterial>
-#include <Qt3DRender/QNormalDiffuseMapMaterial>
-#include <Qt3DRender/QNormalDiffuseSpecularMapMaterial>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-
-Q_LOGGING_CATEGORY(GLTFParserLog, "Qt3D.GLTFParser")
-
-namespace {
-
-const QString KEY_CAMERA = QStringLiteral("camera");
-const QString KEY_CAMERAS = QStringLiteral("cameras");
-const QString KEY_SCENES = QStringLiteral("scenes");
-const QString KEY_NODES = QStringLiteral("nodes");
-const QString KEY_MESHES = QStringLiteral("meshes");
-const QString KEY_CHILDREN = QStringLiteral("children");
-const QString KEY_MATRIX = QStringLiteral("matrix");
-const QString KEY_ROTATION = QStringLiteral("rotation");
-const QString KEY_SCALE = QStringLiteral("scale");
-const QString KEY_TRANSLATION = QStringLiteral("translation");
-const QString KEY_TYPE = QStringLiteral("type");
-const QString KEY_PERSPECTIVE =QStringLiteral("perspective");
-const QString KEY_NAME = QStringLiteral("name");
-const QString KEY_COUNT = QStringLiteral("count");
-const QString KEY_YFOV = QStringLiteral("yfov");
-const QString KEY_ZNEAR = QStringLiteral("znear");
-const QString KEY_ZFAR = QStringLiteral("zfar");
-const QString KEY_MATERIALS = QStringLiteral("materials");
-const QString KEY_EXTENSIONS = QStringLiteral("extensions");
-const QString KEY_COMMON_MAT = QStringLiteral("KHR_materials_common");
-const QString KEY_TECHNIQUE = QStringLiteral("technique");
-const QString KEY_VALUES = QStringLiteral("values");
-const QString KEY_BUFFERS = QStringLiteral("buffers");
-const QString KEY_SHADERS = QStringLiteral("shaders");
-const QString KEY_PROGRAMS = QStringLiteral("programs");
-const QString KEY_PROGRAM = QStringLiteral("program");
-const QString KEY_TECHNIQUES = QStringLiteral("techniques");
-const QString KEY_ACCESSORS = QStringLiteral("accessors");
-const QString KEY_IMAGES = QStringLiteral("images");
-const QString KEY_TEXTURES = QStringLiteral("textures");
-const QString KEY_SCENE = QStringLiteral("scene");
-const QString KEY_BUFFER = QStringLiteral("buffer");
-const QString KEY_TARGET = QStringLiteral("target");
-const QString KEY_BYTE_OFFSET = QStringLiteral("byteOffset");
-const QString KEY_BYTE_LENGTH = QStringLiteral("byteLength");
-const QString KEY_BYTE_STRIDE = QStringLiteral("byteStride");
-const QString KEY_PRIMITIVES = QStringLiteral("primitives");
-const QString KEY_MODE = QStringLiteral("mode");
-const QString KEY_MATERIAL = QStringLiteral("material");
-const QString KEY_ATTRIBUTES = QStringLiteral("attributes");
-const QString KEY_INDICES = QStringLiteral("indices");
-const QString KEY_URI = QStringLiteral("uri");
-const QString KEY_FORMAT = QStringLiteral("format");
-const QString KEY_PASSES = QStringLiteral("passes");
-const QString KEY_SOURCE = QStringLiteral("source");
-const QString KEY_SAMPLER = QStringLiteral("sampler");
-const QString KEY_SAMPLERS = QStringLiteral("samplers");
-const QString KEY_SEMANTIC = QStringLiteral("semantic");
-const QString KEY_STATES = QStringLiteral("states");
-const QString KEY_UNIFORMS = QStringLiteral("uniforms");
-const QString KEY_PARAMETERS = QStringLiteral("parameters");
-const QString KEY_WRAP_S = QStringLiteral("wrapS");
-const QString KEY_MIN_FILTER = QStringLiteral("minFilter");
-const QString KEY_MAG_FILTER = QStringLiteral("magFilter");
-
-const QString KEY_INSTANCE_TECHNIQUE = QStringLiteral("instanceTechnique");
-const QString KEY_INSTANCE_PROGRAM = QStringLiteral("instanceProgram");
-const QString KEY_BUFFER_VIEWS = QStringLiteral("bufferViews");
-const QString KEY_BUFFER_VIEW = QStringLiteral("bufferView");
-const QString KEY_VERTEX_SHADER = QStringLiteral("vertexShader");
-const QString KEY_FRAGMENT_SHADER = QStringLiteral("fragmentShader");
-const QString KEY_INTERNAL_FORMAT = QStringLiteral("internalFormat");
-const QString KEY_COMPONENT_TYPE = QStringLiteral("componentType");
-const QString KEY_ASPECT_RATIO = QStringLiteral("aspect_ratio");
-const QString KEY_VALUE = QStringLiteral("value");
-const QString KEY_ENABLE = QStringLiteral("enable");
-const QString KEY_FUNCTIONS = QStringLiteral("functions");
-const QString KEY_TECHNIQUE_CORE = QStringLiteral("techniqueCore");
-const QString KEY_TECHNIQUE_GL2 = QStringLiteral("techniqueGL2");
-
-} // of anonymous namespace
-
-GLTFParser::GLTFParser() : QAbstractSceneParser(),
- m_parseDone(false)
-{
-}
-
-GLTFParser::~GLTFParser()
-{
-
-}
-
-void GLTFParser::setBasePath(const QString& path)
-{
- m_basePath = path;
-}
-
-bool GLTFParser::setJSON(const QJsonDocument &json )
-{
- if ( !json.isObject() ) {
- return false;
- }
-
- m_json = json;
- m_parseDone = false;
-
- cleanup();
-
- return true;
-}
-
-/*!
- * Sets the \a path used by the parser to load the scene file.
- * If the file is valid, parsing is automatically triggered.
- */
-void GLTFParser::setSource(const QUrl &source)
-{
- const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
- QFileInfo finfo(path);
- if (!finfo.exists()) {
- qCWarning(GLTFParserLog) << "missing file:" << path;
- return;
- }
- QFile f(path);
- f.open(QIODevice::ReadOnly);
-
- QByteArray jsonData = f.readAll();
- QJsonDocument sceneDocument = QJsonDocument::fromBinaryData(jsonData);
- if (sceneDocument.isNull())
- sceneDocument = QJsonDocument::fromJson(jsonData);
-
- if (!setJSON(sceneDocument)) {
- qCWarning(GLTFParserLog) << "not a JSON document";
- return;
- }
-
- setBasePath(finfo.dir().absolutePath());
-}
-
-/*!
- * Returns true if the extension of \a path is supported by the
- * GLTF parser.
- */
-bool GLTFParser::isExtensionSupported(const QUrl &source) const
-{
- const QString path = QUrlHelper::urlToLocalFileOrQrc(source);
- return GLTFParser::isGLTFPath(path);
-}
-
-Qt3DCore::QEntity* GLTFParser::node(const QString &id)
-{
- QJsonObject nodes = m_json.object().value(KEY_NODES).toObject();
- if (!nodes.contains(id)) {
- qCWarning(GLTFParserLog) << "unknown node" << id << "in GLTF file" << m_basePath;
- return NULL;
- }
-
- QJsonObject jsonObj = nodes.value(id).toObject();
- QEntity* result = Q_NULLPTR;
-
- // Qt3D has a limitation that a QEntity can only have 1 mesh and 1 material component
- // So if the node has only 1 mesh, we only create 1 QEntity
- // Otherwise if there are n meshes, there is 1 QEntity, with n children for each mesh/material combo
- if (jsonObj.contains(KEY_MESHES)) {
- QVector<QEntity *> entities;
-
- Q_FOREACH (QJsonValue mesh, jsonObj.value(KEY_MESHES).toArray()) {
- if (!m_meshDict.contains(mesh.toString())) {
- qCWarning(GLTFParserLog) << "node" << id << "references unknown mesh" << mesh.toString();
- continue;
- }
-
- Q_FOREACH (QGeometryRenderer *geometryRenderer, m_meshDict.values(mesh.toString())) {
- QEntity *entity = new QEntity;
- entity->addComponent(geometryRenderer);
- QMaterial *mat = material(m_meshMaterialDict[geometryRenderer]);
- if (mat)
- entity->addComponent(mat);
- entities.append(entity);
- }
-
- }
-
- if (entities.count() == 1) {
- result = entities.first();
- } else {
- result = new QEntity;
- Q_FOREACH (QEntity *entity, entities) {
- entity->setParent(result);
- }
- }
- }
-
- //If the entity contains no meshes, results will still be null here
- if (result == Q_NULLPTR)
- result = new QEntity;
-
- if ( jsonObj.contains(KEY_CHILDREN) ) {
- Q_FOREACH (QJsonValue c, jsonObj.value(KEY_CHILDREN).toArray()) {
- QEntity* child = node(c.toString());
- if (!child)
- continue;
- child->setParent(result);
- }
- }
-
- renameFromJson(jsonObj, result);
-
-
- // Node Transforms
- Qt3DCore::QTransform *trans = Q_NULLPTR;
- if ( jsonObj.contains(KEY_MATRIX) ) {
- QMatrix4x4 m(Qt::Uninitialized);
-
- QJsonArray matrixValues = jsonObj.value(KEY_MATRIX).toArray();
- for (int i=0; i<16; ++i) {
- double v = matrixValues.at( i ).toDouble();
- m(i % 4, i >> 2) = v;
- }
-
- // ADD MATRIX TRANSFORM COMPONENT TO ENTITY
- if (trans == Q_NULLPTR)
- trans = new Qt3DCore::QTransform;
- trans->setMatrix(m);
- }
-
- // Rotation quaternion
- if (jsonObj.contains(KEY_ROTATION)) {
- if (trans == Q_NULLPTR)
- trans = new Qt3DCore::QTransform;
-
- QJsonArray quaternionValues = jsonObj.value(KEY_ROTATION).toArray();
- QQuaternion quaternion(quaternionValues[0].toDouble(),
- quaternionValues[1].toDouble(),
- quaternionValues[2].toDouble(),
- quaternionValues[3].toDouble());
- trans->setRotation(quaternion);
- }
-
- // Translation
- if (jsonObj.contains(KEY_TRANSLATION)) {
- if (trans == Q_NULLPTR)
- trans = new Qt3DCore::QTransform;
-
- QJsonArray translationValues = jsonObj.value(KEY_TRANSLATION).toArray();
- trans->setTranslation(QVector3D(translationValues[0].toDouble(),
- translationValues[1].toDouble(),
- translationValues[2].toDouble()));
- }
-
- // Scale
- if (jsonObj.contains(KEY_SCALE)) {
- if (trans == Q_NULLPTR)
- trans = new Qt3DCore::QTransform;
-
- QJsonArray scaleValues = jsonObj.value(KEY_SCALE).toArray();
- trans->setScale3D(QVector3D(scaleValues[0].toDouble(),
- scaleValues[1].toDouble(),
- scaleValues[2].toDouble()));
- }
-
- // Add the Transform component
- if (trans != Q_NULLPTR)
- result->addComponent(trans);
-
- if ( jsonObj.contains(KEY_CAMERA) ) {
- QCameraLens* cam = camera( jsonObj.value(KEY_CAMERA).toString() );
- if (!cam) {
- qCWarning(GLTFParserLog) << "failed to build camera:" << jsonObj.value(KEY_CAMERA)
- << "on node" << id;
- } else {
- result->addComponent(cam);
- }
- } // of have camera attribute
-
- return result;
-}
-
-Qt3DCore::QEntity* GLTFParser::scene(const QString &id)
-{
- parse();
-
- QJsonObject scenes = m_json.object().value(KEY_SCENES).toObject();
- if (!scenes.contains(id)) {
- if (!id.isNull())
- qCWarning(GLTFParserLog) << "GLTF: no such scene" << id << "in file" << m_basePath;
- return defaultScene();
- }
-
- QJsonObject sceneObj = scenes.value(id).toObject();
- QEntity* sceneEntity = new QEntity;
- Q_FOREACH (QJsonValue nnv, sceneObj.value(KEY_NODES).toArray()) {
- QString nodeName = nnv.toString();
- QEntity* child = node(nodeName);
- if (!child)
- continue;
- child->setParent(sceneEntity);
- }
-
- return sceneEntity;
-}
-
-GLTFParser::BufferData::BufferData()
- : length(0)
- , data(Q_NULLPTR)
-{
-}
-
-GLTFParser::BufferData::BufferData(QJsonObject json)
-{
- path = json.value(KEY_URI).toString();
- length = json.value(KEY_BYTE_LENGTH).toInt();
- data = Q_NULLPTR;
-}
-
-GLTFParser::ParameterData::ParameterData() :
- type(0)
-{
-
-}
-
-GLTFParser::ParameterData::ParameterData(QJsonObject json)
-{
- type = json.value(KEY_TYPE).toInt();
- semantic = json.value(KEY_SEMANTIC).toString();
-}
-
-GLTFParser::AccessorData::AccessorData()
- : type(QAttribute::Float)
- , dataSize(0)
- , count(0)
- , offset(0)
- , stride(0)
-{
-
-}
-
-GLTFParser::AccessorData::AccessorData(const QJsonObject &json)
-{
- bufferViewName = json.value(KEY_BUFFER_VIEW).toString();
- offset = 0;
- stride = 0;
- int componentType = json.value(KEY_COMPONENT_TYPE).toInt();
- type = accessorTypeFromJSON(componentType);
- count = json.value(KEY_COUNT).toInt();
- dataSize = accessorDataSizeFromJson(json.value(KEY_TYPE).toString());
-
- if ( json.contains(KEY_BYTE_OFFSET))
- offset = json.value(KEY_BYTE_OFFSET).toInt();
- if ( json.contains(KEY_BYTE_STRIDE))
- stride = json.value(KEY_BYTE_STRIDE).toInt();
-}
-
-bool GLTFParser::isGLTFPath(const QString& path)
-{
- QFileInfo finfo(path);
- if (!finfo.exists())
- return false;
-
- // might need to detect other things in the future, but would
- // prefer to avoid doing a full parse.
- QString suffix = finfo.suffix().toLower();
- return (suffix == QStringLiteral("json") || suffix == QStringLiteral("gltf") || suffix == QStringLiteral("qgltf"));
-}
-
-void GLTFParser::renameFromJson(const QJsonObject &json, QObject * const object)
-{
- if ( json.contains(KEY_NAME) )
- object->setObjectName( json.value(KEY_NAME).toString() );
-}
-
-QString GLTFParser::standardUniformNamefromSemantic(const QString &semantic)
-{
- //Standard Uniforms
- //if (semantic == QStringLiteral("LOCAL"));
- if (semantic == QStringLiteral("MODEL"))
- return QStringLiteral("modelMatrix");
- if (semantic == QStringLiteral("VIEW"))
- return QStringLiteral("viewMatrix");
- if (semantic == QStringLiteral("PROJECTION"))
- return QStringLiteral("projectionMatrix");
- if (semantic == QStringLiteral("MODELVIEW"))
- return QStringLiteral("modelView");
- if (semantic == QStringLiteral("MODELVIEWPROJECTION"))
- return QStringLiteral("modelViewProjection");
- if (semantic == QStringLiteral("MODELINVERSE"))
- return QStringLiteral("inverseModelMatrix");
- if (semantic == QStringLiteral("VIEWINVERSE"))
- return QStringLiteral("inverViewMatrix");
- if (semantic == QStringLiteral("PROJECTIONINVERSE"))
- return QStringLiteral("inverseProjectionMatrix");
- if (semantic == QStringLiteral("MODELVIEWPROJECTIONINVERSE"))
- return QStringLiteral("inverseModelViewProjection");
- if (semantic == QStringLiteral("MODELINVERSETRANSPOSE"))
- return QStringLiteral("modelNormalMatrix");
- if (semantic == QStringLiteral("MODELVIEWINVERSETRANSPOSE"))
- return QStringLiteral("modelViewNormal");
- if (semantic == QStringLiteral("VIEWPORT"))
- return QStringLiteral("viewportMatrix");
-
- return QString();
-}
-
-QString GLTFParser::standardAttributeNameFromSemantic(const QString &semantic)
-{
- //Standard Attributes
- if (semantic.startsWith(QStringLiteral("POSITION")))
- return QAttribute::defaultPositionAttributeName();
- if (semantic.startsWith(QStringLiteral("NORMAL")))
- return QAttribute::defaultNormalAttributeName();
- if (semantic.startsWith(QStringLiteral("TEXCOORD")))
- return QAttribute::defaultTextureCoordinateAttributeName();
- if (semantic.startsWith(QStringLiteral("COLOR")))
- return QAttribute::defaultColorAttributeName();
- if (semantic.startsWith(QStringLiteral("TANGENT")))
- return QAttribute::defaultTangentAttributeName();
-
-// if (semantic.startsWith(QStringLiteral("JOINT")));
-// if (semantic.startsWith(QStringLiteral("JOINTMATRIX")));
-// if (semantic.startsWith(QStringLiteral("WEIGHT")));
-
- return QString();
-}
-
-QParameter *GLTFParser::parameterFromTechnique(QTechnique *technique, const QString &parameterName)
-{
- Q_FOREACH (QParameter *parameter, technique->parameters()) {
- if (parameter->name() == parameterName) {
- return parameter;
- }
- }
-
- return Q_NULLPTR;
-}
-
-Qt3DCore::QEntity* GLTFParser::defaultScene()
-{
- if (m_defaultScene.isEmpty()) {
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "no default scene";
- return NULL;
- }
-
- return scene(m_defaultScene);
-}
-
-QMaterial *GLTFParser::materialWithCustomShader(const QString &id, const QJsonObject &jsonObj)
-{
- //Default ES2 Technique
- QString techniqueName = jsonObj.value(KEY_TECHNIQUE).toString();
- if (!m_techniques.contains(techniqueName)) {
- qCWarning(GLTFParserLog) << "unknown technique" << techniqueName
- << "for material" << id << "in GLTF file" << m_basePath;
- return NULL;
- }
- QTechnique *technique = m_techniques.value(techniqueName);
- technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- technique->graphicsApiFilter()->setMajorVersion(2);
- technique->graphicsApiFilter()->setMinorVersion(0);
- technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
-
- //Optional Core technique
- QTechnique *coreTechnique = Q_NULLPTR;
- QTechnique *gl2Technique = Q_NULLPTR;
- QString coreTechniqueName = jsonObj.value(KEY_TECHNIQUE_CORE).toString();
- if (!coreTechniqueName.isNull()) {
- if (!m_techniques.contains(coreTechniqueName)) {
- qCWarning(GLTFParserLog) << "unknown technique" << coreTechniqueName
- << "for material" << id << "in GLTF file" << m_basePath;
- } else {
- coreTechnique = m_techniques.value(coreTechniqueName);
- coreTechnique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- coreTechnique->graphicsApiFilter()->setMajorVersion(3);
- coreTechnique->graphicsApiFilter()->setMinorVersion(1);
- coreTechnique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
- }
- }
- //Optional GL2 technique
- QString gl2TechniqueName = jsonObj.value(KEY_TECHNIQUE_GL2).toString();
- if (!gl2TechniqueName.isNull()) {
- if (!m_techniques.contains(gl2TechniqueName)) {
- qCWarning(GLTFParserLog) << "unknown technique" << gl2TechniqueName
- << "for material" << id << "in GLTF file" << m_basePath;
- } else {
- gl2Technique = m_techniques.value(gl2TechniqueName);
- gl2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- gl2Technique->graphicsApiFilter()->setMajorVersion(2);
- gl2Technique->graphicsApiFilter()->setMinorVersion(0);
- gl2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
- }
- }
-
-
- // glTF doesn't deal in effects, but we need a trivial one to wrap
- // up our techniques
- // However we need to create a unique effect for each material instead
- // of caching because QMaterial does not keep up with effects
- // its not the parent of.
- QEffect* effect = new QEffect;
- effect->setObjectName(techniqueName);
- effect->addTechnique(technique);
- if (coreTechnique != Q_NULLPTR)
- effect->addTechnique(coreTechnique);
- if (gl2Technique != Q_NULLPTR)
- effect->addTechnique(gl2Technique);
-
- QMaterial* mat = new QMaterial;
- mat->setEffect(effect);
-
- renameFromJson(jsonObj, mat);
-
- QJsonObject values = jsonObj.value(KEY_VALUES).toObject();
- Q_FOREACH (QString vName, values.keys()) {
- QParameter *param = parameterFromTechnique(technique, vName);
-
- if (param == Q_NULLPTR && coreTechnique != Q_NULLPTR) {
- param = parameterFromTechnique(coreTechnique, vName);
- }
-
- if (param == Q_NULLPTR && gl2Technique != Q_NULLPTR) {
- param = parameterFromTechnique(gl2Technique, vName);
- }
-
- if (param == Q_NULLPTR) {
- qCWarning(GLTFParserLog) << "unknown parameter:" << vName << "in technique" << techniqueName
- << "processing material" << id;
- continue;
- }
-
- ParameterData paramData = m_parameterDataDict.value(param);
- QVariant var = parameterValueFromJSON(paramData.type, values.value(vName));
-
- mat->addParameter(new QParameter(param->name(), var));
- } // of material technique-instance values iteration
-
- return mat;
-}
-
-static inline QVariant vec4ToRgb(const QVariant &vec4Var)
-{
- const QVector4D v = vec4Var.value<QVector4D>();
- return QVariant(QColor::fromRgbF(v.x(), v.y(), v.z()));
-}
-
-QMaterial *GLTFParser::commonMaterial(const QJsonObject &jsonObj)
-{
- QVariantHash params;
- bool hasDiffuseMap = false;
- bool hasSpecularMap = false;
- bool hasNormalMap = false;
-
- QJsonObject values = jsonObj.value(KEY_VALUES).toObject();
- Q_FOREACH (const QString &vName, values.keys()) {
- const QJsonValue val = values.value(vName);
- QVariant var;
- QString propertyName = vName;
- if (vName == QStringLiteral("ambient") && val.isArray()) {
- var = vec4ToRgb(parameterValueFromJSON(GL_FLOAT_VEC4, val));
- } else if (vName == QStringLiteral("diffuse")) {
- if (val.isString()) {
- var = parameterValueFromJSON(GL_SAMPLER_2D, val);
- hasDiffuseMap = true;
- } else if (val.isArray()) {
- var = vec4ToRgb(parameterValueFromJSON(GL_FLOAT_VEC4, val));
- }
- } else if (vName == QStringLiteral("specular")) {
- if (val.isString()) {
- var = parameterValueFromJSON(GL_SAMPLER_2D, val);
- hasSpecularMap = true;
- } else if (val.isArray()) {
- var = vec4ToRgb(parameterValueFromJSON(GL_FLOAT_VEC4, val));
- }
- } else if (vName == QStringLiteral("shininess") && val.isDouble()) {
- var = parameterValueFromJSON(GL_FLOAT, val);
- } else if (vName == QStringLiteral("normalmap") && val.isString()) {
- var = parameterValueFromJSON(GL_SAMPLER_2D, val);
- propertyName = QStringLiteral("normal");
- hasNormalMap = true;
- } else if (vName == QStringLiteral("transparency")) {
- qCWarning(GLTFParserLog) << "Semi-transparent common materials are not currently supported, ignoring alpha";
- }
- if (var.isValid())
- params[propertyName] = var;
- }
-
- QMaterial *mat = Q_NULLPTR;
- if (hasNormalMap) {
- if (hasSpecularMap) {
- mat = new QNormalDiffuseSpecularMapMaterial;
- } else {
- if (hasDiffuseMap)
- mat = new QNormalDiffuseMapMaterial;
- else
- qCWarning(GLTFParserLog) << "Common material with normal and specular maps needs a diffuse map as well";
- }
- } else {
- if (hasSpecularMap) {
- if (hasDiffuseMap)
- mat = new QDiffuseSpecularMapMaterial;
- else
- qCWarning(GLTFParserLog) << "Common material with specular map needs a diffuse map as well";
- } else if (hasDiffuseMap) {
- mat = new QDiffuseMapMaterial;
- } else {
- mat = new QPhongMaterial;
- }
- }
-
- if (mat) {
- for (QVariantHash::const_iterator it = params.constBegin(), itEnd = params.constEnd(); it != itEnd; ++it)
- mat->setProperty(it.key().toUtf8(), it.value());
- } else {
- qCWarning(GLTFParserLog) << "Could not find a suitable built-in material for KHR_materials_common";
- }
-
- return mat;
-}
-
-QMaterial* GLTFParser::material(const QString &id)
-{
- if (m_materialCache.contains(id))
- return m_materialCache.value(id);
-
- QJsonObject mats = m_json.object().value(KEY_MATERIALS).toObject();
- if (!mats.contains(id)) {
- qCWarning(GLTFParserLog) << "unknown material" << id << "in GLTF file" << m_basePath;
- return NULL;
- }
-
- QJsonObject jsonObj = mats.value(id).toObject();
-
- QMaterial *mat = Q_NULLPTR;
-
- // Prefer common materials over custom shaders.
- if (jsonObj.contains(KEY_EXTENSIONS)) {
- QJsonObject extensions = jsonObj.value(KEY_EXTENSIONS).toObject();
- if (extensions.contains(KEY_COMMON_MAT))
- mat = commonMaterial(extensions.value(KEY_COMMON_MAT).toObject());
- }
-
- if (!mat)
- mat = materialWithCustomShader(id, jsonObj);
-
- m_materialCache[id] = mat;
- return mat;
-}
-
-QCameraLens* GLTFParser::camera(const QString &id) const
-{
- QJsonObject cams = m_json.object().value(KEY_CAMERAS).toObject();
- if (!cams.contains(id)) {
- qCWarning(GLTFParserLog) << "unknown camera" << id << "in GLTF file" << m_basePath;
- return Q_NULLPTR;
- }
-
- QJsonObject jsonObj = cams.value(id).toObject();
- QString camTy = jsonObj.value(KEY_TYPE).toString();
-
- if (camTy == QStringLiteral("perspective")) {
- if (!jsonObj.contains(KEY_PERSPECTIVE)) {
- qCWarning(GLTFParserLog) << "camera:" << id << "missing 'perspective' object";
- return Q_NULLPTR;
- }
-
- QJsonObject pObj = jsonObj.value(KEY_PERSPECTIVE).toObject();
- double aspectRatio = pObj.value(KEY_ASPECT_RATIO).toDouble();
- double yfov = pObj.value(KEY_YFOV).toDouble();
- double frustumNear = pObj.value(KEY_ZNEAR).toDouble();
- double frustumFar = pObj.value(KEY_ZFAR).toDouble();
-
- QCameraLens* result = new QCameraLens;
- result->setPerspectiveProjection(yfov, aspectRatio, frustumNear, frustumFar);
- return result;
- } else if (camTy == QStringLiteral("orthographic")) {
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "implement me";
-
- return Q_NULLPTR;
- } else {
- qCWarning(GLTFParserLog) << "camera:" << id << "has unsupported type:" << camTy;
- return Q_NULLPTR;
- }
-}
-
-
-void GLTFParser::parse()
-{
- if (m_parseDone)
- return;
-
- QJsonObject buffers = m_json.object().value(KEY_BUFFERS).toObject();
- Q_FOREACH (QString nm, buffers.keys()) {
- processJSONBuffer( nm, buffers.value(nm).toObject() );
- }
-
- QJsonObject views = m_json.object().value(KEY_BUFFER_VIEWS).toObject();
- loadBufferData();
- Q_FOREACH (QString nm, views.keys()) {
- processJSONBufferView( nm, views.value(nm).toObject() );
- }
- unloadBufferData();
-
- QJsonObject shaders = m_json.object().value(KEY_SHADERS).toObject();
- Q_FOREACH (QString nm, shaders.keys()) {
- processJSONShader( nm, shaders.value(nm).toObject() );
- }
-
- QJsonObject programs = m_json.object().value(KEY_PROGRAMS).toObject();
- Q_FOREACH (QString nm, programs.keys()) {
- processJSONProgram( nm, programs.value(nm).toObject() );
- }
-
- QJsonObject techniques = m_json.object().value(KEY_TECHNIQUES).toObject();
- Q_FOREACH (QString nm, techniques.keys()) {
- processJSONTechnique( nm, techniques.value(nm).toObject() );
- }
-
- QJsonObject attrs = m_json.object().value(KEY_ACCESSORS).toObject();
- Q_FOREACH (QString nm, attrs.keys()) {
- processJSONAccessor( nm, attrs.value(nm).toObject() );
- }
-
- QJsonObject meshes = m_json.object().value(KEY_MESHES).toObject();
- Q_FOREACH (QString nm, meshes.keys()) {
- processJSONMesh( nm, meshes.value(nm).toObject() );
- }
-
- QJsonObject images = m_json.object().value(KEY_IMAGES).toObject();
- Q_FOREACH (QString nm, images.keys()) {
- processJSONImage( nm, images.value(nm).toObject() );
- }
-
- QJsonObject textures = m_json.object().value(KEY_TEXTURES).toObject();
- Q_FOREACH (QString nm, textures.keys()) {
- processJSONTexture(nm, textures.value(nm).toObject() );
- }
-
- m_defaultScene = m_json.object().value(KEY_SCENE).toString();
- m_parseDone = true;
-}
-
-void GLTFParser::cleanup()
-{
- m_meshDict.clear();
- m_meshMaterialDict.clear();
- m_accessorDict.clear();
- //Check for Materials with no parent
- Q_FOREACH (QMaterial *material, m_materialCache.values()) {
- if (material->parent() == Q_NULLPTR)
- delete material;
- }
- m_materialCache.clear();
- m_bufferDatas.clear();
- m_buffers.clear();
- m_shaderPaths.clear();
- //Check for ShaderPrograms with no parent
- Q_FOREACH (QShaderProgram *program, m_programs.values()) {
- if (program->parent() == Q_NULLPTR)
- delete program;
- }
- m_programs.clear();
- //Check for Techniques with no parent
- Q_FOREACH (QTechnique *technique, m_techniques.values()) {
- if (technique->parent() == Q_NULLPTR)
- delete technique;
- }
- m_techniques.clear();
- //Check for Textures with no parent
- Q_FOREACH (QAbstractTextureProvider *texture, m_textures.values()) {
- if (texture->parent() == Q_NULLPTR)
- delete texture;
- }
- m_textures.clear();
- m_imagePaths.clear();
- m_defaultScene.clear();
- m_parameterDataDict.clear();
-}
-
-void GLTFParser::processJSONBuffer(const QString &id, const QJsonObject& json)
-{
- // simply cache buffers for lookup by buffer-views
- m_bufferDatas[id] = BufferData(json);
-}
-
-void GLTFParser::processJSONBufferView(const QString &id, const QJsonObject& json)
-{
- QString bufName = json.value(KEY_BUFFER).toString();
- if (!m_bufferDatas.contains(bufName)) {
- qCWarning(GLTFParserLog) << "unknown buffer:" << bufName << "processing view:" << id;
- return;
- }
-
- int target = json.value(KEY_TARGET).toInt();
- QBuffer::BufferType ty(QBuffer::VertexBuffer);
-
- switch (target) {
- case GL_ARRAY_BUFFER: ty = QBuffer::VertexBuffer; break;
- case GL_ELEMENT_ARRAY_BUFFER: ty = QBuffer::IndexBuffer; break;
- default:
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "buffer" << id << "unsupported target:" << target;
- return;
- }
-
- quint64 offset = 0;
- if (json.contains(KEY_BYTE_OFFSET)) {
- offset = json.value(KEY_BYTE_OFFSET).toInt();
- qCDebug(GLTFParserLog) << "bv:" << id << "has offset:" << offset;
- }
-
- quint64 len = json.value(KEY_BYTE_LENGTH).toInt();
-
- QByteArray bytes(m_bufferDatas[bufName].data->mid(offset, len));
- if (bytes.count() != (int) len) {
- qCWarning(GLTFParserLog) << "failed to read sufficient bytes from:" << m_bufferDatas[bufName].path
- << "for view" << id;
- }
-
- QBuffer *b(new QBuffer(ty));
- b->setData(bytes);
- m_buffers[id] = b;
-}
-
-void GLTFParser::processJSONShader(const QString &id, const QJsonObject &jsonObject)
-{
- // shaders are trivial for the moment, defer the real work
- // to the program section
- QString path = jsonObject.value(KEY_URI).toString();
-
- QFileInfo info(m_basePath, path);
- if (!info.exists()) {
- qCWarning(GLTFParserLog) << "can't find shader" << id << "from path" << path;
- return;
- }
-
- m_shaderPaths[id] = info.absoluteFilePath();
-}
-
-void GLTFParser::processJSONProgram(const QString &id, const QJsonObject &jsonObject)
-{
- QShaderProgram* prog = new QShaderProgram;
- prog->setObjectName(id);
-
- QString fragName = jsonObject.value(KEY_FRAGMENT_SHADER).toString(),
- vertName = jsonObject.value(KEY_VERTEX_SHADER).toString();
- if (!m_shaderPaths.contains(fragName) || !m_shaderPaths.contains(vertName)) {
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "program:" << id << "missing shader:"
- << fragName << vertName;
- return;
- }
-
- prog->setFragmentShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(m_shaderPaths[fragName])));
- prog->setVertexShaderCode(QShaderProgram::loadSource(QUrl::fromLocalFile(m_shaderPaths[vertName])));
- m_programs[id] = prog;
-}
-
-void GLTFParser::processJSONTechnique(const QString &id, const QJsonObject &jsonObject )
-{
- QTechnique *t = new QTechnique;
- t->setObjectName(id);
-
- // Parameters
- QHash<QString, QParameter*> paramDict;
- QJsonObject params = jsonObject.value(KEY_PARAMETERS).toObject();
- Q_FOREACH (QString pname, params.keys()) {
- QJsonObject po = params.value(pname).toObject();
-
- //QString semantic = po.value(KEY_SEMANTIC).toString();
- QParameter *p = new QParameter(t);
- p->setName(pname);
- m_parameterDataDict.insert(p, ParameterData(po));
-
- //If the parameter has default value, set it
- QJsonValue value = po.value(KEY_VALUE);
- if (!value.isUndefined()) {
- int dataType = po.value(KEY_TYPE).toInt();
- p->setValue(parameterValueFromJSON(dataType, value));
- }
-
- t->addParameter(p);
-
- paramDict[pname] = p;
- } // of parameters iteration
-
- // Program
- QString programName = jsonObject.value(KEY_PROGRAM).toString();
- if (!m_programs.contains(programName)) {
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "technique" << id
- << ": missing program" << programName;
- }
-
- QRenderPass* pass = new QRenderPass;
- pass->setShaderProgram(m_programs[programName]);
-
- // Attributes
- QJsonObject attrs = jsonObject.value(KEY_ATTRIBUTES).toObject();
- Q_FOREACH ( QString shaderAttributeName, attrs.keys() ) {
- QString pname = attrs.value(shaderAttributeName).toString();
- QParameter *parameter = paramDict.value(pname, Q_NULLPTR);
- QString attributeName = pname;
- if (parameter == Q_NULLPTR) {
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "attribute " << pname
- << "defined in instanceProgram but not as parameter";
- continue;
- }
- //Check if the parameter has a standard attribute semantic
- QString standardAttributeName = standardAttributeNameFromSemantic(m_parameterDataDict[parameter].semantic);
- if (!standardAttributeName.isNull()) {
- attributeName = standardAttributeName;
- t->removeParameter(parameter);
- m_parameterDataDict.remove(parameter);
- delete parameter;
- }
-
- pass->addBinding(new QParameterMapping(attributeName, shaderAttributeName, QParameterMapping::Attribute));
- } // of program-instance attributes
-
- // Uniforms
- QJsonObject uniforms = jsonObject.value(KEY_UNIFORMS).toObject();
- Q_FOREACH (QString shaderUniformName, uniforms.keys()) {
- QString pname = uniforms.value(shaderUniformName).toString();
- QParameter *parameter = paramDict.value(pname, Q_NULLPTR);
- if (parameter == Q_NULLPTR) {
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "uniform " << pname
- << "defined in instanceProgram but not as parameter";
- continue;
- }
- //Check if the parameter has a standard uniform semantic
- QString standardUniformName = standardUniformNamefromSemantic(m_parameterDataDict[parameter].semantic);
- if (standardUniformName.isNull()) {
- pass->addBinding(new QParameterMapping(pname, shaderUniformName, QParameterMapping::Uniform));
- } else {
- pass->addBinding(new QParameterMapping(standardUniformName, shaderUniformName, QParameterMapping::StandardUniform));
- t->removeParameter(parameter);
- m_parameterDataDict.remove(parameter);
- delete parameter;
- }
- } // of program-instance uniforms
-
-
- // States
- QJsonObject states = jsonObject.value(KEY_STATES).toObject();
-
- //Process states to enable
- QJsonArray enableStatesArray = states.value(KEY_ENABLE).toArray();
- QVector<int> enableStates;
- Q_FOREACH (QJsonValue enableValue, enableStatesArray) {
- enableStates.append(enableValue.toInt());
- }
-
- //Process the list of state functions
- QJsonObject functions = states.value(KEY_FUNCTIONS).toObject();
- Q_FOREACH (QString functionName, functions.keys()) {
- int enableStateType = 0;
- QRenderState *renderState = buildState(functionName, functions.value(functionName), enableStateType);
- if (renderState != Q_NULLPTR) {
- //Remove the need to set a default state values for enableStateType
- enableStates.removeOne(enableStateType);
- pass->addRenderState(renderState);
- }
- }
-
- //Create render states with default values for any remaining enable states
- Q_FOREACH (int enableState, enableStates) {
- QRenderState *renderState = buildStateEnable(enableState);
- if (renderState != Q_NULLPTR)
- pass->addRenderState(renderState);
- }
-
-
- t->addPass(pass);
-
- m_techniques[id] = t;
-}
-
-void GLTFParser::processJSONAccessor( const QString &id, const QJsonObject& json )
-{
- m_accessorDict[id] = AccessorData(json);
-}
-
-void GLTFParser::processJSONMesh(const QString &id, const QJsonObject &json)
-{
- QJsonArray primitivesArray = json.value(KEY_PRIMITIVES).toArray();
- Q_FOREACH (QJsonValue primitiveValue, primitivesArray) {
- QJsonObject primitiveObject = primitiveValue.toObject();
- int type = primitiveObject.value(KEY_MODE).toInt();
- QString material = primitiveObject.value(KEY_MATERIAL).toString();
-
- if ( material.isEmpty()) {
- qCWarning(GLTFParserLog) << "malformed primitive on " << id << ", missing material value"
- << material;
- continue;
- }
-
- QGeometryRenderer *geometryRenderer = new QGeometryRenderer;
- QGeometry *meshGeometry = new QGeometry(geometryRenderer);
-
- //Set Primitive Type
- geometryRenderer->setPrimitiveType(static_cast<QGeometryRenderer::PrimitiveType>(type));
-
- //Save Material for mesh
- m_meshMaterialDict[geometryRenderer] = material;
-
- QJsonObject attrs = primitiveObject.value(KEY_ATTRIBUTES).toObject();
- Q_FOREACH (QString attrName, attrs.keys()) {
- QString k = attrs.value(attrName).toString();
- if (!m_accessorDict.contains(k)) {
- qCWarning(GLTFParserLog) << "unknown attribute accessor:" << k << "on mesh" << id;
- continue;
- }
-
- QString attributeName = standardAttributeNameFromSemantic(attrName);
- if (attributeName.isEmpty())
- attributeName = attrName;
-
- //Get buffer handle for accessor
- QBuffer *buffer = m_buffers.value(m_accessorDict[k].bufferViewName, Q_NULLPTR);
- if (buffer == Q_NULLPTR) {
- qCWarning(GLTFParserLog) << "unknown buffer-view:" << m_accessorDict[k].bufferViewName << "processing accessor:" << id;
- continue;
- }
-
- QAttribute *attribute = new QAttribute(buffer,
- attributeName,
- m_accessorDict[k].type,
- m_accessorDict[k].dataSize,
- m_accessorDict[k].count,
- m_accessorDict[k].offset,
- m_accessorDict[k].stride);
- attribute->setAttributeType(QAttribute::VertexAttribute);
- meshGeometry->addAttribute(attribute);
- }
-
- if ( primitiveObject.contains(KEY_INDICES)) {
- QString k = primitiveObject.value(KEY_INDICES).toString();
- if (!m_accessorDict.contains(k)) {
- qCWarning(GLTFParserLog) << "unknown index accessor:" << k << "on mesh" << id;
- } else {
- //Get buffer handle for accessor
- QBuffer *buffer = m_buffers.value(m_accessorDict[k].bufferViewName, Q_NULLPTR);
- if (buffer == Q_NULLPTR) {
- qCWarning(GLTFParserLog) << "unknown buffer-view:" << m_accessorDict[k].bufferViewName << "processing accessor:" << id;
- continue;
- }
-
- QAttribute *attribute = new QAttribute(buffer,
- m_accessorDict[k].type,
- m_accessorDict[k].dataSize,
- m_accessorDict[k].count,
- m_accessorDict[k].offset,
- m_accessorDict[k].stride);
- attribute->setAttributeType(QAttribute::IndexAttribute);
- meshGeometry->addAttribute(attribute);
- }
- } // of has indices
-
- geometryRenderer->setGeometry(meshGeometry);
-
- m_meshDict.insert( id, geometryRenderer);
- } // of primitives iteration
-}
-
-void GLTFParser::processJSONImage(const QString &id, const QJsonObject &jsonObject)
-{
- QString path = jsonObject.value(KEY_URI).toString();
- QFileInfo info(m_basePath, path);
- if (!info.exists()) {
- qCWarning(GLTFParserLog) << "can't find image" << id << "from path" << path;
- return;
- }
-
- m_imagePaths[id] = info.absoluteFilePath();
-}
-
-void GLTFParser::processJSONTexture(const QString &id, const QJsonObject &jsonObject)
-{
- int target = jsonObject.value(KEY_TARGET).toInt(GL_TEXTURE_2D);
- //TODO: support other targets that GL_TEXTURE_2D (though the spec doesn't support anything else)
- if (target != GL_TEXTURE_2D) {
- qCWarning(GLTFParserLog) << "unsupported texture target: " << target;
- return;
- }
-
- QTexture2D* tex = new QTexture2D;
-
- // TODO: Choose suitable internal format - may vary on OpenGL context type
- //int pixelFormat = jsonObj.value(KEY_FORMAT).toInt(GL_RGBA);
- int internalFormat = jsonObject.value(KEY_INTERNAL_FORMAT).toInt(GL_RGBA);
-
- tex->setFormat(static_cast<QAbstractTextureProvider::TextureFormat>(internalFormat));
-
- QString samplerId = jsonObject.value(KEY_SAMPLER).toString();
- QString source = jsonObject.value(KEY_SOURCE).toString();
- if (!m_imagePaths.contains(source)) {
- qCWarning(GLTFParserLog) << "texture" << id << "references missing image" << source;
- return;
- }
-
- QTextureImage *texImage = new QTextureImage(tex);
- texImage->setSource(QUrl::fromLocalFile(m_imagePaths[source]));
- tex->addTextureImage(texImage);
-
- QJsonObject samplersDict(m_json.object().value(KEY_SAMPLERS).toObject());
- if (!samplersDict.contains(samplerId)) {
- qCWarning(GLTFParserLog) << "texture" << id << "references unknown sampler" << samplerId;
- return;
- }
-
- QJsonObject sampler = samplersDict.value(samplerId).toObject();
-
- tex->setWrapMode(QTextureWrapMode(static_cast<QTextureWrapMode::WrapMode>(sampler.value(KEY_WRAP_S).toInt())));
- tex->setMinificationFilter(static_cast<QAbstractTextureProvider::Filter>(sampler.value(KEY_MIN_FILTER).toInt()));
- if (tex->minificationFilter() == QAbstractTextureProvider::NearestMipMapLinear ||
- tex->minificationFilter() == QAbstractTextureProvider::LinearMipMapNearest ||
- tex->minificationFilter() == QAbstractTextureProvider::NearestMipMapNearest ||
- tex->minificationFilter() == QAbstractTextureProvider::LinearMipMapLinear) {
-
- tex->setGenerateMipMaps(true);
- }
- tex->setMagnificationFilter(static_cast<QAbstractTextureProvider::Filter>(sampler.value(KEY_MAG_FILTER).toInt()));
-
- m_textures[id] = tex;
-}
-
-void GLTFParser::loadBufferData()
-{
- Q_FOREACH (QString bufferName, m_bufferDatas.keys()) {
- if (m_bufferDatas[bufferName].data == Q_NULLPTR) {
- QFile* bufferFile = resolveLocalData(m_bufferDatas[bufferName].path);
- QByteArray *data = new QByteArray(bufferFile->readAll());
- m_bufferDatas[bufferName].data = data;
- delete bufferFile;
- }
- }
-}
-
-void GLTFParser::unloadBufferData()
-{
- Q_FOREACH (QString bufferName, m_bufferDatas.keys()) {
- QByteArray *data = m_bufferDatas[bufferName].data;
- delete data;
- }
-}
-
-QFile *GLTFParser::resolveLocalData(QString path) const
-{
- QDir d(m_basePath);
- Q_ASSERT(d.exists());
-
- QString absPath = d.absoluteFilePath(path);
- QFile* f = new QFile(absPath);
- f->open(QIODevice::ReadOnly);
- return f;
-}
-
-QVariant GLTFParser::parameterValueFromJSON(int type, const QJsonValue &value) const
-{
- if (value.isBool()) {
- if (type == GL_BOOL)
- return QVariant(static_cast<GLboolean>(value.toBool()));
- } else if (value.isString()) {
- if (type == GL_SAMPLER_2D) {
- //Textures are special because we need to do a lookup to return the
- //QAbstractTextureProvider
- QString textureId = value.toString();
- if (!m_textures.contains(textureId)) {
- qCWarning(GLTFParserLog) << "unknown texture" << textureId;
- return QVariant();
- } else {
- return QVariant::fromValue(m_textures.value(textureId));
- }
- }
- } else if (value.isDouble()) {
- switch (type) {
- case GL_BYTE:
- return QVariant(static_cast<GLbyte>(value.toInt()));
- case GL_UNSIGNED_BYTE:
- return QVariant(static_cast<GLubyte>(value.toInt()));
- case GL_SHORT:
- return QVariant(static_cast<GLshort>(value.toInt()));
- case GL_UNSIGNED_SHORT:
- return QVariant(static_cast<GLushort>(value.toInt()));
- case GL_INT:
- return QVariant(static_cast<GLint>(value.toInt()));
- case GL_UNSIGNED_INT:
- return QVariant(static_cast<GLuint>(value.toInt()));
- case GL_FLOAT:
- return QVariant(static_cast<GLfloat>(value.toDouble()));
- }
- } else if (value.isArray()) {
-
- QJsonArray valueArray = value.toArray();
-
- QVector2D vector2D;
- QVector3D vector3D;
- QVector4D vector4D;
- QVector<float> dataMat2(4, 0.0f);
- QVector<float> dataMat3(9, 0.0f);
-
- switch (type) {
- case GL_BYTE:
- return QVariant(static_cast<GLbyte>(valueArray.first().toInt()));
- case GL_UNSIGNED_BYTE:
- return QVariant(static_cast<GLubyte>(valueArray.first().toInt()));
- case GL_SHORT:
- return QVariant(static_cast<GLshort>(valueArray.first().toInt()));
- case GL_UNSIGNED_SHORT:
- return QVariant(static_cast<GLushort>(valueArray.first().toInt()));
- case GL_INT:
- return QVariant(static_cast<GLint>(valueArray.first().toInt()));
- case GL_UNSIGNED_INT:
- return QVariant(static_cast<GLuint>(valueArray.first().toInt()));
- case GL_FLOAT:
- return QVariant(static_cast<GLfloat>(valueArray.first().toDouble()));
- case GL_FLOAT_VEC2:
- vector2D.setX(static_cast<GLfloat>(valueArray.at(0).toDouble()));
- vector2D.setY(static_cast<GLfloat>(valueArray.at(1).toDouble()));
- return QVariant(vector2D);
- case GL_FLOAT_VEC3:
- vector3D.setX(static_cast<GLfloat>(valueArray.at(0).toDouble()));
- vector3D.setY(static_cast<GLfloat>(valueArray.at(1).toDouble()));
- vector3D.setZ(static_cast<GLfloat>(valueArray.at(2).toDouble()));
- return QVariant(vector3D);
- case GL_FLOAT_VEC4:
- vector4D.setX(static_cast<GLfloat>(valueArray.at(0).toDouble()));
- vector4D.setY(static_cast<GLfloat>(valueArray.at(1).toDouble()));
- vector4D.setZ(static_cast<GLfloat>(valueArray.at(2).toDouble()));
- vector4D.setW(static_cast<GLfloat>(valueArray.at(3).toDouble()));
- return QVariant(vector4D);
- case GL_INT_VEC2:
- vector2D.setX(static_cast<GLint>(valueArray.at(0).toInt()));
- vector2D.setY(static_cast<GLint>(valueArray.at(1).toInt()));
- return QVariant(vector2D);
- case GL_INT_VEC3:
- vector3D.setX(static_cast<GLint>(valueArray.at(0).toInt()));
- vector3D.setY(static_cast<GLint>(valueArray.at(1).toInt()));
- vector3D.setZ(static_cast<GLint>(valueArray.at(2).toInt()));
- return QVariant(vector3D);
- case GL_INT_VEC4:
- vector4D.setX(static_cast<GLint>(valueArray.at(0).toInt()));
- vector4D.setY(static_cast<GLint>(valueArray.at(1).toInt()));
- vector4D.setZ(static_cast<GLint>(valueArray.at(2).toInt()));
- vector4D.setW(static_cast<GLint>(valueArray.at(3).toInt()));
- return QVariant(vector4D);
- case GL_BOOL:
- return QVariant(static_cast<GLboolean>(valueArray.first().toBool()));
- case GL_BOOL_VEC2:
- vector2D.setX(static_cast<GLboolean>(valueArray.at(0).toBool()));
- vector2D.setY(static_cast<GLboolean>(valueArray.at(1).toBool()));
- return QVariant(vector2D);
- case GL_BOOL_VEC3:
- vector3D.setX(static_cast<GLboolean>(valueArray.at(0).toBool()));
- vector3D.setY(static_cast<GLboolean>(valueArray.at(1).toBool()));
- vector3D.setZ(static_cast<GLboolean>(valueArray.at(2).toBool()));
- return QVariant(vector3D);
- case GL_BOOL_VEC4:
- vector4D.setX(static_cast<GLboolean>(valueArray.at(0).toBool()));
- vector4D.setY(static_cast<GLboolean>(valueArray.at(1).toBool()));
- vector4D.setZ(static_cast<GLboolean>(valueArray.at(2).toBool()));
- vector4D.setW(static_cast<GLboolean>(valueArray.at(3).toBool()));
- return QVariant(vector4D);
- case GL_FLOAT_MAT2:
- //Matrix2x2 is in Row Major ordering (so we need to convert)
- dataMat2[0] = static_cast<GLfloat>(valueArray.at(0).toDouble());
- dataMat2[1] = static_cast<GLfloat>(valueArray.at(2).toDouble());
- dataMat2[2] = static_cast<GLfloat>(valueArray.at(1).toDouble());
- dataMat2[3] = static_cast<GLfloat>(valueArray.at(3).toDouble());
- return QVariant::fromValue(QMatrix2x2(dataMat2.constData()));
- case GL_FLOAT_MAT3:
- //Matrix3x3 is in Row Major ordering (so we need to convert)
- dataMat3[0] = static_cast<GLfloat>(valueArray.at(0).toDouble());
- dataMat3[1] = static_cast<GLfloat>(valueArray.at(3).toDouble());
- dataMat3[2] = static_cast<GLfloat>(valueArray.at(6).toDouble());
- dataMat3[3] = static_cast<GLfloat>(valueArray.at(1).toDouble());
- dataMat3[4] = static_cast<GLfloat>(valueArray.at(4).toDouble());
- dataMat3[5] = static_cast<GLfloat>(valueArray.at(7).toDouble());
- dataMat3[6] = static_cast<GLfloat>(valueArray.at(2).toDouble());
- dataMat3[7] = static_cast<GLfloat>(valueArray.at(5).toDouble());
- dataMat3[8] = static_cast<GLfloat>(valueArray.at(8).toDouble());
- return QVariant::fromValue(QMatrix3x3(dataMat3.constData()));
- case GL_FLOAT_MAT4:
- //Matrix4x4 is Column Major ordering
- return QVariant(QMatrix4x4(static_cast<GLfloat>(valueArray.at(0).toDouble()),
- static_cast<GLfloat>(valueArray.at(1).toDouble()),
- static_cast<GLfloat>(valueArray.at(2).toDouble()),
- static_cast<GLfloat>(valueArray.at(3).toDouble()),
- static_cast<GLfloat>(valueArray.at(4).toDouble()),
- static_cast<GLfloat>(valueArray.at(5).toDouble()),
- static_cast<GLfloat>(valueArray.at(6).toDouble()),
- static_cast<GLfloat>(valueArray.at(7).toDouble()),
- static_cast<GLfloat>(valueArray.at(8).toDouble()),
- static_cast<GLfloat>(valueArray.at(9).toDouble()),
- static_cast<GLfloat>(valueArray.at(10).toDouble()),
- static_cast<GLfloat>(valueArray.at(11).toDouble()),
- static_cast<GLfloat>(valueArray.at(12).toDouble()),
- static_cast<GLfloat>(valueArray.at(13).toDouble()),
- static_cast<GLfloat>(valueArray.at(14).toDouble()),
- static_cast<GLfloat>(valueArray.at(15).toDouble())));
- case GL_SAMPLER_2D:
- return QVariant(valueArray.at(0).toString());
- }
- }
- return QVariant();
-}
-
-QAttribute::DataType GLTFParser::accessorTypeFromJSON(int componentType)
-{
- if (componentType == GL_BYTE) {
- return QAttribute::Byte;
- } else if (componentType == GL_UNSIGNED_BYTE) {
- return QAttribute::UnsignedByte;
- } else if (componentType == GL_SHORT) {
- return QAttribute::Short;
- } else if (componentType == GL_UNSIGNED_SHORT) {
- return QAttribute::UnsignedShort;
- } else if (componentType == GL_UNSIGNED_INT) {
- return QAttribute::UnsignedInt;
- } else if (componentType == GL_FLOAT) {
- return QAttribute::Float;
- }
-
- //There shouldn't be an invalid case here
- qCWarning(GLTFParserLog) << "unsupported accessor type" << componentType;
- return QAttribute::Float;
-}
-
-uint GLTFParser::accessorDataSizeFromJson(const QString &type)
-{
- QString typeName = type.toUpper();
- if (typeName == "SCALAR")
- return 1;
- if (typeName == "VEC2")
- return 2;
- if (typeName == "VEC3")
- return 3;
- if (typeName == "VEC4")
- return 4;
- if (typeName == "MAT2")
- return 4;
- if (typeName == "MAT3")
- return 9;
- if (typeName == "MAT4")
- return 16;
-
- return 0;
-}
-
-QRenderState *GLTFParser::buildStateEnable(int state)
-{
- int type = 0;
- //By calling buildState with QJsonValue(), a Render State with
- //default values is created.
-
- if (state == GL_BLEND) {
- //It doesn't make sense to handle this state alone
- return Q_NULLPTR;
- }
-
- if (state == GL_CULL_FACE) {
- return buildState(QStringLiteral("cullFace"), QJsonValue(), type);
- }
-
- if (state == GL_DEPTH_TEST) {
- return buildState(QStringLiteral("depthFunc"), QJsonValue(), type);
- }
-
- if (state == GL_POLYGON_OFFSET_FILL) {
- return buildState(QStringLiteral("polygonOffset"), QJsonValue(), type);
- }
-
- if (state == GL_SAMPLE_ALPHA_TO_COVERAGE) {
- return new QAlphaCoverage();
- }
-
- if (state == GL_SCISSOR_TEST) {
- return buildState(QStringLiteral("scissor"), QJsonValue(), type);
- }
-
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << state;
-
- return Q_NULLPTR;
-}
-
-QRenderState* GLTFParser::buildState(const QString& functionName, const QJsonValue &value, int &type)
-{
- type = -1;
- QJsonArray values = value.toArray();
-
- if (functionName == QStringLiteral("blendColor")) {
- type = GL_BLEND;
- //TODO: support render state blendColor
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << functionName;
- return Q_NULLPTR;
- }
-
- if (functionName == QStringLiteral("blendEquationSeparate")) {
- type = GL_BLEND;
- //TODO: support settings blendEquation alpha
- QBlendEquation *blendEquation = new QBlendEquation;
- blendEquation->setMode((QBlendEquation::BlendMode)values.at(0).toInt(GL_FUNC_ADD));
- return blendEquation;
- }
-
- if (functionName == QStringLiteral("blendFuncSeparate")) {
- type = GL_BLEND;
- QBlendStateSeparate *blendState = new QBlendStateSeparate;
- blendState->setSrcRGB((QBlendState::Blending)values.at(0).toInt(GL_ONE));
- blendState->setSrcAlpha((QBlendState::Blending)values.at(1).toInt(GL_ONE));
- blendState->setDstRGB((QBlendState::Blending)values.at(2).toInt(GL_ZERO));
- blendState->setDstAlpha((QBlendState::Blending)values.at(3).toInt(GL_ZERO));
- return blendState;
- }
-
- if (functionName == QStringLiteral("colorMask")) {
- QColorMask *colorMask = new QColorMask;
- colorMask->setRed(values.at(0).toBool(true));
- colorMask->setGreen(values.at(1).toBool(true));
- colorMask->setBlue(values.at(2).toBool(true));
- colorMask->setAlpha(values.at(3).toBool(true));
- return colorMask;
- }
-
- if (functionName == QStringLiteral("cullFace")) {
- type = GL_CULL_FACE;
- QCullFace *cullFace = new QCullFace;
- cullFace->setMode((QCullFace::CullingMode)values.at(0).toInt(GL_BACK));
- return cullFace;
- }
-
- if (functionName == QStringLiteral("depthFunc")) {
- type = GL_DEPTH_TEST;
- QDepthTest *depthTest = new QDepthTest;
- depthTest->setFunc((QDepthTest::DepthFunc)values.at(0).toInt(GL_LESS));
- return depthTest;
- }
-
- if (functionName == QStringLiteral("depthMask")) {
- QDepthMask *depthMask = new QDepthMask;
- depthMask->setMask(values.at(0).toBool(true));
- }
-
- if (functionName == QStringLiteral("depthRange")) {
- //TODO: support render state depthRange
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << functionName;
- return Q_NULLPTR;
- }
-
- if (functionName == QStringLiteral("frontFace")) {
- QFrontFace *frontFace = new QFrontFace;
- frontFace->setDirection((QFrontFace::FaceDir)values.at(0).toInt(GL_CCW));
- return frontFace;
- }
-
- if (functionName == QStringLiteral("lineWidth")) {
- //TODO: support render state lineWidth
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << functionName;
- return Q_NULLPTR;
- }
-
- if (functionName == QStringLiteral("polygonOffset")) {
- type = GL_POLYGON_OFFSET_FILL;
- QPolygonOffset *polygonOffset = new QPolygonOffset;
- polygonOffset->setFactor((float)values.at(0).toDouble(0.0f));
- polygonOffset->setUnits((float)values.at(1).toDouble(0.0f));
- return polygonOffset;
- }
-
- if (functionName == QStringLiteral("scissor")) {
- type = GL_SCISSOR_TEST;
- QScissorTest *scissorTest = new QScissorTest;
- scissorTest->setLeft(values.at(0).toDouble(0.0f));
- scissorTest->setBottom(values.at(1).toDouble(0.0f));
- scissorTest->setWidth(values.at(2).toDouble(0.0f));
- scissorTest->setHeight(values.at(3).toDouble(0.0f));
- return scissorTest;
- }
-
- qCWarning(GLTFParserLog) << Q_FUNC_INFO << "unsupported render state:" << functionName;
- return Q_NULLPTR;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/plugins/sceneparsers/gltf/gltfparser.h b/src/plugins/sceneparsers/gltf/gltfparser.h
deleted file mode 100644
index be8bcaa50..000000000
--- a/src/plugins/sceneparsers/gltf/gltfparser.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef GLTFPARSER_H
-#define GLTFPARSER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QJsonDocument>
-#include <QtCore/QMultiHash>
-
-#include <Qt3DRender/qattribute.h>
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qabstractsceneparser.h>
-
-QT_BEGIN_NAMESPACE
-
-class QFile;
-
-namespace Qt3DCore {
-class QCamera;
-class QCameraLens;
-class QEntity;
-}
-
-namespace Qt3DRender {
-
-class QMaterial;
-class QShaderProgram;
-class QEffect;
-class QAbstractTextureProvider;
-class QRenderState;
-class QTechnique;
-class QParameter;
-class QGeometryRenderer;
-
-Q_DECLARE_LOGGING_CATEGORY(GLTFParserLog)
-
-class GLTFParser : public QAbstractSceneParser
-{
- Q_OBJECT
-
-public:
- GLTFParser();
- ~GLTFParser();
-
- void setBasePath(const QString& path);
- bool setJSON( const QJsonDocument &json );
-
- // SceneParserInterface interface
- void setSource(const QUrl &source) Q_DECL_FINAL;
- bool isExtensionSupported(const QUrl &source) const Q_DECL_FINAL;
- Qt3DCore::QEntity *node(const QString &id) Q_DECL_FINAL;
- Qt3DCore::QEntity *scene(const QString &id = QString()) Q_DECL_FINAL;
-
-private:
- class BufferData
- {
- public:
- BufferData();
-
- BufferData(QJsonObject json);
-
- quint64 length;
- QString path;
- QByteArray *data;
- // type if ever useful
- };
-
- class ParameterData
- {
- public:
- ParameterData();
- ParameterData(QJsonObject json);
-
- QString semantic;
- int type;
- };
-
- class AccessorData
- {
- public:
- AccessorData();
- AccessorData(const QJsonObject& json);
-
- QString bufferViewName;
- QAttribute::DataType type;
- uint dataSize;
- int count;
- int offset;
- int stride;
- };
-
- static bool isGLTFPath(const QString &path);
- static void renameFromJson(const QJsonObject& json, QObject * const object );
- static QString standardUniformNamefromSemantic(const QString &semantic);
- static QString standardAttributeNameFromSemantic(const QString &semantic);
- static QParameter *parameterFromTechnique(QTechnique *technique, const QString &parameterName);
-
- Qt3DCore::QEntity *defaultScene();
- QMaterial *material(const QString &id);
- Qt3DCore::QCameraLens *camera(const QString &id) const;
-
- void parse();
- void cleanup();
-
- void processJSONBuffer(const QString &id, const QJsonObject &json);
- void processJSONBufferView(const QString &id, const QJsonObject &json);
- void processJSONShader(const QString &id, const QJsonObject &jsonObject);
- void processJSONProgram(const QString &id, const QJsonObject &jsonObject);
- void processJSONTechnique(const QString &id, const QJsonObject &jsonObject);
- void processJSONAccessor(const QString &id, const QJsonObject &json);
- void processJSONMesh(const QString &id, const QJsonObject &json);
- void processJSONImage(const QString &id, const QJsonObject &jsonObject);
- void processJSONTexture(const QString &id, const QJsonObject &jsonObject);
-
- void loadBufferData();
- void unloadBufferData();
-
- QFile* resolveLocalData(QString path) const;
-
- QVariant parameterValueFromJSON(int type, const QJsonValue &value) const;
- static QAbstractAttribute::DataType accessorTypeFromJSON(int componentType);
- static uint accessorDataSizeFromJson(const QString &type);
-
- static QRenderState *buildStateEnable(int state);
- static QRenderState *buildState(const QString& functionName, const QJsonValue &value, int &type);
-
- QMaterial *materialWithCustomShader(const QString &id, const QJsonObject &jsonObj);
- QMaterial *commonMaterial(const QJsonObject &jsonObj);
-
- QJsonDocument m_json;
- QString m_basePath;
- bool m_parseDone;
- QString m_defaultScene;
-
- // multi-hash because our QMeshData corresponds to a single primitive
- // in glTf.
- QMultiHash<QString, QGeometryRenderer*> m_meshDict;
-
- // GLTF assigns materials at the mesh level, but we do them as siblings,
- // so record the association here for when we instantiate meshes
- QMap<QGeometryRenderer*, QString> m_meshMaterialDict;
-
- QMap<QString, AccessorData> m_accessorDict;
-
- QMap<QString, QMaterial*> m_materialCache;
-
- QMap<QString, BufferData> m_bufferDatas;
- QMap<QString, QBuffer*> m_buffers;
-
- QMap<QString, QString> m_shaderPaths;
- QMap<QString, QShaderProgram*> m_programs;
-
- QMap<QString, QTechnique *> m_techniques;
- QMap<QParameter*, ParameterData> m_parameterDataDict;
-
- QMap<QString, QAbstractTextureProvider*> m_textures;
- QMap<QString, QString> m_imagePaths;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // GLTFPARSER_H
diff --git a/src/plugins/sceneparsers/gltf/main.cpp b/src/plugins/sceneparsers/gltf/main.cpp
index e680b42f0..c2b4e1e2b 100644
--- a/src/plugins/sceneparsers/gltf/main.cpp
+++ b/src/plugins/sceneparsers/gltf/main.cpp
@@ -1,56 +1,59 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "gltfparser.h"
+#include "gltfio.h"
-#include <Qt3DRender/QSceneParserPlugin>
+#include <Qt3DRender/private/qsceneioplugin_p.h>
QT_BEGIN_NAMESPACE
-class GLTFSceneParserPlugin : public Qt3DRender::QSceneParserPlugin
+class GLTFSceneIOPlugin : public Qt3DRender::QSceneIOPlugin
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QSceneParserFactoryInterface_iid FILE "gltf.json")
+ Q_PLUGIN_METADATA(IID QSceneIOFactoryInterface_iid FILE "gltf.json")
- Qt3DRender::QAbstractSceneParser *create(const QString &key, const QStringList &paramList) Q_DECL_OVERRIDE
+ Qt3DRender::QSceneIOHandler *create(const QString &key, const QStringList &paramList) Q_DECL_OVERRIDE
{
Q_UNUSED(key)
Q_UNUSED(paramList)
- return new Qt3DRender::GLTFParser();
+ return new Qt3DRender::GLTFIO();
}
};
diff --git a/src/quick3d/imports/core/importscore.pro b/src/quick3d/imports/core/importscore.pro
index 293071df2..6f43d8c99 100644
--- a/src/quick3d/imports/core/importscore.pro
+++ b/src/quick3d/imports/core/importscore.pro
@@ -1,9 +1,13 @@
CXX_MODULE = qml
TARGET = quick3dcoreplugin
TARGETPATH = Qt3D/Core
+IMPORT_VERSION = 2.0
QT += core-private qml qml-private quick quick-private 3dcore 3dcore-private 3dquick 3dquick-private
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
HEADERS += \
qt3dquick3dcoreplugin.h
diff --git a/src/quick3d/imports/core/plugins.qmltypes b/src/quick3d/imports/core/plugins.qmltypes
new file mode 100644
index 000000000..310bfe93e
--- /dev/null
+++ b/src/quick3d/imports/core/plugins.qmltypes
@@ -0,0 +1,135 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable Qt3D.Core 2.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component {
+ name: "Qt3DCore::QComponent"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "isShareable"; type: "bool" }
+ Signal {
+ name: "shareableChanged"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ Method {
+ name: "setShareable"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ }
+ Component { name: "Qt3DCore::QEntity"; prototype: "Qt3DCore::QNode" }
+ Component {
+ name: "Qt3DCore::QNode"
+ prototype: "QObject"
+ Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Signal {
+ name: "parentChanged"
+ Parameter { name: "parent"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "enabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Method {
+ name: "setParent"
+ Parameter { name: "parent"; type: "QNode"; isPointer: true }
+ }
+ Method {
+ name: "setEnabled"
+ Parameter { name: "isEnabled"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DCore::QTransform"
+ defaultProperty: "data"
+ prototype: "Qt3DCore::QTransform"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DCore::Quick::QQuaternionAnimation"
+ prototype: "QQuickPropertyAnimation"
+ exports: ["Qt3D.Core/QuaternionAnimation 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Type"
+ values: {
+ "Slerp": 0,
+ "Nlerp": 1
+ }
+ }
+ Property { name: "from"; type: "QQuaternion" }
+ Property { name: "to"; type: "QQuaternion" }
+ Property { name: "type"; type: "Type" }
+ Property { name: "fromXRotation"; type: "float" }
+ Property { name: "fromYRotation"; type: "float" }
+ Property { name: "fromZRotation"; type: "float" }
+ Property { name: "toXRotation"; type: "float" }
+ Property { name: "toYRotation"; type: "float" }
+ Property { name: "toZRotation"; type: "float" }
+ Signal {
+ name: "typeChanged"
+ Parameter { name: "type"; type: "Type" }
+ }
+ Signal {
+ name: "fromXRotationChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Signal {
+ name: "fromYRotationChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Signal {
+ name: "fromZRotationChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Signal {
+ name: "toXRotationChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Signal {
+ name: "toYRotationChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Signal {
+ name: "toZRotationChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DCore::Quick::Quick3DEntity"
+ defaultProperty: "data"
+ prototype: "Qt3DCore::QEntity"
+ exports: ["Qt3D.Core/Entity 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "components"; type: "Qt3DCore::QComponent"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DCore::Quick::Quick3DEntityLoader"
+ defaultProperty: "data"
+ prototype: "Qt3DCore::Quick::Quick3DEntityLoader"
+ Property { name: "components"; type: "Qt3DCore::QComponent"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DCore::Quick::Quick3DNode"
+ defaultProperty: "data"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Core/Node 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DCore::Quick::Quick3DNodeInstantiator"
+ defaultProperty: "delegate"
+ prototype: "Qt3DCore::Quick::Quick3DNodeInstantiator"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+}
diff --git a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
index a41d0e9b5..b72ee9600 100644
--- a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
+++ b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
@@ -1,46 +1,46 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qt3dquick3dcoreplugin.h"
-#include <Qt3DCore/qcameralens.h>
-#include <Qt3DCore/qcamera.h>
#include <Qt3DCore/qtransform.h>
#include <private/quick3dentity_p.h>
#include <private/quick3dentityloader_p.h>
-#include <private/quick3dconfiguration_p.h>
#include <private/quick3dnodeinstantiator_p.h>
#include <private/qquaternionanimation_p.h>
#include <private/qt3dquick_global_p.h>
@@ -52,9 +52,8 @@ void Qt3DQuick3DCorePlugin::registerTypes(const char *uri)
{
Qt3DCore::Quick::Quick3D_initialize();
- qmlRegisterUncreatableType<Qt3DCore::QComponent>(uri, 2, 0, "Component3D", QStringLiteral(""));
+ qmlRegisterUncreatableType<Qt3DCore::QComponent>(uri, 2, 0, "Component3D", QLatin1String(""));
- qmlRegisterType<Qt3DCore::Quick::Quick3DConfiguration>(uri, 2, 0, "Configuration");
Qt3DCore::Quick::registerExtendedType<Qt3DCore::QEntity, Qt3DCore::Quick::Quick3DEntity>("QEntity", "Qt3D.Core/Entity", uri, 2, 0, "Entity");
qmlRegisterType<Qt3DCore::Quick::Quick3DEntityLoader>(uri, 2, 0, "EntityLoader");
qmlRegisterType<Qt3DCore::Quick::Quick3DNodeInstantiator>(uri, 2, 0, "NodeInstantiator");
@@ -66,8 +65,6 @@ void Qt3DQuick3DCorePlugin::registerTypes(const char *uri)
// Ideally we want to make Node an uncreatable type
// We would need qmlRegisterUncreatableExtendedType for that
qmlRegisterExtendedUncreatableType<Qt3DCore::QNode, Qt3DCore::Quick::Quick3DNode>(uri, 2, 0, "Node", QStringLiteral("Node is a base class"));
- Qt3DCore::Quick::registerExtendedType<Qt3DCore::QCamera, Qt3DCore::Quick::Quick3DNode>("QCamera", "Qt3D.Core/Camera", uri, 2, 0, "Camera");
- qmlRegisterType<Qt3DCore::QCameraLens>(uri, 2, 0, "CameraLens");
}
QT_END_NAMESPACE
diff --git a/src/quick3d/imports/core/qt3dquick3dcoreplugin.h b/src/quick3d/imports/core/qt3dquick3dcoreplugin.h
index 56311da30..48c7fd136 100644
--- a/src/quick3d/imports/core/qt3dquick3dcoreplugin.h
+++ b/src/quick3d/imports/core/qt3dquick3dcoreplugin.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,6 +42,13 @@
#include <QtQml/QQmlExtensionPlugin>
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt3D_Core);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class Qt3DQuick3DCorePlugin : public QQmlExtensionPlugin
@@ -46,6 +56,7 @@ class Qt3DQuick3DCorePlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ Qt3DQuick3DCorePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); }
void registerTypes(const char *uri) Q_DECL_OVERRIDE;
};
diff --git a/src/quick3d/imports/extras/defaults/defaults.pri b/src/quick3d/imports/extras/defaults/defaults.pri
new file mode 100644
index 000000000..28a1d1051
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/defaults.pri
@@ -0,0 +1,22 @@
+
+# When adding new QML files that should be built into the plugin,
+# add them to this variable and they will be listed into a generated
+# resource file.
+#
+# To have the plugin register them as types, add an entries to the
+# qmldir array in qt3dquick3dextrasplugin.cpp
+QML_FILES = \
+ $$PWD/qml/PhongMaterial.qml \
+ $$PWD/qml/DiffuseMapMaterial.qml \
+ $$PWD/qml/DiffuseSpecularMapMaterial.qml \
+ $$PWD/qml/NormalDiffuseMapMaterial.qml \
+ $$PWD/qml/NormalDiffuseMapAlphaMaterial.qml \
+ $$PWD/qml/NormalDiffuseSpecularMapMaterial.qml \
+ $$PWD/qml/ForwardRenderer.qml \
+ $$PWD/qml/PerVertexColorMaterial.qml \
+ $$PWD/qml/SkyboxEntity.qml \
+ $$PWD/qml/GoochMaterial.qml \
+ $$PWD/qml/PhongAlphaMaterial.qml \
+ $$PWD/qml/TextureMaterial.qml \
+ $$PWD/qml/OrbitCameraController.qml \
+ $$PWD/qml/FirstPersonCameraController.qml
diff --git a/src/quick3d/imports/extras/defaults/qml/DiffuseMapMaterial.qml b/src/quick3d/imports/extras/defaults/qml/DiffuseMapMaterial.qml
new file mode 100644
index 000000000..6e5a843b0
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/DiffuseMapMaterial.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id: root
+
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property alias diffuse: diffuseTextureImage.source
+ property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
+ property real shininess: 150.0
+ property real textureScale: 1.0
+
+ parameters: [
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter {
+ name: "diffuseTexture"
+ value: Texture2D {
+ id: diffuseTexture
+ minificationFilter: Texture.LinearMipMapLinear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ generateMipMaps: true
+ maximumAnisotropy: 16.0
+ TextureImage { id: diffuseTextureImage; }
+ }
+ },
+ Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "shininess"; value: root.shininess },
+ Parameter { name: "texCoordScale"; value: textureScale }
+ ]
+
+ effect: Effect {
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ ShaderProgram {
+ id: gl2Es2Shader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/diffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/diffusemap.frag")
+ }
+
+ ShaderProgram {
+ id: gl3Shader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/diffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/diffusemap.frag")
+ }
+
+ techniques: [
+ // OpenGL 3.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass { shaderProgram: gl3Shader }
+ },
+
+ // OpenGL 2.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
+ },
+
+ // OpenGL ES 2
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
+ }
+ ]
+ }
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/DiffuseSpecularMapMaterial.qml b/src/quick3d/imports/extras/defaults/qml/DiffuseSpecularMapMaterial.qml
new file mode 100644
index 000000000..e5ec0562a
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/DiffuseSpecularMapMaterial.qml
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id: root
+
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property alias diffuse: diffuseTextureImage.source
+ property alias specular: specularTextureImage.source
+ property real shininess: 150.0
+ property real textureScale: 1.0
+
+ parameters: [
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter {
+ name: "diffuseTexture"
+ value: Texture2D {
+ id: diffuseTexture
+ minificationFilter: Texture.LinearMipMapLinear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ generateMipMaps: true
+ maximumAnisotropy: 16.0
+ TextureImage { id: diffuseTextureImage; }
+ }
+ },
+ Parameter { name: "specularTexture";
+ value: Texture2D {
+ id: specularTexture
+ minificationFilter: Texture.LinearMipMapLinear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ generateMipMaps: true
+ maximumAnisotropy: 16.0
+ TextureImage { id: specularTextureImage; }
+ }
+ },
+ Parameter { name: "shininess"; value: root.shininess },
+ Parameter { name: "texCoordScale"; value: textureScale }
+ ]
+
+ effect: Effect {
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ ShaderProgram {
+ id: gl2Es2Shader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/diffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/diffusespecularmap.frag")
+ }
+
+ ShaderProgram {
+ id: gl3Shader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/diffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/diffusespecularmap.frag")
+ }
+
+ techniques: [
+ // OpenGL 3.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass { shaderProgram: gl3Shader }
+ },
+
+ // OpenGL 2.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
+ },
+
+ // OpenGL ES 2
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
+ }
+ ]
+ }
+}
diff --git a/src/quick3d/imports/extras/defaults/qml/FirstPersonCameraController.qml b/src/quick3d/imports/extras/defaults/qml/FirstPersonCameraController.qml
new file mode 100644
index 000000000..a21679008
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/FirstPersonCameraController.qml
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire <paul.lemire350@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Logic 2.0
+import QtQml 2.2
+
+Entity {
+ id: root
+ property Camera camera
+ property real linearSpeed: 10.0
+ property real lookSpeed: 180.0
+ property real acceleration: -1.0
+ property real deceleration: -1.0
+
+ QtObject {
+ id: d
+ readonly property vector3d firstPersonUp: Qt.vector3d(0, 1, 0)
+ readonly property bool leftMouseButtonPressed: leftMouseButtonAction.active
+ readonly property real vx: txAxis.value * linearSpeed;
+ readonly property real vy: tyAxis.value * linearSpeed;
+ readonly property real vz: tzAxis.value * linearSpeed;
+ readonly property real dx: rxAxis.value * lookSpeed
+ readonly property real dy: ryAxis.value * lookSpeed
+ readonly property bool fineMotion: fineMotionAction.active
+ }
+
+ KeyboardDevice {
+ id: keyboardSourceDevice
+ }
+
+ MouseDevice {
+ id: mouseSourceDevice
+ sensitivity: d.fineMotion ? 0.01 : 0.1
+ }
+
+ components: [
+
+ LogicalDevice {
+ actions: [
+ Action {
+ id: leftMouseButtonAction
+ ActionInput {
+ sourceDevice: mouseSourceDevice
+ buttons: [MouseEvent.LeftButton]
+ }
+ },
+ Action {
+ id: fineMotionAction
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Shift]
+ }
+ }
+ ] // actions
+
+ axes: [
+ // Rotation
+ Axis {
+ id: rxAxis
+ AnalogAxisInput {
+ sourceDevice: mouseSourceDevice
+ axis: MouseDevice.X
+ }
+ },
+ Axis {
+ id: ryAxis
+ AnalogAxisInput {
+ sourceDevice: mouseSourceDevice
+ axis: MouseDevice.Y
+ }
+ },
+ // Translation
+ Axis {
+ id: txAxis
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Left]
+ scale: -1.0
+ acceleration: root.acceleration
+ deceleration: root.deceleration
+ }
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Right]
+ scale: 1.0
+ acceleration: root.acceleration
+ deceleration: root.deceleration
+ }
+ },
+ Axis {
+ id: tzAxis
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Up]
+ scale: 1.0
+ acceleration: root.acceleration
+ deceleration: root.deceleration
+ }
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Down]
+ scale: -1.0
+ acceleration: root.acceleration
+ deceleration: root.deceleration
+ }
+ },
+ Axis {
+ id: tyAxis
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_PageUp]
+ scale: 1.0
+ acceleration: root.acceleration
+ deceleration: root.deceleration
+ }
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_PageDown]
+ scale: -1.0
+ acceleration: root.acceleration
+ deceleration: root.deceleration
+ }
+ }
+ ] // axes
+ },
+
+ FrameAction {
+ onTriggered: {
+ // The time difference since the last frame is passed in as the
+ // argument dt. It is a floating point value in units of seconds.
+ root.camera.translate(Qt.vector3d(d.vx, d.vy, d.vz).times(dt))
+
+ if (d.leftMouseButtonPressed) {
+ root.camera.pan(d.dx * dt, d.firstPersonUp)
+ root.camera.tilt(d.dy * dt)
+ }
+ }
+ }
+ ] // components
+}
diff --git a/src/quick3d/imports/extras/defaults/qml/ForwardRenderer.qml b/src/quick3d/imports/extras/defaults/qml/ForwardRenderer.qml
new file mode 100644
index 000000000..0cd5bcaa6
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/ForwardRenderer.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+TechniqueFilter {
+ // Expose camera to allow user to choose which camera to use for rendering
+ property alias camera: cameraSelector.camera
+ property alias clearColor: clearBuffer.clearColor
+ property alias viewportRect: viewport.normalizedRect
+ property alias window: surfaceSelector.surface
+
+ // Select the forward rendering Technique of any used Effect
+ matchAll: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
+
+ RenderSurfaceSelector {
+ id: surfaceSelector
+
+ // Use the whole viewport
+ Viewport {
+ id: viewport
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+
+ // Use the specified camera
+ CameraSelector {
+ id : cameraSelector
+ FrustumCulling {
+ ClearBuffers {
+ id: clearBuffer
+ clearColor: "white"
+ buffers : ClearBuffers.ColorDepthBuffer
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/quick3d/imports/extras/defaults/qml/GoochMaterial.qml b/src/quick3d/imports/extras/defaults/qml/GoochMaterial.qml
new file mode 100644
index 000000000..51c656ae0
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/GoochMaterial.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id:root
+ property color diffuse: Qt.rgba( 0.0, 0.0, 0.0, 1.0 )
+ property color specular: Qt.rgba( 0.0, 0.0, 0.0, 1.0 )
+ property color coolColor: Qt.rgba( 0.0, 0.0, 0.4, 1.0 )
+ property color warmColor: Qt.rgba( 0.4, 0.4, 0.0, 1.0 )
+ property real alpha: 0.25
+ property real beta: 0.5
+ property real shininess: 100.0
+
+ ShaderProgram {
+ id: gl3GoochShader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/gooch.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/gooch.frag")
+ }
+
+ ShaderProgram {
+ id: gl2es2GoochShader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/gooch.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/gooch.frag")
+ }
+
+ effect: Effect {
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ parameters: [
+ Parameter { name: "kd"; value: root.diffuse },
+ Parameter { name: "ks"; value: root.specular },
+ Parameter { name: "kblue"; value: root.coolColor },
+ Parameter { name: "kyellow"; value: root.warmColor },
+ Parameter { name: "alpha"; value: root.alpha },
+ Parameter { name: "beta"; value: root.beta },
+ Parameter { name: "shininess"; value: root.shininess }
+ ]
+
+ techniques: [
+ // GL 3 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 2
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3GoochShader
+ }
+ },
+
+ // GL 2 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2GoochShader
+ }
+ },
+
+ // ES 2 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2GoochShader
+ }
+ }
+ ]
+ }
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml
new file mode 100644
index 000000000..6dfbf98c1
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapAlphaMaterial.qml
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id: root
+
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property alias diffuse: diffuseTextureImage.source
+ property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
+ property alias normal: normalTextureImage.source
+ property real shininess: 150.0
+ property real textureScale: 1.0
+
+ parameters: [
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter {
+ name: "diffuseTexture"
+ value: Texture2D {
+ id: diffuseTexture
+ minificationFilter: Texture.LinearMipMapLinear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ generateMipMaps: true
+ maximumAnisotropy: 16.0
+ TextureImage { id: diffuseTextureImage; }
+ }
+ },
+ Parameter {
+ name: "normalTexture"
+ value: Texture2D {
+ id: normalTexture
+ minificationFilter: Texture.Linear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ maximumAnisotropy: 16.0
+ TextureImage { id: normalTextureImage; }
+ }
+ },
+ Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "shininess"; value: root.shininess },
+ Parameter { name: "texCoordScale"; value: textureScale }
+ ]
+
+ effect: Effect {
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ ShaderProgram {
+ id: gl2Es2Shader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemapalpha.frag")
+ }
+
+ ShaderProgram {
+ id: gl3Shader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemapalpha.frag")
+ }
+
+ AlphaCoverage { id: alphaCoverageState }
+ DepthTest { id: depthTestState; depthFunction: DepthTest.Less }
+
+ techniques: [
+ // OpenGL 3.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass { shaderProgram: gl3Shader; renderStates: [alphaCoverageState, depthTestState] }
+ },
+
+ // OpenGL 2.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader; renderStates: [alphaCoverageState, depthTestState] }
+ },
+
+ // OpenGL ES 2
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader; renderStates: [alphaCoverageState, depthTestState] }
+ }
+ ]
+ }
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml
new file mode 100644
index 000000000..eeb1d33d4
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseMapMaterial.qml
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id: root
+
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property alias diffuse: diffuseTextureImage.source
+ property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
+ property alias normal: normalTextureImage.source
+ property real shininess: 150.0
+ property real textureScale: 1.0
+
+ parameters: [
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter {
+ name: "diffuseTexture"
+ value: Texture2D {
+ id: diffuseTexture
+ minificationFilter: Texture.LinearMipMapLinear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ generateMipMaps: true
+ maximumAnisotropy: 16.0
+ TextureImage { id: diffuseTextureImage; }
+ }
+ },
+ Parameter {
+ name: "normalTexture"
+ value: Texture2D {
+ id: normalTexture
+ minificationFilter: Texture.Linear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ maximumAnisotropy: 16.0
+ TextureImage { id: normalTextureImage; }
+ }
+ },
+ Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "shininess"; value: root.shininess },
+ Parameter { name: "texCoordScale"; value: textureScale }
+ ]
+
+ effect: Effect {
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ ShaderProgram {
+ id: gl2Es2Shader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemap.frag")
+ }
+
+ ShaderProgram {
+ id: gl3Shader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemap.frag")
+ }
+
+ techniques: [
+ // OpenGL 3.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass { shaderProgram: gl3Shader }
+ },
+
+ // OpenGL 2.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
+ },
+
+ // OpenGL ES 2
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
+ }
+ ]
+ }
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml
new file mode 100644
index 000000000..d2c0efda0
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/NormalDiffuseSpecularMapMaterial.qml
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id: root
+
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property alias diffuse: diffuseTextureImage.source
+ property alias specular: specularTextureImage.source
+ property alias normal: normalTextureImage.source
+ property real shininess: 150.0
+ property real textureScale: 1.0
+
+ parameters: [
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter {
+ name: "diffuseTexture"
+ value: Texture2D {
+ id: diffuseTexture
+ minificationFilter: Texture.LinearMipMapLinear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ generateMipMaps: true
+ maximumAnisotropy: 16.0
+ TextureImage { id: diffuseTextureImage; }
+ }
+ },
+ Parameter { name: "specularTexture";
+ value: Texture2D {
+ id: specularTexture
+ minificationFilter: Texture.LinearMipMapLinear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ generateMipMaps: true
+ maximumAnisotropy: 16.0
+ TextureImage { id: specularTextureImage; }
+ }
+ },
+ Parameter {
+ name: "normalTexture"
+ value: Texture2D {
+ id: normalTexture
+ minificationFilter: Texture.Linear
+ magnificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.Repeat
+ y: WrapMode.Repeat
+ }
+ maximumAnisotropy: 16.0
+ TextureImage { id: normalTextureImage; }
+ }
+ },
+ Parameter { name: "shininess"; value: root.shininess },
+ Parameter { name: "texCoordScale"; value: textureScale }
+ ]
+
+ effect: Effect {
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ ShaderProgram {
+ id: gl2Es2Shader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/normaldiffusespecularmap.frag")
+ }
+
+ ShaderProgram {
+ id: gl3Shader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemap.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusespecularmap.frag")
+ }
+
+ techniques: [
+ // OpenGL 3.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass { shaderProgram: gl3Shader }
+ },
+
+ // OpenGL 2.1
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
+ },
+
+ // OpenGL ES 2
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
+ }
+ ]
+ }
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml b/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml
new file mode 100644
index 000000000..328b7b98e
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/OrbitCameraController.qml
@@ -0,0 +1,235 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire <paul.lemire350@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Logic 2.0
+import QtQml 2.2
+
+Entity {
+ id: root
+ property Camera camera
+ property real linearSpeed: 10.0
+ property real lookSpeed: 180.0
+ property real zoomLimit: 2.0
+
+ QtObject {
+ id: d
+ readonly property vector3d firstPersonUp: Qt.vector3d(0, 1, 0)
+ readonly property bool leftMouseButtonPressed: leftMouseButtonAction.active
+ readonly property bool rightMouseButtonPressed: rightMouseButtonAction.active
+ readonly property bool shiftPressed: shiftAction.active
+ readonly property bool altPressed: altAction.active
+ property real translationX: clampInputs(leftMouseButtonPressed ? mouseXAxis.value : 0, keyboardXAxis.value) * linearSpeed;
+ property real translationY: clampInputs(leftMouseButtonPressed ? mouseYAxis.value : 0, keyboardYAxis.value) * linearSpeed;
+ property real translationZ: keyboardZAxis.value * linearSpeed;
+ property real orbitX: clampInputs(rightMouseButtonPressed ? mouseXAxis.value : 0, keyboardXAxis.value) * lookSpeed;
+ property real orbitY: clampInputs(rightMouseButtonPressed ? mouseYAxis.value : 0, keyboardYAxis.value) * lookSpeed;
+ }
+
+ function clampInputs(input1, input2) {
+ var axisValue = input1 + input2;
+ return (axisValue < -1) ? -1 : (axisValue > 1) ? 1 : axisValue;
+ }
+
+ function zoomDistance(firstPoint, secondPoint) {
+ var u = secondPoint.minus(firstPoint); u = u.times(u);
+ return u.x + u.y + u.z;
+ }
+
+ KeyboardDevice {
+ id: keyboardSourceDevice
+ }
+
+ MouseDevice {
+ id: mouseSourceDevice
+ sensitivity: 0.1
+ }
+
+ components: [
+
+ LogicalDevice {
+ actions: [
+ Action {
+ id: leftMouseButtonAction
+ ActionInput {
+ sourceDevice: mouseSourceDevice
+ buttons: [MouseEvent.LeftButton]
+ }
+ },
+ Action {
+ id: rightMouseButtonAction
+ ActionInput {
+ sourceDevice: mouseSourceDevice
+ buttons: [MouseEvent.RightButton]
+ }
+ },
+ Action {
+ id: shiftAction
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Shift]
+ }
+ },
+ Action {
+ id: altAction
+ ActionInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Alt]
+ }
+ }
+ ] // actions
+
+ axes: [
+ // Mouse
+ Axis {
+ id: mouseXAxis
+ AnalogAxisInput {
+ sourceDevice: mouseSourceDevice
+ axis: MouseDevice.X
+ }
+ },
+ Axis {
+ id: mouseYAxis
+ AnalogAxisInput {
+ sourceDevice: mouseSourceDevice
+ axis: MouseDevice.Y
+ }
+ },
+ // Keyboard
+ Axis {
+ id: keyboardXAxis
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Left]
+ scale: -1.0
+ }
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Right]
+ scale: 1.0
+ }
+ },
+ Axis {
+ id: keyboardZAxis
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Up]
+ scale: d.shiftPressed ? 1.0 : 0.0
+ }
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Down]
+ scale: d.shiftPressed ? -1.0 : 0.0
+ }
+ },
+ Axis {
+ id: keyboardYAxis
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Up]
+ scale: d.shiftPressed ? 0.0 : 1.0
+ }
+ ButtonAxisInput {
+ sourceDevice: keyboardSourceDevice
+ buttons: [Qt.Key_Down]
+ scale: d.shiftPressed ? 0.0 : -1.0
+ }
+ }
+ ] // axes
+ },
+
+ FrameAction {
+ onTriggered: {
+ // The time difference since the last frame is passed in as the
+ // argument dt. It is a floating point value in units of seconds.
+
+ // Mouse input
+ if (d.leftMouseButtonPressed) {
+ if (d.rightMouseButtonPressed) {
+ if (zoomDistance(root.camera.position, root.camera.viewCenter) > root.zoomLimit * root.zoomLimit) {
+ // Dolly up to limit
+ root.camera.translate(Qt.vector3d(0, 0, d.translationY).times(dt), Camera.DontTranslateViewCenter);
+ } else {
+ // Too close, Dolly backwards
+ root.camera.translate(Qt.vector3d(0, 0, -1).times(dt), Camera.DontTranslateViewCenter);
+ }
+ } else {
+ // Translate
+ root.camera.translate(Qt.vector3d(d.translationX, d.translationY, 0).times(dt));
+ return
+ }
+ } else if (d.rightMouseButtonPressed) {
+ // Orbit
+ root.camera.panAboutViewCenter(d.orbitX * dt, d.firstPersonUp);
+ root.camera.tiltAboutViewCenter(d.orbitY * dt);
+ }
+ // Keyboard input
+ if (d.altPressed) {
+ // Orbit
+ root.camera.panAboutViewCenter(d.orbitX * dt, d.firstPersonUp);
+ root.camera.tiltAboutViewCenter(d.orbitY * dt);
+ } else if (d.shiftPressed) {
+ if (zoomDistance(root.camera.position, root.camera.viewCenter) > root.zoomLimit * root.zoomLimit) {
+ // Dolly up to limit
+ root.camera.translate(Qt.vector3d(0, 0, d.translationZ).times(dt), Camera.DontTranslateViewCenter);
+ } else {
+ // Too close, Dolly backwards
+ root.camera.translate(Qt.vector3d(0, 0, -1).times(dt), Camera.DontTranslateViewCenter);
+ }
+ } else {
+ // Translate
+ root.camera.translate(Qt.vector3d(d.translationX, d.translationY, 0).times(dt));
+ }
+ }
+ }
+ ] // components
+}
diff --git a/src/quick3d/imports/extras/defaults/qml/PerVertexColorMaterial.qml b/src/quick3d/imports/extras/defaults/qml/PerVertexColorMaterial.qml
new file mode 100644
index 000000000..9e286f459
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/PerVertexColorMaterial.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Lorenz Esch (TU Ilmenau).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id:root
+
+ ShaderProgram {
+ id: gl3PerVertexColorShader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/pervertexcolor.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/pervertexcolor.frag")
+ }
+
+ ShaderProgram {
+ id: gl2es2PerVertexColorShader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/pervertexcolor.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/pervertexcolor.frag")
+ }
+
+ effect: Effect {
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ techniques: [
+ // GL 3 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3PerVertexColorShader
+ }
+ },
+
+ // GL 2 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2PerVertexColorShader
+ }
+ },
+
+ // ES 2 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2PerVertexColorShader
+ }
+ }
+ ]
+ }
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/PhongAlphaMaterial.qml b/src/quick3d/imports/extras/defaults/qml/PhongAlphaMaterial.qml
new file mode 100644
index 000000000..295d8abd1
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/PhongAlphaMaterial.qml
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id:root
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
+ property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
+ property real shininess: 150.0
+ property real alpha: 0.5
+
+
+ ShaderProgram {
+ id: gl3PhongAlphaShader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/phong.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/phongalpha.frag")
+ }
+
+ ShaderProgram {
+ id: gl2es2PhongAlphaShader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/phong.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/phongalpha.frag")
+ }
+
+ effect: Effect {
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ parameters: [
+ Parameter { name: "alpha"; value: root.alpha },
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
+ Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "shininess"; value: root.shininess }
+ ]
+
+ techniques: [
+ // GL 3 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3PhongAlphaShader
+ renderStates: [
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ },
+ BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+ }
+ },
+
+ // GL 2 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2PhongAlphaShader
+ renderStates: [
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ },
+ BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+ }
+ },
+
+ // ES 2 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2PhongAlphaShader
+ renderStates: [
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ },
+ BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+ }
+ }
+ ]
+ }
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/PhongMaterial.qml b/src/quick3d/imports/extras/defaults/qml/PhongMaterial.qml
new file mode 100644
index 000000000..e60bcefc8
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/PhongMaterial.qml
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id:root
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
+ property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
+ property real shininess: 150.0
+
+
+ ShaderProgram {
+ id: gl3PhongShader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/phong.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/phong.frag")
+ }
+
+ ShaderProgram {
+ id: gl2es2PhongShader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/phong.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/phong.frag")
+ }
+
+ effect: Effect {
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ parameters: [
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
+ Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "shininess"; value: root.shininess }
+ ]
+
+ techniques: [
+ // GL 3 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3PhongShader
+ }
+ },
+
+ // GL 2 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2PhongShader
+ }
+ },
+
+ // ES 2 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2PhongShader
+ }
+ }
+ ]
+ }
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/SkyboxEntity.qml b/src/quick3d/imports/extras/defaults/qml/SkyboxEntity.qml
new file mode 100644
index 000000000..9fcf8559f
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/SkyboxEntity.qml
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+
+ property alias cameraPosition: transform.translation;
+ property string baseName: "";
+ property string extension: ".png"
+
+ property TextureCubeMap skyboxTexture: TextureCubeMap {
+ generateMipMaps: false
+ magnificationFilter: Texture.Linear
+ minificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ TextureImage { face: Texture.CubeMapPositiveX; source: baseName + "_posx" + extension }
+ TextureImage { face: Texture.CubeMapPositiveY; source: baseName + "_posy" + extension }
+ TextureImage { face: Texture.CubeMapPositiveZ; source: baseName + "_posz" + extension }
+ TextureImage { face: Texture.CubeMapNegativeX; source: baseName + "_negx" + extension }
+ TextureImage { face: Texture.CubeMapNegativeY; source: baseName + "_negy" + extension }
+ TextureImage { face: Texture.CubeMapNegativeZ; source: baseName + "_negz" + extension }
+ }
+
+ ShaderProgram {
+ id: gl3SkyboxShader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/skybox.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/skybox.frag")
+ }
+
+ ShaderProgram {
+ id: gl2es2SkyboxShader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/skybox.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/skybox.frag")
+ }
+
+ CuboidMesh {
+ id: cuboidMesh
+ yzMeshResolution: Qt.size(2, 2)
+ xzMeshResolution: Qt.size(2, 2)
+ xyMeshResolution: Qt.size(2, 2)
+ }
+
+ Transform {
+ id: transform
+ }
+
+ Material {
+ id: skyboxMaterial
+ parameters: Parameter { name: "skyboxTexture"; value: skyboxTexture}
+
+ effect: Effect {
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ techniques: [
+ // GL3 Technique
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3SkyboxShader
+ renderStates: [
+ // cull front faces
+ CullFace { mode: CullFace.Front },
+ DepthTest { depthFunction: DepthTest.LessOrEqual }
+ ]
+ }
+ },
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2SkyboxShader
+ renderStates: [
+ CullFace { mode: CullFace.Front },
+ DepthTest { depthFunction: DepthTest.LessOrEqual }
+ ]
+ }
+ },
+ Technique {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2SkyboxShader
+ renderStates: [
+ CullFace { mode: CullFace.Front },
+ DepthTest { depthFunction: DepthTest.LessOrEqual }
+ ]
+ }
+ }
+ ]
+ }
+ }
+
+ components: [cuboidMesh, skyboxMaterial, transform]
+}
+
diff --git a/src/quick3d/imports/extras/defaults/qml/TextureMaterial.qml b/src/quick3d/imports/extras/defaults/qml/TextureMaterial.qml
new file mode 100644
index 000000000..d5f99445b
--- /dev/null
+++ b/src/quick3d/imports/extras/defaults/qml/TextureMaterial.qml
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id: root
+ property Texture2D texture: Texture2D {}
+ property alias textureOffset: texCoordOffset.offset
+
+ ShaderProgram {
+ id: gl3Shader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/unlittexture.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/unlittexture.frag")
+ }
+
+ ShaderProgram {
+ id: gl2es2Shader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/unlittexture.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/unlittexture.frag")
+ }
+
+ effect: Effect {
+
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ parameters: [
+ Parameter {
+ name: "diffuseTexture"
+ value: root.texture
+ },
+ Parameter {
+ id: texCoordOffset
+ property vector2d offset: Qt.vector2d(0, 0)
+ name: "texCoordOffset"
+ value: offset
+ }
+
+ ]
+
+ techniques: [
+ // OpenGL 3.1
+ Technique {
+ annotations: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3Shader
+ }
+ },
+
+ // GL 2 Technique
+ Technique {
+ annotations: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2Shader
+ }
+ },
+
+ // ES 2 Technique
+ Technique {
+ annotations: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2Shader
+ }
+ }
+ ]
+ }
+}
diff --git a/src/quick3d/imports/extras/importsextras.pro b/src/quick3d/imports/extras/importsextras.pro
new file mode 100644
index 000000000..acc993fa7
--- /dev/null
+++ b/src/quick3d/imports/extras/importsextras.pro
@@ -0,0 +1,45 @@
+CXX_MODULE = qml
+TARGET = quick3dextrasplugin
+TARGETPATH = Qt3D/Extras
+IMPORT_VERSION = 2.0
+
+QT += core-private qml qml-private quick quick-private 3dcore 3dcore-private 3dquick 3dquick-private 3dextras 3dlogic
+
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
+HEADERS += \
+ qt3dquick3dextrasplugin.h
+
+SOURCES += \
+ qt3dquick3dextrasplugin.cpp
+
+load(qml_plugin)
+
+include(./defaults/defaults.pri)
+
+OTHER_FILES += \
+ qmldir \
+ $$QML_FILES
+
+# Create a resource file for qml files that need to be registered by the plugin
+GENERATED_RESOURCE_FILE = $$OUT_PWD/defaults.qrc
+INCLUDED_RESOURCE_FILES = $$QML_FILES
+RESOURCE_CONTENT = \
+ "<RCC>" \
+ "<qresource prefix=\"/qt-project.org/imports/Qt3D/Extras/\">"
+
+for(resourcefile, INCLUDED_RESOURCE_FILES) {
+ resourcefileabsolutepath = $$absolute_path($$resourcefile)
+ relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_)
+ relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD)
+ RESOURCE_CONTENT += "<file alias=\"$$relativepath_in\">$$relativepath_out</file>"
+}
+
+RESOURCE_CONTENT += \
+ "</qresource>" \
+ "</RCC>"
+
+write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
+
+RESOURCES += $$GENERATED_RESOURCE_FILE
diff --git a/src/quick3d/imports/extras/plugins.qmltypes b/src/quick3d/imports/extras/plugins.qmltypes
new file mode 100644
index 000000000..d30b2591a
--- /dev/null
+++ b/src/quick3d/imports/extras/plugins.qmltypes
@@ -0,0 +1,1124 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable Qt3D.Extras 2.0'
+
+Module {
+ dependencies: ["Qt3D.Logic 2.0"]
+ Component {
+ name: "Qt3DExtras::QConeGeometry"
+ prototype: "Qt3DRender::QGeometry"
+ exports: ["Qt3D.Extras/ConeGeometry 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "hasTopEndcap"; type: "bool" }
+ Property { name: "hasBottomEndcap"; type: "bool" }
+ Property { name: "rings"; type: "int" }
+ Property { name: "slices"; type: "int" }
+ Property { name: "topRadius"; type: "float" }
+ Property { name: "bottomRadius"; type: "float" }
+ Property { name: "length"; type: "float" }
+ Property {
+ name: "positionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "normalAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "texCoordAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "indexAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "hasTopEndcapChanged"
+ Parameter { name: "hasTopEndcap"; type: "bool" }
+ }
+ Signal {
+ name: "hasBottomEndcapChanged"
+ Parameter { name: "hasBottomEndcap"; type: "bool" }
+ }
+ Signal {
+ name: "topRadiusChanged"
+ Parameter { name: "topRadius"; type: "float" }
+ }
+ Signal {
+ name: "bottomRadiusChanged"
+ Parameter { name: "bottomRadius"; type: "float" }
+ }
+ Signal {
+ name: "ringsChanged"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Signal {
+ name: "slicesChanged"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Signal {
+ name: "lengthChanged"
+ Parameter { name: "length"; type: "float" }
+ }
+ Method {
+ name: "setHasTopEndcap"
+ Parameter { name: "hasTopEndcap"; type: "bool" }
+ }
+ Method {
+ name: "setHasBottomEndcap"
+ Parameter { name: "hasBottomEndcap"; type: "bool" }
+ }
+ Method {
+ name: "setTopRadius"
+ Parameter { name: "topRadius"; type: "float" }
+ }
+ Method {
+ name: "setBottomRadius"
+ Parameter { name: "bottomRadius"; type: "float" }
+ }
+ Method {
+ name: "setRings"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Method {
+ name: "setSlices"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Method {
+ name: "setLength"
+ Parameter { name: "length"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QConeMesh"
+ prototype: "Qt3DRender::QGeometryRenderer"
+ exports: ["Qt3D.Extras/ConeMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "rings"; type: "int" }
+ Property { name: "slices"; type: "int" }
+ Property { name: "hasTopEndcap"; type: "bool" }
+ Property { name: "hasBottomEndcap"; type: "bool" }
+ Property { name: "topRadius"; type: "float" }
+ Property { name: "bottomRadius"; type: "float" }
+ Property { name: "length"; type: "float" }
+ Signal {
+ name: "hasTopEndcapChanged"
+ Parameter { name: "hasTopEndcap"; type: "bool" }
+ }
+ Signal {
+ name: "hasBottomEndcapChanged"
+ Parameter { name: "hasBottomEndcap"; type: "bool" }
+ }
+ Signal {
+ name: "topRadiusChanged"
+ Parameter { name: "topRadius"; type: "float" }
+ }
+ Signal {
+ name: "bottomRadiusChanged"
+ Parameter { name: "bottomRadius"; type: "float" }
+ }
+ Signal {
+ name: "ringsChanged"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Signal {
+ name: "slicesChanged"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Signal {
+ name: "lengthChanged"
+ Parameter { name: "length"; type: "float" }
+ }
+ Method {
+ name: "setHasTopEndcap"
+ Parameter { name: "hasTopEndcap"; type: "bool" }
+ }
+ Method {
+ name: "setHasBottomEndcap"
+ Parameter { name: "hasBottomEndcap"; type: "bool" }
+ }
+ Method {
+ name: "setTopRadius"
+ Parameter { name: "topRadius"; type: "float" }
+ }
+ Method {
+ name: "setBottomRadius"
+ Parameter { name: "bottomRadius"; type: "float" }
+ }
+ Method {
+ name: "setRings"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Method {
+ name: "setSlices"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Method {
+ name: "setLength"
+ Parameter { name: "length"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QCuboidGeometry"
+ prototype: "Qt3DRender::QGeometry"
+ exports: ["Qt3D.Extras/CuboidGeometry 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "xExtent"; type: "float" }
+ Property { name: "yExtent"; type: "float" }
+ Property { name: "zExtent"; type: "float" }
+ Property { name: "xyMeshResolution"; type: "QSize" }
+ Property { name: "yzMeshResolution"; type: "QSize" }
+ Property { name: "xzMeshResolution"; type: "QSize" }
+ Property {
+ name: "positionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "normalAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "texCoordAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "tangentAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "indexAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "xExtentChanged"
+ Parameter { name: "xExtent"; type: "float" }
+ }
+ Signal {
+ name: "yExtentChanged"
+ Parameter { name: "yExtent"; type: "float" }
+ }
+ Signal {
+ name: "zExtentChanged"
+ Parameter { name: "zExtent"; type: "float" }
+ }
+ Signal {
+ name: "yzMeshResolutionChanged"
+ Parameter { name: "yzMeshResolution"; type: "QSize" }
+ }
+ Signal {
+ name: "xzMeshResolutionChanged"
+ Parameter { name: "xzMeshResolution"; type: "QSize" }
+ }
+ Signal {
+ name: "xyMeshResolutionChanged"
+ Parameter { name: "xyMeshResolution"; type: "QSize" }
+ }
+ Method {
+ name: "setXExtent"
+ Parameter { name: "xExtent"; type: "float" }
+ }
+ Method {
+ name: "setYExtent"
+ Parameter { name: "yExtent"; type: "float" }
+ }
+ Method {
+ name: "setZExtent"
+ Parameter { name: "zExtent"; type: "float" }
+ }
+ Method {
+ name: "setYZMeshResolution"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ Method {
+ name: "setXZMeshResolution"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ Method {
+ name: "setXYMeshResolution"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QCuboidMesh"
+ prototype: "Qt3DRender::QGeometryRenderer"
+ exports: ["Qt3D.Extras/CuboidMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "xExtent"; type: "float" }
+ Property { name: "yExtent"; type: "float" }
+ Property { name: "zExtent"; type: "float" }
+ Property { name: "yzMeshResolution"; type: "QSize" }
+ Property { name: "xzMeshResolution"; type: "QSize" }
+ Property { name: "xyMeshResolution"; type: "QSize" }
+ Signal {
+ name: "xExtentChanged"
+ Parameter { name: "xExtent"; type: "float" }
+ }
+ Signal {
+ name: "yExtentChanged"
+ Parameter { name: "yExtent"; type: "float" }
+ }
+ Signal {
+ name: "zExtentChanged"
+ Parameter { name: "zExtent"; type: "float" }
+ }
+ Signal {
+ name: "yzMeshResolutionChanged"
+ Parameter { name: "yzMeshResolution"; type: "QSize" }
+ }
+ Signal {
+ name: "xzMeshResolutionChanged"
+ Parameter { name: "xzMeshResolution"; type: "QSize" }
+ }
+ Signal {
+ name: "xyMeshResolutionChanged"
+ Parameter { name: "xyMeshResolution"; type: "QSize" }
+ }
+ Method {
+ name: "setXExtent"
+ Parameter { name: "xExtent"; type: "float" }
+ }
+ Method {
+ name: "setYExtent"
+ Parameter { name: "yExtent"; type: "float" }
+ }
+ Method {
+ name: "setZExtent"
+ Parameter { name: "zExtent"; type: "float" }
+ }
+ Method {
+ name: "setYZMeshResolution"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ Method {
+ name: "setXZMeshResolution"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ Method {
+ name: "setXYMeshResolution"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QCylinderGeometry"
+ prototype: "Qt3DRender::QGeometry"
+ exports: ["Qt3D.Extras/CylinderGeometry 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "rings"; type: "int" }
+ Property { name: "slices"; type: "int" }
+ Property { name: "radius"; type: "float" }
+ Property { name: "length"; type: "float" }
+ Property {
+ name: "positionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "normalAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "texCoordAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "indexAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "radiusChanged"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Signal {
+ name: "ringsChanged"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Signal {
+ name: "slicesChanged"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Signal {
+ name: "lengthChanged"
+ Parameter { name: "length"; type: "float" }
+ }
+ Method {
+ name: "setRings"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Method {
+ name: "setSlices"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Method {
+ name: "setRadius"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Method {
+ name: "setLength"
+ Parameter { name: "length"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QCylinderMesh"
+ prototype: "Qt3DRender::QGeometryRenderer"
+ exports: ["Qt3D.Extras/CylinderMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "rings"; type: "int" }
+ Property { name: "slices"; type: "int" }
+ Property { name: "radius"; type: "float" }
+ Property { name: "length"; type: "float" }
+ Signal {
+ name: "radiusChanged"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Signal {
+ name: "ringsChanged"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Signal {
+ name: "slicesChanged"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Signal {
+ name: "lengthChanged"
+ Parameter { name: "length"; type: "float" }
+ }
+ Method {
+ name: "setRings"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Method {
+ name: "setSlices"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Method {
+ name: "setRadius"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Method {
+ name: "setLength"
+ Parameter { name: "length"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QPlaneGeometry"
+ prototype: "Qt3DRender::QGeometry"
+ exports: ["Qt3D.Extras/PlaneGeometry 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "width"; type: "float" }
+ Property { name: "height"; type: "float" }
+ Property { name: "resolution"; type: "QSize" }
+ Property {
+ name: "positionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "normalAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "texCoordAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "tangentAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "indexAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "resolutionChanged"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "width"; type: "float" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "height"; type: "float" }
+ }
+ Method {
+ name: "setResolution"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "width"; type: "float" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "height"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QPlaneMesh"
+ prototype: "Qt3DRender::QGeometryRenderer"
+ exports: ["Qt3D.Extras/PlaneMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "width"; type: "float" }
+ Property { name: "height"; type: "float" }
+ Property { name: "meshResolution"; type: "QSize" }
+ Signal {
+ name: "meshResolutionChanged"
+ Parameter { name: "meshResolution"; type: "QSize" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "width"; type: "float" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "height"; type: "float" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "width"; type: "float" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "height"; type: "float" }
+ }
+ Method {
+ name: "setMeshResolution"
+ Parameter { name: "resolution"; type: "QSize" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QSphereGeometry"
+ prototype: "Qt3DRender::QGeometry"
+ exports: ["Qt3D.Extras/SphereGeometry 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "rings"; type: "int" }
+ Property { name: "slices"; type: "int" }
+ Property { name: "radius"; type: "float" }
+ Property { name: "generateTangents"; type: "bool" }
+ Property {
+ name: "positionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "normalAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "texCoordAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "tangentAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "indexAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "radiusChanged"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Signal {
+ name: "ringsChanged"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Signal {
+ name: "slicesChanged"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Signal {
+ name: "generateTangentsChanged"
+ Parameter { name: "generateTangents"; type: "bool" }
+ }
+ Method {
+ name: "setRings"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Method {
+ name: "setSlices"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Method {
+ name: "setRadius"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Method {
+ name: "setGenerateTangents"
+ Parameter { name: "gen"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QSphereMesh"
+ prototype: "Qt3DRender::QGeometryRenderer"
+ exports: ["Qt3D.Extras/SphereMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "rings"; type: "int" }
+ Property { name: "slices"; type: "int" }
+ Property { name: "radius"; type: "float" }
+ Property { name: "generateTangents"; type: "bool" }
+ Signal {
+ name: "radiusChanged"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Signal {
+ name: "ringsChanged"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Signal {
+ name: "slicesChanged"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Signal {
+ name: "generateTangentsChanged"
+ Parameter { name: "generateTangents"; type: "bool" }
+ }
+ Method {
+ name: "setRings"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Method {
+ name: "setSlices"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Method {
+ name: "setRadius"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Method {
+ name: "setGenerateTangents"
+ Parameter { name: "gen"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QTorusGeometry"
+ prototype: "Qt3DRender::QGeometry"
+ exports: ["Qt3D.Extras/TorusGeometry 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "rings"; type: "int" }
+ Property { name: "slices"; type: "int" }
+ Property { name: "radius"; type: "float" }
+ Property { name: "minorRadius"; type: "float" }
+ Property {
+ name: "positionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "normalAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "texCoordAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "indexAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "radiusChanged"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Signal {
+ name: "ringsChanged"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Signal {
+ name: "slicesChanged"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Signal {
+ name: "minorRadiusChanged"
+ Parameter { name: "minorRadius"; type: "float" }
+ }
+ Method {
+ name: "setRings"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Method {
+ name: "setSlices"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Method {
+ name: "setRadius"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Method {
+ name: "setMinorRadius"
+ Parameter { name: "minorRadius"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QTorusMesh"
+ prototype: "Qt3DRender::QGeometryRenderer"
+ exports: ["Qt3D.Extras/TorusMesh 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "rings"; type: "int" }
+ Property { name: "slices"; type: "int" }
+ Property { name: "radius"; type: "float" }
+ Property { name: "minorRadius"; type: "float" }
+ Signal {
+ name: "radiusChanged"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Signal {
+ name: "ringsChanged"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Signal {
+ name: "slicesChanged"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Signal {
+ name: "minorRadiusChanged"
+ Parameter { name: "minorRadius"; type: "float" }
+ }
+ Method {
+ name: "setRings"
+ Parameter { name: "rings"; type: "int" }
+ }
+ Method {
+ name: "setSlices"
+ Parameter { name: "slices"; type: "int" }
+ }
+ Method {
+ name: "setRadius"
+ Parameter { name: "radius"; type: "float" }
+ }
+ Method {
+ name: "setMinorRadius"
+ Parameter { name: "minorRadius"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QGeometry"
+ prototype: "Qt3DCore::QNode"
+ Property {
+ name: "boundingVolumePositionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isPointer: true
+ }
+ Signal {
+ name: "boundingVolumePositionAttributeChanged"
+ Parameter { name: "boundingVolumePositionAttribute"; type: "QAttribute"; isPointer: true }
+ }
+ Method {
+ name: "setBoundingVolumePositionAttribute"
+ Parameter { name: "boundingVolumePositionAttribute"; type: "QAttribute"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QGeometryRenderer"
+ prototype: "Qt3DCore::QComponent"
+ Enum {
+ name: "PrimitiveType"
+ values: {
+ "Points": 0,
+ "Lines": 1,
+ "LineLoop": 2,
+ "LineStrip": 3,
+ "Triangles": 4,
+ "TriangleStrip": 5,
+ "TriangleFan": 6,
+ "LinesAdjacency": 10,
+ "TrianglesAdjacency": 12,
+ "LineStripAdjacency": 11,
+ "TriangleStripAdjacency": 13,
+ "Patches": 14
+ }
+ }
+ Property { name: "instanceCount"; type: "int" }
+ Property { name: "vertexCount"; type: "int" }
+ Property { name: "indexOffset"; type: "int" }
+ Property { name: "firstInstance"; type: "int" }
+ Property { name: "restartIndexValue"; type: "int" }
+ Property { name: "verticesPerPatch"; type: "int" }
+ Property { name: "primitiveRestartEnabled"; type: "bool" }
+ Property { name: "geometry"; type: "Qt3DRender::QGeometry"; isPointer: true }
+ Property { name: "primitiveType"; type: "PrimitiveType" }
+ Signal {
+ name: "instanceCountChanged"
+ Parameter { name: "instanceCount"; type: "int" }
+ }
+ Signal {
+ name: "vertexCountChanged"
+ Parameter { name: "vertexCount"; type: "int" }
+ }
+ Signal {
+ name: "indexOffsetChanged"
+ Parameter { name: "indexOffset"; type: "int" }
+ }
+ Signal {
+ name: "firstInstanceChanged"
+ Parameter { name: "firstInstance"; type: "int" }
+ }
+ Signal {
+ name: "restartIndexValueChanged"
+ Parameter { name: "restartIndexValue"; type: "int" }
+ }
+ Signal {
+ name: "verticesPerPatchChanged"
+ Parameter { name: "verticesPerPatch"; type: "int" }
+ }
+ Signal {
+ name: "primitiveRestartEnabledChanged"
+ Parameter { name: "primitiveRestartEnabled"; type: "bool" }
+ }
+ Signal {
+ name: "geometryChanged"
+ Parameter { name: "geometry"; type: "QGeometry"; isPointer: true }
+ }
+ Signal {
+ name: "primitiveTypeChanged"
+ Parameter { name: "primitiveType"; type: "PrimitiveType" }
+ }
+ Method {
+ name: "setInstanceCount"
+ Parameter { name: "instanceCount"; type: "int" }
+ }
+ Method {
+ name: "setVertexCount"
+ Parameter { name: "vertexCount"; type: "int" }
+ }
+ Method {
+ name: "setIndexOffset"
+ Parameter { name: "indexOffset"; type: "int" }
+ }
+ Method {
+ name: "setFirstInstance"
+ Parameter { name: "firstInstance"; type: "int" }
+ }
+ Method {
+ name: "setRestartIndexValue"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "setVerticesPerPatch"
+ Parameter { name: "verticesPerPatch"; type: "int" }
+ }
+ Method {
+ name: "setPrimitiveRestartEnabled"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Method {
+ name: "setGeometry"
+ Parameter { name: "geometry"; type: "QGeometry"; isPointer: true }
+ }
+ Method {
+ name: "setPrimitiveType"
+ Parameter { name: "primitiveType"; type: "PrimitiveType" }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/DiffuseMapMaterial 2.0"
+ exports: ["Qt3D.Extras/DiffuseMapMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "ambient"; type: "QColor" }
+ Property { name: "specular"; type: "QColor" }
+ Property { name: "shininess"; type: "double" }
+ Property { name: "textureScale"; type: "double" }
+ Property { name: "diffuse"; type: "QUrl" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/DiffuseSpecularMapMaterial 2.0"
+ exports: ["Qt3D.Extras/DiffuseSpecularMapMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "ambient"; type: "QColor" }
+ Property { name: "shininess"; type: "double" }
+ Property { name: "textureScale"; type: "double" }
+ Property { name: "diffuse"; type: "QUrl" }
+ Property { name: "specular"; type: "QUrl" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QNode"
+ name: "Qt3D.Extras/FirstPersonCameraController 2.0"
+ exports: ["Qt3D.Extras/FirstPersonCameraController 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "camera"; type: "Qt3DRender::QCamera"; isPointer: true }
+ Property { name: "linearSpeed"; type: "double" }
+ Property { name: "lookSpeed"; type: "double" }
+ }
+ Component {
+ prototype: "Qt3DCore::QNode"
+ name: "Qt3D.Extras/ForwardRenderer 2.0"
+ exports: ["Qt3D.Extras/ForwardRenderer 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "camera"; type: "Qt3DCore::QEntity"; isPointer: true }
+ Property { name: "clearColor"; type: "QColor" }
+ Property { name: "viewportRect"; type: "QRectF" }
+ Property { name: "window"; type: "QObject"; isPointer: true }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/GoochMaterial 2.0"
+ exports: ["Qt3D.Extras/GoochMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "diffuse"; type: "QColor" }
+ Property { name: "specular"; type: "QColor" }
+ Property { name: "coolColor"; type: "QColor" }
+ Property { name: "warmColor"; type: "QColor" }
+ Property { name: "alpha"; type: "double" }
+ Property { name: "beta"; type: "double" }
+ Property { name: "shininess"; type: "double" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/NormalDiffuseMapAlphaMaterial 2.0"
+ exports: ["Qt3D.Extras/NormalDiffuseMapAlphaMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "ambient"; type: "QColor" }
+ Property { name: "specular"; type: "QColor" }
+ Property { name: "shininess"; type: "double" }
+ Property { name: "textureScale"; type: "double" }
+ Property { name: "diffuse"; type: "QUrl" }
+ Property { name: "normal"; type: "QUrl" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/NormalDiffuseMapMaterial 2.0"
+ exports: ["Qt3D.Extras/NormalDiffuseMapMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "ambient"; type: "QColor" }
+ Property { name: "specular"; type: "QColor" }
+ Property { name: "shininess"; type: "double" }
+ Property { name: "textureScale"; type: "double" }
+ Property { name: "diffuse"; type: "QUrl" }
+ Property { name: "normal"; type: "QUrl" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/NormalDiffuseSpecularMapMaterial 2.0"
+ exports: ["Qt3D.Extras/NormalDiffuseSpecularMapMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "ambient"; type: "QColor" }
+ Property { name: "shininess"; type: "double" }
+ Property { name: "textureScale"; type: "double" }
+ Property { name: "diffuse"; type: "QUrl" }
+ Property { name: "specular"; type: "QUrl" }
+ Property { name: "normal"; type: "QUrl" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QNode"
+ name: "Qt3D.Extras/OrbitController 2.0"
+ exports: ["Qt3D.Extras/OrbitController 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "camera"; type: "Qt3DRender::QCamera"; isPointer: true }
+ Property { name: "linearSpeed"; type: "double" }
+ Property { name: "lookSpeed"; type: "double" }
+ Property { name: "zoomLimit"; type: "double" }
+ Method {
+ name: "clampInputs"
+ type: "QVariant"
+ Parameter { name: "input1"; type: "QVariant" }
+ Parameter { name: "input2"; type: "QVariant" }
+ }
+ Method {
+ name: "zoomDistance"
+ type: "QVariant"
+ Parameter { name: "firstPoint"; type: "QVariant" }
+ Parameter { name: "secondPoint"; type: "QVariant" }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/PerVertexColorMaterial 2.0"
+ exports: ["Qt3D.Extras/PerVertexColorMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/PhongAlphaMaterial 2.0"
+ exports: ["Qt3D.Extras/PhongAlphaMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "ambient"; type: "QColor" }
+ Property { name: "diffuse"; type: "QColor" }
+ Property { name: "specular"; type: "QColor" }
+ Property { name: "shininess"; type: "double" }
+ Property { name: "alpha"; type: "double" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/PhongMaterial 2.0"
+ exports: ["Qt3D.Extras/PhongMaterial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "ambient"; type: "QColor" }
+ Property { name: "diffuse"; type: "QColor" }
+ Property { name: "specular"; type: "QColor" }
+ Property { name: "shininess"; type: "double" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ prototype: "Qt3DCore::QNode"
+ name: "Qt3D.Extras/SkyboxEntity 2.0"
+ exports: ["Qt3D.Extras/SkyboxEntity 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "baseName"; type: "string" }
+ Property { name: "extension"; type: "string" }
+ Property { name: "skyboxTexture"; type: "Qt3DRender::QTextureCubeMap"; isPointer: true }
+ Property { name: "cameraPosition"; type: "QVector3D" }
+ }
+}
diff --git a/src/quick3d/imports/extras/qmldir b/src/quick3d/imports/extras/qmldir
new file mode 100644
index 000000000..ef98fe68f
--- /dev/null
+++ b/src/quick3d/imports/extras/qmldir
@@ -0,0 +1,4 @@
+module Qt3D.Extras
+plugin quick3dextrasplugin
+classname Qt3DQuick3DExtrasPlugin
+depends Qt3D.Logic 2.0
diff --git a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
new file mode 100644
index 000000000..c9e3cdfc9
--- /dev/null
+++ b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qt3dquick3dextrasplugin.h"
+#include <Qt3DExtras/qcuboidmesh.h>
+#include <Qt3DExtras/qconemesh.h>
+#include <Qt3DExtras/qcylindermesh.h>
+#include <Qt3DExtras/qplanemesh.h>
+#include <Qt3DExtras/qspheremesh.h>
+#include <Qt3DExtras/qtorusmesh.h>
+#include <Qt3DExtras/qtorusgeometry.h>
+#include <Qt3DExtras/qspheregeometry.h>
+#include <Qt3DExtras/qcuboidgeometry.h>
+#include <Qt3DExtras/qplanegeometry.h>
+#include <Qt3DExtras/qconegeometry.h>
+#include <Qt3DExtras/qcylindergeometry.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+static const struct {
+ const char *type;
+ int major, minor;
+} qmldir [] = {
+ // Materials
+ { "PhongMaterial", 2, 0 },
+ { "PhongAlphaMaterial", 2, 0 },
+ { "DiffuseMapMaterial", 2, 0 },
+ { "DiffuseSpecularMapMaterial", 2, 0 },
+ { "NormalDiffuseMapAlphaMaterial", 2, 0 },
+ { "NormalDiffuseMapMaterial", 2, 0 },
+ { "NormalDiffuseSpecularMapMaterial", 2, 0 },
+ { "PerVertexColorMaterial", 2, 0 },
+ { "GoochMaterial", 2, 0 },
+ { "TextureMaterial", 2, 0 },
+ // FrameGraphs
+ { "ForwardRenderer", 2, 0 },
+ // Entities
+ { "SkyboxEntity", 2, 0 },
+ // Camera Controllers
+ { "OrbitCameraController", 2, 0 },
+ { "FirstPersonCameraController", 2, 0 },
+};
+
+void Qt3DQuick3DExtrasPlugin::registerTypes(const char *uri)
+{
+ // Meshes
+ qmlRegisterType<Qt3DExtras::QConeMesh>(uri, 2, 0, "ConeMesh");
+ qmlRegisterType<Qt3DExtras::QConeGeometry>(uri, 2, 0, "ConeGeometry");
+ qmlRegisterType<Qt3DExtras::QCuboidMesh>(uri, 2, 0, "CuboidMesh");
+ qmlRegisterType<Qt3DExtras::QCuboidGeometry>(uri, 2, 0, "CuboidGeometry");
+ qmlRegisterType<Qt3DExtras::QCylinderMesh>(uri, 2, 0, "CylinderMesh");
+ qmlRegisterType<Qt3DExtras::QCylinderGeometry>(uri, 2, 0, "CylinderGeometry");
+ qmlRegisterType<Qt3DExtras::QPlaneMesh>(uri, 2, 0, "PlaneMesh");
+ qmlRegisterType<Qt3DExtras::QPlaneGeometry>(uri, 2, 0, "PlaneGeometry");
+ qmlRegisterType<Qt3DExtras::QTorusMesh>(uri, 2, 0, "TorusMesh");
+ qmlRegisterType<Qt3DExtras::QTorusGeometry>(uri, 2, 0, "TorusGeometry");
+ qmlRegisterType<Qt3DExtras::QSphereMesh>(uri, 2, 0, "SphereMesh");
+ qmlRegisterType<Qt3DExtras::QSphereGeometry>(uri, 2, 0, "SphereGeometry");
+
+
+ // Register types provided as QML files compiled into the plugin
+ for (int i = 0; i < int(sizeof(qmldir) / sizeof(qmldir[0])); i++) {
+ auto path = QLatin1String("qrc:/qt-project.org/imports/Qt3D/Extras/defaults/qml/");
+ qmlRegisterType(QUrl(path + qmldir[i].type + QLatin1String(".qml")),
+ uri,
+ qmldir[i].major, qmldir[i].minor,
+ qmldir[i].type);
+ }
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.h b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.h
new file mode 100644
index 000000000..8421c6eb4
--- /dev/null
+++ b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DQUICK3DEXTRASPLUGIN_H
+#define QT3DQUICK3DEXTRASPLUGIN_H
+
+#include <QtQml/QQmlExtensionPlugin>
+
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt3D_Extras);
+ Q_INIT_RESOURCE(defaults);
+ Q_INIT_RESOURCE(extras);
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+class Qt3DQuick3DExtrasPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
+public:
+ Qt3DQuick3DExtrasPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); }
+ void registerTypes(const char *uri) Q_DECL_OVERRIDE;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT3DQUICK3DEXTRASPLUGIN_H
diff --git a/src/quick3d/imports/input/importsinput.pro b/src/quick3d/imports/input/importsinput.pro
index 7f99b17c1..83a7797f9 100644
--- a/src/quick3d/imports/input/importsinput.pro
+++ b/src/quick3d/imports/input/importsinput.pro
@@ -1,9 +1,13 @@
CXX_MODULE = qml
TARGET = quick3dinputplugin
TARGETPATH = Qt3D/Input
+IMPORT_VERSION = 2.0
QT += core-private qml 3dcore 3dinput 3dinput-private 3dquickinput-private
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
OTHER_FILES += qmldir
HEADERS += \
@@ -12,4 +16,6 @@ HEADERS += \
SOURCES += \
qt3dquick3dinputplugin.cpp
+qtHaveModule(gamepad): DEFINES += HAVE_QGAMEPAD
+
load(qml_plugin)
diff --git a/src/quick3d/imports/input/plugins.qmltypes b/src/quick3d/imports/input/plugins.qmltypes
new file mode 100644
index 000000000..faa8ea944
--- /dev/null
+++ b/src/quick3d/imports/input/plugins.qmltypes
@@ -0,0 +1,675 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable Qt3D.Input 2.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component {
+ name: "Qt3DCore::QComponent"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "isShareable"; type: "bool" }
+ Signal {
+ name: "shareableChanged"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ Method {
+ name: "setShareable"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DCore::QNode"
+ prototype: "QObject"
+ Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Signal {
+ name: "parentChanged"
+ Parameter { name: "parent"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "enabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Method {
+ name: "setParent"
+ Parameter { name: "parent"; type: "QNode"; isPointer: true }
+ }
+ Method {
+ name: "setEnabled"
+ Parameter { name: "isEnabled"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::Input::Quick::Quick3DAction"
+ defaultProperty: "inputs"
+ prototype: "Qt3DInput::QAction"
+ exports: ["Qt3D.Input/Action 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "inputs"
+ type: "Qt3DInput::QAbstractActionInput"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DInput::Input::Quick::Quick3DAxis"
+ defaultProperty: "inputs"
+ prototype: "Qt3DInput::QAxis"
+ exports: ["Qt3D.Input/Axis 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "inputs"; type: "Qt3DInput::QAbstractAxisInput"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DInput::Input::Quick::Quick3DInputChord"
+ prototype: "Qt3DInput::QInputChord"
+ exports: ["Qt3D.Input/InputChord 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "chords"
+ type: "Qt3DInput::QAbstractActionInput"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DInput::Input::Quick::Quick3DInputSequence"
+ prototype: "Qt3DInput::QInputSequence"
+ exports: ["Qt3D.Input/InputSequence 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "sequences"
+ type: "Qt3DInput::QAbstractActionInput"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DInput::Input::Quick::Quick3DLogicalDevice"
+ prototype: "Qt3DInput::QLogicalDevice"
+ exports: ["Qt3D.Input/LogicalDevice 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "axes"; type: "Qt3DInput::QAxis"; isList: true; isReadonly: true }
+ Property { name: "actions"; type: "Qt3DInput::QAction"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DInput::Input::Quick::Quick3DPhysicalDevice"
+ prototype: "Qt3DInput::QAbstractPhysicalDevice"
+ exports: ["Qt3D.Input/QAbstractPhysicalDevice 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "axisSettings"; type: "Qt3DInput::QAxisSetting"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DInput::QAbstractActionInput"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Input/AbstractActionInput 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "Qt3DInput::QAbstractAxisInput"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Input/AbstractAxisInput 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "sourceDevice"; type: "Qt3DInput::QAbstractPhysicalDevice"; isPointer: true }
+ Signal {
+ name: "sourceDeviceChanged"
+ Parameter { name: "sourceDevice"; type: "QAbstractPhysicalDevice"; isPointer: true }
+ }
+ Method {
+ name: "setSourceDevice"
+ Parameter { name: "sourceDevice"; type: "QAbstractPhysicalDevice"; isPointer: true }
+ }
+ }
+ Component { name: "Qt3DInput::QAbstractPhysicalDevice"; prototype: "Qt3DCore::QNode" }
+ Component {
+ name: "Qt3DInput::QAction"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "active"; type: "bool"; isReadonly: true }
+ Signal {
+ name: "activeChanged"
+ Parameter { name: "isActive"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QActionInput"
+ prototype: "Qt3DInput::QAbstractActionInput"
+ exports: ["Qt3D.Input/ActionInput 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "sourceDevice"; type: "Qt3DInput::QAbstractPhysicalDevice"; isPointer: true }
+ Property { name: "buttons"; type: "QVector<int>" }
+ Signal {
+ name: "sourceDeviceChanged"
+ Parameter { name: "sourceDevice"; type: "QAbstractPhysicalDevice"; isPointer: true }
+ }
+ Signal {
+ name: "buttonsChanged"
+ Parameter { name: "buttons"; type: "QVector<int>" }
+ }
+ Method {
+ name: "setSourceDevice"
+ Parameter { name: "sourceDevice"; type: "QAbstractPhysicalDevice"; isPointer: true }
+ }
+ Method {
+ name: "setButtons"
+ Parameter { name: "buttons"; type: "QVector<int>" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QAnalogAxisInput"
+ prototype: "Qt3DInput::QAbstractAxisInput"
+ exports: ["Qt3D.Input/AnalogAxisInput 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "axis"; type: "int" }
+ Signal {
+ name: "axisChanged"
+ Parameter { name: "axis"; type: "int" }
+ }
+ Method {
+ name: "setAxis"
+ Parameter { name: "axis"; type: "int" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QAxis"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "value"; type: "float"; isReadonly: true }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QAxisSetting"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Input/AxisSetting 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "deadZoneRadius"; type: "float" }
+ Property { name: "axes"; type: "QVariantList" }
+ Property { name: "smooth"; type: "bool" }
+ Signal {
+ name: "deadZoneRadiusChanged"
+ Parameter { name: "deadZoneRadius"; type: "float" }
+ }
+ Signal {
+ name: "axesChanged"
+ Parameter { name: "axes"; type: "QVariantList" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { name: "smooth"; type: "bool" }
+ }
+ Method {
+ name: "setDeadZoneRadius"
+ Parameter { name: "deadZoneRadius"; type: "float" }
+ }
+ Method {
+ name: "setAxes"
+ Parameter { name: "axes"; type: "QVariantList" }
+ }
+ Method {
+ name: "setSmoothEnabled"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QButtonAxisInput"
+ prototype: "Qt3DInput::QAbstractAxisInput"
+ exports: ["Qt3D.Input/ButtonAxisInput 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "scale"; type: "float" }
+ Property { name: "buttons"; type: "QVector<int>" }
+ Property { name: "acceleration"; type: "float" }
+ Property { name: "deceleration"; type: "float" }
+ Signal {
+ name: "scaleChanged"
+ Parameter { name: "scale"; type: "float" }
+ }
+ Signal {
+ name: "buttonsChanged"
+ Parameter { name: "buttons"; type: "QVector<int>" }
+ }
+ Signal {
+ name: "accelerationChanged"
+ Parameter { name: "acceleration"; type: "float" }
+ }
+ Signal {
+ name: "decelerationChanged"
+ Parameter { name: "deceleration"; type: "float" }
+ }
+ Method {
+ name: "setScale"
+ Parameter { name: "scale"; type: "float" }
+ }
+ Method {
+ name: "setButtons"
+ Parameter { name: "buttons"; type: "QVector<int>" }
+ }
+ Method {
+ name: "setAcceleration"
+ Parameter { name: "acceleration"; type: "float" }
+ }
+ Method {
+ name: "setDeceleration"
+ Parameter { name: "deceleration"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QGamepadInput"
+ prototype: "Qt3DInput::QAbstractPhysicalDevice"
+ Property { name: "deviceId"; type: "int" }
+ }
+ Component {
+ name: "Qt3DInput::QInputChord"
+ prototype: "Qt3DInput::QAbstractActionInput"
+ Property { name: "timeout"; type: "int" }
+ Signal {
+ name: "timeoutChanged"
+ Parameter { name: "timeout"; type: "int" }
+ }
+ Method {
+ name: "setTimeout"
+ Parameter { name: "timeout"; type: "int" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QInputSequence"
+ prototype: "Qt3DInput::QAbstractActionInput"
+ Property { name: "timeout"; type: "int" }
+ Property { name: "buttonInterval"; type: "int" }
+ Signal {
+ name: "timeoutChanged"
+ Parameter { name: "timeout"; type: "int" }
+ }
+ Signal {
+ name: "buttonIntervalChanged"
+ Parameter { name: "buttonInterval"; type: "int" }
+ }
+ Method {
+ name: "setTimeout"
+ Parameter { name: "timeout"; type: "int" }
+ }
+ Method {
+ name: "setButtonInterval"
+ Parameter { name: "buttonInterval"; type: "int" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QInputSettings"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Input/InputSettings 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "eventSource"; type: "QObject"; isPointer: true }
+ Signal {
+ name: "eventSourceChanged"
+ Parameter { type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "setEventSource"
+ Parameter { name: "eventSource"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QKeyEvent"
+ prototype: "QObject"
+ exports: ["Qt3D.Input/KeyEvent 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "key"; type: "int"; isReadonly: true }
+ Property { name: "text"; type: "string"; isReadonly: true }
+ Property { name: "modifiers"; type: "int"; isReadonly: true }
+ Property { name: "isAutoRepeat"; type: "bool"; isReadonly: true }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "nativeScanCode"; type: "uint"; isReadonly: true }
+ Property { name: "accepted"; type: "bool" }
+ Method {
+ name: "matches"
+ type: "bool"
+ Parameter { name: "key_"; type: "QKeySequence::StandardKey" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QKeyboardDevice"
+ prototype: "Qt3DInput::QAbstractPhysicalDevice"
+ Property {
+ name: "activeInput"
+ type: "Qt3DInput::QKeyboardHandler"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "activeInputChanged"
+ Parameter { name: "activeInput"; type: "QKeyboardHandler"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QKeyboardHandler"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Input/KeyboardHandler 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "sourceDevice"; type: "Qt3DInput::QKeyboardDevice"; isPointer: true }
+ Property { name: "focus"; type: "bool" }
+ Signal {
+ name: "sourceDeviceChanged"
+ Parameter { name: "keyboardDevice"; type: "QKeyboardDevice"; isPointer: true }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { name: "focus"; type: "bool" }
+ }
+ Signal {
+ name: "digit0Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit1Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit2Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit3Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit4Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit5Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit6Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit7Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit8Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "digit9Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "leftPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "rightPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "upPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "downPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "tabPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "backtabPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "asteriskPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "numberSignPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "escapePressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "returnPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "enterPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "deletePressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "spacePressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "backPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "cancelPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "selectPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "yesPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "noPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context1Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context2Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context3Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "context4Pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "callPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "hangupPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "flipPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "menuPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "volumeUpPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "volumeDownPressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pressed"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "event"; type: "Qt3DInput::QKeyEvent"; isPointer: true }
+ }
+ Method {
+ name: "setSourceDevice"
+ Parameter { name: "keyboardDevice"; type: "Qt3DInput::QKeyboardDevice"; isPointer: true }
+ }
+ Method {
+ name: "setFocus"
+ Parameter { name: "focus"; type: "bool" }
+ }
+ }
+ Component { name: "Qt3DInput::QLogicalDevice"; prototype: "Qt3DCore::QComponent" }
+ Component {
+ name: "Qt3DInput::QMouseDevice"
+ prototype: "Qt3DInput::QAbstractPhysicalDevice"
+ Enum {
+ name: "Axis"
+ values: {
+ "X": 0,
+ "Y": 1
+ }
+ }
+ Property { name: "sensitivity"; type: "float" }
+ Signal {
+ name: "sensitivityChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Method {
+ name: "setSensitivity"
+ Parameter { name: "value"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QMouseEvent"
+ prototype: "QObject"
+ exports: ["Qt3D.Input/MouseEvent 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Buttons"
+ values: {
+ "LeftButton": 1,
+ "RightButton": 2,
+ "MiddleButton": 4,
+ "BackButton": 8,
+ "NoButton": 0
+ }
+ }
+ Enum {
+ name: "Modifiers"
+ values: {
+ "NoModifier": 0,
+ "ShiftModifier": 33554432,
+ "ControlModifier": 67108864,
+ "AltModifier": 134217728,
+ "MetaModifier": 268435456,
+ "KeypadModifier": 536870912
+ }
+ }
+ Property { name: "x"; type: "int"; isReadonly: true }
+ Property { name: "y"; type: "int"; isReadonly: true }
+ Property { name: "wasHeld"; type: "bool"; isReadonly: true }
+ Property { name: "button"; type: "Qt3DInput::QMouseEvent::Buttons"; isReadonly: true }
+ Property { name: "buttons"; type: "int"; isReadonly: true }
+ Property { name: "modifiers"; type: "Qt3DInput::QMouseEvent::Modifiers"; isReadonly: true }
+ Property { name: "accepted"; type: "bool" }
+ }
+ Component {
+ name: "Qt3DInput::QMouseHandler"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Input/MouseHandler 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "sourceDevice"; type: "Qt3DInput::QMouseDevice"; isPointer: true }
+ Property { name: "containsMouse"; type: "bool"; isReadonly: true }
+ Signal {
+ name: "sourceDeviceChanged"
+ Parameter { name: "mouseDevice"; type: "QMouseDevice"; isPointer: true }
+ }
+ Signal {
+ name: "containsMouseChanged"
+ Parameter { name: "containsMouse"; type: "bool" }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "mouse"; type: "Qt3DInput::QMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "doubleClicked"
+ Parameter { name: "mouse"; type: "Qt3DInput::QMouseEvent"; isPointer: true }
+ }
+ Signal { name: "entered" }
+ Signal { name: "exited" }
+ Signal {
+ name: "pressed"
+ Parameter { name: "mouse"; type: "Qt3DInput::QMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "mouse"; type: "Qt3DInput::QMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "pressAndHold"
+ Parameter { name: "mouse"; type: "Qt3DInput::QMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "mouse"; type: "Qt3DInput::QMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "wheel"
+ Parameter { name: "wheel"; type: "Qt3DInput::QWheelEvent"; isPointer: true }
+ }
+ Method {
+ name: "setSourceDevice"
+ Parameter { name: "mouseDevice"; type: "QMouseDevice"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DInput::QWheelEvent"
+ prototype: "QObject"
+ exports: ["Qt3D.Input/WheelEvent 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Buttons"
+ values: {
+ "LeftButton": 1,
+ "RightButton": 2,
+ "MiddleButton": 4,
+ "BackButton": 8,
+ "NoButton": 0
+ }
+ }
+ Enum {
+ name: "Modifiers"
+ values: {
+ "NoModifier": 0,
+ "ShiftModifier": 33554432,
+ "ControlModifier": 67108864,
+ "AltModifier": 134217728,
+ "MetaModifier": 268435456,
+ "KeypadModifier": 536870912
+ }
+ }
+ Property { name: "x"; type: "int"; isReadonly: true }
+ Property { name: "y"; type: "int"; isReadonly: true }
+ Property { name: "angleDelta"; type: "QPoint"; isReadonly: true }
+ Property { name: "buttons"; type: "int"; isReadonly: true }
+ Property { name: "modifiers"; type: "Qt3DInput::QWheelEvent::Modifiers"; isReadonly: true }
+ Property { name: "accepted"; type: "bool" }
+ }
+}
diff --git a/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp b/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
index 072066b54..a403c38f5 100644
--- a/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
+++ b/src/quick3d/imports/input/qt3dquick3dinputplugin.cpp
@@ -1,60 +1,73 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtQml>
-#include <Qt3DInput/qkeyboardcontroller.h>
-#include <Qt3DInput/qkeyboardinput.h>
+#include <Qt3DInput/qkeyboarddevice.h>
+#include <Qt3DInput/qkeyboardhandler.h>
#include <Qt3DInput/qkeyevent.h>
-#include <Qt3DInput/qmousecontroller.h>
-#include <Qt3DInput/qmouseinput.h>
+#include <Qt3DInput/qmousedevice.h>
+#include <Qt3DInput/qmousehandler.h>
#include <Qt3DInput/qmouseevent.h>
#include <Qt3DInput/qaxis.h>
-#include <Qt3DInput/qaxisinput.h>
#include <Qt3DInput/qaxissetting.h>
#include <Qt3DInput/qaction.h>
-#include <Qt3DInput/qaxisactionhandler.h>
#include <Qt3DInput/qactioninput.h>
+#include <Qt3DInput/qanalogaxisinput.h>
+#include <Qt3DInput/qbuttonaxisinput.h>
+#include <Qt3DInput/qinputsequence.h>
+#include <Qt3DInput/qinputchord.h>
#include <Qt3DInput/qlogicaldevice.h>
#include <Qt3DInput/qabstractphysicaldevice.h>
+#include <Qt3DInput/qinputsettings.h>
+#include <Qt3DInput/private/qgenericinputdevice_p.h>
#include <Qt3DQuickInput/private/quick3daxis_p.h>
#include <Qt3DQuickInput/private/quick3daction_p.h>
+#include <Qt3DQuickInput/private/quick3dinputchord_p.h>
+#include <Qt3DQuickInput/private/quick3dinputsequence_p.h>
#include <Qt3DQuickInput/private/quick3dlogicaldevice_p.h>
#include <Qt3DQuickInput/private/quick3dphysicaldevice_p.h>
+#ifdef HAVE_QGAMEPAD
+# include <Qt3DInput/private/qgamepadinput_p.h>
+#endif
+
#include "qt3dquick3dinputplugin.h"
QT_BEGIN_NAMESPACE
@@ -62,22 +75,31 @@ QT_BEGIN_NAMESPACE
void Qt3DQuick3DInputPlugin::registerTypes(const char *uri)
{
qmlRegisterUncreatableType<Qt3DInput::QKeyEvent>(uri, 2, 0, "KeyEvent", QStringLiteral("Events cannot be created"));
- qmlRegisterType<Qt3DInput::QKeyboardController>(uri, 2, 0, "KeyboardController");
- qmlRegisterType<Qt3DInput::QKeyboardInput>(uri, 2, 0, "KeyboardInput");
+ qmlRegisterType<Qt3DInput::QKeyboardDevice>(uri, 2, 0, "KeyboardDevice");
+ qmlRegisterType<Qt3DInput::QKeyboardHandler>(uri, 2, 0, "KeyboardHandler");
+ qmlRegisterType<Qt3DInput::QInputSettings>(uri, 2, 0, "InputSettings");
qmlRegisterUncreatableType<Qt3DInput::QMouseEvent>(uri, 2, 0, "MouseEvent", QStringLiteral("Events cannot be created"));
qmlRegisterUncreatableType<Qt3DInput::QWheelEvent>(uri, 2, 0, "WheelEvent", QStringLiteral("Events cannot be created"));
- qmlRegisterType<Qt3DInput::QMouseInput>(uri, 2, 0, "MouseInput");
- qmlRegisterType<Qt3DInput::QMouseController>(uri, 2, 0, "MouseController");
+ qmlRegisterType<Qt3DInput::QMouseHandler>(uri, 2, 0, "MouseHandler");
+ qmlRegisterType<Qt3DInput::QMouseDevice>(uri, 2, 0, "MouseDevice");
qmlRegisterExtendedType<Qt3DInput::QLogicalDevice, Qt3DInput::Input::Quick::Quick3DLogicalDevice>(uri, 2, 0, "LogicalDevice");
- qmlRegisterType<Qt3DInput::QAxisActionHandler>(uri, 2, 0, "AxisActionHandler");
+ qmlRegisterUncreatableType<Qt3DInput::QAbstractActionInput>(uri, 2, 0, "AbstractActionInput", QStringLiteral("AbstractActionInput is abstract"));
qmlRegisterType<Qt3DInput::QActionInput>(uri, 2, 0, "ActionInput");
- qmlRegisterType<Qt3DInput::QAxisInput>(uri, 2, 0, "AxisInput");
+ qmlRegisterUncreatableType<Qt3DInput::QAbstractAxisInput>(uri, 2, 0, "AbstractAxisInput", QStringLiteral("AbstractAxisInput is abstract"));
qmlRegisterType<Qt3DInput::QAxisSetting>(uri, 2, 0, "AxisSetting");
+ qmlRegisterType<Qt3DInput::QAnalogAxisInput>(uri, 2, 0, "AnalogAxisInput");
+ qmlRegisterType<Qt3DInput::QButtonAxisInput>(uri, 2, 0, "ButtonAxisInput");
qmlRegisterExtendedType<Qt3DInput::QAxis, Qt3DInput::Input::Quick::Quick3DAxis>(uri, 2, 0, "Axis");
qmlRegisterExtendedType<Qt3DInput::QAction, Qt3DInput::Input::Quick::Quick3DAction>(uri, 2, 0, "Action");
+ qmlRegisterExtendedType<Qt3DInput::QInputSequence, Qt3DInput::Input::Quick::Quick3DInputSequence>(uri, 2, 0, "InputSequence");
+ qmlRegisterExtendedType<Qt3DInput::QInputChord, Qt3DInput::Input::Quick::Quick3DInputChord>(uri, 2, 0, "InputChord");
qmlRegisterExtendedUncreatableType<Qt3DInput::QAbstractPhysicalDevice, Qt3DInput::Input::Quick::Quick3DPhysicalDevice>(uri, 2, 0, "QAbstractPhysicalDevice", QStringLiteral("QAbstractPhysicalDevice is abstract"));
+
+#ifdef HAVE_QGAMEPAD
+ qmlRegisterType<Qt3DInput::QGamepadInput>(uri, 2, 0, "GamepadInput");
+#endif
}
QT_END_NAMESPACE
diff --git a/src/quick3d/imports/input/qt3dquick3dinputplugin.h b/src/quick3d/imports/input/qt3dquick3dinputplugin.h
index 0c4ed6911..d644614e7 100644
--- a/src/quick3d/imports/input/qt3dquick3dinputplugin.h
+++ b/src/quick3d/imports/input/qt3dquick3dinputplugin.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,6 +42,13 @@
#include <QtQml/QQmlExtensionPlugin>
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt3D_Input);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class Qt3DQuick3DInputPlugin : public QQmlExtensionPlugin
@@ -46,6 +56,7 @@ class Qt3DQuick3DInputPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ Qt3DQuick3DInputPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); }
void registerTypes(const char *uri) Q_DECL_OVERRIDE;
};
diff --git a/src/quick3d/imports/logic/importslogic.pro b/src/quick3d/imports/logic/importslogic.pro
index 90f9f2445..c2b33f665 100644
--- a/src/quick3d/imports/logic/importslogic.pro
+++ b/src/quick3d/imports/logic/importslogic.pro
@@ -1,9 +1,13 @@
CXX_MODULE = qml
TARGET = quick3dlogicplugin
TARGETPATH = Qt3D/Logic
+IMPORT_VERSION = 2.0
QT += core-private qml 3dcore 3dlogic
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
OTHER_FILES += qmldir
HEADERS += \
diff --git a/src/quick3d/imports/logic/plugins.qmltypes b/src/quick3d/imports/logic/plugins.qmltypes
new file mode 100644
index 000000000..036ca96f3
--- /dev/null
+++ b/src/quick3d/imports/logic/plugins.qmltypes
@@ -0,0 +1,56 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable Qt3D.Logic 2.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component {
+ name: "Qt3DCore::QComponent"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "isShareable"; type: "bool" }
+ Signal {
+ name: "shareableChanged"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ Method {
+ name: "setShareable"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DCore::QNode"
+ prototype: "QObject"
+ Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Signal {
+ name: "parentChanged"
+ Parameter { name: "parent"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "enabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Method {
+ name: "setParent"
+ Parameter { name: "parent"; type: "QNode"; isPointer: true }
+ }
+ Method {
+ name: "setEnabled"
+ Parameter { name: "isEnabled"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DLogic::QFrameAction"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Logic/FrameAction 2.0"]
+ exportMetaObjectRevisions: [0]
+ Signal {
+ name: "triggered"
+ Parameter { name: "dt"; type: "float" }
+ }
+ }
+}
diff --git a/src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp b/src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp
index 48378b01e..3f96928b7 100644
--- a/src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp
+++ b/src/quick3d/imports/logic/qt3dquick3dlogicplugin.cpp
@@ -1,48 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtQml>
-#include <Qt3DLogic/qlogiccomponent.h>
+#include <Qt3DLogic/qframeaction.h>
#include "qt3dquick3dlogicplugin.h"
QT_BEGIN_NAMESPACE
void Qt3DQuick3DLogicPlugin::registerTypes(const char *uri)
{
- qmlRegisterType<Qt3DLogic::QLogicComponent>(uri, 2, 0, "LogicComponent");
+ qmlRegisterType<Qt3DLogic::QFrameAction>(uri, 2, 0, "FrameAction");
}
QT_END_NAMESPACE
diff --git a/src/quick3d/imports/logic/qt3dquick3dlogicplugin.h b/src/quick3d/imports/logic/qt3dquick3dlogicplugin.h
index c7ff8489f..203bc41b2 100644
--- a/src/quick3d/imports/logic/qt3dquick3dlogicplugin.h
+++ b/src/quick3d/imports/logic/qt3dquick3dlogicplugin.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,6 +42,13 @@
#include <QtQml/QQmlExtensionPlugin>
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt3D_Logic);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class Qt3DQuick3DLogicPlugin : public QQmlExtensionPlugin
@@ -46,6 +56,7 @@ class Qt3DQuick3DLogicPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ Qt3DQuick3DLogicPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
void registerTypes(const char *uri) Q_DECL_OVERRIDE;
};
diff --git a/src/quick3d/imports/render/defaults/defaults.pri b/src/quick3d/imports/render/defaults/defaults.pri
deleted file mode 100644
index 5487dac49..000000000
--- a/src/quick3d/imports/render/defaults/defaults.pri
+++ /dev/null
@@ -1,19 +0,0 @@
-# When adding new QML files that should be built into the plugin,
-# add them to this variable and they will be listed into a generated
-# resource file.
-#
-# To have the plugin register them as types, add an entries to the
-# qmldir array in qt3dquick3drenderplugin.cpp
-QML_FILES = \
- $$PWD/qml/PhongMaterial.qml \
- $$PWD/qml/DiffuseMapMaterial.qml \
- $$PWD/qml/DiffuseSpecularMapMaterial.qml \
- $$PWD/qml/NormalDiffuseMapMaterial.qml \
- $$PWD/qml/NormalDiffuseMapAlphaMaterial.qml \
- $$PWD/qml/NormalDiffuseSpecularMapMaterial.qml \
- $$PWD/qml/ForwardRenderer.qml \
- $$PWD/qml/PerVertexColorMaterial.qml \
- $$PWD/qml/SkyboxEntity.qml \
- $$PWD/qml/GoochMaterial.qml \
- $$PWD/qml/PhongAlphaMaterial.qml \
- $$PWD/qml/TextureMaterial.qml
diff --git a/src/quick3d/imports/render/defaults/qml/DiffuseMapMaterial.qml b/src/quick3d/imports/render/defaults/qml/DiffuseMapMaterial.qml
deleted file mode 100644
index 49b7729fc..000000000
--- a/src/quick3d/imports/render/defaults/qml/DiffuseMapMaterial.qml
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id: root
-
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property alias diffuse: diffuseTextureImage.source
- property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
- property real shininess: 150.0
- property real textureScale: 1.0
-
- parameters: [
- Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter {
- name: "diffuseTexture"
- value: Texture2D {
- id: diffuseTexture
- minificationFilter: Texture.LinearMipMapLinear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- generateMipMaps: true
- maximumAnisotropy: 16.0
- TextureImage { id: diffuseTextureImage; }
- }
- },
- Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
- Parameter { name: "shininess"; value: root.shininess },
- Parameter { name: "texCoordScale"; value: textureScale }
- ]
-
- effect: Effect {
- ShaderProgram {
- id: gl2Es2Shader
- vertexShaderCode: loadSource("qrc:/shaders/es2/diffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/diffusemap.frag")
- }
-
- ShaderProgram {
- id: gl3Shader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/diffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/diffusemap.frag")
- }
-
- techniques: [
- // OpenGL 3.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass { shaderProgram: gl3Shader }
- },
-
- // OpenGL 2.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
- },
-
- // OpenGL ES 2
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
- }
- ]
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/DiffuseSpecularMapMaterial.qml b/src/quick3d/imports/render/defaults/qml/DiffuseSpecularMapMaterial.qml
deleted file mode 100644
index 1684af789..000000000
--- a/src/quick3d/imports/render/defaults/qml/DiffuseSpecularMapMaterial.qml
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id: root
-
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property alias diffuse: diffuseTextureImage.source
- property alias specular: specularTextureImage.source
- property real shininess: 150.0
- property real textureScale: 1.0
-
- parameters: [
- Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter {
- name: "diffuseTexture"
- value: Texture2D {
- id: diffuseTexture
- minificationFilter: Texture.LinearMipMapLinear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- generateMipMaps: true
- maximumAnisotropy: 16.0
- TextureImage { id: diffuseTextureImage; }
- }
- },
- Parameter { name: "specularTexture";
- value: Texture2D {
- id: specularTexture
- minificationFilter: Texture.LinearMipMapLinear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- generateMipMaps: true
- maximumAnisotropy: 16.0
- TextureImage { id: specularTextureImage; }
- }
- },
- Parameter { name: "shininess"; value: root.shininess },
- Parameter { name: "texCoordScale"; value: textureScale }
- ]
-
- effect: Effect {
- ShaderProgram {
- id: gl2Es2Shader
- vertexShaderCode: loadSource("qrc:/shaders/es2/diffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/diffusespecularmap.frag")
- }
-
- ShaderProgram {
- id: gl3Shader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/diffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/diffusespecularmap.frag")
- }
-
- techniques: [
- // OpenGL 3.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass { shaderProgram: gl3Shader }
- },
-
- // OpenGL 2.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
- },
-
- // OpenGL ES 2
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
- }
- ]
- }
-}
diff --git a/src/quick3d/imports/render/defaults/qml/ForwardRenderer.qml b/src/quick3d/imports/render/defaults/qml/ForwardRenderer.qml
deleted file mode 100644
index 308081412..000000000
--- a/src/quick3d/imports/render/defaults/qml/ForwardRenderer.qml
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-TechniqueFilter {
- // Expose camera to allow user to choose which camera to use for rendering
- property alias camera: cameraSelector.camera
- property alias clearColor: viewport.clearColor
- property alias viewportRect: viewport.rect
-
- // Select the forward rendering Technique of any used Effect
- requires: [ Annotation { name: "renderingStyle"; value: "forward" } ]
-
- // Use the whole viewport
- Viewport {
- id: viewport
- rect: Qt.rect(0.0, 0.0, 1.0, 1.0)
- clearColor: "white"
-
- // Use the specified camera
- CameraSelector {
- id : cameraSelector
- FrustumCulling {
- ClearBuffer {
- buffers : ClearBuffer.ColorDepthBuffer
- }
- }
- }
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/GoochMaterial.qml b/src/quick3d/imports/render/defaults/qml/GoochMaterial.qml
deleted file mode 100644
index 82ab08e72..000000000
--- a/src/quick3d/imports/render/defaults/qml/GoochMaterial.qml
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id:root
- property color diffuse: Qt.rgba( 0.0, 0.0, 0.0, 1.0 )
- property color specular: Qt.rgba( 0.0, 0.0, 0.0, 1.0 )
- property color coolColor: Qt.rgba( 0.0, 0.0, 0.4, 1.0 )
- property color warmColor: Qt.rgba( 0.4, 0.4, 0.0, 1.0 )
- property real alpha: 0.25
- property real beta: 0.5
- property real shininess: 100.0
-
- ShaderProgram {
- id: gl3GoochShader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/gooch.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/gooch.frag")
- }
-
- ShaderProgram {
- id: gl2es2GoochShader
- vertexShaderCode: loadSource("qrc:/shaders/es2/gooch.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/gooch.frag")
- }
-
- effect: Effect {
- parameters: [
- Parameter { name: "kd"; value: root.diffuse },
- Parameter { name: "ks"; value: root.specular },
- Parameter { name: "kblue"; value: root.coolColor },
- Parameter { name: "kyellow"; value: root.warmColor },
- Parameter { name: "alpha"; value: root.alpha },
- Parameter { name: "beta"; value: root.beta },
- Parameter { name: "shininess"; value: root.shininess }
- ]
-
- techniques: [
- // GL 3 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 2
- }
- renderPasses: RenderPass {
- shaderProgram: gl3GoochShader
- }
- },
-
- // GL 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2GoochShader
- }
- },
-
- // ES 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2GoochShader
- }
- }
- ]
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/NormalDiffuseMapAlphaMaterial.qml b/src/quick3d/imports/render/defaults/qml/NormalDiffuseMapAlphaMaterial.qml
deleted file mode 100644
index ca658c2c5..000000000
--- a/src/quick3d/imports/render/defaults/qml/NormalDiffuseMapAlphaMaterial.qml
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id: root
-
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property alias diffuse: diffuseTextureImage.source
- property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
- property alias normal: normalTextureImage.source
- property real shininess: 150.0
- property real textureScale: 1.0
-
- parameters: [
- Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter {
- name: "diffuseTexture"
- value: Texture2D {
- id: diffuseTexture
- minificationFilter: Texture.LinearMipMapLinear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- generateMipMaps: true
- maximumAnisotropy: 16.0
- TextureImage { id: diffuseTextureImage; }
- }
- },
- Parameter {
- name: "normalTexture"
- value: Texture2D {
- id: normalTexture
- minificationFilter: Texture.Linear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- maximumAnisotropy: 16.0
- TextureImage { id: normalTextureImage; }
- }
- },
- Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
- Parameter { name: "shininess"; value: root.shininess },
- Parameter { name: "texCoordScale"; value: textureScale }
- ]
-
- effect: Effect {
- ShaderProgram {
- id: gl2Es2Shader
- vertexShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemapalpha.frag")
- }
-
- ShaderProgram {
- id: gl3Shader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemapalpha.frag")
- }
-
- AlphaCoverage { id: alphaCoverageState }
- DepthTest { id: depthTestState; func: DepthTest.Less }
-
- techniques: [
- // OpenGL 3.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass { shaderProgram: gl3Shader; renderStates: [alphaCoverageState, depthTestState] }
- },
-
- // OpenGL 2.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader; renderStates: [alphaCoverageState, depthTestState] }
- },
-
- // OpenGL ES 2
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader; renderStates: [alphaCoverageState, depthTestState] }
- }
- ]
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/NormalDiffuseMapMaterial.qml b/src/quick3d/imports/render/defaults/qml/NormalDiffuseMapMaterial.qml
deleted file mode 100644
index 91fb1d859..000000000
--- a/src/quick3d/imports/render/defaults/qml/NormalDiffuseMapMaterial.qml
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id: root
-
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property alias diffuse: diffuseTextureImage.source
- property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
- property alias normal: normalTextureImage.source
- property real shininess: 150.0
- property real textureScale: 1.0
-
- parameters: [
- Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter {
- name: "diffuseTexture"
- value: Texture2D {
- id: diffuseTexture
- minificationFilter: Texture.LinearMipMapLinear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- generateMipMaps: true
- maximumAnisotropy: 16.0
- TextureImage { id: diffuseTextureImage; }
- }
- },
- Parameter {
- name: "normalTexture"
- value: Texture2D {
- id: normalTexture
- minificationFilter: Texture.Linear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- maximumAnisotropy: 16.0
- TextureImage { id: normalTextureImage; }
- }
- },
- Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
- Parameter { name: "shininess"; value: root.shininess },
- Parameter { name: "texCoordScale"; value: textureScale }
- ]
-
- effect: Effect {
- ShaderProgram {
- id: gl2Es2Shader
- vertexShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemap.frag")
- }
-
- ShaderProgram {
- id: gl3Shader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemap.frag")
- }
-
- techniques: [
- // OpenGL 3.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass { shaderProgram: gl3Shader }
- },
-
- // OpenGL 2.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
- },
-
- // OpenGL ES 2
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
- }
- ]
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/NormalDiffuseSpecularMapMaterial.qml b/src/quick3d/imports/render/defaults/qml/NormalDiffuseSpecularMapMaterial.qml
deleted file mode 100644
index ab1727e2d..000000000
--- a/src/quick3d/imports/render/defaults/qml/NormalDiffuseSpecularMapMaterial.qml
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id: root
-
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property alias diffuse: diffuseTextureImage.source
- property alias specular: specularTextureImage.source
- property alias normal: normalTextureImage.source
- property real shininess: 150.0
- property real textureScale: 1.0
-
- parameters: [
- Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter {
- name: "diffuseTexture"
- value: Texture2D {
- id: diffuseTexture
- minificationFilter: Texture.LinearMipMapLinear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- generateMipMaps: true
- maximumAnisotropy: 16.0
- TextureImage { id: diffuseTextureImage; }
- }
- },
- Parameter { name: "specularTexture";
- value: Texture2D {
- id: specularTexture
- minificationFilter: Texture.LinearMipMapLinear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- generateMipMaps: true
- maximumAnisotropy: 16.0
- TextureImage { id: specularTextureImage; }
- }
- },
- Parameter {
- name: "normalTexture"
- value: Texture2D {
- id: normalTexture
- minificationFilter: Texture.Linear
- magnificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.Repeat
- y: WrapMode.Repeat
- }
- maximumAnisotropy: 16.0
- TextureImage { id: normalTextureImage; }
- }
- },
- Parameter { name: "shininess"; value: root.shininess },
- Parameter { name: "texCoordScale"; value: textureScale }
- ]
-
- effect: Effect {
- ShaderProgram {
- id: gl2Es2Shader
- vertexShaderCode: loadSource("qrc:/shaders/es2/normaldiffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/normaldiffusespecularmap.frag")
- }
-
- ShaderProgram {
- id: gl3Shader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusemap.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/normaldiffusespecularmap.frag")
- }
-
- techniques: [
- // OpenGL 3.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass { shaderProgram: gl3Shader }
- },
-
- // OpenGL 2.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
- },
-
- // OpenGL ES 2
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass { shaderProgram: gl2Es2Shader }
- }
- ]
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/PerVertexColorMaterial.qml b/src/quick3d/imports/render/defaults/qml/PerVertexColorMaterial.qml
deleted file mode 100644
index 8d41a5043..000000000
--- a/src/quick3d/imports/render/defaults/qml/PerVertexColorMaterial.qml
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Lorenz Esch (TU Ilmenau).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id:root
-
- ShaderProgram {
- id: gl3PerVertexColorShader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/pervertexcolor.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/pervertexcolor.frag")
- }
-
- ShaderProgram {
- id: gl2es2PerVertexColorShader
- vertexShaderCode: loadSource("qrc:/shaders/es2/pervertexcolor.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/pervertexcolor.frag")
- }
-
- effect: Effect {
- techniques: [
- // GL 3 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass {
- shaderProgram: gl3PerVertexColorShader
- }
- },
-
- // GL 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2PerVertexColorShader
- }
- },
-
- // ES 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2PerVertexColorShader
- }
- }
- ]
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/PhongAlphaMaterial.qml b/src/quick3d/imports/render/defaults/qml/PhongAlphaMaterial.qml
deleted file mode 100644
index 1edcbe03c..000000000
--- a/src/quick3d/imports/render/defaults/qml/PhongAlphaMaterial.qml
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id:root
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
- property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
- property real shininess: 150.0
- property real alpha: 0.5
-
-
- ShaderProgram {
- id: gl3PhongAlphaShader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/phong.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/phongalpha.frag")
- }
-
- ShaderProgram {
- id: gl2es2PhongAlphaShader
- vertexShaderCode: loadSource("qrc:/shaders/es2/phong.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/phongalpha.frag")
- }
-
- effect: Effect {
-
- parameters: [
- Parameter { name: "alpha"; value: root.alpha },
- Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
- Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
- Parameter { name: "shininess"; value: root.shininess }
- ]
-
- techniques: [
- // GL 3 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass {
- shaderProgram: gl3PhongAlphaShader
- renderStates: [
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- },
- BlendEquation {mode: BlendEquation.FuncAdd}
- ]
- }
- },
-
- // GL 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2PhongAlphaShader
- renderStates: [
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- },
- BlendEquation {mode: BlendEquation.FuncAdd}
- ]
- }
- },
-
- // ES 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2PhongAlphaShader
- renderStates: [
- DepthMask { mask: false },
- BlendState {
- srcRGB: BlendState.SrcAlpha
- dstRGB: BlendState.OneMinusSrcAlpha
- },
- BlendEquation {mode: BlendEquation.FuncAdd}
- ]
- }
- }
- ]
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/PhongMaterial.qml b/src/quick3d/imports/render/defaults/qml/PhongMaterial.qml
deleted file mode 100644
index 6cab55dd9..000000000
--- a/src/quick3d/imports/render/defaults/qml/PhongMaterial.qml
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id:root
- property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
- property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
- property color specular: Qt.rgba( 0.01, 0.01, 0.01, 1.0 )
- property real shininess: 150.0
-
-
- ShaderProgram {
- id: gl3PhongShader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/phong.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/phong.frag")
- }
-
- ShaderProgram {
- id: gl2es2PhongShader
- vertexShaderCode: loadSource("qrc:/shaders/es2/phong.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/phong.frag")
- }
-
- effect: Effect {
-
- parameters: [
- Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
- Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
- Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
- Parameter { name: "shininess"; value: root.shininess }
- ]
-
- techniques: [
- // GL 3 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass {
- shaderProgram: gl3PhongShader
- }
- },
-
- // GL 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2PhongShader
- }
- },
-
- // ES 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2PhongShader
- }
- }
- ]
- }
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/SkyboxEntity.qml b/src/quick3d/imports/render/defaults/qml/SkyboxEntity.qml
deleted file mode 100644
index fac8ae8a9..000000000
--- a/src/quick3d/imports/render/defaults/qml/SkyboxEntity.qml
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Entity {
-
- property alias cameraPosition: transform.translation;
- property string baseName: "";
- property string extension: ".png"
-
- property TextureCubeMap skyboxTexture: TextureCubeMap {
- generateMipMaps: false
- magnificationFilter: Texture.Linear
- minificationFilter: Texture.Linear
- wrapMode {
- x: WrapMode.ClampToEdge
- y: WrapMode.ClampToEdge
- }
- TextureImage { cubeMapFace: Texture.CubeMapPositiveX; source: baseName + "_posx" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapPositiveY; source: baseName + "_posy" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapPositiveZ; source: baseName + "_posz" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapNegativeX; source: baseName + "_negx" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapNegativeY; source: baseName + "_negy" + extension }
- TextureImage { cubeMapFace: Texture.CubeMapNegativeZ; source: baseName + "_negz" + extension }
- }
-
- ShaderProgram {
- id: gl3SkyboxShader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/skybox.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/skybox.frag")
- }
-
- ShaderProgram {
- id: gl2es2SkyboxShader
- vertexShaderCode: loadSource("qrc:/shaders/es2/skybox.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/skybox.frag")
- }
-
- CuboidMesh {
- id: cuboidMesh
- yzMeshResolution: Qt.size(2, 2)
- xzMeshResolution: Qt.size(2, 2)
- xyMeshResolution: Qt.size(2, 2)
- }
-
- Transform {
- id: transform
- }
-
- Material {
- id: skyboxMaterial
- parameters: Parameter { name: "skyboxTexture"; value: skyboxTexture}
-
- effect: Effect {
- techniques: [
- // GL3 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass {
- shaderProgram: gl3SkyboxShader
- renderStates: [
- // cull front faces
- CullFace { mode: CullFace.Front },
- DepthTest { func: DepthTest.LessOrEqual }
- ]
- }
- },
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2SkyboxShader
- renderStates: [
- CullFace { mode: CullFace.Front },
- DepthTest { func: DepthTest.LessOrEqual }
- ]
- }
- },
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2SkyboxShader
- renderStates: [
- CullFace { mode: CullFace.Front },
- DepthTest { func: DepthTest.LessOrEqual }
- ]
- }
- }
- ]
- }
- }
-
- components: [cuboidMesh, skyboxMaterial, transform]
-}
-
diff --git a/src/quick3d/imports/render/defaults/qml/TextureMaterial.qml b/src/quick3d/imports/render/defaults/qml/TextureMaterial.qml
deleted file mode 100644
index 69d276f86..000000000
--- a/src/quick3d/imports/render/defaults/qml/TextureMaterial.qml
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt3D.Core 2.0
-import Qt3D.Render 2.0
-
-Material {
- id: root
- property Texture2D texture: Texture2D {}
- property alias textureOffset: texCoordOffset.offset
-
- ShaderProgram {
- id: gl3Shader
- vertexShaderCode: loadSource("qrc:/shaders/gl3/unlittexture.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/gl3/unlittexture.frag")
- }
-
- ShaderProgram {
- id: gl2es2Shader
- vertexShaderCode: loadSource("qrc:/shaders/es2/unlittexture.vert")
- fragmentShaderCode: loadSource("qrc:/shaders/es2/unlittexture.frag")
- }
-
- effect: Effect {
- parameters: [
- Parameter {
- name: "diffuseTexture"
- value: root.texture
- },
- Parameter {
- id: texCoordOffset
- property vector2d offset: Qt.vector2d(0, 0)
- name: "texCoordOffset"
- value: offset
- }
-
- ]
-
- techniques: [
- // OpenGL 3.1
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- profile: GraphicsApiFilter.CoreProfile
- majorVersion: 3
- minorVersion: 1
- }
- renderPasses: RenderPass {
- shaderProgram: gl3Shader
- }
- },
-
- // GL 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGL
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2Shader
- }
- },
-
- // ES 2 Technique
- Technique {
- graphicsApiFilter {
- api: GraphicsApiFilter.OpenGLES
- profile: GraphicsApiFilter.NoProfile
- majorVersion: 2
- minorVersion: 0
- }
- renderPasses: RenderPass {
- shaderProgram: gl2es2Shader
- }
- }
- ]
- }
-}
diff --git a/src/quick3d/imports/render/importsrender.pro b/src/quick3d/imports/render/importsrender.pro
index caf6a37bb..442068fe7 100644
--- a/src/quick3d/imports/render/importsrender.pro
+++ b/src/quick3d/imports/render/importsrender.pro
@@ -1,9 +1,13 @@
CXX_MODULE = qml
TARGET = quick3drenderplugin
TARGETPATH = Qt3D/Render
+IMPORT_VERSION = 2.0
QT += core-private qml qml-private 3dcore 3drender 3dquick 3dquick-private 3dquickrender-private
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
HEADERS += \
qt3dquick3drenderplugin.h
@@ -12,31 +16,4 @@ SOURCES += \
OTHER_FILES += qmldir
-include(./defaults/defaults.pri)
-
-OTHER_FILES += \
- $$QML_FILES
-
-# Create a resource file for qml files that need to be registered by the plugin
-GENERATED_RESOURCE_FILE = $$OUT_PWD/defaults.qrc
-INCLUDED_RESOURCE_FILES = $$QML_FILES
-RESOURCE_CONTENT = \
- "<RCC>" \
- "<qresource prefix=\"/Qt3D/Render/\">"
-
-for(resourcefile, INCLUDED_RESOURCE_FILES) {
- resourcefileabsolutepath = $$absolute_path($$resourcefile)
- relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_)
- relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD)
- RESOURCE_CONTENT += "<file alias=\"$$relativepath_in\">$$relativepath_out</file>"
-}
-
-RESOURCE_CONTENT += \
- "</qresource>" \
- "</RCC>"
-
-write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.")
-
-RESOURCES += $$GENERATED_RESOURCE_FILE
-
load(qml_plugin)
diff --git a/src/quick3d/imports/render/plugins.qmltypes b/src/quick3d/imports/render/plugins.qmltypes
new file mode 100644
index 000000000..19f03de65
--- /dev/null
+++ b/src/quick3d/imports/render/plugins.qmltypes
@@ -0,0 +1,1897 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable Qt3D.Render 2.0'
+
+Module {
+ dependencies: ["Qt3D.Core 2.0"]
+ Component {
+ name: "QWindow"
+ prototype: "QObject"
+ exports: ["Qt3D.Render/Window 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Visibility"
+ values: {
+ "Hidden": 0,
+ "AutomaticVisibility": 1,
+ "Windowed": 2,
+ "Minimized": 3,
+ "Maximized": 4,
+ "FullScreen": 5
+ }
+ }
+ Property { name: "title"; type: "string" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "minimumWidth"; type: "int" }
+ Property { name: "minimumHeight"; type: "int" }
+ Property { name: "maximumWidth"; type: "int" }
+ Property { name: "maximumHeight"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
+ Signal {
+ name: "screenChanged"
+ Parameter { name: "screen"; type: "QScreen"; isPointer: true }
+ }
+ Signal {
+ name: "modalityChanged"
+ Parameter { name: "modality"; type: "Qt::WindowModality" }
+ }
+ Signal {
+ name: "windowStateChanged"
+ Parameter { name: "windowState"; type: "Qt::WindowState" }
+ }
+ Signal {
+ name: "windowTitleChanged"
+ revision: 2
+ Parameter { name: "title"; type: "string" }
+ }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
+ name: "contentOrientationChanged"
+ Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
+ }
+ Signal {
+ name: "focusObjectChanged"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
+ Method {
+ name: "setVisible"
+ Parameter { name: "visible"; type: "bool" }
+ }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method { name: "showMinimized" }
+ Method { name: "showMaximized" }
+ Method { name: "showFullScreen" }
+ Method { name: "showNormal" }
+ Method { name: "close"; type: "bool" }
+ Method { name: "raise" }
+ Method { name: "lower" }
+ Method {
+ name: "setTitle"
+ Parameter { type: "string" }
+ }
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setMinimumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMinimumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setMaximumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMaximumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "alert"
+ revision: 1
+ Parameter { name: "msec"; type: "int" }
+ }
+ Method { name: "requestUpdate"; revision: 3 }
+ }
+ Component {
+ name: "Qt3DRender::QAbstractLight"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QAbstractLight"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QAbstractTexture"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QAbstractTexture"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QAbstractTextureImage"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "mipLevel"; type: "int" }
+ Property { name: "layer"; type: "int" }
+ Property { name: "face"; type: "Qt3DRender::QAbstractTexture::CubeMapFace" }
+ Signal {
+ name: "mipLevelChanged"
+ Parameter { name: "mipLevel"; type: "int" }
+ }
+ Signal {
+ name: "layerChanged"
+ Parameter { name: "layer"; type: "int" }
+ }
+ Signal {
+ name: "faceChanged"
+ Parameter { name: "face"; type: "QAbstractTexture::CubeMapFace" }
+ }
+ Method {
+ name: "setMipLevel"
+ Parameter { name: "level"; type: "int" }
+ }
+ Method {
+ name: "setLayer"
+ Parameter { name: "layer"; type: "int" }
+ }
+ Method {
+ name: "setFace"
+ Parameter { name: "face"; type: "QAbstractTexture::CubeMapFace" }
+ }
+ }
+ Component { name: "Qt3DRender::QAlphaCoverage"; prototype: "Qt3DRender::QRenderState" }
+ Component {
+ name: "Qt3DRender::QAlphaTest"
+ prototype: "Qt3DRender::QRenderState"
+ Enum {
+ name: "AlphaFunction"
+ values: {
+ "Never": 512,
+ "Always": 519,
+ "Less": 513,
+ "LessOrEqual": 515,
+ "Equal": 514,
+ "GreaterOrEqual": 518,
+ "Greater": 516,
+ "NotEqual": 517
+ }
+ }
+ Property { name: "alphaFunction"; type: "AlphaFunction" }
+ Property { name: "referenceValue"; type: "float" }
+ Signal {
+ name: "alphaFunctionChanged"
+ Parameter { name: "alphaFunction"; type: "AlphaFunction" }
+ }
+ Signal {
+ name: "referenceValueChanged"
+ Parameter { name: "referenceValue"; type: "float" }
+ }
+ Method {
+ name: "setAlphaFunction"
+ Parameter { name: "alphaFunction"; type: "AlphaFunction" }
+ }
+ Method {
+ name: "setReferenceValue"
+ Parameter { name: "referenceValue"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QAttribute"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QAttribute"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QBlendEquation"
+ prototype: "Qt3DRender::QRenderState"
+ Enum {
+ name: "BlendFunction"
+ values: {
+ "Add": 32774,
+ "Subtract": 32778,
+ "ReverseSubtract": 32779,
+ "Min": 32775,
+ "Max": 32776
+ }
+ }
+ Property { name: "blendFunction"; type: "BlendFunction" }
+ Signal {
+ name: "blendFunctionChanged"
+ Parameter { name: "blendFunction"; type: "BlendFunction" }
+ }
+ Method {
+ name: "setBlendFunction"
+ Parameter { name: "blendFunction"; type: "BlendFunction" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QBlendEquationArguments"
+ prototype: "Qt3DRender::QRenderState"
+ Enum {
+ name: "Blending"
+ values: {
+ "Zero": 0,
+ "One": 1,
+ "SourceColor": 768,
+ "SourceAlpha": 770,
+ "Source1Alpha": 771,
+ "Source1Color": 772,
+ "DestinationColor": 774,
+ "DestinationAlpha": 772,
+ "SourceAlphaSaturate": 776,
+ "ConstantColor": 32769,
+ "ConstantAlpha": 32771,
+ "OneMinusSourceColor": 769,
+ "OneMinusSourceAlpha": 771,
+ "OneMinusDestinationAlpha": 773,
+ "OneMinusDestinationColor": 775,
+ "OneMinusConstantColor": 32770,
+ "OneMinusConstantAlpha": 32772,
+ "OneMinusSource1Alpha": 32773,
+ "OneMinusSource1Color0": 32774
+ }
+ }
+ Property { name: "sourceRgb"; type: "Blending" }
+ Property { name: "sourceAlpha"; type: "Blending" }
+ Property { name: "destinationRgb"; type: "Blending" }
+ Property { name: "destinationAlpha"; type: "Blending" }
+ Property { name: "bufferIndex"; type: "int" }
+ Signal {
+ name: "sourceRgbChanged"
+ Parameter { name: "sourceRgb"; type: "Blending" }
+ }
+ Signal {
+ name: "sourceAlphaChanged"
+ Parameter { name: "sourceAlpha"; type: "Blending" }
+ }
+ Signal {
+ name: "destinationRgbChanged"
+ Parameter { name: "destinationRgb"; type: "Blending" }
+ }
+ Signal {
+ name: "destinationAlphaChanged"
+ Parameter { name: "destinationAlpha"; type: "Blending" }
+ }
+ Signal {
+ name: "sourceRgbaChanged"
+ Parameter { name: "sourceRgba"; type: "Blending" }
+ }
+ Signal {
+ name: "destinationRgbaChanged"
+ Parameter { name: "destinationRgba"; type: "Blending" }
+ }
+ Signal {
+ name: "bufferIndexChanged"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "setSourceRgb"
+ Parameter { name: "sourceRgb"; type: "Blending" }
+ }
+ Method {
+ name: "setDestinationRgb"
+ Parameter { name: "destinationRgb"; type: "Blending" }
+ }
+ Method {
+ name: "setSourceAlpha"
+ Parameter { name: "sourceAlpha"; type: "Blending" }
+ }
+ Method {
+ name: "setDestinationAlpha"
+ Parameter { name: "destinationAlpha"; type: "Blending" }
+ }
+ Method {
+ name: "setSourceRgba"
+ Parameter { name: "sourceRgba"; type: "Blending" }
+ }
+ Method {
+ name: "setDestinationRgba"
+ Parameter { name: "destinationRgba"; type: "Blending" }
+ }
+ Method {
+ name: "setBufferIndex"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QBuffer"
+ prototype: "Qt3DCore::QNode"
+ Enum {
+ name: "BufferType"
+ values: {
+ "VertexBuffer": 34962,
+ "IndexBuffer": 34963,
+ "PixelPackBuffer": 35051,
+ "PixelUnpackBuffer": 35052,
+ "UniformBuffer": 35345,
+ "ShaderStorageBuffer": 37074
+ }
+ }
+ Enum {
+ name: "UsageType"
+ values: {
+ "StreamDraw": 35040,
+ "StreamRead": 35041,
+ "StreamCopy": 35042,
+ "StaticDraw": 35044,
+ "StaticRead": 35045,
+ "StaticCopy": 35046,
+ "DynamicDraw": 35048,
+ "DynamicRead": 35049,
+ "DynamicCopy": 35050
+ }
+ }
+ Property { name: "type"; type: "BufferType" }
+ Property { name: "usage"; type: "UsageType" }
+ Property { name: "syncData"; type: "bool" }
+ Signal {
+ name: "dataChanged"
+ Parameter { name: "bytes"; type: "QByteArray" }
+ }
+ Signal {
+ name: "typeChanged"
+ Parameter { name: "type"; type: "BufferType" }
+ }
+ Signal {
+ name: "usageChanged"
+ Parameter { name: "usage"; type: "UsageType" }
+ }
+ Signal {
+ name: "syncDataChanged"
+ Parameter { name: "syncData"; type: "bool" }
+ }
+ Method {
+ name: "setType"
+ Parameter { name: "type"; type: "BufferType" }
+ }
+ Method {
+ name: "setUsage"
+ Parameter { name: "usage"; type: "UsageType" }
+ }
+ Method {
+ name: "setSyncData"
+ Parameter { name: "syncData"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QCamera"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QCamera"
+ Property { name: "components"; type: "Qt3DCore::QComponent"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QCameraLens"
+ prototype: "Qt3DCore::QComponent"
+ Enum {
+ name: "ProjectionType"
+ values: {
+ "OrthographicProjection": 0,
+ "PerspectiveProjection": 1,
+ "FrustumProjection": 2,
+ "CustomProjection": 3
+ }
+ }
+ Property { name: "projectionType"; type: "ProjectionType" }
+ Property { name: "nearPlane"; type: "float" }
+ Property { name: "farPlane"; type: "float" }
+ Property { name: "fieldOfView"; type: "float" }
+ Property { name: "aspectRatio"; type: "float" }
+ Property { name: "left"; type: "float" }
+ Property { name: "right"; type: "float" }
+ Property { name: "bottom"; type: "float" }
+ Property { name: "top"; type: "float" }
+ Property { name: "projectionMatrix"; type: "QMatrix4x4" }
+ Signal {
+ name: "projectionTypeChanged"
+ Parameter { name: "projectionType"; type: "QCameraLens::ProjectionType" }
+ }
+ Signal {
+ name: "nearPlaneChanged"
+ Parameter { name: "nearPlane"; type: "float" }
+ }
+ Signal {
+ name: "farPlaneChanged"
+ Parameter { name: "farPlane"; type: "float" }
+ }
+ Signal {
+ name: "fieldOfViewChanged"
+ Parameter { name: "fieldOfView"; type: "float" }
+ }
+ Signal {
+ name: "aspectRatioChanged"
+ Parameter { name: "aspectRatio"; type: "float" }
+ }
+ Signal {
+ name: "leftChanged"
+ Parameter { name: "left"; type: "float" }
+ }
+ Signal {
+ name: "rightChanged"
+ Parameter { name: "right"; type: "float" }
+ }
+ Signal {
+ name: "bottomChanged"
+ Parameter { name: "bottom"; type: "float" }
+ }
+ Signal {
+ name: "topChanged"
+ Parameter { name: "top"; type: "float" }
+ }
+ Signal {
+ name: "projectionMatrixChanged"
+ Parameter { name: "projectionMatrix"; type: "QMatrix4x4" }
+ }
+ Method {
+ name: "setProjectionType"
+ Parameter { name: "projectionType"; type: "ProjectionType" }
+ }
+ Method {
+ name: "setNearPlane"
+ Parameter { name: "nearPlane"; type: "float" }
+ }
+ Method {
+ name: "setFarPlane"
+ Parameter { name: "farPlane"; type: "float" }
+ }
+ Method {
+ name: "setFieldOfView"
+ Parameter { name: "fieldOfView"; type: "float" }
+ }
+ Method {
+ name: "setAspectRatio"
+ Parameter { name: "aspectRatio"; type: "float" }
+ }
+ Method {
+ name: "setLeft"
+ Parameter { name: "left"; type: "float" }
+ }
+ Method {
+ name: "setRight"
+ Parameter { name: "right"; type: "float" }
+ }
+ Method {
+ name: "setBottom"
+ Parameter { name: "bottom"; type: "float" }
+ }
+ Method {
+ name: "setTop"
+ Parameter { name: "top"; type: "float" }
+ }
+ Method {
+ name: "setProjectionMatrix"
+ Parameter { name: "projectionMatrix"; type: "QMatrix4x4" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QCameraSelector"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ Property { name: "camera"; type: "Qt3DCore::QEntity"; isPointer: true }
+ Signal {
+ name: "cameraChanged"
+ Parameter { name: "camera"; type: "Qt3DCore::QEntity"; isPointer: true }
+ }
+ Method {
+ name: "setCamera"
+ Parameter { name: "camera"; type: "Qt3DCore::QEntity"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QClearBuffers"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ Enum {
+ name: "BufferType"
+ values: {
+ "None": 0,
+ "ColorBuffer": 1,
+ "DepthBuffer": 2,
+ "StencilBuffer": 4,
+ "DepthStencilBuffer": 6,
+ "ColorDepthBuffer": 3,
+ "ColorDepthStencilBuffer": 7,
+ "AllBuffers": -1
+ }
+ }
+ Property { name: "buffers"; type: "BufferType" }
+ Property { name: "clearColor"; type: "QColor" }
+ Property { name: "clearDepthValue"; type: "float" }
+ Property { name: "clearStencilValue"; type: "int" }
+ Signal {
+ name: "buffersChanged"
+ Parameter { name: "buffers"; type: "BufferType" }
+ }
+ Signal {
+ name: "clearColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "clearDepthValueChanged"
+ Parameter { name: "clearDepthValue"; type: "float" }
+ }
+ Signal {
+ name: "clearStencilValueChanged"
+ Parameter { name: "clearStencilValue"; type: "int" }
+ }
+ Method {
+ name: "setBuffers"
+ Parameter { name: "buffers"; type: "BufferType" }
+ }
+ Method {
+ name: "setClearColor"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Method {
+ name: "setClearDepthValue"
+ Parameter { name: "clearDepthValue"; type: "float" }
+ }
+ Method {
+ name: "setClearStencilValue"
+ Parameter { name: "clearStencilValue"; type: "int" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QClipPlane"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QClipPlane"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QColorMask"
+ prototype: "Qt3DRender::QRenderState"
+ Property { name: "redMasked"; type: "bool" }
+ Property { name: "greenMasked"; type: "bool" }
+ Property { name: "blueMasked"; type: "bool" }
+ Property { name: "alphaMasked"; type: "bool" }
+ Signal {
+ name: "redMaskedChanged"
+ Parameter { name: "redMasked"; type: "bool" }
+ }
+ Signal {
+ name: "greenMaskedChanged"
+ Parameter { name: "greenMasked"; type: "bool" }
+ }
+ Signal {
+ name: "blueMaskedChanged"
+ Parameter { name: "blueMasked"; type: "bool" }
+ }
+ Signal {
+ name: "alphaMaskedChanged"
+ Parameter { name: "alphaMasked"; type: "bool" }
+ }
+ Method {
+ name: "setRedMasked"
+ Parameter { name: "redMasked"; type: "bool" }
+ }
+ Method {
+ name: "setGreenMasked"
+ Parameter { name: "greenMasked"; type: "bool" }
+ }
+ Method {
+ name: "setBlueMasked"
+ Parameter { name: "blueMasked"; type: "bool" }
+ }
+ Method {
+ name: "setAlphaMasked"
+ Parameter { name: "alphaMasked"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QComputeCommand"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QComputeCommand"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QCullFace"
+ prototype: "Qt3DRender::QRenderState"
+ Enum {
+ name: "CullingMode"
+ values: {
+ "NoCulling": 0,
+ "Front": 1028,
+ "Back": 1029,
+ "FrontAndBack": 1032
+ }
+ }
+ Property { name: "mode"; type: "CullingMode" }
+ Signal {
+ name: "modeChanged"
+ Parameter { name: "mode"; type: "CullingMode" }
+ }
+ Method {
+ name: "setMode"
+ Parameter { name: "mode"; type: "CullingMode" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QDepthTest"
+ prototype: "Qt3DRender::QRenderState"
+ Enum {
+ name: "DepthFunction"
+ values: {
+ "Never": 512,
+ "Always": 519,
+ "Less": 513,
+ "LessOrEqual": 515,
+ "Equal": 514,
+ "GreaterOrEqual": 518,
+ "Greater": 516,
+ "NotEqual": 517
+ }
+ }
+ Property { name: "depthFunction"; type: "DepthFunction" }
+ Signal {
+ name: "depthFunctionChanged"
+ Parameter { name: "depthFunction"; type: "DepthFunction" }
+ }
+ Method {
+ name: "setDepthFunction"
+ Parameter { name: "depthFunction"; type: "DepthFunction" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QDirectionalLight"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QDirectionalLight"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QDispatchCompute"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QDispatchCompute"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component { name: "Qt3DRender::QDithering"; prototype: "Qt3DRender::QRenderState" }
+ Component { name: "Qt3DRender::QEffect"; prototype: "Qt3DCore::QNode" }
+ Component {
+ name: "Qt3DRender::QFilterKey"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "value"; type: "QVariant" }
+ Property { name: "name"; type: "string" }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "name"; type: "string" }
+ }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "setValue"
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Method {
+ name: "setName"
+ Parameter { name: "customType"; type: "string" }
+ }
+ }
+ Component { name: "Qt3DRender::QFrameGraphNode"; prototype: "Qt3DCore::QNode" }
+ Component {
+ name: "Qt3DRender::QFrontFace"
+ prototype: "Qt3DRender::QRenderState"
+ Enum {
+ name: "WindingDirection"
+ values: {
+ "ClockWise": 2304,
+ "CounterClockWise": 2305
+ }
+ }
+ Property { name: "direction"; type: "WindingDirection" }
+ Signal {
+ name: "directionChanged"
+ Parameter { name: "direction"; type: "WindingDirection" }
+ }
+ Method {
+ name: "setDirection"
+ Parameter { name: "direction"; type: "WindingDirection" }
+ }
+ }
+ Component { name: "Qt3DRender::QFrustumCulling"; prototype: "Qt3DRender::QFrameGraphNode" }
+ Component {
+ name: "Qt3DRender::QGeometry"
+ prototype: "Qt3DCore::QNode"
+ Property {
+ name: "boundingVolumePositionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isPointer: true
+ }
+ Signal {
+ name: "boundingVolumePositionAttributeChanged"
+ Parameter { name: "boundingVolumePositionAttribute"; type: "QAttribute"; isPointer: true }
+ }
+ Method {
+ name: "setBoundingVolumePositionAttribute"
+ Parameter { name: "boundingVolumePositionAttribute"; type: "QAttribute"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QGeometryRenderer"
+ prototype: "Qt3DCore::QComponent"
+ Enum {
+ name: "PrimitiveType"
+ values: {
+ "Points": 0,
+ "Lines": 1,
+ "LineLoop": 2,
+ "LineStrip": 3,
+ "Triangles": 4,
+ "TriangleStrip": 5,
+ "TriangleFan": 6,
+ "LinesAdjacency": 10,
+ "TrianglesAdjacency": 12,
+ "LineStripAdjacency": 11,
+ "TriangleStripAdjacency": 13,
+ "Patches": 14
+ }
+ }
+ Property { name: "instanceCount"; type: "int" }
+ Property { name: "vertexCount"; type: "int" }
+ Property { name: "indexOffset"; type: "int" }
+ Property { name: "firstInstance"; type: "int" }
+ Property { name: "restartIndexValue"; type: "int" }
+ Property { name: "verticesPerPatch"; type: "int" }
+ Property { name: "primitiveRestartEnabled"; type: "bool" }
+ Property { name: "geometry"; type: "Qt3DRender::QGeometry"; isPointer: true }
+ Property { name: "primitiveType"; type: "PrimitiveType" }
+ Signal {
+ name: "instanceCountChanged"
+ Parameter { name: "instanceCount"; type: "int" }
+ }
+ Signal {
+ name: "vertexCountChanged"
+ Parameter { name: "vertexCount"; type: "int" }
+ }
+ Signal {
+ name: "indexOffsetChanged"
+ Parameter { name: "indexOffset"; type: "int" }
+ }
+ Signal {
+ name: "firstInstanceChanged"
+ Parameter { name: "firstInstance"; type: "int" }
+ }
+ Signal {
+ name: "restartIndexValueChanged"
+ Parameter { name: "restartIndexValue"; type: "int" }
+ }
+ Signal {
+ name: "verticesPerPatchChanged"
+ Parameter { name: "verticesPerPatch"; type: "int" }
+ }
+ Signal {
+ name: "primitiveRestartEnabledChanged"
+ Parameter { name: "primitiveRestartEnabled"; type: "bool" }
+ }
+ Signal {
+ name: "geometryChanged"
+ Parameter { name: "geometry"; type: "QGeometry"; isPointer: true }
+ }
+ Signal {
+ name: "primitiveTypeChanged"
+ Parameter { name: "primitiveType"; type: "PrimitiveType" }
+ }
+ Method {
+ name: "setInstanceCount"
+ Parameter { name: "instanceCount"; type: "int" }
+ }
+ Method {
+ name: "setVertexCount"
+ Parameter { name: "vertexCount"; type: "int" }
+ }
+ Method {
+ name: "setIndexOffset"
+ Parameter { name: "indexOffset"; type: "int" }
+ }
+ Method {
+ name: "setFirstInstance"
+ Parameter { name: "firstInstance"; type: "int" }
+ }
+ Method {
+ name: "setRestartIndexValue"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "setVerticesPerPatch"
+ Parameter { name: "verticesPerPatch"; type: "int" }
+ }
+ Method {
+ name: "setPrimitiveRestartEnabled"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Method {
+ name: "setGeometry"
+ Parameter { name: "geometry"; type: "QGeometry"; isPointer: true }
+ }
+ Method {
+ name: "setPrimitiveType"
+ Parameter { name: "primitiveType"; type: "PrimitiveType" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QGraphicsApiFilter"
+ prototype: "QObject"
+ exports: ["Qt3D.Render/GraphicsApiFilter 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Api"
+ values: {
+ "OpenGLES": 2,
+ "OpenGL": 1
+ }
+ }
+ Enum {
+ name: "OpenGLProfile"
+ values: {
+ "NoProfile": 0,
+ "CoreProfile": 1,
+ "CompatibilityProfile": 2
+ }
+ }
+ Property { name: "api"; type: "Qt3DRender::QGraphicsApiFilter::Api" }
+ Property { name: "profile"; type: "Qt3DRender::QGraphicsApiFilter::OpenGLProfile" }
+ Property { name: "minorVersion"; type: "int" }
+ Property { name: "majorVersion"; type: "int" }
+ Property { name: "extensions"; type: "QStringList" }
+ Property { name: "vendor"; type: "string" }
+ Signal {
+ name: "apiChanged"
+ Parameter { name: "api"; type: "Api" }
+ }
+ Signal {
+ name: "profileChanged"
+ Parameter { name: "profile"; type: "OpenGLProfile" }
+ }
+ Signal {
+ name: "minorVersionChanged"
+ Parameter { name: "minorVersion"; type: "int" }
+ }
+ Signal {
+ name: "majorVersionChanged"
+ Parameter { name: "majorVersion"; type: "int" }
+ }
+ Signal {
+ name: "extensionsChanged"
+ Parameter { name: "extensions"; type: "QStringList" }
+ }
+ Signal {
+ name: "vendorChanged"
+ Parameter { name: "vendor"; type: "string" }
+ }
+ Signal { name: "graphicsApiFilterChanged" }
+ Method {
+ name: "setApi"
+ Parameter { name: "api"; type: "Api" }
+ }
+ Method {
+ name: "setProfile"
+ Parameter { name: "profile"; type: "OpenGLProfile" }
+ }
+ Method {
+ name: "setMinorVersion"
+ Parameter { name: "minorVersion"; type: "int" }
+ }
+ Method {
+ name: "setMajorVersion"
+ Parameter { name: "majorVersion"; type: "int" }
+ }
+ Method {
+ name: "setExtensions"
+ Parameter { name: "extensions"; type: "QStringList" }
+ }
+ Method {
+ name: "setVendor"
+ Parameter { name: "vendor"; type: "string" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QLayer"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QLayer"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QLayerFilter"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QLayerFilter"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QMaterial"
+ prototype: "Qt3DCore::QComponent"
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QMesh"
+ prototype: "Qt3DRender::QGeometryRenderer"
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "meshName"; type: "string" }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ Signal {
+ name: "meshNameChanged"
+ Parameter { name: "meshName"; type: "string" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ Method {
+ name: "setMeshName"
+ Parameter { name: "meshName"; type: "string" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QMultiSampleAntiAliasing"
+ prototype: "Qt3DRender::QRenderState"
+ }
+ Component {
+ name: "Qt3DRender::QNoDepthMask"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QNoDepthMask"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component { name: "Qt3DRender::QNoDraw"; prototype: "Qt3DRender::QFrameGraphNode" }
+ Component {
+ name: "Qt3DRender::QObjectPicker"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QObjectPicker"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QParameter"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QParameter"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QPickEvent"
+ prototype: "QObject"
+ exports: ["Qt3D.Render/PickEvent 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "accepted"; type: "bool" }
+ Property { name: "position"; type: "QPointF"; isReadonly: true }
+ Property { name: "distance"; type: "float"; isReadonly: true }
+ Property { name: "localIntersection"; type: "QVector3D"; isReadonly: true }
+ Property { name: "worldIntersection"; type: "QVector3D"; isReadonly: true }
+ Signal {
+ name: "acceptedChanged"
+ Parameter { name: "accepted"; type: "bool" }
+ }
+ Method {
+ name: "setAccepted"
+ Parameter { name: "accepted"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QPickingSettings"
+ prototype: "Qt3DCore::QNode"
+ Enum {
+ name: "PickMethod"
+ values: {
+ "BoundingVolumePicking": 0,
+ "TrianglePicking": 1
+ }
+ }
+ Enum {
+ name: "PickResultMode"
+ values: {
+ "NearestPick": 0,
+ "AllPicks": 1
+ }
+ }
+ Property { name: "pickMethod"; type: "PickMethod" }
+ Property { name: "pickResultMode"; type: "PickResultMode" }
+ Signal {
+ name: "pickMethodChanged"
+ Parameter { name: "pickMethod"; type: "QPickingSettings::PickMethod" }
+ }
+ Signal {
+ name: "pickResultModeChanged"
+ Parameter { name: "pickResult"; type: "QPickingSettings::PickResultMode" }
+ }
+ Method {
+ name: "setPickMethod"
+ Parameter { name: "pickMethod"; type: "PickMethod" }
+ }
+ Method {
+ name: "setPickResultMode"
+ Parameter { name: "pickResultMode"; type: "PickResultMode" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QPointLight"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QPointLight"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QPointSize"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QPointSize"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QPolygonOffset"
+ prototype: "Qt3DRender::QRenderState"
+ Property { name: "scaleFactor"; type: "float" }
+ Property { name: "depthSteps"; type: "float" }
+ Signal {
+ name: "scaleFactorChanged"
+ Parameter { name: "scaleFactor"; type: "float" }
+ }
+ Signal {
+ name: "depthStepsChanged"
+ Parameter { name: "depthSteps"; type: "float" }
+ }
+ Method {
+ name: "setScaleFactor"
+ Parameter { name: "scaleFactor"; type: "float" }
+ }
+ Method {
+ name: "setDepthSteps"
+ Parameter { name: "depthSteps"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QRenderPass"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "shaderProgram"; type: "Qt3DRender::QShaderProgram"; isPointer: true }
+ Signal {
+ name: "shaderProgramChanged"
+ Parameter { name: "shaderProgram"; type: "QShaderProgram"; isPointer: true }
+ }
+ Method {
+ name: "setShaderProgram"
+ Parameter { name: "shaderProgram"; type: "QShaderProgram"; isPointer: true }
+ }
+ }
+ Component { name: "Qt3DRender::QRenderPassFilter"; prototype: "Qt3DRender::QFrameGraphNode" }
+ Component {
+ name: "Qt3DRender::QRenderSettings"
+ defaultProperty: "activeFrameGraph"
+ prototype: "Qt3DRender::QRenderSettings"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component { name: "Qt3DRender::QRenderState"; prototype: "Qt3DCore::QNode" }
+ Component { name: "Qt3DRender::QRenderStateSet"; prototype: "Qt3DRender::QFrameGraphNode" }
+ Component {
+ name: "Qt3DRender::QRenderSurfaceSelector"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QRenderSurfaceSelector"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component { name: "Qt3DRender::QRenderTarget"; prototype: "Qt3DCore::QComponent" }
+ Component {
+ name: "Qt3DRender::QRenderTargetOutput"
+ prototype: "Qt3DCore::QNode"
+ Enum {
+ name: "AttachmentPoint"
+ values: {
+ "Color0": 0,
+ "Color1": 1,
+ "Color2": 2,
+ "Color3": 3,
+ "Color4": 4,
+ "Color5": 5,
+ "Color6": 6,
+ "Color7": 7,
+ "Color8": 8,
+ "Color9": 9,
+ "Color10": 10,
+ "Color11": 11,
+ "Color12": 12,
+ "Color13": 13,
+ "Color14": 14,
+ "Color15": 15,
+ "Depth": 16,
+ "Stencil": 17,
+ "DepthStencil": 18
+ }
+ }
+ Property { name: "attachmentPoint"; type: "AttachmentPoint" }
+ Property { name: "texture"; type: "QAbstractTexture"; isPointer: true }
+ Property { name: "mipLevel"; type: "int" }
+ Property { name: "layer"; type: "int" }
+ Property { name: "face"; type: "QAbstractTexture::CubeMapFace" }
+ Signal {
+ name: "attachmentPointChanged"
+ Parameter { name: "attachmentPoint"; type: "AttachmentPoint" }
+ }
+ Signal {
+ name: "textureChanged"
+ Parameter { name: "texture"; type: "QAbstractTexture"; isPointer: true }
+ }
+ Signal {
+ name: "mipLevelChanged"
+ Parameter { name: "mipLevel"; type: "int" }
+ }
+ Signal {
+ name: "layerChanged"
+ Parameter { name: "layer"; type: "int" }
+ }
+ Signal {
+ name: "faceChanged"
+ Parameter { name: "face"; type: "QAbstractTexture::CubeMapFace" }
+ }
+ Method {
+ name: "setAttachmentPoint"
+ Parameter { name: "attachmentPoint"; type: "AttachmentPoint" }
+ }
+ Method {
+ name: "setTexture"
+ Parameter { name: "texture"; type: "QAbstractTexture"; isPointer: true }
+ }
+ Method {
+ name: "setMipLevel"
+ Parameter { name: "level"; type: "int" }
+ }
+ Method {
+ name: "setLayer"
+ Parameter { name: "layer"; type: "int" }
+ }
+ Method {
+ name: "setFace"
+ Parameter { name: "face"; type: "QAbstractTexture::CubeMapFace" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QRenderTargetSelector"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ Property { name: "target"; type: "Qt3DRender::QRenderTarget"; isPointer: true }
+ Signal {
+ name: "targetChanged"
+ Parameter { name: "target"; type: "QRenderTarget"; isPointer: true }
+ }
+ Method {
+ name: "setTarget"
+ Parameter { name: "target"; type: "QRenderTarget"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QSceneLoader"
+ prototype: "Qt3DCore::QComponent"
+ Enum {
+ name: "Status"
+ values: {
+ "None": 0,
+ "Loading": 1,
+ "Ready": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ Signal {
+ name: "statusChanged"
+ Parameter { name: "status"; type: "Status" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "arg"; type: "QUrl" }
+ }
+ Method {
+ name: "setStatus"
+ Parameter { name: "status"; type: "Status" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QScissorTest"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QScissorTest"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QSeamlessCubemap"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QSeamlessCubemap"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component { name: "Qt3DRender::QShaderData"; prototype: "Qt3DCore::QComponent" }
+ Component {
+ name: "Qt3DRender::QShaderProgram"
+ prototype: "Qt3DCore::QNode"
+ Enum {
+ name: "ShaderType"
+ values: {
+ "Vertex": 0,
+ "Fragment": 1,
+ "TessellationControl": 2,
+ "TessellationEvaluation": 3,
+ "Geometry": 4,
+ "Compute": 5
+ }
+ }
+ Property { name: "vertexShaderCode"; type: "QByteArray" }
+ Property { name: "tessellationControlShaderCode"; type: "QByteArray" }
+ Property { name: "tessellationEvaluationShaderCode"; type: "QByteArray" }
+ Property { name: "geometryShaderCode"; type: "QByteArray" }
+ Property { name: "fragmentShaderCode"; type: "QByteArray" }
+ Property { name: "computeShaderCode"; type: "QByteArray" }
+ Signal {
+ name: "vertexShaderCodeChanged"
+ Parameter { name: "vertexShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "tessellationControlShaderCodeChanged"
+ Parameter { name: "tessellationControlShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "tessellationEvaluationShaderCodeChanged"
+ Parameter { name: "tessellationEvaluationShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "geometryShaderCodeChanged"
+ Parameter { name: "geometryShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "fragmentShaderCodeChanged"
+ Parameter { name: "fragmentShaderCode"; type: "QByteArray" }
+ }
+ Signal {
+ name: "computeShaderCodeChanged"
+ Parameter { name: "computeShaderCode"; type: "QByteArray" }
+ }
+ Method {
+ name: "setVertexShaderCode"
+ Parameter { name: "vertexShaderCode"; type: "QByteArray" }
+ }
+ Method {
+ name: "setTessellationControlShaderCode"
+ Parameter { name: "tessellationControlShaderCode"; type: "QByteArray" }
+ }
+ Method {
+ name: "setTessellationEvaluationShaderCode"
+ Parameter { name: "tessellationEvaluationShaderCode"; type: "QByteArray" }
+ }
+ Method {
+ name: "setGeometryShaderCode"
+ Parameter { name: "geometryShaderCode"; type: "QByteArray" }
+ }
+ Method {
+ name: "setFragmentShaderCode"
+ Parameter { name: "fragmentShaderCode"; type: "QByteArray" }
+ }
+ Method {
+ name: "setComputeShaderCode"
+ Parameter { name: "computeShaderCode"; type: "QByteArray" }
+ }
+ Method {
+ name: "loadSource"
+ type: "QByteArray"
+ Parameter { name: "sourceUrl"; type: "QUrl" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QSortPolicy"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QSortPolicy"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::QSpotLight"
+ prototype: "Qt3DRender::QAbstractLight"
+ Property { name: "constantAttenuation"; type: "float" }
+ Property { name: "linearAttenuation"; type: "float" }
+ Property { name: "quadraticAttenuation"; type: "float" }
+ Property { name: "localDirection"; type: "QVector3D" }
+ Property { name: "cutOffAngle"; type: "float" }
+ Signal {
+ name: "constantAttenuationChanged"
+ Parameter { name: "constantAttenuation"; type: "float" }
+ }
+ Signal {
+ name: "linearAttenuationChanged"
+ Parameter { name: "linearAttenuation"; type: "float" }
+ }
+ Signal {
+ name: "quadraticAttenuationChanged"
+ Parameter { name: "quadraticAttenuation"; type: "float" }
+ }
+ Signal {
+ name: "localDirectionChanged"
+ Parameter { name: "localDirection"; type: "QVector3D" }
+ }
+ Signal {
+ name: "cutOffAngleChanged"
+ Parameter { name: "cutOffAngle"; type: "float" }
+ }
+ Method {
+ name: "setConstantAttenuation"
+ Parameter { name: "value"; type: "float" }
+ }
+ Method {
+ name: "setLinearAttenuation"
+ Parameter { name: "value"; type: "float" }
+ }
+ Method {
+ name: "setQuadraticAttenuation"
+ Parameter { name: "value"; type: "float" }
+ }
+ Method {
+ name: "setLocalDirection"
+ Parameter { name: "localDirection"; type: "QVector3D" }
+ }
+ Method {
+ name: "setCutOffAngle"
+ Parameter { name: "cutOffAngle"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QStencilMask"
+ prototype: "Qt3DRender::QRenderState"
+ Property { name: "frontOutputMask"; type: "uint" }
+ Property { name: "backOutputMask"; type: "uint" }
+ Signal {
+ name: "frontOutputMaskChanged"
+ Parameter { name: "frontOutputMask"; type: "uint" }
+ }
+ Signal {
+ name: "backOutputMaskChanged"
+ Parameter { name: "backOutputMask"; type: "uint" }
+ }
+ Method {
+ name: "setFrontOutputMask"
+ Parameter { name: "frontOutputMask"; type: "uint" }
+ }
+ Method {
+ name: "setBackOutputMask"
+ Parameter { name: "backOutputMask"; type: "uint" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QStencilOperation"
+ prototype: "Qt3DRender::QRenderState"
+ Property {
+ name: "front"
+ type: "Qt3DRender::QStencilOperationArguments"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "back"
+ type: "Qt3DRender::QStencilOperationArguments"
+ isReadonly: true
+ isPointer: true
+ }
+ }
+ Component {
+ name: "Qt3DRender::QStencilOperationArguments"
+ prototype: "QObject"
+ exports: ["Qt3D.Render/StencilOperationArguments 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "FaceMode"
+ values: {
+ "Front": 1028,
+ "Back": 1029,
+ "FrontAndBack": 1032
+ }
+ }
+ Enum {
+ name: "Operation"
+ values: {
+ "Zero": 0,
+ "Keep": 7680,
+ "Replace": 7681,
+ "Increment": 7682,
+ "Decrement": 7683,
+ "IncrementWrap": 34055,
+ "DecrementWrap": 34056,
+ "Invert": 5386
+ }
+ }
+ Property { name: "faceMode"; type: "FaceMode"; isReadonly: true }
+ Property { name: "stencilTestFailureOperation"; type: "Operation" }
+ Property { name: "depthTestFailureOperation"; type: "Operation" }
+ Property { name: "allTestsPassOperation"; type: "Operation" }
+ Signal {
+ name: "stencilTestFailureOperationChanged"
+ Parameter { name: "stencilFail"; type: "Operation" }
+ }
+ Signal {
+ name: "depthTestFailureOperationChanged"
+ Parameter { name: "depthFail"; type: "Operation" }
+ }
+ Signal {
+ name: "allTestsPassOperationChanged"
+ Parameter { name: "stencilDepthPass"; type: "Operation" }
+ }
+ Signal {
+ name: "faceModeChanged"
+ Parameter { name: "faceMode"; type: "FaceMode" }
+ }
+ Method {
+ name: "setStencilTestFailureOperation"
+ Parameter { name: "operation"; type: "Operation" }
+ }
+ Method {
+ name: "setDepthTestFailureOperation"
+ Parameter { name: "operation"; type: "Operation" }
+ }
+ Method {
+ name: "setAllTestsPassOperation"
+ Parameter { name: "operation"; type: "Operation" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QStencilTest"
+ prototype: "Qt3DRender::QRenderState"
+ Property {
+ name: "front"
+ type: "Qt3DRender::QStencilTestArguments"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "back"
+ type: "Qt3DRender::QStencilTestArguments"
+ isReadonly: true
+ isPointer: true
+ }
+ }
+ Component {
+ name: "Qt3DRender::QStencilTestArguments"
+ prototype: "QObject"
+ exports: ["Qt3D.Render/StencilTestArguments 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "StencilFaceMode"
+ values: {
+ "Front": 1028,
+ "Back": 1029,
+ "FrontAndBack": 1032
+ }
+ }
+ Enum {
+ name: "StencilFunction"
+ values: {
+ "Never": 512,
+ "Always": 519,
+ "Less": 513,
+ "LessOrEqual": 515,
+ "Equal": 514,
+ "GreaterOrEqual": 518,
+ "Greater": 516,
+ "NotEqual": 517
+ }
+ }
+ Property { name: "faceMode"; type: "StencilFaceMode"; isReadonly: true }
+ Property { name: "comparisonMask"; type: "uint" }
+ Property { name: "referenceValue"; type: "int" }
+ Property { name: "stencilFunction"; type: "StencilFunction" }
+ Signal {
+ name: "comparisonMaskChanged"
+ Parameter { name: "comparisonMask"; type: "uint" }
+ }
+ Signal {
+ name: "stencilFunctionChanged"
+ Parameter { name: "stencilFunction"; type: "StencilFunction" }
+ }
+ Signal {
+ name: "referenceValueChanged"
+ Parameter { name: "referenceValue"; type: "int" }
+ }
+ Signal {
+ name: "faceModeChanged"
+ Parameter { name: "faceMode"; type: "StencilFaceMode" }
+ }
+ Method {
+ name: "setComparisonMask"
+ Parameter { name: "comparisonMask"; type: "uint" }
+ }
+ Method {
+ name: "setReferenceValue"
+ Parameter { name: "referenceValue"; type: "int" }
+ }
+ Method {
+ name: "setStencilFunction"
+ Parameter { name: "stencilFunction"; type: "StencilFunction" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QTechnique"
+ prototype: "Qt3DCore::QNode"
+ Property {
+ name: "graphicsApiFilter"
+ type: "Qt3DRender::QGraphicsApiFilter"
+ isReadonly: true
+ isPointer: true
+ }
+ }
+ Component { name: "Qt3DRender::QTechniqueFilter"; prototype: "Qt3DRender::QFrameGraphNode" }
+ Component { name: "Qt3DRender::QTexture1D"; prototype: "Qt3DRender::QAbstractTexture" }
+ Component { name: "Qt3DRender::QTexture1DArray"; prototype: "Qt3DRender::QAbstractTexture" }
+ Component { name: "Qt3DRender::QTexture2D"; prototype: "Qt3DRender::QAbstractTexture" }
+ Component { name: "Qt3DRender::QTexture2DArray"; prototype: "Qt3DRender::QAbstractTexture" }
+ Component {
+ name: "Qt3DRender::QTexture2DMultisample"
+ prototype: "Qt3DRender::QAbstractTexture"
+ }
+ Component {
+ name: "Qt3DRender::QTexture2DMultisampleArray"
+ prototype: "Qt3DRender::QAbstractTexture"
+ }
+ Component { name: "Qt3DRender::QTexture3D"; prototype: "Qt3DRender::QAbstractTexture" }
+ Component { name: "Qt3DRender::QTextureBuffer"; prototype: "Qt3DRender::QAbstractTexture" }
+ Component { name: "Qt3DRender::QTextureCubeMap"; prototype: "Qt3DRender::QAbstractTexture" }
+ Component {
+ name: "Qt3DRender::QTextureCubeMapArray"
+ prototype: "Qt3DRender::QAbstractTexture"
+ }
+ Component {
+ name: "Qt3DRender::QTextureImage"
+ prototype: "Qt3DRender::QAbstractTextureImage"
+ Enum {
+ name: "Status"
+ values: {
+ "None": 0,
+ "Loading": 1,
+ "Ready": 2,
+ "Error": 3
+ }
+ }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ Signal {
+ name: "statusChanged"
+ Parameter { name: "status"; type: "Status" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QTextureLoader"
+ prototype: "Qt3DRender::QAbstractTexture"
+ Property { name: "source"; type: "QUrl" }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ }
+ Component { name: "Qt3DRender::QTextureRectangle"; prototype: "Qt3DRender::QAbstractTexture" }
+ Component {
+ name: "Qt3DRender::QTextureWrapMode"
+ prototype: "QObject"
+ exports: ["Qt3D.Render/WrapMode 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "WrapMode"
+ values: {
+ "Repeat": 10497,
+ "MirroredRepeat": 33648,
+ "ClampToEdge": 33071,
+ "ClampToBorder": 33069
+ }
+ }
+ Property { name: "x"; type: "WrapMode" }
+ Property { name: "y"; type: "WrapMode" }
+ Property { name: "z"; type: "WrapMode" }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "x"; type: "WrapMode" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "y"; type: "WrapMode" }
+ }
+ Signal {
+ name: "zChanged"
+ Parameter { name: "z"; type: "WrapMode" }
+ }
+ Method {
+ name: "setX"
+ Parameter { name: "x"; type: "WrapMode" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "y"; type: "WrapMode" }
+ }
+ Method {
+ name: "setZ"
+ Parameter { name: "z"; type: "WrapMode" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QViewport"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ Property { name: "normalizedRect"; type: "QRectF" }
+ Signal {
+ name: "normalizedRectChanged"
+ Parameter { name: "normalizedRect"; type: "QRectF" }
+ }
+ Method {
+ name: "setNormalizedRect"
+ Parameter { name: "normalizedRect"; type: "QRectF" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DBuffer"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QBuffer"
+ exports: ["Qt3D.Render/Buffer 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QVariant" }
+ Signal { name: "bufferDataChanged" }
+ Signal { name: "bufferDataChanged" }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DEffect"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QEffect"
+ exports: ["Qt3D.Render/Effect 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "techniques"; type: "Qt3DRender::QTechnique"; isList: true; isReadonly: true }
+ Property { name: "parameters"; type: "Qt3DRender::QParameter"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DGeometry"
+ defaultProperty: "attributes"
+ prototype: "Qt3DRender::QGeometry"
+ exports: ["Qt3D.Render/Geometry 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "attributes"; type: "Qt3DRender::QAttribute"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DMaterial"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QMaterial"
+ exports: ["Qt3D.Render/Material 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "parameters"; type: "Qt3DRender::QParameter"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DParameter"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::Render::Quick::Quick3DParameter"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DRenderPass"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QRenderPass"
+ exports: ["Qt3D.Render/RenderPass 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "filterKeys"; type: "Qt3DRender::QFilterKey"; isList: true; isReadonly: true }
+ Property {
+ name: "renderStates"
+ type: "Qt3DRender::QRenderState"
+ isList: true
+ isReadonly: true
+ }
+ Property { name: "parameters"; type: "Qt3DRender::QParameter"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DRenderPassFilter"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QRenderPassFilter"
+ exports: ["Qt3D.Render/RenderPassFilter 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "matchAny"; type: "Qt3DRender::QFilterKey"; isList: true; isReadonly: true }
+ Property { name: "parameters"; type: "Qt3DRender::QParameter"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DRenderTargetOutput"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QRenderTarget"
+ exports: ["Qt3D.Render/RenderTarget 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "attachments"
+ type: "Qt3DRender::QRenderTargetOutput"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DRenderTargetSelector"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QRenderTargetSelector"
+ exports: ["Qt3D.Render/RenderTargetSelector 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "drawBuffers"; type: "QVariantList" }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DScene"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QSceneLoader"
+ exports: ["Qt3D.Render/SceneLoader 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DShaderData"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::Render::Quick::Quick3DShaderData"
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DShaderDataArray"
+ defaultProperty: "values"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "values"; type: "Qt3DRender::QShaderData"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DStateSet"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QRenderStateSet"
+ exports: ["Qt3D.Render/RenderStateSet 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "renderStates"
+ type: "Qt3DRender::QRenderState"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DTechnique"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QTechnique"
+ exports: ["Qt3D.Render/Technique 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "filterKeys"; type: "Qt3DRender::QFilterKey"; isList: true; isReadonly: true }
+ Property { name: "renderPasses"; type: "Qt3DRender::QRenderPass"; isList: true; isReadonly: true }
+ Property { name: "parameters"; type: "Qt3DRender::QParameter"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DTechniqueFilter"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QTechniqueFilter"
+ exports: ["Qt3D.Render/TechniqueFilter 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "matchAll"; type: "Qt3DRender::QFilterKey"; isList: true; isReadonly: true }
+ Property { name: "parameters"; type: "Qt3DRender::QParameter"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DTextureExtension"
+ defaultProperty: "textureImages"
+ prototype: "Qt3DRender::QTexture1D"
+ exports: [
+ "Qt3D.Render/Texture1D 2.0",
+ "Qt3D.Render/Texture1DArray 2.0",
+ "Qt3D.Render/Texture2D 2.0",
+ "Qt3D.Render/Texture2DArray 2.0",
+ "Qt3D.Render/Texture2DMultisample 2.0",
+ "Qt3D.Render/Texture2DMultisampleArray 2.0",
+ "Qt3D.Render/Texture3D 2.0",
+ "Qt3D.Render/TextureBuffer 2.0",
+ "Qt3D.Render/TextureCubeMap 2.0",
+ "Qt3D.Render/TextureCubeMapArray 2.0",
+ "Qt3D.Render/TextureLoader 2.0",
+ "Qt3D.Render/TextureRectangle 2.0"
+ ]
+ exportMetaObjectRevisions: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+ Property {
+ name: "textureImages"
+ type: "Qt3DRender::QAbstractTextureImage"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DRender::Render::Quick::Quick3DViewport"
+ defaultProperty: "data"
+ prototype: "Qt3DRender::QViewport"
+ exports: ["Qt3D.Render/Viewport 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+}
diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
index 4382a1bf6..f69c3e4a9 100644
--- a/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
+++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.cpp
@@ -1,42 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qt3dquick3drenderplugin.h"
-#include <Qt3DRender/qabstractsceneloader.h>
#include <Qt3DRender/qsceneloader.h>
#include <Qt3DRender/qmesh.h>
#include <Qt3DRender/qrenderpass.h>
@@ -45,77 +47,71 @@
#include <Qt3DRender/qrenderpassfilter.h>
#include <Qt3DRender/qtechniquefilter.h>
#include <Qt3DRender/qrendertargetselector.h>
+#include <Qt3DRender/qrendersurfaceselector.h>
#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qframegraph.h>
#include <Qt3DRender/qtechnique.h>
#include <Qt3DRender/qcameraselector.h>
#include <Qt3DRender/qeffect.h>
#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qannotation.h>
-#include <Qt3DRender/qparametermapping.h>
-#include <Qt3DRender/qcuboidmesh.h>
-#include <Qt3DRender/qcylindermesh.h>
-#include <Qt3DRender/qplanemesh.h>
-#include <Qt3DRender/qspheremesh.h>
-#include <Qt3DRender/qtorusmesh.h>
+#include <Qt3DRender/qfilterkey.h>
#include <Qt3DRender/qlayer.h>
-#include <Qt3DRender/qlayerfilter.h>
-#include <Qt3DRender/qlight.h>
+#include <Qt3DRender/qabstractlight.h>
#include <Qt3DRender/qspotlight.h>
#include <Qt3DRender/qdirectionallight.h>
#include <Qt3DRender/qpointlight.h>
#include <Qt3DRender/qgraphicsapifilter.h>
#include <Qt3DRender/qrenderstate.h>
-#include <Qt3DRender/qblendstate.h>
+#include <Qt3DRender/qblendequationarguments.h>
#include <Qt3DRender/qblendequation.h>
#include <Qt3DRender/qalphatest.h>
#include <Qt3DRender/qdepthtest.h>
-#include <Qt3DRender/qdepthmask.h>
+#include <Qt3DRender/qnodepthmask.h>
#include <Qt3DRender/qcullface.h>
#include <Qt3DRender/qfrontface.h>
#include <Qt3DRender/qstenciltest.h>
-#include <Qt3DRender/qstenciltestseparate.h>
+#include <Qt3DRender/qstenciltestarguments.h>
#include <Qt3DRender/qscissortest.h>
#include <Qt3DRender/qdithering.h>
-#include <Qt3DRender/qrenderattachment.h>
-#include <Qt3DRender/qclearbuffer.h>
-#include <Qt3DRender/qsortcriterion.h>
+#include <Qt3DRender/qrendertargetoutput.h>
+#include <Qt3DRender/qclearbuffers.h>
#include <Qt3DRender/qalphacoverage.h>
+#include <Qt3DRender/qmultisampleantialiasing.h>
#include <Qt3DRender/qpointsize.h>
#include <Qt3DRender/qpolygonoffset.h>
#include <Qt3DRender/qcolormask.h>
#include <Qt3DRender/qshaderdata.h>
#include <Qt3DRender/qnodraw.h>
#include <Qt3DRender/qclipplane.h>
-#include <Qt3DRender/qstencilop.h>
-#include <Qt3DRender/qstencilopseparate.h>
+#include <Qt3DRender/qseamlesscubemap.h>
+#include <Qt3DRender/qsortpolicy.h>
+#include <Qt3DRender/qstenciloperation.h>
+#include <Qt3DRender/qstenciloperationarguments.h>
#include <Qt3DRender/qstencilmask.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
#include <Qt3DRender/qgeometry.h>
-#include <Qt3DRender/qtorusgeometry.h>
-#include <Qt3DRender/qspheregeometry.h>
-#include <Qt3DRender/qcuboidgeometry.h>
-#include <Qt3DRender/qplanegeometry.h>
#include <Qt3DRender/qgeometryrenderer.h>
-#include <Qt3DRender/qcylindergeometry.h>
#include <Qt3DRender/qobjectpicker.h>
-#include <Qt3DRender/qboundingvolumespecifier.h>
-#include <Qt3DRender/qboundingvolumedebug.h>
+#include <Qt3DRender/qpickevent.h>
#include <Qt3DRender/qfrustumculling.h>
-#include <Qt3DRender/qlighting.h>
#include <Qt3DRender/qdispatchcompute.h>
+#include <Qt3DRender/qcomputecommand.h>
+#include <Qt3DRender/qcameralens.h>
+#include <Qt3DRender/qcamera.h>
+#include <Qt3DRender/qrendersettings.h>
+#include <Qt3DRender/qpickingsettings.h>
+#include <Qt3DRender/private/qboundingvolumedebug_p.h>
+#include <Qt3DQuickRender/private/quick3dlayerfilter_p.h>
#include <Qt3DQuickRender/private/quick3dtechnique_p.h>
#include <Qt3DQuickRender/private/quick3dmaterial_p.h>
#include <Qt3DQuickRender/private/quick3dtechniquefilter_p.h>
#include <Qt3DQuickRender/private/quick3dviewport_p.h>
#include <Qt3DQuickRender/private/quick3drenderpassfilter_p.h>
-#include <Qt3DQuickRender/private/quick3drendertarget_p.h>
+#include <Qt3DQuickRender/private/quick3drendertargetoutput_p.h>
#include <Qt3DQuickRender/private/quick3deffect_p.h>
#include <Qt3DQuickRender/private/quick3dscene_p.h>
#include <Qt3DQuickRender/private/quick3dtexture_p.h>
#include <Qt3DQuickRender/private/quick3drenderpass_p.h>
-#include <Qt3DQuickRender/private/quick3dsortmethod_p.h>
#include <Qt3DQuickRender/private/quick3dparameter_p.h>
#include <Qt3DQuickRender/private/quick3dshaderdata_p.h>
#include <Qt3DQuickRender/private/quick3dshaderdataarray_p.h>
@@ -125,64 +121,41 @@
#include <Qt3DQuickRender/private/quick3dbuffer_p.h>
#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
-static void initResources()
-{
- Q_INIT_RESOURCE(defaults);
-}
+#include <QtGui/qwindow.h>
QT_BEGIN_NAMESPACE
-static const struct {
- const char *type;
- int major, minor;
-} qmldir [] = {
- // Materials
- { "PhongMaterial", 2, 0 },
- { "PhongAlphaMaterial", 2, 0 },
- { "DiffuseMapMaterial", 2, 0 },
- { "DiffuseSpecularMapMaterial", 2, 0 },
- { "NormalDiffuseMapAlphaMaterial", 2, 0 },
- { "NormalDiffuseMapMaterial", 2, 0 },
- { "NormalDiffuseSpecularMapMaterial", 2, 0 },
- { "PerVertexColorMaterial", 2, 0 },
- { "GoochMaterial", 2, 0 },
- { "TextureMaterial", 2, 0 },
- // FrameGraphs
- { "ForwardRenderer", 2, 0 },
- // Entities
- { "SkyboxEntity", 2, 0 }
-};
-
QVariantList Quick3DShaderDataArrayToVariantListConverter(Qt3DRender::Render::Quick::Quick3DShaderDataArray *array)
{
- QList<Qt3DRender::QShaderData *> arrayValues = array->values();
+ const QVector<Qt3DRender::QShaderData *> arrayValues = array->values();
QVariantList values;
values.reserve(arrayValues.size());
- Q_FOREACH (Qt3DRender::QShaderData *data, arrayValues)
+ for (Qt3DRender::QShaderData *data : arrayValues)
values.append(QVariant::fromValue(data));
return values;
}
void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
{
- // Init resources for defaults QML files
- initResources();
-
Qt3DRender::Quick::Quick3DRender_initialize();
+ qmlRegisterUncreatableType<QWindow>(uri, 2, 0, "Window", "Only for assigning window surface property");
+
// Converters
QMetaType::registerConverter<Qt3DRender::Render::Quick::Quick3DShaderDataArray*, QVariantList>(Quick3DShaderDataArrayToVariantListConverter);
+ // Renderer setttings
+ qmlRegisterType<Qt3DRender::QRenderSettings>(uri, 2, 0, "RenderSettings");
+ qmlRegisterType<Qt3DRender::QPickingSettings>(uri, 2, 0, "PickingSettings");
+
// @uri Qt3D.Render
- qmlRegisterUncreatableType<Qt3DRender::QAbstractSceneLoader>(uri, 2, 0, "QAbstractSceneLoader", "QAbstractScene is abstract");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QSceneLoader, Qt3DRender::Render::Quick::Quick3DScene>("QSceneLoader", "Qt3D.Render/SceneLoader", uri, 2, 0, "SceneLoader");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QEffect, Qt3DRender::Render::Quick::Quick3DEffect>("QEffect", "Qt3D.Render/Effect", uri, 2, 0, "Effect");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTechnique, Qt3DRender::Render::Quick::Quick3DTechnique>("QTechnique", "Qt3D.Render/Technique", uri, 2, 0, "Technique");
- qmlRegisterType<Qt3DRender::QAnnotation>(uri, 2, 0, "Annotation");
+ qmlRegisterType<Qt3DRender::QFilterKey>(uri, 2, 0, "FilterKey");
qmlRegisterType<Qt3DRender::QGraphicsApiFilter>(uri, 2, 0, "GraphicsApiFilter");
qmlRegisterUncreatableType<Qt3DRender::QParameter>(uri, 2, 0, "QParameter", "Quick3D should instantiate Quick3DParameter only");
qmlRegisterType<Qt3DRender::Render::Quick::Quick3DParameter>(uri, 2, 0, "Parameter");
- qmlRegisterType<Qt3DRender::QParameterMapping>(uri, 2, 0, "ParameterMapping");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QMaterial, Qt3DRender::Render::Quick::Quick3DMaterial>("QMaterial", "Qt3D.Render/Material", uri, 2, 0, "Material");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QRenderPass, Qt3DRender::Render::Quick::Quick3DRenderPass>("QRenderPass", "Qt3D.Render/RenderPass", uri, 2, 0, "RenderPass");
qmlRegisterType<Qt3DRender::QShaderProgram>(uri, 2, 0, "ShaderProgram");
@@ -190,9 +163,13 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DRender::Render::Quick::Quick3DShaderDataArray>(uri, 2, 0, "ShaderDataArray");
qmlRegisterType<Qt3DRender::Render::Quick::Quick3DShaderData>(uri, 2, 0, "ShaderData");
+ // Camera
+ qmlRegisterType<Qt3DRender::QCamera>(uri, 2, 0, "Camera");
+ qmlRegisterType<Qt3DRender::QCameraLens>(uri, 2, 0, "CameraLens");
+
// Textures
qmlRegisterType<Qt3DRender::QTextureWrapMode>(uri, 2, 0, "WrapMode");//, QStringLiteral("QTextureWrapMode cannot be created from QML"));
- qmlRegisterUncreatableType<Qt3DRender::QAbstractTextureProvider>(uri, 2, 0, "Texture", QStringLiteral("Texture should be created from one of the subclasses"));
+ qmlRegisterUncreatableType<Qt3DRender::QAbstractTexture>(uri, 2, 0, "Texture", QStringLiteral("Texture should be created from one of the subclasses"));
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTexture1D, Qt3DRender::Render::Quick::Quick3DTextureExtension>("QTexture1D", "Qt3D.Render/Texture1D", uri, 2, 0, "Texture1D");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTexture1DArray, Qt3DRender::Render::Quick::Quick3DTextureExtension>("QTexture1DArray", "Qt3D.Render/Texture1DArray", uri, 2, 0, "Texture1DArray");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTexture2D, Qt3DRender::Render::Quick::Quick3DTextureExtension>("QTexture2D", "Qt3D.Render/Texture2D", uri, 2, 0, "Texture2D");
@@ -204,43 +181,35 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTexture2DMultisampleArray, Qt3DRender::Render::Quick::Quick3DTextureExtension>("QTexture2DMultisampleArray", "Qt3D.Render/Texture2DMultisampleArray", uri, 2, 0, "Texture2DMultisampleArray");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTextureRectangle, Qt3DRender::Render::Quick::Quick3DTextureExtension>("QTextureRectangle", "Qt3D.Render/TextureRectangle", uri, 2, 0, "TextureRectangle");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTextureBuffer, Qt3DRender::Render::Quick::Quick3DTextureExtension>("QTextureBuffer", "Qt3D.Render/TextureBuffer", uri, 2, 0, "TextureBuffer");
+ Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTextureLoader, Qt3DRender::Render::Quick::Quick3DTextureExtension>("QTextureLoader", "Qt3D.Render/TextureLoader", uri, 2, 0, "TextureLoader");
qmlRegisterUncreatableType<Qt3DRender::QAbstractTextureImage>(uri, 2, 0, "QAbstractTextureImage", QStringLiteral("QAbstractTextureImage is abstract"));
qmlRegisterType<Qt3DRender::QTextureImage>(uri, 2, 0, "TextureImage");
// Geometry
- qmlRegisterUncreatableType<Qt3DRender::QAbstractAttribute>(uri, 2, 0, "QAbstractAttribute", QStringLiteral("QAbstractAttribute is abstract"));
- qmlRegisterUncreatableType<Qt3DRender::QAbstractBuffer>(uri, 2, 0, "QAbstractBuffer", QStringLiteral("QAbstractBuffer is abstract"));
qmlRegisterType<Qt3DRender::QAttribute>(uri, 2, 0, "Attribute");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QBuffer, Qt3DRender::Render::Quick::Quick3DBuffer>("QBuffer", "Qt3D.Render/Buffer", uri, 2, 0, "Buffer");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QGeometry, Qt3DRender::Render::Quick::Quick3DGeometry>("QGeometry", "Qt3D.Render/Geometry", uri, 2, 0, "Geometry");
qmlRegisterType<Qt3DRender::QGeometryRenderer>(uri, 2, 0, "GeometryRenderer");
- qmlRegisterUncreatableType<Qt3DRender::QBoundingVolumeSpecifier>(uri, 2, 0, "QBoundingVolumeSpecifier", QStringLiteral("QBoundingVolumeSpecifier is used as a grouped property"));
// Debug components
- qmlRegisterType<Qt3DRender::QBoundingVolumeDebug>(uri, 2, 0, "BoundingVolumeDebug");
+// qmlRegisterType<Qt3DRender::QBoundingVolumeDebug>(uri, 2, 0, "BoundingVolumeDebug");
+
+ // Mesh
+ qmlRegisterType<Qt3DRender::QMesh>(uri, 2, 0, "Mesh");
// Picking
qmlRegisterType<Qt3DRender::QObjectPicker>(uri, 2, 0, "ObjectPicker");
+ qmlRegisterUncreatableType<Qt3DRender::QPickEvent>(uri, 2, 0, "PickEvent", QStringLiteral("Events cannot be created"));
- // Meshes
- qmlRegisterType<Qt3DRender::QMesh>(uri, 2, 0, "Mesh");
- qmlRegisterType<Qt3DRender::QCuboidMesh>(uri, 2, 0, "CuboidMesh");
- qmlRegisterType<Qt3DRender::QCuboidGeometry>(uri, 2, 0, "CuboidGeometry");
- qmlRegisterType<Qt3DRender::QCylinderMesh>(uri, 2, 0, "CylinderMesh");
- qmlRegisterType<Qt3DRender::QCylinderGeometry>(uri, 2, 0, "CylinderGeometry");
- qmlRegisterType<Qt3DRender::QPlaneMesh>(uri, 2, 0, "PlaneMesh");
- qmlRegisterType<Qt3DRender::QPlaneGeometry>(uri, 2, 0, "PlaneGeometry");
- qmlRegisterType<Qt3DRender::QTorusMesh>(uri, 2, 0, "TorusMesh");
- qmlRegisterType<Qt3DRender::QTorusGeometry>(uri, 2, 0, "TorusGeometry");
- qmlRegisterType<Qt3DRender::QSphereMesh>(uri, 2, 0, "SphereMesh");
- qmlRegisterType<Qt3DRender::QSphereGeometry>(uri, 2, 0, "SphereGeometry");
+ // Compute Job
+ qmlRegisterType<Qt3DRender::QComputeCommand>(uri, 2, 0, "ComputeCommand");
// Layers
qmlRegisterType<Qt3DRender::QLayer>(uri, 2, 0, "Layer");
- qmlRegisterType<Qt3DRender::QLayerFilter>(uri, 2, 0, "LayerFilter");
+ Qt3DRender::Quick::registerExtendedType<Qt3DRender::QLayerFilter, Qt3DRender::Render::Quick::Quick3DLayerFilter>("QLayerFilter", "Qt3D.Render/LayerFilter", uri, 2, 0, "LayerFilter");
// Lights
- qmlRegisterType<Qt3DRender::QLight>(uri, 2, 0, "Light");
+ qmlRegisterUncreatableType<Qt3DRender::QAbstractLight>(uri, 2, 0, "Light", QStringLiteral("Light is an abstract base class"));
qmlRegisterType<Qt3DRender::QPointLight>(uri, 2, 0, "PointLight");
qmlRegisterType<Qt3DRender::QDirectionalLight>(uri, 2, 0, "DirectionalLight");
qmlRegisterType<Qt3DRender::QSpotLight>(uri, 2, 0, "SpotLight");
@@ -251,34 +220,34 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QTechniqueFilter, Qt3DRender::Render::Quick::Quick3DTechniqueFilter>("QTechniqueFilter", "Qt3D.Render/TechniqueFilter", uri, 2, 0, "TechniqueFilter");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QViewport, Qt3DRender::Render::Quick::Quick3DViewport>("QViewport", "Qt3D.Render/Viewport", uri, 2, 0, "Viewport");
Qt3DRender::Quick::registerExtendedType<Qt3DRender::QRenderTargetSelector, Qt3DRender::Render::Quick::Quick3DRenderTargetSelector>("QRenderTargetSelector", "Qt3D.Render/RenderTargetSelector", uri, 2, 0, "RenderTargetSelector");
- qmlRegisterType<Qt3DRender::QClearBuffer>(uri, 2, 0, "ClearBuffer");
+ qmlRegisterType<Qt3DRender::QClearBuffers>(uri, 2, 0, "ClearBuffers");
qmlRegisterUncreatableType<Qt3DRender::QFrameGraphNode>(uri, 2, 0, "FrameGraphNode", QStringLiteral("FrameGraphNode is a base class"));
- Qt3DRender::Quick::registerExtendedType<Qt3DRender::QStateSet, Qt3DRender::Render::Quick::Quick3DStateSet>("QStateSet", "Qt3D.Render/StateSet", uri, 2, 0, "StateSet");
+ Qt3DRender::Quick::registerExtendedType<Qt3DRender::QRenderStateSet, Qt3DRender::Render::Quick::Quick3DStateSet>("QRenderStateSet", "Qt3D.Render/RenderStateSet", uri, 2, 0, "RenderStateSet");
qmlRegisterType<Qt3DRender::QNoDraw>(uri, 2, 0, "NoDraw");
- qmlRegisterType<Qt3DRender::QFrameGraph>(uri, 2, 0, "FrameGraph");
qmlRegisterType<Qt3DRender::QFrustumCulling>(uri, 2, 0, "FrustumCulling");
- qmlRegisterType<Qt3DRender::QLighting>(uri, 2, 0, "Lighting");
qmlRegisterType<Qt3DRender::QDispatchCompute>(uri, 2, 0, "DispatchCompute");
// RenderTarget
- qmlRegisterType<Qt3DRender::QRenderAttachment>(uri, 2, 0, "RenderAttachment");
- Qt3DRender::Quick::registerExtendedType<Qt3DRender::QRenderTarget, Qt3DRender::Render::Quick::Quick3DRenderTarget>("QRenderTarget", "Qt3D.Render/RenderTarget", uri, 2, 0, "RenderTarget");
+ qmlRegisterType<Qt3DRender::QRenderTargetOutput>(uri, 2, 0, "RenderTargetOutput");
+ Qt3DRender::Quick::registerExtendedType<Qt3DRender::QRenderTarget, Qt3DRender::Render::Quick::Quick3DRenderTargetOutput>("QRenderTarget", "Qt3D.Render/RenderTarget", uri, 2, 0, "RenderTarget");
+
+ // Render surface selector
+ qmlRegisterType<Qt3DRender::QRenderSurfaceSelector>(uri, 2, 0, "RenderSurfaceSelector");
// Sorting
- qmlRegisterType<Qt3DRender::QSortCriterion>(uri, 2, 0, "SortCriterion");
- Qt3DRender::Quick::registerExtendedType<Qt3DRender::QSortMethod, Qt3DRender::Render::Quick::Quick3DSortMethod>("QSortMethod", "Qt3D.Render/SortMethod", uri, 2, 0, "SortMethod");
+ qmlRegisterType<Qt3DRender::QSortPolicy>(uri, 2, 0, "SortPolicy");
// RenderStates
qmlRegisterUncreatableType<Qt3DRender::QRenderState>(uri, 2, 0, "RenderState", QStringLiteral("QRenderState is a base class"));
- qmlRegisterType<Qt3DRender::QBlendState>(uri, 2, 0, "BlendState");
- qmlRegisterType<Qt3DRender::QBlendStateSeparate>(uri, 2, 0, "BlendStateSeparate");
+ qmlRegisterType<Qt3DRender::QBlendEquationArguments>(uri, 2, 0, "BlendEquationArguments");
qmlRegisterType<Qt3DRender::QBlendEquation>(uri, 2, 0, "BlendEquation");
qmlRegisterType<Qt3DRender::QAlphaTest>(uri, 2, 0, "AlphaTest");
qmlRegisterType<Qt3DRender::QDepthTest>(uri, 2, 0, "DepthTest");
- qmlRegisterType<Qt3DRender::QDepthMask>(uri, 2, 0, "DepthMask");
+ qmlRegisterType<Qt3DRender::QMultiSampleAntiAliasing>(uri, 2, 0, "MultiSampleAntiAliasing");
+ qmlRegisterType<Qt3DRender::QNoDepthMask>(uri, 2, 0, "NoDepthMask");
qmlRegisterType<Qt3DRender::QCullFace>(uri, 2, 0, "CullFace");
qmlRegisterType<Qt3DRender::QFrontFace>(uri, 2, 0, "FrontFace");
- qmlRegisterUncreatableType<Qt3DRender::QStencilTestSeparate>(uri, 2, 0, "StencilTestSeparate", QStringLiteral("QStencilTestSeparate cannot be instantiated on its own"));
+ qmlRegisterUncreatableType<Qt3DRender::QStencilTestArguments>(uri, 2, 0, "StencilTestArguments", QStringLiteral("QStencilTestArguments cannot be instantiated on its own"));
qmlRegisterType<Qt3DRender::QStencilTest>(uri, 2, 0, "StencilTest");
qmlRegisterType<Qt3DRender::QScissorTest>(uri, 2, 0, "ScissorTest");
qmlRegisterType<Qt3DRender::QDithering>(uri, 2, 0, "Dithering");
@@ -287,18 +256,10 @@ void Qt3DQuick3DRenderPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DRender::QPolygonOffset>(uri, 2, 0, "PolygonOffset");
qmlRegisterType<Qt3DRender::QColorMask>(uri, 2, 0, "ColorMask");
qmlRegisterType<Qt3DRender::QClipPlane>(uri, 2, 0, "ClipPlane");
- qmlRegisterUncreatableType<Qt3DRender::QStencilOpSeparate>(uri, 2, 0, "StencilOpSeparate", QStringLiteral("StencilOpSeparate cannot be instanciated on its own"));
- qmlRegisterType<Qt3DRender::QStencilOp>(uri, 2, 0, "StencilOp");
+ qmlRegisterUncreatableType<Qt3DRender::QStencilOperationArguments>(uri, 2, 0, "StencilOperationArguments", QStringLiteral("StencilOperationArguments cannot be instanciated on its own"));
+ qmlRegisterType<Qt3DRender::QSeamlessCubemap>(uri, 2, 0, "SeamlessCubemap");
+ qmlRegisterType<Qt3DRender::QStencilOperation>(uri, 2, 0, "StencilOperation");
qmlRegisterType<Qt3DRender::QStencilMask>(uri, 2, 0, "StencilMask");
-
- // Register types provided as QML files compiled into the plugin
- for (int i = 0; i < int(sizeof(qmldir) / sizeof(qmldir[0])); i++) {
- QString path = QStringLiteral("qrc:/Qt3D/Render/defaults/qml/");
- qmlRegisterType(QUrl(path + qmldir[i].type + QStringLiteral(".qml")),
- uri,
- qmldir[i].major, qmldir[i].minor,
- qmldir[i].type);
- }
}
QT_END_NAMESPACE
diff --git a/src/quick3d/imports/render/qt3dquick3drenderplugin.h b/src/quick3d/imports/render/qt3dquick3drenderplugin.h
index 05aceab7f..53235fdb9 100644
--- a/src/quick3d/imports/render/qt3dquick3drenderplugin.h
+++ b/src/quick3d/imports/render/qt3dquick3drenderplugin.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,6 +42,13 @@
#include <QtQml/QQmlExtensionPlugin>
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt3D_Render);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class Qt3DQuick3DRenderPlugin : public QQmlExtensionPlugin
@@ -46,6 +56,7 @@ class Qt3DQuick3DRenderPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ Qt3DQuick3DRenderPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
void registerTypes(const char *uri) Q_DECL_OVERRIDE;
};
diff --git a/src/quick3d/imports/scene3d/importsscene3d.pro b/src/quick3d/imports/scene3d/importsscene3d.pro
index 4c0724e20..078d5e2a1 100644
--- a/src/quick3d/imports/scene3d/importsscene3d.pro
+++ b/src/quick3d/imports/scene3d/importsscene3d.pro
@@ -1,18 +1,32 @@
CXX_MODULE = qml
TARGET = qtquickscene3dplugin
TARGETPATH = QtQuick/Scene3D
+IMPORT_VERSION = 2.0
-QT += qml quick 3dcore 3drender 3dinput
+QT += qml quick 3dcore 3drender 3drender-private 3dinput
+
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
HEADERS += \
qtquickscene3dplugin.h \
scene3dlogging_p.h \
- scene3ditem_p.h
+ scene3ditem_p.h \
+ scene3dcleaner_p.h \
+ scene3drenderer_p.h \
+ scene3dsgnode_p.h \
+ scene3dsgmaterialshader_p.h \
+ scene3dsgmaterial_p.h
SOURCES += \
qtquickscene3dplugin.cpp \
scene3ditem.cpp \
- scene3dlogging.cpp
+ scene3dlogging.cpp \
+ scene3dcleaner.cpp \
+ scene3drenderer.cpp \
+ scene3dsgnode.cpp \
+ scene3dsgmaterialshader.cpp \
+ scene3dsgmaterial.cpp
OTHER_FILES += qmldir
diff --git a/src/quick3d/imports/scene3d/plugins.qmltypes b/src/quick3d/imports/scene3d/plugins.qmltypes
new file mode 100644
index 000000000..da56b97ea
--- /dev/null
+++ b/src/quick3d/imports/scene3d/plugins.qmltypes
@@ -0,0 +1,50 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtQuick.Scene3D 2.0'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component {
+ name: "Qt3DRender::Scene3DItem"
+ defaultProperty: "entity"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Scene3D/Scene3D 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "CameraAspectRatioMode"
+ values: {
+ "AutomaticAspectRatio": 0,
+ "UserAspectRatio": 1
+ }
+ }
+ Property { name: "entity"; type: "Qt3DCore::QEntity"; isPointer: true }
+ Property { name: "aspects"; type: "QStringList" }
+ Property { name: "multisample"; type: "bool" }
+ Property { name: "cameraAspectRatioMode"; type: "CameraAspectRatioMode" }
+ Property { name: "hoverEnabled"; type: "bool" }
+ Signal {
+ name: "cameraAspectRatioModeChanged"
+ Parameter { name: "mode"; type: "CameraAspectRatioMode" }
+ }
+ Method {
+ name: "setAspects"
+ Parameter { name: "aspects"; type: "QStringList" }
+ }
+ Method {
+ name: "setEntity"
+ Parameter { name: "entity"; type: "Qt3DCore::QEntity"; isPointer: true }
+ }
+ Method {
+ name: "setCameraAspectRatioMode"
+ Parameter { name: "mode"; type: "CameraAspectRatioMode" }
+ }
+ Method {
+ name: "setHoverEnabled"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ }
+}
diff --git a/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp b/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp
index a1aa4945a..7103a1bb8 100644
--- a/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp
+++ b/src/quick3d/imports/scene3d/qtquickscene3dplugin.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/imports/scene3d/qtquickscene3dplugin.h b/src/quick3d/imports/scene3d/qtquickscene3dplugin.h
index 076b454df..773feb296 100644
--- a/src/quick3d/imports/scene3d/qtquickscene3dplugin.h
+++ b/src/quick3d/imports/scene3d/qtquickscene3dplugin.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,6 +42,13 @@
#include <QtQml/QQmlExtensionPlugin>
+static void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Scene3D);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class QtQuickScene3DPlugin : public QQmlExtensionPlugin
@@ -46,6 +56,7 @@ class QtQuickScene3DPlugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtQuickScene3DPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
void registerTypes(const char *uri) Q_DECL_OVERRIDE;
};
diff --git a/src/quick3d/imports/scene3d/scene3dcleaner.cpp b/src/quick3d/imports/scene3d/scene3dcleaner.cpp
new file mode 100644
index 000000000..06b795c8a
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3dcleaner.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "scene3dcleaner_p.h"
+#include "scene3dlogging_p.h"
+#include "scene3drenderer_p.h"
+
+#include <Qt3DCore/qaspectengine.h>
+
+#include <QtCore/qthread.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+Scene3DCleaner::Scene3DCleaner(QObject *parent)
+ : QObject(parent)
+ , m_renderer(nullptr)
+{
+}
+
+Scene3DCleaner::~Scene3DCleaner()
+{
+ qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
+}
+
+void Scene3DCleaner::cleanup()
+{
+ Q_ASSERT(m_renderer);
+ delete m_renderer->m_aspectEngine; // also deletes m_renderer->m_renderAspect
+ m_renderer->m_aspectEngine = nullptr;
+ m_renderer->m_renderAspect = nullptr;
+ m_renderer->deleteLater();
+ deleteLater();
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/imports/scene3d/scene3dcleaner_p.h b/src/quick3d/imports/scene3d/scene3dcleaner_p.h
new file mode 100644
index 000000000..6ec2c7e6b
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3dcleaner_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_SCENE3DCLEANER_P_H
+#define QT3DRENDER_SCENE3DCLEANER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class Scene3DRenderer;
+
+class Scene3DCleaner : public QObject
+{
+ Q_OBJECT
+public:
+ explicit Scene3DCleaner(QObject *parent = 0);
+ ~Scene3DCleaner();
+
+ void setRenderer(Scene3DRenderer *renderer) { m_renderer = renderer; }
+
+public Q_SLOTS:
+ void cleanup();
+
+private:
+ Scene3DRenderer *m_renderer;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_SCENE3DCLEANER_H
diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp
index ef839ae87..23a3a977d 100644
--- a/src/quick3d/imports/scene3d/scene3ditem.cpp
+++ b/src/quick3d/imports/scene3d/scene3ditem.cpp
@@ -1,452 +1,64 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "scene3ditem_p.h"
+#include "scene3dcleaner_p.h"
#include "scene3dlogging_p.h"
+#include "scene3drenderer_p.h"
+#include "scene3dsgnode_p.h"
#include <Qt3DCore/QAspectEngine>
+#include <Qt3DCore/qentity.h>
+#include <Qt3DRender/qcamera.h>
#include <Qt3DRender/QRenderAspect>
+#include <Qt3DRender/qrendersurfaceselector.h>
+#include <Qt3DRender/qrendersettings.h>
#include <Qt3DInput/QInputAspect>
+#include <Qt3DInput/qinputsettings.h>
-#include <QOpenGLContext>
-#include <QOpenGLFramebufferObject>
-#include <QOpenGLFramebufferObjectFormat>
-#include <QSurface>
-#include <QQuickWindow>
-#include <QSGTexture>
-#include <QSGMaterial>
-#include <QSGNode>
-#include <QOpenGLFunctions>
-#include <QThread>
+#include <QtQuick/qquickwindow.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class ContextSaver
-{
-public:
- explicit ContextSaver(QOpenGLContext *context = QOpenGLContext::currentContext())
- : m_context(context),
- m_surface(context ? context->surface() : Q_NULLPTR)
- {
- }
-
- ~ContextSaver()
- {
- if (m_context)
- m_context->makeCurrent(m_surface);
- }
-
- QOpenGLContext *context() const { return m_context; }
- QSurface *surface() const { return m_surface; }
-
-private:
- QOpenGLContext * const m_context;
- QSurface * const m_surface;
-};
-
-class Scene3DSGNode;
-
-/*!
- \class Qt3DCore::Scene3DRenderer
- \internal
-
- \brief The Qt3DCore::Scene3DRenderer class takes care of rendering a Qt3D scene
- within a Framebuffer object to be used by the QtQuick 2 renderer.
-
- The Qt3DCore::Scene3DRenderer class renders a Qt3D scene as provided by a Qt3DCore::Scene3DItem.
- It owns the aspectEngine even though it doesn't instantiate it.
-
- The shutdown procedure is a two steps process that goes as follow:
-
- \li The window is closed
-
- \li This triggers the windowsChanged signal which the Scene3DRenderer
- uses to perform the necessary cleanups in the QSGRenderThread (destroys
- DebugLogger ...) with the shutdown slot (queued connection).
-
- \li The destroyed signal of the window is also connected to the
- Scene3DRenderer. When triggered in the context of the main thread, the
- cleanup slot is called.
-
- There is an alternate shutdown procedure in case the QQuickItem is
- destroyed with an active window which can happen in the case where the
- Scene3D is used with a QtQuick Loader
-
- In that case the shutdown procedure goes the same except that the destroyed
- signal of the window is not called. Therefore the cleanup method is invoked
- to properly destroy the aspect engine.
- */
-
-// Lives in the main thread
-// Used to delete the Qt3D aspect engine in the main thread
-class Scene3DCleaner : public QObject
-{
- Q_OBJECT
-public:
- Scene3DCleaner()
- : QObject()
- , m_renderer(Q_NULLPTR)
- {}
-
- ~Scene3DCleaner()
- {
- qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
- }
-
- void setRenderer(Scene3DRenderer *renderer)
- {
- m_renderer = renderer;
- }
-
-public Q_SLOTS:
- void cleanup();
-
-private:
- Scene3DRenderer *m_renderer;
-};
-
-// Lives in the aspect thread (QSGRenderThread)
-class Scene3DRenderer : public QObject
-{
- Q_OBJECT
-public:
- Scene3DRenderer(Scene3DItem *item,
- Qt3DCore::QAspectEngine *aspectEngine,
- QRenderAspect *renderAspect)
- : QObject()
- , m_item(item)
- , m_aspectEngine(aspectEngine)
- , m_renderAspect(renderAspect)
- , m_multisampledFBO(Q_NULLPTR)
- , m_finalFBO(Q_NULLPTR)
- , m_texture(Q_NULLPTR)
- , m_multisample(false) // this value is not used, will be synced from the Scene3DItem instead
- , m_lastMultisample(false)
- {
- Q_CHECK_PTR(m_item);
- Q_CHECK_PTR(m_item->window());
-
- QObject::connect(m_item->window(), &QQuickWindow::beforeRendering, this, &Scene3DRenderer::render, Qt::DirectConnection);
- QObject::connect(m_item, &QQuickItem::windowChanged, this, &Scene3DRenderer::onWindowChangedQueued, Qt::QueuedConnection);
-
- ContextSaver saver;
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(saver.surface()));
- m_aspectEngine->setData(data);
-
- m_renderAspect->renderInitialize(saver.context());
- scheduleRootEntityChange();
- }
-
- // The Scene3DRender is delete by itself with the cleanup slot
- ~Scene3DRenderer()
- {
- qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
- }
-
- QOpenGLFramebufferObject *createMultisampledFramebufferObject(const QSize &size)
- {
- QOpenGLFramebufferObjectFormat format;
- format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
- format.setSamples(4);
- return new QOpenGLFramebufferObject(size, format);
- }
-
- QOpenGLFramebufferObject *createFramebufferObject(const QSize &size)
- {
- QOpenGLFramebufferObjectFormat format;
- format.setAttachment(QOpenGLFramebufferObject::Depth);
- return new QOpenGLFramebufferObject(size, format);
- }
-
- void scheduleRootEntityChange()
- {
- QMetaObject::invokeMethod(m_item, "applyRootEntityChange", Qt::QueuedConnection);
- }
-
- void setSGNode(Scene3DSGNode *node) Q_DECL_NOEXCEPT;
-
- void setCleanerHelper(Scene3DCleaner *cleaner)
- {
- m_cleaner = cleaner;
- if (m_cleaner) {
- // Window closed case
- QObject::connect(m_item->window(), &QQuickWindow::destroyed, m_cleaner, &Scene3DCleaner::cleanup);
- m_cleaner->setRenderer(this);
- }
- }
-
- void synchronize();
-
-public Q_SLOTS:
- void render();
-
- // Executed in the QtQuick render thread.
- void shutdown()
- {
- qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
-
- // Set to null so that subsequent calls to render
- // would return early
- m_item = Q_NULLPTR;
-
- // Shutdown the Renderer Aspect while the OpenGL context
- // is still valid
- if (m_renderAspect)
- m_renderAspect->renderShutdown();
- }
-
- // SGThread
- void onWindowChangedQueued(QQuickWindow *w)
- {
- if (w == Q_NULLPTR) {
- qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
- shutdown();
- // Will only trigger something with the Loader case
- // The window closed cases is handled by the window's destroyed
- // signal
- QMetaObject::invokeMethod(m_cleaner, "cleanup");
- }
- }
-
-private:
- Scene3DItem *m_item; // Will be released by the QQuickWindow/QML Engine
- Qt3DCore::QAspectEngine *m_aspectEngine; // Will be released by the Scene3DRendererCleaner
- QRenderAspect *m_renderAspect; // Will be released by the aspectEngine
- QScopedPointer<QOpenGLFramebufferObject> m_multisampledFBO;
- QScopedPointer<QOpenGLFramebufferObject> m_finalFBO;
- QScopedPointer<QSGTexture> m_texture;
- Scene3DSGNode *m_node; // Will be released by the QtQuick SceneGraph
- Scene3DCleaner *m_cleaner;
- QSize m_lastSize;
- bool m_multisample;
- bool m_lastMultisample;
-
- friend class Scene3DCleaner;
-};
-
-/*!
- \class Qt3DCore::SCene3DMaterialShader
- \internal
-
- \brief The Qt3DCore::Scene3DSGMaterialShader class is a custom
- QSGMaterialShader subclass instantiated by a Qt3DCore::Scene3DSGMateria1
-
- The Qt3DCore::Scene3DSGMaterialShader provides a shader that renders a texture
- using premultiplied alpha.
- */
-class Scene3DSGMaterialShader : public QSGMaterialShader
-{
-public:
- void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) Q_DECL_FINAL;
-
- const char * const *attributeNames() const Q_DECL_FINAL
- {
- static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", 0 };
- return attr;
- }
-
- static QSGMaterialType type;
-
-protected:
- const char *vertexShader() const Q_DECL_FINAL
- {
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx->format().version() >= qMakePair(3, 2) && ctx->format().profile() == QSurfaceFormat::CoreProfile) {
- return ""
- "#version 150 core \n"
- "uniform mat4 qt_Matrix; \n"
- "in vec4 qt_VertexPosition; \n"
- "in vec2 qt_VertexTexCoord; \n"
- "out vec2 qt_TexCoord; \n"
- "void main() { \n"
- " qt_TexCoord = qt_VertexTexCoord; \n"
- " gl_Position = qt_Matrix * qt_VertexPosition; \n"
- "}";
- } else {
- return ""
- "uniform highp mat4 qt_Matrix; \n"
- "attribute highp vec4 qt_VertexPosition; \n"
- "attribute highp vec2 qt_VertexTexCoord; \n"
- "varying highp vec2 qt_TexCoord; \n"
- "void main() { \n"
- " qt_TexCoord = qt_VertexTexCoord; \n"
- " gl_Position = qt_Matrix * qt_VertexPosition; \n"
- "}";
- }
- }
-
- const char *fragmentShader() const Q_DECL_FINAL
- {
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- if (ctx->format().version() >= qMakePair(3, 2) && ctx->format().profile() == QSurfaceFormat::CoreProfile) {
- return ""
- "#version 150 core \n"
- "uniform sampler2D source; \n"
- "uniform float qt_Opacity; \n"
- "in vec2 qt_TexCoord; \n"
- "out vec4 fragColor; \n"
- "void main() { \n"
- " vec4 p = texture(source, qt_TexCoord); \n"
- " fragColor = vec4(p.rgb * p.a, qt_Opacity * p.a); \n"
- "}";
- } else {
- return ""
- "uniform highp sampler2D source; \n"
- "uniform highp float qt_Opacity; \n"
- "varying highp vec2 qt_TexCoord; \n"
- "void main() { \n"
- " highp vec4 p = texture2D(source, qt_TexCoord); \n"
- " gl_FragColor = vec4(p.rgb * p.a, qt_Opacity * p.a); \n"
- "}";
- }
- }
-
- void initialize() Q_DECL_FINAL
- {
- m_matrixId = program()->uniformLocation("qt_Matrix");
- m_opacityId = program()->uniformLocation("qt_Opacity");
- }
-
-private:
- int m_matrixId;
- int m_opacityId;
-};
-
-QSGMaterialType Scene3DSGMaterialShader::type;
-
-/*!
- \class Qt3DCore::Scene3DSGMaterial
- \internal
- \inherit QSGMaterial
-
- \brief The Qt3DCore::Scene3DSGMaterial class is a custom QSGMaterial subclass used to
- render a Qt3DCore::Scene3DSGNode
-
- The Qt3DCore::Scene3DSGMaterial class renders a texture using premultiplied
- alpha unlike the QSGSimpleTextureMaterial.
-
- This is needed to properly integrate alpha blending from a Qt3D scene
- within a QtQuick 2 scene.
- */
-class Scene3DSGMaterial : public QSGMaterial
-{
-public:
- Scene3DSGMaterial()
- : QSGMaterial()
- , m_texture(Q_NULLPTR)
- {}
-
- void setTexture(QSGTexture *texture) Q_DECL_NOEXCEPT
- {
- m_texture = texture;
- setFlag(Blending, m_texture ? m_texture->hasAlphaChannel() : false);
- }
-
- QSGTexture *texture() const Q_DECL_NOEXCEPT { return m_texture; }
- QSGMaterialType *type() const Q_DECL_FINAL { return &Scene3DSGMaterialShader::type; }
- QSGMaterialShader *createShader() const Q_DECL_FINAL { return new Scene3DSGMaterialShader(); }
-
-private:
- QSGTexture *m_texture;
-};
-
-/*!
- \class Qt3DCore::Scene3DSGNode
- \internal
-
- \brief The Qt3DCore::Scene3DSGNode class is a simple QSGeometryNode subclass that
- uses a Qt3DCore::Scene3DMaterial
-
- The Qt3DCore::Scene3DSGNode allows to render a simple rect texture with
- premultiplied alpha.
- */
-class Scene3DSGNode : public QSGGeometryNode
-{
-public:
- Scene3DSGNode()
- : QSGGeometryNode()
- , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
- {
- setMaterial(&m_material);
- setOpaqueMaterial(&m_opaqueMaterial);
- setGeometry(&m_geometry);
- qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
- }
-
- ~Scene3DSGNode()
- {
- qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
- // The Scene3DSGNode is deleted by the QSGRenderThread when the SceneGraph
- // is terminated.
- }
-
- void setTexture(QSGTexture *texture) Q_DECL_NOEXCEPT
- {
- m_material.setTexture(texture);
- m_opaqueMaterial.setTexture(texture);
- markDirty(DirtyMaterial);
- }
-
- QSGTexture *texture() const Q_DECL_NOEXCEPT { return m_material.texture(); }
-
- void setRect(const QRectF &rect)
- {
- if (rect != m_rect) {
- m_rect = rect;
- // Map the item's bounding rect to normalized texture coordinates
- const QRectF sourceRect(0.0f, 1.0f, 1.0f, -1.0f);
- QSGGeometry::updateTexturedRectGeometry(&m_geometry, m_rect, sourceRect);
- markDirty(DirtyGeometry);
- }
- }
-
- QRectF rect() const Q_DECL_NOEXCEPT { return m_rect; }
-
-private:
- Scene3DSGMaterial m_material;
- Scene3DSGMaterial m_opaqueMaterial;
- QSGGeometry m_geometry;
- QRectF m_rect;
-};
-
/*!
\class Qt3DCore::Scene3DItem
\internal
@@ -459,26 +71,19 @@ private:
multisampled Framebuffer object to be then renderer through the use of a
Qt3DCore::Scene3DSGNode with premultiplied alpha.
*/
-
Scene3DItem::Scene3DItem(QQuickItem *parent)
: QQuickItem(parent)
- , m_entity(Q_NULLPTR)
+ , m_entity(nullptr)
, m_aspectEngine(new Qt3DCore::QAspectEngine())
- , m_renderAspect(new QRenderAspect(QRenderAspect::Synchronous))
- , m_renderer(Q_NULLPTR)
+ , m_renderAspect(nullptr)
+ , m_renderer(nullptr)
, m_rendererCleaner(new Scene3DCleaner())
, m_multisample(true)
+ , m_cameraAspectRatioMode(AutomaticAspectRatio)
{
setFlag(QQuickItem::ItemHasContents, true);
setAcceptedMouseButtons(Qt::MouseButtonMask);
- setAcceptHoverEvents(true);
-
- // We need to register the event source in the main thread
- QVariantMap data;
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(this));
- m_aspectEngine->setData(data);
-
- m_aspectEngine->registerAspect(m_renderAspect);
+ // TO DO: register the event source in the main thread
}
Scene3DItem::~Scene3DItem()
@@ -508,10 +113,10 @@ void Scene3DItem::setAspects(const QStringList &aspects)
m_aspects = aspects;
// Aspects are owned by the aspect engine
- Q_FOREACH (const QString &aspect, m_aspects) {
- if (aspect == QStringLiteral("render")) // This one is hardwired anyway
+ for (const QString &aspect : qAsConst(m_aspects)) {
+ if (aspect == QLatin1String("render")) // This one is hardwired anyway
continue;
- if (aspect == QStringLiteral("input")) {
+ if (aspect == QLatin1String("input")) {
m_aspectEngine->registerAspect(new Qt3DInput::QInputAspect);
continue;
}
@@ -531,10 +136,142 @@ void Scene3DItem::setEntity(Qt3DCore::QEntity *entity)
emit entityChanged();
}
+void Scene3DItem::setCameraAspectRatioMode(CameraAspectRatioMode mode)
+{
+ if (m_cameraAspectRatioMode == mode)
+ return;
+
+ m_cameraAspectRatioMode = mode;
+ setCameraAspectModeHelper();
+ emit cameraAspectRatioModeChanged(mode);
+}
+
+void Scene3DItem::setHoverEnabled(bool enabled)
+{
+ if (enabled != acceptHoverEvents()) {
+ setAcceptHoverEvents(enabled);
+ emit hoverEnabledChanged();
+ }
+}
+
+Scene3DItem::CameraAspectRatioMode Scene3DItem::cameraAspectRatioMode() const
+{
+ return m_cameraAspectRatioMode;
+}
+
void Scene3DItem::applyRootEntityChange()
{
- if (m_aspectEngine->rootEntity() != m_entity)
- m_aspectEngine->setRootEntity(m_entity);
+ if (m_aspectEngine->rootEntity() != m_entity) {
+ m_aspectEngine->setRootEntity(Qt3DCore::QEntityPtr(m_entity));
+
+ // Set the render surface
+ if (!m_entity)
+ return;
+
+ setWindowSurface(m_entity);
+
+ if (m_cameraAspectRatioMode == AutomaticAspectRatio) {
+ // Set aspect ratio of first camera to match the window
+ QList<Qt3DRender::QCamera *> cameras
+ = m_entity->findChildren<Qt3DRender::QCamera *>();
+ if (cameras.isEmpty()) {
+ qWarning() << "No camera found and automatic aspect ratio requested";
+ } else {
+ m_camera = cameras.first();
+ setCameraAspectModeHelper();
+ }
+ }
+
+ // Set ourselves up as a source of input events for the input aspect
+ Qt3DInput::QInputSettings *inputSettings = m_entity->findChild<Qt3DInput::QInputSettings *>();
+ if (inputSettings) {
+ inputSettings->setEventSource(this);
+ } else {
+ qWarning() << "No Input Settings found, keyboard and mouse events won't be handled";
+ }
+ }
+}
+
+void Scene3DItem::setWindowSurface(QObject *rootObject)
+{
+ // Find surface selector in framegraph and set ourselves up as the
+ // render surface there
+ Qt3DRender::QRenderSettings *renderSettings
+ = rootObject->findChild<Qt3DRender::QRenderSettings *>();
+ if (!renderSettings) {
+ qWarning() << "No renderer settings component found";
+ return;
+ }
+
+ Qt3DCore::QNode *frameGraphRoot = renderSettings->activeFrameGraph();
+ if (!frameGraphRoot) {
+ qWarning() << "No active frame graph found";
+ return;
+ }
+
+ Qt3DRender::QRenderSurfaceSelector *surfaceSelector
+ = frameGraphRoot->findChild<Qt3DRender::QRenderSurfaceSelector *>();
+ if (!surfaceSelector) {
+ qWarning() << "No render surface selector found in frame graph";
+ return;
+ }
+
+ // Set the item's window surface if it appears
+ // the surface wasn't set on the surfaceSelector
+ if (!surfaceSelector->surface())
+ surfaceSelector->setSurface(this->window());
+}
+
+void Scene3DItem::setItemArea(const QSize &area)
+{
+ // Find surface selector in framegraph and set the area
+ Qt3DRender::QRenderSettings *renderSettings
+ = m_entity->findChild<Qt3DRender::QRenderSettings *>();
+ if (!renderSettings) {
+ qWarning() << "No renderer settings component found";
+ return;
+ }
+
+ Qt3DCore::QNode *frameGraphRoot = renderSettings->activeFrameGraph();
+ if (!frameGraphRoot) {
+ qWarning() << "No active frame graph found";
+ return;
+ }
+
+ Qt3DRender::QRenderSurfaceSelector *surfaceSelector
+ = frameGraphRoot->findChild<Qt3DRender::QRenderSurfaceSelector *>();
+ if (!surfaceSelector) {
+ qWarning() << "No render surface selector found in frame graph";
+ return;
+ }
+ surfaceSelector->setExternalRenderTargetSize(area);
+}
+
+bool Scene3DItem::isHoverEnabled() const
+{
+ return acceptHoverEvents();
+}
+
+void Scene3DItem::setCameraAspectModeHelper()
+{
+ switch (m_cameraAspectRatioMode) {
+ case AutomaticAspectRatio:
+ connect(this, &Scene3DItem::widthChanged, this, &Scene3DItem::updateCameraAspectRatio);
+ connect(this, &Scene3DItem::heightChanged, this, &Scene3DItem::updateCameraAspectRatio);
+ break;
+ case UserAspectRatio:
+ disconnect(this, &Scene3DItem::widthChanged, this, &Scene3DItem::updateCameraAspectRatio);
+ disconnect(this, &Scene3DItem::heightChanged, this, &Scene3DItem::updateCameraAspectRatio);
+ break;
+ }
+}
+
+void Scene3DItem::updateCameraAspectRatio()
+{
+ if (m_camera) {
+ m_camera->setAspectRatio(static_cast<float>(width()) /
+ static_cast<float>(height()));
+ }
}
/*!
@@ -567,15 +304,21 @@ void Scene3DItem::setMultisample(bool enable)
QSGNode *Scene3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *)
{
+ // If the render aspect wasn't created yet, do so now
+ if (!m_renderAspect) {
+ m_renderAspect = new QRenderAspect(QRenderAspect::Synchronous);
+ m_aspectEngine->registerAspect(m_renderAspect);
+ }
+
// If the node already exists
// we delete it and recreate it
// as we need to resize the FBO
if (node) {
delete node;
- node = Q_NULLPTR;
+ node = nullptr;
}
- if (m_renderer == Q_NULLPTR) {
+ if (m_renderer == nullptr) {
m_renderer = new Scene3DRenderer(this, m_aspectEngine, m_renderAspect);
m_renderer->setCleanerHelper(m_rendererCleaner);
}
@@ -589,147 +332,12 @@ QSGNode *Scene3DItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNode
return fboNode;
}
-void Scene3DRenderer::synchronize()
-{
- m_multisample = m_item->multisample();
-}
-
-void Scene3DRenderer::setSGNode(Scene3DSGNode *node) Q_DECL_NOEXCEPT
-{
- m_node = node;
- if (!m_texture.isNull())
- node->setTexture(m_texture.data());
-}
-
-void Scene3DRenderer::render()
-{
- if (!m_item || !m_item->window())
- return;
-
- QQuickWindow *window = m_item->window();
-
- if (m_aspectEngine->rootEntity() != m_item->entity())
- scheduleRootEntityChange();
-
- ContextSaver saver;
-
- const QSize currentSize = m_item->boundingRect().size().toSize() * window->effectiveDevicePixelRatio();
- const bool forceRecreate = currentSize != m_lastSize || m_multisample != m_lastMultisample;
-
- // Rebuild FBO and textures if never created or a resize has occurred
- if ((m_multisampledFBO.isNull() || forceRecreate) && m_multisample) {
- qCDebug(Scene3D) << Q_FUNC_INFO << "Creating multisample framebuffer";
- m_multisampledFBO.reset(createMultisampledFramebufferObject(currentSize));
- if (m_multisampledFBO->format().samples() == 0 || !QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()) {
- qCDebug(Scene3D) << Q_FUNC_INFO << "Failed to create multisample framebuffer";
- m_multisample = false;
- m_multisampledFBO.reset(Q_NULLPTR);
- }
- }
-
- if (m_finalFBO.isNull() || forceRecreate) {
- m_finalFBO.reset(createFramebufferObject(currentSize));
- m_texture.reset(window->createTextureFromId(m_finalFBO->texture(), m_finalFBO->size(), QQuickWindow::TextureHasAlphaChannel));
- m_node->setTexture(m_texture.data());
- }
-
- // Store the current size as a comparison
- // point for the next frame
- m_lastSize = currentSize;
- m_lastMultisample = m_multisample;
-
- //Only try to use MSAA when available
- if (m_multisample) {
- // Bind FBO
- m_multisampledFBO->bind();
-
- // Render Qt3D Scene
- m_renderAspect->renderSynchronous();
-
- // We may have called doneCurrent() so restore the context.
- if (saver.context()->surface() != saver.surface())
- saver.context()->makeCurrent(saver.surface());
-
- // Blit multisampled FBO with non multisampled FBO with texture attachment
- QOpenGLFramebufferObject::blitFramebuffer(m_finalFBO.data(), m_multisampledFBO.data());
-
- // Restore QtQuick FBO
- m_multisampledFBO->bindDefault();
- } else {
- // Bind FBO
- m_finalFBO->bind();
-
- // Render Qt3D Scene
- m_renderAspect->renderSynchronous();
-
- // We may have called doneCurrent() so restore the context.
- if (saver.context()->surface() != saver.surface())
- saver.context()->makeCurrent(saver.surface());
-
- // Restore QtQuick FBO
- m_finalFBO->bindDefault();
- }
-
- // Reset the state used by the Qt Quick scenegraph to avoid any
- // interference when rendering the rest of the UI.
- window->resetOpenGLState();
-
- // Mark material as dirty to request a new frame
- m_node->markDirty(QSGNode::DirtyMaterial);
-
- // Request next frame
- window->update();
-}
-
-inline static bool isPowerOfTwo(int x)
+void Scene3DItem::mousePressEvent(QMouseEvent *event)
{
- // Assumption: x >= 1
- return x == (x & -x);
-}
-
-void Scene3DSGMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
-{
- Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
- Scene3DSGMaterial *tx = static_cast<Scene3DSGMaterial *>(newEffect);
- Scene3DSGMaterial *oldTx = static_cast<Scene3DSGMaterial *>(oldEffect);
-
- QSGTexture *t = tx->texture();
-
- bool npotSupported = const_cast<QOpenGLContext *>(state.context())
- ->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat);
- if (!npotSupported) {
- QSize size = t->textureSize();
- const bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height());
- if (isNpot) {
- t->setHorizontalWrapMode(QSGTexture::ClampToEdge);
- t->setVerticalWrapMode(QSGTexture::ClampToEdge);
- }
- }
-
- if (oldTx == 0 || oldTx->texture()->textureId() != t->textureId())
- t->bind();
- else
- t->updateBindOptions();
-
- if (state.isMatrixDirty())
- program()->setUniformValue(m_matrixId, state.combinedMatrix());
-
- if (state.isOpacityDirty())
- program()->setUniformValue(m_opacityId, state.opacity());
-}
-
-void Scene3DCleaner::cleanup()
-{
- Q_ASSERT(m_renderer);
- delete m_renderer->m_aspectEngine; // also deletes m_renderer->m_renderAspect
- m_renderer->m_aspectEngine = Q_NULLPTR;
- m_renderer->m_renderAspect = Q_NULLPTR;
- m_renderer->deleteLater();
- deleteLater();
+ Q_UNUSED(event);
+ //Prevent subsequent move and release events being disregarded my the default event->ignore() from QQuickItem
}
} // namespace Qt3DRender
QT_END_NAMESPACE
-
-#include "scene3ditem.moc"
diff --git a/src/quick3d/imports/scene3d/scene3ditem_p.h b/src/quick3d/imports/scene3d/scene3ditem_p.h
index edb0b7b00..bb141b423 100644
--- a/src/quick3d/imports/scene3d/scene3ditem_p.h
+++ b/src/quick3d/imports/scene3d/scene3ditem_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,6 +52,7 @@
//
#include <QQuickItem>
+#include <QtCore/qpointer.h>
QT_BEGIN_NAMESPACE
@@ -59,6 +63,7 @@ class QEntity;
namespace Qt3DRender {
+class QCamera;
class QRenderAspect;
class Scene3DRenderer;
class Scene3DCleaner;
@@ -69,6 +74,8 @@ class Scene3DItem : public QQuickItem
Q_PROPERTY(Qt3DCore::QEntity* entity READ entity WRITE setEntity NOTIFY entityChanged)
Q_PROPERTY(QStringList aspects READ aspects WRITE setAspects NOTIFY aspectsChanged)
Q_PROPERTY(bool multisample READ multisample WRITE setMultisample NOTIFY multisampleChanged)
+ Q_PROPERTY(CameraAspectRatioMode cameraAspectRatioMode READ cameraAspectRatioMode WRITE setCameraAspectRatioMode NOTIFY cameraAspectRatioModeChanged)
+ Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
Q_CLASSINFO("DefaultProperty", "entity")
public:
explicit Scene3DItem(QQuickItem *parent = 0);
@@ -79,21 +86,38 @@ public:
bool multisample() const;
void setMultisample(bool enable);
+ void setItemArea(const QSize &area);
+ bool isHoverEnabled() const;
+
+ enum CameraAspectRatioMode {
+ AutomaticAspectRatio,
+ UserAspectRatio
+ };
+ Q_ENUM(CameraAspectRatioMode);
+ CameraAspectRatioMode cameraAspectRatioMode() const;
public Q_SLOTS:
void setAspects(const QStringList &aspects);
void setEntity(Qt3DCore::QEntity *entity);
+ void setCameraAspectRatioMode(CameraAspectRatioMode mode);
+ void setHoverEnabled(bool enabled);
Q_SIGNALS:
void aspectsChanged();
void entityChanged();
void multisampleChanged();
+ void cameraAspectRatioModeChanged(CameraAspectRatioMode mode);
+ void hoverEnabledChanged();
private Q_SLOTS:
void applyRootEntityChange();
private:
QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *nodeData) Q_DECL_OVERRIDE;
+ void setWindowSurface(QObject *rootObject);
+ void setCameraAspectModeHelper();
+ void updateCameraAspectRatio();
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
QStringList m_aspects;
Qt3DCore::QEntity *m_entity;
@@ -104,6 +128,9 @@ private:
Scene3DCleaner *m_rendererCleaner;
bool m_multisample;
+
+ QPointer<Qt3DRender::QCamera> m_camera;
+ CameraAspectRatioMode m_cameraAspectRatioMode;
};
} // Qt3DRender
diff --git a/src/quick3d/imports/scene3d/scene3dlogging.cpp b/src/quick3d/imports/scene3d/scene3dlogging.cpp
index c7bdc32b3..b9582799b 100644
--- a/src/quick3d/imports/scene3d/scene3dlogging.cpp
+++ b/src/quick3d/imports/scene3d/scene3dlogging.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/imports/scene3d/scene3dlogging_p.h b/src/quick3d/imports/scene3d/scene3dlogging_p.h
index 703f67f20..0f9448d42 100644
--- a/src/quick3d/imports/scene3d/scene3dlogging_p.h
+++ b/src/quick3d/imports/scene3d/scene3dlogging_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp
new file mode 100644
index 000000000..24b42e15d
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp
@@ -0,0 +1,304 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "scene3drenderer_p.h"
+#include "scene3dcleaner_p.h"
+#include "scene3ditem_p.h"
+#include "scene3dlogging_p.h"
+#include "scene3dsgnode_p.h"
+
+#include <Qt3DRender/qrenderaspect.h>
+#include <Qt3DRender/private/qrenderaspect_p.h>
+#include <Qt3DCore/qaspectengine.h>
+
+#include <QtQuick/qquickwindow.h>
+
+#include <QtGui/qopenglcontext.h>
+#include <QtGui/qopenglframebufferobject.h>
+
+#include <QtCore/qthread.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class ContextSaver
+{
+public:
+ explicit ContextSaver(QOpenGLContext *context = QOpenGLContext::currentContext())
+ : m_context(context),
+ m_surface(context ? context->surface() : nullptr)
+ {
+ }
+
+ ~ContextSaver()
+ {
+ if (m_context)
+ m_context->makeCurrent(m_surface);
+ }
+
+ QOpenGLContext *context() const { return m_context; }
+ QSurface *surface() const { return m_surface; }
+
+private:
+ QOpenGLContext * const m_context;
+ QSurface * const m_surface;
+};
+
+/*!
+ \class Qt3DCore::Scene3DRenderer
+ \internal
+
+ \brief The Qt3DCore::Scene3DRenderer class takes care of rendering a Qt3D scene
+ within a Framebuffer object to be used by the QtQuick 2 renderer.
+
+ The Qt3DCore::Scene3DRenderer class renders a Qt3D scene as provided by a Qt3DCore::Scene3DItem.
+ It owns the aspectEngine even though it doesn't instantiate it.
+
+ The shutdown procedure is a two steps process that goes as follow:
+
+ \li The window is closed
+
+ \li This triggers the windowsChanged signal which the Scene3DRenderer
+ uses to perform the necessary cleanups in the QSGRenderThread (destroys
+ DebugLogger ...) with the shutdown slot (queued connection).
+
+ \li The destroyed signal of the window is also connected to the
+ Scene3DRenderer. When triggered in the context of the main thread, the
+ cleanup slot is called.
+
+ There is an alternate shutdown procedure in case the QQuickItem is
+ destroyed with an active window which can happen in the case where the
+ Scene3D is used with a QtQuick Loader
+
+ In that case the shutdown procedure goes the same except that the destroyed
+ signal of the window is not called. Therefore the cleanup method is invoked
+ to properly destroy the aspect engine.
+ */
+Scene3DRenderer::Scene3DRenderer(Scene3DItem *item, Qt3DCore::QAspectEngine *aspectEngine, QRenderAspect *renderAspect)
+ : QObject()
+ , m_item(item)
+ , m_aspectEngine(aspectEngine)
+ , m_renderAspect(renderAspect)
+ , m_multisampledFBO(nullptr)
+ , m_finalFBO(nullptr)
+ , m_texture(nullptr)
+ , m_multisample(false) // this value is not used, will be synced from the Scene3DItem instead
+ , m_lastMultisample(false)
+{
+ Q_CHECK_PTR(m_item);
+ Q_CHECK_PTR(m_item->window());
+
+ QObject::connect(m_item->window(), &QQuickWindow::beforeRendering, this, &Scene3DRenderer::render, Qt::DirectConnection);
+ QObject::connect(m_item, &QQuickItem::windowChanged, this, &Scene3DRenderer::onWindowChangedQueued, Qt::QueuedConnection);
+
+ ContextSaver saver;
+ static_cast<QRenderAspectPrivate*>(QRenderAspectPrivate::get(m_renderAspect))->renderInitialize(saver.context());
+ scheduleRootEntityChange();
+}
+
+Scene3DRenderer::~Scene3DRenderer()
+{
+ qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
+}
+
+QOpenGLFramebufferObject *Scene3DRenderer::createMultisampledFramebufferObject(const QSize &size)
+{
+ QOpenGLFramebufferObjectFormat format;
+ format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
+ format.setSamples(4);
+ return new QOpenGLFramebufferObject(size, format);
+}
+
+QOpenGLFramebufferObject *Scene3DRenderer::createFramebufferObject(const QSize &size)
+{
+ QOpenGLFramebufferObjectFormat format;
+ format.setAttachment(QOpenGLFramebufferObject::Depth);
+ return new QOpenGLFramebufferObject(size, format);
+}
+
+void Scene3DRenderer::scheduleRootEntityChange()
+{
+ QMetaObject::invokeMethod(m_item, "applyRootEntityChange", Qt::QueuedConnection);
+}
+
+void Scene3DRenderer::setCleanerHelper(Scene3DCleaner *cleaner)
+{
+ m_cleaner = cleaner;
+ if (m_cleaner) {
+ // Window closed case
+ QObject::connect(m_item->window(), &QQuickWindow::destroyed, m_cleaner, &Scene3DCleaner::cleanup);
+ m_cleaner->setRenderer(this);
+ }
+}
+
+// Executed in the QtQuick render thread.
+void Scene3DRenderer::shutdown()
+{
+ qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
+
+ // Set to null so that subsequent calls to render
+ // would return early
+ m_item = nullptr;
+
+ // Shutdown the Renderer Aspect while the OpenGL context
+ // is still valid
+ if (m_renderAspect)
+ static_cast<QRenderAspectPrivate*>(QRenderAspectPrivate::get(m_renderAspect))->renderShutdown();
+}
+
+// SGThread
+void Scene3DRenderer::onWindowChangedQueued(QQuickWindow *w)
+{
+ if (w == nullptr) {
+ qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
+ shutdown();
+ // Will only trigger something with the Loader case
+ // The window closed cases is handled by the window's destroyed
+ // signal
+ QMetaObject::invokeMethod(m_cleaner, "cleanup");
+ }
+}
+
+void Scene3DRenderer::synchronize()
+{
+ m_multisample = m_item->multisample();
+}
+
+void Scene3DRenderer::setSGNode(Scene3DSGNode *node) Q_DECL_NOEXCEPT
+{
+ m_node = node;
+ if (!m_texture.isNull())
+ node->setTexture(m_texture.data());
+}
+
+void Scene3DRenderer::render()
+{
+ if (!m_item || !m_item->window())
+ return;
+
+ QQuickWindow *window = m_item->window();
+
+ if (m_aspectEngine->rootEntity() != m_item->entity())
+ scheduleRootEntityChange();
+
+ ContextSaver saver;
+
+ const QSize boundingRectSize = m_item->boundingRect().size().toSize();
+ const QSize currentSize = boundingRectSize * window->effectiveDevicePixelRatio();
+ const bool forceRecreate = currentSize != m_lastSize || m_multisample != m_lastMultisample;
+
+ if (currentSize != m_lastSize)
+ m_item->setItemArea(boundingRectSize);
+
+ // Rebuild FBO and textures if never created or a resize has occurred
+ if ((m_multisampledFBO.isNull() || forceRecreate) && m_multisample) {
+ qCDebug(Scene3D) << Q_FUNC_INFO << "Creating multisample framebuffer";
+ m_multisampledFBO.reset(createMultisampledFramebufferObject(currentSize));
+ if (m_multisampledFBO->format().samples() == 0 || !QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()) {
+ qCDebug(Scene3D) << Q_FUNC_INFO << "Failed to create multisample framebuffer";
+ m_multisample = false;
+ m_multisampledFBO.reset(nullptr);
+ }
+ }
+
+ if (m_finalFBO.isNull() || forceRecreate) {
+ m_finalFBO.reset(createFramebufferObject(currentSize));
+ m_texture.reset(window->createTextureFromId(m_finalFBO->texture(), m_finalFBO->size(), QQuickWindow::TextureHasAlphaChannel));
+ m_node->setTexture(m_texture.data());
+ }
+
+ // Store the current size as a comparison
+ // point for the next frame
+ m_lastSize = currentSize;
+ m_lastMultisample = m_multisample;
+
+ //Only try to use MSAA when available
+ if (m_multisample) {
+ // Bind FBO
+ m_multisampledFBO->bind();
+
+ // Render Qt3D Scene
+ static_cast<QRenderAspectPrivate*>(QRenderAspectPrivate::get(m_renderAspect))->renderSynchronous();
+
+ // We may have called doneCurrent() so restore the context.
+ if (saver.context()->surface() != saver.surface())
+ saver.context()->makeCurrent(saver.surface());
+
+ // Blit multisampled FBO with non multisampled FBO with texture attachment
+ const QRect dstRect(QPoint(0, 0), m_finalFBO->size());
+ const QRect srcRect(QPoint(0, 0), m_multisampledFBO->size());
+ QOpenGLFramebufferObject::blitFramebuffer(m_finalFBO.data(), dstRect,
+ m_multisampledFBO.data(), srcRect,
+ GL_COLOR_BUFFER_BIT,
+ GL_NEAREST,
+ 0, 0,
+ QOpenGLFramebufferObject::DontRestoreFramebufferBinding);
+
+ // Restore QtQuick FBO
+ m_multisampledFBO->bindDefault();
+ } else {
+ // Bind FBO
+ m_finalFBO->bind();
+
+ // Render Qt3D Scene
+ static_cast<QRenderAspectPrivate*>(QRenderAspectPrivate::get(m_renderAspect))->renderSynchronous();
+
+ // We may have called doneCurrent() so restore the context.
+ if (saver.context()->surface() != saver.surface())
+ saver.context()->makeCurrent(saver.surface());
+
+ // Restore QtQuick FBO
+ m_finalFBO->bindDefault();
+ }
+
+ // Reset the state used by the Qt Quick scenegraph to avoid any
+ // interference when rendering the rest of the UI.
+ window->resetOpenGLState();
+
+ // Mark material as dirty to request a new frame
+ m_node->markDirty(QSGNode::DirtyMaterial);
+
+ // Request next frame
+ window->update();
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/imports/scene3d/scene3drenderer_p.h b/src/quick3d/imports/scene3d/scene3drenderer_p.h
new file mode 100644
index 000000000..80045f66b
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3drenderer_p.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_SCENE3DRENDERER_P_H
+#define QT3DRENDER_SCENE3DRENDERER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+
+#include <QtCore/qsize.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWindow;
+class QSGTexture;
+class QOpenGLFramebufferObject;
+
+namespace Qt3DCore {
+class QAspectEngine;
+}
+
+namespace Qt3DRender {
+
+class QRenderAspect;
+class Scene3DCleaner;
+class Scene3DItem;
+class Scene3DSGNode;
+
+class Scene3DRenderer : public QObject
+{
+ Q_OBJECT
+public:
+ Scene3DRenderer(Scene3DItem *item,
+ Qt3DCore::QAspectEngine *aspectEngine,
+ QRenderAspect *renderAspect);
+ ~Scene3DRenderer();
+
+ QOpenGLFramebufferObject *createMultisampledFramebufferObject(const QSize &size);
+ QOpenGLFramebufferObject *createFramebufferObject(const QSize &size);
+ void scheduleRootEntityChange();
+ void setSGNode(Scene3DSGNode *node) Q_DECL_NOEXCEPT;
+ void setCleanerHelper(Scene3DCleaner *cleaner);
+ void synchronize();
+
+public Q_SLOTS:
+ void render();
+ void shutdown();
+ void onWindowChangedQueued(QQuickWindow *w);
+
+private:
+ Scene3DItem *m_item; // Will be released by the QQuickWindow/QML Engine
+ Qt3DCore::QAspectEngine *m_aspectEngine; // Will be released by the Scene3DRendererCleaner
+ QRenderAspect *m_renderAspect; // Will be released by the aspectEngine
+ QScopedPointer<QOpenGLFramebufferObject> m_multisampledFBO;
+ QScopedPointer<QOpenGLFramebufferObject> m_finalFBO;
+ QScopedPointer<QSGTexture> m_texture;
+ Scene3DSGNode *m_node; // Will be released by the QtQuick SceneGraph
+ Scene3DCleaner *m_cleaner;
+ QSize m_lastSize;
+ bool m_multisample;
+ bool m_lastMultisample;
+
+ friend class Scene3DCleaner;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_SCENE3DRENDERER_P_H
diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterial.cpp b/src/quick3d/imports/scene3d/scene3dsgmaterial.cpp
new file mode 100644
index 000000000..a47d00268
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3dsgmaterial.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "scene3dsgmaterial_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DCore::Scene3DSGMaterial
+ \internal
+ \inherit QSGMaterial
+
+ \brief The Qt3DRender::Scene3DSGMaterial class is a custom QSGMaterial subclass used to
+ render a Qt3DRender::Scene3DSGNode
+
+ The Qt3DRender::Scene3DSGMaterial class renders a texture using premultiplied
+ alpha unlike the QSGSimpleTextureMaterial.
+
+ This is needed to properly integrate alpha blending from a Qt3D scene
+ within a QtQuick 2 scene.
+ */
+Scene3DSGMaterial::Scene3DSGMaterial()
+ : QSGMaterial()
+ , m_texture(nullptr)
+{
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h b/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h
new file mode 100644
index 000000000..0ff1bed27
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3dsgmaterial_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SCENE3DSGMATERIAL_H
+#define SCENE3DSGMATERIAL_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/QSGMaterial>
+#include "scene3dsgmaterialshader_p.h"
+
+#include <QtQuick/qsgtexture.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class Scene3DSGMaterial : public QSGMaterial
+{
+public:
+ Scene3DSGMaterial();
+
+ void setTexture(QSGTexture *texture) Q_DECL_NOEXCEPT
+ {
+ m_texture = texture;
+ setFlag(Blending, m_texture ? m_texture->hasAlphaChannel() : false);
+ }
+
+ QSGTexture *texture() const Q_DECL_NOEXCEPT { return m_texture; }
+ QSGMaterialType *type() const Q_DECL_FINAL { return &Scene3DSGMaterialShader::type; }
+ QSGMaterialShader *createShader() const Q_DECL_FINAL { return new Scene3DSGMaterialShader(); }
+
+private:
+ QSGTexture *m_texture;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // SCENE3DSGMATERIAL_H
diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterialshader.cpp b/src/quick3d/imports/scene3d/scene3dsgmaterialshader.cpp
new file mode 100644
index 000000000..5ce0f4d60
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3dsgmaterialshader.cpp
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "scene3dsgmaterialshader_p.h"
+#include "scene3dsgmaterial_p.h"
+
+#include <QtGui/qopenglcontext.h>
+#include <QtGui/qopenglfunctions.h>
+#include <QtGui/qsurfaceformat.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+
+inline bool isPowerOfTwo(int x)
+{
+ // Assumption: x >= 1
+ return x == (x & -x);
+}
+
+}
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DCore::SCene3DMaterialShader
+ \internal
+
+ \brief The Qt3DRender::Scene3DSGMaterialShader class is a custom
+ QSGMaterialShader subclass instantiated by a Qt3DRender::Scene3DSGMateria1
+
+ The Qt3DRender::Scene3DSGMaterialShader provides a shader that renders a texture
+ using premultiplied alpha.
+ */
+
+QSGMaterialType Scene3DSGMaterialShader::type;
+
+const char * const *Scene3DSGMaterialShader::attributeNames() const
+{
+ static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", 0 };
+ return attr;
+}
+
+const char *Scene3DSGMaterialShader::vertexShader() const
+{
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ if (ctx->format().version() >= qMakePair(3, 2) && ctx->format().profile() == QSurfaceFormat::CoreProfile) {
+ return ""
+ "#version 150 core \n"
+ "uniform mat4 qt_Matrix; \n"
+ "in vec4 qt_VertexPosition; \n"
+ "in vec2 qt_VertexTexCoord; \n"
+ "out vec2 qt_TexCoord; \n"
+ "void main() { \n"
+ " qt_TexCoord = qt_VertexTexCoord; \n"
+ " gl_Position = qt_Matrix * qt_VertexPosition; \n"
+ "}";
+ } else {
+ return ""
+ "uniform highp mat4 qt_Matrix; \n"
+ "attribute highp vec4 qt_VertexPosition; \n"
+ "attribute highp vec2 qt_VertexTexCoord; \n"
+ "varying highp vec2 qt_TexCoord; \n"
+ "void main() { \n"
+ " qt_TexCoord = qt_VertexTexCoord; \n"
+ " gl_Position = qt_Matrix * qt_VertexPosition; \n"
+ "}";
+ }
+}
+
+const char *Scene3DSGMaterialShader::fragmentShader() const
+{
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ if (ctx->format().version() >= qMakePair(3, 2) && ctx->format().profile() == QSurfaceFormat::CoreProfile) {
+ return ""
+ "#version 150 core \n"
+ "uniform sampler2D source; \n"
+ "uniform float qt_Opacity; \n"
+ "in vec2 qt_TexCoord; \n"
+ "out vec4 fragColor; \n"
+ "void main() { \n"
+ " vec4 p = texture(source, qt_TexCoord); \n"
+ " fragColor = vec4(p.rgb * p.a, qt_Opacity * p.a); \n"
+ "}";
+ } else {
+ return ""
+ "uniform highp sampler2D source; \n"
+ "uniform highp float qt_Opacity; \n"
+ "varying highp vec2 qt_TexCoord; \n"
+ "void main() { \n"
+ " highp vec4 p = texture2D(source, qt_TexCoord); \n"
+ " gl_FragColor = vec4(p.rgb * p.a, qt_Opacity * p.a); \n"
+ "}";
+ }
+}
+
+void Scene3DSGMaterialShader::initialize()
+{
+ m_matrixId = program()->uniformLocation("qt_Matrix");
+ m_opacityId = program()->uniformLocation("qt_Opacity");
+}
+
+void Scene3DSGMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect)
+{
+ Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type());
+ Scene3DSGMaterial *tx = static_cast<Scene3DSGMaterial *>(newEffect);
+ Scene3DSGMaterial *oldTx = static_cast<Scene3DSGMaterial *>(oldEffect);
+
+ QSGTexture *t = tx->texture();
+
+ bool npotSupported = const_cast<QOpenGLContext *>(state.context())
+ ->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat);
+ if (!npotSupported) {
+ QSize size = t->textureSize();
+ const bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height());
+ if (isNpot) {
+ t->setHorizontalWrapMode(QSGTexture::ClampToEdge);
+ t->setVerticalWrapMode(QSGTexture::ClampToEdge);
+ }
+ }
+
+ if (oldTx == 0 || oldTx->texture()->textureId() != t->textureId())
+ t->bind();
+ else
+ t->updateBindOptions();
+
+ if (state.isMatrixDirty())
+ program()->setUniformValue(m_matrixId, state.combinedMatrix());
+
+ if (state.isOpacityDirty())
+ program()->setUniformValue(m_opacityId, state.opacity());
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/imports/scene3d/scene3dsgmaterialshader_p.h b/src/quick3d/imports/scene3d/scene3dsgmaterialshader_p.h
new file mode 100644
index 000000000..64d281ec4
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3dsgmaterialshader_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_SCENE3DSGMATERIALSHADER_P_H
+#define QT3DRENDER_SCENE3DSGMATERIALSHADER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/QSGMaterialShader>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class Scene3DSGMaterialShader : public QSGMaterialShader
+{
+public:
+ void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) Q_DECL_FINAL;
+ const char * const *attributeNames() const Q_DECL_FINAL;
+
+ static QSGMaterialType type;
+
+protected:
+ const char *vertexShader() const Q_DECL_FINAL;
+ const char *fragmentShader() const Q_DECL_FINAL;
+ void initialize() Q_DECL_FINAL;
+
+private:
+ int m_matrixId;
+ int m_opacityId;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_SCENE3DSGMATERIALSHADER_P_H
diff --git a/src/quick3d/imports/scene3d/scene3dsgnode.cpp b/src/quick3d/imports/scene3d/scene3dsgnode.cpp
new file mode 100644
index 000000000..ae0a07350
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3dsgnode.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "scene3dsgnode_p.h"
+#include "scene3dlogging_p.h"
+
+#include <QtCore/qthread.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DCore::Scene3DSGNode
+ \internal
+
+ \brief The Qt3DCore::Scene3DSGNode class is a simple QSGeometryNode subclass that
+ uses a Qt3DCore::Scene3DMaterial
+
+ The Qt3DCore::Scene3DSGNode allows to render a simple rectangle textured with a
+ texture using premultiplied alpha.
+ */
+Scene3DSGNode::Scene3DSGNode()
+ : QSGGeometryNode()
+ , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
+{
+ setMaterial(&m_material);
+ setOpaqueMaterial(&m_opaqueMaterial);
+ setGeometry(&m_geometry);
+ qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
+}
+
+Scene3DSGNode::~Scene3DSGNode()
+{
+ qCDebug(Scene3D) << Q_FUNC_INFO << QThread::currentThread();
+ // The Scene3DSGNode is deleted by the QSGRenderThread when the SceneGraph
+ // is terminated.
+}
+
+void Scene3DSGNode::setRect(const QRectF &rect)
+{
+ if (rect != m_rect) {
+ m_rect = rect;
+ // Map the item's bounding rect to normalized texture coordinates
+ const QRectF sourceRect(0.0f, 1.0f, 1.0f, -1.0f);
+ QSGGeometry::updateTexturedRectGeometry(&m_geometry, m_rect, sourceRect);
+ markDirty(DirtyGeometry);
+ }
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/imports/scene3d/scene3dsgnode_p.h b/src/quick3d/imports/scene3d/scene3dsgnode_p.h
new file mode 100644
index 000000000..f123ffdaa
--- /dev/null
+++ b/src/quick3d/imports/scene3d/scene3dsgnode_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_SCENE3DSGNODE_P_H
+#define QT3DRENDER_SCENE3DSGNODE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/QSGGeometryNode>
+
+#include "scene3dsgmaterial_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QSGTexture;
+
+namespace Qt3DRender {
+
+class Scene3DSGNode : public QSGGeometryNode
+{
+public:
+ Scene3DSGNode();
+ ~Scene3DSGNode();
+
+ void setTexture(QSGTexture *texture) Q_DECL_NOEXCEPT
+ {
+ m_material.setTexture(texture);
+ m_opaqueMaterial.setTexture(texture);
+ markDirty(DirtyMaterial);
+ }
+ QSGTexture *texture() const Q_DECL_NOEXCEPT { return m_material.texture(); }
+
+ void setRect(const QRectF &rect);
+ QRectF rect() const Q_DECL_NOEXCEPT { return m_rect; }
+
+private:
+ Scene3DSGMaterial m_material;
+ Scene3DSGMaterial m_opaqueMaterial;
+ QSGGeometry m_geometry;
+ QRectF m_rect;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_SCENE3DSGNODE_P_H
diff --git a/src/quick3d/quick3d/items/items.pri b/src/quick3d/quick3d/items/items.pri
index 17668085e..4c5e93fb2 100644
--- a/src/quick3d/quick3d/items/items.pri
+++ b/src/quick3d/quick3d/items/items.pri
@@ -1,6 +1,5 @@
HEADERS += \
$$PWD/quick3dnodeinstantiator_p.h \
- $$PWD/quick3dconfiguration_p.h \
$$PWD/quick3dentity_p.h \
$$PWD/quick3dentityloader_p_p.h \
$$PWD/quick3dentityloader_p.h \
@@ -10,7 +9,6 @@ SOURCES += \
$$PWD/quick3dnode.cpp \
$$PWD/quick3dentity.cpp \
$$PWD/quick3dentityloader.cpp \
- $$PWD/quick3dconfiguration.cpp \
$$PWD/quick3dnodeinstantiator.cpp
INCLUDEPATH += $$PWD
diff --git a/src/quick3d/quick3d/items/quick3dconfiguration.cpp b/src/quick3d/quick3d/items/quick3dconfiguration.cpp
deleted file mode 100644
index 4b31e08c7..000000000
--- a/src/quick3d/quick3d/items/quick3dconfiguration.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "quick3dconfiguration_p.h"
-#include <QDebug>
-
-#include <Qt3DCore/QAspectEngine>
-#include <Qt3DCore/QCamera>
-#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/private/qnode_p.h>
-
-#include <Qt3DInput/QInputAspect>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-namespace Quick {
-
-/*!
- \qmltype Configuration
- \inqmlmodule Qt3D.Core
- \since 5.5
-*/
-Quick3DConfiguration::Quick3DConfiguration(QObject *parent)
- : QObject(parent)
- , m_camera(Q_NULLPTR)
-{
-}
-
-void Quick3DConfiguration::setControlledCamera(QCamera *camera)
-{
- if (m_camera != camera) {
- m_camera = camera;
- emit controlledCameraChanged();
- QMetaObject::invokeMethod(this, "applyControlledCameraChange", Qt::QueuedConnection);
- }
-}
-
-/*!
- \qmlproperty Camera Qt3DCore::Configuration::controlledCamera
-*/
-QCamera *Quick3DConfiguration::controlledCamera() const
-{
- return m_camera;
-}
-
-void Quick3DConfiguration::applyControlledCameraChange()
-{
- QScene *scene = QNodePrivate::get(m_camera)->scene();
-
- // Too early, let's try again later
- if (!scene) {
- QMetaObject::invokeMethod(this, "applyControlledCameraChange", Qt::QueuedConnection);
- return;
- }
-
- Q_FOREACH (QAbstractAspect *aspect, scene->engine()->aspects()) {
- if (aspect->property("camera").isValid()) {
- aspect->setProperty("camera", QVariant::fromValue(m_camera));
- break;
- }
- }
-}
-
-} // namespace Quick
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
diff --git a/src/quick3d/quick3d/items/quick3dconfiguration_p.h b/src/quick3d/quick3d/items/quick3dconfiguration_p.h
deleted file mode 100644
index 3b1c76aea..000000000
--- a/src/quick3d/quick3d/items/quick3dconfiguration_p.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3D_QUICK_QUICK3DCONFIGURATION_P_H
-#define QT3D_QUICK_QUICK3DCONFIGURATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DQuick/private/qt3dquick_global_p.h>
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-
-class QCamera;
-
-namespace Quick {
-
-class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DConfiguration : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DCore::QCamera *controlledCamera READ controlledCamera WRITE setControlledCamera NOTIFY controlledCameraChanged)
-public:
- explicit Quick3DConfiguration(QObject *parent = 0);
-
- void setControlledCamera(QCamera *camera);
- QCamera *controlledCamera() const;
-
-Q_SIGNALS:
- void controlledCameraChanged();
-
-private Q_SLOTS:
- void applyControlledCameraChange();
-
-private:
- QCamera *m_camera;
-};
-
-} // namespace Quick
-} // namespace Qt3DCore
-
-QT_END_NAMESPACE
-
-#endif // QT3D_QUICK_QUICK3DCONFIGURATION_P_H
diff --git a/src/quick3d/quick3d/items/quick3dentity.cpp b/src/quick3d/quick3d/items/quick3dentity.cpp
index 9fdbe1ce9..4eac4400e 100644
--- a/src/quick3d/quick3d/items/quick3dentity.cpp
+++ b/src/quick3d/quick3d/items/quick3dentity.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -69,7 +72,7 @@ QQmlListProperty<QComponent> Quick3DEntity::componentList()
void Quick3DEntity::qmlAppendComponent(QQmlListProperty<QComponent> *list, QComponent *comp)
{
- if (comp == Q_NULLPTR)
+ if (comp == nullptr)
return;
Quick3DEntity *self = static_cast<Quick3DEntity *>(list->object);
self->parentEntity()->addComponent(comp);
@@ -90,8 +93,8 @@ int Quick3DEntity::qmlComponentsCount(QQmlListProperty<QComponent> *list)
void Quick3DEntity::qmlClearComponents(QQmlListProperty<QComponent> *list)
{
Quick3DEntity *self = static_cast<Quick3DEntity *>(list->object);
- QComponentList components = self->parentEntity()->components();
- Q_FOREACH (QComponent *comp, components) {
+ const QComponentVector components = self->parentEntity()->components();
+ for (QComponent *comp : components) {
self->parentEntity()->removeComponent(comp);
}
}
diff --git a/src/quick3d/quick3d/items/quick3dentity_p.h b/src/quick3d/quick3d/items/quick3dentity_p.h
index b5f8ef8d3..eb716a0c3 100644
--- a/src/quick3d/quick3d/items/quick3dentity_p.h
+++ b/src/quick3d/quick3d/items/quick3dentity_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/items/quick3dentityloader.cpp b/src/quick3d/quick3d/items/quick3dentityloader.cpp
index 9849382bf..63f4cceac 100644
--- a/src/quick3d/quick3d/items/quick3dentityloader.cpp
+++ b/src/quick3d/quick3d/items/quick3dentityloader.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -63,9 +66,9 @@ protected:
switch (status) {
case Ready: {
- Q_ASSERT(priv->m_entity == Q_NULLPTR);
+ Q_ASSERT(priv->m_entity == nullptr);
priv->m_entity = qobject_cast<QEntity *>(object());
- Q_ASSERT(priv->m_entity != Q_NULLPTR);
+ Q_ASSERT(priv->m_entity != nullptr);
priv->m_entity->setParent(m_loader);
emit m_loader->entityChanged();
break;
@@ -97,11 +100,6 @@ Quick3DEntityLoader::Quick3DEntityLoader(QNode *parent)
{
}
-Quick3DEntityLoader::~Quick3DEntityLoader()
-{
- QNode::cleanup();
-}
-
/*!
\qmlproperty QtQml::QtObject Qt3DCore::EntityLoader::entity
\readonly
@@ -134,21 +132,12 @@ void Quick3DEntityLoader::setSource(const QUrl &url)
d->loadFromSource();
}
-void Quick3DEntityLoader::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const Quick3DEntityLoader *loader = static_cast<const Quick3DEntityLoader*>(ref);
- d_func()->m_source = loader->d_func()->m_source;
- d_func()->m_entity = static_cast<QEntity*>(QNode::clone(loader->d_func()->m_entity));
- d_func()->m_entity->setParent(this);
-}
-
Quick3DEntityLoaderPrivate::Quick3DEntityLoaderPrivate()
: QEntityPrivate(),
- m_incubator(Q_NULLPTR),
- m_context(Q_NULLPTR),
- m_component(Q_NULLPTR),
- m_entity(Q_NULLPTR)
+ m_incubator(nullptr),
+ m_context(nullptr),
+ m_component(nullptr),
+ m_entity(nullptr)
{
}
@@ -157,23 +146,23 @@ void Quick3DEntityLoaderPrivate::clear()
if (m_incubator) {
m_incubator->clear();
delete m_incubator;
- m_incubator = Q_NULLPTR;
+ m_incubator = nullptr;
}
if (m_entity) {
m_entity->setParent(Q_NODE_NULLPTR);
delete m_entity;
- m_entity = Q_NULLPTR;
+ m_entity = nullptr;
}
if (m_component) {
delete m_component;
- m_component = Q_NULLPTR;
+ m_component = nullptr;
}
if (m_context) {
delete m_context;
- m_context = Q_NULLPTR;
+ m_context = nullptr;
}
}
@@ -193,9 +182,9 @@ void Quick3DEntityLoaderPrivate::loadComponent(const QUrl &source)
{
Q_Q(Quick3DEntityLoader);
- Q_ASSERT(m_entity == Q_NULLPTR);
- Q_ASSERT(m_component == Q_NULLPTR);
- Q_ASSERT(m_context == Q_NULLPTR);
+ Q_ASSERT(m_entity == nullptr);
+ Q_ASSERT(m_component == nullptr);
+ Q_ASSERT(m_context == nullptr);
m_component = new QQmlComponent(qmlEngine(q), q);
QObject::connect(m_component, SIGNAL(statusChanged(QQmlComponent::Status)),
@@ -207,10 +196,10 @@ void Quick3DEntityLoaderPrivate::_q_componentStatusChanged(QQmlComponent::Status
{
Q_Q(Quick3DEntityLoader);
- Q_ASSERT(m_entity == Q_NULLPTR);
- Q_ASSERT(m_component != Q_NULLPTR);
- Q_ASSERT(m_context == Q_NULLPTR);
- Q_ASSERT(m_incubator == Q_NULLPTR);
+ Q_ASSERT(m_entity == nullptr);
+ Q_ASSERT(m_component != nullptr);
+ Q_ASSERT(m_context == nullptr);
+ Q_ASSERT(m_incubator == nullptr);
if (!m_component->errors().isEmpty()) {
QQmlEnginePrivate::warning(qmlEngine(q), m_component->errors());
diff --git a/src/quick3d/quick3d/items/quick3dentityloader_p.h b/src/quick3d/quick3d/items/quick3dentityloader_p.h
index af3f1df7d..928f31ada 100644
--- a/src/quick3d/quick3d/items/quick3dentityloader_p.h
+++ b/src/quick3d/quick3d/items/quick3dentityloader_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -73,7 +76,6 @@ class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DEntityLoader : public QEntity
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
public:
explicit Quick3DEntityLoader(QNode *parent = 0);
- ~Quick3DEntityLoader();
QObject *entity() const;
@@ -84,13 +86,9 @@ Q_SIGNALS:
void entityChanged();
void sourceChanged();
-protected:
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(Quick3DEntityLoader)
Q_PRIVATE_SLOT(d_func(), void _q_componentStatusChanged(QQmlComponent::Status))
- QT3D_CLONEABLE(Quick3DEntityLoader)
};
} // namespace Quick
diff --git a/src/quick3d/quick3d/items/quick3dentityloader_p_p.h b/src/quick3d/quick3d/items/quick3dentityloader_p_p.h
index cbf0001da..235870933 100644
--- a/src/quick3d/quick3d/items/quick3dentityloader_p_p.h
+++ b/src/quick3d/quick3d/items/quick3dentityloader_p_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/items/quick3dnode.cpp b/src/quick3d/quick3d/items/quick3dnode.cpp
index f8228758d..3761f8d64 100644
--- a/src/quick3d/quick3d/items/quick3dnode.cpp
+++ b/src/quick3d/quick3d/items/quick3dnode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -108,7 +111,7 @@ int Quick3DNode::dataCount(QQmlListProperty<QObject> *list)
void Quick3DNode::clearData(QQmlListProperty<QObject> *list)
{
Quick3DNode *self = static_cast<Quick3DNode *>(list->object);
- Q_FOREACH (QObject *const child, self->parentNode()->children())
+ for (QObject *const child : self->parentNode()->children())
self->childRemoved(0, child);
}
@@ -138,7 +141,7 @@ int Quick3DNode::childCount(QQmlListProperty<Qt3DCore::QNode> *list)
void Quick3DNode::clearChildren(QQmlListProperty<Qt3DCore::QNode> *list)
{
Quick3DNode *self = static_cast<Quick3DNode *>(list->object);
- Q_FOREACH (QObject *const child, self->parentNode()->children())
+ for (QObject *const child : self->parentNode()->children())
self->childRemoved(0, child);
}
@@ -159,7 +162,7 @@ void Quick3DNode::childRemoved(int, QObject *obj)
if (QNode *n = qobject_cast<QNode *>(obj))
n->setParent(Q_NODE_NULLPTR);
else
- obj->setParent(Q_NULLPTR);
+ obj->setParent(nullptr);
}
} // namespace Quick
diff --git a/src/quick3d/quick3d/items/quick3dnode_p.h b/src/quick3d/quick3d/items/quick3dnode_p.h
index b25167528..9798d0d4c 100644
--- a/src/quick3d/quick3d/items/quick3dnode_p.h
+++ b/src/quick3d/quick3d/items/quick3dnode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp b/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp
index 5d267fe90..b95290a3c 100644
--- a/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp
+++ b/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp
@@ -2,34 +2,37 @@
**
** Copyright (C) 2013 Research In Motion.
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -168,7 +171,8 @@ void Quick3DNodeInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &change
int difference = 0;
QHash<int, QVector<QPointer<QObject> > > moved;
- Q_FOREACH (const QQmlChangeSet::Change &remove, changeSet.removes()) {
+ const auto removes = changeSet.removes();
+ for (const QQmlChangeSet::Change &remove : removes) {
int index = qMin(remove.index, m_objects.count());
int count = qMin(remove.index + remove.count, m_objects.count()) - index;
if (remove.isMove()) {
@@ -189,7 +193,8 @@ void Quick3DNodeInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &change
difference -= remove.count;
}
- Q_FOREACH (const QQmlChangeSet::Change &insert, changeSet.inserts()) {
+ const auto inserts = changeSet.inserts();
+ for (const QQmlChangeSet::Change &insert : inserts) {
int index = qMin(insert.index, m_objects.count());
if (insert.isMove()) {
QVector<QPointer<QObject> > movedObjects = moved.value(insert.moveId);
@@ -241,11 +246,6 @@ Quick3DNodeInstantiator::Quick3DNodeInstantiator(QNode *parent)
{
}
-Quick3DNodeInstantiator::~Quick3DNodeInstantiator()
-{
- QNode::cleanup();
-}
-
/*!
\qmlsignal Qt3D.Core::NodeInstantiator::objectAdded(int index, QtObject node)
@@ -500,21 +500,22 @@ void Quick3DNodeInstantiator::componentComplete()
}
}
-void Quick3DNodeInstantiator::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const Quick3DNodeInstantiator *instantiator = static_cast<const Quick3DNodeInstantiator*>(ref);
- // We only need to clone the children as the instantiator itself has no
- // corresponding backend node type.
- for (int i = 0; i < instantiator->d_func()->m_objects.size(); ++i) {
- QNode *n = qobject_cast<QNode *>(instantiator->d_func()->m_objects.at(i));
- if (!n)
- continue;
- QNode *clonedNode = QNode::clone(n);
- clonedNode->setParent(this);
- d_func()->m_objects.append(clonedNode);
- }
-}
+// TODO: Avoid cloning here
+//void Quick3DNodeInstantiator::copy(const QNode *ref)
+//{
+// QNode::copy(ref);
+// const Quick3DNodeInstantiator *instantiator = static_cast<const Quick3DNodeInstantiator*>(ref);
+// // We only need to clone the children as the instantiator itself has no
+// // corresponding backend node type.
+// for (int i = 0; i < instantiator->d_func()->m_objects.size(); ++i) {
+// QNode *n = qobject_cast<QNode *>(instantiator->d_func()->m_objects.at(i));
+// if (!n)
+// continue;
+// QNode *clonedNode = QNode::clone(n);
+// clonedNode->setParent(this);
+// d_func()->m_objects.append(clonedNode);
+// }
+//}
} // namespace Quick
} // namespace Qt3DCore
diff --git a/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h b/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
index 8a47fe316..d861fc2fe 100644
--- a/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
+++ b/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
@@ -2,34 +2,37 @@
**
** Copyright (C) 2013 Research In Motion.
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -77,7 +80,6 @@ class QT3DQUICKSHARED_PRIVATE_EXPORT Quick3DNodeInstantiator : public QNode, pub
public:
Quick3DNodeInstantiator(QNode *parent = 0);
- ~Quick3DNodeInstantiator();
bool isActive() const;
void setActive(bool newVal);
@@ -110,11 +112,7 @@ Q_SIGNALS:
void objectAdded(int index, QObject *object);
void objectRemoved(int index, QObject *object);
-protected:
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
private:
- QT3D_CLONEABLE(Quick3DNodeInstantiator)
Q_DISABLE_COPY(Quick3DNodeInstantiator)
Q_DECLARE_PRIVATE(Quick3DNodeInstantiator)
Q_PRIVATE_SLOT(d_func(), void _q_createdItem(int, QObject *))
diff --git a/src/quick3d/quick3d/qqmlaspectengine.cpp b/src/quick3d/quick3d/qqmlaspectengine.cpp
index a425e9cb9..690f256a0 100644
--- a/src/quick3d/quick3d/qqmlaspectengine.cpp
+++ b/src/quick3d/quick3d/qqmlaspectengine.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -56,7 +59,7 @@ QQmlAspectEnginePrivate::QQmlAspectEnginePrivate()
: QObjectPrivate()
, m_qmlEngine(new QQmlEngine())
, m_aspectEngine(new QAspectEngine())
- , m_component(Q_NULLPTR)
+ , m_component(nullptr)
{
}
@@ -86,6 +89,15 @@ QQmlAspectEnginePrivate::QQmlAspectEnginePrivate()
*/
/*!
+ * \fn void Qt3DCore::Quick::QQmlAspectEngine::sceneCreated(QObject* rootObject)
+ *
+ * This signal is emitted with \a rootObject when the scene has been instantiated. This provides a
+ * chance to manipulate the scene before passing it over to the aspect engine. Useful for
+ * convenience window classes to set up cameras and surfaces on the framegraph and event sources
+ * for the input aspect etc.
+ */
+
+/*!
* Constructs a new QQmlAspectEngine with \a parent.
*/
QQmlAspectEngine::QQmlAspectEngine(QObject *parent)
@@ -93,6 +105,11 @@ QQmlAspectEngine::QQmlAspectEngine(QObject *parent)
{
}
+/*! \internal */
+QQmlAspectEngine::~QQmlAspectEngine()
+{
+}
+
/*!
* \return the status.
*/
@@ -114,8 +131,8 @@ void QQmlAspectEngine::setSource(const QUrl &source)
Q_D(QQmlAspectEngine);
if (d->m_component) {
- d->m_aspectEngine->setRootEntity(Q_NULLPTR);
- d->m_component = Q_NULLPTR;
+ d->m_aspectEngine->setRootEntity(QEntityPtr());
+ d->m_component = nullptr;
}
if (!source.isEmpty()) {
@@ -155,8 +172,8 @@ void QQmlAspectEnginePrivate::_q_continueExecute()
q, SLOT(_q_continueExecute()));
if (m_component->isError()) {
- QList<QQmlError> errorList = m_component->errors();
- Q_FOREACH ( const QQmlError& error, errorList ) {
+ const auto errors = m_component->errors();
+ for (const QQmlError &error : errors) {
QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning()
<< error;
}
@@ -167,8 +184,8 @@ void QQmlAspectEnginePrivate::_q_continueExecute()
QObject* obj = m_component->create();
if (m_component->isError()) {
- QList<QQmlError> errorList = m_component->errors();
- Q_FOREACH ( const QQmlError& error, errorList ) {
+ const auto errors = m_component->errors();
+ for (const QQmlError &error : errors) {
QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning()
<< error;
}
@@ -176,7 +193,12 @@ void QQmlAspectEnginePrivate::_q_continueExecute()
return;
}
- m_aspectEngine->setRootEntity(qobject_cast<QEntity *>(obj));
+ // Let users know we have loaded the QML file, and the scene has been instantiated.
+ // This gives a chance to manipulate the scene before passing it over to the
+ // aspect engine. Useful for convenience window classes to set up cameras and surfaces
+ // on the framegraph and event sources for the input aspect etc.
+ emit q->sceneCreated(obj);
+ m_aspectEngine->setRootEntity(QEntityPtr(qobject_cast<QEntity *>(obj)));
emit q->statusChanged(q->status());
}
diff --git a/src/quick3d/quick3d/qqmlaspectengine.h b/src/quick3d/quick3d/qqmlaspectengine.h
index 6c71f3edb..c85cbb8ea 100644
--- a/src/quick3d/quick3d/qqmlaspectengine.h
+++ b/src/quick3d/quick3d/qqmlaspectengine.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,7 +57,8 @@ class QT3DQUICKSHARED_EXPORT QQmlAspectEngine: public QObject
public:
enum Status { Null, Ready, Loading, Error };
- explicit QQmlAspectEngine(QObject *parent = Q_NULLPTR);
+ explicit QQmlAspectEngine(QObject *parent = nullptr);
+ ~QQmlAspectEngine();
Status status() const;
void setSource(const QUrl &source);
@@ -64,6 +68,7 @@ public:
Q_SIGNALS:
void statusChanged(Status);
+ void sceneCreated(QObject* rootObject);
private:
Q_DECLARE_PRIVATE(QQmlAspectEngine)
diff --git a/src/quick3d/quick3d/qqmlaspectengine_p.h b/src/quick3d/quick3d/qqmlaspectengine_p.h
index c53082a4a..f9343ae68 100644
--- a/src/quick3d/quick3d/qqmlaspectengine_p.h
+++ b/src/quick3d/quick3d/qqmlaspectengine_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/qquaternionanimation.cpp b/src/quick3d/quick3d/qquaternionanimation.cpp
index 872f299ec..25cad523b 100644
--- a/src/quick3d/quick3d/qquaternionanimation.cpp
+++ b/src/quick3d/quick3d/qquaternionanimation.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt 3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/qquaternionanimation_p.h b/src/quick3d/quick3d/qquaternionanimation_p.h
index 2c968df58..92056f24e 100644
--- a/src/quick3d/quick3d/qquaternionanimation_p.h
+++ b/src/quick3d/quick3d/qquaternionanimation_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt 3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/qt3dquick_global.cpp b/src/quick3d/quick3d/qt3dquick_global.cpp
index 865cd3243..78523aa4a 100644
--- a/src/quick3d/quick3d/qt3dquick_global.cpp
+++ b/src/quick3d/quick3d/qt3dquick_global.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -156,8 +159,8 @@ public:
int index = s.indexOf(QLatin1Char(','));
bool xGood, yGood;
- float xCoord = s.left(index).toFloat(&xGood);
- float yCoord = s.mid(index+1).toFloat(&yGood);
+ float xCoord = s.leftRef(index).toFloat(&xGood);
+ float yCoord = s.midRef(index+1).toFloat(&yGood);
if (xGood && yGood) {
if (ok) *ok = true;
@@ -176,9 +179,9 @@ public:
int index2 = s.indexOf(QLatin1Char(','), index+1);
bool xGood, yGood, zGood;
- float xCoord = s.left(index).toFloat(&xGood);
- float yCoord = s.mid(index+1, index2-index-1).toFloat(&yGood);
- float zCoord = s.mid(index2+1).toFloat(&zGood);
+ float xCoord = s.leftRef(index).toFloat(&xGood);
+ float yCoord = s.midRef(index+1, index2-index-1).toFloat(&yGood);
+ float zCoord = s.midRef(index2+1).toFloat(&zGood);
if (xGood && yGood && zGood) {
if (ok) *ok = true;
@@ -198,10 +201,10 @@ public:
int index3 = s.indexOf(QLatin1Char(','), index2+1);
bool xGood, yGood, zGood, wGood;
- float xCoord = s.left(index).toFloat(&xGood);
- float yCoord = s.mid(index+1, index2-index-1).toFloat(&yGood);
- float zCoord = s.mid(index2+1, index3-index2-1).toFloat(&zGood);
- float wCoord = s.mid(index3+1).toFloat(&wGood);
+ float xCoord = s.leftRef(index).toFloat(&xGood);
+ float yCoord = s.midRef(index+1, index2-index-1).toFloat(&yGood);
+ float zCoord = s.midRef(index2+1, index3-index2-1).toFloat(&zGood);
+ float wCoord = s.midRef(index3+1).toFloat(&wGood);
if (xGood && yGood && zGood && wGood) {
if (ok) *ok = true;
@@ -221,10 +224,10 @@ public:
int index3 = s.indexOf(QLatin1Char(','), index2+1);
bool sGood, xGood, yGood, zGood;
- qreal sCoord = s.left(index).toDouble(&sGood);
- qreal xCoord = s.mid(index+1, index2-index-1).toDouble(&xGood);
- qreal yCoord = s.mid(index2+1, index3-index2-1).toDouble(&yGood);
- qreal zCoord = s.mid(index3+1).toDouble(&zGood);
+ qreal sCoord = s.leftRef(index).toDouble(&sGood);
+ qreal xCoord = s.midRef(index+1, index2-index-1).toDouble(&xGood);
+ qreal yCoord = s.midRef(index2+1, index3-index2-1).toDouble(&yGood);
+ qreal zCoord = s.midRef(index3+1).toDouble(&zGood);
if (sGood && xGood && yGood && zGood) {
if (ok) *ok = true;
@@ -241,7 +244,7 @@ public:
if (s.count(QLatin1Char(',')) == 15) {
float matValues[16];
bool vOK = true;
- QString mutableStr = s;
+ QStringRef mutableStr(&s);
for (int i = 0; vOK && i < 16; ++i) {
int cidx = mutableStr.indexOf(QLatin1Char(','));
matValues[i] = mutableStr.left(cidx).toDouble(&vOK);
@@ -301,7 +304,7 @@ public:
break;
}
- return Q_NULLPTR;
+ return nullptr;
}
bool init(int type, QVariant& dst) Q_DECL_OVERRIDE
diff --git a/src/quick3d/quick3d/qt3dquick_global.h b/src/quick3d/quick3d/qt3dquick_global.h
index b723012e6..b2f580335 100644
--- a/src/quick3d/quick3d/qt3dquick_global.h
+++ b/src/quick3d/quick3d/qt3dquick_global.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DQUICK_GLOBAL_H
#define QT3DQUICK_GLOBAL_H
-#include <QtCore/qglobal.h>
+#include <Qt3DCore/qt3dcore_global.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quick3d/quick3d/qt3dquick_global_p.h b/src/quick3d/quick3d/qt3dquick_global_p.h
index d15381dd6..d67209404 100644
--- a/src/quick3d/quick3d/qt3dquick_global_p.h
+++ b/src/quick3d/quick3d/qt3dquick_global_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/qt3dquicknodefactory.cpp b/src/quick3d/quick3d/qt3dquicknodefactory.cpp
index 4da5e9b25..923793506 100644
--- a/src/quick3d/quick3d/qt3dquicknodefactory.cpp
+++ b/src/quick3d/quick3d/qt3dquicknodefactory.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -56,7 +59,7 @@ void QuickNodeFactory::registerType(const char *className, const char *quickName
QNode *QuickNodeFactory::createNode(const char *type)
{
if (!m_types.contains(type))
- return Q_NULLPTR;
+ return nullptr;
Type &typeInfo(m_types[type]);
@@ -65,7 +68,7 @@ QNode *QuickNodeFactory::createNode(const char *type)
typeInfo.t = QQmlMetaType::qmlType(QString::fromLatin1(typeInfo.quickName), typeInfo.version.first, typeInfo.version.second);
}
- return typeInfo.t ? qobject_cast<QNode *>(typeInfo.t->create()) : Q_NULLPTR;
+ return typeInfo.t ? qobject_cast<QNode *>(typeInfo.t->create()) : nullptr;
}
} // namespace Qt3DCore
diff --git a/src/quick3d/quick3d/qt3dquicknodefactory_p.h b/src/quick3d/quick3d/qt3dquicknodefactory_p.h
index fda891ed8..4dd455461 100644
--- a/src/quick3d/quick3d/qt3dquicknodefactory_p.h
+++ b/src/quick3d/quick3d/qt3dquicknodefactory_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qabstractnodefactory.h>
+#include <Qt3DCore/private/qabstractnodefactory_p.h>
#include <QtCore/qhash.h>
QT_BEGIN_NAMESPACE
@@ -68,9 +71,9 @@ public:
private:
struct Type {
- Type() : t(Q_NULLPTR), resolved(false) { }
+ Type() : t(nullptr), resolved(false) { }
Type(const char *quickName, int major, int minor)
- : quickName(quickName), version(major, minor), t(Q_NULLPTR), resolved(false) { }
+ : quickName(quickName), version(major, minor), t(nullptr), resolved(false) { }
QByteArray quickName;
QPair<int, int> version;
QQmlType *t;
diff --git a/src/quick3d/quick3d/qt3dquickvaluetypes.cpp b/src/quick3d/quick3d/qt3dquickvaluetypes.cpp
index a17efd3f1..1cdc3844b 100644
--- a/src/quick3d/quick3d/qt3dquickvaluetypes.cpp
+++ b/src/quick3d/quick3d/qt3dquickvaluetypes.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/qt3dquickvaluetypes_p.h b/src/quick3d/quick3d/qt3dquickvaluetypes_p.h
index d87d9aa74..ed80d0426 100644
--- a/src/quick3d/quick3d/qt3dquickvaluetypes_p.h
+++ b/src/quick3d/quick3d/qt3dquickvaluetypes_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3d/quick3d.pro b/src/quick3d/quick3d/quick3d.pro
index 9e5ffbfdd..affb3b352 100644
--- a/src/quick3d/quick3d/quick3d.pro
+++ b/src/quick3d/quick3d/quick3d.pro
@@ -3,6 +3,9 @@ MODULE = 3dquick
QT += core-private gui-private qml qml-private quick quick-private 3dcore 3dcore-private
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
gcov {
CONFIG += static
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
diff --git a/src/quick3d/quick3dextras/qt3dquickextras_global.h b/src/quick3d/quick3dextras/qt3dquickextras_global.h
new file mode 100644
index 000000000..d9277baee
--- /dev/null
+++ b/src/quick3d/quick3dextras/qt3dquickextras_global.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DQUICKEXTRAS_GLOBAL_H
+#define QT3DQUICKEXTRAS_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#if defined(QT_SHARED) || !defined(QT_STATIC)
+# if defined(QT_BUILD_3DQUICKEXTRAS_LIB)
+# define QT3DQUICKEXTRASSHARED_EXPORT Q_DECL_EXPORT
+# else
+# define QT3DQUICKEXTRASSHARED_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define QT3DQUICKEXTRASSHARED_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QT3DQUICKEXTRAS_GLOBAL_H
diff --git a/src/quick3d/quick3dextras/qt3dquickwindow.cpp b/src/quick3d/quick3dextras/qt3dquickwindow.cpp
new file mode 100644
index 000000000..7d4ad0dd9
--- /dev/null
+++ b/src/quick3d/quick3dextras/qt3dquickwindow.cpp
@@ -0,0 +1,254 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <Qt3DQuick/QQmlAspectEngine>
+#include <Qt3DRender/qcamera.h>
+#include <Qt3DRender/qrenderaspect.h>
+#include <Qt3DRender/qrendersettings.h>
+#include <Qt3DRender/qrendersurfaceselector.h>
+#include <Qt3DInput/qinputaspect.h>
+#include <Qt3DInput/qinputsettings.h>
+#include <Qt3DLogic/qlogicaspect.h>
+
+#include <QQmlContext>
+
+#include <QtGui/qopenglcontext.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DExtras {
+
+namespace Quick {
+
+Qt3DQuickWindow::Qt3DQuickWindow(QWindow *parent)
+ : QQuickWindow(parent)
+ , m_engine(nullptr)
+ , m_renderAspect(nullptr)
+ , m_inputAspect(nullptr)
+ , m_logicAspect(nullptr)
+ , m_initialized(false)
+ , m_cameraAspectRatioMode(AutomaticAspectRatio)
+{
+ setSurfaceType(QSurface::OpenGLSurface);
+
+ resize(1024, 768);
+
+ QSurfaceFormat format;
+#ifdef QT_OPENGL_ES_2
+ format.setRenderableType(QSurfaceFormat::OpenGLES);
+#else
+ if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
+ format.setVersion(4, 3);
+ format.setProfile(QSurfaceFormat::CoreProfile);
+ }
+#endif
+ format.setDepthBufferSize(24);
+ format.setSamples(4);
+ format.setStencilBufferSize(8);
+ setFormat(format);
+ QSurfaceFormat::setDefaultFormat(format);
+ create();
+
+ m_engine.reset(new Qt3DCore::Quick::QQmlAspectEngine);
+ m_renderAspect = new Qt3DRender::QRenderAspect;
+ m_inputAspect = new Qt3DInput::QInputAspect;
+ m_logicAspect = new Qt3DLogic::QLogicAspect;
+
+ m_engine->aspectEngine()->registerAspect(m_renderAspect);
+ m_engine->aspectEngine()->registerAspect(m_inputAspect);
+ m_engine->aspectEngine()->registerAspect(m_logicAspect);
+}
+
+Qt3DQuickWindow::~Qt3DQuickWindow()
+{
+}
+
+void Qt3DQuickWindow::registerAspect(Qt3DCore::QAbstractAspect *aspect)
+{
+ Q_ASSERT(!isVisible());
+ m_engine->aspectEngine()->registerAspect(aspect);
+}
+
+void Qt3DQuickWindow::registerAspect(const QString &name)
+{
+ Q_ASSERT(!isVisible());
+ m_engine->aspectEngine()->registerAspect(name);
+}
+
+void Qt3DQuickWindow::setSource(const QUrl &source)
+{
+ m_source = source;
+}
+
+Qt3DCore::Quick::QQmlAspectEngine *Qt3DQuickWindow::engine() const
+{
+ return m_engine.data();
+}
+
+void Qt3DQuickWindow::setCameraAspectRatioMode(CameraAspectRatioMode mode)
+{
+ if (m_cameraAspectRatioMode == mode)
+ return;
+
+ m_cameraAspectRatioMode = mode;
+ setCameraAspectModeHelper();
+ emit cameraAspectRatioModeChanged(mode);
+}
+
+Qt3DQuickWindow::CameraAspectRatioMode Qt3DQuickWindow::cameraAspectRatioMode() const
+{
+ return m_cameraAspectRatioMode;
+}
+
+void Qt3DQuickWindow::showEvent(QShowEvent *e)
+{
+ if (!m_initialized) {
+
+ // Connect to the QQmlAspectEngine's statusChanged signal so that when the QML is loaded
+ // and th eobjects hav ebeen instantiated, but before we set them on the QAspectEngine we
+ // can swoop in and set the window surface and camera on the framegraph and ensure the camera
+ // respects the window's aspect ratio
+ connect(m_engine.data(), &Qt3DCore::Quick::QQmlAspectEngine::sceneCreated,
+ this, &Qt3DQuickWindow::onSceneCreated);
+
+ m_engine->setSource(m_source);
+
+ // Set the QQmlIncubationController on the window
+ // to benefit from asynchronous incubation
+ m_engine->qmlEngine()->setIncubationController(QQuickWindow::incubationController());
+
+ m_initialized = true;
+ }
+ QQuickWindow::showEvent(e);
+}
+
+void Qt3DQuickWindow::onSceneCreated(QObject *rootObject)
+{
+ Q_ASSERT(rootObject);
+
+ setWindowSurface(rootObject);
+
+ if (m_cameraAspectRatioMode == AutomaticAspectRatio) {
+ // Set aspect ratio of first camera to match the window
+ QList<Qt3DRender::QCamera *> cameras
+ = rootObject->findChildren<Qt3DRender::QCamera *>();
+ if (cameras.isEmpty()) {
+ qWarning() << "No camera found";
+ } else {
+ m_camera = cameras.first();
+ setCameraAspectModeHelper();
+ }
+ }
+
+ // Set ourselves up as a source of input events for the input aspect
+ Qt3DInput::QInputSettings *inputSettings = rootObject->findChild<Qt3DInput::QInputSettings *>();
+ if (inputSettings) {
+ inputSettings->setEventSource(this);
+ } else {
+ qWarning() << "No Input Settings found, keyboard and mouse events won't be handled";
+ }
+}
+
+void Qt3DQuickWindow::setWindowSurface(QObject *rootObject)
+{
+ // Find surface selector in framegraph and set ourselves up as the
+ // render surface there
+ Qt3DRender::QRenderSettings *rendererSettings
+ = rootObject->findChild<Qt3DRender::QRenderSettings *>();
+ if (!rendererSettings) {
+ qWarning() << "No renderer settings component found";
+ return;
+ }
+
+ Qt3DCore::QNode *frameGraphRoot = rendererSettings->activeFrameGraph();
+ if (!frameGraphRoot) {
+ qWarning() << "No active frame graph found";
+ return;
+ }
+
+ Qt3DRender::QRenderSurfaceSelector *surfaceSelector = qobject_cast<Qt3DRender::QRenderSurfaceSelector *>(frameGraphRoot);
+ if (!surfaceSelector)
+ surfaceSelector = frameGraphRoot->findChild<Qt3DRender::QRenderSurfaceSelector *>();
+ if (!surfaceSelector) {
+ qWarning() << "No render surface selector found in frame graph";
+ return;
+ }
+
+ surfaceSelector->setSurface(this);
+}
+
+void Qt3DQuickWindow::setCameraAspectModeHelper()
+{
+ switch (m_cameraAspectRatioMode) {
+ case AutomaticAspectRatio:
+ connect(this, &QWindow::widthChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio);
+ connect(this, &QWindow::heightChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio);
+ break;
+ case UserAspectRatio:
+ disconnect(this, &QWindow::widthChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio);
+ disconnect(this, &QWindow::heightChanged, this, &Qt3DQuickWindow::updateCameraAspectRatio);
+ break;
+ }
+}
+
+void Qt3DQuickWindow::updateCameraAspectRatio()
+{
+ if (m_camera) {
+ m_camera->setAspectRatio(static_cast<float>(width()) /
+ static_cast<float>(height()));
+ }
+}
+
+} // Quick
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3dextras/qt3dquickwindow.h b/src/quick3d/quick3dextras/qt3dquickwindow.h
new file mode 100644
index 000000000..48d2c7cb6
--- /dev/null
+++ b/src/quick3d/quick3dextras/qt3dquickwindow.h
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DEXTRAS_QUICK_QT3DQUICKWINDOW_H
+#define QT3DEXTRAS_QUICK_QT3DQUICKWINDOW_H
+
+#include <Qt3DQuickExtras/qt3dquickextras_global.h>
+#include <QQuickWindow>
+#include <QtCore/qpointer.h>
+#include <QUrl>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QAbstractAspect;
+namespace Quick {
+class QQmlAspectEngine;
+}
+}
+
+namespace Qt3DRender {
+class QRenderAspect;
+class QCamera;
+}
+
+namespace Qt3DInput {
+class QInputAspect;
+}
+
+namespace Qt3DLogic {
+class QLogicAspect;
+}
+
+namespace Qt3DExtras {
+
+namespace Quick {
+
+class QT3DQUICKEXTRASSHARED_EXPORT Qt3DQuickWindow : public QQuickWindow
+{
+ Q_OBJECT
+ Q_PROPERTY(CameraAspectRatioMode cameraAspectRatioMode READ cameraAspectRatioMode WRITE setCameraAspectRatioMode NOTIFY cameraAspectRatioModeChanged)
+
+public:
+ explicit Qt3DQuickWindow(QWindow *parent = nullptr);
+ ~Qt3DQuickWindow();
+
+ void registerAspect(Qt3DCore::QAbstractAspect *aspect);
+ void registerAspect(const QString &name);
+
+ void setSource(const QUrl &source);
+ Qt3DCore::Quick::QQmlAspectEngine *engine() const;
+
+ enum CameraAspectRatioMode {
+ AutomaticAspectRatio,
+ UserAspectRatio
+ };
+ Q_ENUM(CameraAspectRatioMode);
+
+ void setCameraAspectRatioMode(CameraAspectRatioMode mode);
+ CameraAspectRatioMode cameraAspectRatioMode() const;
+
+Q_SIGNALS:
+ void cameraAspectRatioModeChanged(CameraAspectRatioMode mode);
+
+protected:
+ void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
+
+private:
+ void onSceneCreated(QObject *rootObject);
+ void setWindowSurface(QObject *rootObject);
+ void setCameraAspectModeHelper();
+ void updateCameraAspectRatio();
+
+ QScopedPointer<Qt3DCore::Quick::QQmlAspectEngine> m_engine;
+
+ // Aspects
+ Qt3DRender::QRenderAspect *m_renderAspect;
+ Qt3DInput::QInputAspect *m_inputAspect;
+ Qt3DLogic::QLogicAspect *m_logicAspect;
+
+ QUrl m_source;
+ bool m_initialized;
+ QPointer<Qt3DRender::QCamera> m_camera;
+ CameraAspectRatioMode m_cameraAspectRatioMode;
+};
+
+} // Quick
+
+} // Qt3DExtras
+
+QT_END_NAMESPACE
+
+#endif // QT3DEXTRAS_QUICK_QT3DQUICKWINDOW_H
diff --git a/src/quick3d/quick3dextras/quick3dextras.pro b/src/quick3d/quick3dextras/quick3dextras.pro
new file mode 100644
index 000000000..7af47424e
--- /dev/null
+++ b/src/quick3d/quick3dextras/quick3dextras.pro
@@ -0,0 +1,29 @@
+TARGET = Qt3DQuickExtras
+MODULE = 3dquickextras
+
+QT += core core-private qml qml-private 3dcore 3dinput 3dquick 3drender 3dlogic
+CONFIG -= precompile_header
+
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
+gcov {
+ CONFIG += static
+ QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
+ QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
+}
+
+SOURCES += \
+ qt3dquickwindow.cpp
+
+
+HEADERS += \
+ qt3dquickextras_global.h \
+ qt3dquickwindow.h
+
+!contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
+
+# otherwise mingw headers do not declare common functions like ::strcasecmp
+win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
+
+load(qt_module)
diff --git a/src/quick3d/quick3dinput/items/items.pri b/src/quick3d/quick3dinput/items/items.pri
index 0a11a2bbf..c0ee04665 100644
--- a/src/quick3d/quick3dinput/items/items.pri
+++ b/src/quick3d/quick3dinput/items/items.pri
@@ -2,12 +2,16 @@ SOURCES += \
$$PWD/quick3daxis.cpp \
$$PWD/quick3daction.cpp \
$$PWD/quick3dlogicaldevice.cpp \
- $$PWD/quick3dphysicaldevice.cpp
+ $$PWD/quick3dphysicaldevice.cpp \
+ $$PWD/quick3dinputsequence.cpp \
+ $$PWD/quick3dinputchord.cpp
HEADERS += \
$$PWD/quick3daxis_p.h \
$$PWD/quick3daction_p.h \
$$PWD/quick3dlogicaldevice_p.h \
- $$PWD/quick3dphysicaldevice_p.h
+ $$PWD/quick3dphysicaldevice_p.h \
+ $$PWD/quick3dinputsequence_p.h \
+ $$PWD/quick3dinputchord_p.h
INCLUDEPATH += $$PWD
diff --git a/src/quick3d/quick3dinput/items/quick3daction.cpp b/src/quick3d/quick3dinput/items/quick3daction.cpp
index 140d62cc9..b3b99e504 100644
--- a/src/quick3d/quick3dinput/items/quick3daction.cpp
+++ b/src/quick3d/quick3dinput/items/quick3daction.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,37 +50,38 @@ Quick3DAction::Quick3DAction(QObject *parent)
{
}
-QQmlListProperty<QActionInput> Quick3DAction::qmlActionInputs()
+QQmlListProperty<QAbstractActionInput> Quick3DAction::qmlActionInputs()
{
- return QQmlListProperty<QActionInput>(this, 0,
+ return QQmlListProperty<QAbstractActionInput>(this, 0,
&Quick3DAction::appendActionInput,
&Quick3DAction::actionInputCount,
&Quick3DAction::actionInputAt,
&Quick3DAction::clearActionInputs);
}
-void Quick3DAction::appendActionInput(QQmlListProperty<QActionInput> *list, QActionInput *input)
+void Quick3DAction::appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input)
{
Quick3DAction *action = qobject_cast<Quick3DAction *>(list->object);
action->parentAction()->addInput(input);
}
-QActionInput *Quick3DAction::actionInputAt(QQmlListProperty<QActionInput> *list, int index)
+QAbstractActionInput *Quick3DAction::actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index)
{
Quick3DAction *action = qobject_cast<Quick3DAction *>(list->object);
return action->parentAction()->inputs().at(index);
}
-int Quick3DAction::actionInputCount(QQmlListProperty<QActionInput> *list)
+int Quick3DAction::actionInputCount(QQmlListProperty<QAbstractActionInput> *list)
{
Quick3DAction *action = qobject_cast<Quick3DAction *>(list->object);
return action->parentAction()->inputs().count();
}
-void Quick3DAction::clearActionInputs(QQmlListProperty<QActionInput> *list)
+void Quick3DAction::clearActionInputs(QQmlListProperty<QAbstractActionInput> *list)
{
Quick3DAction *action = qobject_cast<Quick3DAction *>(list->object);
- Q_FOREACH (QActionInput *input, action->parentAction()->inputs())
+ const auto inputs = action->parentAction()->inputs();
+ for (QAbstractActionInput *input : inputs)
action->parentAction()->removeInput(input);
}
diff --git a/src/quick3d/quick3dinput/items/quick3daction_p.h b/src/quick3d/quick3dinput/items/quick3daction_p.h
index 040418628..8394f9c48 100644
--- a/src/quick3d/quick3dinput/items/quick3daction_p.h
+++ b/src/quick3d/quick3dinput/items/quick3daction_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@
#include <Qt3DQuickInput/private/qt3dquickinput_global_p.h>
#include <Qt3DInput/QAction>
-#include <Qt3DInput/QActionInput>
+#include <Qt3DInput/QAbstractActionInput>
#include <QQmlListProperty>
QT_BEGIN_NAMESPACE
@@ -62,18 +65,19 @@ namespace Quick {
class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DAction : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DInput::QActionInput> inputs READ qmlActionInputs CONSTANT)
+ Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> inputs READ qmlActionInputs CONSTANT)
+ Q_CLASSINFO("DefaultProperty", "inputs")
public:
- explicit Quick3DAction(QObject *parent = Q_NULLPTR);
+ explicit Quick3DAction(QObject *parent = nullptr);
inline QAction *parentAction() const { return qobject_cast<QAction *>(parent()); }
- QQmlListProperty<QActionInput> qmlActionInputs();
+ QQmlListProperty<QAbstractActionInput> qmlActionInputs();
private:
- static void appendActionInput(QQmlListProperty<QActionInput> *list, QActionInput *input);
- static QActionInput *actionInputAt(QQmlListProperty<QActionInput> *list, int index);
- static int actionInputCount(QQmlListProperty<QActionInput> *list);
- static void clearActionInputs(QQmlListProperty<QActionInput> *list);
+ static void appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input);
+ static QAbstractActionInput *actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index);
+ static int actionInputCount(QQmlListProperty<QAbstractActionInput> *list);
+ static void clearActionInputs(QQmlListProperty<QAbstractActionInput> *list);
};
} // namespace Quick
diff --git a/src/quick3d/quick3dinput/items/quick3daxis.cpp b/src/quick3d/quick3dinput/items/quick3daxis.cpp
index b71f899c3..2857e4c48 100644
--- a/src/quick3d/quick3dinput/items/quick3daxis.cpp
+++ b/src/quick3d/quick3dinput/items/quick3daxis.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,37 +50,38 @@ Quick3DAxis::Quick3DAxis(QObject *parent)
{
}
-QQmlListProperty<QAxisInput> Quick3DAxis::qmlAxisInputs()
+QQmlListProperty<QAbstractAxisInput> Quick3DAxis::qmlAxisInputs()
{
- return QQmlListProperty<QAxisInput>(this, 0,
+ return QQmlListProperty<QAbstractAxisInput>(this, 0,
&Quick3DAxis::appendAxisInput,
&Quick3DAxis::axesInputCount,
&Quick3DAxis::axisInputAt,
&Quick3DAxis::clearAxisInputs);
}
-void Quick3DAxis::appendAxisInput(QQmlListProperty<QAxisInput> *list, QAxisInput *input)
+void Quick3DAxis::appendAxisInput(QQmlListProperty<QAbstractAxisInput> *list, QAbstractAxisInput *input)
{
Quick3DAxis *axis = qobject_cast<Quick3DAxis *>(list->object);
axis->parentAxis()->addInput(input);
}
-QAxisInput *Quick3DAxis::axisInputAt(QQmlListProperty<QAxisInput> *list, int index)
+QAbstractAxisInput *Quick3DAxis::axisInputAt(QQmlListProperty<QAbstractAxisInput> *list, int index)
{
Quick3DAxis *axis = qobject_cast<Quick3DAxis *>(list->object);
return axis->parentAxis()->inputs().at(index);
}
-int Quick3DAxis::axesInputCount(QQmlListProperty<QAxisInput> *list)
+int Quick3DAxis::axesInputCount(QQmlListProperty<QAbstractAxisInput> *list)
{
Quick3DAxis *axis = qobject_cast<Quick3DAxis *>(list->object);
return axis->parentAxis()->inputs().count();
}
-void Quick3DAxis::clearAxisInputs(QQmlListProperty<QAxisInput> *list)
+void Quick3DAxis::clearAxisInputs(QQmlListProperty<QAbstractAxisInput> *list)
{
Quick3DAxis *axis = qobject_cast<Quick3DAxis *>(list->object);
- Q_FOREACH (QAxisInput *input, axis->parentAxis()->inputs())
+ const auto inputs = axis->parentAxis()->inputs();
+ for (QAbstractAxisInput *input : inputs)
axis->parentAxis()->removeInput(input);
}
diff --git a/src/quick3d/quick3dinput/items/quick3daxis_p.h b/src/quick3d/quick3dinput/items/quick3daxis_p.h
index 2a626b6e7..400bd5ea0 100644
--- a/src/quick3d/quick3dinput/items/quick3daxis_p.h
+++ b/src/quick3d/quick3dinput/items/quick3daxis_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@
#include <Qt3DQuickInput/private/qt3dquickinput_global_p.h>
#include <Qt3DInput/QAxis>
-#include <Qt3DInput/QAxisInput>
+#include <Qt3DInput/QAbstractAxisInput>
#include <QQmlListProperty>
QT_BEGIN_NAMESPACE
@@ -62,18 +65,19 @@ namespace Quick {
class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DAxis : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DInput::QAxisInput> inputs READ qmlAxisInputs CONSTANT)
+ Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractAxisInput> inputs READ qmlAxisInputs CONSTANT)
+ Q_CLASSINFO("DefaultProperty", "inputs")
public:
- explicit Quick3DAxis(QObject *parent = Q_NULLPTR);
+ explicit Quick3DAxis(QObject *parent = nullptr);
inline QAxis *parentAxis() const { return qobject_cast<QAxis *>(parent()); }
- QQmlListProperty<QAxisInput> qmlAxisInputs();
+ QQmlListProperty<QAbstractAxisInput> qmlAxisInputs();
private:
- static void appendAxisInput(QQmlListProperty<QAxisInput> *list, QAxisInput *input);
- static QAxisInput *axisInputAt(QQmlListProperty<QAxisInput> *list, int index);
- static int axesInputCount(QQmlListProperty<QAxisInput> *list);
- static void clearAxisInputs(QQmlListProperty<QAxisInput> *list);
+ static void appendAxisInput(QQmlListProperty<QAbstractAxisInput> *list, QAbstractAxisInput *input);
+ static QAbstractAxisInput *axisInputAt(QQmlListProperty<QAbstractAxisInput> *list, int index);
+ static int axesInputCount(QQmlListProperty<QAbstractAxisInput> *list);
+ static void clearAxisInputs(QQmlListProperty<QAbstractAxisInput> *list);
};
} // namespace Quick
diff --git a/src/quick3d/quick3dinput/items/quick3dinputchord.cpp b/src/quick3d/quick3dinput/items/quick3dinputchord.cpp
new file mode 100644
index 000000000..0d214a5ec
--- /dev/null
+++ b/src/quick3d/quick3dinput/items/quick3dinputchord.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quick3dinputchord_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+namespace Quick {
+
+Quick3DInputChord::Quick3DInputChord(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQmlListProperty<QAbstractActionInput> Quick3DInputChord::qmlActionInputs()
+{
+ return QQmlListProperty<QAbstractActionInput>(this, 0,
+ &Quick3DInputChord::appendActionInput,
+ &Quick3DInputChord::actionInputCount,
+ &Quick3DInputChord::actionInputAt,
+ &Quick3DInputChord::clearActionInputs);
+}
+
+void Quick3DInputChord::appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input)
+{
+ Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(list->object);
+ action->parentChord()->addChord(input);
+}
+
+QAbstractActionInput *Quick3DInputChord::actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index)
+{
+ Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(list->object);
+ return action->parentChord()->chords().at(index);
+}
+
+int Quick3DInputChord::actionInputCount(QQmlListProperty<QAbstractActionInput> *list)
+{
+ Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(list->object);
+ return action->parentChord()->chords().count();
+}
+
+void Quick3DInputChord::clearActionInputs(QQmlListProperty<QAbstractActionInput> *list)
+{
+ Quick3DInputChord *action = qobject_cast<Quick3DInputChord *>(list->object);
+ const auto chords = action->parentChord()->chords();
+ for (QAbstractActionInput *input : chords)
+ action->parentChord()->removeChord(input);
+}
+
+} // namespace Quick
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3dinput/items/quick3dinputchord_p.h b/src/quick3d/quick3dinput/items/quick3dinputchord_p.h
new file mode 100644
index 000000000..d9759b856
--- /dev/null
+++ b/src/quick3d/quick3dinput/items/quick3dinputchord_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_QUICK_QUICK3DINPUTCHORD_H
+#define QT3DINPUT_INPUT_QUICK_QUICK3DINPUTCHORD_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DQuickInput/private/qt3dquickinput_global_p.h>
+#include <Qt3DInput/qinputchord.h>
+#include <QQmlListProperty>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+namespace Quick {
+
+class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DInputChord : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> chords READ qmlActionInputs CONSTANT)
+public:
+ explicit Quick3DInputChord(QObject *parent = nullptr);
+
+ inline QInputChord *parentChord() const { return qobject_cast<QInputChord *>(parent()); }
+ QQmlListProperty<QAbstractActionInput> qmlActionInputs();
+
+private:
+ static void appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input);
+ static QAbstractActionInput *actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index);
+ static int actionInputCount(QQmlListProperty<QAbstractActionInput> *list);
+ static void clearActionInputs(QQmlListProperty<QAbstractActionInput> *list);
+};
+
+} // namespace Quick
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+
+#endif // QT3DINPUT_INPUT_QUICK_QUICK3DINPUTCHORD_H
diff --git a/src/quick3d/quick3dinput/items/quick3dinputsequence.cpp b/src/quick3d/quick3dinput/items/quick3dinputsequence.cpp
new file mode 100644
index 000000000..02539443e
--- /dev/null
+++ b/src/quick3d/quick3dinput/items/quick3dinputsequence.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quick3dinputsequence_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+namespace Quick {
+
+Quick3DInputSequence::Quick3DInputSequence(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQmlListProperty<QAbstractActionInput> Quick3DInputSequence::qmlActionInputs()
+{
+ return QQmlListProperty<QAbstractActionInput>(this, 0,
+ &Quick3DInputSequence::appendActionInput,
+ &Quick3DInputSequence::actionInputCount,
+ &Quick3DInputSequence::actionInputAt,
+ &Quick3DInputSequence::clearActionInputs);
+}
+
+void Quick3DInputSequence::appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input)
+{
+ Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(list->object);
+ action->parentSequence()->addSequence(input);
+}
+
+QAbstractActionInput *Quick3DInputSequence::actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index)
+{
+ Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(list->object);
+ return action->parentSequence()->sequences().at(index);
+}
+
+int Quick3DInputSequence::actionInputCount(QQmlListProperty<QAbstractActionInput> *list)
+{
+ Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(list->object);
+ return action->parentSequence()->sequences().count();
+}
+
+void Quick3DInputSequence::clearActionInputs(QQmlListProperty<QAbstractActionInput> *list)
+{
+ Quick3DInputSequence *action = qobject_cast<Quick3DInputSequence *>(list->object);
+ const auto sequences = action->parentSequence()->sequences();
+ for (QAbstractActionInput *input : sequences)
+ action->parentSequence()->removeSequence(input);
+}
+
+
+} // namespace Quick
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h b/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h
new file mode 100644
index 000000000..ccf872675
--- /dev/null
+++ b/src/quick3d/quick3dinput/items/quick3dinputsequence_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DINPUT_INPUT_QUICK_QUICK3DINPUTSEQUENCE_H
+#define QT3DINPUT_INPUT_QUICK_QUICK3DINPUTSEQUENCE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DQuickInput/private/qt3dquickinput_global_p.h>
+#include <Qt3DInput/qinputsequence.h>
+#include <QQmlListProperty>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DInput {
+namespace Input {
+namespace Quick {
+
+class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DInputSequence : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3DInput::QAbstractActionInput> sequences READ qmlActionInputs CONSTANT)
+public:
+ explicit Quick3DInputSequence(QObject *parent = nullptr);
+
+ inline QInputSequence *parentSequence() const { return qobject_cast<QInputSequence *>(parent()); }
+ QQmlListProperty<QAbstractActionInput> qmlActionInputs();
+
+private:
+ static void appendActionInput(QQmlListProperty<QAbstractActionInput> *list, QAbstractActionInput *input);
+ static QAbstractActionInput *actionInputAt(QQmlListProperty<QAbstractActionInput> *list, int index);
+ static int actionInputCount(QQmlListProperty<QAbstractActionInput> *list);
+ static void clearActionInputs(QQmlListProperty<QAbstractActionInput> *list);
+};
+
+} // namespace Quick
+} // namespace Input
+} // namespace Qt3DInput
+
+QT_END_NAMESPACE
+
+
+#endif // QT3DINPUT_INPUT_QUICK_QUICK3DINPUTSEQUENCE_H
diff --git a/src/quick3d/quick3dinput/items/quick3dlogicaldevice.cpp b/src/quick3d/quick3dinput/items/quick3dlogicaldevice.cpp
index 0b41cd723..72be7e7ac 100644
--- a/src/quick3d/quick3dinput/items/quick3dlogicaldevice.cpp
+++ b/src/quick3d/quick3dinput/items/quick3dlogicaldevice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -86,7 +89,8 @@ int Quick3DLogicalDevice::axesCount(QQmlListProperty<QAxis> *list)
void Quick3DLogicalDevice::clearAxes(QQmlListProperty<QAxis> *list)
{
Quick3DLogicalDevice *device = qobject_cast<Quick3DLogicalDevice *>(list->object);
- Q_FOREACH (QAxis *axis, device->parentLogicalDevice()->axes())
+ const auto axes = device->parentLogicalDevice()->axes();
+ for (QAxis *axis : axes)
device->parentLogicalDevice()->removeAxis(axis);
}
@@ -111,7 +115,8 @@ int Quick3DLogicalDevice::actionCount(QQmlListProperty<QAction> *list)
void Quick3DLogicalDevice::clearActions(QQmlListProperty<QAction> *list)
{
Quick3DLogicalDevice *device = qobject_cast<Quick3DLogicalDevice *>(list->object);
- Q_FOREACH (QAction *action, device->parentLogicalDevice()->actions())
+ const auto actions = device->parentLogicalDevice()->actions();
+ for (QAction *action : actions)
device->parentLogicalDevice()->removeAction(action);
}
diff --git a/src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h b/src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h
index 8d6645030..5b3b36039 100644
--- a/src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h
+++ b/src/quick3d/quick3dinput/items/quick3dlogicaldevice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -66,7 +69,7 @@ class QT3DQUICKINPUTSHARED_PRIVATE_EXPORT Quick3DLogicalDevice : public QObject
Q_PROPERTY(QQmlListProperty<Qt3DInput::QAxis> axes READ qmlAxes CONSTANT)
Q_PROPERTY(QQmlListProperty<Qt3DInput::QAction> actions READ qmlActions CONSTANT)
public:
- explicit Quick3DLogicalDevice(QObject *parent = Q_NULLPTR);
+ explicit Quick3DLogicalDevice(QObject *parent = nullptr);
inline QLogicalDevice *parentLogicalDevice() const { return qobject_cast<QLogicalDevice *>(parent()); }
QQmlListProperty<QAxis> qmlAxes();
diff --git a/src/quick3d/quick3dinput/items/quick3dphysicaldevice.cpp b/src/quick3d/quick3dinput/items/quick3dphysicaldevice.cpp
index 7487ff7c4..ead311135 100644
--- a/src/quick3d/quick3dinput/items/quick3dphysicaldevice.cpp
+++ b/src/quick3d/quick3dinput/items/quick3dphysicaldevice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -77,7 +80,8 @@ int Quick3DPhysicalDevice::axisSettingsCount(QQmlListProperty<QAxisSetting> *lis
void Quick3DPhysicalDevice::clearAxisSettings(QQmlListProperty<QAxisSetting> *list)
{
Quick3DPhysicalDevice *device = qobject_cast<Quick3DPhysicalDevice *>(list->object);
- Q_FOREACH (QAxisSetting *axisSetting, device->parentPhysicalDevice()->axisSettings())
+ const auto axisSettings = device->parentPhysicalDevice()->axisSettings();
+ for (QAxisSetting *axisSetting : axisSettings)
device->parentPhysicalDevice()->removeAxisSetting(axisSetting);
}
diff --git a/src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h b/src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h
index e6a965e3a..9a97d152c 100644
--- a/src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h
+++ b/src/quick3d/quick3dinput/items/quick3dphysicaldevice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3dinput/qt3dquickinput_global.cpp b/src/quick3d/quick3dinput/qt3dquickinput_global.cpp
index e41dcdb4d..dd84f9fa4 100644
--- a/src/quick3d/quick3dinput/qt3dquickinput_global.cpp
+++ b/src/quick3d/quick3dinput/qt3dquickinput_global.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3dinput/qt3dquickinput_global.h b/src/quick3d/quick3dinput/qt3dquickinput_global.h
index 599826c8b..d34667dc3 100644
--- a/src/quick3d/quick3dinput/qt3dquickinput_global.h
+++ b/src/quick3d/quick3dinput/qt3dquickinput_global.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DQUICKINPUT_GLOBAL_H
#define QT3DQUICKINPUT_GLOBAL_H
-#include <QtCore/qglobal.h>
+#include <Qt3DCore/qt3dcore_global.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quick3d/quick3dinput/qt3dquickinput_global_p.h b/src/quick3d/quick3dinput/qt3dquickinput_global_p.h
index 2f5383d32..a5d9adcec 100644
--- a/src/quick3d/quick3dinput/qt3dquickinput_global_p.h
+++ b/src/quick3d/quick3dinput/qt3dquickinput_global_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp b/src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp
index c55e1ef15..8f9fe81ec 100644
--- a/src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp
+++ b/src/quick3d/quick3dinput/qt3dquickinputnodefactory.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -56,7 +59,7 @@ void QuickInputNodeFactory::registerType(const char *className, const char *quic
Qt3DCore::QNode *QuickInputNodeFactory::createNode(const char *type)
{
if (!m_types.contains(type))
- return Q_NULLPTR;
+ return nullptr;
Type &typeInfo(m_types[type]);
@@ -65,7 +68,7 @@ Qt3DCore::QNode *QuickInputNodeFactory::createNode(const char *type)
typeInfo.t = QQmlMetaType::qmlType(QString::fromLatin1(typeInfo.quickName), typeInfo.version.first, typeInfo.version.second);
}
- return typeInfo.t ? qobject_cast<Qt3DCore::QNode *>(typeInfo.t->create()) : Q_NULLPTR;
+ return typeInfo.t ? qobject_cast<Qt3DCore::QNode *>(typeInfo.t->create()) : nullptr;
}
} // namespace Qt3DInput
diff --git a/src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h b/src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h
index fff8cd752..3473cf038 100644
--- a/src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h
+++ b/src/quick3d/quick3dinput/qt3dquickinputnodefactory_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qabstractnodefactory.h>
+#include <Qt3DCore/private/qabstractnodefactory_p.h>
#include <QtCore/qhash.h>
QT_BEGIN_NAMESPACE
@@ -68,9 +71,9 @@ public:
private:
struct Type {
- Type() : t(Q_NULLPTR), resolved(false) { }
+ Type() : t(nullptr), resolved(false) { }
Type(const char *quickName, int major, int minor)
- : quickName(quickName), version(major, minor), t(Q_NULLPTR), resolved(false) { }
+ : quickName(quickName), version(major, minor), t(nullptr), resolved(false) { }
QByteArray quickName;
QPair<int, int> version;
QQmlType *t;
diff --git a/src/quick3d/quick3dinput/quick3dinput.pro b/src/quick3d/quick3dinput/quick3dinput.pro
index 59339449e..3aa0dedcf 100644
--- a/src/quick3d/quick3dinput/quick3dinput.pro
+++ b/src/quick3d/quick3dinput/quick3dinput.pro
@@ -4,6 +4,9 @@ MODULE = 3dquickinput
QT += core core-private qml qml-private 3dcore 3dinput 3dquick 3dquick-private 3dcore-private 3dinput-private
CONFIG -= precompile_header
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
gcov {
CONFIG += static
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
diff --git a/src/quick3d/quick3drender/items/items.pri b/src/quick3d/quick3drender/items/items.pri
index 99ffbc801..82fbdebc0 100644
--- a/src/quick3d/quick3drender/items/items.pri
+++ b/src/quick3d/quick3drender/items/items.pri
@@ -3,40 +3,40 @@ HEADERS += \
$$PWD/quick3dbuffer_p.h \
$$PWD/quick3deffect_p.h \
$$PWD/quick3dgeometry_p.h \
+ $$PWD/quick3dlayerfilter_p.h \
$$PWD/quick3dmaterial_p.h \
$$PWD/quick3drenderpass_p.h \
$$PWD/quick3drenderpassfilter_p.h \
- $$PWD/quick3drendertarget_p.h \
$$PWD/quick3drendertargetselector_p.h \
$$PWD/quick3dscene_p.h \
$$PWD/quick3dshaderdata_p.h \
$$PWD/quick3dshaderdataarray_p.h \
- $$PWD/quick3dsortmethod_p.h \
$$PWD/quick3dstateset_p.h \
$$PWD/quick3dtechnique_p.h \
$$PWD/quick3dtexture_p.h \
$$PWD/quick3dviewport_p.h \
$$PWD/quick3dparameter_p_p.h \
- $$PWD/quick3dparameter_p.h
+ $$PWD/quick3dparameter_p.h \
+ $$PWD/quick3drendertargetoutput_p.h
SOURCES += \
$$PWD/quick3drenderpassfilter.cpp \
- $$PWD/quick3drendertarget.cpp \
$$PWD/quick3dtechniquefilter.cpp \
$$PWD/quick3dviewport.cpp \
+ $$PWD/quick3dlayerfilter.cpp \
$$PWD/quick3dmaterial.cpp \
$$PWD/quick3dtechnique.cpp \
$$PWD/quick3deffect.cpp \
$$PWD/quick3dscene.cpp \
$$PWD/quick3dtexture.cpp \
$$PWD/quick3drenderpass.cpp \
- $$PWD/quick3dsortmethod.cpp \
$$PWD/quick3dparameter.cpp \
$$PWD/quick3dshaderdata.cpp \
$$PWD/quick3dshaderdataarray.cpp \
$$PWD/quick3dstateset.cpp \
$$PWD/quick3drendertargetselector.cpp \
$$PWD/quick3dgeometry.cpp \
- $$PWD/quick3dbuffer.cpp
+ $$PWD/quick3dbuffer.cpp \
+ $$PWD/quick3drendertargetoutput.cpp
INCLUDEPATH += $$PWD
diff --git a/src/quick3d/quick3drender/items/quick3dbuffer.cpp b/src/quick3d/quick3drender/items/quick3dbuffer.cpp
index 70753d6ab..e2a40da78 100644
--- a/src/quick3d/quick3drender/items/quick3dbuffer.cpp
+++ b/src/quick3d/quick3drender/items/quick3dbuffer.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,10 +55,10 @@ namespace Quick {
Quick3DBuffer::Quick3DBuffer(QObject *parent)
: QObject(parent)
- , m_engine(Q_NULLPTR)
- , m_v4engine(Q_NULLPTR)
+ , m_engine(nullptr)
+ , m_v4engine(nullptr)
{
- QObject::connect(parentBuffer(), &Qt3DRender::QAbstractBuffer::dataChanged, this, &Quick3DBuffer::bufferDataChanged);
+ QObject::connect(parentBuffer(), &Qt3DRender::QBuffer::dataChanged, this, &Quick3DBuffer::bufferDataChanged);
}
QByteArray Quick3DBuffer::convertToRawData(const QJSValue &jsValue)
@@ -87,7 +90,7 @@ void Quick3DBuffer::setBufferData(const QVariant &bufferData)
void Quick3DBuffer::initEngines()
{
- if (m_engine == Q_NULLPTR) {
+ if (m_engine == nullptr) {
m_engine = qmlEngine(parent());
m_v4engine = QQmlEnginePrivate::getV4Engine(m_engine);
}
diff --git a/src/quick3d/quick3drender/items/quick3dbuffer_p.h b/src/quick3d/quick3drender/items/quick3dbuffer_p.h
index d2933ddc9..512e6936c 100644
--- a/src/quick3d/quick3drender/items/quick3dbuffer_p.h
+++ b/src/quick3d/quick3drender/items/quick3dbuffer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -71,7 +74,7 @@ class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DBuffer : public QObject
Q_OBJECT
Q_PROPERTY(QVariant data READ bufferData WRITE setBufferData NOTIFY bufferDataChanged)
public:
- explicit Quick3DBuffer(QObject *parent = Q_NULLPTR);
+ explicit Quick3DBuffer(QObject *parent = nullptr);
inline QBuffer *parentBuffer() const { return qobject_cast<QBuffer *>(parent()); }
QVariant bufferData() const;
diff --git a/src/quick3d/quick3drender/items/quick3deffect.cpp b/src/quick3d/quick3drender/items/quick3deffect.cpp
index 885cb4112..9d4ce934a 100644
--- a/src/quick3d/quick3drender/items/quick3deffect.cpp
+++ b/src/quick3d/quick3drender/items/quick3deffect.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -79,7 +82,7 @@ QTechnique *Quick3DEffect::techniqueAt(QQmlListProperty<QTechnique> *list, int i
Quick3DEffect *eff = qobject_cast<Quick3DEffect*>(list->object);
if (eff)
return qobject_cast<QTechnique*>(eff->parentEffect()->techniques().at(index));
- return Q_NULLPTR;
+ return nullptr;
}
int Quick3DEffect::techniqueCount(QQmlListProperty<QTechnique> *list)
@@ -96,7 +99,8 @@ void Quick3DEffect::clearTechniqueList(QQmlListProperty<QTechnique> *list)
if (eff) {
// Ownership of techniques is handled by the QmlEngine so we shouldn't class clearTechniques
// which deletes techniques
- Q_FOREACH (QTechnique *tech, eff->parentEffect()->techniques())
+ const auto techniques = eff->parentEffect()->techniques();
+ for (QTechnique *tech : techniques)
eff->parentEffect()->removeTechnique(tech);
}
}
@@ -122,7 +126,8 @@ int Quick3DEffect::parametersCount(QQmlListProperty<QParameter> *list)
void Quick3DEffect::clearParameterList(QQmlListProperty<QParameter> *list)
{
Quick3DEffect *effect = qobject_cast<Quick3DEffect *>(list->object);
- Q_FOREACH (QParameter *p, qobject_cast<QEffect *>(effect->parentEffect())->parameters())
+ const auto parameters = qobject_cast<QEffect *>(effect->parentEffect())->parameters();
+ for (QParameter *p : parameters)
qobject_cast<QEffect *>(effect->parentEffect())->removeParameter(p);
}
diff --git a/src/quick3d/quick3drender/items/quick3deffect_p.h b/src/quick3d/quick3drender/items/quick3deffect_p.h
index 51d9428c3..50152e2af 100644
--- a/src/quick3d/quick3drender/items/quick3deffect_p.h
+++ b/src/quick3d/quick3drender/items/quick3deffect_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/items/quick3dgeometry.cpp b/src/quick3d/quick3drender/items/quick3dgeometry.cpp
index 5b7e35722..84c02d7c9 100644
--- a/src/quick3d/quick3drender/items/quick3dgeometry.cpp
+++ b/src/quick3d/quick3drender/items/quick3dgeometry.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,41 +50,40 @@ Quick3DGeometry::Quick3DGeometry(QObject *parent)
{
}
-QQmlListProperty<Qt3DRender::QAbstractAttribute> Quick3DGeometry::attributeList()
+QQmlListProperty<Qt3DRender::QAttribute> Quick3DGeometry::attributeList()
{
- return QQmlListProperty<Qt3DRender::QAbstractAttribute>(this, 0,
+ return QQmlListProperty<Qt3DRender::QAttribute>(this, 0,
&Quick3DGeometry::appendAttribute,
&Quick3DGeometry::attributesCount,
&Quick3DGeometry::attributeAt,
&Quick3DGeometry::clearAttributes);
}
-void Quick3DGeometry::appendAttribute(QQmlListProperty<Qt3DRender::QAbstractAttribute> *list, Qt3DRender::QAbstractAttribute *attribute)
+void Quick3DGeometry::appendAttribute(QQmlListProperty<Qt3DRender::QAttribute> *list, Qt3DRender::QAttribute *attribute)
{
Quick3DGeometry *geometry = static_cast<Quick3DGeometry *>(list->object);
geometry->m_managedAttributes.append(attribute);
geometry->parentGeometry()->addAttribute(attribute);
}
-Qt3DRender::QAbstractAttribute *Quick3DGeometry::attributeAt(QQmlListProperty<Qt3DRender::QAbstractAttribute> *list, int index)
+Qt3DRender::QAttribute *Quick3DGeometry::attributeAt(QQmlListProperty<Qt3DRender::QAttribute> *list, int index)
{
Quick3DGeometry *geometry = static_cast<Quick3DGeometry *>(list->object);
return geometry->parentGeometry()->attributes().at(index);
}
-int Quick3DGeometry::attributesCount(QQmlListProperty<Qt3DRender::QAbstractAttribute> *list)
+int Quick3DGeometry::attributesCount(QQmlListProperty<Qt3DRender::QAttribute> *list)
{
Quick3DGeometry *geometry = static_cast<Quick3DGeometry *>(list->object);
return geometry->parentGeometry()->attributes().count();
}
-void Quick3DGeometry::clearAttributes(QQmlListProperty<Qt3DRender::QAbstractAttribute> *list)
+void Quick3DGeometry::clearAttributes(QQmlListProperty<Qt3DRender::QAttribute> *list)
{
Quick3DGeometry *geometry = static_cast<Quick3DGeometry *>(list->object);
- QVector<Qt3DRender::QAbstractAttribute *> &managedAttributes = geometry->m_managedAttributes;
- Q_FOREACH (Qt3DRender::QAbstractAttribute *attribute, managedAttributes)
+ for (Qt3DRender::QAttribute *attribute : qAsConst(geometry->m_managedAttributes))
geometry->parentGeometry()->removeAttribute(attribute);
- managedAttributes.clear();
+ geometry->m_managedAttributes.clear();
}
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dgeometry_p.h b/src/quick3d/quick3drender/items/quick3dgeometry_p.h
index 2983fe03e..4c020b0e2 100644
--- a/src/quick3d/quick3drender/items/quick3dgeometry_p.h
+++ b/src/quick3d/quick3drender/items/quick3dgeometry_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,22 +64,22 @@ namespace Quick {
class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DGeometry : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DRender::QAbstractAttribute> attributes READ attributeList)
+ Q_PROPERTY(QQmlListProperty<Qt3DRender::QAttribute> attributes READ attributeList)
Q_CLASSINFO("DefaultProperty", "attributes")
public:
explicit Quick3DGeometry(QObject *parent = 0);
inline QGeometry *parentGeometry() const { return qobject_cast<QGeometry *>(parent()); }
- QQmlListProperty<Qt3DRender::QAbstractAttribute> attributeList();
+ QQmlListProperty<Qt3DRender::QAttribute> attributeList();
private:
- static void appendAttribute(QQmlListProperty<Qt3DRender::QAbstractAttribute> *list, Qt3DRender::QAbstractAttribute *provider);
- static Qt3DRender::QAbstractAttribute *attributeAt(QQmlListProperty<Qt3DRender::QAbstractAttribute> *list, int index);
- static int attributesCount(QQmlListProperty<Qt3DRender::QAbstractAttribute> *list);
- static void clearAttributes(QQmlListProperty<Qt3DRender::QAbstractAttribute> *list);
+ static void appendAttribute(QQmlListProperty<Qt3DRender::QAttribute> *list, Qt3DRender::QAttribute *provider);
+ static Qt3DRender::QAttribute *attributeAt(QQmlListProperty<Qt3DRender::QAttribute> *list, int index);
+ static int attributesCount(QQmlListProperty<Qt3DRender::QAttribute> *list);
+ static void clearAttributes(QQmlListProperty<Qt3DRender::QAttribute> *list);
- QVector<Qt3DRender::QAbstractAttribute *> m_managedAttributes;
+ QVector<Qt3DRender::QAttribute *> m_managedAttributes;
};
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dlayerfilter.cpp b/src/quick3d/quick3drender/items/quick3dlayerfilter.cpp
new file mode 100644
index 000000000..6f7efcd23
--- /dev/null
+++ b/src/quick3d/quick3drender/items/quick3dlayerfilter.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quick3dlayerfilter_p.h"
+#include <Qt3DRender/qtexture.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+namespace Quick {
+
+Quick3DLayerFilter::Quick3DLayerFilter(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQmlListProperty<QLayer> Quick3DLayerFilter::qmlLayers()
+{
+ return QQmlListProperty<QLayer>(this, 0,
+ &Quick3DLayerFilter::appendLayer,
+ &Quick3DLayerFilter::layerCount,
+ &Quick3DLayerFilter::layerAt,
+ &Quick3DLayerFilter::clearLayers);
+}
+
+void Quick3DLayerFilter::appendLayer(QQmlListProperty<QLayer> *list, QLayer *layer)
+{
+ Quick3DLayerFilter *filter = qobject_cast<Quick3DLayerFilter *>(list->object);
+ if (filter) {
+ filter->parentFilter()->addLayer(layer);
+ }
+}
+
+QLayer *Quick3DLayerFilter::layerAt(QQmlListProperty<QLayer> *list, int index)
+{
+ Quick3DLayerFilter *filter = qobject_cast<Quick3DLayerFilter *>(list->object);
+ if (filter) {
+ return filter->parentFilter()->layers().at(index);
+ }
+ return 0;
+}
+
+int Quick3DLayerFilter::layerCount(QQmlListProperty<QLayer> *list)
+{
+ Quick3DLayerFilter *filter = qobject_cast<Quick3DLayerFilter *>(list->object);
+ if (filter) {
+ return filter->parentFilter()->layers().count();
+ }
+ return 0;
+}
+
+void Quick3DLayerFilter::clearLayers(QQmlListProperty<QLayer> *list)
+{
+ Quick3DLayerFilter *filter = qobject_cast<Quick3DLayerFilter *>(list->object);
+ if (filter) {
+ const auto layers = filter->parentFilter()->layers();
+ for (QLayer *layer : layers)
+ filter->parentFilter()->removeLayer(layer);
+ }
+}
+
+} // Quick
+
+} // namespace Render
+
+} // Qt3D
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3drender/items/quick3dlayerfilter_p.h b/src/quick3d/quick3drender/items/quick3dlayerfilter_p.h
new file mode 100644
index 000000000..b2e7e2d11
--- /dev/null
+++ b/src/quick3d/quick3drender/items/quick3dlayerfilter_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_QUICK_QUICK3DLAYERFILTER_P_H
+#define QT3DRENDER_RENDER_QUICK_QUICK3DLAYERFILTER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
+#include <Qt3DRender/qlayerfilter.h>
+#include <Qt3DRender/qlayer.h>
+#include <QQmlListProperty>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+namespace Quick {
+
+class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DLayerFilter : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3DRender::QLayer> layers READ qmlLayers)
+
+public:
+ explicit Quick3DLayerFilter(QObject *parent = 0);
+
+ inline QLayerFilter *parentFilter() const { return qobject_cast<QLayerFilter*>(parent()); }
+
+ QQmlListProperty<QLayer> qmlLayers();
+
+private:
+ static void appendLayer(QQmlListProperty<QLayer> *list, QLayer *bar);
+ static QLayer *layerAt(QQmlListProperty<QLayer> *list, int index);
+ static int layerCount(QQmlListProperty<QLayer> *list);
+ static void clearLayers(QQmlListProperty<QLayer> *list);
+};
+
+} // namespace Quick
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_QUICK_QUICK3DLAYERFILTER_P_H
diff --git a/src/quick3d/quick3drender/items/quick3dmaterial.cpp b/src/quick3d/quick3drender/items/quick3dmaterial.cpp
index 672a203f6..50b064bc2 100644
--- a/src/quick3d/quick3drender/items/quick3dmaterial.cpp
+++ b/src/quick3d/quick3drender/items/quick3dmaterial.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -88,9 +91,9 @@ void Quick3DMaterial::clearParameters(QQmlListProperty<QParameter> *list)
{
Quick3DMaterial *mat = qobject_cast<Quick3DMaterial *>(list->object);
if (mat) {
- Q_FOREACH (QParameter *p, mat->parentMaterial()->parameters()) {
+ const auto parameters = mat->parentMaterial()->parameters();
+ for (QParameter *p : parameters)
mat->parentMaterial()->removeParameter(p);
- }
}
}
diff --git a/src/quick3d/quick3drender/items/quick3dmaterial_p.h b/src/quick3d/quick3drender/items/quick3dmaterial_p.h
index 691ff276e..48b60df62 100644
--- a/src/quick3d/quick3drender/items/quick3dmaterial_p.h
+++ b/src/quick3d/quick3drender/items/quick3dmaterial_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/items/quick3dparameter.cpp b/src/quick3d/quick3drender/items/quick3dparameter.cpp
index 9f2dfb59b..22b6bba96 100644
--- a/src/quick3d/quick3drender/items/quick3dparameter.cpp
+++ b/src/quick3d/quick3drender/items/quick3dparameter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/items/quick3dparameter_p.h b/src/quick3d/quick3drender/items/quick3dparameter_p.h
index 6e3cfe61d..60493973d 100644
--- a/src/quick3d/quick3drender/items/quick3dparameter_p.h
+++ b/src/quick3d/quick3drender/items/quick3dparameter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -70,7 +73,6 @@ private:
protected:
Quick3DParameter(Quick3DParameterPrivate &dd, QNode *parent = 0);
- QT3D_CLONEABLE(Quick3DParameter)
};
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dparameter_p_p.h b/src/quick3d/quick3drender/items/quick3dparameter_p_p.h
index 429608024..0432642f3 100644
--- a/src/quick3d/quick3drender/items/quick3dparameter_p_p.h
+++ b/src/quick3d/quick3drender/items/quick3dparameter_p_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/items/quick3drenderpass.cpp b/src/quick3d/quick3drender/items/quick3drenderpass.cpp
index b1524dcbf..d5f16fab6 100644
--- a/src/quick3d/quick3drender/items/quick3drenderpass.cpp
+++ b/src/quick3d/quick3drender/items/quick3drenderpass.cpp
@@ -1,42 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "quick3drenderpass_p.h"
-#include <Qt3DRender/qparametermapping.h>
QT_BEGIN_NAMESPACE
@@ -49,22 +51,13 @@ Quick3DRenderPass::Quick3DRenderPass(QObject *parent)
{
}
-QQmlListProperty<QAnnotation> Quick3DRenderPass::annotationList()
+QQmlListProperty<QFilterKey> Quick3DRenderPass::filterKeyList()
{
- return QQmlListProperty<QAnnotation>(this, 0,
- &Quick3DRenderPass::appendAnnotation,
- &Quick3DRenderPass::annotationsCount,
- &Quick3DRenderPass::annotationAt,
- &Quick3DRenderPass::clearAnnotations);
-}
-
-QQmlListProperty<QParameterMapping> Quick3DRenderPass::bindingList()
-{
- return QQmlListProperty<QParameterMapping>(this, 0,
- &Quick3DRenderPass::appendBinding,
- &Quick3DRenderPass::bindingsCount,
- &Quick3DRenderPass::bindingAt,
- &Quick3DRenderPass::clearBindings);
+ return QQmlListProperty<QFilterKey>(this, 0,
+ &Quick3DRenderPass::appendFilterKey,
+ &Quick3DRenderPass::filterKeysCount,
+ &Quick3DRenderPass::filterKeyAt,
+ &Quick3DRenderPass::clearFilterKey);
}
QQmlListProperty<QRenderState> Quick3DRenderPass::renderStateList()
@@ -85,54 +78,30 @@ QQmlListProperty<QParameter> Quick3DRenderPass::parameterList()
&Quick3DRenderPass::clearParameterList);
}
-void Quick3DRenderPass::appendAnnotation(QQmlListProperty<QAnnotation> *list, QAnnotation *annotation)
-{
- Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- rPass->parentRenderPass()->addAnnotation(annotation);
-}
-
-QAnnotation *Quick3DRenderPass::annotationAt(QQmlListProperty<QAnnotation> *list, int index)
-{
- Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- return rPass->parentRenderPass()->annotations().at(index);
-}
-
-int Quick3DRenderPass::annotationsCount(QQmlListProperty<QAnnotation> *list)
-{
- Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- return rPass->parentRenderPass()->annotations().count();
-}
-
-void Quick3DRenderPass::clearAnnotations(QQmlListProperty<QAnnotation> *list)
-{
- Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- Q_FOREACH (QAnnotation *c, rPass->parentRenderPass()->annotations())
- rPass->parentRenderPass()->removeAnnotation(c);
-}
-
-void Quick3DRenderPass::appendBinding(QQmlListProperty<QParameterMapping> *list, QParameterMapping *binding)
+void Quick3DRenderPass::appendFilterKey(QQmlListProperty<QFilterKey> *list, QFilterKey *filterKey)
{
Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- rPass->parentRenderPass()->addBinding(binding);
+ rPass->parentRenderPass()->addFilterKey(filterKey);
}
-QParameterMapping *Quick3DRenderPass::bindingAt(QQmlListProperty<QParameterMapping> *list, int index)
+QFilterKey *Quick3DRenderPass::filterKeyAt(QQmlListProperty<QFilterKey> *list, int index)
{
Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- return rPass->parentRenderPass()->bindings().at(index);
+ return rPass->parentRenderPass()->filterKeys().at(index);
}
-int Quick3DRenderPass::bindingsCount(QQmlListProperty<QParameterMapping> *list)
+int Quick3DRenderPass::filterKeysCount(QQmlListProperty<QFilterKey> *list)
{
Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- return rPass->parentRenderPass()->bindings().count();
+ return rPass->parentRenderPass()->filterKeys().count();
}
-void Quick3DRenderPass::clearBindings(QQmlListProperty<QParameterMapping> *list)
+void Quick3DRenderPass::clearFilterKey(QQmlListProperty<QFilterKey> *list)
{
Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- Q_FOREACH (QParameterMapping *binding, rPass->parentRenderPass()->bindings())
- rPass->parentRenderPass()->removeBinding(binding);
+ const auto keys = rPass->parentRenderPass()->filterKeys();
+ for (QFilterKey *c : keys)
+ rPass->parentRenderPass()->removeFilterKey(c);
}
void Quick3DRenderPass::appendRenderState(QQmlListProperty<QRenderState> *list, QRenderState *state)
@@ -156,7 +125,8 @@ int Quick3DRenderPass::renderStateCount(QQmlListProperty<QRenderState> *list)
void Quick3DRenderPass::clearRenderStates(QQmlListProperty<QRenderState> *list)
{
Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- Q_FOREACH (QRenderState *s, rPass->parentRenderPass()->renderStates())
+ const auto states = rPass->parentRenderPass()->renderStates();
+ for (QRenderState *s : states)
rPass->parentRenderPass()->removeRenderState(s);
}
@@ -181,7 +151,8 @@ int Quick3DRenderPass::parametersCount(QQmlListProperty<QParameter> *list)
void Quick3DRenderPass::clearParameterList(QQmlListProperty<QParameter> *list)
{
Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object);
- Q_FOREACH (QParameter *p, rPass->parentRenderPass()->parameters())
+ const auto parameters = rPass->parentRenderPass()->parameters();
+ for (QParameter *p : parameters)
rPass->parentRenderPass()->removeParameter(p);
}
diff --git a/src/quick3d/quick3drender/items/quick3drenderpass_p.h b/src/quick3d/quick3drender/items/quick3drenderpass_p.h
index 536bd6b4a..6ac940e23 100644
--- a/src/quick3d/quick3drender/items/quick3drenderpass_p.h
+++ b/src/quick3d/quick3drender/items/quick3drenderpass_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,30 +65,23 @@ namespace Quick {
class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderPass : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DRender::QAnnotation> annotations READ annotationList)
- Q_PROPERTY(QQmlListProperty<Qt3DRender::QParameterMapping> bindings READ bindingList)
+ Q_PROPERTY(QQmlListProperty<Qt3DRender::QFilterKey> filterKeys READ filterKeyList)
Q_PROPERTY(QQmlListProperty<Qt3DRender::QRenderState> renderStates READ renderStateList)
Q_PROPERTY(QQmlListProperty<Qt3DRender::QParameter> parameters READ parameterList)
public:
explicit Quick3DRenderPass(QObject *parent = 0);
- QQmlListProperty<QAnnotation> annotationList();
- QQmlListProperty<QParameterMapping> bindingList();
+ QQmlListProperty<QFilterKey> filterKeyList();
QQmlListProperty<QRenderState> renderStateList();
QQmlListProperty<QParameter> parameterList();
inline QRenderPass *parentRenderPass() const { return qobject_cast<QRenderPass *>(parent()); }
private:
- static void appendAnnotation(QQmlListProperty<QAnnotation> *list, QAnnotation *criterion);
- static QAnnotation *annotationAt(QQmlListProperty<QAnnotation> *list, int index);
- static int annotationsCount(QQmlListProperty<QAnnotation> *list);
- static void clearAnnotations(QQmlListProperty<QAnnotation> *list);
-
- static void appendBinding(QQmlListProperty<QParameterMapping> *list, QParameterMapping *binding);
- static QParameterMapping *bindingAt(QQmlListProperty<QParameterMapping> *list, int index);
- static int bindingsCount(QQmlListProperty<QParameterMapping> *list);
- static void clearBindings(QQmlListProperty<QParameterMapping> *list);
+ static void appendFilterKey(QQmlListProperty<QFilterKey> *list, QFilterKey *filterKey);
+ static QFilterKey *filterKeyAt(QQmlListProperty<QFilterKey> *list, int index);
+ static int filterKeysCount(QQmlListProperty<QFilterKey> *list);
+ static void clearFilterKey(QQmlListProperty<QFilterKey> *list);
static void appendRenderState(QQmlListProperty<QRenderState> *list, QRenderState *state);
static QRenderState *renderStateAt(QQmlListProperty<QRenderState> *list, int index);
diff --git a/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp b/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp
index 127c2e9f3..8b51a79ef 100644
--- a/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp
+++ b/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,9 +50,9 @@ Quick3DRenderPassFilter::Quick3DRenderPassFilter(QObject *parent)
{
}
-QQmlListProperty<QAnnotation> Quick3DRenderPassFilter::includeList()
+QQmlListProperty<QFilterKey> Quick3DRenderPassFilter::includeList()
{
- return QQmlListProperty<QAnnotation>(this, 0,
+ return QQmlListProperty<QFilterKey>(this, 0,
&Quick3DRenderPassFilter::appendInclude,
&Quick3DRenderPassFilter::includesCount,
&Quick3DRenderPassFilter::includeAt,
@@ -66,37 +69,38 @@ QQmlListProperty<QParameter> Quick3DRenderPassFilter::parameterList()
}
-void Quick3DRenderPassFilter::appendInclude(QQmlListProperty<QAnnotation> *list, QAnnotation *annotation)
+void Quick3DRenderPassFilter::appendInclude(QQmlListProperty<QFilterKey> *list, QFilterKey *annotation)
{
Quick3DRenderPassFilter *filter = qobject_cast<Quick3DRenderPassFilter *>(list->object);
if (filter) {
annotation->setParent(filter->parentRenderPassFilter());
- filter->parentRenderPassFilter()->addInclude(annotation);
+ filter->parentRenderPassFilter()->addMatch(annotation);
}
}
-QAnnotation *Quick3DRenderPassFilter::includeAt(QQmlListProperty<QAnnotation> *list, int index)
+QFilterKey *Quick3DRenderPassFilter::includeAt(QQmlListProperty<QFilterKey> *list, int index)
{
Quick3DRenderPassFilter *filter = qobject_cast<Quick3DRenderPassFilter *>(list->object);
if (filter)
- return filter->parentRenderPassFilter()->includes().at(index);
+ return filter->parentRenderPassFilter()->matchAny().at(index);
return 0;
}
-int Quick3DRenderPassFilter::includesCount(QQmlListProperty<QAnnotation> *list)
+int Quick3DRenderPassFilter::includesCount(QQmlListProperty<QFilterKey> *list)
{
Quick3DRenderPassFilter *filter = qobject_cast<Quick3DRenderPassFilter *>(list->object);
if (filter)
- return filter->parentRenderPassFilter()->includes().count();
+ return filter->parentRenderPassFilter()->matchAny().count();
return 0;
}
-void Quick3DRenderPassFilter::clearIncludes(QQmlListProperty<QAnnotation> *list)
+void Quick3DRenderPassFilter::clearIncludes(QQmlListProperty<QFilterKey> *list)
{
Quick3DRenderPassFilter *filter = qobject_cast<Quick3DRenderPassFilter *>(list->object);
if (filter) {
- Q_FOREACH (QAnnotation *criterion, filter->parentRenderPassFilter()->includes())
- filter->parentRenderPassFilter()->removeInclude(criterion);
+ const auto criteria = filter->parentRenderPassFilter()->matchAny();
+ for (QFilterKey *criterion : criteria)
+ filter->parentRenderPassFilter()->removeMatch(criterion);
}
}
@@ -121,7 +125,8 @@ int Quick3DRenderPassFilter::parametersCount(QQmlListProperty<QParameter> *list)
void Quick3DRenderPassFilter::clearParameterList(QQmlListProperty<QParameter> *list)
{
Quick3DRenderPassFilter *rPassFilter = qobject_cast<Quick3DRenderPassFilter *>(list->object);
- Q_FOREACH (QParameter *p, rPassFilter->parentRenderPassFilter()->parameters())
+ const auto parameters = rPassFilter->parentRenderPassFilter()->parameters();
+ for (QParameter *p : parameters)
rPassFilter->parentRenderPassFilter()->removeParameter(p);
}
diff --git a/src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h b/src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h
index 82d713bb5..3acd32270 100644
--- a/src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h
+++ b/src/quick3d/quick3drender/items/quick3drenderpassfilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@
#include <Qt3DQuick/private/quick3dnode_p.h>
#include <Qt3DRender/qrenderpassfilter.h>
-#include <Qt3DRender/qannotation.h>
+#include <Qt3DRender/qfilterkey.h>
#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
#include <QQmlListProperty>
@@ -63,22 +66,22 @@ namespace Quick {
class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderPassFilter : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DRender::QAnnotation> includes READ includeList)
+ Q_PROPERTY(QQmlListProperty<Qt3DRender::QFilterKey> matchAny READ includeList)
Q_PROPERTY(QQmlListProperty<Qt3DRender::QParameter> parameters READ parameterList)
public:
explicit Quick3DRenderPassFilter(QObject *parent = 0);
- QQmlListProperty<QAnnotation> includeList();
+ QQmlListProperty<QFilterKey> includeList();
QQmlListProperty<QParameter> parameterList();
inline QRenderPassFilter *parentRenderPassFilter() const { return qobject_cast<Qt3DRender::QRenderPassFilter*>(parent()); }
private:
- static void appendInclude(QQmlListProperty<QAnnotation> *list, QAnnotation *criterion);
- static QAnnotation *includeAt(QQmlListProperty<QAnnotation> *list, int index);
- static int includesCount(QQmlListProperty<QAnnotation> *list);
- static void clearIncludes(QQmlListProperty<QAnnotation> *list);
+ static void appendInclude(QQmlListProperty<QFilterKey> *list, QFilterKey *criterion);
+ static QFilterKey *includeAt(QQmlListProperty<QFilterKey> *list, int index);
+ static int includesCount(QQmlListProperty<QFilterKey> *list);
+ static void clearIncludes(QQmlListProperty<QFilterKey> *list);
static void appendParameter(QQmlListProperty<QParameter> *list, QParameter *param);
static QParameter *parameterAt(QQmlListProperty<QParameter> *list, int index);
diff --git a/src/quick3d/quick3drender/items/quick3drendertarget.cpp b/src/quick3d/quick3drender/items/quick3drendertarget.cpp
deleted file mode 100644
index 5f3916b45..000000000
--- a/src/quick3d/quick3drender/items/quick3drendertarget.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "quick3drendertarget_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-namespace Render {
-namespace Quick {
-
-Quick3DRenderTarget::Quick3DRenderTarget(QObject * parent)
- : QObject(parent)
-{
-}
-
-QQmlListProperty<QRenderAttachment> Quick3DRenderTarget::qmlAttachments()
-{
- return QQmlListProperty<QRenderAttachment>(this, 0,
- &Quick3DRenderTarget::appendRenderAttachment,
- &Quick3DRenderTarget::renderAttachmentCount,
- &Quick3DRenderTarget::renderAttachmentAt,
- &Quick3DRenderTarget::clearRenderAttachments);
-}
-
-void Quick3DRenderTarget::appendRenderAttachment(QQmlListProperty<QRenderAttachment> *list, QRenderAttachment *attachment)
-{
- Quick3DRenderTarget *rT = qobject_cast<Quick3DRenderTarget *>(list->object);
- if (rT)
- rT->parentRenderTarget()->addAttachment(attachment);
-}
-
-QRenderAttachment *Quick3DRenderTarget::renderAttachmentAt(QQmlListProperty<QRenderAttachment> *list, int index)
-{
- Quick3DRenderTarget *rT = qobject_cast<Quick3DRenderTarget *>(list->object);
- if (rT)
- return rT->parentRenderTarget()->attachments().at(index);
- return Q_NULLPTR;
-}
-
-int Quick3DRenderTarget::renderAttachmentCount(QQmlListProperty<QRenderAttachment> *list)
-{
- Quick3DRenderTarget *rT = qobject_cast<Quick3DRenderTarget *>(list->object);
- if (rT)
- return rT->parentRenderTarget()->attachments().count();
- return -1;
-}
-
-void Quick3DRenderTarget::clearRenderAttachments(QQmlListProperty<QRenderAttachment> *list)
-{
- Quick3DRenderTarget *rT = qobject_cast<Quick3DRenderTarget *>(list->object);
- if (rT) {
- Q_FOREACH (QRenderAttachment *att, rT->parentRenderTarget()->attachments())
- rT->parentRenderTarget()->removeAttachment(att);
- }
-}
-
-} // namespace Quick
-} // namespace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/quick3d/quick3drender/items/quick3drendertarget_p.h b/src/quick3d/quick3drender/items/quick3drendertarget_p.h
deleted file mode 100644
index f64605c6a..000000000
--- a/src/quick3d/quick3drender/items/quick3drendertarget_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QUICK_QUICK3DRENDERTARGET_P_H
-#define QT3DRENDER_RENDER_QUICK_QUICK3DRENDERTARGET_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
-#include <Qt3DRender/qrendertarget.h>
-#include <Qt3DRender/qrenderattachment.h>
-#include <QQmlListProperty>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-namespace Render {
-namespace Quick {
-
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderTarget : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DRender::QRenderAttachment> attachments READ qmlAttachments)
-public:
- explicit Quick3DRenderTarget(QObject *parent = 0);
-
- inline QRenderTarget *parentRenderTarget() const { return qobject_cast<QRenderTarget *>(parent()); }
- QQmlListProperty<QRenderAttachment> qmlAttachments();
-
-private:
- static void appendRenderAttachment(QQmlListProperty<QRenderAttachment> *list, QRenderAttachment *attachment);
- static QRenderAttachment *renderAttachmentAt(QQmlListProperty<QRenderAttachment> *list, int index);
- static int renderAttachmentCount(QQmlListProperty<QRenderAttachment> *list);
- static void clearRenderAttachments(QQmlListProperty<QRenderAttachment> *list);
-};
-
-} // namespace Quick
-} // namespace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QUICK_QUICK3DRENDERTARGET_P_H
diff --git a/src/quick3d/quick3drender/items/quick3drendertargetoutput.cpp b/src/quick3d/quick3drender/items/quick3drendertargetoutput.cpp
new file mode 100644
index 000000000..e3b40243a
--- /dev/null
+++ b/src/quick3d/quick3drender/items/quick3drendertargetoutput.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "quick3drendertargetoutput_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+namespace Quick {
+
+Quick3DRenderTargetOutput::Quick3DRenderTargetOutput(QObject * parent)
+ : QObject(parent)
+{
+}
+
+QQmlListProperty<QRenderTargetOutput> Quick3DRenderTargetOutput::qmlAttachments()
+{
+ return QQmlListProperty<QRenderTargetOutput>(this, 0,
+ &Quick3DRenderTargetOutput::appendRenderAttachment,
+ &Quick3DRenderTargetOutput::renderAttachmentCount,
+ &Quick3DRenderTargetOutput::renderAttachmentAt,
+ &Quick3DRenderTargetOutput::clearRenderAttachments);
+}
+
+void Quick3DRenderTargetOutput::appendRenderAttachment(QQmlListProperty<QRenderTargetOutput> *list, QRenderTargetOutput *output)
+{
+ Quick3DRenderTargetOutput *rT = qobject_cast<Quick3DRenderTargetOutput *>(list->object);
+ if (rT)
+ rT->parentRenderTarget()->addOutput(output);
+}
+
+QRenderTargetOutput *Quick3DRenderTargetOutput::renderAttachmentAt(QQmlListProperty<QRenderTargetOutput> *list, int index)
+{
+ Quick3DRenderTargetOutput *rT = qobject_cast<Quick3DRenderTargetOutput *>(list->object);
+ if (rT)
+ return rT->parentRenderTarget()->outputs().at(index);
+ return nullptr;
+}
+
+int Quick3DRenderTargetOutput::renderAttachmentCount(QQmlListProperty<QRenderTargetOutput> *list)
+{
+ Quick3DRenderTargetOutput *rT = qobject_cast<Quick3DRenderTargetOutput *>(list->object);
+ if (rT)
+ return rT->parentRenderTarget()->outputs().count();
+ return -1;
+}
+
+void Quick3DRenderTargetOutput::clearRenderAttachments(QQmlListProperty<QRenderTargetOutput> *list)
+{
+ Quick3DRenderTargetOutput *rT = qobject_cast<Quick3DRenderTargetOutput *>(list->object);
+ if (rT) {
+ const auto outputs = rT->parentRenderTarget()->outputs();
+ for (QRenderTargetOutput *output : outputs)
+ rT->parentRenderTarget()->removeOutput(output);
+ }
+}
+
+} // namespace Quick
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h b/src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h
new file mode 100644
index 000000000..5a2c8ea54
--- /dev/null
+++ b/src/quick3d/quick3drender/items/quick3drendertargetoutput_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_QUICK_QUICK3DRENDERTARGETOUTPUT_P_H
+#define QT3DRENDER_RENDER_QUICK_QUICK3DRENDERTARGETOUTPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
+#include <Qt3DRender/qrendertarget.h>
+#include <Qt3DRender/qrendertargetoutput.h>
+#include <QQmlListProperty>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+namespace Quick {
+
+class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DRenderTargetOutput : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3DRender::QRenderTargetOutput> attachments READ qmlAttachments)
+public:
+ explicit Quick3DRenderTargetOutput(QObject *parent = 0);
+
+ inline QRenderTarget *parentRenderTarget() const { return qobject_cast<QRenderTarget *>(parent()); }
+ QQmlListProperty<QRenderTargetOutput> qmlAttachments();
+
+private:
+ static void appendRenderAttachment(QQmlListProperty<QRenderTargetOutput> *list, QRenderTargetOutput *attachment);
+ static QRenderTargetOutput *renderAttachmentAt(QQmlListProperty<QRenderTargetOutput> *list, int index);
+ static int renderAttachmentCount(QQmlListProperty<QRenderTargetOutput> *list);
+ static void clearRenderAttachments(QQmlListProperty<QRenderTargetOutput> *list);
+};
+
+} // namespace Quick
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_QUICK_QUICK3DRENDERTARGETOUTPUT_P_H
diff --git a/src/quick3d/quick3drender/items/quick3drendertargetselector.cpp b/src/quick3d/quick3drender/items/quick3drendertargetselector.cpp
index dcc5dd2bd..b61c7ed12 100644
--- a/src/quick3d/quick3drender/items/quick3drendertargetselector.cpp
+++ b/src/quick3d/quick3drender/items/quick3drendertargetselector.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,7 +58,9 @@ QVariantList Quick3DRenderTargetSelector::drawBuffers() const
{
// Converts RenderAttachmentType to int
QVariantList l;
- Q_FOREACH (const QRenderAttachment::RenderAttachmentType &b, parentRenderTargetSelector()->drawBuffers())
+ const auto outputs = parentRenderTargetSelector()->outputs();
+ l.reserve(outputs.size());
+ for (const QRenderTargetOutput::AttachmentPoint &b : outputs)
l.append(static_cast<int>(b));
return l;
}
@@ -65,11 +70,12 @@ void Quick3DRenderTargetSelector::setDrawBuffers(const QVariantList &buffers)
if (buffers != drawBuffers()) {
// Converts int to RenderAttachmentType
- QList<QRenderAttachment::RenderAttachmentType> drawBuffersList;
- Q_FOREACH (const QVariant &buf, buffers)
- drawBuffersList.append(static_cast<QRenderAttachment::RenderAttachmentType>(buf.toInt()));
+ QVector<QRenderTargetOutput::AttachmentPoint> drawBuffersList;
+ drawBuffersList.reserve(buffers.size());
+ for (const QVariant &buf : buffers)
+ drawBuffersList.append(static_cast<QRenderTargetOutput::AttachmentPoint>(buf.toInt()));
- parentRenderTargetSelector()->setDrawBuffers(drawBuffersList);
+ parentRenderTargetSelector()->setOutputs(drawBuffersList);
emit drawBuffersChanged();
}
}
diff --git a/src/quick3d/quick3drender/items/quick3drendertargetselector_p.h b/src/quick3d/quick3drender/items/quick3drendertargetselector_p.h
index 09f594580..a24a6a71f 100644
--- a/src/quick3d/quick3drender/items/quick3drendertargetselector_p.h
+++ b/src/quick3d/quick3drender/items/quick3drendertargetselector_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,7 +52,7 @@
//
#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
-#include <Qt3DRender/qrenderattachment.h>
+#include <Qt3DRender/qrendertargetoutput.h>
#include <Qt3DRender/qrendertargetselector.h>
#include <QQmlListProperty>
#include <QVariantList>
diff --git a/src/quick3d/quick3drender/items/quick3dscene.cpp b/src/quick3d/quick3drender/items/quick3dscene.cpp
index 95a833448..4062904f2 100644
--- a/src/quick3d/quick3drender/items/quick3dscene.cpp
+++ b/src/quick3d/quick3drender/items/quick3dscene.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/items/quick3dscene_p.h b/src/quick3d/quick3drender/items/quick3dscene_p.h
index f607aaeeb..60c2d2ab5 100644
--- a/src/quick3d/quick3drender/items/quick3dscene_p.h
+++ b/src/quick3d/quick3drender/items/quick3dscene_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@
#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
#include <Qt3DQuick/private/quick3dentity_p.h>
-#include <Qt3DRender/qabstractsceneloader.h>
+#include <Qt3DRender/qsceneloader.h>
QT_BEGIN_NAMESPACE
@@ -64,7 +67,7 @@ class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DScene : public QObject
public:
explicit Quick3DScene(QObject *parent = 0);
- inline QAbstractSceneLoader *parentScene() const { return qobject_cast<QAbstractSceneLoader *>(parent()); }
+ inline QSceneLoader *parentScene() const { return qobject_cast<QSceneLoader *>(parent()); }
};
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdata.cpp b/src/quick3d/quick3drender/items/quick3dshaderdata.cpp
index 1dd9ac323..e5901e8fb 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdata.cpp
+++ b/src/quick3d/quick3drender/items/quick3dshaderdata.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -74,7 +77,8 @@ public:
Quick3DShaderDataArray *array = v.value<Quick3DShaderDataArray *>();
QVariantList innerValues;
if (array) {
- Q_FOREACH (QShaderData *d, array->values()) {
+ const auto values = array->values();
+ for (QShaderData *d : values) {
if (d)
innerValues.append(QVariant::fromValue(d->id()));
}
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdata_p.h b/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
index cb7e0fe7c..72c117c90 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
+++ b/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,9 +68,6 @@ class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DShaderData : public QShaderDat
Q_OBJECT
public:
explicit Quick3DShaderData(QNode *parent = 0);
-
-private:
- QT3D_CLONEABLE(Quick3DShaderData)
};
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp b/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp
index 3306cf226..21dd2525a 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp
+++ b/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@ public:
: QNodePrivate()
{}
- QList<QShaderData *> m_values;
+ QVector<QShaderData *> m_values;
};
Quick3DShaderDataArray::Quick3DShaderDataArray(QNode *parent)
@@ -58,11 +61,6 @@ Quick3DShaderDataArray::Quick3DShaderDataArray(QNode *parent)
{
}
-Quick3DShaderDataArray::~Quick3DShaderDataArray()
-{
- QNode::cleanup();
-}
-
QQmlListProperty<QShaderData> Quick3DShaderDataArray::valuesList()
{
return QQmlListProperty<QShaderData>(this, 0,
@@ -72,19 +70,20 @@ QQmlListProperty<QShaderData> Quick3DShaderDataArray::valuesList()
&Quick3DShaderDataArray::clearValues);
}
-QList<QShaderData *> Quick3DShaderDataArray::values() const
+QVector<QShaderData *> Quick3DShaderDataArray::values() const
{
Q_D(const Quick3DShaderDataArray);
return d->m_values;
}
-void Quick3DShaderDataArray::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const Quick3DShaderDataArray *dataArray = static_cast<const Quick3DShaderDataArray *>(ref);
- Q_FOREACH (QShaderData *v, dataArray->d_func()->m_values)
- d_func()->m_values.append(static_cast<QShaderData *>(QNode::clone(v)));
-}
+// TODO: Avoid cloning here
+//void Quick3DShaderDataArray::copy(const QNode *ref)
+//{
+// QNode::copy(ref);
+// const Quick3DShaderDataArray *dataArray = static_cast<const Quick3DShaderDataArray *>(ref);
+// Q_FOREACH (QShaderData *v, dataArray->d_func()->m_values)
+// d_func()->m_values.append(static_cast<QShaderData *>(QNode::clone(v)));
+//}
void Quick3DShaderDataArray::appendValue(QQmlListProperty<QShaderData> *list, QShaderData *bar)
{
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h b/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
index df49c1f98..effd18b32 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
+++ b/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -73,12 +76,8 @@ class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DShaderDataArray : public Qt3DC
public:
explicit Quick3DShaderDataArray(Qt3DCore::QNode *parent = 0);
- ~Quick3DShaderDataArray();
QQmlListProperty<QShaderData> valuesList();
- QList<QShaderData *> values() const;
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ QVector<QShaderData *> values() const;
private:
static void appendValue(QQmlListProperty<QShaderData> *list, QShaderData *bar);
@@ -86,7 +85,6 @@ private:
static int valueCount(QQmlListProperty<QShaderData> *list);
static void clearValues(QQmlListProperty<QShaderData> *list);
Q_DECLARE_PRIVATE(Quick3DShaderDataArray)
- QT3D_CLONEABLE(Quick3DShaderDataArray)
};
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dsortmethod.cpp b/src/quick3d/quick3drender/items/quick3dsortmethod.cpp
deleted file mode 100644
index 71d121682..000000000
--- a/src/quick3d/quick3drender/items/quick3dsortmethod.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "quick3dsortmethod_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-namespace Render {
-namespace Quick {
-
-Quick3DSortMethod::Quick3DSortMethod(QObject *parent)
- : QObject(parent)
-{
-}
-
-QQmlListProperty<QSortCriterion> Quick3DSortMethod::criteriaList()
-{
- return QQmlListProperty<QSortCriterion>(this, 0,
- &Quick3DSortMethod::appendCriterion,
- &Quick3DSortMethod::criteriaCount,
- &Quick3DSortMethod::criterionAt,
- &Quick3DSortMethod::clearCriteria);
-}
-
-void Quick3DSortMethod::appendCriterion(QQmlListProperty<QSortCriterion> *list, QSortCriterion *criterion)
-{
- Quick3DSortMethod *sM = qobject_cast<Quick3DSortMethod *>(list->object);
- if (sM != Q_NULLPTR)
- sM->parentSortMethod()->addCriterion(criterion);
-}
-
-QSortCriterion *Quick3DSortMethod::criterionAt(QQmlListProperty<QSortCriterion> *list, int index)
-{
- Quick3DSortMethod *sM = qobject_cast<Quick3DSortMethod *>(list->object);
- if (sM != Q_NULLPTR)
- return sM->parentSortMethod()->criteria().at(index);
- return Q_NULLPTR;
-}
-
-int Quick3DSortMethod::criteriaCount(QQmlListProperty<QSortCriterion> *list)
-{
- Quick3DSortMethod *sM = qobject_cast<Quick3DSortMethod *>(list->object);
- if (sM != Q_NULLPTR)
- return sM->parentSortMethod()->criteria().count();
- return -1;
-}
-
-void Quick3DSortMethod::clearCriteria(QQmlListProperty<QSortCriterion> *list)
-{
- Quick3DSortMethod *sM = qobject_cast<Quick3DSortMethod *>(list->object);
- if (sM != Q_NULLPTR) {
- Q_FOREACH (QSortCriterion *c, sM->parentSortMethod()->criteria())
- sM->parentSortMethod()->removeCriterion(c);
- }
-}
-
-} // namespace Quick
-} // namespace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/quick3d/quick3drender/items/quick3dsortmethod_p.h b/src/quick3d/quick3drender/items/quick3dsortmethod_p.h
deleted file mode 100644
index 9e1db429b..000000000
--- a/src/quick3d/quick3drender/items/quick3dsortmethod_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QUICK_QUICK3DSORTMETHOD_P_H
-#define QT3DRENDER_RENDER_QUICK_QUICK3DSORTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
-#include <Qt3DRender/qsortmethod.h>
-#include <Qt3DRender/qsortcriterion.h>
-#include <QQmlListProperty>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-namespace Render {
-namespace Quick {
-
-class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DSortMethod : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DRender::QSortCriterion> criteria READ criteriaList)
-public:
- explicit Quick3DSortMethod(QObject *parent = 0);
-
- inline QSortMethod *parentSortMethod() const { return qobject_cast<QSortMethod *>(parent()); }
-
- QQmlListProperty<QSortCriterion> criteriaList();
-
-private:
- static void appendCriterion(QQmlListProperty<QSortCriterion> *list, QSortCriterion *criterion);
- static QSortCriterion *criterionAt(QQmlListProperty<QSortCriterion> *list, int index);
- static int criteriaCount(QQmlListProperty<QSortCriterion> *list);
- static void clearCriteria(QQmlListProperty<QSortCriterion> *list);
-};
-
-} // namespace Quick
-} // namespace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QUICK_QUICK3DSORTMETHOD_P_H
diff --git a/src/quick3d/quick3drender/items/quick3dstateset.cpp b/src/quick3d/quick3drender/items/quick3dstateset.cpp
index f97363a9c..d7d74e5ad 100644
--- a/src/quick3d/quick3drender/items/quick3dstateset.cpp
+++ b/src/quick3d/quick3drender/items/quick3dstateset.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -82,7 +85,8 @@ int Quick3DStateSet::renderStateCount(QQmlListProperty<QRenderState> *list)
void Quick3DStateSet::clearRenderStates(QQmlListProperty<QRenderState> *list)
{
Quick3DStateSet *stateSet = qobject_cast<Quick3DStateSet *>(list->object);
- Q_FOREACH (QRenderState *s, stateSet->parentStateSet()->renderStates())
+ const auto states = stateSet->parentStateSet()->renderStates();
+ for (QRenderState *s : states)
stateSet->parentStateSet()->removeRenderState(s);
}
diff --git a/src/quick3d/quick3drender/items/quick3dstateset_p.h b/src/quick3d/quick3drender/items/quick3dstateset_p.h
index a1312c5ca..4bb9b6cec 100644
--- a/src/quick3d/quick3drender/items/quick3dstateset_p.h
+++ b/src/quick3d/quick3drender/items/quick3dstateset_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,7 +52,7 @@
//
#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
-#include <Qt3DRender/qstateset.h>
+#include <Qt3DRender/qrenderstateset.h>
#include <QQmlListProperty>
QT_BEGIN_NAMESPACE
@@ -67,7 +70,7 @@ public:
~Quick3DStateSet();
QQmlListProperty<QRenderState> renderStateList();
- inline QStateSet *parentStateSet() const { return qobject_cast<QStateSet *>(parent()); }
+ inline QRenderStateSet *parentStateSet() const { return qobject_cast<QRenderStateSet *>(parent()); }
private:
static void appendRenderState(QQmlListProperty<QRenderState> *list, QRenderState *state);
diff --git a/src/quick3d/quick3drender/items/quick3dtechnique.cpp b/src/quick3d/quick3drender/items/quick3dtechnique.cpp
index d5be802e4..123050645 100644
--- a/src/quick3d/quick3drender/items/quick3dtechnique.cpp
+++ b/src/quick3d/quick3drender/items/quick3dtechnique.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -86,7 +89,8 @@ int Quick3DTechnique::parametersCount(QQmlListProperty<QParameter> *list)
void Quick3DTechnique::clearParameterList(QQmlListProperty<QParameter> *list)
{
Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object);
- Q_FOREACH (QParameter *p, technique->parentTechnique()->parameters())
+ const auto parameters = technique->parentTechnique()->parameters();
+ for (QParameter *p : parameters)
technique->parentTechnique()->removeParameter(p);
}
@@ -94,7 +98,7 @@ void Quick3DTechnique::appendRenderPass(QQmlListProperty<QRenderPass> *list, QRe
{
Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object);
if (technique) {
- technique->parentTechnique()->addPass(renderPass);
+ technique->parentTechnique()->addRenderPass(renderPass);
}
}
@@ -118,52 +122,54 @@ void Quick3DTechnique::clearRenderPasses(QQmlListProperty<QRenderPass> *list)
{
Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object);
if (technique) {
- Q_FOREACH (QRenderPass *pass, technique->parentTechnique()->renderPasses())
- technique->parentTechnique()->removePass(pass);
+ const auto passes = technique->parentTechnique()->renderPasses();
+ for (QRenderPass *pass : passes)
+ technique->parentTechnique()->removeRenderPass(pass);
}
}
-QQmlListProperty<QAnnotation> Quick3DTechnique::annotationList()
+QQmlListProperty<QFilterKey> Quick3DTechnique::filterKeyList()
{
- return QQmlListProperty<QAnnotation>(this, 0,
- &Quick3DTechnique::appendAnnotation,
- &Quick3DTechnique::annotationCount,
- &Quick3DTechnique::annotationAt,
- &Quick3DTechnique::clearAnnotationList);
+ return QQmlListProperty<QFilterKey>(this, 0,
+ &Quick3DTechnique::appendFilterKey,
+ &Quick3DTechnique::filterKeyCount,
+ &Quick3DTechnique::filterKeyAt,
+ &Quick3DTechnique::clearFilterKeyList);
}
-void Quick3DTechnique::appendAnnotation(QQmlListProperty<QAnnotation> *list, QAnnotation *annotation)
+void Quick3DTechnique::appendFilterKey(QQmlListProperty<QFilterKey> *list, QFilterKey *filterKey)
{
Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object);
if (technique) {
- if (!annotation->parent())
- annotation->setParent(technique->parentTechnique());
- technique->parentTechnique()->addAnnotation(annotation);
+ if (!filterKey->parent())
+ filterKey->setParent(technique->parentTechnique());
+ technique->parentTechnique()->addFilterKey(filterKey);
}
}
-QAnnotation *Quick3DTechnique::annotationAt(QQmlListProperty<QAnnotation> *list, int index)
+QFilterKey *Quick3DTechnique::filterKeyAt(QQmlListProperty<QFilterKey> *list, int index)
{
Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object);
if (technique)
- return technique->parentTechnique()->annotations().at(index);
+ return technique->parentTechnique()->filterKeys().at(index);
return 0;
}
-int Quick3DTechnique::annotationCount(QQmlListProperty<QAnnotation> *list)
+int Quick3DTechnique::filterKeyCount(QQmlListProperty<QFilterKey> *list)
{
Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object);
if (technique)
- return technique->parentTechnique()->annotations().size();
+ return technique->parentTechnique()->filterKeys().size();
return 0;
}
-void Quick3DTechnique::clearAnnotationList(QQmlListProperty<QAnnotation> *list)
+void Quick3DTechnique::clearFilterKeyList(QQmlListProperty<QFilterKey> *list)
{
Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object);
if (technique) {
- Q_FOREACH (QAnnotation *a, technique->parentTechnique()->annotations())
- technique->parentTechnique()->removeAnnotation(a);
+ const auto keys = technique->parentTechnique()->filterKeys();
+ for (QFilterKey *a : keys)
+ technique->parentTechnique()->removeFilterKey(a);
}
}
diff --git a/src/quick3d/quick3drender/items/quick3dtechnique_p.h b/src/quick3d/quick3drender/items/quick3dtechnique_p.h
index ee96c243a..203befcb7 100644
--- a/src/quick3d/quick3drender/items/quick3dtechnique_p.h
+++ b/src/quick3d/quick3drender/items/quick3dtechnique_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,13 +64,13 @@ namespace Quick {
class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DTechnique : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DRender::QAnnotation> annotations READ annotationList)
+ Q_PROPERTY(QQmlListProperty<Qt3DRender::QFilterKey> filterKeys READ filterKeyList)
Q_PROPERTY(QQmlListProperty<Qt3DRender::QRenderPass> renderPasses READ renderPassList)
Q_PROPERTY(QQmlListProperty<Qt3DRender::QParameter> parameters READ parameterList)
public:
explicit Quick3DTechnique(QObject *parent = 0);
- QQmlListProperty<QAnnotation> annotationList();
+ QQmlListProperty<QFilterKey> filterKeyList();
QQmlListProperty<QRenderPass> renderPassList();
QQmlListProperty<QParameter> parameterList();
@@ -81,10 +84,10 @@ private:
static int parametersCount(QQmlListProperty<QParameter> *list);
static void clearParameterList(QQmlListProperty<QParameter> *list);
- static void appendAnnotation(QQmlListProperty<QAnnotation> *list, QAnnotation *Annotation);
- static QAnnotation *annotationAt(QQmlListProperty<QAnnotation> *list, int index);
- static int annotationCount(QQmlListProperty<QAnnotation> *list);
- static void clearAnnotationList(QQmlListProperty<QAnnotation> *list);
+ static void appendFilterKey(QQmlListProperty<QFilterKey> *list, QFilterKey *filterKey);
+ static QFilterKey *filterKeyAt(QQmlListProperty<QFilterKey> *list, int index);
+ static int filterKeyCount(QQmlListProperty<QFilterKey> *list);
+ static void clearFilterKeyList(QQmlListProperty<QFilterKey> *list);
static void appendRenderPass(QQmlListProperty<QRenderPass> *list, QRenderPass* renderPass);
static QRenderPass *renderPassAt(QQmlListProperty<QRenderPass> *list, int index);
diff --git a/src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp b/src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp
index 50334de28..b27d46c31 100644
--- a/src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp
+++ b/src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,9 +50,9 @@ Quick3DTechniqueFilter::Quick3DTechniqueFilter(QObject *parent)
{
}
-QQmlListProperty<QAnnotation> Quick3DTechniqueFilter::requireList()
+QQmlListProperty<QFilterKey> Quick3DTechniqueFilter::matchList()
{
- return QQmlListProperty<QAnnotation>(this, 0,
+ return QQmlListProperty<QFilterKey>(this, 0,
&Quick3DTechniqueFilter::appendRequire,
&Quick3DTechniqueFilter::requiresCount,
&Quick3DTechniqueFilter::requireAt,
@@ -65,37 +68,38 @@ QQmlListProperty<QParameter> Quick3DTechniqueFilter::parameterList()
&Quick3DTechniqueFilter::clearParameterList);
}
-void Quick3DTechniqueFilter::appendRequire(QQmlListProperty<QAnnotation> *list, QAnnotation *criterion)
+void Quick3DTechniqueFilter::appendRequire(QQmlListProperty<QFilterKey> *list, QFilterKey *criterion)
{
Quick3DTechniqueFilter *filter = qobject_cast<Quick3DTechniqueFilter *>(list->object);
if (filter) {
criterion->setParent(filter->parentTechniqueFilter());
- filter->parentTechniqueFilter()->addRequirement(criterion);
+ filter->parentTechniqueFilter()->addMatch(criterion);
}
}
-QAnnotation *Quick3DTechniqueFilter::requireAt(QQmlListProperty<QAnnotation> *list, int index)
+QFilterKey *Quick3DTechniqueFilter::requireAt(QQmlListProperty<QFilterKey> *list, int index)
{
Quick3DTechniqueFilter *filter = qobject_cast<Quick3DTechniqueFilter *>(list->object);
if (filter)
- return filter->parentTechniqueFilter()->criteria().at(index);
+ return filter->parentTechniqueFilter()->matchAll().at(index);
return 0;
}
-int Quick3DTechniqueFilter::requiresCount(QQmlListProperty<QAnnotation> *list)
+int Quick3DTechniqueFilter::requiresCount(QQmlListProperty<QFilterKey> *list)
{
Quick3DTechniqueFilter *filter = qobject_cast<Quick3DTechniqueFilter *>(list->object);
if (filter)
- return filter->parentTechniqueFilter()->criteria().size();
+ return filter->parentTechniqueFilter()->matchAll().size();
return 0;
}
-void Quick3DTechniqueFilter::clearRequires(QQmlListProperty<QAnnotation> *list)
+void Quick3DTechniqueFilter::clearRequires(QQmlListProperty<QFilterKey> *list)
{
Quick3DTechniqueFilter *filter = qobject_cast<Quick3DTechniqueFilter *>(list->object);
if (filter) {
- Q_FOREACH (QAnnotation *criterion, filter->parentTechniqueFilter()->criteria())
- filter->parentTechniqueFilter()->removeRequirement(criterion);
+ const auto criteria = filter->parentTechniqueFilter()->matchAll();
+ for (QFilterKey *criterion : criteria)
+ filter->parentTechniqueFilter()->removeMatch(criterion);
}
}
@@ -120,7 +124,8 @@ int Quick3DTechniqueFilter::parametersCount(QQmlListProperty<QParameter> *list)
void Quick3DTechniqueFilter::clearParameterList(QQmlListProperty<QParameter> *list)
{
Quick3DTechniqueFilter *techniqueFilter = qobject_cast<Quick3DTechniqueFilter *>(list->object);
- Q_FOREACH (QParameter *p, techniqueFilter->parentTechniqueFilter()->parameters())
+ const auto parameters = techniqueFilter->parentTechniqueFilter()->parameters();
+ for (QParameter *p : parameters)
techniqueFilter->parentTechniqueFilter()->removeParameter(p);
}
diff --git a/src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h b/src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h
index d8d4e4478..27d637e23 100644
--- a/src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h
+++ b/src/quick3d/quick3drender/items/quick3dtechniquefilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@
#include <Qt3DQuickRender/private/qt3dquickrender_global_p.h>
#include <Qt3DRender/qtechniquefilter.h>
-#include <Qt3DRender/qannotation.h>
+#include <Qt3DRender/qfilterkey.h>
#include <Qt3DQuick/private/quick3dnode_p.h>
#include <QQmlListProperty>
@@ -63,22 +66,22 @@ namespace Quick {
class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DTechniqueFilter : public QObject
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<Qt3DRender::QAnnotation> requires READ requireList)
+ Q_PROPERTY(QQmlListProperty<Qt3DRender::QFilterKey> matchAll READ matchList)
Q_PROPERTY(QQmlListProperty<Qt3DRender::QParameter> parameters READ parameterList)
public:
explicit Quick3DTechniqueFilter(QObject *parent = 0);
- QQmlListProperty<QAnnotation> requireList();
+ QQmlListProperty<QFilterKey> matchList();
QQmlListProperty<QParameter> parameterList();
inline QTechniqueFilter *parentTechniqueFilter() const { return qobject_cast<QTechniqueFilter*>(parent()); }
private:
- static void appendRequire(QQmlListProperty<QAnnotation> *list, QAnnotation *criterion);
- static QAnnotation *requireAt(QQmlListProperty<QAnnotation> *list, int index);
- static int requiresCount(QQmlListProperty<QAnnotation> *list);
- static void clearRequires(QQmlListProperty<QAnnotation> *list);
+ static void appendRequire(QQmlListProperty<QFilterKey> *list, QFilterKey *criterion);
+ static QFilterKey *requireAt(QQmlListProperty<QFilterKey> *list, int index);
+ static int requiresCount(QQmlListProperty<QFilterKey> *list);
+ static void clearRequires(QQmlListProperty<QFilterKey> *list);
static void appendParameter(QQmlListProperty<QParameter> *list, QParameter *param);
static QParameter *parameterAt(QQmlListProperty<QParameter> *list, int index);
diff --git a/src/quick3d/quick3drender/items/quick3dtexture.cpp b/src/quick3d/quick3drender/items/quick3dtexture.cpp
index 90bd564f2..9c528996c 100644
--- a/src/quick3d/quick3drender/items/quick3dtexture.cpp
+++ b/src/quick3d/quick3drender/items/quick3dtexture.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -69,7 +72,7 @@ QAbstractTextureImage *Quick3DTextureExtension::textureImageAt(QQmlListProperty<
Quick3DTextureExtension *self = qobject_cast<Quick3DTextureExtension *>(list->object);
if (self)
return self->parentTexture()->textureImages().at(index);
- return Q_NULLPTR;
+ return nullptr;
}
int Quick3DTextureExtension::textureImageCount(QQmlListProperty<QAbstractTextureImage> *list)
@@ -82,10 +85,11 @@ int Quick3DTextureExtension::textureImageCount(QQmlListProperty<QAbstractTexture
void Quick3DTextureExtension::clearTextureImageList(QQmlListProperty<QAbstractTextureImage> *list)
{
- Quick3DTextureExtension *self = qobject_cast<Quick3DTextureExtension *>(list->object);
- if (self)
- Q_FOREACH (QAbstractTextureImage *img, self->parentTexture()->textureImages())
+ if (Quick3DTextureExtension *self = qobject_cast<Quick3DTextureExtension *>(list->object)) {
+ const auto images = self->parentTexture()->textureImages();
+ for (QAbstractTextureImage *img : images)
self->parentTexture()->removeTextureImage(img);
+ }
}
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dtexture_p.h b/src/quick3d/quick3drender/items/quick3dtexture_p.h
index 1089bb616..a1e2ad6b8 100644
--- a/src/quick3d/quick3drender/items/quick3dtexture_p.h
+++ b/src/quick3d/quick3drender/items/quick3dtexture_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -70,7 +73,7 @@ public:
explicit Quick3DTextureExtension(QObject *parent = 0);
QQmlListProperty<QAbstractTextureImage> textureImages();
- inline QAbstractTextureProvider *parentTexture() const { return qobject_cast<QAbstractTextureProvider *>(parent()); }
+ inline QAbstractTexture *parentTexture() const { return qobject_cast<QAbstractTexture *>(parent()); }
private:
static void appendTextureImage(QQmlListProperty<QAbstractTextureImage> *list, QAbstractTextureImage *textureImage);
diff --git a/src/quick3d/quick3drender/items/quick3dviewport.cpp b/src/quick3d/quick3drender/items/quick3dviewport.cpp
index 5cb89a1b0..5d490018f 100644
--- a/src/quick3d/quick3drender/items/quick3dviewport.cpp
+++ b/src/quick3d/quick3drender/items/quick3dviewport.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/items/quick3dviewport_p.h b/src/quick3d/quick3drender/items/quick3dviewport_p.h
index a5eceadd0..877900365 100644
--- a/src/quick3d/quick3drender/items/quick3dviewport_p.h
+++ b/src/quick3d/quick3drender/items/quick3dviewport_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/qt3dquickrender_global.cpp b/src/quick3d/quick3drender/qt3dquickrender_global.cpp
index 1b8323c5c..0706185fe 100644
--- a/src/quick3d/quick3drender/qt3dquickrender_global.cpp
+++ b/src/quick3d/quick3drender/qt3dquickrender_global.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/qt3dquickrender_global.h b/src/quick3d/quick3drender/qt3dquickrender_global.h
index e92fbdbc9..7c21243e3 100644
--- a/src/quick3d/quick3drender/qt3dquickrender_global.h
+++ b/src/quick3d/quick3drender/qt3dquickrender_global.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DQUICKRENDER_GLOBAL_H
#define QT3DQUICKRENDER_GLOBAL_H
-#include <QtCore/qglobal.h>
+#include <Qt3DCore/qt3dcore_global.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quick3d/quick3drender/qt3dquickrender_global_p.h b/src/quick3d/quick3drender/qt3dquickrender_global_p.h
index 45d27d752..77378f41b 100644
--- a/src/quick3d/quick3drender/qt3dquickrender_global_p.h
+++ b/src/quick3d/quick3drender/qt3dquickrender_global_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quick3d/quick3drender/qt3dquickrendernodefactory.cpp b/src/quick3d/quick3drender/qt3dquickrendernodefactory.cpp
index dd2265f1d..2d9456d12 100644
--- a/src/quick3d/quick3drender/qt3dquickrendernodefactory.cpp
+++ b/src/quick3d/quick3drender/qt3dquickrendernodefactory.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -56,7 +59,7 @@ void QuickRenderNodeFactory::registerType(const char *className, const char *qui
Qt3DCore::QNode *QuickRenderNodeFactory::createNode(const char *type)
{
if (!m_types.contains(type))
- return Q_NULLPTR;
+ return nullptr;
Type &typeInfo(m_types[type]);
@@ -65,7 +68,7 @@ Qt3DCore::QNode *QuickRenderNodeFactory::createNode(const char *type)
typeInfo.t = QQmlMetaType::qmlType(QString::fromLatin1(typeInfo.quickName), typeInfo.version.first, typeInfo.version.second);
}
- return typeInfo.t ? qobject_cast<Qt3DCore::QNode *>(typeInfo.t->create()) : Q_NULLPTR;
+ return typeInfo.t ? qobject_cast<Qt3DCore::QNode *>(typeInfo.t->create()) : nullptr;
}
} // namespace Qt3DRender
diff --git a/src/quick3d/quick3drender/qt3dquickrendernodefactory_p.h b/src/quick3d/quick3drender/qt3dquickrendernodefactory_p.h
index cd7ca2606..863a97f0b 100644
--- a/src/quick3d/quick3drender/qt3dquickrendernodefactory_p.h
+++ b/src/quick3d/quick3drender/qt3dquickrendernodefactory_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qabstractnodefactory.h>
+#include <Qt3DCore/private/qabstractnodefactory_p.h>
#include <QtCore/qhash.h>
QT_BEGIN_NAMESPACE
@@ -68,9 +71,9 @@ public:
private:
struct Type {
- Type() : t(Q_NULLPTR), resolved(false) { }
+ Type() : t(nullptr), resolved(false) { }
Type(const char *quickName, int major, int minor)
- : quickName(quickName), version(major, minor), t(Q_NULLPTR), resolved(false) { }
+ : quickName(quickName), version(major, minor), t(nullptr), resolved(false) { }
QByteArray quickName;
QPair<int, int> version;
QQmlType *t;
diff --git a/src/quick3d/quick3drender/quick3drender.pro b/src/quick3d/quick3drender/quick3drender.pro
index f9d711dd6..959834870 100644
--- a/src/quick3d/quick3drender/quick3drender.pro
+++ b/src/quick3d/quick3drender/quick3drender.pro
@@ -4,6 +4,9 @@ MODULE = 3dquickrender
QT += core core-private qml qml-private 3dcore 3drender 3dquick 3dquick-private 3dcore-private 3drender-private
CONFIG -= precompile_header
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
+
gcov {
CONFIG += static
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
diff --git a/src/render/backend/abstractrenderer_p.h b/src/render/backend/abstractrenderer_p.h
index 78637eb89..e7f8857bc 100644
--- a/src/render/backend/abstractrenderer_p.h
+++ b/src/render/backend/abstractrenderer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,6 +50,7 @@
// We mean it.
//
+#include <QtCore/qflags.h>
#include <Qt3DRender/private/qt3drender_global_p.h>
#include <Qt3DCore/qaspectjob.h>
#include <Qt3DCore/qnodeid.h>
@@ -54,6 +58,7 @@
QT_BEGIN_NAMESPACE
class QSurface;
+class QSize;
namespace Qt3DCore {
class QAbstractFrameAdvanceService;
@@ -72,6 +77,9 @@ namespace Render {
class NodeManagers;
class Entity;
class FrameGraphNode;
+class RenderSettings;
+class BackendNode;
+
class QT3DRENDERSHARED_PRIVATE_EXPORT AbstractRenderer
{
@@ -82,22 +90,33 @@ public:
OpenGL
};
+ // Changes made to backend nodes are reported to the Renderer
+ enum BackendNodeDirtyFlag {
+ TransformDirty = 1 << 0,
+ MaterialDirty = 1 << 1,
+ GeometryDirty = 1 << 2,
+ ComputeDirty = 1 << 3,
+ AllDirty = 1 << 15
+ };
+ Q_DECLARE_FLAGS(BackendNodeDirtySet, BackendNodeDirtyFlag)
+
+ virtual void dumpInfo() const = 0;
+
virtual API api() const = 0;
virtual qint64 time() const = 0;
virtual void setTime(qint64 time) = 0;
- virtual void setSurface(QSurface *surface) = 0;
virtual void setNodeManagers(NodeManagers *managers) = 0;
virtual void setServices(Qt3DCore::QServiceLocator *services) = 0;
virtual void setSurfaceExposed(bool exposed) = 0;
- virtual QSurface *surface() const = 0;
virtual NodeManagers *nodeManagers() const = 0;
virtual Qt3DCore::QServiceLocator *services() const = 0;
virtual void initialize() = 0;
virtual void shutdown() = 0;
+ virtual void releaseGraphicsResources() = 0;
virtual void createAllocators(Qt3DCore::QAbstractAspectJobManager *jobManager) = 0;
virtual void destroyAllocators(Qt3DCore::QAbstractAspectJobManager *jobManager) = 0;
@@ -108,10 +127,15 @@ public:
virtual bool isRunning() const = 0;
+ virtual void markDirty(BackendNodeDirtySet changes, BackendNode *node) = 0;
+ virtual BackendNodeDirtySet dirtyBits() = 0;
+ virtual void clearDirtyBits(BackendNodeDirtySet changes) = 0;
+ virtual bool shouldRender() = 0;
+ virtual void skipNextFrame() = 0;
+
virtual QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() = 0;
virtual Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() = 0;
- virtual void setFrameGraphRoot(const Qt3DCore::QNodeId fgRootId) = 0;
virtual void setSceneRoot(Qt3DCore::QBackendNodeFactory *factory, Entity *root) = 0;
virtual Entity *sceneRoot() const = 0;
@@ -120,8 +144,12 @@ public:
virtual Qt3DCore::QAbstractFrameAdvanceService *frameAdvanceService() const = 0;
virtual void registerEventFilter(Qt3DCore::QEventFilterService *service) = 0;
+ virtual void setSettings(RenderSettings *settings) = 0;
+ virtual RenderSettings *settings() const = 0;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractRenderer::BackendNodeDirtySet)
+
} // Render
} // Qt3DRender
diff --git a/src/render/backend/attachmentpack.cpp b/src/render/backend/attachmentpack.cpp
index 705240104..d2bb5ee9a 100644
--- a/src/render/backend/attachmentpack.cpp
+++ b/src/render/backend/attachmentpack.cpp
@@ -1,81 +1,93 @@
/****************************************************************************
**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "attachmentpack_p.h"
+#include <Qt3DRender/private/rendertarget_p.h>
+#include <Qt3DRender/private/rendertargetselectornode_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-
namespace Render {
AttachmentPack::AttachmentPack()
{
}
-void AttachmentPack::addAttachment(const Attachment &attachment)
+AttachmentPack::AttachmentPack(const RenderTargetSelector *selector, const RenderTarget *target, AttachmentManager *attachmentManager)
{
- m_attachments.append(attachment);
-}
+ // Cache draw buffers list
+ const QVector<QRenderTargetOutput::AttachmentPoint> selectedAttachmentPoints = selector->outputs();
-QVector<Attachment> AttachmentPack::attachments() const
-{
- return m_attachments;
-}
+ // Copy attachments
+ const auto outputIds = target->renderOutputs();
+ for (Qt3DCore::QNodeId outputId : outputIds) {
+ const RenderTargetOutput *output = attachmentManager->lookupResource(outputId);
+ if (output)
+ m_attachments.append(output->attachment());
+ }
-QList<QRenderAttachment::RenderAttachmentType> AttachmentPack::drawBuffers() const
-{
- return m_drawBuffers;
-}
+ // Create actual DrawBuffers list that is used for glDrawBuffers
-void AttachmentPack::setDrawBuffers(const QList<QRenderAttachment::RenderAttachmentType> &drawBuffers)
-{
- m_drawBuffers = drawBuffers;
+ // If nothing is specified, use all the attachments as draw buffers
+ if (selectedAttachmentPoints.isEmpty()) {
+ for (const Attachment &attachment : qAsConst(m_attachments))
+ // only consider Color Attachments
+ if (attachment.m_point <= QRenderTargetOutput::Color15)
+ m_drawBuffers.push_back((int) attachment.m_point);
+ } else {
+ for (QRenderTargetOutput::AttachmentPoint drawBuffer : selectedAttachmentPoints)
+ if (drawBuffer <= QRenderTargetOutput::Color15)
+ m_drawBuffers.push_back((int) drawBuffer);
+ }
}
-Attachment::Attachment()
- : m_mipLevel(0)
- , m_layer(0)
- , m_type(QRenderAttachment::ColorAttachment0)
- , m_face(QRenderAttachment::CubeMapNegativeX)
+// return index of given attachment within actual draw buffers list
+int AttachmentPack::getDrawBufferIndex(QRenderTargetOutput::AttachmentPoint attachmentPoint) const
{
+ for (int i = 0; i < m_drawBuffers.size(); i++)
+ if (m_drawBuffers.at(i) == (int)attachmentPoint)
+ return i;
+ return -1;
}
} // namespace Render
-
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/backend/attachmentpack_p.h b/src/render/backend/attachmentpack_p.h
index 317e86ae9..98362149a 100644
--- a/src/render/backend/attachmentpack_p.h
+++ b/src/render/backend/attachmentpack_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DRender/qrenderattachment.h>
+#include <Qt3DRender/qrendertargetoutput.h>
#include <QVector>
QT_BEGIN_NAMESPACE
@@ -58,29 +61,40 @@ namespace Render {
struct Attachment
{
- Attachment();
+ Attachment()
+ : m_mipLevel(0)
+ , m_layer(0)
+ , m_point(QRenderTargetOutput::Color0)
+ , m_face(QAbstractTexture::CubeMapNegativeX)
+ {}
+
QString m_name;
int m_mipLevel;
int m_layer;
Qt3DCore::QNodeId m_textureUuid;
- QRenderAttachment::RenderAttachmentType m_type;
- QRenderAttachment::CubeMapFace m_face;
+ QRenderTargetOutput::AttachmentPoint m_point;
+ QAbstractTexture::CubeMapFace m_face;
};
+class RenderTarget;
+class RenderTargetSelector;
+class AttachmentManager;
+
class AttachmentPack
{
public:
AttachmentPack();
+ AttachmentPack(const RenderTargetSelector *selector, const RenderTarget *target, AttachmentManager *attachmentManager);
- void addAttachment(const Attachment &attachment);
- QVector<Attachment> attachments() const;
- QList<QRenderAttachment::RenderAttachmentType> drawBuffers() const;
+ QVector<Attachment> attachments() const { return m_attachments; }
+ QVector<int> getGlDrawBuffers() const { return m_drawBuffers; }
- void setDrawBuffers(const QList<QRenderAttachment::RenderAttachmentType> &drawBuffers);
+ // return index of given attachment within actual draw buffers list
+ int getDrawBufferIndex(QRenderTargetOutput::AttachmentPoint attachmentPoint) const;
private:
QVector<Attachment> m_attachments;
- QList<QRenderAttachment::RenderAttachmentType> m_drawBuffers;
+ QVector<int> m_drawBuffers;
};
} // namespace Render
diff --git a/src/render/backend/backendnode.cpp b/src/render/backend/backendnode.cpp
new file mode 100644
index 000000000..7054db6a4
--- /dev/null
+++ b/src/render/backend/backendnode.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "backendnode_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+BackendNode::BackendNode(Mode mode)
+ : QBackendNode(mode)
+ , m_renderer(nullptr)
+{
+}
+
+BackendNode::~BackendNode()
+{
+}
+
+void BackendNode::setRenderer(AbstractRenderer *renderer)
+{
+ m_renderer = renderer;
+}
+
+void BackendNode::markDirty(AbstractRenderer::BackendNodeDirtySet changes)
+{
+ Q_ASSERT(m_renderer);
+ m_renderer->markDirty(changes, this);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/backend/backendnode_p.h b/src/render/backend/backendnode_p.h
new file mode 100644
index 000000000..5688c2412
--- /dev/null
+++ b/src/render/backend/backendnode_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_BACKENDNODE_H
+#define QT3DRENDER_RENDER_BACKENDNODE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRender/private/abstractrenderer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class Q_AUTOTEST_EXPORT BackendNode : public Qt3DCore::QBackendNode
+{
+public:
+ BackendNode(Qt3DCore::QBackendNode::Mode mode = ReadOnly);
+ ~BackendNode();
+
+ void setRenderer(AbstractRenderer *renderer);
+
+protected:
+ void markDirty(AbstractRenderer::BackendNodeDirtySet changes);
+ AbstractRenderer *m_renderer;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_BACKENDNODE_H
diff --git a/src/render/backend/boundingvolumedebug.cpp b/src/render/backend/boundingvolumedebug.cpp
index 57b57baa0..4ae3b2933 100644
--- a/src/render/backend/boundingvolumedebug.cpp
+++ b/src/render/backend/boundingvolumedebug.cpp
@@ -1,42 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-
+#if 0
#include "boundingvolumedebug_p.h"
-#include <Qt3DRender/qboundingvolumedebug.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
+#include <Qt3DRender/private/qboundingvolumedebug_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +48,7 @@ namespace Qt3DRender {
namespace Render {
BoundingVolumeDebug::BoundingVolumeDebug()
- : QBackendNode(QBackendNode::ReadWrite)
+ : BackendNode(QBackendNode::ReadWrite)
, m_recursive(false)
, m_radius(0.0f)
{
@@ -72,13 +75,14 @@ void BoundingVolumeDebug::updateFromPeer(Qt3DCore::QNode *peer)
void BoundingVolumeDebug::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- const Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
+ const Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
const QByteArray propertyName = propertyChange->propertyName();
- if (propertyChange->type() == Qt3DCore::NodeUpdated) {
+ if (propertyChange->type() == Qt3DCore::PropertyUpdated) {
if (propertyName == QByteArrayLiteral("recursive")) {
m_recursive = propertyChange->value().toBool();
}
+ markDirty(AbstractRenderer::AllDirty);
}
}
@@ -86,9 +90,10 @@ void BoundingVolumeDebug::setRadius(float radius)
{
if (m_radius != radius) {
m_radius = radius;
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerdId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("radius");
- e->setTargetNode(peerUuid());
+ e->setTargetNode(peerId());
e->setValue(QVariant(radius));
notifyObservers(e);
}
@@ -98,9 +103,10 @@ void BoundingVolumeDebug::setCenter(const QVector3D &center)
{
if (m_center != center) {
m_center = center;
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerdId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("center");
- e->setTargetNode(peerUuid());
+ e->setTargetNode(peerId());
e->setValue(QVariant::fromValue(center));
notifyObservers(e);
}
@@ -111,3 +117,5 @@ void BoundingVolumeDebug::setCenter(const QVector3D &center)
} // Qt3DRender
QT_END_NAMESPACE
+
+#endif
diff --git a/src/render/backend/boundingvolumedebug_p.h b/src/render/backend/boundingvolumedebug_p.h
index b7370d13e..f7a1903e9 100644
--- a/src/render/backend/boundingvolumedebug_p.h
+++ b/src/render/backend/boundingvolumedebug_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,9 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
+#if 0
+
+#include <Qt3DRender/private/backendnode_p.h>
#include <QVector3D>
QT_BEGIN_NAMESPACE
@@ -57,7 +62,7 @@ namespace Qt3DRender {
namespace Render {
-class Q_AUTOTEST_EXPORT BoundingVolumeDebug : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT BoundingVolumeDebug : public BackendNode
{
public:
BoundingVolumeDebug();
@@ -86,4 +91,6 @@ private:
QT_END_NAMESPACE
+#endif
+
#endif // QT3DRENDER_RENDER_BOUNDINGVOLUMEDEBUG_H
diff --git a/src/render/backend/cameralens.cpp b/src/render/backend/cameralens.cpp
index 3d039f298..e60a32422 100644
--- a/src/render/backend/cameralens.cpp
+++ b/src/render/backend/cameralens.cpp
@@ -1,46 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "cameralens_p.h"
+#include <Qt3DRender/qcameralens.h>
+#include <Qt3DRender/private/qcameralens_p.h>
#include <Qt3DRender/private/renderlogging_p.h>
-
-#include <Qt3DCore/qtransform.h>
-#include <Qt3DCore/qcameralens.h>
#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qtransform.h>
QT_BEGIN_NAMESPACE
@@ -50,9 +53,8 @@ namespace Qt3DRender {
namespace Render {
CameraLens::CameraLens()
- : QBackendNode()
+ : BackendNode()
{
- m_clearColor = QVector4D(0.5, 0.5, 1.0, 1.0);
}
CameraLens::~CameraLens()
@@ -62,14 +64,14 @@ CameraLens::~CameraLens()
void CameraLens::cleanup()
{
-
+ QBackendNode::setEnabled(false);
}
-void CameraLens::updateFromPeer(Qt3DCore::QNode *peer)
+void CameraLens::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QCameraLens *lens = static_cast<QCameraLens *>(peer);
- setProjection(lens->projectionMatrix());
- m_enabled = lens->isEnabled();
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QCameraLensData>>(change);
+ const auto &data = typedChange->data;
+ m_projection = data.projectionMatrix;
}
void CameraLens::setProjection(const QMatrix4x4 &projection)
@@ -80,21 +82,22 @@ void CameraLens::setProjection(const QMatrix4x4 &projection)
void CameraLens::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
switch (e->type()) {
- case NodeUpdated: {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ case PropertyUpdated: {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("projectionMatrix")) {
QMatrix4x4 projectionMatrix = propertyChange->value().value<QMatrix4x4>();
m_projection = projectionMatrix;
- } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().toBool();
}
+
+ markDirty(AbstractRenderer::AllDirty);
}
break;
default:
break;
}
+ BackendNode::sceneChangeEvent(e);
}
} // namespace Render
diff --git a/src/render/backend/cameralens_p.h b/src/render/backend/cameralens_p.h
index b997db679..e5268da53 100644
--- a/src/render/backend/cameralens_p.h
+++ b/src/render/backend/cameralens_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRender/private/backendnode_p.h>
#include <QMatrix4x4>
#include <QRectF>
@@ -60,29 +63,22 @@ namespace Render {
class CameraManager;
-class CameraLens : public Qt3DCore::QBackendNode
+class CameraLens : public BackendNode
{
public:
CameraLens();
~CameraLens();
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
- void setClearColor();
- QVector4D clearColor() const { return m_clearColor; }
-
void setProjection(const QMatrix4x4 &projection);
inline QMatrix4x4 projection() const { return m_projection; }
- inline bool isEnabled() const { return m_enabled; }
-
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
- QVector4D m_clearColor;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QMatrix4x4 m_projection;
- bool m_enabled;
};
} // namespace Render
diff --git a/src/render/backend/computecommand.cpp b/src/render/backend/computecommand.cpp
new file mode 100644
index 000000000..2b23df9aa
--- /dev/null
+++ b/src/render/backend/computecommand.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "computecommand_p.h"
+#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DRender/qcomputecommand.h>
+#include <Qt3DRender/private/qcomputecommand_p.h>
+#include <Qt3DRender/private/abstractrenderer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+ComputeCommand::ComputeCommand()
+ : BackendNode(ReadOnly)
+{
+ m_workGroups[0] = 1;
+ m_workGroups[1] = 1;
+ m_workGroups[2] = 1;
+}
+
+ComputeCommand::~ComputeCommand()
+{
+}
+
+void ComputeCommand::cleanup()
+{
+ QBackendNode::setEnabled(false);
+ m_workGroups[0] = 1;
+ m_workGroups[1] = 1;
+ m_workGroups[2] = 1;
+}
+
+void ComputeCommand::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QComputeCommandData>>(change);
+ const auto &data = typedChange->data;
+ m_workGroups[0] = data.workGroupX;
+ m_workGroups[1] = data.workGroupY;
+ m_workGroups[2] = data.workGroupZ;
+ if (m_renderer != nullptr)
+ BackendNode::markDirty(AbstractRenderer::ComputeDirty);
+}
+
+void ComputeCommand::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ if (propertyChange->propertyName() == QByteArrayLiteral("workGroupX"))
+ m_workGroups[0] = propertyChange->value().toInt();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupY"))
+ m_workGroups[1] = propertyChange->value().toInt();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupZ"))
+ m_workGroups[2] = propertyChange->value().toInt();
+ markDirty(AbstractRenderer::AllDirty);
+ }
+ BackendNode::sceneChangeEvent(e);
+}
+
+} // Render
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/backend/computecommand_p.h b/src/render/backend/computecommand_p.h
new file mode 100644
index 000000000..c50354d37
--- /dev/null
+++ b/src/render/backend/computecommand_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_COMPUTECOMMAND_P_H
+#define QT3DRENDER_RENDER_COMPUTECOMMAND_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/backendnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class ComputeJobPrivate;
+
+class Q_AUTOTEST_EXPORT ComputeCommand : public BackendNode
+{
+public:
+ ComputeCommand();
+ ~ComputeCommand();
+
+ void cleanup();
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ inline int x() const Q_DECL_NOEXCEPT { return m_workGroups[0]; }
+ inline int y() const Q_DECL_NOEXCEPT { return m_workGroups[1]; }
+ inline int z() const Q_DECL_NOEXCEPT { return m_workGroups[2]; }
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_OVERRIDE;
+ int m_workGroups[3];
+};
+
+} // Render
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_COMPUTECOMMAND_P_H
diff --git a/src/render/backend/entity.cpp b/src/render/backend/entity.cpp
index 745e54735..dc7726eec 100644
--- a/src/render/backend/entity.cpp
+++ b/src/render/backend/entity.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#include "entity_p.h"
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
-#include <Qt3DRender/qlight.h>
+#include <Qt3DRender/qabstractlight.h>
#include <Qt3DRender/qlayer.h>
#include <Qt3DRender/qmaterial.h>
#include <Qt3DRender/qmesh.h>
@@ -46,12 +49,15 @@
#include <Qt3DRender/qshaderdata.h>
#include <Qt3DRender/qgeometryrenderer.h>
#include <Qt3DRender/qobjectpicker.h>
-#include <Qt3DRender/qboundingvolumedebug.h>
+#include <Qt3DRender/qcomputecommand.h>
+#include <Qt3DRender/private/qboundingvolumedebug_p.h>
#include <Qt3DRender/private/geometryrenderermanager_p.h>
-#include <Qt3DCore/qcameralens.h>
+#include <Qt3DRender/qcameralens.h>
+#include <Qt3DCore/qcomponentaddedchange.h>
+#include <Qt3DCore/qcomponentremovedchange.h>
#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/qtransform.h>
#include <Qt3DCore/private/qentity_p.h>
@@ -66,9 +72,8 @@ namespace Qt3DRender {
namespace Render {
Entity::Entity()
- : QBackendNode()
- , m_nodeManagers(Q_NULLPTR)
- , m_enabled(true)
+ : BackendNode()
+ , m_nodeManagers(nullptr)
, m_boundingDirty(false)
{
}
@@ -80,22 +85,22 @@ Entity::~Entity()
void Entity::cleanup()
{
- if (m_nodeManagers != Q_NULLPTR) {
+ if (m_nodeManagers != nullptr) {
Entity *parentEntity = parent();
- if (parentEntity != Q_NULLPTR)
+ if (parentEntity != nullptr)
parentEntity->removeChildHandle(m_handle);
for (int i = 0; i < m_childrenHandles.size(); i++)
m_nodeManagers->renderNodesManager()->release(m_childrenHandles[i]);
- // We need to release using peerUuid otherwise the handle will be cleared
+ // We need to release using peerId otherwise the handle will be cleared
// but would still remain in the Id to Handle table
- m_nodeManagers->worldMatrixManager()->releaseResource(peerUuid());
+ m_nodeManagers->worldMatrixManager()->releaseResource(peerId());
qCDebug(Render::RenderNodes) << Q_FUNC_INFO;
}
m_worldTransform = HMatrix();
// Release all component will have to perform their own release when they receive the
- // NodeDeleted/NodeAboutToBeDeleted notification
+ // NodeDeleted notification
// Clear components
m_transformComponent = Qt3DCore::QNodeId();
m_cameraComponent = Qt3DCore::QNodeId();
@@ -103,14 +108,15 @@ void Entity::cleanup()
m_geometryRendererComponent = Qt3DCore::QNodeId();
m_objectPickerComponent = QNodeId();
m_boundingVolumeDebugComponent = QNodeId();
+ m_computeComponent = QNodeId();
m_layerComponents.clear();
m_shaderDataComponents.clear();
m_lightComponents.clear();
m_localBoundingVolume.reset();
m_worldBoundingVolume.reset();
m_worldBoundingVolumeWithChildren.reset();
- m_enabled = true;
m_boundingDirty = false;
+ QBackendNode::setEnabled(false);
}
void Entity::setParentHandle(HEntity parentHandle)
@@ -118,11 +124,11 @@ void Entity::setParentHandle(HEntity parentHandle)
Q_ASSERT(m_nodeManagers);
// Remove ourselves from previous parent children list
Entity *parent = m_nodeManagers->renderNodesManager()->data(parentHandle);
- if (parent != Q_NULLPTR && parent->m_childrenHandles.contains(m_handle))
+ if (parent != nullptr && parent->m_childrenHandles.contains(m_handle))
parent->m_childrenHandles.remove(m_handle);
m_parentHandle = parentHandle;
parent = m_nodeManagers->renderNodesManager()->data(parentHandle);
- if (parent != Q_NULLPTR && !parent->m_childrenHandles.contains(m_handle))
+ if (parent != nullptr && !parent->m_childrenHandles.contains(m_handle))
parent->m_childrenHandles.append(m_handle);
}
@@ -136,16 +142,21 @@ void Entity::setHandle(HEntity handle)
m_handle = handle;
}
-void Entity::updateFromPeer(Qt3DCore::QNode *peer)
+void Entity::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
{
- QEntity *entity = static_cast<QEntity *>(peer);
- QEntityPrivate *entityPrivate = static_cast<QEntityPrivate *>(QNodePrivate::get(entity));
- const QNodeId parentEntityId = entityPrivate->parentEntityId();
+ const auto typedChange = qSharedPointerCast<QNodeCreatedChange<Qt3DCore::QEntityData>>(change);
+ const auto &data = typedChange->data;
- m_objectName = peer->objectName();
- m_worldTransform = m_nodeManagers->worldMatrixManager()->getOrAcquireHandle(peerUuid());
+ // Note this is *not* the parentId as that is the ID of the parent QNode, which is not
+ // necessarily the same as the parent QEntity (which may be further up the tree).
+ const QNodeId parentEntityId = data.parentEntityId;
+ qCDebug(Render::RenderNodes) << "Creating Entity id =" << peerId() << "parentId =" << parentEntityId;
- // TO DO: Suboptimal -> Maybe have a Hash<QComponent, QEntityList> instead
+ // TODO: Store string id instead and only in debug mode
+ //m_objectName = peer->objectName();
+ m_worldTransform = m_nodeManagers->worldMatrixManager()->getOrAcquireHandle(peerId());
+
+ // TODO: Suboptimal -> Maybe have a Hash<QComponent, QEntityList> instead
m_transformComponent = QNodeId();
m_materialComponent = QNodeId();
m_cameraComponent = QNodeId();
@@ -155,51 +166,43 @@ void Entity::updateFromPeer(Qt3DCore::QNode *peer)
m_layerComponents.clear();
m_shaderDataComponents.clear();
m_lightComponents.clear();
- m_localBoundingVolume.reset(new Sphere(peerUuid()));
- m_worldBoundingVolume.reset(new Sphere(peerUuid()));
- m_worldBoundingVolumeWithChildren.reset(new Sphere(peerUuid()));
+ m_localBoundingVolume.reset(new Sphere(peerId()));
+ m_worldBoundingVolume.reset(new Sphere(peerId()));
+ m_worldBoundingVolumeWithChildren.reset(new Sphere(peerId()));
- Q_FOREACH (QComponent *comp, entity->components())
- addComponent(comp);
+ for (const auto &idAndType : qAsConst(data.componentIdsAndTypes))
+ addComponent(idAndType);
- if (!parentEntityId.isNull()) {
+ if (!parentEntityId.isNull())
setParentHandle(m_nodeManagers->renderNodesManager()->lookupHandle(parentEntityId));
- } else {
- qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "No parent entity found for Entity" << peerUuid();
- }
-
- m_enabled = entity->isEnabled();
+ else
+ qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "No parent entity found for Entity" << peerId();
}
void Entity::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
switch (e->type()) {
case ComponentAdded: {
- QNodePtr nodePtr = propertyChange->value().value<QNodePtr>();
- QComponent *component = qobject_cast<QComponent *>(nodePtr.data());
- qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "Component Added" << m_objectName << component->objectName();
- addComponent(component);
+ QComponentAddedChangePtr change = qSharedPointerCast<QComponentAddedChange>(e);
+ const auto componentIdAndType = QNodeIdTypePair(change->componentId(), change->componentMetaObject());
+ addComponent(componentIdAndType);
+ qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "Component Added. Id =" << change->componentId();
break;
}
case ComponentRemoved: {
- QNodeId nodeId = propertyChange->value().value<QNodeId>();
- qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "Component Removed";
- removeComponent(nodeId);
- break;
- }
-
- case NodeUpdated: {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- m_enabled = propertyChange->value().value<bool>();
+ QComponentRemovedChangePtr change = qSharedPointerCast<QComponentRemovedChange>(e);
+ removeComponent(change->componentId());
+ qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "Component Removed. Id =" << change->componentId();
break;
}
default:
break;
}
+ markDirty(AbstractRenderer::AllDirty);
+ BackendNode::sceneChangeEvent(e);
}
void Entity::dump() const
@@ -207,7 +210,8 @@ void Entity::dump() const
static int depth = 0;
QString indent(2 * depth++, QChar::fromLatin1(' '));
qCDebug(Backend) << indent + m_objectName;
- foreach (const Entity *child, children())
+ const auto children_ = children();
+ for (const Entity *child : children_)
child->dump();
--depth;
}
@@ -222,7 +226,7 @@ void Entity::appendChildHandle(HEntity childHandle)
if (!m_childrenHandles.contains(childHandle)) {
m_childrenHandles.append(childHandle);
Entity *child = m_nodeManagers->renderNodesManager()->data(childHandle);
- if (child != Q_NULLPTR)
+ if (child != nullptr)
child->m_parentHandle = m_handle;
}
}
@@ -239,9 +243,9 @@ QVector<Entity *> Entity::children() const
{
QVector<Entity *> childrenVector;
childrenVector.reserve(m_childrenHandles.size());
- foreach (HEntity handle, m_childrenHandles) {
+ for (HEntity handle : m_childrenHandles) {
Entity *child = m_nodeManagers->renderNodesManager()->data(handle);
- if (child != Q_NULLPTR)
+ if (child != nullptr)
childrenVector.append(child);
}
return childrenVector;
@@ -262,29 +266,62 @@ void Entity::addComponent(Qt3DCore::QComponent *component)
// The backend element is always created when this method is called
// If that's not the case something has gone wrong
- if (qobject_cast<Qt3DCore::QTransform*>(component) != Q_NULLPTR) {
+ if (qobject_cast<Qt3DCore::QTransform*>(component) != nullptr) {
m_transformComponent = component->id();
- } else if (qobject_cast<QCameraLens *>(component) != Q_NULLPTR) {
+ } else if (qobject_cast<QCameraLens *>(component) != nullptr) {
m_cameraComponent = component->id();
- } else if (qobject_cast<QLayer *>(component) != Q_NULLPTR) {
+ } else if (qobject_cast<QLayer *>(component) != nullptr) {
m_layerComponents.append(component->id());
- } else if (qobject_cast<QMaterial *>(component) != Q_NULLPTR) {
+ } else if (qobject_cast<QMaterial *>(component) != nullptr) {
m_materialComponent = component->id();
- } else if (qobject_cast<QLight *>(component) != Q_NULLPTR) { // QLight subclasses QShaderData
+ } else if (qobject_cast<QAbstractLight *>(component) != nullptr) {
m_lightComponents.append(component->id());
- } else if (qobject_cast<QShaderData *>(component) != Q_NULLPTR) {
+ } else if (qobject_cast<QShaderData *>(component) != nullptr) {
m_shaderDataComponents.append(component->id());
- } else if (qobject_cast<QGeometryRenderer *>(component) != Q_NULLPTR) {
+ } else if (qobject_cast<QGeometryRenderer *>(component) != nullptr) {
m_geometryRendererComponent = component->id();
m_boundingDirty = true;
- } else if (qobject_cast<QObjectPicker *>(component) != Q_NULLPTR) {
+ } else if (qobject_cast<QObjectPicker *>(component) != nullptr) {
m_objectPickerComponent = component->id();
- } else if (qobject_cast<QBoundingVolumeDebug *>(component) != Q_NULLPTR) {
- m_boundingVolumeDebugComponent = component->id();
+// } else if (qobject_cast<QBoundingVolumeDebug *>(component) != nullptr) {
+// m_boundingVolumeDebugComponent = component->id();
+ } else if (qobject_cast<QComputeCommand *>(component) != nullptr) {
+ m_computeComponent = component->id();
}
}
-void Entity::removeComponent(const Qt3DCore::QNodeId &nodeId)
+void Entity::addComponent(Qt3DCore::QNodeIdTypePair idAndType)
+{
+ // The backend element is always created when this method is called
+ // If that's not the case something has gone wrong
+ const auto type = idAndType.type;
+ const auto id = idAndType.id;
+ qCDebug(Render::RenderNodes) << Q_FUNC_INFO << "id =" << id << type->className();
+ if (type->inherits(&Qt3DCore::QTransform::staticMetaObject)) {
+ m_transformComponent = id;
+ } else if (type->inherits(&QCameraLens::staticMetaObject)) {
+ m_cameraComponent = id;
+ } else if (type->inherits(&QLayer::staticMetaObject)) {
+ m_layerComponents.append(id);
+ } else if (type->inherits(&QMaterial::staticMetaObject)) {
+ m_materialComponent = id;
+ } else if (type->inherits(&QAbstractLight::staticMetaObject)) { // QAbstractLight subclasses QShaderData
+ m_lightComponents.append(id);
+ } else if (type->inherits(&QShaderData::staticMetaObject)) {
+ m_shaderDataComponents.append(id);
+ } else if (type->inherits(&QGeometryRenderer::staticMetaObject)) {
+ m_geometryRendererComponent = id;
+ m_boundingDirty = true;
+ } else if (type->inherits(&QObjectPicker::staticMetaObject)) {
+ m_objectPickerComponent = id;
+// } else if (type->inherits(&QBoundingVolumeDebug::staticMetaObject)) {
+// m_boundingVolumeDebugComponent = id;
+ } else if (type->inherits(&QComputeCommand::staticMetaObject)) {
+ m_computeComponent = id;
+ }
+}
+
+void Entity::removeComponent(Qt3DCore::QNodeId nodeId)
{
if (m_transformComponent == nodeId) {
m_transformComponent = QNodeId();
@@ -301,23 +338,15 @@ void Entity::removeComponent(const Qt3DCore::QNodeId &nodeId)
m_boundingDirty = true;
} else if (m_objectPickerComponent == nodeId) {
m_objectPickerComponent = QNodeId();
- } else if (m_boundingVolumeDebugComponent == nodeId) {
- m_boundingVolumeDebugComponent = QNodeId();
+// } else if (m_boundingVolumeDebugComponent == nodeId) {
+// m_boundingVolumeDebugComponent = QNodeId();
} else if (m_lightComponents.contains(nodeId)) {
m_lightComponents.removeAll(nodeId);
+ } else if (m_computeComponent == nodeId) {
+ m_computeComponent = QNodeId();
}
}
-bool Entity::isEnabled() const
-{
- return m_enabled;
-}
-
-void Entity::setEnabled(bool isEnabled)
-{
- m_enabled = isEnabled;
-}
-
bool Entity::isBoundingVolumeDirty() const
{
return m_boundingDirty;
@@ -365,7 +394,7 @@ QList<HLayer> Entity::componentsHandle<Layer>() const
{
QList<HLayer> layerHandles;
layerHandles.reserve(m_layerComponents.size());
- Q_FOREACH (const QNodeId &id, m_layerComponents)
+ for (QNodeId id : m_layerComponents)
layerHandles.append(m_nodeManagers->layerManager()->lookupHandle(id));
return layerHandles;
}
@@ -375,27 +404,33 @@ QList<HShaderData> Entity::componentsHandle<ShaderData>() const
{
QList<HShaderData> shaderDataHandles;
shaderDataHandles.reserve(m_shaderDataComponents.size());
- Q_FOREACH (const QNodeId &id, m_shaderDataComponents)
+ for (QNodeId id : m_shaderDataComponents)
shaderDataHandles.append(m_nodeManagers->shaderDataManager()->lookupHandle(id));
return shaderDataHandles;
}
-template<>
-HBoundingVolumeDebug Entity::componentHandle<BoundingVolumeDebug>() const
-{
- return m_nodeManagers->boundingVolumeDebugManager()->lookupHandle(m_boundingVolumeDebugComponent);
-}
+//template<>
+//HBoundingVolumeDebug Entity::componentHandle<BoundingVolumeDebug>() const
+//{
+// return m_nodeManagers->boundingVolumeDebugManager()->lookupHandle(m_boundingVolumeDebugComponent);
+//}
template<>
QList<HLight> Entity::componentsHandle<Light>() const
{
QList<HLight> lightHandles;
lightHandles.reserve(m_lightComponents.size());
- Q_FOREACH (const QNodeId &id, m_lightComponents)
+ for (QNodeId id : m_lightComponents)
lightHandles.append(m_nodeManagers->lightManager()->lookupHandle(id));
return lightHandles;
}
+template<>
+HComputeCommand Entity::componentHandle<ComputeCommand>() const
+{
+ return m_nodeManagers->computeJobManager()->lookupHandle(m_computeComponent);
+}
+
// Render components
template<>
@@ -433,7 +468,7 @@ QList<Layer *> Entity::renderComponents<Layer>() const
{
QList<Layer *> layers;
layers.reserve(m_layerComponents.size());
- Q_FOREACH (const QNodeId &id, m_layerComponents)
+ for (QNodeId id : m_layerComponents)
layers.append(m_nodeManagers->layerManager()->lookupResource(id));
return layers;
}
@@ -443,7 +478,7 @@ QList<ShaderData *> Entity::renderComponents<ShaderData>() const
{
QList<ShaderData *> shaderDatas;
shaderDatas.reserve(m_shaderDataComponents.size());
- Q_FOREACH (const QNodeId &id, m_shaderDataComponents)
+ for (QNodeId id : m_shaderDataComponents)
shaderDatas.append(m_nodeManagers->shaderDataManager()->lookupResource(id));
return shaderDatas;
}
@@ -453,15 +488,21 @@ QList<Light *> Entity::renderComponents<Light>() const
{
QList<Light *> lights;
lights.reserve(m_lightComponents.size());
- Q_FOREACH (const QNodeId &id, m_lightComponents)
+ for (QNodeId id : m_lightComponents)
lights.append(m_nodeManagers->lightManager()->lookupResource(id));
return lights;
}
+//template<>
+//BoundingVolumeDebug *Entity::renderComponent<BoundingVolumeDebug>() const
+//{
+// return m_nodeManagers->boundingVolumeDebugManager()->lookupResource(m_boundingVolumeDebugComponent);
+//}
+
template<>
-BoundingVolumeDebug *Entity::renderComponent<BoundingVolumeDebug>() const
+ComputeCommand *Entity::renderComponent<ComputeCommand>() const
{
- return m_nodeManagers->boundingVolumeDebugManager()->lookupResource(m_boundingVolumeDebugComponent);
+ return m_nodeManagers->computeJobManager()->lookupResource(m_computeComponent);
}
// Uuid
@@ -476,10 +517,10 @@ template<>
Qt3DCore::QNodeId Entity::componentUuid<Material>() const { return m_materialComponent; }
template<>
-QList<Qt3DCore::QNodeId> Entity::componentsUuid<Layer>() const { return m_layerComponents; }
+QVector<Qt3DCore::QNodeId> Entity::componentsUuid<Layer>() const { return m_layerComponents; }
template<>
-QList<Qt3DCore::QNodeId> Entity::componentsUuid<ShaderData>() const { return m_shaderDataComponents; }
+QVector<Qt3DCore::QNodeId> Entity::componentsUuid<ShaderData>() const { return m_shaderDataComponents; }
template<>
Qt3DCore::QNodeId Entity::componentUuid<GeometryRenderer>() const { return m_geometryRendererComponent; }
@@ -491,30 +532,33 @@ template<>
QNodeId Entity::componentUuid<BoundingVolumeDebug>() const { return m_boundingVolumeDebugComponent; }
template<>
-QList<Qt3DCore::QNodeId> Entity::componentsUuid<Light>() const { return m_lightComponents; }
+QNodeId Entity::componentUuid<ComputeCommand>() const { return m_computeComponent; }
+
+template<>
+QVector<Qt3DCore::QNodeId> Entity::componentsUuid<Light>() const { return m_lightComponents; }
-RenderEntityFunctor::RenderEntityFunctor(NodeManagers *manager)
+RenderEntityFunctor::RenderEntityFunctor(AbstractRenderer *renderer, NodeManagers *manager)
: m_nodeManagers(manager)
+ , m_renderer(renderer)
{
}
-Qt3DCore::QBackendNode *RenderEntityFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *RenderEntityFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- HEntity renderNodeHandle = m_nodeManagers->renderNodesManager()->getOrAcquireHandle(frontend->id());
+ HEntity renderNodeHandle = m_nodeManagers->renderNodesManager()->getOrAcquireHandle(change->subjectId());
Entity *entity = m_nodeManagers->renderNodesManager()->data(renderNodeHandle);
- entity->setFactory(factory);
entity->setNodeManagers(m_nodeManagers);
entity->setHandle(renderNodeHandle);
- entity->setPeer(frontend);
+ entity->setRenderer(m_renderer);
return entity;
}
-Qt3DCore::QBackendNode *RenderEntityFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *RenderEntityFunctor::get(Qt3DCore::QNodeId id) const
{
return m_nodeManagers->renderNodesManager()->lookupResource(id);
}
-void RenderEntityFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void RenderEntityFunctor::destroy(Qt3DCore::QNodeId id) const
{
m_nodeManagers->renderNodesManager()->releaseResource(id);
}
diff --git a/src/render/backend/entity_p.h b/src/render/backend/entity_p.h
index 2cd0ee743..f2aa65501 100644
--- a/src/render/backend/entity_p.h
+++ b/src/render/backend/entity_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,10 +52,11 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/handle_types_p.h>
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
+#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DCore/private/qentity_p.h>
#include <Qt3DCore/private/qhandle_p.h>
#include <QVector>
@@ -76,7 +80,7 @@ class Sphere;
class Renderer;
class NodeManagers;
-class Q_AUTOTEST_EXPORT Entity : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT Entity : public BackendNode
{
public:
Entity();
@@ -86,7 +90,6 @@ public:
void setParentHandle(HEntity parentHandle);
void setNodeManagers(NodeManagers *manager);
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void dump() const;
@@ -108,10 +111,8 @@ public:
Sphere *worldBoundingVolumeWithChildren() const { return m_worldBoundingVolumeWithChildren.data(); }
void addComponent(Qt3DCore::QComponent *component);
- void removeComponent(const Qt3DCore::QNodeId &nodeId);
-
- bool isEnabled() const;
- void setEnabled(bool isEnabled);
+ void addComponent(Qt3DCore::QNodeIdTypePair idAndType);
+ void removeComponent(Qt3DCore::QNodeId nodeId);
bool isBoundingVolumeDirty() const;
void unsetBoundingVolumeDirty();
@@ -131,7 +132,7 @@ public:
template<class Backend>
Backend *renderComponent() const
{
- return Q_NULLPTR;
+ return nullptr;
}
template<class Backend>
@@ -147,12 +148,14 @@ public:
}
template<class Backend>
- QList<Qt3DCore::QNodeId> componentsUuid() const
+ QVector<Qt3DCore::QNodeId> componentsUuid() const
{
- return QList<Qt3DCore::QNodeId>();
+ return QVector<Qt3DCore::QNodeId>();
}
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
NodeManagers *m_nodeManagers;
HEntity m_handle;
HEntity m_parentHandle;
@@ -167,15 +170,15 @@ private:
Qt3DCore::QNodeId m_transformComponent;
Qt3DCore::QNodeId m_materialComponent;
Qt3DCore::QNodeId m_cameraComponent;
- QList<Qt3DCore::QNodeId> m_layerComponents;
- QList<Qt3DCore::QNodeId> m_shaderDataComponents;
- QList<Qt3DCore::QNodeId> m_lightComponents;
+ QVector<Qt3DCore::QNodeId> m_layerComponents;
+ QVector<Qt3DCore::QNodeId> m_shaderDataComponents;
+ QVector<Qt3DCore::QNodeId> m_lightComponents;
Qt3DCore::QNodeId m_geometryRendererComponent;
Qt3DCore::QNodeId m_objectPickerComponent;
Qt3DCore::QNodeId m_boundingVolumeDebugComponent;
+ Qt3DCore::QNodeId m_computeComponent;
QString m_objectName;
- bool m_enabled;
bool m_boundingDirty;
};
@@ -201,12 +204,15 @@ QList<HLayer> Entity::componentsHandle<Layer>() const;
template<>
QList<HShaderData> Entity::componentsHandle<ShaderData>() const;
-template<>
-Q_AUTOTEST_EXPORT HBoundingVolumeDebug Entity::componentHandle<BoundingVolumeDebug>() const;
+//template<>
+//Q_AUTOTEST_EXPORT HBoundingVolumeDebug Entity::componentHandle<BoundingVolumeDebug>() const;
template<>
QList<HLight> Entity::componentsHandle<Light>() const;
+template<>
+Q_AUTOTEST_EXPORT HComputeCommand Entity::componentHandle<ComputeCommand>() const;
+
// Render components
template<>
Material *Entity::renderComponent<Material>() const;
@@ -229,12 +235,15 @@ QList<Layer *> Entity::renderComponents<Layer>() const;
template<>
QList<ShaderData *> Entity::renderComponents<ShaderData>() const;
-template<>
-Q_AUTOTEST_EXPORT BoundingVolumeDebug *Entity::renderComponent<BoundingVolumeDebug>() const;
+//template<>
+//Q_AUTOTEST_EXPORT BoundingVolumeDebug *Entity::renderComponent<BoundingVolumeDebug>() const;
template<>
QList<Light *> Entity::renderComponents<Light>() const;
+template<>
+Q_AUTOTEST_EXPORT ComputeCommand *Entity::renderComponent<ComputeCommand>() const;
+
// UUid
template<>
Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<Transform>() const;
@@ -246,10 +255,10 @@ template<>
Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<Material>() const;
template<>
-Q_AUTOTEST_EXPORT QList<Qt3DCore::QNodeId> Entity::componentsUuid<Layer>() const;
+Q_AUTOTEST_EXPORT QVector<Qt3DCore::QNodeId> Entity::componentsUuid<Layer>() const;
template<>
-Q_AUTOTEST_EXPORT QList<Qt3DCore::QNodeId> Entity::componentsUuid<ShaderData>() const;
+Q_AUTOTEST_EXPORT QVector<Qt3DCore::QNodeId> Entity::componentsUuid<ShaderData>() const;
template<>
Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<GeometryRenderer>() const;
@@ -257,22 +266,26 @@ Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<GeometryRenderer>() co
template<>
Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<ObjectPicker>() const;
+//template<>
+//Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<BoundingVolumeDebug>() const;
+
template<>
-Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<BoundingVolumeDebug>() const;
+Q_AUTOTEST_EXPORT Qt3DCore::QNodeId Entity::componentUuid<ComputeCommand>() const;
template<>
-Q_AUTOTEST_EXPORT QList<Qt3DCore::QNodeId> Entity::componentsUuid<Light>() const;
+Q_AUTOTEST_EXPORT QVector<Qt3DCore::QNodeId> Entity::componentsUuid<Light>() const;
-class RenderEntityFunctor : public Qt3DCore::QBackendNodeFunctor
+class RenderEntityFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit RenderEntityFunctor(NodeManagers *manager);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
+ explicit RenderEntityFunctor(AbstractRenderer *renderer, NodeManagers *manager);
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
private:
NodeManagers *m_nodeManagers;
+ AbstractRenderer *m_renderer;
};
} // namespace Render
diff --git a/src/render/backend/handle_types_p.h b/src/render/backend/handle_types_p.h
index 5e9c8fe85..d22ef1d90 100644
--- a/src/render/backend/handle_types_p.h
+++ b/src/render/backend/handle_types_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,20 +60,19 @@ class QMatrix4x4;
namespace Qt3DRender {
-class QTexImageData;
+class QTextureImageData;
namespace Render {
-class RenderAttachment;
+class RenderTargetOutput;
class CameraLens;
-class Annotation;
+class FilterKey;
class Effect;
class Entity;
class Shader;
class FrameGraphNode;
class Layer;
class Material;
-class SortCriterion;
class Technique;
class Texture;
class Transform;
@@ -87,10 +89,13 @@ class ObjectPicker;
class BoundingVolumeDebug;
class OpenGLVertexArrayObject;
class Light;
+class ComputeCommand;
+class GLBuffer;
+class RenderStateNode;
-typedef Qt3DCore::QHandle<RenderAttachment, 16> HAttachment;
+typedef Qt3DCore::QHandle<RenderTargetOutput, 16> HAttachment;
typedef Qt3DCore::QHandle<CameraLens, 8> HCamera;
-typedef Qt3DCore::QHandle<Annotation, 16> HCriterion;
+typedef Qt3DCore::QHandle<FilterKey, 16> HFilterKey;
typedef Qt3DCore::QHandle<Effect, 16> HEffect;
typedef Qt3DCore::QHandle<Entity, 16> HEntity;
typedef Qt3DCore::QHandle<FrameGraphNode *, 8> HFrameGraphNode;
@@ -99,13 +104,12 @@ typedef Qt3DCore::QHandle<Material, 16> HMaterial;
typedef Qt3DCore::QHandle<QMatrix4x4, 16> HMatrix;
typedef Qt3DCore::QHandle<OpenGLVertexArrayObject, 16> HVao;
typedef Qt3DCore::QHandle<Shader, 16> HShader;
-typedef Qt3DCore::QHandle<SortCriterion, 8> HSortCriterion;
typedef Qt3DCore::QHandle<Technique, 16> HTechnique;
typedef Qt3DCore::QHandle<Texture, 16> HTexture;
typedef Qt3DCore::QHandle<Transform, 16> HTransform;
typedef Qt3DCore::QHandle<RenderTarget, 8> HTarget;
typedef Qt3DCore::QHandle<RenderPass, 16> HRenderPass;
-typedef Qt3DCore::QHandle<QTexImageData, 16> HTextureData;
+typedef Qt3DCore::QHandle<QTextureImageData, 16> HTextureData;
typedef Qt3DCore::QHandle<Parameter, 16> HParameter;
typedef Qt3DCore::QHandle<ShaderData, 16> HShaderData;
typedef Qt3DCore::QHandle<TextureImage, 16> HTextureImage;
@@ -116,6 +120,9 @@ typedef Qt3DCore::QHandle<GeometryRenderer, 16> HGeometryRenderer;
typedef Qt3DCore::QHandle<ObjectPicker, 16> HObjectPicker;
typedef Qt3DCore::QHandle<BoundingVolumeDebug, 16> HBoundingVolumeDebug;
typedef Qt3DCore::QHandle<Light, 16> HLight;
+typedef Qt3DCore::QHandle<ComputeCommand, 16> HComputeCommand;
+typedef Qt3DCore::QHandle<GLBuffer, 16> HGLBuffer;
+typedef Qt3DCore::QHandle<RenderStateNode, 16> HRenderState;
} // namespace Render
diff --git a/src/render/backend/layer.cpp b/src/render/backend/layer.cpp
index 332882802..14c0317f8 100644
--- a/src/render/backend/layer.cpp
+++ b/src/render/backend/layer.cpp
@@ -1,42 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "layer_p.h"
-#include "qlayer.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/qlayer.h>
+#include <Qt3DRender/private/qlayer_p.h>
+#include <Qt3DRender/private/stringtoint_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <QVariant>
QT_BEGIN_NAMESPACE
@@ -47,7 +52,7 @@ namespace Qt3DRender {
namespace Render {
Layer::Layer()
- : QBackendNode()
+ : BackendNode()
{
}
@@ -58,27 +63,7 @@ Layer::~Layer()
void Layer::cleanup()
{
-}
-
-void Layer::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QLayer *layer = static_cast<QLayer *>(peer);
- m_layers = layer->names();
- m_enabled = layer->isEnabled();
-}
-
-QStringList Layer::layers() const
-{
- return m_layers;
-}
-
-void Layer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (e->type() == NodeUpdated && propertyChange->propertyName() == QByteArrayLiteral("names"))
- m_layers = propertyChange->value().toStringList();
- else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- m_enabled = propertyChange->value().toBool();
+ QBackendNode::setEnabled(false);
}
} // namespace Render
diff --git a/src/render/backend/layer_p.h b/src/render/backend/layer_p.h
index 23351e5f9..b6a78a1cf 100644
--- a/src/render/backend/layer_p.h
+++ b/src/render/backend/layer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,8 +51,8 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DCore/qbackendnode.h>
#include <QStringList>
QT_BEGIN_NAMESPACE
@@ -62,22 +65,12 @@ namespace Render {
class LayerManager;
-class Layer : public Qt3DCore::QBackendNode
+class Layer : public BackendNode
{
public:
Layer();
~Layer();
void cleanup();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
- QStringList layers() const;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- inline bool isEnabled() const { return m_enabled; }
-
-private:
- QStringList m_layers;
- bool m_enabled;
};
} // namespace Render
diff --git a/src/render/backend/managers.cpp b/src/render/backend/managers.cpp
new file mode 100644
index 000000000..7754c8682
--- /dev/null
+++ b/src/render/backend/managers.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "managers_p.h"
+
+#include <Qt3DRender/private/framegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+bool FrameGraphManager::containsNode(Qt3DCore::QNodeId id) const
+{
+ return m_nodes.contains(id);
+}
+
+void FrameGraphManager::appendNode(Qt3DCore::QNodeId id, FrameGraphNode *node)
+{
+ m_nodes.insert(id, node);
+}
+
+FrameGraphNode* FrameGraphManager::lookupNode(Qt3DCore::QNodeId id) const
+{
+ const QHash<Qt3DCore::QNodeId, FrameGraphNode*>::const_iterator it = m_nodes.find(id);
+ if (it == m_nodes.end())
+ return nullptr;
+ else
+ return *it;
+}
+
+void FrameGraphManager::releaseNode(Qt3DCore::QNodeId id)
+{
+ delete m_nodes.take(id);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h
index ca2d3e264..386a552c6 100644
--- a/src/render/backend/managers_p.h
+++ b/src/render/backend/managers_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,24 +52,24 @@
//
#include <Qt3DCore/private/qresourcemanager_p.h>
-#include <Qt3DRender/private/renderattachment_p.h>
+#include <Qt3DRender/private/rendertargetoutput_p.h>
#include <Qt3DRender/private/cameralens_p.h>
-#include <Qt3DRender/private/annotation_p.h>
+#include <Qt3DRender/private/filterkey_p.h>
#include <Qt3DRender/private/effect_p.h>
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/layer_p.h>
#include <Qt3DRender/private/material_p.h>
#include <Qt3DRender/private/shader_p.h>
-#include <Qt3DRender/private/sortcriterion_p.h>
#include <Qt3DRender/private/technique_p.h>
#include <Qt3DRender/private/texture_p.h>
#include <Qt3DRender/private/transform_p.h>
#include <Qt3DRender/private/rendertarget_p.h>
#include <Qt3DRender/private/renderpass_p.h>
+#include <Qt3DRender/private/renderstatenode_p.h>
#include <Qt3DRender/private/parameter_p.h>
#include <Qt3DRender/private/shaderdata_p.h>
#include <Qt3DRender/private/handle_types_p.h>
-#include <Qt3DRender/private/uniformbuffer_p.h>
+#include <Qt3DRender/private/glbuffer_p.h>
#include <Qt3DRender/private/textureimage_p.h>
#include <Qt3DRender/private/attribute_p.h>
#include <Qt3DRender/private/geometry_p.h>
@@ -74,6 +77,7 @@
#include <Qt3DRender/private/boundingvolumedebug_p.h>
#include <Qt3DRender/private/openglvertexarrayobject_p.h>
#include <Qt3DRender/private/light_p.h>
+#include <Qt3DRender/private/computecommand_p.h>
QT_BEGIN_NAMESPACE
@@ -82,7 +86,7 @@ namespace Qt3DRender {
namespace Render {
class AttachmentManager : public Qt3DCore::QResourceManager<
- RenderAttachment,
+ RenderTargetOutput,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy,
@@ -102,8 +106,8 @@ public:
CameraManager() {}
};
-class CriterionManager : public Qt3DCore::QResourceManager<
- Annotation,
+class FilterKeyManager : public Qt3DCore::QResourceManager<
+ FilterKey,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy,
@@ -111,7 +115,7 @@ class CriterionManager : public Qt3DCore::QResourceManager<
{
public:
- CriterionManager() {}
+ FilterKeyManager() {}
};
class EffectManager : public Qt3DCore::QResourceManager<
@@ -134,14 +138,20 @@ public:
EntityManager() {}
};
-class FrameGraphManager : public Qt3DCore::QResourceManager<
- FrameGraphNode *,
- Qt3DCore::QNodeId,
- 8,
- Qt3DCore::ArrayAllocatingPolicy>
+class FrameGraphNode;
+
+class Q_AUTOTEST_EXPORT FrameGraphManager
{
public:
FrameGraphManager() {}
+
+ bool containsNode(Qt3DCore::QNodeId id) const;
+ void appendNode(Qt3DCore::QNodeId id, FrameGraphNode *node);
+ FrameGraphNode* lookupNode(Qt3DCore::QNodeId id) const;
+ void releaseNode(Qt3DCore::QNodeId id);
+
+private:
+ QHash<Qt3DCore::QNodeId, FrameGraphNode*> m_nodes;
};
class LayerManager : public Qt3DCore::QResourceManager<
@@ -183,17 +193,6 @@ public:
ShaderManager() {}
};
-class SortCriterionManager : public Qt3DCore::QResourceManager<
- SortCriterion,
- Qt3DCore::QNodeId,
- 8,
- Qt3DCore::ArrayAllocatingPolicy,
- Qt3DCore::ObjectLevelLockingPolicy>
-{
-public:
- SortCriterionManager() {}
-};
-
class TechniqueManager : public Qt3DCore::QResourceManager<
Technique,
Qt3DCore::QNodeId,
@@ -281,9 +280,9 @@ public:
ShaderDataManager() {}
};
-class UBOManager : public Qt3DCore::QResourceManager<
- UniformBuffer,
- ShaderDataShaderUboKey,
+class GLBufferManager : public Qt3DCore::QResourceManager<
+ GLBuffer,
+ Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy,
Qt3DCore::ObjectLevelLockingPolicy>
@@ -326,6 +325,7 @@ class ObjectPickerManager : public Qt3DCore::QResourceManager<
{
};
+#if 0
class BoundingVolumeDebugManager : public Qt3DCore::QResourceManager<
BoundingVolumeDebug,
Qt3DCore::QNodeId,
@@ -334,6 +334,7 @@ class BoundingVolumeDebugManager : public Qt3DCore::QResourceManager<
Qt3DCore::ObjectLevelLockingPolicy>
{
};
+#endif
class LightManager : public Qt3DCore::QResourceManager<
Light,
@@ -346,16 +347,36 @@ public:
LightManager() {}
};
+class ComputeCommandManager : public Qt3DCore::QResourceManager<
+ ComputeCommand,
+ Qt3DCore::QNodeId,
+ 16,
+ Qt3DCore::ArrayAllocatingPolicy,
+ Qt3DCore::ObjectLevelLockingPolicy>
+{
+public:
+ ComputeCommandManager() {}
+};
+
+class RenderStateManager : public Qt3DCore::QResourceManager<
+ RenderStateNode,
+ Qt3DCore::QNodeId,
+ 16,
+ Qt3DCore::ArrayAllocatingPolicy,
+ Qt3DCore::ObjectLevelLockingPolicy>
+{
+};
+
+
} // namespace Render
} // namespace Qt3DRender
-Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Annotation, Q_REQUIRES_CLEANUP)
+Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::FilterKey, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Effect, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Entity, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Layer, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Material, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Shader, Q_REQUIRES_CLEANUP)
-Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::SortCriterion, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::RenderTarget, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Technique, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Texture, Q_REQUIRES_CLEANUP)
@@ -365,6 +386,7 @@ Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Attribute, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::Geometry, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::ObjectPicker, Q_REQUIRES_CLEANUP)
Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::BoundingVolumeDebug, Q_REQUIRES_CLEANUP)
+Q_DECLARE_RESOURCE_INFO(Qt3DRender::Render::ComputeCommand, Q_REQUIRES_CLEANUP)
QT_END_NAMESPACE
diff --git a/src/render/backend/nodefunctor_p.h b/src/render/backend/nodefunctor_p.h
index 6a2a902b8..98dec968f 100644
--- a/src/render/backend/nodefunctor_p.h
+++ b/src/render/backend/nodefunctor_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,8 +51,8 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
#include <Qt3DCore/qnode.h>
+#include <Qt3DRender/private/backendnode_p.h>
QT_BEGIN_NAMESPACE
@@ -57,35 +60,38 @@ namespace Qt3DRender {
namespace Render {
+class AbstractRenderer;
+
template<class Backend, class Manager>
-class NodeFunctor : public Qt3DCore::QBackendNodeFunctor
+class NodeFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit NodeFunctor(Manager *manager)
+ explicit NodeFunctor(AbstractRenderer *renderer, Manager *manager)
: m_manager(manager)
+ , m_renderer(renderer)
{
}
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_FINAL
{
- Backend *backend = m_manager->getOrCreateResource(frontend->id());
- backend->setFactory(factory);
- backend->setPeer(frontend);
+ Backend *backend = m_manager->getOrCreateResource(change->subjectId());
+ backend->setRenderer(m_renderer);
return backend;
}
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_FINAL
{
return m_manager->lookupResource(id);
}
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_FINAL
{
m_manager->releaseResource(id);
}
private:
Manager *m_manager;
+ AbstractRenderer *m_renderer;
};
} // namespace Render
diff --git a/src/render/backend/nodemanagers.cpp b/src/render/backend/nodemanagers.cpp
index 578cd1c82..2a0ef7151 100644
--- a/src/render/backend/nodemanagers.cpp
+++ b/src/render/backend/nodemanagers.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -63,24 +66,25 @@ NodeManagers::NodeManagers()
, m_textureManager(new TextureManager())
, m_textureDataManager(new TextureDataManager())
, m_layerManager(new LayerManager())
- , m_criterionManager(new CriterionManager())
+ , m_filterKeyManager(new FilterKeyManager())
, m_frameGraphManager(new FrameGraphManager())
, m_transformManager(new TransformManager())
, m_renderTargetManager(new RenderTargetManager())
, m_sceneManager(new SceneManager())
, m_attachmentManager(new AttachmentManager())
- , m_sortCriterionManager(new SortCriterionManager())
, m_parameterManager(new ParameterManager())
, m_shaderDataManager(new ShaderDataManager())
- , m_uboManager(new UBOManager())
+ , m_glBufferManager(new GLBufferManager())
, m_textureImageManager(new TextureImageManager())
, m_bufferManager(new BufferManager())
, m_attributeManager(new AttributeManager())
, m_geometryManager(new GeometryManager())
, m_geometryRendererManager(new GeometryRendererManager)
, m_objectPickerManager(new ObjectPickerManager())
- , m_boundingVolumeDebugManager(new BoundingVolumeDebugManager())
+// , m_boundingVolumeDebugManager(new BoundingVolumeDebugManager())
, m_lightManager(new LightManager())
+ , m_computeJobManager(new ComputeCommandManager())
+ , m_renderStateManager(new RenderStateManager())
{
}
@@ -145,7 +149,7 @@ TextureManager *NodeManagers::manager<Texture>() const Q_DECL_NOEXCEPT
}
template<>
-TextureDataManager *NodeManagers::manager<QTexImageData>() const Q_DECL_NOEXCEPT
+TextureDataManager *NodeManagers::manager<QTextureImageData>() const Q_DECL_NOEXCEPT
{
return m_textureDataManager;
}
@@ -157,9 +161,9 @@ LayerManager *NodeManagers::manager<Layer>() const Q_DECL_NOEXCEPT
}
template<>
-CriterionManager *NodeManagers::manager<Annotation>() const Q_DECL_NOEXCEPT
+FilterKeyManager *NodeManagers::manager<FilterKey>() const Q_DECL_NOEXCEPT
{
- return m_criterionManager;
+ return m_filterKeyManager;
}
template<>
@@ -187,18 +191,12 @@ SceneManager *NodeManagers::manager<Scene>() const Q_DECL_NOEXCEPT
}
template<>
-AttachmentManager *NodeManagers::manager<RenderAttachment>() const Q_DECL_NOEXCEPT
+AttachmentManager *NodeManagers::manager<RenderTargetOutput>() const Q_DECL_NOEXCEPT
{
return m_attachmentManager;
}
template<>
-SortCriterionManager *NodeManagers::manager<SortCriterion>() const Q_DECL_NOEXCEPT
-{
- return m_sortCriterionManager;
-}
-
-template<>
ParameterManager *NodeManagers::manager<Parameter>() const Q_DECL_NOEXCEPT
{
return m_parameterManager;
@@ -211,9 +209,9 @@ ShaderDataManager *NodeManagers::manager<ShaderData>() const Q_DECL_NOEXCEPT
}
template<>
-UBOManager *NodeManagers::manager<UniformBuffer>() const Q_DECL_NOEXCEPT
+GLBufferManager *NodeManagers::manager<GLBuffer>() const Q_DECL_NOEXCEPT
{
- return m_uboManager;
+ return m_glBufferManager;
}
template<>
@@ -252,16 +250,28 @@ ObjectPickerManager *NodeManagers::manager<ObjectPicker>() const Q_DECL_NOEXCEPT
return m_objectPickerManager;
}
+//template<>
+//BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const Q_DECL_NOEXCEPT
+//{
+// return m_boundingVolumeDebugManager;
+//}
+
template<>
-BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const Q_DECL_NOEXCEPT
+LightManager *NodeManagers::manager<Light>() const Q_DECL_NOEXCEPT
{
- return m_boundingVolumeDebugManager;
+ return m_lightManager;
}
template<>
-LightManager *NodeManagers::manager<Light>() const Q_DECL_NOEXCEPT
+ComputeCommandManager *NodeManagers::manager<ComputeCommand>() const Q_DECL_NOEXCEPT
{
- return m_lightManager;
+ return m_computeJobManager;
+}
+
+template<>
+RenderStateManager *NodeManagers::manager<RenderStateNode>() const Q_DECL_NOEXCEPT
+{
+ return m_renderStateManager;
}
} // Render
diff --git a/src/render/backend/nodemanagers_p.h b/src/render/backend/nodemanagers_p.h
index 9fb4074e1..e4e80ede3 100644
--- a/src/render/backend/nodemanagers_p.h
+++ b/src/render/backend/nodemanagers_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,7 +61,7 @@ class QOpenGLVertexArrayObject;
namespace Qt3DRender {
-class QTexImageData;
+class QTextureImageData;
namespace Render {
@@ -80,21 +83,21 @@ class RenderPassManager;
class RenderTargetManager;
class SceneManager;
class AttachmentManager;
-class SortCriterionManager;
class ParameterManager;
class ShaderDataManager;
-class UBOManager;
+class GLBufferManager;
class TextureImageManager;
-class CriterionManager;
+class FilterKeyManager;
class FrameGraphManager;
class TransformManager;
class TextureManager;
class TextureDataManager;
class LayerManager;
class LightManager;
+class ComputeCommandManager;
+class RenderStateManager;
class FrameGraphNode;
-class Annotation;
class Entity;
class CameraLens;
class Material;
@@ -104,24 +107,25 @@ class Effect;
class RenderPass;
class Texture;
class Layer;
-class Annotation;
+class FilterKey;
class FrameGraphNode;
class Transform;
class Scene;
-class RenderAttachment;
+class RenderTargetOutput;
class RenderTarget;
class ShaderData;
-class SortCriterion;
class Parameter;
-class UniformBuffer;
+class GLBuffer;
class TextureImage;
class Buffer;
class Attribute;
class Geometry;
class GeometryRenderer;
class ObjectPicker;
-class BoundingVolumeDebug;
+//class BoundingVolumeDebug;
class Light;
+class ComputeCommand;
+class RenderStateNode;
class QT3DRENDERSHARED_PRIVATE_EXPORT NodeManagers
{
@@ -131,23 +135,23 @@ public:
template<class Backend, typename Manager>
Manager *manager() const Q_DECL_NOEXCEPT
{
- return Q_NULLPTR;
+ return nullptr;
}
template<class Backend, typename Manager, typename Key>
Backend *lookupResource(const Key &id) const
{
Manager *mgr = manager<Backend, Manager>();
- if (mgr != Q_NULLPTR)
+ if (mgr != nullptr)
return mgr->lookupResource(id);
- return Q_NULLPTR;
+ return nullptr;
}
template<class Backend, typename Manager, typename Handle, typename Key>
Handle lookupHandle(const Key &id) const
{
Manager *mgr = manager<Backend, Manager>();
- if (mgr != Q_NULLPTR)
+ if (mgr != nullptr)
return mgr->lookupHandle(id);
return Handle();
}
@@ -156,9 +160,9 @@ public:
Backend *data(Handle handle)
{
Manager *mgr = manager<Backend, Manager>();
- if (mgr != Q_NULLPTR)
+ if (mgr != nullptr)
return mgr->data(handle);
- return Q_NULLPTR;
+ return nullptr;
}
@@ -174,24 +178,25 @@ public:
inline TextureManager *textureManager() const Q_DECL_NOEXCEPT { return m_textureManager; }
inline TextureDataManager *textureDataManager() const Q_DECL_NOEXCEPT { return m_textureDataManager; }
inline LayerManager *layerManager() const Q_DECL_NOEXCEPT { return m_layerManager; }
- inline CriterionManager *criterionManager() const Q_DECL_NOEXCEPT { return m_criterionManager; }
+ inline FilterKeyManager *filterKeyManager() const Q_DECL_NOEXCEPT { return m_filterKeyManager; }
inline FrameGraphManager *frameGraphManager() const Q_DECL_NOEXCEPT { return m_frameGraphManager; }
inline TransformManager *transformManager() const Q_DECL_NOEXCEPT { return m_transformManager; }
inline RenderTargetManager *renderTargetManager() const Q_DECL_NOEXCEPT { return m_renderTargetManager; }
inline SceneManager *sceneManager() const Q_DECL_NOEXCEPT { return m_sceneManager; }
inline AttachmentManager *attachmentManager() const Q_DECL_NOEXCEPT { return m_attachmentManager; }
- inline SortCriterionManager *sortCriterionManager() const Q_DECL_NOEXCEPT { return m_sortCriterionManager; }
inline ParameterManager *parameterManager() const Q_DECL_NOEXCEPT { return m_parameterManager; }
inline ShaderDataManager *shaderDataManager() const Q_DECL_NOEXCEPT { return m_shaderDataManager; }
- inline UBOManager *uboManager() const Q_DECL_NOEXCEPT { return m_uboManager; }
+ inline GLBufferManager *glBufferManager() const Q_DECL_NOEXCEPT { return m_glBufferManager; }
inline TextureImageManager *textureImageManager() const Q_DECL_NOEXCEPT { return m_textureImageManager; }
inline BufferManager *bufferManager() const Q_DECL_NOEXCEPT { return m_bufferManager; }
inline AttributeManager *attributeManager() const Q_DECL_NOEXCEPT { return m_attributeManager; }
inline GeometryManager *geometryManager() const Q_DECL_NOEXCEPT { return m_geometryManager; }
inline GeometryRendererManager *geometryRendererManager() const Q_DECL_NOEXCEPT { return m_geometryRendererManager; }
inline ObjectPickerManager *objectPickerManager() const Q_DECL_NOEXCEPT { return m_objectPickerManager; }
- inline BoundingVolumeDebugManager *boundingVolumeDebugManager() const Q_DECL_NOEXCEPT { return m_boundingVolumeDebugManager; }
+ // inline BoundingVolumeDebugManager *boundingVolumeDebugManager() const Q_DECL_NOEXCEPT { return m_boundingVolumeDebugManager; }
inline LightManager *lightManager() const Q_DECL_NOEXCEPT { return m_lightManager; }
+ inline ComputeCommandManager *computeJobManager() const Q_DECL_NOEXCEPT { return m_computeJobManager; }
+ inline RenderStateManager *renderStateManager() const Q_DECL_NOEXCEPT { return m_renderStateManager; }
private:
CameraManager *m_cameraManager;
@@ -206,24 +211,25 @@ private:
TextureManager *m_textureManager;
TextureDataManager *m_textureDataManager;
LayerManager *m_layerManager;
- CriterionManager *m_criterionManager;
+ FilterKeyManager *m_filterKeyManager;
FrameGraphManager *m_frameGraphManager;
TransformManager *m_transformManager;
RenderTargetManager *m_renderTargetManager;
SceneManager *m_sceneManager;
AttachmentManager *m_attachmentManager;
- SortCriterionManager *m_sortCriterionManager;
ParameterManager *m_parameterManager;
ShaderDataManager *m_shaderDataManager;
- UBOManager *m_uboManager;
+ GLBufferManager *m_glBufferManager;
TextureImageManager *m_textureImageManager;
BufferManager *m_bufferManager;
AttributeManager *m_attributeManager;
GeometryManager *m_geometryManager;
GeometryRendererManager *m_geometryRendererManager;
ObjectPickerManager *m_objectPickerManager;
- BoundingVolumeDebugManager *m_boundingVolumeDebugManager;
+ // BoundingVolumeDebugManager *m_boundingVolumeDebugManager;
LightManager *m_lightManager;
+ ComputeCommandManager *m_computeJobManager;
+ RenderStateManager *m_renderStateManager;
};
// Specializations
@@ -259,13 +265,13 @@ template<>
QT3DRENDERSHARED_PRIVATE_EXPORT TextureManager *NodeManagers::manager<Texture>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT TextureDataManager *NodeManagers::manager<QTexImageData>() const Q_DECL_NOEXCEPT;
+QT3DRENDERSHARED_PRIVATE_EXPORT TextureDataManager *NodeManagers::manager<QTextureImageData>() const Q_DECL_NOEXCEPT;
template<>
QT3DRENDERSHARED_PRIVATE_EXPORT LayerManager *NodeManagers::manager<Layer>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT CriterionManager *NodeManagers::manager<Annotation>() const Q_DECL_NOEXCEPT;
+QT3DRENDERSHARED_PRIVATE_EXPORT FilterKeyManager *NodeManagers::manager<FilterKey>() const Q_DECL_NOEXCEPT;
template<>
QT3DRENDERSHARED_PRIVATE_EXPORT FrameGraphManager *NodeManagers::manager<FrameGraphNode*>() const Q_DECL_NOEXCEPT;
@@ -280,10 +286,7 @@ template<>
QT3DRENDERSHARED_PRIVATE_EXPORT SceneManager *NodeManagers::manager<Scene>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT AttachmentManager *NodeManagers::manager<RenderAttachment>() const Q_DECL_NOEXCEPT;
-
-template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT SortCriterionManager *NodeManagers::manager<SortCriterion>() const Q_DECL_NOEXCEPT;
+QT3DRENDERSHARED_PRIVATE_EXPORT AttachmentManager *NodeManagers::manager<RenderTargetOutput>() const Q_DECL_NOEXCEPT;
template<>
QT3DRENDERSHARED_PRIVATE_EXPORT ParameterManager *NodeManagers::manager<Parameter>() const Q_DECL_NOEXCEPT;
@@ -292,7 +295,7 @@ template<>
QT3DRENDERSHARED_PRIVATE_EXPORT ShaderDataManager *NodeManagers::manager<ShaderData>() const Q_DECL_NOEXCEPT;
template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT UBOManager *NodeManagers::manager<UniformBuffer>() const Q_DECL_NOEXCEPT;
+QT3DRENDERSHARED_PRIVATE_EXPORT GLBufferManager *NodeManagers::manager<GLBuffer>() const Q_DECL_NOEXCEPT;
template<>
QT3DRENDERSHARED_PRIVATE_EXPORT TextureImageManager *NodeManagers::manager<TextureImage>() const Q_DECL_NOEXCEPT;
@@ -312,12 +315,18 @@ QT3DRENDERSHARED_PRIVATE_EXPORT GeometryRendererManager *NodeManagers::manager<G
template<>
QT3DRENDERSHARED_PRIVATE_EXPORT ObjectPickerManager *NodeManagers::manager<ObjectPicker>() const Q_DECL_NOEXCEPT;
-template<>
-QT3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const Q_DECL_NOEXCEPT;
+//template<>
+//QT3DRENDERSHARED_PRIVATE_EXPORT BoundingVolumeDebugManager *NodeManagers::manager<BoundingVolumeDebug>() const Q_DECL_NOEXCEPT;
template<>
LightManager *NodeManagers::manager<Light>() const Q_DECL_NOEXCEPT;
+template<>
+QT3DRENDERSHARED_PRIVATE_EXPORT ComputeCommandManager *NodeManagers::manager<ComputeCommand>() const Q_DECL_NOEXCEPT;
+
+template<>
+QT3DRENDERSHARED_PRIVATE_EXPORT RenderStateManager *NodeManagers::manager<RenderStateNode>() const Q_DECL_NOEXCEPT;
+
} // Render
} // Qt3DRender
diff --git a/src/render/backend/openglvertexarrayobject_p.h b/src/render/backend/openglvertexarrayobject_p.h
index f872ab14c..fb67145b8 100644
--- a/src/render/backend/openglvertexarrayobject_p.h
+++ b/src/render/backend/openglvertexarrayobject_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -60,45 +63,44 @@ class OpenGLVertexArrayObject
{
public:
OpenGLVertexArrayObject()
- : m_vao(Q_NULLPTR)
- , m_specified(false)
+ : m_specified(false)
{}
void bind()
{
- Q_ASSERT(m_vao);
+ Q_ASSERT(!m_vao.isNull());
Q_ASSERT(m_vao->isCreated());
m_vao->bind();
}
void release()
{
- Q_ASSERT(m_vao);
+ Q_ASSERT(!m_vao.isNull());
Q_ASSERT(m_vao->isCreated());
m_vao->release();
}
void create()
{
- Q_ASSERT(m_vao);
+ Q_ASSERT(!m_vao.isNull());
m_vao->create();
}
bool isCreated() const
{
- Q_ASSERT(m_vao);
+ Q_ASSERT(!m_vao.isNull());
return m_vao->isCreated();
}
- QOpenGLVertexArrayObject *vao() { return m_vao; }
- const QOpenGLVertexArrayObject *vao() const { return m_vao; }
- void setVao(QOpenGLVertexArrayObject *vao) { m_vao = vao; }
+ QOpenGLVertexArrayObject *vao() { return m_vao.data(); }
+ const QOpenGLVertexArrayObject *vao() const { return m_vao.data(); }
+ void setVao(QOpenGLVertexArrayObject *vao) { m_vao.reset(vao); }
void setSpecified(bool b) { m_specified = b; }
bool isSpecified() const { return m_specified; }
private:
- QOpenGLVertexArrayObject *m_vao;
+ QScopedPointer<QOpenGLVertexArrayObject> m_vao;
bool m_specified;
};
diff --git a/src/render/backend/parameterpack.cpp b/src/render/backend/parameterpack.cpp
index b11be585e..b358a3139 100644
--- a/src/render/backend/parameterpack.cpp
+++ b/src/render/backend/parameterpack.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,19 +57,19 @@ void ParameterPack::clear()
m_peers.clear();
}
-void ParameterPack::appendParameter(const Qt3DCore::QNodeId &parameterId)
+void ParameterPack::appendParameter(Qt3DCore::QNodeId parameterId)
{
if (!m_peers.contains(parameterId)) {
m_peers.append(parameterId);
}
}
-void ParameterPack::removeParameter(const Qt3DCore::QNodeId &parameterId)
+void ParameterPack::removeParameter(Qt3DCore::QNodeId parameterId)
{
m_peers.removeOne(parameterId);
}
-QList<Qt3DCore::QNodeId> ParameterPack::parameters() const
+QVector<Qt3DCore::QNodeId> ParameterPack::parameters() const
{
return m_peers;
}
diff --git a/src/render/backend/parameterpack_p.h b/src/render/backend/parameterpack_p.h
index 274797f0d..d09f2b7cb 100644
--- a/src/render/backend/parameterpack_p.h
+++ b/src/render/backend/parameterpack_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -63,12 +66,17 @@ public:
ParameterPack();
~ParameterPack();
void clear();
- void appendParameter(const Qt3DCore::QNodeId &parameterId);
- void removeParameter(const Qt3DCore::QNodeId &parameterId);
- QList<Qt3DCore::QNodeId> parameters() const;
+ void appendParameter(Qt3DCore::QNodeId parameterId);
+ void removeParameter(Qt3DCore::QNodeId parameterId);
+ QVector<Qt3DCore::QNodeId> parameters() const;
+
+ void setParameters(const Qt3DCore::QNodeIdVector &parameterIds)
+ {
+ m_peers = parameterIds;
+ }
private:
- QList<Qt3DCore::QNodeId> m_peers;
+ QVector<Qt3DCore::QNodeId> m_peers;
};
} // namespace Render
diff --git a/src/render/backend/platformsurfacefilter.cpp b/src/render/backend/platformsurfacefilter.cpp
index 1fe9f11be..891e30c44 100644
--- a/src/render/backend/platformsurfacefilter.cpp
+++ b/src/render/backend/platformsurfacefilter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,11 +51,32 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
+QSemaphore PlatformSurfaceFilter::m_surfacesSemaphore(1);
+QHash<QSurface *, bool> PlatformSurfaceFilter::m_surfacesValidity;
+
+// Surface protection
+// The surface is accessible from multiple threads at 3 potential places
+// 1) In here (the frontend) when we receive an event
+// 2) In the RenderViewJobs
+// 3) In the Renderer for the submission
+// * We don't need any protection in 2) as we are just copying the pointer
+// but not performing any access to the texture as all the information
+// we need has been cached in the RenderSurfaceSelector element
+// * This leaves us with case 1 and 3. It is important that if the surface
+// is about to be destroyed that we let the time to the submission thread
+// to complete whatever it is doing with a surface before we have the time
+// to process the AboutToBeDestroyed event. For that we have lockSurface, releaseSurface
+// on the PlatformSurfaceFilter. But that's not enough, you need to be sure that
+// the surface is still valid. When locked, you can use isSurfaceValid to check
+// if a surface is still accessible.
+// A Surface is valid when it has been created and becomes invalid when AboutToBeDestroyed
+// has been called
+// SurfaceLocker is a convenience type to perform locking an surface validity check
+
PlatformSurfaceFilter::PlatformSurfaceFilter(QObject *parent)
: QObject(parent)
- , m_obj(Q_NULLPTR)
- , m_surface(Q_NULLPTR)
- , m_renderer(Q_NULLPTR)
+ , m_obj(nullptr)
+ , m_surface(nullptr)
{
qRegisterMetaType<QSurface *>("QSurface*");
}
@@ -63,21 +87,6 @@ PlatformSurfaceFilter::~PlatformSurfaceFilter()
m_obj->removeEventFilter(this);
}
-void PlatformSurfaceFilter::setWindow(QWindow *window)
-{
- setSurface(window);
-}
-
-void PlatformSurfaceFilter::setOffscreenSurface(QOffscreenSurface *offscreen)
-{
- setSurface(offscreen);
-}
-
-void PlatformSurfaceFilter::setRenderer(AbstractRenderer *renderer)
-{
- m_renderer = renderer;
-}
-
bool PlatformSurfaceFilter::eventFilter(QObject *obj, QEvent *e)
{
if (obj == m_obj && e->type() == QEvent::PlatformSurface) {
@@ -85,13 +94,21 @@ bool PlatformSurfaceFilter::eventFilter(QObject *obj, QEvent *e)
switch (ev->surfaceEventType()) {
case QPlatformSurfaceEvent::SurfaceCreated:
- setRendererSurface(m_surface);
+ // set validy to true
+ {
+ markSurfaceAsValid();
break;
+ }
case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
- setSurface<QWindow>(Q_NULLPTR);
- setRendererSurface(Q_NULLPTR);
+ // set validity to false
+ {
+ SurfaceLocker lock(m_surface);
+ // If we remove it, the call to isSurfaceValid will
+ // implicitely return false
+ PlatformSurfaceFilter::m_surfacesValidity.remove(m_surface);
break;
+ }
default:
qCritical("Unknown surface type");
@@ -101,24 +118,50 @@ bool PlatformSurfaceFilter::eventFilter(QObject *obj, QEvent *e)
if (obj == m_obj && e->type() == QEvent::Expose) {
QExposeEvent *ev = static_cast<QExposeEvent *>(e);
- m_renderer->setSurfaceExposed(!ev->region().isEmpty());
+ Q_UNUSED(ev);
+ // We could use this to tell to ignore the RenderView
+ // at submission time since it's not exposed
}
return false;
}
-void PlatformSurfaceFilter::setRendererSurface(QSurface *surface)
+void PlatformSurfaceFilter::lockSurface()
+{
+ PlatformSurfaceFilter::m_surfacesSemaphore.acquire(1);
+}
+
+void PlatformSurfaceFilter::releaseSurface()
+{
+ PlatformSurfaceFilter::m_surfacesSemaphore.release(1);
+}
+
+bool PlatformSurfaceFilter::isSurfaceValid(QSurface *surface)
+{
+ // Should be called only when the surface is locked
+ // with the semaphore
+ return m_surfacesValidity.value(surface, false);
+}
+
+void PlatformSurfaceFilter::markSurfaceAsValid()
+{
+ SurfaceLocker lock(m_surface);
+ PlatformSurfaceFilter::m_surfacesValidity.insert(m_surface, true);
+}
+
+SurfaceLocker::SurfaceLocker(QSurface *surface)
+ : m_surface(surface)
+{
+ PlatformSurfaceFilter::lockSurface();
+}
+
+SurfaceLocker::~SurfaceLocker()
+{
+ PlatformSurfaceFilter::releaseSurface();
+}
+
+bool SurfaceLocker::isSurfaceValid() const
{
- // Tell the renderer about the surface on which to render. This function
- // is called in the context of the main thread and internally
- // the renderer uses a private thread to submit OpenGL calls. The surface
- // pointer within the renderer is protected by a mutex that is locked for
- // the duration of a frame. In this way, the renderer can be sure to have
- // a valid surface for the duration of the frame for which it is submitting
- // draw calls. Only when the frame finishes and the mutex is unlocked does
- // this call to Renderer::setSurface continue. Thereby blocking the main
- // thread from destroying the platform surface before we are ready.
- if (m_renderer != Q_NULLPTR)
- m_renderer->setSurface(surface);
+ return PlatformSurfaceFilter::isSurfaceValid(m_surface);
}
} // namespace Render
diff --git a/src/render/backend/platformsurfacefilter_p.h b/src/render/backend/platformsurfacefilter_p.h
index 24d71ca16..e95c45d67 100644
--- a/src/render/backend/platformsurfacefilter_p.h
+++ b/src/render/backend/platformsurfacefilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,6 +53,7 @@
#include <QtCore/qobject.h>
#include <QtGui/qsurface.h>
+#include <QSemaphore>
QT_BEGIN_NAMESPACE
@@ -69,35 +73,49 @@ public:
explicit PlatformSurfaceFilter(QObject *parent = 0);
~PlatformSurfaceFilter();
- void setWindow(QWindow *window);
- void setOffscreenSurface(QOffscreenSurface *offscreen);
-
- void setRenderer(AbstractRenderer *renderer);
-
bool eventFilter(QObject *obj, QEvent *e) Q_DECL_OVERRIDE;
-private:
- void setRendererSurface(QSurface *surface);
+ static void lockSurface();
+ static void releaseSurface();
+ static bool isSurfaceValid(QSurface *surface);
template<class T>
void setSurface(T *surface)
{
+ Q_ASSERT(surface);
if (m_obj == surface)
return;
if (m_obj)
m_obj->removeEventFilter(this);
- m_surface = surface;
+ // Surface is offset from QWindow/QOffscreenSurface due to multiple inheritance
+ m_surface = static_cast<QSurface *>(surface);
m_obj = surface;
- if (m_obj)
+ if (m_obj) {
m_obj->installEventFilter(this);
+ markSurfaceAsValid();
+ }
}
-
+private:
QObject *m_obj;
QSurface *m_surface;
- AbstractRenderer *m_renderer;
+
+ static QSemaphore m_surfacesSemaphore;
+ static QHash<QSurface *, bool> m_surfacesValidity;
+ void markSurfaceAsValid();
+};
+
+class SurfaceLocker
+{
+public:
+ explicit SurfaceLocker(QSurface *surface);
+ ~SurfaceLocker();
+ bool isSurfaceValid() const;
+
+private:
+ QSurface *m_surface;
};
} // namespace Render
diff --git a/src/render/backend/qgraphicsutils_p.h b/src/render/backend/qgraphicsutils_p.h
index 7b88a7691..40ff99f0e 100644
--- a/src/render/backend/qgraphicsutils_p.h
+++ b/src/render/backend/qgraphicsutils_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -261,7 +264,7 @@ public:
default: {
- float *data = Q_NULLPTR;
+ float *data = nullptr;
if (v.userType() == QMatrix3x3Type) {
QMatrix3x3 mat = v.value<QMatrix3x3>();
data = mat.data();
diff --git a/src/render/backend/quniformvalue.cpp b/src/render/backend/quniformvalue.cpp
index 8c8c1bfa2..33d5d966f 100644
--- a/src/render/backend/quniformvalue.cpp
+++ b/src/render/backend/quniformvalue.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,76 +55,68 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-QUniformValue::QUniformValue()
+void QUniformValue::apply(GraphicsContext *ctx, const ShaderUniform &description) const
{
-}
-
-QUniformValue *QUniformValue::fromVariant(const QVariant &v, Qt3DCore::QFrameAllocator *allocator)
-{
- QUniformValue *u = allocator->allocate<QUniformValue>();
- u->m_var = v;
- return u;
-}
-
-bool QUniformValue::operator ==(const QUniformValue &other)
-{
- return (other.m_var == m_var);
-}
+ switch (m_type) {
+ case Value:
+ ctx->bindUniform(m_var, description);
+ break;
+
+ case TextureSampler:
+ // We assume that the texture has been successfully bound and attache to a texture unit
+ if (m_textureIdUnit.m_textureUnit != -1) {
+ ctx->bindUniform(m_textureIdUnit.m_textureUnit, description);
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
+ int err = ctx->openGLContext()->functions()->glGetError();
+ if (err) {
+ qCWarning(Render::Backend, "Error %d after setting uniform \"%s\" at location %d",
+ err, qUtf8Printable(description.m_name), description.m_location);
+ }
+#endif
+ } else {
+ qCWarning(Render::Backend, "Invalid texture unit supplied for \"%s\"",
+ qUtf8Printable(description.m_nameId));
+ }
+ break;
-bool QUniformValue::operator !=(const QUniformValue &other)
-{
- return !operator ==(other);
+ default:
+ break;
+ }
}
-void QUniformValue::apply(GraphicsContext *ctx, const ShaderUniform &shaderDescription) const
-{
- ctx->bindUniform(m_var, shaderDescription);
-}
-QUniformPack::~QUniformPack()
+ShaderParameterPack::~ShaderParameterPack()
{
m_uniforms.clear();
}
-void QUniformPack::setUniform(const QString &glslName, const QUniformValue *val)
+void ShaderParameterPack::setUniform(const int glslNameId, const QUniformValue &val)
{
- m_uniforms.insert(glslName, val);
+ m_uniforms.insert(glslNameId, val);
}
-void QUniformPack::setTexture(const QString &glslName, const Qt3DCore::QNodeId &texId)
+void ShaderParameterPack::setTexture(const int glslNameId, Qt3DCore::QNodeId texId)
{
for (int t=0; t<m_textures.size(); ++t) {
- if (m_textures[t].glslName != glslName) {
+ if (m_textures[t].glslNameId != glslNameId)
continue;
- }
m_textures[t].texId = texId;
return;
}
- m_textures.append(NamedTexture(glslName, texId));
+ m_textures.append(NamedTexture(glslNameId, texId));
}
// Contains Uniform Block Index and QNodeId of the ShaderData (UBO)
-void QUniformPack::setUniformBuffer(const BlockToUBO &blockToUBO)
+void ShaderParameterPack::setUniformBuffer(BlockToUBO blockToUBO)
{
- m_uniformBuffers.append(blockToUBO);
+ m_uniformBuffers.append(std::move(blockToUBO));
}
-void TextureUniform::apply(GraphicsContext *ctx, const ShaderUniform &description) const
+void ShaderParameterPack::setShaderStorageBuffer(BlockToSSBO blockToSSBO)
{
- // We assume that the texture has been successfully bound and attache to a texture unit
- if (m_textureUnit != -1) {
- ctx->bindUniform(m_textureUnit, description);
- int err = ctx->openGLContext()->functions()->glGetError();
- if (err) {
- qCWarning(Render::Backend, "Error %d after setting uniform \"%s\" at location %d",
- err, qUtf8Printable(description.m_name), description.m_location);
- }
- } else {
- qCWarning(Render::Backend, "Invalid texture unit supplied for \"%s\"",
- qUtf8Printable(description.m_name));
- }
+ m_shaderStorageBuffers.push_back(std::move(blockToSSBO));
}
} // namespace Render
diff --git a/src/render/backend/quniformvalue_p.h b/src/render/backend/quniformvalue_p.h
index 9f0381200..4938b9249 100644
--- a/src/render/backend/quniformvalue_p.h
+++ b/src/render/backend/quniformvalue_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,7 +57,6 @@
#include <QOpenGLShaderProgram>
#include <Qt3DCore/qnodeid.h>
#include <Qt3DRender/private/renderlogging_p.h>
-
#include <Qt3DRender/private/shadervariables_p.h>
QT_BEGIN_NAMESPACE
@@ -69,114 +71,175 @@ namespace Qt3DRender {
namespace Render {
class GraphicsContext;
-/**
- * @brief The QUniformValue class - immutable storage of uniform value
- * in the rendering backend.
- */
+
class QUniformValue
{
public:
- QUniformValue();
- virtual ~QUniformValue() {}
-
- static QUniformValue *fromVariant(const QVariant &v, Qt3DCore::QFrameAllocator *allocator);
+ enum UniformType {
+ Value,
+ TextureSampler,
+ Unknown
+ };
- virtual bool operator ==(const QUniformValue &other);
- bool operator !=(const QUniformValue &other);
+ QUniformValue()
+ : m_type(Unknown)
+ , m_var()
+ {
+ }
- virtual bool isTexture() const
+ explicit QUniformValue(const QVariant &var, UniformType type = Value)
+ : m_type(type)
+ , m_var(var)
{
- return false;
}
- virtual void apply(GraphicsContext *ctx, const ShaderUniform &description) const;
+ void setType(UniformType type) Q_DECL_NOTHROW { m_type = type; }
+ UniformType type() Q_DECL_NOEXCEPT { return m_type; }
+ bool isTexture() const Q_DECL_NOEXCEPT { return m_type == TextureSampler; }
-protected:
- QVariant m_var;
-};
+ void setValue(const QVariant &value) Q_DECL_NOEXCEPT
+ {
+ Q_ASSERT(m_type == Value);
+ m_var = value;
+ }
-class TextureUniform : public QUniformValue
-{
-public :
- TextureUniform()
- : QUniformValue()
- , m_textureUnit(-1)
+ QVariant value() const
{
+ Q_ASSERT(m_type == Value);
+ return m_var;
}
- bool isTexture() const Q_DECL_FINAL
+ void setTextureUnit(int textureUnit) Q_DECL_NOEXCEPT
{
- return true;
+ Q_ASSERT(m_type == TextureSampler);
+ m_textureIdUnit.m_textureUnit = textureUnit;
}
- void setTextureId(const Qt3DCore::QNodeId &id)
+ int textureUnit() const Q_DECL_NOEXCEPT
{
- m_textureId = id;
+ Q_ASSERT(m_type == TextureSampler);
+ return m_textureIdUnit.m_textureUnit;
}
- Qt3DCore::QNodeId textureId() const { return m_textureId; }
+ void setTextureId(Qt3DCore::QNodeId textureId) Q_DECL_NOEXCEPT
+ {
+ Q_ASSERT(m_type == TextureSampler);
+ m_textureIdUnit.m_textureId = textureId;
+ }
+
+ Qt3DCore::QNodeId textureId() const Q_DECL_NOEXCEPT
+ {
+ Q_ASSERT(m_type == TextureSampler);
+ return m_textureIdUnit.m_textureId;
+ }
- bool operator ==(const QUniformValue &other) Q_DECL_OVERRIDE
+ bool operator ==(const QUniformValue &other) Q_DECL_NOEXCEPT
{
- if (other.isTexture()) {
- const TextureUniform *otherTex = static_cast<const TextureUniform *>(&other);
- return otherTex->textureId() == m_textureId;
+ if (other.m_type != m_type)
+ return false;
+
+ switch (m_type) {
+ case Value:
+ return other.m_var == m_var;
+ case TextureSampler:
+ return other.m_textureIdUnit == m_textureIdUnit;
+ default:
+ break;
}
return false;
}
- // Called by the QGraphicContext prior applying
- void setTextureUnit(int textureUnit) { m_textureUnit = textureUnit; }
+ bool operator !=(const QUniformValue &other) Q_DECL_NOEXCEPT
+ {
+ return !operator ==(other);
+ }
- void apply(GraphicsContext *ctx, const ShaderUniform &description) const Q_DECL_OVERRIDE;
+ void apply(GraphicsContext *ctx, const ShaderUniform &description) const;
-private:
- Qt3DCore::QNodeId m_textureId;
- int m_textureUnit;
+protected:
+ struct TextureIdUnit {
+ Qt3DCore::QNodeId m_textureId;
+ int m_textureUnit;
+
+ TextureIdUnit()
+ : m_textureId()
+ , m_textureUnit(-1)
+ {}
+
+ bool operator == (const TextureIdUnit &other) const Q_DECL_NOEXCEPT
+ {
+ return (other.m_textureId == m_textureId) && (other.m_textureUnit == m_textureUnit);
+ }
+
+ bool operator !=(const TextureIdUnit &other) const Q_DECL_NOEXCEPT
+ {
+ return !operator ==(other);
+ }
+ };
+
+ // TODO: Replace QVariant with our own union of GLSL types as we don't
+ // need the full flexibility of QVariant on the backend
+ UniformType m_type;
+ QVariant m_var;
+ TextureIdUnit m_textureIdUnit;
};
struct BlockToUBO {
int m_blockIndex;
- Qt3DCore::QNodeId m_shaderDataID;
+ Qt3DCore::QNodeId m_bufferID;
bool m_needsUpdate;
QHash<QString, QVariant> m_updatedProperties;
};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToUBO, Q_MOVABLE_TYPE)
+
+struct BlockToSSBO {
+ int m_blockIndex;
+ Qt3DCore::QNodeId m_bufferID;
+};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, BlockToSSBO, Q_PRIMITIVE_TYPE)
+
-class QUniformPack
+typedef QHash<int, QUniformValue> PackUniformHash;
+
+class ShaderParameterPack
{
public:
- ~QUniformPack();
+ ~ShaderParameterPack();
- void setUniform(const QString &glslName, const QUniformValue *val);
- void setTexture(const QString &glslName, const Qt3DCore::QNodeId &id);
- void setUniformBuffer(const BlockToUBO &blockToUBO);
+ void setUniform(const int glslNameId, const QUniformValue &val);
+ void setTexture(const int glslNameId, Qt3DCore::QNodeId id);
+ void setUniformBuffer(BlockToUBO blockToUBO);
+ void setShaderStorageBuffer(BlockToSSBO blockToSSBO);
- inline const QHash<QString, const QUniformValue* > &uniforms() const { return m_uniforms; }
- const QUniformValue *uniform(const QString &glslName) const { return m_uniforms.value(glslName); }
+ inline PackUniformHash &uniforms() { return m_uniforms; }
+ inline const PackUniformHash &uniforms() const { return m_uniforms; }
+ QUniformValue uniform(const int glslNameId) const { return m_uniforms.value(glslNameId); }
struct NamedTexture
{
NamedTexture() {}
- NamedTexture(const QString &nm, const Qt3DCore::QNodeId &t)
- : glslName(nm)
+ NamedTexture(const int nm, Qt3DCore::QNodeId t)
+ : glslNameId(nm)
, texId(t)
{ }
- QString glslName;
+ int glslNameId;
Qt3DCore::QNodeId texId;
};
inline QVector<NamedTexture> textures() const { return m_textures; }
inline QVector<BlockToUBO> uniformBuffers() const { return m_uniformBuffers; }
-
+ inline QVector<BlockToSSBO> shaderStorageBuffers() const { return m_shaderStorageBuffers; }
private:
- QHash<QString, const QUniformValue* > m_uniforms;
+ PackUniformHash m_uniforms;
QVector<NamedTexture> m_textures;
QVector<BlockToUBO> m_uniformBuffers;
+ QVector<BlockToSSBO> m_shaderStorageBuffers;
friend class RenderView;
};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ShaderParameterPack::NamedTexture, Q_PRIMITIVE_TYPE)
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/backend/render-backend.pri b/src/render/backend/render-backend.pri
index e77feaa48..01318aeb8 100644
--- a/src/render/backend/render-backend.pri
+++ b/src/render/backend/render-backend.pri
@@ -1,3 +1,6 @@
+#DEFINES += QT3D_RENDER_VIEW_JOB_TIMING
+#DEFINES += QT3D_RENDER_DUMP_BACKEND_NODES
+
INCLUDEPATH += $$PWD
HEADERS += \
@@ -10,7 +13,6 @@ HEADERS += \
$$PWD/renderqueue_p.h \
$$PWD/parameterpack_p.h \
$$PWD/rendertarget_p.h \
- $$PWD/renderattachment_p.h \
$$PWD/attachmentpack_p.h \
$$PWD/shadervariables_p.h \
$$PWD/qgraphicsutils_p.h \
@@ -27,7 +29,13 @@ HEADERS += \
$$PWD/triangleboundingvolume_p.h \
$$PWD/openglvertexarrayobject_p.h \
$$PWD/trianglesextractor_p.h \
- $$PWD/abstractrenderer_p.h
+ $$PWD/trianglesvisitor_p.h \
+ $$PWD/abstractrenderer_p.h \
+ $$PWD/computecommand_p.h \
+ $$PWD/rendersettings_p.h \
+ $$PWD/stringtoint_p.h \
+ $$PWD/backendnode_p.h \
+ $$PWD/rendertargetoutput_p.h
SOURCES += \
$$PWD/renderthread.cpp \
@@ -39,8 +47,7 @@ SOURCES += \
$$PWD/renderqueue.cpp \
$$PWD/parameterpack.cpp \
$$PWD/rendertarget.cpp \
- $$PWD/renderattachment.cpp \
- $$PWD/attachmentpack.cpp \
+ $$PWD/managers.cpp \
$$PWD/platformsurfacefilter.cpp \
$$PWD/cameralens.cpp \
$$PWD/entity.cpp \
@@ -49,4 +56,12 @@ SOURCES += \
$$PWD/boundingvolumedebug.cpp \
$$PWD/nodemanagers.cpp \
$$PWD/triangleboundingvolume.cpp \
- $$PWD/trianglesextractor.cpp
+ $$PWD/trianglesextractor.cpp \
+ $$PWD/trianglesvisitor.cpp \
+ $$PWD/computecommand.cpp \
+ $$PWD/rendersettings.cpp \
+ $$PWD/stringtoint.cpp \
+ $$PWD/backendnode.cpp \
+ $$PWD/rendertargetoutput.cpp \
+ $$PWD/attachmentpack.cpp
+
diff --git a/src/render/backend/renderattachment.cpp b/src/render/backend/renderattachment.cpp
deleted file mode 100644
index 231a19254..000000000
--- a/src/render/backend/renderattachment.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <Qt3DRender/private/renderattachment_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qtexture.h>
-#include <QVariant>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-namespace Render {
-
-RenderAttachment::RenderAttachment()
- : QBackendNode()
-{
-}
-
-void RenderAttachment::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QRenderAttachment *attachment = static_cast<QRenderAttachment *>(peer);
-
- m_attachmentData.m_mipLevel = attachment->mipLevel();
- m_attachmentData.m_layer = attachment->layer();
- m_attachmentData.m_type = attachment->type();
- m_attachmentData.m_face = attachment->face();
- m_attachmentData.m_name = attachment->name();
- if (attachment->texture())
- m_attachmentData.m_textureUuid = attachment->texture()->id();
-}
-
-Qt3DCore::QNodeId RenderAttachment::textureUuid() const
-{
- return m_attachmentData.m_textureUuid;
-}
-
-int RenderAttachment::mipLevel() const
-{
- return m_attachmentData.m_mipLevel;
-}
-
-int RenderAttachment::layer() const
-{
- return m_attachmentData.m_layer;
-}
-
-QString RenderAttachment::name() const
-{
- return m_attachmentData.m_name;
-}
-
-QRenderAttachment::CubeMapFace RenderAttachment::face() const
-{
- return m_attachmentData.m_face;
-}
-
-QRenderAttachment::RenderAttachmentType RenderAttachment::type() const
-{
- return m_attachmentData.m_type;
-}
-
-void RenderAttachment::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (e->type() == NodeUpdated) {
- if (propertyChange->propertyName() == QByteArrayLiteral("type")) {
- m_attachmentData.m_type = static_cast<QRenderAttachment::RenderAttachmentType>(propertyChange->value().toInt());
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("texture")) {
- m_attachmentData.m_textureUuid = propertyChange->value().value<QNodeId>();
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("mipLevel")) {
- m_attachmentData.m_mipLevel = propertyChange->value().toInt();
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("layer")) {
- m_attachmentData.m_layer = propertyChange->value().toInt();
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("face")) {
- m_attachmentData.m_face = static_cast<QRenderAttachment::CubeMapFace>(propertyChange->value().toInt());
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("name")) {
- m_attachmentData.m_name = propertyChange->value().toString();
- }
- }
-}
-
-Attachment RenderAttachment::attachment() const
-{
- return m_attachmentData;
-}
-
-} // namespace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/backend/renderattachment_p.h b/src/render/backend/renderattachment_p.h
deleted file mode 100644
index 9b6c5f8bf..000000000
--- a/src/render/backend/renderattachment_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_RENDERATTACHMENT_H
-#define QT3DRENDER_RENDER_RENDERATTACHMENT_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/qrenderattachment.h>
-#include <Qt3DRender/private/attachmentpack_p.h>
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QRenderAttachment;
-
-namespace Render {
-
-class AttachmentManager;
-
-class RenderAttachment : public Qt3DCore::QBackendNode
-{
-public:
- RenderAttachment();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
- Qt3DCore::QNodeId textureUuid() const;
- int mipLevel() const;
- int layer() const;
- QString name() const;
- QRenderAttachment::CubeMapFace face() const;
- QRenderAttachment::RenderAttachmentType type() const;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- Attachment attachment() const;
-
-private:
- Qt3DCore::QNodeId m_attachmentUuid;
- Attachment m_attachmentData;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_RENDERATTACHMENT_H
diff --git a/src/render/backend/rendercommand.cpp b/src/render/backend/rendercommand.cpp
index 6def67187..7ab072e79 100644
--- a/src/render/backend/rendercommand.cpp
+++ b/src/render/backend/rendercommand.cpp
@@ -1,41 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "rendercommand_p.h"
-#include <Qt3DRender/qsortcriterion.h>
QT_BEGIN_NAMESPACE
@@ -43,9 +45,17 @@ namespace Qt3DRender {
namespace Render {
RenderCommand::RenderCommand()
- : m_sortBackToFront(false)
+ : m_instancesCount(0)
+ , m_stateSet(nullptr)
+ , m_depth(0.0f)
+ , m_changeCost(0)
+ , m_type(RenderCommand::Draw)
+ , m_sortBackToFront(false)
{
m_sortingType.global = 0;
+ m_workGroups[0] = 0;
+ m_workGroups[1] = 0;
+ m_workGroups[2] = 0;
}
bool compareCommands(RenderCommand *r1, RenderCommand *r2)
diff --git a/src/render/backend/rendercommand_p.h b/src/render/backend/rendercommand_p.h
index 88aa424e4..c344d105f 100644
--- a/src/render/backend/rendercommand_p.h
+++ b/src/render/backend/rendercommand_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -73,7 +76,7 @@ public:
HVao m_vao; // VAO used during the submission step to store all states and VBOs
HShader m_shader; // Shader for given pass and mesh
- QUniformPack m_uniforms; // Might need to be reworked so as to be able to destroy the
+ ShaderParameterPack m_parameterPack; // Might need to be reworked so as to be able to destroy the
// Texture while submission is happening.
GLint m_instancesCount; // Number of instances of the mesh, if 0 regular draw otherwise glDrawArraysInstanced or glDrawElementsInstanced
RenderStateSet *m_stateSet;
@@ -83,18 +86,26 @@ public:
// A QAttribute pack might be interesting
// This is a temporary fix in the meantime, to remove the hacked methods in Technique
- QHash<QString, QString> m_parameterAttributeToShaderNames;
+ QVector<int> m_attributes;
float m_depth;
int m_changeCost;
uint m_shaderDna;
+ enum CommandType {
+ Draw,
+ Compute
+ };
+
+ CommandType m_type;
+
union sortingType {
char sorts[4];
int global;
} m_sortingType;
bool m_sortBackToFront;
+ int m_workGroups[3];
};
bool compareCommands(RenderCommand *r1, RenderCommand *r2);
diff --git a/src/render/backend/renderconfiguration.cpp b/src/render/backend/renderconfiguration.cpp
index ad350cb7b..730676996 100644
--- a/src/render/backend/renderconfiguration.cpp
+++ b/src/render/backend/renderconfiguration.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/backend/renderconfiguration_p.h b/src/render/backend/renderconfiguration_p.h
index c3b1eec2f..9aa950faa 100644
--- a/src/render/backend/renderconfiguration_p.h
+++ b/src/render/backend/renderconfiguration_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp
index e2d4ef768..e51d46031 100644
--- a/src/render/backend/renderer.cpp
+++ b/src/render/backend/renderer.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -41,14 +44,13 @@
#include <Qt3DRender/qmaterial.h>
#include <Qt3DRender/qmesh.h>
-#include <Qt3DRender/qparametermapping.h>
#include <Qt3DRender/qrenderpass.h>
#include <Qt3DRender/qshaderprogram.h>
#include <Qt3DRender/qtechnique.h>
#include <Qt3DRender/qrenderaspect.h>
#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qabstractsceneparser.h>
+#include <Qt3DRender/private/qsceneiohandler_p.h>
#include <Qt3DRender/private/renderviewjob_p.h>
#include <Qt3DRender/private/renderstates_p.h>
#include <Qt3DRender/private/cameraselectornode_p.h>
@@ -76,15 +78,16 @@
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/geometryrenderermanager_p.h>
#include <Qt3DRender/private/openglvertexarrayobject_p.h>
+#include <Qt3DRender/private/platformsurfacefilter_p.h>
-#include <Qt3DCore/qcameralens.h>
+#include <Qt3DRender/qcameralens.h>
#include <Qt3DCore/private/qeventfilterservice_p.h>
#include <Qt3DCore/private/qabstractaspectjobmanager_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <QStack>
#include <QSurface>
#include <QElapsedTimer>
-#include <QOpenGLDebugLogger>
#include <QLibraryInfo>
#include <QPluginLoader>
#include <QDir>
@@ -92,9 +95,17 @@
#include <QOffscreenSurface>
#include <QWindow>
+#include <QtGui/private/qopenglcontext_p.h>
+
// For Debug purposes only
#include <QThread>
+
+#ifdef QT3D_JOBS_RUN_STATS
+#include <Qt3DCore/private/qthreadpooler_p.h>
+#include <Qt3DRender/private/job_common_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
using namespace Qt3DCore;
@@ -102,23 +113,15 @@ using namespace Qt3DCore;
namespace Qt3DRender {
namespace Render {
-static void logOpenGLDebugMessage(const QOpenGLDebugMessage &debugMessage)
-{
- qDebug() << "OpenGL debug message:" << debugMessage;
-}
-
-const QString SCENE_PARSERS_PATH = QStringLiteral("/sceneparsers");
-
-
/*!
\internal
Renderer shutdown procedure:
Since the renderer relies on the surface and OpenGLContext to perform its cleanup,
- it is shutdown when the surface is set to Q_NULLPTR
+ it is shutdown when the surface is set to nullptr
- When the surface is set to Q_NULLPTR this will request the RenderThread to terminate
+ When the surface is set to nullptr this will request the RenderThread to terminate
and will prevent createRenderBinJobs from returning a set of jobs as there is nothing
more to be rendered.
@@ -131,19 +134,23 @@ const QString SCENE_PARSERS_PATH = QStringLiteral("/sceneparsers");
*/
Renderer::Renderer(QRenderAspect::RenderType type)
- : m_services(Q_NULLPTR)
- , m_nodesManager(Q_NULLPTR)
- , m_graphicsContext(Q_NULLPTR)
- , m_surface(Q_NULLPTR)
+ : m_services(nullptr)
+ , m_nodesManager(nullptr)
+ , m_defaultMaterial(nullptr)
+ , m_defaultRenderStateSet(nullptr)
+ , m_graphicsContext(nullptr)
, m_renderQueue(new RenderQueue())
- , m_renderThread(type == QRenderAspect::Threaded ? new RenderThread(this) : Q_NULLPTR)
+ , m_renderThread(type == QRenderAspect::Threaded ? new RenderThread(this) : nullptr)
, m_vsyncFrameAdvanceService(new VSyncFrameAdvanceService())
- , m_debugLogger(Q_NULLPTR)
+ , m_waitForInitializationToBeCompleted(0)
, m_pickEventFilter(new PickEventFilter())
, m_exposed(0)
- , m_glContext(Q_NULLPTR)
- , m_pickBoundingVolumeJob(Q_NULLPTR)
+ , m_changeSet(0)
+ , m_lastFrameCorrect(0)
+ , m_glContext(nullptr)
+ , m_pickBoundingVolumeJob(nullptr)
, m_time(0)
+ , m_settings(nullptr)
{
// Set renderer as running - it will wait in the context of the
// RenderThread for RenderViews to be submitted
@@ -154,6 +161,24 @@ Renderer::Renderer(QRenderAspect::RenderType type)
Renderer::~Renderer()
{
+ // If using a threaded rendering approach, tell the thread to exit
+ // and wait for it to be done
+ m_running.fetchAndStoreOrdered(0);
+ if (m_renderThread)
+ m_renderThread->wait();
+
+ delete m_renderQueue;
+ delete m_defaultMaterial;
+ delete m_defaultRenderStateSet;
+}
+
+void Renderer::dumpInfo() const
+{
+ qDebug() << Q_FUNC_INFO << "t =" << m_time;
+
+ const ShaderManager *shaderManager = m_nodesManager->shaderManager();
+ qDebug() << "=== Shader Manager ===";
+ qDebug() << *shaderManager;
}
qint64 Renderer::time() const
@@ -208,24 +233,21 @@ void Renderer::buildDefaultTechnique()
basicPass->setShaderProgram(defaultShader);
m_defaultRenderStateSet = new RenderStateSet;
- m_defaultRenderStateSet->addState(DepthTest::getOrCreate(GL_LESS));
- m_defaultRenderStateSet->addState(CullFace::getOrCreate(GL_BACK));
- m_defaultRenderStateSet->addState(ColorMask::getOrCreate(true, true, true, true));
+ m_defaultRenderStateSet->addState(getOrCreateRenderStateImpl<DepthTest>(GL_LESS));
+ m_defaultRenderStateSet->addState(getOrCreateRenderStateImpl<CullFace>(GL_BACK));
+ m_defaultRenderStateSet->addState(getOrCreateRenderStateImpl<ColorMask>(true, true, true, true));
//basicPass->setStateSet(m_defaultRenderStateSet);
- m_defaultTechnique->addPass(basicPass);
+ m_defaultTechnique->addRenderPass(basicPass);
- QParameter* ka = new QParameter(QStringLiteral("ambient"), QVector3D(0.2f, 0.2f, 0.2f));
+ QParameter* ka = new QParameter(QStringLiteral("ka"), QVector3D(0.2f, 0.2f, 0.2f));
m_defaultTechnique->addParameter(ka);
- basicPass->addBinding(new QParameterMapping(QStringLiteral("ambient"), QStringLiteral("ka"), QParameterMapping::Uniform));
- QParameter* kd = new QParameter(QStringLiteral("diffuse"), QVector3D(1.0f, 0.5f, 0.0f));
+ QParameter* kd = new QParameter(QStringLiteral("kd"), QVector3D(1.0f, 0.5f, 0.0f));
m_defaultTechnique->addParameter(kd);
- basicPass->addBinding(new QParameterMapping(QStringLiteral("diffuse"), QStringLiteral("kd"), QParameterMapping::Uniform));
- QParameter* ks = new QParameter(QStringLiteral("specular"), QVector3D(0.01f, 0.01f, 0.01f));
+ QParameter* ks = new QParameter(QStringLiteral("ks"), QVector3D(0.01f, 0.01f, 0.01f));
m_defaultTechnique->addParameter(ks);
- basicPass->addBinding(new QParameterMapping(QStringLiteral("specular"), QStringLiteral("ks"), QParameterMapping::Uniform));
m_defaultTechnique->addParameter(new QParameter(QStringLiteral("shininess"), 150.0f));
}
@@ -277,7 +299,7 @@ void Renderer::createThreadLocalAllocator(void *renderer)
// RenderCommand has a sizeof 128
// QMatrix4x4 has a sizeof 68
// May need to fine tune parameters passed to QFrameAllocator for best performances
- QFrameAllocator *allocator = new QFrameAllocator(128, 16, 128);
+ QFrameAllocator *allocator = new QFrameAllocator(192, 16, 128);
theRenderer->tlsAllocators()->setLocalData(allocator);
// Add the allocator to the renderer
@@ -308,7 +330,7 @@ void Renderer::destroyThreadLocalAllocator(void *renderer)
allocator->clear();
// Setting the local data to null actually deletes the allocatorQeue
// as the tls object takes ownership of pointers
- theRenderer->tlsAllocators()->setLocalData(Q_NULLPTR);
+ theRenderer->tlsAllocators()->setLocalData(nullptr);
}
}
@@ -317,81 +339,77 @@ void Renderer::destroyThreadLocalAllocator(void *renderer)
// method termintates
void Renderer::initialize()
{
- if (m_renderThread)
- m_waitForWindowToBeSetCondition.wait(mutex());
-
- QByteArray debugLoggingMode = qgetenv("QT3DRENDER_DEBUG_LOGGING");
- bool enableDebugLogging = !debugLoggingMode.isEmpty();
-
m_graphicsContext.reset(new GraphicsContext);
m_graphicsContext->setRenderer(this);
- QSurfaceFormat sf = m_surface->format();
- if (enableDebugLogging)
- sf.setOption(QSurfaceFormat::DebugContext);
+ QOpenGLContext* ctx = m_glContext;
- QOpenGLContext* ctx = m_glContext ? m_glContext : new QOpenGLContext;
+ // If we are using our own context (not provided by QtQuick),
+ // we need to create it
if (!m_glContext) {
- qCDebug(Backend) << "Creating OpenGL context with format" << sf;
- ctx->setFormat(sf);
+ ctx = new QOpenGLContext;
+ ctx->setShareContext(qt_gl_global_share_context());
+
+ // TO DO: Shouldn't we use the highest context available and trust
+ // QOpenGLContext to fall back on the best lowest supported ?
+ const QByteArray debugLoggingMode = qgetenv("QT3DRENDER_DEBUG_LOGGING");
+
+ if (!debugLoggingMode.isEmpty()) {
+ QSurfaceFormat sf = ctx->format();
+ sf.setOption(QSurfaceFormat::DebugContext);
+ ctx->setFormat(sf);
+ }
+
+ // Create OpenGL context
if (ctx->create())
qCDebug(Backend) << "OpenGL context created with actual format" << ctx->format();
else
qCWarning(Backend) << Q_FUNC_INFO << "OpenGL context creation failed";
}
- m_graphicsContext->setOpenGLContext(ctx, m_surface);
-
- if (enableDebugLogging && ctx->makeCurrent(m_surface)) {
- bool supported = ctx->hasExtension("GL_KHR_debug");
- if (supported) {
- qCDebug(Backend) << "Qt3D: Enabling OpenGL debug logging";
- m_debugLogger.reset(new QOpenGLDebugLogger);
- if (m_debugLogger->initialize()) {
- QObject::connect(m_debugLogger.data(), &QOpenGLDebugLogger::messageLogged, &logOpenGLDebugMessage);
- QString mode = QString::fromLocal8Bit(debugLoggingMode);
- m_debugLogger->startLogging(mode.toLower().startsWith(QLatin1String("sync"))
- ? QOpenGLDebugLogger::SynchronousLogging
- : QOpenGLDebugLogger::AsynchronousLogging);
-
- Q_FOREACH (const QOpenGLDebugMessage &msg, m_debugLogger->loggedMessages())
- logOpenGLDebugMessage(msg);
- }
- } else {
- qCDebug(Backend) << "Qt3D: OpenGL debug logging requested but GL_KHR_debug not supported";
- }
- ctx->doneCurrent();
- }
+
+ // Note: we don't have a surface at this point
+ // The context will be made current later on (at render time)
+ m_graphicsContext->setOpenGLContext(ctx);
// Awake setScenegraphRoot in case it was waiting
- m_waitForInitializationToBeCompleted.wakeOne();
+ m_waitForInitializationToBeCompleted.release(1);
// Allow the aspect manager to proceed
m_vsyncFrameAdvanceService->proceedToNextFrame();
}
/*!
+ * \internal
+ *
+ * Signals for the renderer to stop rendering. If a threaded renderer is in use,
+ * the render thread will call releaseGraphicsResources() just before the thread exits.
+ * If rendering synchronously, this function will call releaseGraphicsResources().
+ */
+void Renderer::shutdown()
+{
+ qCDebug(Backend) << Q_FUNC_INFO << "Requesting renderer shutdown";
+ m_running.store(0);
+ if (!m_renderThread) {
+ releaseGraphicsResources();
+ } else {
+ // Wake up the render thread in case it is waiting for some renderviews
+ // to be ready. The isReadyToSubmit() function checks for a shutdown
+ // having been requested.
+ m_submitRenderViewsSemaphore.release(1);
+ }
+}
+
+/*!
\internal
- Called in the context of the RenderThread to do any shutdown and cleanup
- that needs to be performed in the thread where the OpenGL context lives
+ When using a threaded renderer this function is called in the context of the
+ RenderThread to do any shutdown and cleanup that needs to be performed in the
+ thread where the OpenGL context lives.
*/
-void Renderer::shutdown()
+void Renderer::releaseGraphicsResources()
{
- // TO DO: Check that this works with iOs and other cases
- if (m_surface) {
- m_running.fetchAndStoreOrdered(0);
-
- m_graphicsContext->makeCurrent(m_surface);
- // Stop and destroy the OpenGL logger
- if (m_debugLogger) {
- m_debugLogger->stopLogging();
- m_debugLogger.reset(Q_NULLPTR);
- }
-
- // Clean up the graphics context
- m_graphicsContext.reset(Q_NULLPTR);
- m_surface = Q_NULLPTR;
- qCDebug(Backend) << Q_FUNC_INFO << "Renderer properly shutdown";
- }
+ // Clean up the graphics context
+ m_graphicsContext.reset(nullptr);
+ qCDebug(Backend) << Q_FUNC_INFO << "Renderer properly shutdown";
}
void Renderer::setSurfaceExposed(bool exposed)
@@ -400,116 +418,73 @@ void Renderer::setSurfaceExposed(bool exposed)
m_exposed.fetchAndStoreOrdered(exposed);
}
-void Renderer::setFrameGraphRoot(const Qt3DCore::QNodeId fgRootId)
-{
- m_frameGraphRootUuid = fgRootId;
- qCDebug(Backend) << Q_FUNC_INFO << m_frameGraphRootUuid;
-}
-
Render::FrameGraphNode *Renderer::frameGraphRoot() const
{
- FrameGraphNode **fgRoot = m_nodesManager->lookupResource<FrameGraphNode*, FrameGraphManager>(m_frameGraphRootUuid);
- if (fgRoot != Q_NULLPTR)
- return *fgRoot;
- return Q_NULLPTR;
+ Q_ASSERT(m_settings);
+ return m_nodesManager->frameGraphManager()->lookupNode(m_settings->activeFrameGraphID());
}
// QAspectThread context
// Order of execution :
-// 1) Initialize -> waiting for Window
-// 2) setWindow -> waking Initialize || setSceneGraphRoot waiting
-// 3) setWindow -> waking Initialize if setSceneGraphRoot was called before
-// 4) Initialize resuming, performing initialization and waking up setSceneGraphRoot
-// 5) setSceneGraphRoot called || setSceneGraphRoot resuming if it was waiting
+// 1) RenderThread is created -> release 1 of m_waitForInitializationToBeCompleted when started
+// 2) setSceneRoot waits to acquire initialization
+// 3) submitRenderView -> check for surface
+// -> make surface current + create proper glHelper if needed
void Renderer::setSceneRoot(QBackendNodeFactory *factory, Entity *sgRoot)
{
Q_ASSERT(sgRoot);
- QMutexLocker lock(&m_mutex); // This waits until initialize and setSurface have been called
- if (m_graphicsContext == Q_NULLPTR) // If initialization hasn't been completed we must wait
- m_waitForInitializationToBeCompleted.wait(&m_mutex);
+
+ // If initialization hasn't been completed we must wait
+ m_waitForInitializationToBeCompleted.acquire();
+
m_renderSceneRoot = sgRoot;
if (!m_renderSceneRoot)
qCWarning(Backend) << "Failed to build render scene";
m_renderSceneRoot->dump();
qCDebug(Backend) << Q_FUNC_INFO << "DUMPING SCENE";
- buildDefaultTechnique();
- buildDefaultMaterial();
- factory->createBackendNode(m_defaultMaterial);
- factory->createBackendNode(m_defaultMaterial->effect());
- factory->createBackendNode(m_defaultTechnique);
- factory->createBackendNode(m_defaultTechnique->renderPasses().first());
- factory->createBackendNode(m_defaultTechnique->renderPasses().first()->shaderProgram());
+ // Create the default materials ....
+ // Needs a QOpenGLContext (for things like isOpenGLES ...)
+ // TO DO: Maybe this should be moved elsewhere
+ {
+ buildDefaultTechnique();
+ QNodeCreatedChangeGenerator creationChangeGenerator(m_defaultTechnique);
+ const QVector<QNodeCreatedChangeBasePtr> defaultMaterialCreationChanges = creationChangeGenerator.creationChanges();
+ for (const QNodeCreatedChangeBasePtr &change : defaultMaterialCreationChanges)
+ factory->createBackendNode(change);
- // We create backend resources for all the parameters
- Q_FOREACH (QParameter *p, m_defaultMaterial->parameters())
- factory->createBackendNode(p);
- Q_FOREACH (QParameter *p, m_defaultTechnique->parameters())
- factory->createBackendNode(p);
- Q_FOREACH (QParameter *p, m_defaultMaterial->effect()->parameters())
- factory->createBackendNode(p);
+ }
+ {
+ buildDefaultMaterial();
+ QNodeCreatedChangeGenerator creationChangeGenerator(m_defaultMaterial);
+ const QVector<QNodeCreatedChangeBasePtr> defaultMaterialCreationChanges = creationChangeGenerator.creationChanges();
+ for (const QNodeCreatedChangeBasePtr &change : defaultMaterialCreationChanges)
+ factory->createBackendNode(change);
+ }
m_defaultMaterialHandle = nodeManagers()->lookupHandle<Material, MaterialManager, HMaterial>(m_defaultMaterial->id());
m_defaultEffectHandle = nodeManagers()->lookupHandle<Effect, EffectManager, HEffect>(m_defaultMaterial->effect()->id());
m_defaultTechniqueHandle = nodeManagers()->lookupHandle<Technique, TechniqueManager, HTechnique>(m_defaultTechnique->id());
- m_defaultRenderPassHandle = nodeManagers()->lookupHandle<RenderPass, RenderPassManager, HRenderPass>(m_defaultTechnique->renderPasses().first()->id());
- m_defaultRenderShader = nodeManagers()->lookupResource<Shader, ShaderManager>(m_defaultTechnique->renderPasses().first()->shaderProgram()->id());
+ m_defaultRenderPassHandle = nodeManagers()->lookupHandle<RenderPass, RenderPassManager, HRenderPass>(m_defaultTechnique->renderPasses().constFirst()->id());
+ m_defaultRenderShader = nodeManagers()->lookupResource<Shader, ShaderManager>(m_defaultTechnique->renderPasses().constFirst()->shaderProgram()->id());
}
-// Called in RenderAspect Thread context
-// Cannot do OpenGLContext initialization here
-void Renderer::setSurface(QSurface* surface)
+void Renderer::registerEventFilter(QEventFilterService *service)
{
qCDebug(Backend) << Q_FUNC_INFO << QThread::currentThread();
- // Locking this mutex will wait until initialize() has been called by
- // RenderThread::run() and the RenderThread is waiting on the
- // m_waitForWindowToBeSetCondition condition.
- //
- // The first time this is called Renderer::setSurface will cause the
- // Renderer::initialize() function to continue execution in the context
- // of the Render Thread. On subsequent calls, just the surface will be
- // updated.
-
- // setSurface(Q_NULLPTR) is also called when the window is destroyed,
- // this is the opportunity to cleanup GL resources while we still have
- // a valid QGraphicContext
-
- // TODO: Remove the need for a valid surface from the renderer initialization
- // We can use an offscreen surface to create and assess the OpenGL context.
- // This should allow us to get rid of the "swapBuffers called on a non-exposed
- // window" warning that we sometimes see.
- QMutexLocker locker(&m_mutex);
-
- // We are about to be destroyed
- // cleanup GL now
- if (surface == Q_NULLPTR) {
- // Bail out of the main render loop. Ensure that even if the render thread
- // is waiting on RenderViews to be populated that we wake up the wait condition.
- // We check for termination immediately after being awaken.
- m_running.fetchAndStoreOrdered(0);
- if (m_renderThread) { // Pure Qt3D with RenderThread case
- m_submitRenderViewsSemaphore.release(1);
- m_renderThread->wait();
- // This will call shutdown on the Renderer and cleanup GL context
- // and then set the surface to Q_NULLPTR
- m_surface = surface;
- }
- // else we are dealing with the QtQuick2 / Scene3D in which case we
- // don't set the surface to Q_NULLPTR just yet as a call to
- // QRenderAspect::renderShutdown() -> Renderer::shutdown() should
- // follow and will take care of this
- } else { // Setting a valid window on initialization
- m_surface = surface;
- m_waitForWindowToBeSetCondition.wakeOne();
- }
+ service->registerEventFilter(m_pickEventFilter.data(), 1024);
}
-void Renderer::registerEventFilter(QEventFilterService *service)
+void Renderer::setSettings(RenderSettings *settings)
{
- qCDebug(Backend) << Q_FUNC_INFO << QThread::currentThread();
- service->registerEventFilter(m_pickEventFilter.data(), 1024);
+ m_settings = settings;
+}
+
+RenderSettings *Renderer::settings() const
+{
+ return m_settings;
}
void Renderer::render()
@@ -519,7 +494,7 @@ void Renderer::render()
// Camera, RenderTarget ...
// Utimately the renderer should be a framework
- // For the processing of the list of renderbins
+ // For the processing of the list of renderviews
// Matrice update, bounding volumes computation ...
// Should be jobs
@@ -529,17 +504,69 @@ void Renderer::render()
// One framegraph description
while (m_running.load() > 0) {
- if (m_exposed.load() > 0)
- doRender();
- else
- QThread::msleep(250);
+ doRender();
+ // TO DO: Restore windows exposed detection
+ // Probably needs to happens some place else though
}
}
void Renderer::doRender()
{
- // Render using current device state and renderer configuration
- const bool submissionSucceeded = submitRenderViews();
+ bool submissionSucceeded = false;
+ Renderer::ViewSubmissionResultData submissionData;
+
+ if (isReadyToSubmit()) {
+
+#ifdef QT3D_JOBS_RUN_STATS
+ // Save start of frame
+ JobRunStats submissionStats;
+ submissionStats.jobId.typeAndInstance[0] = JobTypes::FrameSubmission;
+ submissionStats.jobId.typeAndInstance[1] = 0;
+ submissionStats.threadId = reinterpret_cast<quint64>(QThread::currentThreadId());
+ submissionStats.startTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
+#endif
+
+ // Lock the mutex to protect access to m_surface and check if we are still set
+ // to the running state and that we have a valid surface on which to draw
+ // TO DO: Is that still needed given the surface changes
+ QMutexLocker locker(&m_mutex);
+ const QVector<Render::RenderView *> renderViews = m_renderQueue->nextFrameQueue();
+
+ if (canRender() && (submissionSucceeded = renderViews.size() > 0) == true) {
+ // Clear all dirty flags but Compute so that
+ // we still render every frame when a compute shader is used in a scene
+ BackendNodeDirtySet changesToUnset = m_changeSet;
+ if (changesToUnset.testFlag(Renderer::ComputeDirty))
+ changesToUnset.setFlag(Renderer::ComputeDirty, false);
+ clearDirtyBits(changesToUnset);
+
+ // Render using current device state and renderer configuration
+ submissionData = submitRenderViews(renderViews);
+ }
+
+ // Delete all the RenderViews which will clear the allocators
+ // that were used for their allocation
+ qDeleteAll(renderViews);
+
+#ifdef QT3D_JOBS_RUN_STATS
+ // Save submission elapsed time
+ submissionStats.endTime = QThreadPooler::m_jobsStatTimer.nsecsElapsed();
+ // Note this is safe since proceedToNextFrame is the one going to trigger
+ // the write to the file, and this is performed after this step
+ Qt3DCore::QThreadPooler::addJobLogStatsEntry(submissionStats);
+ QThreadPooler::writeFrameJobLogStats();
+#endif
+ }
+
+ // Note: submissionSucceeded is false when
+ // * we cannot render because a shutdown has been scheduled
+ // * the renderqueue is incomplete (only when rendering with a Scene3D)
+ // Otherwise returns true even for cases like
+ // * No render view
+ // * No surface set
+ // * OpenGLContext failed to be set current
+ // This behavior is important as we need to
+ // call proceedToNextFrame despite rendering errors that aren't fatal
// Only reset renderQueue and proceed to next frame if the submission
// succeeded or it we are using a render thread.
@@ -560,13 +587,24 @@ void Renderer::doRender()
// Note: we can check for non render thread cases (scene3d)
// only when we are sure that a full frame was previously submitted
// (submissionSucceeded == true)
- Q_FOREACH (QFrameAllocator *allocator, m_allocators)
+ for (QFrameAllocator *allocator : qAsConst(m_allocators)) {
Q_ASSERT(allocator->isEmpty());
+ }
}
// We allow the RenderTickClock service to proceed to the next frame
// In turn this will allow the aspect manager to request a new set of jobs
// to be performed for each aspect
m_vsyncFrameAdvanceService->proceedToNextFrame();
+
+ // Perform the last swapBuffers calls after the proceedToNextFrame
+ // as this allows us to gain a bit of time for the preparation of the
+ // next frame
+ // Finish up with last surface used in the list of RenderViews
+ if (submissionSucceeded) {
+ SurfaceLocker surfaceLock(submissionData.surface);
+ // Finish up with last surface used in the list of RenderViews
+ m_graphicsContext->endDrawing(submissionData.lastBoundFBOId == m_graphicsContext->defaultFBO() && surfaceLock.isSurfaceValid());
+ }
}
}
@@ -596,27 +634,22 @@ bool Renderer::canRender() const
return false;
}
- // Make sure that the surface we are rendering too has not been unset
- // (probably due to the window being destroyed or changing QScreens).
- if (!m_surface) {
- qCDebug(Rendering) << "QSurface has been removed";
- return false;
- }
+ // TO DO: Check if all surfaces have been destroyed...
+ // It may be better if the last window to be closed trigger a call to shutdown
+ // Rather than having checks for the surface everywhere
return true;
}
-// Happens in RenderThread context when all RenderViewJobs are done
-bool Renderer::submitRenderViews()
+bool Renderer::isReadyToSubmit()
{
// If we are using a render thread, make sure that
// we've been told to render before rendering
if (m_renderThread) { // Prevent ouf of order execution
m_submitRenderViewsSemaphore.acquire(1);
- // Early return if we have been unlocked because of
- // shutdown
- if (!m_running.load())
+ // Check if shutdown has been requested
+ if (m_running.load() == 0)
return false;
// When using Thread rendering, the semaphore should only
@@ -625,7 +658,6 @@ bool Renderer::submitRenderViews()
// The case of shutdown should have been handled just before
Q_ASSERT(m_renderQueue->isFrameQueueComplete());
} else {
-
// When using synchronous rendering (QtQuick)
// We are not sure that the frame queue is actually complete
// Since a call to render may not be synched with the completions
@@ -636,52 +668,79 @@ bool Renderer::submitRenderViews()
if (!m_renderQueue->isFrameQueueComplete())
return false;
}
+ return true;
+}
+// Happens in RenderThread context when all RenderViewJobs are done
+// Returns the id of the last bound FBO
+Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Render::RenderView *> &renderViews)
+{
QElapsedTimer timer;
quint64 queueElapsed = 0;
timer.start();
- // Lock the mutex to protect access to m_surface and check if we are still set
- // to the running state and that we have a valid surface on which to draw
- QMutexLocker locker(&m_mutex);
- const QVector<Render::RenderView *> renderViews = m_renderQueue->nextFrameQueue();
- if (!canRender()) {
- qDeleteAll(renderViews);
- return false;
- }
-
const int renderViewsCount = renderViews.size();
quint64 frameElapsed = queueElapsed;
+ m_lastFrameCorrect.store(1); // everything fine until now.....
- // Early return if there's actually nothing to render
- if (renderViewsCount <= 0)
- return true;
+ qCDebug(Memory) << Q_FUNC_INFO << "rendering frame ";
// We might not want to render on the default FBO
bool boundFboIdValid = false;
- GLuint boundFboId = 0;
- QColor previousClearColor = renderViews.first()->clearColor();
-
- // Bail out if we cannot make the OpenGL context current (e.g. if the window has been destroyed)
- if (!m_graphicsContext->beginDrawing(m_surface, previousClearColor)) {
- qDeleteAll(renderViews);
- return false;
- }
-
- if (!boundFboIdValid) {
- boundFboIdValid = true;
- boundFboId = m_graphicsContext->boundFrameBufferObject();
- }
-
- // Reset state to the default state
- m_graphicsContext->setCurrentStateSet(m_defaultRenderStateSet);
-
- qCDebug(Memory) << Q_FUNC_INFO << "rendering frame ";
+ uint lastBoundFBOId = 0;
+ QSurface *surface = nullptr;
+ QSurface *previousSurface = nullptr;
+ QSurface *lastUsedSurface = nullptr;
for (int i = 0; i < renderViewsCount; ++i) {
// Initialize GraphicsContext for drawing
// If the RenderView has a RenderStateSet defined
const RenderView *renderView = renderViews.at(i);
+ // Check if using the same surface as the previous RenderView.
+ // If not, we have to free up the context from the previous surface
+ // and make the context current on the new surface
+ surface = renderView->surface();
+ SurfaceLocker surfaceLock(surface);
+
+ // TO DO: Make sure that the surface we are rendering too has not been unset
+
+ // For now, if we do not have a surface, skip this renderview
+ // TODO: Investigate if it's worth providing a fallback offscreen surface
+ // to use when surface is null. Or if we should instead expose an
+ // offscreensurface to Qt3D.
+ if (!surface || !surfaceLock.isSurfaceValid()) {
+ m_lastFrameCorrect.store(0);
+ continue;
+ }
+
+ lastUsedSurface = surface;
+
+ if (surface != previousSurface && previousSurface) {
+ const bool swapBuffers = (lastBoundFBOId == m_graphicsContext->defaultFBO()) && PlatformSurfaceFilter::isSurfaceValid(previousSurface);
+ // We only call swap buffer if we are sure the previous surface is still valid
+ m_graphicsContext->endDrawing(swapBuffers);
+ }
+
+ if (surface != previousSurface) {
+ // If we can't make the context current on the surface, skip to the
+ // next RenderView. We won't get the full frame but we may get something
+ if (!m_graphicsContext->beginDrawing(surface)) {
+ qWarning() << "Failed to make OpenGL context current on surface";
+ m_lastFrameCorrect.store(0);
+ continue;
+ }
+
+ previousSurface = surface;
+
+ if (!boundFboIdValid) {
+ boundFboIdValid = true;
+ lastBoundFBOId = m_graphicsContext->boundFrameBufferObject();
+ }
+
+ // Reset state to the default state
+ m_graphicsContext->setCurrentStateSet(m_defaultRenderStateSet);
+ }
+
// Set RenderView render state
RenderStateSet *renderViewStateSet = renderView->stateSet();
if (renderViewStateSet)
@@ -690,21 +749,38 @@ bool Renderer::submitRenderViews()
// Set RenderTarget ...
// Activate RenderTarget
m_graphicsContext->activateRenderTarget(nodeManagers()->data<RenderTarget, RenderTargetManager>(renderView->renderTargetHandle()),
- renderView->attachmentPack(), boundFboId);
+ renderView->attachmentPack(),
+ lastBoundFBOId);
+
+ // set color, depth, stencil clear values (only if needed)
+ auto clearBufferTypes = renderView->clearTypes();
+ if (clearBufferTypes & QClearBuffers::ColorBuffer && renderView->globalClearColorBuffers() != nullptr)
+ m_graphicsContext->clearColor(renderView->globalClearColorBuffers()->clearColorAsColor());
+ if (clearBufferTypes & QClearBuffers::DepthBuffer)
+ m_graphicsContext->clearDepthValue(renderView->clearDepthValue());
+ if (clearBufferTypes & QClearBuffers::StencilBuffer)
+ m_graphicsContext->clearStencilValue(renderView->clearStencilValue());
- // Set clear color if different
- if (previousClearColor != renderView->clearColor()) {
- previousClearColor = renderView->clearColor();
- m_graphicsContext->clearColor(previousClearColor);
+ // Clear BackBuffer
+ m_graphicsContext->clearBackBuffer(clearBufferTypes);
+
+ // if there are ClearColors set for different draw buffers,
+ // clear each of these draw buffers individually now
+ const QVector<const ClearBuffers*> clearDrawBuffers = renderView->specificClearColorBuffers();
+ for (const ClearBuffers *clearBuffer : clearDrawBuffers) {
+ if (!clearBuffer->bufferId().isNull()) {
+ const RenderTargetOutput *buffer = m_nodesManager->attachmentManager()->lookupResource(clearBuffer->bufferId());
+ const int drawBufferIndex = renderView->attachmentPack().getDrawBufferIndex(buffer->point());
+ m_graphicsContext->clearBufferf(drawBufferIndex, clearBuffer->clearColor());
+ }
}
- // Clear BackBuffer
- m_graphicsContext->clearBackBuffer(renderView->clearBuffer());
// Set the Viewport
- m_graphicsContext->setViewport(renderView->viewport());
+ m_graphicsContext->setViewport(renderView->viewport(), renderView->surfaceSize() * renderView->devicePixelRatio());
// Execute the render commands
- executeCommands(renderView->commands());
+ if (!executeCommands(renderView))
+ m_lastFrameCorrect.store(0); // something went wrong; make sure to render the next frame!
// executeCommands takes care of restoring the stateset to the value
// of gc->currentContext() at the moment it was called (either
@@ -715,34 +791,76 @@ bool Renderer::submitRenderViews()
frameElapsed = timer.elapsed();
}
- // Reset state to the default state if the last stateset is not the
- // defaultRenderStateSet
- if (m_graphicsContext->currentStateSet() != m_defaultRenderStateSet)
- m_graphicsContext->setCurrentStateSet(m_defaultRenderStateSet);
-
- m_graphicsContext->endDrawing(boundFboId == m_graphicsContext->defaultFBO());
-
- // Delete all the RenderViews which will clear the allocators
- // that were used for their allocation
- qDeleteAll(renderViews);
+ // Reset state and call doneCurrent if the surface
+ // is valid and was actually activated
+ if (surface && m_graphicsContext->hasValidGLHelper()) {
+ // Reset state to the default state if the last stateset is not the
+ // defaultRenderStateSet
+ if (m_graphicsContext->currentStateSet() != m_defaultRenderStateSet)
+ m_graphicsContext->setCurrentStateSet(m_defaultRenderStateSet);
+ }
queueElapsed = timer.elapsed() - queueElapsed;
qCDebug(Rendering) << Q_FUNC_INFO << "Submission of Queue in " << queueElapsed << "ms <=> " << queueElapsed / renderViewsCount << "ms per RenderView <=> Avg " << 1000.0f / (queueElapsed * 1.0f/ renderViewsCount * 1.0f) << " RenderView/s";
qCDebug(Rendering) << Q_FUNC_INFO << "Submission Completed in " << timer.elapsed() << "ms";
+ // Stores the necessary information to safely perform
+ // the last swap buffer call
+ ViewSubmissionResultData resultData;
+ resultData.lastBoundFBOId = lastBoundFBOId;
+ resultData.surface = lastUsedSurface;
+
+ return resultData;
+}
+
+void Renderer::markDirty(BackendNodeDirtySet changes, BackendNode *node)
+{
+ Q_UNUSED(node);
+ m_changeSet |= changes;
+}
+
+Renderer::BackendNodeDirtySet Renderer::dirtyBits()
+{
+ return m_changeSet;
+}
+
+void Renderer::clearDirtyBits(BackendNodeDirtySet changes)
+{
+ m_changeSet &= ~changes;
+}
+
+bool Renderer::shouldRender()
+{
+ // Only render if something changed during the last frame, or the last frame
+ // was not rendered successfully
+ // TODO: Reinstate the proper logic here when it catches all cases
return true;
+ // was not rendered successfully (or render-on-demand is disabled)
+ return (m_settings->renderPolicy() == QRenderSettings::Always
+ || m_changeSet != 0
+ || !m_lastFrameCorrect.load());
+}
+
+void Renderer::skipNextFrame()
+{
+ Q_ASSERT(m_settings->renderPolicy() != QRenderSettings::Always);
+
+ // make submitRenderViews() actually run
+ m_renderQueue->setNoRender();
+ m_submitRenderViewsSemaphore.release(1);
}
// Waits to be told to create jobs for the next frame
// Called by QRenderAspect jobsToExecute context of QAspectThread
QVector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
{
+ QVector<QAspectJobPtr> renderBinJobs;
+
// Traverse the current framegraph. For each leaf node create a
// RenderView and set its configuration then create a job to
// populate the RenderView with a set of RenderCommands that get
// their details from the RenderNodes that are visible to the
// Camera selected by the framegraph configuration
- QVector<QAspectJobPtr> renderBinJobs;
FrameGraphVisitor visitor;
visitor.traverse(frameGraphRoot(), this, &renderBinJobs);
@@ -767,8 +885,11 @@ Qt3DCore::QAspectJobPtr Renderer::createRenderViewJob(FrameGraphNode *node, int
{
RenderViewJobPtr job(new RenderViewJob);
job->setRenderer(this);
- if (m_surface)
- job->setSurfaceSize(m_surface->size());
+ // if (m_surface)
+ // job->setSurfaceSize(m_surface->size());
+ // TO DO: the surface size can only be set by the RenderView
+ // since the only the RenderView will know about the surface
+ // it should be renderer onto
job->setFrameGraphLeafNode(node);
job->setSubmitOrderIndex(submitOrderIndex);
return job;
@@ -779,161 +900,197 @@ QAbstractFrameAdvanceService *Renderer::frameAdvanceService() const
return static_cast<Qt3DCore::QAbstractFrameAdvanceService *>(m_vsyncFrameAdvanceService.data());
}
-// Called by RenderView->submit() in RenderThread context
-void Renderer::executeCommands(const QVector<RenderCommand *> &commands)
+// Called by executeCommands
+void Renderer::performDraw(GeometryRenderer *rGeometryRenderer, GLsizei primitiveCount, Attribute *indexAttribute)
{
- // Render drawing commands
+ const GLint primType = rGeometryRenderer->primitiveType();
+ const bool drawIndexed = indexAttribute != nullptr;
+ const GLint indexType = drawIndexed ? GraphicsContext::glDataTypeFromAttributeDataType(indexAttribute->vertexBaseType()) : 0;
+
+ if (rGeometryRenderer->primitiveType() == QGeometryRenderer::Patches)
+ m_graphicsContext->setVerticesPerPatch(rGeometryRenderer->verticesPerPatch());
+
+ if (rGeometryRenderer->primitiveRestartEnabled())
+ m_graphicsContext->enablePrimitiveRestart(rGeometryRenderer->restartIndexValue());
+
+ // TO DO: Add glMulti Draw variants
+ if (drawIndexed) {
+ m_graphicsContext->drawElementsInstancedBaseVertexBaseInstance(primType,
+ primitiveCount,
+ indexType,
+ reinterpret_cast<void*>(quintptr(indexAttribute->byteOffset())),
+ rGeometryRenderer->instanceCount(),
+ rGeometryRenderer->indexOffset(),
+ rGeometryRenderer->firstVertex());
+ } else {
+ m_graphicsContext->drawArraysInstancedBaseInstance(primType,
+ rGeometryRenderer->firstInstance(),
+ primitiveCount,
+ rGeometryRenderer->instanceCount(),
+ rGeometryRenderer->firstVertex());
+ }
- // Use the graphicscontext to submit the commands to the underlying
- // graphics API (OpenGL)
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
+ int err = m_graphicsContext->openGLContext()->functions()->glGetError();
+ if (err)
+ qCWarning(Rendering) << "GL error after drawing mesh:" << QString::number(err, 16);
+#endif
- // Save the RenderView base stateset
- RenderStateSet *globalState = m_graphicsContext->currentStateSet();
- OpenGLVertexArrayObject *vao = Q_NULLPTR;
- HVao previousVaoHandle;
+ if (rGeometryRenderer->primitiveRestartEnabled())
+ m_graphicsContext->disablePrimitiveRestart();
- Q_FOREACH (RenderCommand *command, commands) {
+ // Unset dirtiness on rGeometryRenderer only
+ // The rGeometry may be shared by several rGeometryRenderer
+ // so we cannot unset its dirtiness at this point
+ rGeometryRenderer->unsetDirty();
+}
- // Check if we have a valid GeometryRenderer + Geometry
- Geometry *rGeometry = m_nodesManager->data<Geometry, GeometryManager>(command->m_geometry);
- GeometryRenderer *rGeometryRenderer = m_nodesManager->data<GeometryRenderer, GeometryRendererManager>(command->m_geometryRenderer);
- const bool hasGeometryRenderer = rGeometry != Q_NULLPTR && rGeometryRenderer != Q_NULLPTR && !rGeometry->attributes().isEmpty();
+void Renderer::performCompute(const RenderView *, RenderCommand *command)
+{
+ Shader *shader = m_nodesManager->data<Shader, ShaderManager>(command->m_shader);
+ if (shader != nullptr) {
+ m_graphicsContext->activateShader(shader);
+ m_graphicsContext->setParameters(command->m_parameterPack);
+ m_graphicsContext->dispatchCompute(command->m_workGroups[0],
+ command->m_workGroups[1],
+ command->m_workGroups[2]);
+
+ // HACK: Reset the compute flag to dirty
+ m_changeSet |= AbstractRenderer::ComputeDirty;
+
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
+ int err = m_graphicsContext->openGLContext()->functions()->glGetError();
+ if (err)
+ qCWarning(Rendering) << "GL error after drawing mesh:" << QString::number(err, 16);
+#endif
+ }
+}
- if (!hasGeometryRenderer) {
- qCWarning(Rendering) << "RenderCommand should have a mesh to render";
- continue;
+bool Renderer::createOrUpdateVAO(RenderCommand *command,
+ HVao *previousVaoHandle,
+ OpenGLVertexArrayObject **vao)
+{
+ VAOManager *vaoManager = m_nodesManager->vaoManager();
+ if (m_graphicsContext->supportsVAO()) {
+ command->m_vao = vaoManager->lookupHandle(QPair<HGeometry, HShader>(command->m_geometry, command->m_shader));
+
+ if (command->m_vao.isNull()) {
+ qCDebug(Rendering) << Q_FUNC_INFO << "Allocating new VAO";
+ command->m_vao = vaoManager->getOrAcquireHandle(QPair<HGeometry, HShader>(command->m_geometry, command->m_shader));
+ vaoManager->data(command->m_vao)->setVao(new QOpenGLVertexArrayObject());
+ vaoManager->data(command->m_vao)->create();
}
- Shader *shader = m_nodesManager->data<Shader, ShaderManager>(command->m_shader);
- if (shader == Q_NULLPTR) {
- shader = m_defaultRenderShader;
- command->m_parameterAttributeToShaderNames = m_defaultParameterToGLSLAttributeNames;
- command->m_uniforms = m_defaultUniformPack;
+ if (*previousVaoHandle != command->m_vao) {
+ *previousVaoHandle = command->m_vao;
+ *vao = vaoManager->data(command->m_vao);
+ return true;
}
+ Q_ASSERT(*vao);
+ }
+ return false;
+}
- // The VAO should be created only once for a QGeometry and a ShaderProgram
- // Manager should have a VAO Manager that are indexed by QMeshData and Shader
- // RenderCommand should have a handle to the corresponding VAO for the Mesh and Shader
- bool needsToBindVAO = false;
- VAOManager *vaoManager = m_nodesManager->vaoManager();
- if (m_graphicsContext->supportsVAO()) {
- command->m_vao = vaoManager->lookupHandle(QPair<HGeometry, HShader>(command->m_geometry, command->m_shader));
-
- if (command->m_vao.isNull()) {
- qCDebug(Rendering) << Q_FUNC_INFO << "Allocating new VAO";
- command->m_vao = vaoManager->getOrAcquireHandle(QPair<HGeometry, HShader>(command->m_geometry, command->m_shader));
- vaoManager->data(command->m_vao)->setVao(new QOpenGLVertexArrayObject());
- vaoManager->data(command->m_vao)->create();
- }
+// Called by RenderView->submit() in RenderThread context
+// Returns true, if all RenderCommands were sent to the GPU
+bool Renderer::executeCommands(const RenderView *rv)
+{
+ bool allCommandsIssued = true;
- if (previousVaoHandle != command->m_vao) {
- needsToBindVAO = true;
- previousVaoHandle = command->m_vao;
- vao = vaoManager->data(command->m_vao);
- }
- Q_ASSERT(vao);
- }
+ // Render drawing commands
+ const QVector<RenderCommand *> commands = rv->commands();
- //// We activate the shader here
- // This will fill the attributes & uniforms info the first time the shader is loaded
- m_graphicsContext->activateShader(shader);
+ // Use the graphicscontext to submit the commands to the underlying
+ // graphics API (OpenGL)
- //// Initialize GL
- // The initialization is performed only once parameters in the command are set
- // Which indicates that the shader has been initialized and that renderview jobs were able to retrieve
- // Uniform and Attributes info from the shader
- // Otherwise we might create a VAO without attribute bindings as the RenderCommand had no way to know about attributes
- // Before the shader was loader
- Attribute *indexAttribute = Q_NULLPTR;
- bool specified = false;
- const bool requiresVAOUpdate = (!vao || !vao->isSpecified()) || (rGeometry->isDirty() || rGeometryRenderer->isDirty());
- GLsizei primitiveCount = rGeometryRenderer->primitiveCount();
-
- // Append dirty Geometry to temporary vector
- // so that its dirtiness can be unset later
- if (rGeometry->isDirty())
- m_dirtyGeometry.push_back(rGeometry);
-
- if (needsToBindVAO && vao) {
- vao->bind();
- }
+ // Save the RenderView base stateset
+ RenderStateSet *globalState = m_graphicsContext->currentStateSet();
+ OpenGLVertexArrayObject *vao = nullptr;
+ HVao previousVaoHandle;
- if (!command->m_parameterAttributeToShaderNames.isEmpty()) {
- // Update or set Attributes and Buffers for the given rGeometry and Command
- indexAttribute = updateBuffersAndAttributes(rGeometry, command, primitiveCount, requiresVAOUpdate);
- specified = true;
- if (vao)
- vao->setSpecified(true);
- }
+ for (RenderCommand *command : qAsConst(commands)) {
- //// Update program uniforms
- m_graphicsContext->setUniforms(command->m_uniforms);
+ if (command->m_type == RenderCommand::Compute) { // Compute Call
+ performCompute(rv, command);
+ } else { // Draw Command
- //// Draw Calls
- // Set state
- RenderStateSet *localState = command->m_stateSet;
+ // Check if we have a valid GeometryRenderer + Geometry
+ Geometry *rGeometry = m_nodesManager->data<Geometry, GeometryManager>(command->m_geometry);
+ GeometryRenderer *rGeometryRenderer = m_nodesManager->data<GeometryRenderer, GeometryRendererManager>(command->m_geometryRenderer);
+ const bool hasGeometryRenderer = rGeometry != nullptr && rGeometryRenderer != nullptr && !rGeometry->attributes().isEmpty();
- // Merge the RenderCommand state with the globalState of the RenderView
- // Or restore the globalState if no stateSet for the RenderCommand
- if (localState != Q_NULLPTR) {
- command->m_stateSet->merge(globalState);
- m_graphicsContext->setCurrentStateSet(command->m_stateSet);
- } else {
- m_graphicsContext->setCurrentStateSet(globalState);
- }
- // All Uniforms for a pass are stored in the QUniformPack of the command
- // Uniforms for Effect, Material and Technique should already have been correctly resolved
- // at that point
- if (primitiveCount && (specified || (vao && vao->isSpecified()))) {
- const GLint primType = rGeometryRenderer->primitiveType();
- const bool drawInstanced = rGeometryRenderer->instanceCount() > 1;
- const bool drawIndexed = indexAttribute != Q_NULLPTR;
- const GLint indexType = drawIndexed ? GraphicsContext::glDataTypeFromAttributeDataType(indexAttribute->dataType()) : 0;
-
- if (rGeometryRenderer->primitiveType() == QGeometryRenderer::Patches)
- m_graphicsContext->setVerticesPerPatch(rGeometry->verticesPerPatch());
-
- if (rGeometryRenderer->primitiveRestart())
- m_graphicsContext->enablePrimitiveRestart(rGeometryRenderer->restartIndex());
-
- // TO DO: Add glMulti Draw variants
- if (!drawInstanced) { // Non instanced Rendering
- if (drawIndexed)
- m_graphicsContext->drawElements(primType,
- primitiveCount,
- indexType,
- reinterpret_cast<void*>(quintptr(indexAttribute->byteOffset())),
- rGeometryRenderer->baseVertex());
-
- else
- m_graphicsContext->drawArrays(primType, 0, primitiveCount);
- } else { // Instanced Rendering
- if (drawIndexed)
- m_graphicsContext->drawElementsInstanced(primType,
- primitiveCount,
- indexType,
- reinterpret_cast<void*>(quintptr(indexAttribute->byteOffset())),
- rGeometryRenderer->instanceCount());
- else
- m_graphicsContext->drawArraysInstanced(primType,
- rGeometryRenderer->baseInstance(),
- primitiveCount,
- rGeometryRenderer->instanceCount());
+ if (!hasGeometryRenderer) {
+ allCommandsIssued = false;
+ qCWarning(Rendering) << "RenderCommand should have a mesh to render";
+ continue;
}
- int err = m_graphicsContext->openGLContext()->functions()->glGetError();
- if (err)
- qCWarning(Rendering) << "GL error after drawing mesh:" << QString::number(err, 16);
-
- if (rGeometryRenderer->primitiveRestart())
- m_graphicsContext->disablePrimitiveRestart();
-
+ Shader *shader = m_nodesManager->data<Shader, ShaderManager>(command->m_shader);
+ if (shader == nullptr) {
+ shader = m_defaultRenderShader;
+ command->m_parameterPack = m_defaultUniformPack;
+ }
- // Unset dirtiness on rGeometryRenderer only
- // The rGeometry may be shared by several rGeometryRenderer
- // so we cannot unset its dirtiness at this point
- rGeometryRenderer->unsetDirty();
+ // The VAO should be created only once for a QGeometry and a ShaderProgram
+ // Manager should have a VAO Manager that are indexed by QMeshData and Shader
+ // RenderCommand should have a handle to the corresponding VAO for the Mesh and Shader
+ const bool needsToBindVAO = createOrUpdateVAO(command, &previousVaoHandle, &vao);
+
+ //// We activate the shader here
+ // This will fill the attributes & uniforms info the first time the shader is loaded
+ m_graphicsContext->activateShader(shader);
+
+ //// Initialize GL
+ // The initialization is performed only once parameters in the command are set
+ // Which indicates that the shader has been initialized and that renderview jobs were able to retrieve
+ // Uniform and Attributes info from the shader
+ // Otherwise we might create a VAO without attribute bindings as the RenderCommand had no way to know about attributes
+ // Before the shader was loader
+ Attribute *indexAttribute = nullptr;
+ bool specified = false;
+ const bool requiresVAOUpdate = (!vao || !vao->isSpecified()) || (rGeometry->isDirty() || rGeometryRenderer->isDirty());
+ GLsizei primitiveCount = rGeometryRenderer->vertexCount();
+
+ // Append dirty Geometry to temporary vector
+ // so that its dirtiness can be unset later
+ if (rGeometry->isDirty())
+ m_dirtyGeometry.push_back(rGeometry);
+
+ if (needsToBindVAO && vao != nullptr)
+ vao->bind();
+
+ if (!command->m_attributes.isEmpty()) {
+ // Update or set Attributes and Buffers for the given rGeometry and Command
+ indexAttribute = updateBuffersAndAttributes(rGeometry, command, primitiveCount, requiresVAOUpdate);
+ specified = true;
+ if (vao)
+ vao->setSpecified(true);
+ }
+ //// Update program uniforms
+ m_graphicsContext->setParameters(command->m_parameterPack);
+
+ //// OpenGL State
+ // Set state
+ RenderStateSet *localState = command->m_stateSet;
+ // Merge the RenderCommand state with the globalState of the RenderView
+ // Or restore the globalState if no stateSet for the RenderCommand
+ if (localState != nullptr) {
+ command->m_stateSet->merge(globalState);
+ m_graphicsContext->setCurrentStateSet(command->m_stateSet);
+ } else {
+ m_graphicsContext->setCurrentStateSet(globalState);
+ }
+ // All Uniforms for a pass are stored in the QUniformPack of the command
+ // Uniforms for Effect, Material and Technique should already have been correctly resolved
+ // at that point
+
+ //// Draw Calls
+ if (primitiveCount && (specified || (vao && vao->isSpecified()))) {
+ performDraw(rGeometryRenderer, primitiveCount, indexAttribute);
+ } else {
+ allCommandsIssued = false;
+ }
}
} // end of RenderCommands loop
@@ -946,31 +1103,34 @@ void Renderer::executeCommands(const QVector<RenderCommand *> &commands)
m_graphicsContext->setCurrentStateSet(globalState);
// Unset dirtiness on Geometry and Attributes
- Q_FOREACH (Attribute *attribute, m_dirtyAttributes)
+ for (Attribute *attribute : qAsConst(m_dirtyAttributes))
attribute->unsetDirty();
m_dirtyAttributes.clear();
- Q_FOREACH (Geometry *geometry, m_dirtyGeometry)
+ for (Geometry *geometry : qAsConst(m_dirtyGeometry))
geometry->unsetDirty();
m_dirtyGeometry.clear();
+
+ return allCommandsIssued;
}
Attribute *Renderer::updateBuffersAndAttributes(Geometry *geometry, RenderCommand *command, GLsizei &count, bool forceUpdate)
{
- Attribute *indexAttribute = Q_NULLPTR;
+ Attribute *indexAttribute = nullptr;
uint estimatedCount = 0;
m_dirtyAttributes.reserve(m_dirtyAttributes.size() + geometry->attributes().size());
- Q_FOREACH (const QNodeId &attributeId, geometry->attributes()) {
+ const auto attributeIds = geometry->attributes();
+ for (QNodeId attributeId : attributeIds) {
// TO DO: Improvement we could store handles and use the non locking policy on the attributeManager
Attribute *attribute = m_nodesManager->attributeManager()->lookupResource(attributeId);
- if (attribute == Q_NULLPTR)
+ if (attribute == nullptr)
continue;
Buffer *buffer = m_nodesManager->bufferManager()->lookupResource(attribute->bufferId());
- if (buffer == Q_NULLPTR)
+ if (buffer == nullptr)
continue;
if (buffer->isDirty()) {
@@ -989,9 +1149,9 @@ Attribute *Renderer::updateBuffersAndAttributes(Geometry *geometry, RenderComman
m_graphicsContext->specifyIndices(buffer);
indexAttribute = attribute;
// Vertex Attribute
- } else if (command->m_parameterAttributeToShaderNames.contains(attribute->name())) {
+ } else if (command->m_attributes.contains(attribute->nameId())) {
if (attribute->isDirty() || forceUpdate)
- m_graphicsContext->specifyAttribute(attribute, buffer, command->m_parameterAttributeToShaderNames.value(attribute->name()));
+ m_graphicsContext->specifyAttribute(attribute, buffer, attribute->name());
estimatedCount = qMax(attribute->count(), estimatedCount);
}
@@ -1024,7 +1184,7 @@ QList<QMouseEvent> Renderer::pendingPickingEvents() const
return m_pickEventFilter->pendingEvents();
}
-QGraphicsApiFilter *Renderer::contextInfo() const
+const GraphicsApiFilterData *Renderer::contextInfo() const
{
return m_graphicsContext->contextInfo();
}
diff --git a/src/render/backend/renderer_p.h b/src/render/backend/renderer_p.h
index 404b10463..ef645dbb5 100644
--- a/src/render/backend/renderer_p.h
+++ b/src/render/backend/renderer_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,6 +60,7 @@
#include <Qt3DCore/qaspectjob.h>
#include <Qt3DRender/private/qt3drender_global_p.h>
#include <Qt3DRender/private/pickboundingvolumejob_p.h>
+#include <Qt3DRender/private/rendersettings_p.h>
#include <QHash>
#include <QMatrix4x4>
@@ -75,7 +79,6 @@
QT_BEGIN_NAMESPACE
class QSurface;
-class QOpenGLDebugLogger;
class QMouseEvent;
namespace Qt3DCore {
@@ -92,8 +95,8 @@ class QShaderProgram;
class QMesh;
class QRenderPass;
class QAbstractShapeMesh;
-class QGraphicsApiFilter;
-class QAbstractSceneParser;
+struct GraphicsApiFilterData;
+class QSceneIOHandler;
namespace Render {
@@ -121,22 +124,22 @@ public:
explicit Renderer(QRenderAspect::RenderType type);
~Renderer();
+ void dumpInfo() const Q_DECL_OVERRIDE;
API api() const Q_DECL_OVERRIDE { return AbstractRenderer::OpenGL; }
qint64 time() const Q_DECL_OVERRIDE;
void setTime(qint64 time) Q_DECL_OVERRIDE;
- void setSurface(QSurface *s) Q_DECL_OVERRIDE;
void setNodeManagers(NodeManagers *managers) Q_DECL_OVERRIDE { m_nodesManager = managers; }
void setServices(Qt3DCore::QServiceLocator *services) Q_DECL_OVERRIDE { m_services = services; }
void setSurfaceExposed(bool exposed) Q_DECL_OVERRIDE;
- QSurface *surface() const Q_DECL_OVERRIDE { return m_surface; }
NodeManagers *nodeManagers() const Q_DECL_OVERRIDE;
Qt3DCore::QServiceLocator *services() const Q_DECL_OVERRIDE { return m_services; }
void initialize() Q_DECL_OVERRIDE;
void shutdown() Q_DECL_OVERRIDE;
+ void releaseGraphicsResources() Q_DECL_OVERRIDE;
void createAllocators(Qt3DCore::QAbstractAspectJobManager *jobManager) Q_DECL_OVERRIDE;
void destroyAllocators(Qt3DCore::QAbstractAspectJobManager *jobManager) Q_DECL_OVERRIDE;
@@ -148,9 +151,16 @@ public:
void setSceneRoot(Qt3DCore::QBackendNodeFactory *factory, Entity *sgRoot) Q_DECL_OVERRIDE;
Entity *sceneRoot() const Q_DECL_OVERRIDE { return m_renderSceneRoot; }
- void setFrameGraphRoot(const Qt3DCore::QNodeId fgRootId) Q_DECL_OVERRIDE;
FrameGraphNode *frameGraphRoot() const Q_DECL_OVERRIDE;
+ void markDirty(BackendNodeDirtySet changes, BackendNode *node) Q_DECL_OVERRIDE;
+ BackendNodeDirtySet dirtyBits() Q_DECL_OVERRIDE;
+ void clearDirtyBits(BackendNodeDirtySet changes) Q_DECL_OVERRIDE;
+
+
+ bool shouldRender() Q_DECL_OVERRIDE;
+ void skipNextFrame() Q_DECL_OVERRIDE;
+
QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() Q_DECL_OVERRIDE;
Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() Q_DECL_OVERRIDE;
@@ -160,11 +170,14 @@ public:
void registerEventFilter(Qt3DCore::QEventFilterService *service) Q_DECL_OVERRIDE;
- void executeCommands(const QVector<RenderCommand *> &commands);
+ virtual void setSettings(RenderSettings *settings) Q_DECL_OVERRIDE;
+ virtual RenderSettings *settings() const Q_DECL_OVERRIDE;
+
+ bool executeCommands(const RenderView *rv);
Attribute *updateBuffersAndAttributes(Geometry *geometry, RenderCommand *command, GLsizei &count, bool forceUpdate);
void setOpenGLContext(QOpenGLContext *context);
- QGraphicsApiFilter *contextInfo() const;
+ const GraphicsApiFilterData *contextInfo() const;
void addAllocator(Qt3DCore::QFrameAllocator *allocator);
@@ -182,7 +195,21 @@ public:
void enqueueRenderView(RenderView *renderView, int submitOrder);
- bool submitRenderViews();
+ bool isReadyToSubmit();
+
+
+ struct ViewSubmissionResultData
+ {
+ ViewSubmissionResultData()
+ : lastBoundFBOId(0)
+ , surface(nullptr)
+ {}
+
+ uint lastBoundFBOId;
+ QSurface *surface;
+ };
+
+ ViewSubmissionResultData submitRenderViews(const QVector<Render::RenderView *> &renderViews);
QMutex* mutex() { return &m_mutex; }
@@ -218,12 +245,9 @@ private:
// is missing a shader
Shader *m_defaultRenderShader;
RenderStateSet *m_defaultRenderStateSet;
- QHash<QString, QString> m_defaultParameterToGLSLAttributeNames;
- QUniformPack m_defaultUniformPack;
+ ShaderParameterPack m_defaultUniformPack;
QScopedPointer<GraphicsContext> m_graphicsContext;
- QSurface *m_surface;
-
RenderQueue *m_renderQueue;
QScopedPointer<RenderThread> m_renderThread;
@@ -234,8 +258,7 @@ private:
QMutex m_mutex;
QSemaphore m_submitRenderViewsSemaphore;
- QWaitCondition m_waitForWindowToBeSetCondition;
- QWaitCondition m_waitForInitializationToBeCompleted;
+ QSemaphore m_waitForInitializationToBeCompleted;
static void createThreadLocalAllocator(void *renderer);
static void destroyThreadLocalAllocator(void *renderer);
@@ -243,17 +266,27 @@ private:
QAtomicInt m_running;
- QScopedPointer<QOpenGLDebugLogger> m_debugLogger;
QScopedPointer<PickEventFilter> m_pickEventFilter;
QVector<Qt3DCore::QFrameAllocator *> m_allocators;
QVector<Attribute *> m_dirtyAttributes;
QVector<Geometry *> m_dirtyGeometry;
QAtomicInt m_exposed;
+ BackendNodeDirtySet m_changeSet;
+ QAtomicInt m_lastFrameCorrect;
QOpenGLContext *m_glContext;
PickBoundingVolumeJobPtr m_pickBoundingVolumeJob;
qint64 m_time;
+
+ RenderSettings *m_settings;
+
+ void performDraw(GeometryRenderer *rGeometryRenderer,
+ GLsizei primitiveCount, Attribute *indexAttribute);
+ void performCompute(const RenderView *rv, RenderCommand *command);
+ bool createOrUpdateVAO(RenderCommand *command,
+ HVao *previousVAOHandle,
+ OpenGLVertexArrayObject **vao);
};
} // namespace Render
diff --git a/src/render/backend/renderqueue.cpp b/src/render/backend/renderqueue.cpp
index fd68b1bc0..6ec7da464 100644
--- a/src/render/backend/renderqueue.cpp
+++ b/src/render/backend/renderqueue.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -45,7 +48,8 @@ namespace Qt3DRender {
namespace Render {
RenderQueue::RenderQueue()
- : m_targetRenderViewCount(0)
+ : m_noRender(false)
+ , m_targetRenderViewCount(0)
, m_currentRenderViewCount(0)
, m_currentWorkQueue(1)
{
@@ -63,7 +67,15 @@ int RenderQueue::currentRenderViewCount() const
void RenderQueue::reset()
{
m_currentRenderViewCount = 0;
- Q_ASSERT(currentRenderViewCount() == 0);
+ m_targetRenderViewCount = 0;
+ m_currentWorkQueue.clear();
+ m_noRender = false;
+}
+
+void RenderQueue::setNoRender()
+{
+ Q_ASSERT(m_targetRenderViewCount == 0);
+ m_noRender = true;
}
/*!
@@ -73,6 +85,7 @@ void RenderQueue::reset()
*/
bool RenderQueue::queueRenderView(RenderView *renderView, uint submissionOrderIndex)
{
+ Q_ASSERT(!m_noRender);
m_currentWorkQueue[submissionOrderIndex] = renderView;
++m_currentRenderViewCount;
return isFrameQueueComplete();
@@ -93,6 +106,7 @@ QVector<RenderView *> RenderQueue::nextFrameQueue()
*/
void RenderQueue::setTargetRenderViewCount(int targetRenderViewCount)
{
+ Q_ASSERT(!m_noRender);
m_targetRenderViewCount = targetRenderViewCount;
m_currentWorkQueue.resize(targetRenderViewCount);
}
@@ -104,7 +118,8 @@ void RenderQueue::setTargetRenderViewCount(int targetRenderViewCount)
*/
bool RenderQueue::isFrameQueueComplete() const
{
- return m_targetRenderViewCount && m_targetRenderViewCount == currentRenderViewCount();
+ return (m_noRender
+ || (m_targetRenderViewCount && m_targetRenderViewCount == currentRenderViewCount()));
}
} // namespace Render
diff --git a/src/render/backend/renderqueue_p.h b/src/render/backend/renderqueue_p.h
index 151ea4808..49316049b 100644
--- a/src/render/backend/renderqueue_p.h
+++ b/src/render/backend/renderqueue_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -73,7 +76,10 @@ public:
QVector<RenderView *> nextFrameQueue();
void reset();
+ void setNoRender();
+
private:
+ bool m_noRender;
int m_targetRenderViewCount;
int m_currentRenderViewCount;
QVector<RenderView *> m_currentWorkQueue;
diff --git a/src/render/backend/rendersettings.cpp b/src/render/backend/rendersettings.cpp
new file mode 100644
index 000000000..b602d23e1
--- /dev/null
+++ b/src/render/backend/rendersettings.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "rendersettings_p.h"
+
+#include <Qt3DRender/QFrameGraphNode>
+#include <Qt3DRender/private/abstractrenderer_p.h>
+#include <Qt3DRender/private/qrendersettings_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderSettings::RenderSettings()
+ : BackendNode()
+{
+ cleanup();
+}
+
+void RenderSettings::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QRenderSettingsData>>(change);
+ const auto &data = typedChange->data;
+ m_activeFrameGraph = data.activeFrameGraphId;
+ m_renderPolicy = data.renderPolicy;
+ m_pickMethod = data.pickMethod;
+ m_pickResultMode = data.pickResultMode;
+}
+
+void RenderSettings::cleanup()
+{
+ m_pickMethod = QPickingSettings::BoundingVolumePicking;
+ m_pickResultMode = QPickingSettings::NearestPick;
+ m_activeFrameGraph = Qt3DCore::QNodeId();
+ m_renderPolicy = QRenderSettings::OnDemand;
+}
+
+void RenderSettings::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("pickMethod"))
+ m_pickMethod = propertyChange->value().value<QPickingSettings::PickMethod>();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("pickResult"))
+ m_pickResultMode = propertyChange->value().value<QPickingSettings::PickResultMode>();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("activeFrameGraph"))
+ m_activeFrameGraph = propertyChange->value().value<QNodePtr>()->id();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("renderPolicy"))
+ m_renderPolicy = propertyChange->value().value<QRenderSettings::RenderPolicy>();
+ markDirty(AbstractRenderer::AllDirty);
+ }
+
+ BackendNode::sceneChangeEvent(e);
+}
+
+RenderSettingsFunctor::RenderSettingsFunctor(AbstractRenderer *renderer)
+ : m_renderer(renderer)
+{
+}
+
+Qt3DCore::QBackendNode *RenderSettingsFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
+{
+ Q_UNUSED(change);
+ if (m_renderer->settings() != nullptr) {
+ qWarning() << "Renderer settings already exists";
+ return nullptr;
+ }
+
+ RenderSettings *settings = new RenderSettings;
+ settings->setRenderer(m_renderer);
+ m_renderer->setSettings(settings);
+ return settings;
+}
+
+Qt3DCore::QBackendNode *RenderSettingsFunctor::get(Qt3DCore::QNodeId id) const
+{
+ Q_UNUSED(id);
+ return nullptr;
+}
+
+void RenderSettingsFunctor::destroy(Qt3DCore::QNodeId id) const
+{
+ Q_UNUSED(id);
+ // Deletes the old settings object
+ m_renderer->setSettings(nullptr);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/backend/rendersettings_p.h b/src/render/backend/rendersettings_p.h
new file mode 100644
index 000000000..643959a8f
--- /dev/null
+++ b/src/render/backend/rendersettings_p.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_RENDERSETTINGS_H
+#define QT3DRENDER_RENDER_RENDERSETTINGS_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/qrendersettings.h>
+#include <Qt3DRender/qpickingsettings.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+class AbstractRenderer;
+
+class RenderSettings : public BackendNode
+{
+public:
+ RenderSettings();
+
+ void cleanup();
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ Qt3DCore::QNodeId activeFrameGraphID() const { return m_activeFrameGraph; }
+ QRenderSettings::RenderPolicy renderPolicy() const { return m_renderPolicy; }
+ QPickingSettings::PickMethod pickMethod() const { return m_pickMethod; }
+ QPickingSettings::PickResultMode pickResultMode() const { return m_pickResultMode; }
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QRenderSettings::RenderPolicy m_renderPolicy;
+ QPickingSettings::PickMethod m_pickMethod;
+ QPickingSettings::PickResultMode m_pickResultMode;
+ Qt3DCore::QNodeId m_activeFrameGraph;
+};
+
+class RenderSettingsFunctor : public Qt3DCore::QBackendNodeMapper
+{
+public:
+ explicit RenderSettingsFunctor(AbstractRenderer *renderer);
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+
+private:
+ AbstractRenderer *m_renderer;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERSETTINGS_H
diff --git a/src/render/backend/rendertarget.cpp b/src/render/backend/rendertarget.cpp
index 44570449e..b0565a26b 100644
--- a/src/render/backend/rendertarget.cpp
+++ b/src/render/backend/rendertarget.cpp
@@ -1,43 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <Qt3DRender/private/rendertarget_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
#include <Qt3DRender/qrendertarget.h>
-#include <Qt3DRender/qrenderattachment.h>
+#include <Qt3DRender/private/qrendertarget_p.h>
+#include <Qt3DRender/qrendertargetoutput.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <QVariant>
QT_BEGIN_NAMESPACE
@@ -48,45 +54,64 @@ namespace Qt3DRender {
namespace Render {
RenderTarget::RenderTarget()
- : QBackendNode()
+ : BackendNode()
{
}
-void RenderTarget::updateFromPeer(Qt3DCore::QNode *peer)
+void RenderTarget::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QRenderTarget *target = static_cast<QRenderTarget *>(peer);
- m_renderAttachments.clear();
- Q_FOREACH (QRenderAttachment *att, target->attachments())
- appendRenderAttachment(att->id());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QRenderTargetData>>(change);
+ const auto &data = typedChange->data;
+ m_renderOutputs = data.outputIds;
}
void RenderTarget::cleanup()
{
+ m_renderOutputs.clear();
+ QBackendNode::setEnabled(false);
}
-void RenderTarget::appendRenderAttachment(const QNodeId &attachmentId)
+void RenderTarget::appendRenderOutput(QNodeId outputId)
{
- if (!m_renderAttachments.contains(attachmentId))
- m_renderAttachments.append(attachmentId);
+ if (!m_renderOutputs.contains(outputId))
+ m_renderOutputs.append(outputId);
}
-void RenderTarget::removeRenderAttachment(const QNodeId &attachmentId)
+void RenderTarget::removeRenderOutput(QNodeId outputId)
{
- m_renderAttachments.removeOne(attachmentId);
+ m_renderOutputs.removeOne(outputId);
}
-QList<Qt3DCore::QNodeId> RenderTarget::renderAttachments() const
+QVector<Qt3DCore::QNodeId> RenderTarget::renderOutputs() const
{
- return m_renderAttachments;
+ return m_renderOutputs;
}
void RenderTarget::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (e->type() == NodeAdded && propertyChange->propertyName() == QByteArrayLiteral("attachment"))
- appendRenderAttachment(propertyChange->value().value<QNodeId>());
- else if (e->type() == NodeRemoved && propertyChange->propertyName() == QByteArrayLiteral("attachment"))
- removeRenderAttachment(propertyChange->value().value<QNodeId>());
+ switch (e->type()) {
+ case Qt3DCore::PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("output")) {
+ appendRenderOutput(change->addedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ }
+ break;
+ }
+
+ case Qt3DCore::PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("output")) {
+ removeRenderOutput(change->removedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ BackendNode::sceneChangeEvent(e);
}
} // namespace Render
diff --git a/src/render/backend/rendertarget_p.h b/src/render/backend/rendertarget_p.h
index e369ba320..df73cab9a 100644
--- a/src/render/backend/rendertarget_p.h
+++ b/src/render/backend/rendertarget_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,8 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
+#include <Qt3DRender/private/backendnode_p.h>
#include <QList>
QT_BEGIN_NAMESPACE
@@ -57,29 +59,29 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QRenderTarget;
-class QRenderAttachment;
+class QRenderTargetOutput;
namespace Render {
class RenderTargetManager;
-class RenderTarget : public Qt3DCore::QBackendNode
+class RenderTarget : public BackendNode
{
public:
RenderTarget();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void cleanup();
- void appendRenderAttachment(const Qt3DCore::QNodeId &attachmentId);
- void removeRenderAttachment(const Qt3DCore::QNodeId &attachmentId);
+ void appendRenderOutput(Qt3DCore::QNodeId outputId);
+ void removeRenderOutput(Qt3DCore::QNodeId outputId);
- QList<Qt3DCore::QNodeId> renderAttachments() const;
+ QVector<Qt3DCore::QNodeId> renderOutputs() const;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
- QList<Qt3DCore::QNodeId> m_renderAttachments;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<Qt3DCore::QNodeId> m_renderOutputs;
};
} // namespace Render
diff --git a/src/render/backend/rendertargetoutput.cpp b/src/render/backend/rendertargetoutput.cpp
new file mode 100644
index 000000000..faebfacb6
--- /dev/null
+++ b/src/render/backend/rendertargetoutput.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DRender/private/rendertargetoutput_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/private/qrendertargetoutput_p.h>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderTargetOutput::RenderTargetOutput()
+ : BackendNode()
+{
+}
+
+void RenderTargetOutput::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QRenderTargetOutputData>>(change);
+ const auto &data = typedChange->data;
+ m_attachmentData.m_point = data.attachmentPoint;
+ m_attachmentData.m_mipLevel = data.mipLevel;
+ m_attachmentData.m_layer = data.layer;
+ m_attachmentData.m_face = data.face;
+ m_attachmentData.m_textureUuid = data.textureId;
+}
+
+Qt3DCore::QNodeId RenderTargetOutput::textureUuid() const
+{
+ return m_attachmentData.m_textureUuid;
+}
+
+int RenderTargetOutput::mipLevel() const
+{
+ return m_attachmentData.m_mipLevel;
+}
+
+int RenderTargetOutput::layer() const
+{
+ return m_attachmentData.m_layer;
+}
+
+QString RenderTargetOutput::name() const
+{
+ return m_attachmentData.m_name;
+}
+
+QAbstractTexture::CubeMapFace RenderTargetOutput::face() const
+{
+ return m_attachmentData.m_face;
+}
+
+QRenderTargetOutput::AttachmentPoint RenderTargetOutput::point() const
+{
+ return m_attachmentData.m_point;
+}
+
+void RenderTargetOutput::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (e->type() == PropertyUpdated) {
+ if (propertyChange->propertyName() == QByteArrayLiteral("type")) {
+ m_attachmentData.m_point = static_cast<QRenderTargetOutput::AttachmentPoint>(propertyChange->value().toInt());
+ }
+ else if (propertyChange->propertyName() == QByteArrayLiteral("texture")) {
+ m_attachmentData.m_textureUuid = propertyChange->value().value<QNodeId>();
+ }
+ else if (propertyChange->propertyName() == QByteArrayLiteral("mipLevel")) {
+ m_attachmentData.m_mipLevel = propertyChange->value().toInt();
+ }
+ else if (propertyChange->propertyName() == QByteArrayLiteral("layer")) {
+ m_attachmentData.m_layer = propertyChange->value().toInt();
+ }
+ else if (propertyChange->propertyName() == QByteArrayLiteral("face")) {
+ m_attachmentData.m_face = static_cast<QAbstractTexture::CubeMapFace>(propertyChange->value().toInt());
+ }
+ markDirty(AbstractRenderer::AllDirty);
+ }
+
+ BackendNode::sceneChangeEvent(e);
+}
+
+Attachment RenderTargetOutput::attachment() const
+{
+ return m_attachmentData;
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/backend/rendertargetoutput_p.h b/src/render/backend/rendertargetoutput_p.h
new file mode 100644
index 000000000..14daa84e9
--- /dev/null
+++ b/src/render/backend/rendertargetoutput_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_RENDERTARGETOUTPUT_H
+#define QT3DRENDER_RENDER_RENDERTARGETOUTPUT_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/qrendertargetoutput.h>
+#include <Qt3DRender/private/attachmentpack_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderTargetOutput;
+
+namespace Render {
+
+class AttachmentManager;
+
+class RenderTargetOutput : public BackendNode
+{
+public:
+ RenderTargetOutput();
+
+ Qt3DCore::QNodeId textureUuid() const;
+ int mipLevel() const;
+ int layer() const;
+ QString name() const;
+ QAbstractTexture::CubeMapFace face() const;
+ QRenderTargetOutput::AttachmentPoint point() const;
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ Attachment attachment() const;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+ Qt3DCore::QNodeId m_attachmentUuid;
+ Attachment m_attachmentData;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERTARGETOUTPUT_H
diff --git a/src/render/backend/renderthread.cpp b/src/render/backend/renderthread.cpp
index 5738fc0ec..03cbb7a5f 100644
--- a/src/render/backend/renderthread.cpp
+++ b/src/render/backend/renderthread.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -56,6 +59,10 @@ RenderThread::RenderThread(Renderer *renderer)
{
}
+RenderThread::~RenderThread()
+{
+}
+
// Called by Renderer in the context of the Aspect Thread
void RenderThread::waitForStart( Priority priority )
{
@@ -90,7 +97,7 @@ void RenderThread::run()
m_renderer->render();
// Clean up any OpenGL resources
- m_renderer->shutdown();
+ m_renderer->releaseGraphicsResources();
qCDebug(Render::Backend) << "Exiting RenderThread";
}
diff --git a/src/render/backend/renderthread_p.h b/src/render/backend/renderthread_p.h
index 230e827fb..026a98609 100644
--- a/src/render/backend/renderthread_p.h
+++ b/src/render/backend/renderthread_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,6 +68,7 @@ class Q_AUTOTEST_EXPORT RenderThread : public QThread
Q_OBJECT
public:
explicit RenderThread(Renderer *renderer);
+ ~RenderThread();
void waitForStart( Priority priority = InheritPriority );
diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp
index ac7c9cf78..c61ae5b13 100644
--- a/src/render/backend/renderview.cpp
+++ b/src/render/backend/renderview.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,7 +42,7 @@
#include <Qt3DRender/qmaterial.h>
#include <Qt3DRender/qrenderaspect.h>
#include <Qt3DRender/qrendertarget.h>
-#include <Qt3DRender/qlight.h>
+#include <Qt3DRender/qabstractlight.h>
#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/cameraselectornode_p.h>
@@ -60,39 +63,57 @@
#include <Qt3DRender/private/renderstateset_p.h>
#include <Qt3DRender/private/techniquefilternode_p.h>
#include <Qt3DRender/private/viewportnode_p.h>
+#include <Qt3DRender/private/buffermanager_p.h>
+#include <Qt3DRender/private/geometryrenderermanager_p.h>
-#include <Qt3DRender/qparametermapping.h>
-
+#include <Qt3DRender/private/stringtoint_p.h>
#include <Qt3DCore/qentity.h>
-
#include <QtGui/qsurface.h>
-
#include <algorithm>
#include <QDebug>
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+#include <QElapsedTimer>
+#endif
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-static const int MAX_LIGHTS = 8;
namespace {
-// TODO: Should we treat lack of layer data as implicitly meaning that an
-// entity is in all layers?
-bool isEntityInLayers(const Entity *entity, const QStringList &layers)
+const int qNodeIdTypeId = qMetaTypeId<Qt3DCore::QNodeId>();
+
+const int MAX_LIGHTS = 8;
+
+#define LIGHT_POSITION_NAME QLatin1String(".position")
+#define LIGHT_TYPE_NAME QLatin1String(".type")
+#define LIGHT_COLOR_NAME QLatin1String(".color")
+#define LIGHT_INTENSITY_NAME QLatin1String(".intensity")
+
+int LIGHT_COUNT_NAME_ID = 0;
+int LIGHT_POSITION_NAMES[MAX_LIGHTS];
+int LIGHT_TYPE_NAMES[MAX_LIGHTS];
+int LIGHT_COLOR_NAMES[MAX_LIGHTS];
+int LIGHT_INTENSITY_NAMES[MAX_LIGHTS];
+QString LIGHT_STRUCT_NAMES[MAX_LIGHTS];
+
+bool isEntityInLayers(const Entity *entity, bool hasLayerFilter, const Qt3DCore::QNodeIdVector &filterLayerIds)
{
- if (layers.isEmpty())
+ if (hasLayerFilter && filterLayerIds.isEmpty())
+ return false;
+ else if (filterLayerIds.isEmpty())
return true;
- QList<Layer *> renderLayers = entity->renderComponents<Layer>();
- Q_FOREACH (Layer *layer, renderLayers) {
- if (layer->isEnabled())
- Q_FOREACH (const QString &layerName, layer->layers())
- if (layers.contains(layerName))
- return true;
+ const QList<Layer *> entityLayers = entity->renderComponents<Layer>();
+ for (const Layer *entityLayer : entityLayers) {
+ if (!entityLayer->isEnabled())
+ continue;
+
+ if (filterLayerIds.contains(entityLayer->peerId()))
+ return true;
}
return false;
}
@@ -107,119 +128,98 @@ bool isEntityFrustumCulled(const Entity *entity, const Plane *planes)
return false;
}
-void destroyUniformValue(const QUniformValue *value, Qt3DCore::QFrameAllocator *allocator)
-{
- QUniformValue *v = const_cast<QUniformValue *>(value);
- if (v->isTexture())
- allocator->deallocate(static_cast<TextureUniform *>(v));
- else
- allocator->deallocate(v);
-}
-
} // anonymouse namespace
-RenderView::StandardUniformsPFuncsHash RenderView::ms_standardUniformSetters = RenderView::initializeStandardUniformSetters();
-QStringList RenderView::ms_standardAttributesNames = RenderView::initializeStandardAttributeNames();
+bool wasInitialized = false;
+RenderView::StandardUniformsPFuncsHash RenderView::ms_standardUniformSetters;
+
RenderView::StandardUniformsPFuncsHash RenderView::initializeStandardUniformSetters()
{
RenderView::StandardUniformsPFuncsHash setters;
- setters.insert(QStringLiteral("modelMatrix"), &RenderView::modelMatrix);
- setters.insert(QStringLiteral("viewMatrix"), &RenderView::viewMatrix);
- setters.insert(QStringLiteral("projectionMatrix"), &RenderView::projectionMatrix);
- setters.insert(QStringLiteral("modelView"), &RenderView::modelViewMatrix);
- setters.insert(QStringLiteral("modelViewProjection"), &RenderView::modelViewProjectionMatrix);
- setters.insert(QStringLiteral("mvp"), &RenderView::modelViewProjectionMatrix);
- setters.insert(QStringLiteral("inverseModelMatrix"), &RenderView::inverseModelMatrix);
- setters.insert(QStringLiteral("inverViewMatrix"), &RenderView::inverseViewMatrix);
- setters.insert(QStringLiteral("inverseProjectionMatrix"), &RenderView::inverseProjectionMatrix);
- setters.insert(QStringLiteral("inverseModelView"), &RenderView::inverseModelViewMatrix);
- setters.insert(QStringLiteral("inverseModelViewProjection"), &RenderView::inverseModelViewProjectionMatrix);
- setters.insert(QStringLiteral("modelNormalMatrix"), &RenderView::modelNormalMatrix);
- setters.insert(QStringLiteral("modelViewNormal"), &RenderView::modelViewNormalMatrix);
- setters.insert(QStringLiteral("viewportMatrix"), &RenderView::viewportMatrix);
- setters.insert(QStringLiteral("inverseViewportMatrix"), &RenderView::inverseViewportMatrix);
- setters.insert(QStringLiteral("time"), &RenderView::time);
- setters.insert(QStringLiteral("eyePosition"), &RenderView::eyePosition);
+ setters.insert(StringToInt::lookupId(QLatin1String("modelMatrix")), &RenderView::modelMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("viewMatrix")), &RenderView::viewMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("projectionMatrix")), &RenderView::projectionMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("modelView")), &RenderView::modelViewMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("modelViewProjection")), &RenderView::modelViewProjectionMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("mvp")), &RenderView::modelViewProjectionMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("inverseModelMatrix")), &RenderView::inverseModelMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("inverseViewMatrix")), &RenderView::inverseViewMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("inverseProjectionMatrix")), &RenderView::inverseProjectionMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("inverseModelView")), &RenderView::inverseModelViewMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("inverseModelViewProjection")), &RenderView::inverseModelViewProjectionMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("modelNormalMatrix")), &RenderView::modelNormalMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("modelViewNormal")), &RenderView::modelViewNormalMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("viewportMatrix")), &RenderView::viewportMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("inverseViewportMatrix")), &RenderView::inverseViewportMatrix);
+ setters.insert(StringToInt::lookupId(QLatin1String("time")), &RenderView::time);
+ setters.insert(StringToInt::lookupId(QLatin1String("eyePosition")), &RenderView::eyePosition);
return setters;
}
-QStringList RenderView::initializeStandardAttributeNames()
-{
- QStringList attributesNames;
-
- attributesNames << QAttribute::defaultPositionAttributeName();
- attributesNames << QAttribute::defaultTextureCoordinateAttributeName();
- attributesNames << QAttribute::defaultNormalAttributeName();
- attributesNames << QAttribute::defaultColorAttributeName();
- attributesNames << QAttribute::defaultTangentAttributeName();
-
- return attributesNames;
-}
-
-QUniformValue *RenderView::modelMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::modelMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue::fromVariant(model, m_allocator);
+ return QUniformValue(QVariant::fromValue(model));
}
-QUniformValue *RenderView::viewMatrix(const QMatrix4x4 &) const
+QUniformValue RenderView::viewMatrix(const QMatrix4x4 &) const
{
- return QUniformValue::fromVariant(*m_data->m_viewMatrix, m_allocator);
+ return QUniformValue(QVariant::fromValue(*m_data->m_viewMatrix));
}
-QUniformValue *RenderView::projectionMatrix(const QMatrix4x4 &) const
+QUniformValue RenderView::projectionMatrix(const QMatrix4x4 &) const
{
- return QUniformValue::fromVariant(m_data->m_renderCamera->projection(), m_allocator);
+ return QUniformValue(QVariant::fromValue(m_data->m_renderCamera->projection()));
}
-QUniformValue *RenderView::modelViewMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::modelViewMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue::fromVariant(*m_data->m_viewMatrix * model, m_allocator);
+ return QUniformValue(QVariant::fromValue(*m_data->m_viewMatrix * model));
}
-QUniformValue *RenderView::modelViewProjectionMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::modelViewProjectionMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue::fromVariant(*m_data->m_viewProjectionMatrix * model, m_allocator);
+ return QUniformValue(QVariant::fromValue(*m_data->m_viewProjectionMatrix * model));
}
-QUniformValue *RenderView::inverseModelMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::inverseModelMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue::fromVariant(model.inverted(), m_allocator);
+ return QUniformValue(QVariant::fromValue(model.inverted()));
}
-QUniformValue *RenderView::inverseViewMatrix(const QMatrix4x4 &) const
+QUniformValue RenderView::inverseViewMatrix(const QMatrix4x4 &) const
{
- return QUniformValue::fromVariant(m_data->m_viewMatrix->inverted(), m_allocator);
+ return QUniformValue(QVariant::fromValue(m_data->m_viewMatrix->inverted()));
}
-QUniformValue *RenderView::inverseProjectionMatrix(const QMatrix4x4 &) const
+QUniformValue RenderView::inverseProjectionMatrix(const QMatrix4x4 &) const
{
QMatrix4x4 projection;
if (m_data->m_renderCamera)
projection = m_data->m_renderCamera->projection();
- return QUniformValue::fromVariant(projection.inverted(), m_allocator);
+ return QUniformValue(QVariant::fromValue(projection.inverted()));
}
-QUniformValue *RenderView::inverseModelViewMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::inverseModelViewMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue::fromVariant((*m_data->m_viewMatrix * model).inverted(), m_allocator);
+ return QUniformValue(QVariant::fromValue((*m_data->m_viewMatrix * model).inverted()));
}
-QUniformValue *RenderView::inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue::fromVariant((*m_data->m_viewProjectionMatrix * model).inverted(0), m_allocator);
+ return QUniformValue(QVariant::fromValue((*m_data->m_viewProjectionMatrix * model).inverted(0)));
}
-QUniformValue *RenderView::modelNormalMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::modelNormalMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue::fromVariant(QVariant::fromValue(model.normalMatrix()), m_allocator);
+ return QUniformValue(QVariant::fromValue(model.normalMatrix()));
}
-QUniformValue *RenderView::modelViewNormalMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::modelViewNormalMatrix(const QMatrix4x4 &model) const
{
- return QUniformValue::fromVariant(QVariant::fromValue((*m_data->m_viewMatrix * model).normalMatrix()), m_allocator);
+ return QUniformValue(QVariant::fromValue((*m_data->m_viewMatrix * model).normalMatrix()));
}
// TODO: Move this somewhere global where GraphicsContext::setViewport() can use it too
@@ -231,68 +231,83 @@ static QRectF resolveViewport(const QRectF &fractionalViewport, const QSize &sur
fractionalViewport.height() * surfaceSize.height());
}
-QUniformValue *RenderView::viewportMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::viewportMatrix(const QMatrix4x4 &model) const
{
// TODO: Can we avoid having to pass the model matrix in to these functions?
Q_UNUSED(model);
QMatrix4x4 viewportMatrix;
viewportMatrix.viewport(resolveViewport(*m_viewport, m_surfaceSize));
- return QUniformValue::fromVariant(QVariant::fromValue(viewportMatrix), m_allocator);
+ return QUniformValue(QVariant::fromValue(viewportMatrix));
}
-QUniformValue *RenderView::inverseViewportMatrix(const QMatrix4x4 &model) const
+QUniformValue RenderView::inverseViewportMatrix(const QMatrix4x4 &model) const
{
Q_UNUSED(model);
QMatrix4x4 viewportMatrix;
viewportMatrix.viewport(resolveViewport(*m_viewport, m_surfaceSize));
QMatrix4x4 inverseViewportMatrix = viewportMatrix.inverted();
- return QUniformValue::fromVariant(QVariant::fromValue(inverseViewportMatrix), m_allocator);
+ return QUniformValue(QVariant::fromValue(inverseViewportMatrix));
}
-QUniformValue *RenderView::time(const QMatrix4x4 &model) const
+QUniformValue RenderView::time(const QMatrix4x4 &model) const
{
Q_UNUSED(model);
qint64 time = m_renderer->time();
float t = time / 1000000000.0f;
- return QUniformValue::fromVariant(QVariant(t), m_allocator);
+ return QUniformValue(QVariant(t));
}
-QUniformValue *RenderView::eyePosition(const QMatrix4x4 &model) const
+QUniformValue RenderView::eyePosition(const QMatrix4x4 &model) const
{
Q_UNUSED(model);
- return QUniformValue::fromVariant(QVariant::fromValue(m_data->m_eyePos), m_allocator);
+ return QUniformValue(QVariant::fromValue(m_data->m_eyePos));
}
RenderView::RenderView()
- : m_renderer(Q_NULLPTR)
- , m_allocator(Q_NULLPTR)
- , m_data(Q_NULLPTR)
- , m_clearColor(Q_NULLPTR)
- , m_viewport(Q_NULLPTR)
- , m_clearBuffer(QClearBuffer::None)
- , m_stateSet(Q_NULLPTR)
+ : m_renderer(nullptr)
+ , m_devicePixelRatio(1.)
+ , m_allocator(nullptr)
+ , m_data(nullptr)
+ , m_viewport(nullptr)
+ , m_surface(nullptr)
+ , m_clearBuffer(QClearBuffers::None)
+ , m_globalClearColorBuffer(nullptr)
+ , m_stateSet(nullptr)
, m_noDraw(false)
+ , m_compute(false)
, m_frustumCulling(false)
{
+ m_workGroups[0] = 1;
+ m_workGroups[1] = 1;
+ m_workGroups[2] = 1;
+
+ if (Q_UNLIKELY(!wasInitialized)) {
+ // Needed as we can control the init order of static/global variables across compile units
+ // and this hash relies on the static StringToInt class
+ wasInitialized = true;
+ RenderView::ms_standardUniformSetters = RenderView::initializeStandardUniformSetters();
+ LIGHT_COUNT_NAME_ID = StringToInt::lookupId(QLatin1String("lightCount"));
+ for (int i = 0; i < MAX_LIGHTS; ++i) {
+ Q_STATIC_ASSERT_X(MAX_LIGHTS < 10, "can't use the QChar trick anymore");
+ LIGHT_STRUCT_NAMES[i] = QLatin1String("lights[") + QLatin1Char(char('0' + i)) + QLatin1Char(']');
+ LIGHT_POSITION_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_NAMES[i] + LIGHT_POSITION_NAME);
+ LIGHT_TYPE_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_NAMES[i] + LIGHT_TYPE_NAME);
+ LIGHT_COLOR_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_NAMES[i] + LIGHT_COLOR_NAME);
+ LIGHT_INTENSITY_NAMES[i] = StringToInt::lookupId(LIGHT_STRUCT_NAMES[i] + LIGHT_INTENSITY_NAME);
+ }
+ }
}
RenderView::~RenderView()
{
- if (m_allocator == Q_NULLPTR) // Mainly needed for unit tests
+ if (m_allocator == nullptr) // Mainly needed for unit tests
return;
- Q_FOREACH (RenderCommand *command, m_commands) {
- // Deallocate all uniform values of the QUniformPack of each RenderCommand
- const QHash<QString, const QUniformValue* > uniforms = command->m_uniforms.uniforms();
- const QHash<QString, const QUniformValue* >::const_iterator end = uniforms.constEnd();
- QHash<QString, const QUniformValue* >::const_iterator it = uniforms.constBegin();
-
- for (; it != end; ++it)
- destroyUniformValue(it.value(), m_allocator);
+ for (RenderCommand *command : qAsConst(m_commands)) {
- if (command->m_stateSet != Q_NULLPTR) // We do not delete the RenderState as that is stored statically
+ if (command->m_stateSet != nullptr) // We do not delete the RenderState as that is stored statically
m_allocator->deallocate<RenderStateSet>(command->m_stateSet);
// Deallocate RenderCommand
@@ -304,8 +319,6 @@ RenderView::~RenderView()
m_allocator->deallocate<QMatrix4x4>(m_data->m_viewProjectionMatrix);
// Deallocate viewport rect
m_allocator->deallocate<QRectF>(m_viewport);
- // Deallocate clearColor
- m_allocator->deallocate<QColor>(m_clearColor);
// Deallocate m_data
m_allocator->deallocate<InnerData>(m_data);
// Deallocate m_stateSet
@@ -318,7 +331,7 @@ RenderView::~RenderView()
void RenderView::operator delete(void *ptr)
{
RenderView *rView = static_cast<RenderView *>(ptr);
- if (rView != Q_NULLPTR && rView->m_allocator != Q_NULLPTR)
+ if (rView != nullptr && rView->m_allocator != nullptr)
rView->m_allocator->deallocateRawMemory(rView, sizeof(RenderView));
}
@@ -326,7 +339,7 @@ void RenderView::operator delete(void *ptr)
void RenderView::operator delete(void *ptr, void *)
{
RenderView *rView = static_cast<RenderView *>(ptr);
- if (rView != Q_NULLPTR && rView->m_allocator != Q_NULLPTR)
+ if (rView != nullptr && rView->m_allocator != nullptr)
rView->m_allocator->deallocateRawMemory(rView, sizeof(RenderView));
}
@@ -346,14 +359,16 @@ void RenderView::sort()
++i;
if (i - j > 0) { // Several commands have the same shader, so we minimize uniform changes
- QHash<QString, const QUniformValue *> cachedUniforms = m_commands[j++]->m_uniforms.uniforms();
+ PackUniformHash cachedUniforms = m_commands[j++]->m_parameterPack.uniforms();
while (j < i) {
- QHash<QString, const QUniformValue *> &uniforms = m_commands[j]->m_uniforms.m_uniforms;
- QHash<QString, const QUniformValue *>::iterator it = uniforms.begin();
+ // We need the reference here as we are modifying the original container
+ // not the copy
+ PackUniformHash &uniforms = m_commands[j]->m_parameterPack.m_uniforms;
+ PackUniformHash::iterator it = uniforms.begin();
+ const PackUniformHash::iterator end = uniforms.end();
- while (it != uniforms.end()) {
- bool found = false;
+ while (it != end) {
// We are comparing the values:
// - raw uniform values
// - the texture Node id if the uniform represents a texture
@@ -361,15 +376,10 @@ void RenderView::sort()
// sharing the same material (shader) are rendered, we can't have the case
// where two uniforms, referencing the same texture eventually have 2 different
// texture unit values
- if (cachedUniforms.contains(it.key())) {
- const QUniformValue *refValue = cachedUniforms.value(it.key());
- if (*const_cast<QUniformValue *>(refValue) == *it.value()) {
- destroyUniformValue(it.value(), m_allocator);
- it = uniforms.erase(it);
- found = true;
- }
- }
- if (!found) {
+ QUniformValue refValue = cachedUniforms.value(it.key());
+ if (refValue == it.value()) {
+ it = uniforms.erase(it);
+ } else {
cachedUniforms.insert(it.key(), it.value());
++it;
}
@@ -388,6 +398,47 @@ void RenderView::setRenderer(Renderer *renderer)
m_data->m_uniformBlockBuilder.shaderDataManager = m_manager->shaderDataManager();
}
+// Returns an array of Passes with the accompanying Parameter list
+RenderRenderPassList RenderView::passesAndParameters(ParameterInfoList *parameters, Entity *node, bool useDefaultMaterial)
+{
+ // Find the material, effect, technique and set of render passes to use
+ Material *material = nullptr;
+ Effect *effect = nullptr;
+ if ((material = node->renderComponent<Material>()) != nullptr && material->isEnabled())
+ effect = m_renderer->nodeManagers()->effectManager()->lookupResource(material->effect());
+ Technique *technique = findTechniqueForEffect(m_renderer, this, effect);
+
+ // Order set:
+ // 1 Pass Filter
+ // 2 Technique Filter
+ // 3 Material
+ // 4 Effect
+ // 5 Technique
+ // 6 RenderPass
+
+ // Add Parameters define in techniqueFilter and passFilter
+ // passFilter have priority over techniqueFilter
+ if (m_data->m_passFilter)
+ parametersFromParametersProvider(parameters, m_renderer->nodeManagers()->parameterManager(),
+ m_data->m_passFilter);
+ if (m_data->m_techniqueFilter)
+ parametersFromParametersProvider(parameters, m_renderer->nodeManagers()->parameterManager(),
+ m_data->m_techniqueFilter);
+ // Get the parameters for our selected rendering setup (override what was defined in the technique/pass filter)
+ parametersFromMaterialEffectTechnique(parameters, m_manager->parameterManager(), material, effect, technique);
+
+ RenderRenderPassList passes;
+ if (technique) {
+ passes = findRenderPassesForTechnique(m_manager, this, technique);
+ } else if (useDefaultMaterial) {
+ material = m_manager->data<Material, MaterialManager>(m_renderer->defaultMaterialHandle());
+ effect = m_manager->data<Effect, EffectManager>(m_renderer->defaultEffectHandle());
+ technique = m_manager->data<Technique, TechniqueManager>(m_renderer->defaultTechniqueHandle());
+ passes << m_manager->data<RenderPass, RenderPassManager>(m_renderer->defaultRenderPassHandle());
+ }
+ return passes;
+}
+
void RenderView::gatherLights(Entity *node)
{
const QList<Light *> lights = node->renderComponents<Light>();
@@ -395,7 +446,8 @@ void RenderView::gatherLights(Entity *node)
m_lightSources.append(LightSource(node, lights));
// Traverse children
- Q_FOREACH (Entity *child, node->children())
+ const auto children = node->children();
+ for (Entity *child : children)
gatherLights(child);
}
@@ -413,205 +465,290 @@ private:
QVector3D p;
};
-// Tries to order renderCommand by shader so as to minimize shader changes
-void RenderView::buildRenderCommands(Entity *node, const Plane *planes)
+void RenderView::addClearBuffers(const ClearBuffers *cb) {
+ QClearBuffers::BufferTypeFlags type = cb->type();
+
+ if (type & QClearBuffers::StencilBuffer) {
+ m_clearStencilValue = cb->clearStencilValue();
+ m_clearBuffer |= QClearBuffers::StencilBuffer;
+ }
+ if (type & QClearBuffers::DepthBuffer) {
+ m_clearDepthValue = cb->clearDepthValue();
+ m_clearBuffer |= QClearBuffers::DepthBuffer;
+ }
+ // keep track of global ClearColor (if set) and collect all DrawBuffer-specific
+ // ClearColors
+ if (type & QClearBuffers::ColorBuffer) {
+ if (cb->clearsAllColorBuffers()) {
+ m_globalClearColorBuffer = cb;
+ m_clearBuffer |= QClearBuffers::ColorBuffer;
+ } else {
+ m_specificClearColorBuffers.push_back(cb);
+ }
+ }
+}
+
+// TODO: Convert into a job that caches lookup of entities for layers
+static void findEntitiesInLayers(Entity *e, bool hasLayerFilter, const Qt3DCore::QNodeIdVector &filterLayerIds, QVector<Entity *> &entities)
{
- // Skip branches that are not enabled
- if (!node->isEnabled())
+ // Bail if sub-tree is disabled
+ if (!e->isEnabled())
return;
- if (m_frustumCulling && isEntityFrustumCulled(node, planes))
- return;
+ // Check this entity
+ if (isEntityInLayers(e, hasLayerFilter, filterLayerIds))
+ entities.push_back(e);
- // Build renderCommand for current node
- if (isEntityInLayers(node, m_data->m_layers)) {
- GeometryRenderer *geometryRenderer = Q_NULLPTR;
- if (node->componentHandle<GeometryRenderer, 16>() != HGeometryRenderer()
- && (geometryRenderer = node->renderComponent<GeometryRenderer>()) != Q_NULLPTR
- && geometryRenderer->isEnabled()) {
-
- // There is a geometry renderer
- if (geometryRenderer != Q_NULLPTR && !geometryRenderer->geometryId().isNull()) {
- // TO DO: Perform culling here
- // As shaders may be deforming, transforming the mesh
- // We might want to make that optional or dependent on an explicit bounding box item
-
- // Find the material, effect, technique and set of render passes to use
- Material *material = Q_NULLPTR;
- Effect *effect = Q_NULLPTR;
- if ((material = node->renderComponent<Material>()) != Q_NULLPTR && material->isEnabled())
- effect = m_renderer->nodeManagers()->effectManager()->lookupResource(material->effect());
- Technique *technique = findTechniqueForEffect(m_renderer, this, effect);
-
- ParameterInfoList parameters;
- // Order set:
- // 1 Pass Filter
- // 2 Technique Filter
- // 3 Material
- // 4 Effect
- // 5 Technique
- // 6 RenderPass
-
- // Add Parameters define in techniqueFilter and passFilter
- // passFilter have priority over techniqueFilter
- if (m_data->m_passFilter)
- parametersFromParametersProvider(&parameters, m_renderer->nodeManagers()->parameterManager(),
- m_data->m_passFilter);
- if (m_data->m_techniqueFilter)
- parametersFromParametersProvider(&parameters, m_renderer->nodeManagers()->parameterManager(),
- m_data->m_techniqueFilter);
-
- RenderRenderPassList passes;
- if (technique) {
- passes = findRenderPassesForTechnique(m_manager, this, technique);
- } else {
- material = m_manager->data<Material, MaterialManager>(m_renderer->defaultMaterialHandle());
- effect = m_manager->data<Effect, EffectManager>(m_renderer->defaultEffectHandle());
- technique = m_manager->data<Technique, TechniqueManager>(m_renderer->defaultTechniqueHandle());
- passes << m_manager->data<RenderPass, RenderPassManager>(m_renderer->defaultRenderPassHandle());
- }
+ // Recurse to children
+ const auto children = e->children();
+ for (Entity *child : children)
+ findEntitiesInLayers(child, hasLayerFilter, filterLayerIds, entities);
+}
- // Get the parameters for our selected rendering setup (override what was defined in the technique/pass filter)
- parametersFromMaterialEffectTechnique(&parameters, m_manager->parameterManager(), material, effect, technique);
-
- // 1 RenderCommand per RenderPass pass on an Entity with a Mesh
- m_commands.reserve(m_commands.size() + passes.size());
- Q_FOREACH (RenderPass *pass, passes) {
-
- // Add the RenderPass Parameters
- ParameterInfoList globalParameters = parameters;
- parametersFromParametersProvider(&globalParameters, m_manager->parameterManager(), pass);
-
- RenderCommand *command = m_allocator->allocate<RenderCommand>();
- command->m_depth = m_data->m_eyePos.distanceToPoint(node->worldBoundingVolume()->center());
-
- command->m_geometry = m_manager->lookupHandle<Geometry, GeometryManager, HGeometry>(geometryRenderer->geometryId());
- command->m_geometryRenderer = node->componentHandle<GeometryRenderer, 16>();
- command->m_instancesCount = 0;
- command->m_stateSet = Q_NULLPTR;
- command->m_changeCost = 0;
- // For RenderPass based states we use the globally set RenderState
- // if no renderstates are defined as part of the pass. That means:
- // RenderPass { renderStates: [] } will use the states defined by
- // StateSet in the FrameGraph
- if (!pass->renderStates().isEmpty())
- command->m_stateSet = buildRenderStateSet(pass->renderStates(), m_allocator);
- if (command->m_stateSet != Q_NULLPTR) {
- // Merge per pass stateset with global stateset
- // so that the local stateset only overrides
- if (m_stateSet != Q_NULLPTR)
- command->m_stateSet->merge(m_stateSet);
- command->m_changeCost = m_renderer->defaultRenderState()->changeCost(command->m_stateSet);
- }
+// Tries to order renderCommand by shader so as to minimize shader changes
+void RenderView::buildRenderCommands(Entity *rootEntity, const Plane *planes)
+{
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ QElapsedTimer timer;
+ timer.start();
+#endif
+ // Filter the entities according to the layers for this renderview
+ QVector<Entity *> entities;
+ const int entityCount = m_renderer->nodeManagers()->renderNodesManager()->count();
+ entities.reserve(entityCount);
+ findEntitiesInLayers(rootEntity, hasLayerFilter(), layerFilter(), entities);
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ qDebug() << "Found" << entities.size() << "entities in layers" << m_data->m_layers
+ << "in" << timer.nsecsElapsed() / 1.0e6 << "ms";
+#endif
+
+ for (Entity *entity : qAsConst(entities)) {
+ if (m_compute) {
+ // 1) Look for Compute Entities if Entity -> components [ ComputeJob, Material ]
+ // when the RenderView is part of a DispatchCompute branch
+ buildComputeRenderCommands(entity);
+ } else {
+ // 2) Look for Drawable Entities if Entity -> components [ GeometryRenderer, Material ]
+ // when the RenderView is not part of a DispatchCompute branch
+ // Investigate if it's worth doing as separate jobs
+ buildDrawRenderCommands(entity, planes);
+ }
+ }
+}
- // Pick which lights to take in to account.
- // For now decide based on the distance by taking the MAX_LIGHTS closest lights.
- // Replace with more sophisticated mechanisms later.
- std::sort(m_lightSources.begin(), m_lightSources.end(), LightSourceCompare(node));
- QVector<LightSource> activeLightSources; // NB! the total number of lights here may still exceed MAX_LIGHTS
- activeLightSources.reserve(m_lightSources.count());
- int lightCount = 0;
- for (int i = 0; i < m_lightSources.count() && lightCount < MAX_LIGHTS; ++i) {
- activeLightSources.append(m_lightSources[i]);
- lightCount += m_lightSources[i].lights.count();
- }
+void RenderView::buildDrawRenderCommands(Entity *node, const Plane *planes)
+{
+ if (m_frustumCulling && isEntityFrustumCulled(node, planes))
+ return;
- setShaderAndUniforms(command, pass, globalParameters, *(node->worldTransform()), activeLightSources);
+ GeometryRenderer *geometryRenderer = nullptr;
+ HGeometryRenderer geometryRendererHandle = node->componentHandle<GeometryRenderer, 16>();
+ if (!geometryRendererHandle.isNull()
+ && (geometryRenderer = m_manager->geometryRendererManager()->data(geometryRendererHandle)) != nullptr
+ && geometryRenderer->isEnabled()
+ && !geometryRenderer->geometryId().isNull()) {
+
+ // There is a geometry renderer with geometry
+ ParameterInfoList parameters;
+ const RenderRenderPassList passes = passesAndParameters(&parameters, node, true);
+
+ // 1 RenderCommand per RenderPass pass on an Entity with a Mesh
+ for (RenderPass *pass : passes) {
+ // Add the RenderPass Parameters
+ ParameterInfoList globalParameters = parameters;
+ parametersFromParametersProvider(&globalParameters, m_manager->parameterManager(), pass);
+
+ RenderCommand *command = m_allocator->allocate<RenderCommand>();
+ command->m_depth = m_data->m_eyePos.distanceToPoint(node->worldBoundingVolume()->center());
+ command->m_geometry = m_manager->lookupHandle<Geometry, GeometryManager, HGeometry>(geometryRenderer->geometryId());
+ command->m_geometryRenderer = geometryRendererHandle;
+ // For RenderPass based states we use the globally set RenderState
+ // if no renderstates are defined as part of the pass. That means:
+ // RenderPass { renderStates: [] } will use the states defined by
+ // StateSet in the FrameGraph
+ if (pass->hasRenderStates()) {
+ command->m_stateSet = m_allocator->allocate<RenderStateSet>();
+ addToRenderStateSet(command->m_stateSet, pass, m_manager->renderStateManager());
+
+ // Merge per pass stateset with global stateset
+ // so that the local stateset only overrides
+ if (m_stateSet != nullptr)
+ command->m_stateSet->merge(m_stateSet);
+ command->m_changeCost = m_renderer->defaultRenderState()->changeCost(command->m_stateSet);
+ }
- buildSortingKey(command);
- m_commands.append(command);
- }
+ // Pick which lights to take in to account.
+ // For now decide based on the distance by taking the MAX_LIGHTS closest lights.
+ // Replace with more sophisticated mechanisms later.
+ std::sort(m_lightSources.begin(), m_lightSources.end(), LightSourceCompare(node));
+ QVector<LightSource> activeLightSources; // NB! the total number of lights here may still exceed MAX_LIGHTS
+ int lightCount = 0;
+ for (int i = 0; i < m_lightSources.count() && lightCount < MAX_LIGHTS; ++i) {
+ activeLightSources.append(m_lightSources[i]);
+ lightCount += m_lightSources[i].lights.count();
}
+
+ setShaderAndUniforms(command, pass, globalParameters, *(node->worldTransform()), activeLightSources);
+
+ buildSortingKey(command);
+ m_commands.append(command);
}
}
-
- // Traverse children
- Q_FOREACH (Entity *child, node->children())
- buildRenderCommands(child, planes);
}
-const AttachmentPack &RenderView::attachmentPack() const
-{
- return m_attachmentPack;
+void RenderView::buildComputeRenderCommands(Entity *node)
+{
+ // If the RenderView contains only a ComputeDispatch then it cares about
+ // A ComputeDispatch is also implicitely a NoDraw operation
+ // enabled flag
+ // layer component
+ // material/effect/technique/parameters/filters/
+ ComputeCommand *computeJob = nullptr;
+ if (node->componentHandle<ComputeCommand, 16>() != HComputeCommand()
+ && (computeJob = node->renderComponent<ComputeCommand>()) != nullptr
+ && computeJob->isEnabled()) {
+
+ ParameterInfoList parameters;
+ const RenderRenderPassList passes = passesAndParameters(&parameters, node, true);
+
+ for (RenderPass *pass : passes) {
+ // Add the RenderPass Parameters
+ ParameterInfoList globalParameters = parameters;
+ parametersFromParametersProvider(&globalParameters, m_manager->parameterManager(), pass);
+
+ RenderCommand *command = m_allocator->allocate<RenderCommand>();
+ command->m_type = RenderCommand::Compute;
+ command->m_workGroups[0] = std::max(m_workGroups[0], computeJob->x());
+ command->m_workGroups[1] = std::max(m_workGroups[1], computeJob->y());
+ command->m_workGroups[2] = std::max(m_workGroups[2], computeJob->z());
+ setShaderAndUniforms(command,
+ pass,
+ globalParameters,
+ *(node->worldTransform()),
+ QVector<LightSource>());
+ m_commands.append(command);
+ }
+ }
}
-void RenderView::setUniformValue(QUniformPack &uniformPack, const QString &name, const QVariant &value)
-{
- if (const QUniformValue *val = uniformPack.uniform(name))
- destroyUniformValue(val, m_allocator);
-
- Texture *tex = Q_NULLPTR;
-
- if ((tex = value.value<Texture *>()) != Q_NULLPTR) {
- uniformPack.setTexture(name, tex->peerUuid());
- TextureUniform *texUniform = m_allocator->allocate<TextureUniform>();
- texUniform->setTextureId(tex->peerUuid());
- uniformPack.setUniform(name, texUniform);
+void RenderView::setUniformValue(ShaderParameterPack &uniformPack, int nameId, const QVariant &value)
+{
+ Texture *tex = nullptr;
+ // At this point a uniform value can only be a scalar type
+ // or a Qt3DCore::QNodeId corresponding to a Texture
+ // ShaderData/Buffers would be handled as UBO/SSBO and would therefore
+ // not be in the default uniform block
+ if (static_cast<QMetaType::Type>(value.userType()) == qNodeIdTypeId) {
+ // Speed up conversion to avoid using QVariant::value()
+ const Qt3DCore::QNodeId texId = variant_value<Qt3DCore::QNodeId>(value);
+ if ((tex = m_manager->textureManager()->lookupResource(texId))
+ != nullptr) {
+ uniformPack.setTexture(nameId, tex->peerId());
+ //TextureUniform *texUniform = m_allocator->allocate<TextureUniform>();
+ QUniformValue texUniform;
+ texUniform.setType(QUniformValue::TextureSampler);
+ texUniform.setTextureId(tex->peerId());
+ uniformPack.setUniform(nameId, texUniform);
+ }
} else {
- uniformPack.setUniform(name, QUniformValue::fromVariant(value, m_allocator));
+ uniformPack.setUniform(nameId, QUniformValue(value));
}
}
-void RenderView::setStandardUniformValue(QUniformPack &uniformPack, const QString &glslName, const QString &name, const QMatrix4x4 &worldTransform)
+void RenderView::setStandardUniformValue(ShaderParameterPack &uniformPack, int glslNameId, int nameId, const QMatrix4x4 &worldTransform)
{
- if (const QUniformValue *val = uniformPack.uniform(glslName))
- destroyUniformValue(val, m_allocator);
-
- uniformPack.setUniform(glslName, (this->*ms_standardUniformSetters[name])(worldTransform));
+ uniformPack.setUniform(glslNameId, (this->*ms_standardUniformSetters[nameId])(worldTransform));
}
-void RenderView::setUniformBlockValue(QUniformPack &uniformPack, Shader *shader, const ShaderUniformBlock &block, const QVariant &value)
+void RenderView::setUniformBlockValue(ShaderParameterPack &uniformPack,
+ Shader *shader,
+ const ShaderUniformBlock &block,
+ const QVariant &value)
{
- ShaderData *shaderData = Q_NULLPTR;
- if ((shaderData = value.value<ShaderData *>())) {
+ Q_UNUSED(shader)
+
+ if (static_cast<QMetaType::Type>(value.userType()) == qNodeIdTypeId) {
+
+ Buffer *buffer = nullptr;
+ if ((buffer = m_manager->bufferManager()->lookupResource(variant_value<Qt3DCore::QNodeId>(value))) != nullptr) {
+ BlockToUBO uniformBlockUBO;
+ uniformBlockUBO.m_blockIndex = block.m_index;
+ uniformBlockUBO.m_bufferID = buffer->peerId();
+ uniformPack.setUniformBuffer(std::move(uniformBlockUBO));
+ // Buffer update to GL buffer will be done at render time
+ }
+
+
+ //ShaderData *shaderData = nullptr;
+ // if ((shaderData = m_manager->shaderDataManager()->lookupResource(value.value<Qt3DCore::QNodeId>())) != nullptr) {
// UBO are indexed by <ShaderId, ShaderDataId> so that a same QShaderData can be used among different shaders
// while still making sure that if they have a different layout everything will still work
// If two shaders define the same block with the exact same layout, in that case the UBO could be shared
// but how do we know that ? We'll need to compare ShaderUniformBlocks
- // For now a UBO is unique to a Shader and a ShaderData
- // later we might want to make them shareable across Shaders but
- // that will require checking that all Shaders have the same layout for a given
- // uniform block
- ShaderDataShaderUboKey uboKey(shaderData->peerUuid(),
- shader->peerUuid());
-
- BlockToUBO uniformBlockUBO;
- uniformBlockUBO.m_blockIndex = block.m_index;
- uniformBlockUBO.m_shaderDataID = shaderData->peerUuid();
- bool uboNeedsUpdate = false;
-
- // build UBO at uboId if not created before
- if (!m_manager->uboManager()->contains(uboKey)) {
- m_manager->uboManager()->getOrCreateResource(uboKey);
- uboNeedsUpdate = true;
- }
+ // Note: we assume that if a buffer is shared accross multiple shaders
+ // then it implies that they share the same layout
+
+ // Temporarly disabled
+
+ // BufferShaderKey uboKey(shaderData->peerId(),
+ // shader->peerId());
+
+ // BlockToUBO uniformBlockUBO;
+ // uniformBlockUBO.m_blockIndex = block.m_index;
+ // uniformBlockUBO.m_shaderDataID = shaderData->peerId();
+ // bool uboNeedsUpdate = false;
+
+ // // build UBO at uboId if not created before
+ // if (!m_manager->glBufferManager()->contains(uboKey)) {
+ // m_manager->glBufferManager()->getOrCreateResource(uboKey);
+ // uboNeedsUpdate = true;
+ // }
+
+ // // If shaderData has been updated (property has changed or one of the nested properties has changed)
+ // // foreach property defined in the QShaderData, we try to fill the value of the corresponding active uniform(s)
+ // // for all the updated properties (all the properties if the UBO was just created)
+ // if (shaderData->updateViewTransform(*m_data->m_viewMatrix) || uboNeedsUpdate) {
+ // // Clear previous values remaining in the hash
+ // m_data->m_uniformBlockBuilder.activeUniformNamesToValue.clear();
+ // // Update only update properties if uboNeedsUpdate is true, otherwise update the whole block
+ // m_data->m_uniformBlockBuilder.updatedPropertiesOnly = uboNeedsUpdate;
+ // // Retrieve names and description of each active uniforms in the uniform block
+ // m_data->m_uniformBlockBuilder.uniforms = shader->activeUniformsForUniformBlock(block.m_index);
+ // // Builds the name-value map for the block
+ // m_data->m_uniformBlockBuilder.buildActiveUniformNameValueMapStructHelper(shaderData, block.m_name);
+ // if (!uboNeedsUpdate)
+ // shaderData->markDirty();
+ // // copy the name-value map into the BlockToUBO
+ // uniformBlockUBO.m_updatedProperties = m_data->m_uniformBlockBuilder.activeUniformNamesToValue;
+ // uboNeedsUpdate = true;
+ // }
+
+ // uniformBlockUBO.m_needsUpdate = uboNeedsUpdate;
+ // uniformPack.setUniformBuffer(std::move(uniformBlockUBO));
+ // }
+ }
+}
- // If shaderData has been updated (property has changed or one of the nested properties has changed)
- // foreach property defined in the QShaderData, we try to fill the value of the corresponding active uniform(s)
- // for all the updated properties (all the properties if the UBO was just created)
- if (shaderData->updateViewTransform(*m_data->m_viewMatrix) || uboNeedsUpdate) {
- // Clear previous values remaining in the hash
- m_data->m_uniformBlockBuilder.activeUniformNamesToValue.clear();
- // Update only update properties if uboNeedsUpdate is true, otherwise update the whole block
- m_data->m_uniformBlockBuilder.updatedPropertiesOnly = uboNeedsUpdate;
- // Retrieve names and description of each active uniforms in the uniform block
- m_data->m_uniformBlockBuilder.uniforms = shader->activeUniformsForBlock(block.m_index);
- // Builds the name-value map for the block
- m_data->m_uniformBlockBuilder.buildActiveUniformNameValueMapStructHelper(shaderData, block.m_name);
- if (!uboNeedsUpdate)
- shaderData->markDirty();
- // copy the name-value map into the BlockToUBO
- uniformBlockUBO.m_updatedProperties = m_data->m_uniformBlockBuilder.activeUniformNamesToValue;
- uboNeedsUpdate = true;
+void RenderView::setShaderStorageValue(ShaderParameterPack &uniformPack,
+ Shader *shader,
+ const ShaderStorageBlock &block,
+ const QVariant &value)
+{
+ Q_UNUSED(shader)
+ if (static_cast<QMetaType::Type>(value.userType()) == qNodeIdTypeId) {
+ Buffer *buffer = nullptr;
+ if ((buffer = m_manager->bufferManager()->lookupResource(variant_value<Qt3DCore::QNodeId>(value))) != nullptr) {
+ BlockToSSBO shaderStorageBlock;
+ shaderStorageBlock.m_blockIndex = block.m_index;
+ shaderStorageBlock.m_bufferID = buffer->peerId();
+ uniformPack.setShaderStorageBuffer(shaderStorageBlock);
+ // Buffer update to GL buffer will be done at render time
}
-
- uniformBlockUBO.m_needsUpdate = uboNeedsUpdate;
- uniformPack.setUniformBuffer(uniformBlockUBO);
}
}
-void RenderView::setDefaultUniformBlockShaderDataValue(QUniformPack &uniformPack, Shader *shader, ShaderData *shaderData, const QString &structName)
+void RenderView::setDefaultUniformBlockShaderDataValue(ShaderParameterPack &uniformPack, Shader *shader, ShaderData *shaderData, const QString &structName)
{
m_data->m_uniformBlockBuilder.activeUniformNamesToValue.clear();
@@ -620,12 +757,12 @@ void RenderView::setDefaultUniformBlockShaderDataValue(QUniformPack &uniformPack
// Force to update the whole block
m_data->m_uniformBlockBuilder.updatedPropertiesOnly = false;
// Retrieve names and description of each active uniforms in the uniform block
- m_data->m_uniformBlockBuilder.uniforms = shader->activeUniformsForBlock(-1);
+ m_data->m_uniformBlockBuilder.uniforms = shader->activeUniformsForUniformBlock(-1);
// Build name-value map for the block
m_data->m_uniformBlockBuilder.buildActiveUniformNameValueMapStructHelper(shaderData, structName);
// Set uniform values for each entrie of the block name-value map
- QHash<QString, QVariant>::const_iterator activeValuesIt = m_data->m_uniformBlockBuilder.activeUniformNamesToValue.constBegin();
- const QHash<QString, QVariant>::const_iterator activeValuesEnd = m_data->m_uniformBlockBuilder.activeUniformNamesToValue.constEnd();
+ QHash<int, QVariant>::const_iterator activeValuesIt = m_data->m_uniformBlockBuilder.activeUniformNamesToValue.constBegin();
+ const QHash<int, QVariant>::const_iterator activeValuesEnd = m_data->m_uniformBlockBuilder.activeUniformNamesToValue.constEnd();
while (activeValuesIt != activeValuesEnd) {
setUniformValue(uniformPack, activeValuesIt.key(), activeValuesIt.value());
@@ -636,22 +773,20 @@ void RenderView::setDefaultUniformBlockShaderDataValue(QUniformPack &uniformPack
void RenderView::buildSortingKey(RenderCommand *command)
{
// Build a bitset key depending on the SortingCriterion
- int sortCount = m_data->m_sortingCriteria.count();
+ int sortCount = m_data->m_sortingTypes.count();
// If sortCount == 0, no sorting is applied
// Handle at most 4 filters at once
for (int i = 0; i < sortCount && i < 4; i++) {
- SortCriterion *sC = m_manager->lookupResource<SortCriterion, SortCriterionManager>(m_data->m_sortingCriteria[i]);
-
- switch (sC->sortType()) {
- case QSortCriterion::StateChangeCost:
+ switch (m_data->m_sortingTypes.at(i)) {
+ case QSortPolicy::StateChangeCost:
command->m_sortingType.sorts[i] = command->m_changeCost; // State change cost
break;
- case QSortCriterion::BackToFront:
+ case QSortPolicy::BackToFront:
command->m_sortBackToFront = true; // Depth value
break;
- case QSortCriterion::Material:
+ case QSortPolicy::Material:
command->m_sortingType.sorts[i] = command->m_shaderDna; // Material
break;
default:
@@ -673,126 +808,108 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass,
// For each ParameterBinder in the RenderPass -> create a QUniformPack
// Once that works, improve that to try and minimize QUniformPack updates
- if (rPass != Q_NULLPTR) {
+ if (rPass != nullptr) {
// Index Shader by Shader UUID
command->m_shader = m_manager->lookupHandle<Shader, ShaderManager, HShader>(rPass->shaderProgram());
- Shader *shader = Q_NULLPTR;
- if ((shader = m_manager->data<Shader, ShaderManager>(command->m_shader)) != Q_NULLPTR) {
+ Shader *shader = nullptr;
+ if ((shader = m_manager->data<Shader, ShaderManager>(command->m_shader)) != nullptr) {
command->m_shaderDna = shader->dna();
// Builds the QUniformPack, sets shader standard uniforms and store attributes name / glname bindings
// If a parameter is defined and not found in the bindings it is assumed to be a binding of Uniform type with the glsl name
// equals to the parameter name
- const QVector<QString> &uniformNames = shader->uniformsNames();
- const QVector<QString> &attributeNames = shader->attributesNames();
- const QVector<QString> &uniformBlockNames = shader->uniformBlockNames();
+ const QVector<int> uniformNamesIds = shader->uniformsNamesIds();
+ const QVector<int> uniformBlockNamesIds = shader->uniformBlockNamesIds();
+ const QVector<int> shaderStorageBlockNamesIds = shader->storageBlockNamesIds();
+ const QVector<int> attributeNamesIds = shader->attributeNamesIds();
// Set fragData Name and index
// Later on we might want to relink the shader if attachments have changed
// But for now we set them once and for all
QHash<QString, int> fragOutputs;
if (!m_renderTarget.isNull() && !shader->isLoaded()) {
- Q_FOREACH (const Attachment &att, m_attachmentPack.attachments()) {
- if (att.m_type <= QRenderAttachment::ColorAttachment15)
- fragOutputs.insert(att.m_name, att.m_type);
+ const auto atts = m_attachmentPack.attachments();
+ for (const Attachment &att : atts) {
+ if (att.m_point <= QRenderTargetOutput::Color15)
+ fragOutputs.insert(att.m_name, att.m_point);
}
}
- if (!uniformNames.isEmpty() || !attributeNames.isEmpty()) {
+ if (!uniformNamesIds.isEmpty() || !attributeNamesIds.isEmpty() ||
+ !shaderStorageBlockNamesIds.isEmpty() || !attributeNamesIds.isEmpty()) {
// Set default standard uniforms without bindings
- Q_FOREACH (const QString &uniformName, uniformNames) {
- if (ms_standardUniformSetters.contains(uniformName))
- setStandardUniformValue(command->m_uniforms, uniformName, uniformName, worldTransform);
+ for (const int uniformNameId : uniformNamesIds) {
+ if (ms_standardUniformSetters.contains(uniformNameId))
+ setStandardUniformValue(command->m_parameterPack, uniformNameId, uniformNameId, worldTransform);
}
// Set default attributes
- Q_FOREACH (const QString &attributeName, attributeNames) {
- if (ms_standardAttributesNames.contains(attributeName))
- command->m_parameterAttributeToShaderNames.insert(attributeName, attributeName);
- }
-
- // Set uniforms and attributes explicitly binded
- Q_FOREACH (const ParameterMapping &binding, rPass->bindings()) {
- ParameterInfoList::iterator it = findParamInfo(&parameters, binding.parameterName());
- if (it == parameters.end()) {
- if (binding.bindingType() == QParameterMapping::Attribute
- && attributeNames.contains(binding.shaderVariableName())) {
- command->m_parameterAttributeToShaderNames.insert(binding.parameterName(), binding.shaderVariableName());
- } else if (binding.bindingType() == QParameterMapping::StandardUniform
- && uniformNames.contains(binding.shaderVariableName())
- && ms_standardUniformSetters.contains(binding.parameterName())) {
- setStandardUniformValue(command->m_uniforms, binding.shaderVariableName(), binding.parameterName(), worldTransform);
- } else if (binding.bindingType() == QParameterMapping::FragmentOutput
- && fragOutputs.contains(binding.parameterName())) {
- fragOutputs.insert(binding.shaderVariableName(), fragOutputs.take(binding.parameterName()));
- } else {
- qCWarning(Render::Backend) << Q_FUNC_INFO << "Trying to bind a Parameter that hasn't been defined " << binding.parameterName();
- }
- } else {
- setUniformValue(command->m_uniforms, binding.shaderVariableName(), it->value);
- parameters.erase(it);
- }
- }
+ for (const int attributeNameId : attributeNamesIds)
+ command->m_attributes.push_back(attributeNameId);
// Parameters remaining could be
// -> uniform scalar / vector
// -> uniform struct / arrays
// -> uniform block / array (4.3)
-
- if ((!uniformNames.isEmpty() || !uniformBlockNames.isEmpty()) && !parameters.isEmpty()) {
- ParameterInfoList::iterator it = parameters.begin();
- while (it != parameters.end()) {
- if (uniformNames.contains(it->name)) { // Parameter is a regular uniform
- setUniformValue(command->m_uniforms, it->name, it->value);
- it = parameters.erase(it);
- } else if (uniformBlockNames.indexOf(it->name) != -1) { // Parameter is a uniform block
- const ShaderUniformBlock &block = shader->uniformBlock(it->name);
- setUniformBlockValue(command->m_uniforms, shader, block, it->value);
- it = parameters.erase(it);
- } else {
- const QVariant &v = it->value;
- ShaderData *shaderData = Q_NULLPTR;
- if ((shaderData = v.value<ShaderData *>()) != Q_NULLPTR) {
- // Try to check if we have a struct or array matching a QShaderData parameter
- setDefaultUniformBlockShaderDataValue(command->m_uniforms, shader, shaderData, it->name);
- it = parameters.erase(it);
- } else {
- // Else param unused by current shader
- ++it;
- }
+ // -> ssbo block / array (4.3)
+
+ ParameterInfoList::const_iterator it = parameters.cbegin();
+ const ParameterInfoList::const_iterator parametersEnd = parameters.cend();
+
+ while (it != parametersEnd) {
+ if (uniformNamesIds.contains(it->nameId)) { // Parameter is a regular uniform
+ setUniformValue(command->m_parameterPack, it->nameId, it->value);
+ } else if (uniformBlockNamesIds.indexOf(it->nameId) != -1) { // Parameter is a uniform block
+ setUniformBlockValue(command->m_parameterPack, shader, shader->uniformBlockForBlockNameId(it->nameId), it->value);
+ } else if (shaderStorageBlockNamesIds.indexOf(it->nameId) != -1) { // Parameters is a SSBO
+ setShaderStorageValue(command->m_parameterPack, shader, shader->storageBlockForBlockNameId(it->nameId), it->value);
+ } else { // Parameter is a struct
+ const QVariant &v = it->value;
+ ShaderData *shaderData = nullptr;
+ if (static_cast<QMetaType::Type>(v.userType()) == qNodeIdTypeId &&
+ (shaderData = m_manager->shaderDataManager()->lookupResource(variant_value<Qt3DCore::QNodeId>(v))) != nullptr) {
+ // Try to check if we have a struct or array matching a QShaderData parameter
+ setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, StringToInt::lookupString(it->nameId));
}
+ // Otherwise: param unused by current shader
}
+ ++it;
}
// Lights
- const QString LIGHT_COUNT_NAME = QStringLiteral("lightCount");
- const QString LIGHT_POSITION_NAME = QStringLiteral(".position");
int lightIdx = 0;
- Q_FOREACH (const LightSource &lightSource, activeLightSources) {
+ for (const LightSource &lightSource : activeLightSources) {
if (lightIdx == MAX_LIGHTS)
break;
Entity *lightEntity = lightSource.entity;
const QVector3D worldPos = lightEntity->worldBoundingVolume()->center();
- Q_FOREACH (Light *light, lightSource.lights) {
+ for (Light *light : lightSource.lights) {
+ ShaderData *shaderData = m_manager->shaderDataManager()->lookupResource(light->shaderData());
+ if (!shaderData)
+ continue;
+
if (lightIdx == MAX_LIGHTS)
break;
- const QString structName = QStringLiteral("lights[") + QString::number(lightIdx) + QLatin1Char(']');
- setUniformValue(command->m_uniforms, structName + LIGHT_POSITION_NAME, worldPos);
- setDefaultUniformBlockShaderDataValue(command->m_uniforms, shader, light, structName);
+
+ setUniformValue(command->m_parameterPack, LIGHT_POSITION_NAMES[lightIdx], worldPos);
+ setUniformValue(command->m_parameterPack, LIGHT_TYPE_NAMES[lightIdx], int(QAbstractLight::PointLight));
+ setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[lightIdx], QVector3D(1.0f, 1.0f, 1.0f));
+ setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_NAMES[lightIdx], QVector3D(0.5f, 0.5f, 0.5f));
+ setDefaultUniformBlockShaderDataValue(command->m_parameterPack, shader, shaderData, LIGHT_STRUCT_NAMES[lightIdx]);
++lightIdx;
}
}
- if (uniformNames.contains(LIGHT_COUNT_NAME))
- setUniformValue(command->m_uniforms, LIGHT_COUNT_NAME, qMax(1, lightIdx));
+ if (uniformNamesIds.contains(LIGHT_COUNT_NAME_ID))
+ setUniformValue(command->m_parameterPack, LIGHT_COUNT_NAME_ID, qMax(1, lightIdx));
if (activeLightSources.isEmpty()) {
- setUniformValue(command->m_uniforms, QStringLiteral("lights[0].type"), int(QLight::DirectionalLight));
- setUniformValue(command->m_uniforms, QStringLiteral("lights[0].direction"), QVector3D(0.0f, -1.0f, -1.0f));
- setUniformValue(command->m_uniforms, QStringLiteral("lights[0].color"), QVector3D(1.0f, 1.0f, 1.0f));
- setUniformValue(command->m_uniforms, QStringLiteral("lights[0].intensity"), 1.0f);
+ setUniformValue(command->m_parameterPack, LIGHT_POSITION_NAMES[0], QVector3D(10.0f, 10.0f, 0.0f));
+ setUniformValue(command->m_parameterPack, LIGHT_TYPE_NAMES[0], int(QAbstractLight::PointLight));
+ setUniformValue(command->m_parameterPack, LIGHT_COLOR_NAMES[0], QVector3D(1.0f, 1.0f, 1.0f));
+ setUniformValue(command->m_parameterPack, LIGHT_INTENSITY_NAMES[0], QVector3D(0.5f, 0.5f, 0.5f));
}
}
// Set frag outputs in the shaders if hash not empty
diff --git a/src/render/backend/renderview_p.h b/src/render/backend/renderview_p.h
index 9819b0b5e..89591e271 100644
--- a/src/render/backend/renderview_p.h
+++ b/src/render/backend/renderview_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,11 +53,13 @@
//
#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qclearbuffer.h>
+#include <Qt3DRender/qclearbuffers.h>
#include <Qt3DRender/private/renderer_p.h>
+#include <Qt3DRender/private/clearbuffers_p.h>
#include <Qt3DRender/private/cameralens_p.h>
#include <Qt3DRender/private/attachmentpack_p.h>
#include <Qt3DRender/private/handle_types_p.h>
+#include <Qt3DRender/private/qsortpolicy_p.h>
#include <Qt3DRender/qparameter.h>
#include <Qt3DCore/private/qframeallocator_p.h>
@@ -63,6 +68,7 @@
#include <Qt3DRender/private/renderviewjobutils_p.h>
#include <QVector>
+#include <QSurface>
#include <QMutex>
#include <QColor>
@@ -115,9 +121,12 @@ public:
void sort();
void setRenderer(Renderer *renderer);
- inline void setSurfaceSize(const QSize &size) { m_surfaceSize = size; }
- inline Renderer *renderer() const { return m_renderer; }
- inline NodeManagers *nodeManagers() const { return m_manager; }
+ inline void setSurfaceSize(const QSize &size) Q_DECL_NOEXCEPT { m_surfaceSize = size; }
+ inline Renderer *renderer() const Q_DECL_NOEXCEPT { return m_renderer; }
+ inline NodeManagers *nodeManagers() const Q_DECL_NOEXCEPT { return m_manager; }
+ inline const QSize &surfaceSize() const { return m_surfaceSize; }
+ inline void setDevicePixelRatio(qreal r) { m_devicePixelRatio = r; }
+ inline qreal devicePixelRatio() const { return m_devicePixelRatio; }
inline void setAllocator(Qt3DCore::QFrameAllocator *allocator)
{
@@ -146,8 +155,10 @@ public:
inline void setEyePosition(const QVector3D &eyePos) { m_data->m_eyePos = eyePos; }
inline QVector3D eyePosition() const { return m_data->m_eyePos; }
- inline void appendLayerFilter(const QStringList &layers) { m_data->m_layers << layers; }
- inline QStringList layerFilters() const { return m_data->m_layers; }
+ inline void setHasLayerFilter(bool filter) { m_data->m_hasLayerFilter = filter; }
+ inline bool hasLayerFilter() const { return m_data->m_hasLayerFilter; }
+ inline void appendLayerFilter(const Qt3DCore::QNodeIdVector &layerIds) { m_data->m_layerIds << layerIds; }
+ inline Qt3DCore::QNodeIdVector layerFilter() const { return m_data->m_layerIds; }
inline void setRenderPassFilter(const RenderPassFilter *rpFilter) { m_data->m_passFilter = rpFilter; }
inline const RenderPassFilter *renderPassFilter() const { return m_data->m_passFilter; }
@@ -155,14 +166,19 @@ public:
inline void setTechniqueFilter(const TechniqueFilter *filter) { m_data->m_techniqueFilter = filter; }
inline const TechniqueFilter *techniqueFilter() const { return m_data->m_techniqueFilter; }
- inline RenderStateSet *stateSet() const { return m_stateSet; }
- void setStateSet(RenderStateSet *stateSet) { m_stateSet = stateSet; }
+ inline RenderStateSet *stateSet() const Q_DECL_NOEXCEPT { return m_stateSet; }
+ void setStateSet(RenderStateSet *stateSet) Q_DECL_NOEXCEPT { m_stateSet = stateSet; }
- inline bool noDraw() const { return m_noDraw; }
- void setNoDraw(bool noDraw) { m_noDraw = noDraw; }
+ inline bool noDraw() const Q_DECL_NOEXCEPT { return m_noDraw; }
+ void setNoDraw(bool noDraw) Q_DECL_NOEXCEPT { m_noDraw = noDraw; }
- inline bool frustumCulling() const { return m_frustumCulling; }
- void setFrustumCulling(bool frustumCulling) { m_frustumCulling = frustumCulling; }
+ inline bool isCompute() const Q_DECL_NOEXCEPT { return m_compute; }
+ void setCompute(bool compute) Q_DECL_NOEXCEPT { m_compute = compute; }
+
+ void setComputeWorkgroups(int x, int y, int z) Q_DECL_NOEXCEPT { m_workGroups[0] = x; m_workGroups[1] = y; m_workGroups[2] = z; }
+ const int *computeWorkGroups() const Q_DECL_NOEXCEPT { return m_workGroups; }
+ inline bool frustumCulling() const Q_DECL_NOEXCEPT { return m_frustumCulling; }
+ void setFrustumCulling(bool frustumCulling) Q_DECL_NOEXCEPT { m_frustumCulling = frustumCulling; }
// TODO: Get rid of this overly complex memory management by splitting out the
// InnerData as a RenderViewConfig struct. This can be created by setRenderViewConfigFromFrameGraphLeafNode
@@ -186,50 +202,45 @@ public:
return *m_viewport;
}
- inline void setClearColor(const QColor &c)
- {
- if (!m_clearColor) {
- Q_ASSERT(m_allocator);
- m_clearColor = m_allocator->allocate<QColor>();
- *m_clearColor = QColor(QColor::Invalid);
- }
- *m_clearColor = c;
- }
- inline QColor clearColor() const
- {
- if (!m_clearColor) {
- Q_ASSERT(m_allocator);
- m_clearColor = m_allocator->allocate<QColor>();
- *m_clearColor = QColor(QColor::Invalid);
- }
- return *m_clearColor;
- }
-
- inline void setClearBuffer(QClearBuffer::BufferType clearBuffer) { m_clearBuffer = clearBuffer; }
- inline QClearBuffer::BufferType clearBuffer() const { return m_clearBuffer; }
-
- void buildRenderCommands(Entity *preprocessedTreeRoot, const Plane *planes);
+ // depth and stencil ClearBuffers are cached locally
+ // color ClearBuffers are collected, as there may be multiple
+ // color buffers to be cleared. we need to apply all these at rendering
+ void addClearBuffers(const ClearBuffers *cb);
+ inline QVector<const ClearBuffers*> specificClearColorBuffers() const { return m_specificClearColorBuffers; }
+ inline const ClearBuffers* globalClearColorBuffers() const { return m_globalClearColorBuffer; }
+ inline QClearBuffers::BufferTypeFlags clearTypes() const { return m_clearBuffer; }
+ inline float clearDepthValue() const { return m_clearDepthValue; }
+ inline int clearStencilValue() const { return m_clearStencilValue; }
+
+ RenderRenderPassList passesAndParameters(ParameterInfoList *parameter, Entity *node, bool useDefaultMaterials = true);
+
+ void buildRenderCommands(Entity *rootEntity, const Plane *planes);
+ void buildDrawRenderCommands(Entity *node, const Plane *planes);
+ void buildComputeRenderCommands(Entity *node);
QVector<RenderCommand *> commands() const { return m_commands; }
void gatherLights(Entity *preprocessedTreeRoot);
- void addRenderAttachment(Attachment attachment) { m_attachmentPack.addAttachment(attachment); }
- void setDrawBuffers(const QList<QRenderAttachment::RenderAttachmentType> &drawBuffers) { m_attachmentPack.setDrawBuffers(drawBuffers); }
- const AttachmentPack &attachmentPack() const;
+ void setAttachmentPack(const AttachmentPack &pack) { m_attachmentPack = pack; }
+ const AttachmentPack &attachmentPack() const { return m_attachmentPack; }
+
+ void setRenderTargetHandle(HTarget renderTargetHandle) Q_DECL_NOEXCEPT { m_renderTarget = renderTargetHandle; }
+ HTarget renderTargetHandle() const Q_DECL_NOEXCEPT { return m_renderTarget; }
- void setRenderTargetHandle(HTarget renderTargetHandle) { m_renderTarget = renderTargetHandle; }
- HTarget renderTargetHandle() const { return m_renderTarget; }
+ void addSortType(const QVector<Qt3DRender::QSortPolicy::SortType> &sortTypes) { m_data->m_sortingTypes.append(sortTypes); }
- void addSortCriteria(const QList<Qt3DCore::QNodeId> &sortMethodUid) { m_data->m_sortingCriteria.append(sortMethodUid); }
+ void setSurface(QSurface *surface) { m_surface = surface; }
+ QSurface *surface() const { return m_surface; }
// Helps making the size of RenderView smaller
// Contains all the data needed for the actual building of the RenderView
// But that aren't used later by the Renderer
struct InnerData {
InnerData()
- : m_renderCamera(Q_NULLPTR)
- , m_techniqueFilter(Q_NULLPTR)
- , m_passFilter(Q_NULLPTR)
- , m_viewMatrix(Q_NULLPTR)
+ : m_renderCamera(nullptr)
+ , m_techniqueFilter(nullptr)
+ , m_passFilter(nullptr)
+ , m_viewMatrix(nullptr)
+ , m_hasLayerFilter(false)
{
}
CameraLens *m_renderCamera;
@@ -237,14 +248,15 @@ public:
const RenderPassFilter *m_passFilter;
QMatrix4x4 *m_viewMatrix;
QMatrix4x4 *m_viewProjectionMatrix;
- QStringList m_layers;
- QList<Qt3DCore::QNodeId> m_sortingCriteria;
+ bool m_hasLayerFilter;
+ Qt3DCore::QNodeIdVector m_layerIds;
+ QVector<Qt3DRender::QSortPolicy::SortType> m_sortingTypes;
QVector3D m_eyePos;
UniformBlockValueBuilder m_uniformBlockBuilder;
};
struct LightSource {
- LightSource() : entity(Q_NULLPTR) { }
+ LightSource() : entity(nullptr) { }
LightSource(Entity *entity, const QList<Light *> &lights)
: entity(entity), lights(lights) { }
Entity *entity;
@@ -258,18 +270,25 @@ private:
Renderer *m_renderer;
NodeManagers *m_manager;
QSize m_surfaceSize;
+ qreal m_devicePixelRatio;
Qt3DCore::QFrameAllocator *m_allocator;
InnerData *m_data;
- mutable QColor *m_clearColor;
mutable QRectF *m_viewport;
HTarget m_renderTarget;
+ QSurface *m_surface;
AttachmentPack m_attachmentPack;
- QClearBuffer::BufferType m_clearBuffer;
+ QClearBuffers::BufferTypeFlags m_clearBuffer;
+ float m_clearDepthValue;
+ int m_clearStencilValue;
+ const ClearBuffers* m_globalClearColorBuffer; // global ClearColor
+ QVector<const ClearBuffers*> m_specificClearColorBuffers; // different draw buffers with distinct colors
RenderStateSet *m_stateSet;
- bool m_noDraw;
- bool m_frustumCulling;
+ bool m_noDraw:1;
+ bool m_compute:1;
+ bool m_frustumCulling:1;
+ int m_workGroups[3];
// We do not use pointers to RenderNodes or Drawable's here so that the
// render aspect is free to change the drawables on the next frame whilst
@@ -278,36 +297,38 @@ private:
QVector<LightSource> m_lightSources;
- typedef QHash<QString, QUniformValue* (RenderView::*)(const QMatrix4x4& model) const> StandardUniformsPFuncsHash;
+ typedef QHash<int, QUniformValue (RenderView::*)(const QMatrix4x4& model) const> StandardUniformsPFuncsHash;
static StandardUniformsPFuncsHash ms_standardUniformSetters;
static StandardUniformsPFuncsHash initializeStandardUniformSetters();
- static QStringList ms_standardAttributesNames;
- static QStringList initializeStandardAttributeNames();
-
- QUniformValue *modelMatrix(const QMatrix4x4& model) const;
- QUniformValue *viewMatrix(const QMatrix4x4&) const;
- QUniformValue *projectionMatrix(const QMatrix4x4 &) const;
- QUniformValue *modelViewMatrix(const QMatrix4x4 &model) const;
- QUniformValue *modelViewProjectionMatrix(const QMatrix4x4 &model) const;
- QUniformValue *inverseModelMatrix(const QMatrix4x4 &model) const;
- QUniformValue *inverseViewMatrix(const QMatrix4x4 &) const;
- QUniformValue *inverseProjectionMatrix(const QMatrix4x4 &) const;
- QUniformValue *inverseModelViewMatrix(const QMatrix4x4 &model) const;
- QUniformValue *inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const;
- QUniformValue *modelNormalMatrix(const QMatrix4x4 &model) const;
- QUniformValue *modelViewNormalMatrix(const QMatrix4x4 &model) const;
- QUniformValue *viewportMatrix(const QMatrix4x4 &model) const;
- QUniformValue *inverseViewportMatrix(const QMatrix4x4 &model) const;
- QUniformValue *time(const QMatrix4x4 &model) const;
- QUniformValue *eyePosition(const QMatrix4x4 &model) const;
-
- void setUniformValue(QUniformPack &uniformPack, const QString &name, const QVariant &value);
- void setStandardUniformValue(QUniformPack &uniformPack, const QString &glslName, const QString &name, const QMatrix4x4 &worldTransform);
- void setUniformBlockValue(QUniformPack &uniformPack,
+
+ QUniformValue modelMatrix(const QMatrix4x4& model) const;
+ QUniformValue viewMatrix(const QMatrix4x4&) const;
+ QUniformValue projectionMatrix(const QMatrix4x4 &) const;
+ QUniformValue modelViewMatrix(const QMatrix4x4 &model) const;
+ QUniformValue modelViewProjectionMatrix(const QMatrix4x4 &model) const;
+ QUniformValue inverseModelMatrix(const QMatrix4x4 &model) const;
+ QUniformValue inverseViewMatrix(const QMatrix4x4 &) const;
+ QUniformValue inverseProjectionMatrix(const QMatrix4x4 &) const;
+ QUniformValue inverseModelViewMatrix(const QMatrix4x4 &model) const;
+ QUniformValue inverseModelViewProjectionMatrix(const QMatrix4x4 &model) const;
+ QUniformValue modelNormalMatrix(const QMatrix4x4 &model) const;
+ QUniformValue modelViewNormalMatrix(const QMatrix4x4 &model) const;
+ QUniformValue viewportMatrix(const QMatrix4x4 &model) const;
+ QUniformValue inverseViewportMatrix(const QMatrix4x4 &model) const;
+ QUniformValue time(const QMatrix4x4 &model) const;
+ QUniformValue eyePosition(const QMatrix4x4 &model) const;
+
+ void setUniformValue(ShaderParameterPack &uniformPack, int nameId, const QVariant &value);
+ void setStandardUniformValue(ShaderParameterPack &uniformPack, int glslNameId, int nameId, const QMatrix4x4 &worldTransform);
+ void setUniformBlockValue(ShaderParameterPack &uniformPack,
Shader *shader,
const ShaderUniformBlock &block,
const QVariant &value);
- void setDefaultUniformBlockShaderDataValue(QUniformPack &uniformPack,
+ void setShaderStorageValue(ShaderParameterPack &uniformPack,
+ Shader *shader,
+ const ShaderStorageBlock &block,
+ const QVariant &value);
+ void setDefaultUniformBlockShaderDataValue(ShaderParameterPack &uniformPack,
Shader *shader,
ShaderData *shaderData,
const QString &structName);
diff --git a/src/render/backend/shadervariables_p.h b/src/render/backend/shadervariables_p.h
index 89dbba965..a8ff00680 100644
--- a/src/render/backend/shadervariables_p.h
+++ b/src/render/backend/shadervariables_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <QtGlobal>
+#include <Qt3DRender/qt3drender_global.h>
#include <QOpenGLContext>
QT_BEGIN_NAMESPACE
@@ -59,22 +62,33 @@ namespace Render {
struct ShaderAttribute
{
+ ShaderAttribute()
+ : m_nameId(-1)
+ , m_type(0)
+ , m_size(0)
+ , m_location(-1)
+ {}
+
QString m_name;
+ int m_nameId;
GLenum m_type;
int m_size;
int m_location;
};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ShaderAttribute, Q_MOVABLE_TYPE)
struct ShaderUniform
{
ShaderUniform()
- : m_size(0)
+ : m_nameId(-1)
+ , m_size(0)
, m_offset(-1)
, m_location(-1)
, m_blockIndex(-1)
{}
QString m_name;
+ int m_nameId;
GLenum m_type;
int m_size;
int m_offset; // -1 default, >= 0 if uniform defined in uniform block
@@ -85,22 +99,44 @@ struct ShaderUniform
uint m_rawByteSize; // contains byte size (size / type / strides)
// size, offset and strides are in bytes
};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ShaderUniform, Q_MOVABLE_TYPE)
struct ShaderUniformBlock
{
ShaderUniformBlock()
- : m_index(-1)
+ : m_nameId(-1)
+ , m_index(-1)
, m_binding(-1)
, m_activeUniformsCount(0)
, m_size(0)
{}
QString m_name;
+ int m_nameId;
int m_index;
int m_binding;
int m_activeUniformsCount;
int m_size;
};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ShaderUniformBlock, Q_MOVABLE_TYPE)
+
+struct ShaderStorageBlock
+{
+ ShaderStorageBlock()
+ : m_index(-1)
+ , m_binding(-1)
+ , m_size(0)
+ , m_activeVariablesCount(0)
+ {}
+
+ QString m_name;
+ int m_nameId;
+ int m_index;
+ int m_binding;
+ int m_size;
+ int m_activeVariablesCount;
+};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ShaderStorageBlock, Q_MOVABLE_TYPE)
} // namespace Render
diff --git a/src/render/backend/stringtoint.cpp b/src/render/backend/stringtoint.cpp
new file mode 100644
index 000000000..4ae49fc30
--- /dev/null
+++ b/src/render/backend/stringtoint.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "stringtoint_p.h"
+#include <QMutex>
+#include <QReadWriteLock>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+namespace {
+
+QMutex mutex;
+QReadWriteLock readLock;
+
+} // anonymous
+
+QVector<QString> StringToInt::m_stringsArray = QVector<QString>();
+QVector<QString> StringToInt::m_pendingStringsArray = QVector<QString>();
+int StringToInt::m_calls = 0;
+
+int StringToInt::lookupId(QLatin1String str)
+{
+ // ### optimize me
+ return lookupId(QString(str));
+}
+
+int StringToInt::lookupId(const QString &str)
+{
+ // Note: how do we protect against the case where
+ // we are synching the two arrays ?
+ QReadLocker readLocker(&readLock);
+ int idx = StringToInt::m_stringsArray.indexOf(str);
+
+ if (Q_UNLIKELY(idx < 0)) {
+ QMutexLocker lock(&mutex);
+
+ // If not found in m_stringsArray, maybe it's in the pending array
+ if ((idx = StringToInt::m_pendingStringsArray.indexOf(str)) >= 0) {
+ idx += StringToInt::m_stringsArray.size();
+ } else {
+ // If not, we add it to the m_pendingStringArray
+ StringToInt::m_pendingStringsArray.push_back(str);
+ idx = StringToInt::m_stringsArray.size() + m_pendingStringsArray.size() - 1;
+ }
+
+ // We sync the two arrays every 20 calls
+ if (StringToInt::m_calls % 20 == 0 && StringToInt::m_pendingStringsArray.size() > 0) {
+ // Unlock reader to writeLock
+ // since a read lock cannot be locked for writing
+ lock.unlock();
+ readLocker.unlock();
+
+ QWriteLocker writeLock(&readLock);
+ lock.relock();
+
+ StringToInt::m_stringsArray += StringToInt::m_pendingStringsArray;
+ StringToInt::m_pendingStringsArray.clear();
+ StringToInt::m_calls = 0;
+ }
+ }
+ return idx;
+}
+
+QString StringToInt::lookupString(int idx)
+{
+ QReadLocker readLocker(&readLock);
+ if (Q_LIKELY(StringToInt::m_stringsArray.size() > idx))
+ return StringToInt::m_stringsArray.at(idx);
+
+ // Maybe it's in the pending array then
+ QMutexLocker lock(&mutex);
+ if (StringToInt::m_stringsArray.size() + StringToInt::m_pendingStringsArray.size() > idx)
+ return StringToInt::m_pendingStringsArray.at(idx - StringToInt::m_stringsArray.size());
+
+ return QString();
+}
+
+} // Render
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/backend/stringtoint_p.h b/src/render/backend/stringtoint_p.h
new file mode 100644
index 000000000..2d9e566fb
--- /dev/null
+++ b/src/render/backend/stringtoint_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_STRINGTOINT_P_H
+#define QT3DRENDER_RENDER_STRINGTOINT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+
+#include <QVector>
+#include <QString>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class Q_AUTOTEST_EXPORT StringToInt
+{
+public:
+ static int lookupId(const QString &str);
+ static int lookupId(QLatin1String str);
+ static QString lookupString(int idx);
+
+private:
+ static QVector<QString> m_stringsArray;
+ static QVector<QString> m_pendingStringsArray;
+ static int m_calls;
+};
+
+} // Render
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_STRINGTOINT_P_H
diff --git a/src/render/backend/transform.cpp b/src/render/backend/transform.cpp
index c5cc52671..ef6942f54 100644
--- a/src/render/backend/transform.cpp
+++ b/src/render/backend/transform.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,9 +39,10 @@
#include "transform_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
#include <Qt3DCore/qtransform.h>
+#include <Qt3DCore/private/qtransform_p.h>
QT_BEGIN_NAMESPACE
@@ -48,22 +52,21 @@ namespace Qt3DRender {
namespace Render {
Transform::Transform()
- : QBackendNode()
+ : BackendNode()
, m_rotation()
, m_scale(1.0f, 1.0f, 1.0f)
, m_translation()
{
}
-void Transform::updateFromPeer(Qt3DCore::QNode *peer)
+void Transform::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- Qt3DCore::QTransform *transform = static_cast<Qt3DCore::QTransform *>(peer);
-
- m_rotation = transform->rotation();
- m_scale = transform->scale3D();
- m_translation = transform->translation();
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QTransformData>>(change);
+ const auto &data = typedChange->data;
+ m_rotation = data.rotation;
+ m_scale = data.scale;
+ m_translation = data.translation;
updateMatrix();
- m_enabled = transform->isEnabled();
}
QMatrix4x4 Transform::transformMatrix() const
@@ -74,8 +77,8 @@ QMatrix4x4 Transform::transformMatrix() const
void Transform::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
// TODO: Flag the matrix as dirty and update all matrices batched in a job
- if (e->type() == NodeUpdated) {
- const QScenePropertyChangePtr &propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (e->type() == PropertyUpdated) {
+ const QPropertyUpdatedChangePtr &propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("scale3D")) {
m_scale = propertyChange->value().value<QVector3D>();
updateMatrix();
@@ -85,10 +88,11 @@ void Transform::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
} else if (propertyChange->propertyName() == QByteArrayLiteral("translation")) {
m_translation = propertyChange->value().value<QVector3D>();
updateMatrix();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().toBool();
}
}
+ markDirty(AbstractRenderer::TransformDirty);
+
+ BackendNode::sceneChangeEvent(e);
}
void Transform::updateMatrix()
diff --git a/src/render/backend/transform_p.h b/src/render/backend/transform_p.h
index 28fb60493..a36005d2d 100644
--- a/src/render/backend/transform_p.h
+++ b/src/render/backend/transform_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,10 +51,10 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
-#include <QMatrix4x4>
+#include <Qt3DRender/private/backendnode_p.h>
#include <QtGui/qquaternion.h>
#include <QtGui/qvector3d.h>
+#include <QMatrix4x4>
QT_BEGIN_NAMESPACE
@@ -62,24 +65,23 @@ namespace Render {
class Renderer;
class TransformManager;
-class Transform : public Qt3DCore::QBackendNode
+class Transform : public BackendNode
{
public:
Transform();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
QMatrix4x4 transformMatrix() const;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- inline bool isEnabled() const { return m_enabled; }
void updateMatrix();
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QMatrix4x4 m_transformMatrix;
QQuaternion m_rotation;
QVector3D m_scale;
QVector3D m_translation;
- bool m_enabled;
};
} // namespace Render
diff --git a/src/render/backend/triangleboundingvolume.cpp b/src/render/backend/triangleboundingvolume.cpp
index 8353e0cef..9a2b26310 100644
--- a/src/render/backend/triangleboundingvolume.cpp
+++ b/src/render/backend/triangleboundingvolume.cpp
@@ -1,41 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "triangleboundingvolume_p.h"
-#include <Qt3DCore/qray3d.h>
+#include <Qt3DRender/private/qray3d_p.h>
QT_BEGIN_NAMESPACE
@@ -45,7 +48,7 @@ namespace Render {
// Note: a, b, c in clockwise order
// RealTime Collision Detection page 192
-bool intersectsSegmentTriangle(const Qt3DCore::QRay3D &ray,
+bool intersectsSegmentTriangle(const QRay3D &ray,
const QVector3D &a,
const QVector3D &b,
const QVector3D &c,
@@ -96,7 +99,7 @@ TriangleBoundingVolume::TriangleBoundingVolume()
/*!
The vertices a, b, c are assumed to be in counter clockwise order.
*/
-TriangleBoundingVolume::TriangleBoundingVolume(const Qt3DCore::QNodeId &id, const QVector3D &a, const QVector3D &b, const QVector3D &c)
+TriangleBoundingVolume::TriangleBoundingVolume(Qt3DCore::QNodeId id, const QVector3D &a, const QVector3D &b, const QVector3D &c)
: QBoundingVolume()
, m_id(id)
, m_a(a)
@@ -109,13 +112,13 @@ Qt3DCore::QNodeId TriangleBoundingVolume::id() const
return m_id;
}
-bool TriangleBoundingVolume::intersects(const Qt3DCore::QRay3D &ray, QVector3D *q) const
+bool TriangleBoundingVolume::intersects(const QRay3D &ray, QVector3D *q) const
{
float t = 0.0f;
QVector3D uvw;
const float intersected = intersectsSegmentTriangle(ray, m_c, m_b, m_a, uvw, t);
- if (intersected && q != Q_NULLPTR)
+ if (intersected && q != nullptr)
*q = ray.origin() + t * ray.direction();
return intersected;
diff --git a/src/render/backend/triangleboundingvolume_p.h b/src/render/backend/triangleboundingvolume_p.h
index 849a3abe1..5ce0f1574 100644
--- a/src/render/backend/triangleboundingvolume_p.h
+++ b/src/render/backend/triangleboundingvolume_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,7 +61,7 @@ namespace Qt3DRender {
namespace Render {
-Q_AUTOTEST_EXPORT bool intersectsSegmentTriangle(const Qt3DCore::QRay3D &ray,
+Q_AUTOTEST_EXPORT bool intersectsSegmentTriangle(const QRay3D &ray,
const QVector3D &a,
const QVector3D &b,
const QVector3D &c,
@@ -69,13 +72,13 @@ class Q_AUTOTEST_EXPORT TriangleBoundingVolume : public QBoundingVolume
{
public:
TriangleBoundingVolume();
- explicit TriangleBoundingVolume(const Qt3DCore::QNodeId &id,
+ explicit TriangleBoundingVolume(Qt3DCore::QNodeId id,
const QVector3D &a,
const QVector3D &b,
const QVector3D &c);
Qt3DCore::QNodeId id() const Q_DECL_FINAL;
- bool intersects(const Qt3DCore::QRay3D &ray, QVector3D *q) const Q_DECL_FINAL;
+ bool intersects(const QRay3D &ray, QVector3D *q) const Q_DECL_FINAL;
Type type() const Q_DECL_FINAL;
QVector3D a() const;
diff --git a/src/render/backend/trianglesextractor.cpp b/src/render/backend/trianglesextractor.cpp
index 6d4643fd6..280898b55 100644
--- a/src/render/backend/trianglesextractor.cpp
+++ b/src/render/backend/trianglesextractor.cpp
@@ -1,45 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "trianglesextractor_p.h"
+#include <Qt3DCore/qentity.h>
#include <Qt3DRender/qgeometryrenderer.h>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/buffermanager_p.h>
#include <Qt3DRender/private/geometryrenderer_p.h>
+#include <Qt3DRender/private/geometryrenderermanager_p.h>
#include <Qt3DRender/private/geometry_p.h>
#include <Qt3DRender/private/attribute_p.h>
#include <Qt3DRender/private/buffer_p.h>
@@ -48,455 +53,28 @@
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-
namespace Render {
-namespace {
-
-bool isTriangleBased(Qt3DRender::QGeometryRenderer::PrimitiveType type) Q_DECL_NOEXCEPT
-{
- switch (type) {
- case Qt3DRender::QGeometryRenderer::Triangles:
- case Qt3DRender::QGeometryRenderer::TriangleStrip:
- case Qt3DRender::QGeometryRenderer::TriangleFan:
- case Qt3DRender::QGeometryRenderer::TrianglesAdjacency:
- case Qt3DRender::QGeometryRenderer::TriangleStripAdjacency:
- return true;
- default:
- return false;
- }
-}
-
-struct BufferInfo
-{
- BufferInfo()
- : type(QAttribute::Float)
- , dataSize(0)
- , count(0)
- , byteStride(0)
- , byteOffset(0)
- {}
-
- QByteArray data;
- QAttribute::DataType type;
- uint dataSize;
- uint count;
- uint byteStride;
- uint byteOffset;
-};
-
-// TO DO: Add methods for triangle strip adjacency
-// What about primitive restart ?
-
-// indices, vertices are already offset
-template<typename index, typename vertex>
-QVector<QBoundingVolume *> traverseTrianglesIndexed(index *indices,
- vertex *vertices,
- const BufferInfo &indexInfo,
- const BufferInfo &vertexInfo,
- const Qt3DCore::QNodeId id)
-{
- QVector<QBoundingVolume *> tris;
- uint i = 0;
- const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
- const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
-
- QVector3D abc[3];
- while (i < indexInfo.count) {
- for (uint u = 0; u < 3; ++u) {
- uint idx = indices[i + u] * verticesStride;
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[u][j] = vertices[idx + j];
- }
- }
- tris.push_back(new TriangleBoundingVolume(id, abc[2], abc[1], abc[0]));
- i += 3;
- }
-
- return tris;
-}
-
-// vertices are already offset
-template<typename vertex>
-QVector<QBoundingVolume *> traverseTriangles(vertex *vertices,
- const BufferInfo &vertexInfo,
- const Qt3DCore::QNodeId id)
-{
- QVector<QBoundingVolume *> tris;
- uint i = 0;
-
- const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
- const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
-
- QVector3D abc[3];
- while (i < vertexInfo.count) {
- for (uint u = 0; u < 3; ++u) {
- uint idx = (i + u) * verticesStride;
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[u][j] = vertices[idx + j];
- }
- }
- tris.push_back(new TriangleBoundingVolume(id, abc[2], abc[1], abc[0]));
- i += 3;
- }
- return tris;
-}
-
-// indices, vertices are already offset
-template<typename index, typename vertex>
-QVector<QBoundingVolume *> traverseTriangleStripIndexed(index *indices,
- vertex *vertices,
- const BufferInfo &indexInfo,
- const BufferInfo &vertexInfo,
- const Qt3DCore::QNodeId id)
-{
- QVector<QBoundingVolume *> tris;
- uint i = 0;
- const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
- const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
-
- QVector3D abc[3];
- while (i < indexInfo.count) {
- for (uint u = 0; u < 3; ++u) {
- uint idx = indices[i + u] * verticesStride;
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[u][j] = vertices[idx + j];
- }
- }
- tris.push_back(new TriangleBoundingVolume(id, abc[2], abc[1], abc[0]));
- ++i;
- }
-
- return tris;
-}
-
-// vertices are already offset
-template<typename vertex>
-QVector<QBoundingVolume *> traverseTriangleStrip(vertex *vertices,
- const BufferInfo &vertexInfo,
- const Qt3DCore::QNodeId id)
-{
- QVector<QBoundingVolume *> tris;
- uint i = 0;
-
- const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
- const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
-
- QVector3D abc[3];
- while (i < vertexInfo.count) {
- for (uint u = 0; u < 3; ++u) {
- uint idx = (i + u) * verticesStride;
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[u][j] = vertices[idx + j];
- }
- }
- tris.push_back(new TriangleBoundingVolume(id, abc[2], abc[1], abc[0]));
- ++i;
- }
- return tris;
-}
-
-// indices, vertices are already offset
-template<typename index, typename vertex>
-QVector<QBoundingVolume *> traverseTriangleFanIndexed(index *indices,
- vertex *vertices,
- const BufferInfo &indexInfo,
- const BufferInfo &vertexInfo,
- const Qt3DCore::QNodeId id)
-{
- QVector<QBoundingVolume *> tris;
- const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
- const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
-
- QVector3D abc[3];
-
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[0][j] = vertices[static_cast<int>(indices[0]) * verticesStride + j];
- }
-
- uint i = 1;
- while (i < indexInfo.count) {
- for (uint u = 0; u < 2; ++u) {
- uint idx = indices[i + u] * verticesStride;
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[u + 1][j] = vertices[idx + j];
- }
- }
- tris.push_back(new TriangleBoundingVolume(id, abc[2], abc[1], abc[0]));
- i += 2;
- }
-
- return tris;
-}
-
-// vertices are already offset
-template<typename vertex>
-QVector<QBoundingVolume *> traverseTriangleFan(vertex *vertices,
- const BufferInfo &vertexInfo,
- const Qt3DCore::QNodeId id)
-{
- QVector<QBoundingVolume *> tris;
-
- const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
- const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
-
- QVector3D abc[3];
-
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[0][j] = vertices[j];
- }
-
- uint i = 1;
- while (i < vertexInfo.count) {
- for (uint u = 0; u < 2; ++u) {
- uint idx = (i + u) * verticesStride;
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[u + 1][j] = vertices[idx + j];
- }
- }
- tris.push_back(new TriangleBoundingVolume(id, abc[2], abc[1], abc[0]));
- i += 2;
- }
- return tris;
-}
-
-// indices, vertices are already offset
-template<typename index, typename vertex>
-QVector<QBoundingVolume *> traverseTriangleAdjacencyIndexed(index *indices,
- vertex *vertices,
- const BufferInfo &indexInfo,
- const BufferInfo &vertexInfo,
- const Qt3DCore::QNodeId id)
-{
- QVector<QBoundingVolume *> tris;
- uint i = 0;
- const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
- const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
-
- QVector3D abc[3];
- while (i < indexInfo.count) {
- for (uint u = 0; u < 6; u += 2) {
- uint idx = indices[i + u] * verticesStride;
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[u / 2][j] = vertices[idx + j];
- }
- }
- tris.push_back(new TriangleBoundingVolume(id, abc[2], abc[1], abc[0]));
- i += 6;
- }
-
- return tris;
-}
-
-// vertices are already offset
-template<typename vertex>
-QVector<QBoundingVolume *> traverseTriangleAdjacency(vertex *vertices,
- const BufferInfo &vertexInfo,
- const Qt3DCore::QNodeId id)
-{
- QVector<QBoundingVolume *> tris;
- uint i = 0;
-
- const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
- const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
-
- QVector3D abc[3];
- while (i < vertexInfo.count) {
- for (uint u = 0; u < 6; u += 2) {
- uint idx = (i + u) * verticesStride;
- for (uint j = 0; j < maxVerticesDataSize; ++j) {
- abc[u / 2][j] = vertices[idx + j];
- }
- }
- tris.push_back(new TriangleBoundingVolume(id, abc[2], abc[1], abc[0]));
- i += 6;
- }
- return tris;
-}
-
-
-template <QAttribute::DataType> struct EnumToType;
-template <> struct EnumToType<QAttribute::Byte> { typedef const char type; };
-template <> struct EnumToType<QAttribute::UnsignedByte> { typedef const uchar type; };
-template <> struct EnumToType<QAttribute::Short> { typedef const short type; };
-template <> struct EnumToType<QAttribute::UnsignedShort> { typedef const ushort type; };
-template <> struct EnumToType<QAttribute::Int> { typedef const int type; };
-template <> struct EnumToType<QAttribute::UnsignedInt> { typedef const uint type; };
-template <> struct EnumToType<QAttribute::Float> { typedef const float type; };
-template <> struct EnumToType<QAttribute::Double> { typedef const double type; };
-
-template<QAttribute::DataType v>
-typename EnumToType<v>::type *castToType(const QByteArray &u, uint byteOffset)
-{
- return reinterpret_cast< typename EnumToType<v>::type *>(u.constData() + byteOffset);
-}
-
-template<typename ReturnType, typename Func>
-QVector<QBoundingVolume *> processBuffer(const BufferInfo &info, Func &f)
-{
- switch (info.type) {
- case QAttribute::Byte: return f(info, castToType<QAttribute::Byte>(info.data, info.byteOffset));
- case QAttribute::UnsignedByte: return f(info, castToType<QAttribute::UnsignedByte>(info.data, info.byteOffset));
- case QAttribute::Short: return f(info, castToType<QAttribute::Short>(info.data, info.byteOffset));
- case QAttribute::UnsignedShort: return f(info, castToType<QAttribute::UnsignedShort>(info.data, info.byteOffset));
- case QAttribute::Int: return f(info, castToType<QAttribute::Int>(info.data, info.byteOffset));
- case QAttribute::UnsignedInt: return f(info, castToType<QAttribute::UnsignedInt>(info.data, info.byteOffset));
- case QAttribute::Float: return f(info, castToType<QAttribute::Float>(info.data, info.byteOffset));
- case QAttribute::Double: return f(info, castToType<QAttribute::Double>(info.data, info.byteOffset));
- default:
- return ReturnType();
- }
-}
-
-template<typename Index, typename ReturnType>
-struct IndexedVertexExecutor
-{
- template<typename Vertex>
- ReturnType operator ()(const BufferInfo &vertexInfo, Vertex * vertices)
- {
- switch (primitiveType) {
- case Qt3DRender::QGeometryRenderer::Triangles:
- return traverseTrianglesIndexed(indices, vertices, indexBufferInfo, vertexInfo, id);
- case Qt3DRender::QGeometryRenderer::TriangleStrip:
- return traverseTriangleStripIndexed(indices, vertices, indexBufferInfo, vertexInfo, id);
- case Qt3DRender::QGeometryRenderer::TriangleFan:
- return traverseTriangleFanIndexed(indices, vertices, indexBufferInfo, vertexInfo, id);
- case Qt3DRender::QGeometryRenderer::TrianglesAdjacency:
- return traverseTriangleAdjacencyIndexed(indices, vertices, indexBufferInfo, vertexInfo, id);
- case Qt3DRender::QGeometryRenderer::TriangleStripAdjacency:
- default:
- return ReturnType();
- }
- }
-
- BufferInfo indexBufferInfo;
- Index *indices;
- Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType;
- Qt3DCore::QNodeId id;
-};
-
-template<typename ReturnType>
-struct IndexExecutor
-{
- BufferInfo vertexBufferInfo;
-
- template<typename Index>
- ReturnType operator ()( const BufferInfo &indexInfo, Index *indices)
- {
- IndexedVertexExecutor<Index, ReturnType> exec;
- exec.primitiveType = primitiveType;
- exec.indices = indices;
- exec.indexBufferInfo = indexInfo;
- exec.id = id;
- return processBuffer<ReturnType>(vertexBufferInfo, exec);
- }
-
- Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType;
- Qt3DCore::QNodeId id;
-};
-
-template<typename ReturnType>
-struct VertexExecutor
-{
- template<typename Vertex>
- ReturnType operator ()(const BufferInfo &vertexInfo, Vertex *vertices)
- {
- switch (primitiveType) {
- case Qt3DRender::QGeometryRenderer::Triangles:
- return traverseTriangles(vertices, vertexInfo, id);
- case Qt3DRender::QGeometryRenderer::TriangleStrip:
- return traverseTriangleStrip(vertices, vertexInfo, id);
- case Qt3DRender::QGeometryRenderer::TriangleFan:
- return traverseTriangleFan(vertices, vertexInfo, id);
- case Qt3DRender::QGeometryRenderer::TrianglesAdjacency:
- return traverseTriangleAdjacency(vertices, vertexInfo, id);
- case Qt3DRender::QGeometryRenderer::TriangleStripAdjacency:
- default:
- return ReturnType();
- }
- }
-
- Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType;
- Qt3DCore::QNodeId id;
-};
-
-} // anonymous
-
TrianglesExtractor::TrianglesExtractor(GeometryRenderer *renderer, NodeManagers *manager)
- : m_renderer(renderer)
- , m_manager(manager)
+ : TrianglesVisitor(manager)
+ , m_renderer(renderer)
{
}
QVector<QBoundingVolume *> TrianglesExtractor::extract(const Qt3DCore::QNodeId id)
{
- if (m_renderer && m_renderer->instanceCount() == 1 && isTriangleBased(m_renderer->primitiveType())) {
- Attribute *positionAttribute = Q_NULLPTR;
- Attribute *indexAttribute = Q_NULLPTR;
- Buffer *positionBuffer = Q_NULLPTR;
- Buffer *indexBuffer = Q_NULLPTR;
- Geometry *geom = m_manager->lookupResource<Geometry, GeometryManager>(m_renderer->geometryId());
-
- if (geom) {
- Qt3DRender::Render::Attribute *attribute = Q_NULLPTR;
- Q_FOREACH (const Qt3DCore::QNodeId attrId, geom->attributes()) {
- attribute = m_manager->lookupResource<Attribute, AttributeManager>(attrId);
- if (attribute){
- if (attribute->name() == QAttribute::defaultPositionAttributeName())
- positionAttribute = attribute;
- else if (attribute->attributeType() == QAttribute::IndexAttribute)
- indexAttribute = attribute;
- }
- }
-
- if (positionAttribute)
- positionBuffer = m_manager->lookupResource<Buffer, BufferManager>(positionAttribute->bufferId());
- if (indexAttribute)
- indexBuffer = m_manager->lookupResource<Buffer, BufferManager>(indexAttribute->bufferId());
-
- if (positionBuffer) {
-
- BufferInfo vertexBufferInfo;
- vertexBufferInfo.data = positionBuffer->data();
- vertexBufferInfo.type = positionAttribute->dataType();
- vertexBufferInfo.byteOffset = positionAttribute->byteOffset();
- vertexBufferInfo.byteStride = positionAttribute->byteStride();
- vertexBufferInfo.dataSize = positionAttribute->dataSize();
- vertexBufferInfo.count = positionAttribute->count();
-
- if (indexBuffer) { // Indexed
-
- BufferInfo indexBufferInfo;
- indexBufferInfo.data = indexBuffer->data();
- indexBufferInfo.type = indexAttribute->dataType();
- indexBufferInfo.byteOffset = indexAttribute->byteOffset();
- indexBufferInfo.byteStride = indexAttribute->byteStride();
- indexBufferInfo.count = indexAttribute->count();
-
- IndexExecutor<QVector<QBoundingVolume *> > executor;
- executor.vertexBufferInfo = vertexBufferInfo;
- executor.primitiveType = m_renderer->primitiveType();
- executor.id = id;
-
- return processBuffer<QVector<QBoundingVolume *> >(indexBufferInfo, executor);
-
- } else { // Non Indexed
-
- // Check into which type the buffer needs to be casted
- VertexExecutor<QVector<QBoundingVolume *> > executor;
- executor.primitiveType = m_renderer->primitiveType();
- executor.id = id;
+ qDeleteAll(m_volumes);
+ apply(m_renderer, id);
+ return m_volumes;
+}
- return processBuffer<QVector<QBoundingVolume *> >(vertexBufferInfo, executor);
- }
- }
- }
- }
- return QVector<QBoundingVolume *>();
+void TrianglesExtractor::visit(uint andx, const QVector3D &a, uint bndx, const QVector3D &b, uint cndx, const QVector3D &c)
+{
+ Q_UNUSED(andx); Q_UNUSED(bndx); Q_UNUSED(cndx);
+ m_volumes.push_back(new TriangleBoundingVolume(m_nodeId, a, b, c));
}
} // namespace Render
-
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/backend/trianglesextractor_p.h b/src/render/backend/trianglesextractor_p.h
index 7353278fe..c8fb08124 100644
--- a/src/render/backend/trianglesextractor_p.h
+++ b/src/render/backend/trianglesextractor_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qnodeid.h>
+#include "trianglesvisitor_p.h"
QT_BEGIN_NAMESPACE
@@ -58,10 +61,7 @@ class QBoundingVolume;
namespace Render {
-class GeometryRenderer;
-class NodeManagers;
-
-class Q_AUTOTEST_EXPORT TrianglesExtractor
+class Q_AUTOTEST_EXPORT TrianglesExtractor : private TrianglesVisitor
{
public:
explicit TrianglesExtractor(GeometryRenderer *renderer,
@@ -70,8 +70,12 @@ public:
QVector<QBoundingVolume *> extract(const Qt3DCore::QNodeId id);
private:
+ void visit(uint andx, const QVector3D &a,
+ uint bndx, const QVector3D &b,
+ uint cndx, const QVector3D &c) Q_DECL_OVERRIDE;
+
GeometryRenderer *m_renderer;
- NodeManagers *m_manager;
+ QVector<QBoundingVolume *> m_volumes;
};
} // namespace Render
diff --git a/src/render/backend/trianglesvisitor.cpp b/src/render/backend/trianglesvisitor.cpp
new file mode 100644
index 000000000..50a9a4046
--- /dev/null
+++ b/src/render/backend/trianglesvisitor.cpp
@@ -0,0 +1,536 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "trianglesvisitor_p.h"
+#include <Qt3DCore/qentity.h>
+#include <Qt3DRender/qgeometryrenderer.h>
+#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
+#include <Qt3DRender/private/buffermanager_p.h>
+#include <Qt3DRender/private/geometryrenderer_p.h>
+#include <Qt3DRender/private/geometryrenderermanager_p.h>
+#include <Qt3DRender/private/geometry_p.h>
+#include <Qt3DRender/private/attribute_p.h>
+#include <Qt3DRender/private/buffer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+namespace {
+
+bool isTriangleBased(Qt3DRender::QGeometryRenderer::PrimitiveType type) Q_DECL_NOEXCEPT
+{
+ switch (type) {
+ case Qt3DRender::QGeometryRenderer::Triangles:
+ case Qt3DRender::QGeometryRenderer::TriangleStrip:
+ case Qt3DRender::QGeometryRenderer::TriangleFan:
+ case Qt3DRender::QGeometryRenderer::TrianglesAdjacency:
+ case Qt3DRender::QGeometryRenderer::TriangleStripAdjacency:
+ return true;
+ default:
+ return false;
+ }
+}
+
+struct BufferInfo
+{
+ BufferInfo()
+ : type(QAttribute::VertexBaseType::Float)
+ , dataSize(0)
+ , count(0)
+ , byteStride(0)
+ , byteOffset(0)
+ {}
+
+ QByteArray data;
+ QAttribute::VertexBaseType type;
+ uint dataSize;
+ uint count;
+ uint byteStride;
+ uint byteOffset;
+};
+
+// TO DO: Add methods for triangle strip adjacency
+// What about primitive restart ?
+
+// indices, vertices are already offset
+template<typename index, typename vertex>
+void traverseTrianglesIndexed(index *indices,
+ vertex *vertices,
+ const BufferInfo &indexInfo,
+ const BufferInfo &vertexInfo,
+ TrianglesVisitor* visitor)
+{
+ uint i = 0;
+ const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
+ const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
+
+ uint ndx[3];
+ QVector3D abc[3];
+ while (i < indexInfo.count) {
+ for (uint u = 0; u < 3; ++u) {
+ uint idx = indices[i + u] * verticesStride;
+ ndx[u] = idx;
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[u][j] = vertices[idx + j];
+ }
+ }
+ visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[0], abc[0]);
+ i += 3;
+ }
+}
+
+// vertices are already offset
+template<typename vertex>
+void traverseTriangles(vertex *vertices,
+ const BufferInfo &vertexInfo,
+ TrianglesVisitor* visitor)
+{
+ uint i = 0;
+
+ const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
+ const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
+
+ uint ndx[3];
+ QVector3D abc[3];
+ while (i < vertexInfo.count) {
+ for (uint u = 0; u < 3; ++u) {
+ uint idx = (i + u) * verticesStride;
+ ndx[u] = idx;
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[u][j] = vertices[idx + j];
+ }
+ }
+ visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[0], abc[0]);
+ i += 3;
+ }
+}
+
+static inline bool checkDegenerate(const uint ndx[3], const uint idx, const uint i)
+{
+ for (uint j = 0; j < i; ++j) {
+ if (idx == ndx[j])
+ return true;
+ }
+ return false;
+}
+
+// indices, vertices are already offset
+template<typename index, typename vertex>
+void traverseTriangleStripIndexed(index *indices,
+ vertex *vertices,
+ const BufferInfo &indexInfo,
+ const BufferInfo &vertexInfo,
+ TrianglesVisitor* visitor)
+{
+ uint i = 0;
+ const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
+ const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
+
+ uint ndx[3];
+ QVector3D abc[3];
+ while (i < indexInfo.count - 2) {
+ bool degenerate = false;
+ for (uint u = 0; u < 3; ++u) {
+ uint idx = indices[i + u] * verticesStride;
+ if (checkDegenerate(ndx, idx, i)) {
+ degenerate = true;
+ break;
+ }
+ ndx[u] = idx;
+ for (uint j = 0; j < maxVerticesDataSize; ++j)
+ abc[u][j] = vertices[idx + j];
+ }
+ if (!degenerate)
+ visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[0], abc[0]);
+ ++i;
+ }
+}
+
+// vertices are already offset
+template<typename vertex>
+void traverseTriangleStrip(vertex *vertices,
+ const BufferInfo &vertexInfo,
+ TrianglesVisitor* visitor)
+{
+ uint i = 0;
+
+ const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
+ const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
+
+ uint ndx[3];
+ QVector3D abc[3];
+ while (i < vertexInfo.count) {
+ for (uint u = 0; u < 3; ++u) {
+ uint idx = (i + u) * verticesStride;
+ ndx[u] = idx;
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[u][j] = vertices[idx + j];
+ }
+ }
+ visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[2], abc[0]);
+ ++i;
+ }
+}
+
+// indices, vertices are already offset
+template<typename index, typename vertex>
+void traverseTriangleFanIndexed(index *indices,
+ vertex *vertices,
+ const BufferInfo &indexInfo,
+ const BufferInfo &vertexInfo,
+ TrianglesVisitor* visitor)
+{
+ const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
+ const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
+
+ uint ndx[3];
+ QVector3D abc[3];
+
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[0][j] = vertices[static_cast<int>(indices[0]) * verticesStride + j];
+ }
+
+ uint i = 1;
+ while (i < indexInfo.count) {
+ for (uint u = 0; u < 2; ++u) {
+ uint idx = indices[i + u] * verticesStride;
+ ndx[i] = idx;
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[u + 1][j] = vertices[idx + j];
+ }
+ }
+ visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[0], abc[0]);
+ i += 2;
+ }
+}
+
+// vertices are already offset
+template<typename vertex>
+void traverseTriangleFan(vertex *vertices,
+ const BufferInfo &vertexInfo,
+ TrianglesVisitor* visitor)
+{
+ const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
+ const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
+
+ uint ndx[3];
+ QVector3D abc[3];
+
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[0][j] = vertices[j];
+ }
+
+ uint i = 1;
+ while (i < vertexInfo.count) {
+ for (uint u = 0; u < 2; ++u) {
+ uint idx = (i + u) * verticesStride;
+ ndx[u] = idx;
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[u + 1][j] = vertices[idx + j];
+ }
+ }
+ visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[0], abc[0]);
+ i += 2;
+ }
+}
+
+// indices, vertices are already offset
+template<typename index, typename vertex>
+void traverseTriangleAdjacencyIndexed(index *indices,
+ vertex *vertices,
+ const BufferInfo &indexInfo,
+ const BufferInfo &vertexInfo,
+ TrianglesVisitor* visitor)
+{
+ uint i = 0;
+ const uint verticesStride = vertexInfo.byteStride / sizeof(vertex);
+ const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
+
+ uint ndx[3];
+ QVector3D abc[3];
+ while (i < indexInfo.count) {
+ for (uint u = 0; u < 6; u += 2) {
+ uint idx = indices[i + u] * verticesStride;
+ ndx[u / 2] = idx;
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[u / 2][j] = vertices[idx + j];
+ }
+ }
+ visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[0], abc[0]);
+ i += 6;
+ }
+}
+
+// vertices are already offset
+template<typename Vertex>
+void traverseTriangleAdjacency(Vertex *vertices,
+ const BufferInfo &vertexInfo,
+ TrianglesVisitor* visitor)
+{
+ uint i = 0;
+
+ const uint verticesStride = vertexInfo.byteStride / sizeof(Vertex);
+ const uint maxVerticesDataSize = qMin(vertexInfo.dataSize, 3U);
+
+ uint ndx[3];
+ QVector3D abc[3];
+ while (i < vertexInfo.count) {
+ for (uint u = 0; u < 6; u += 2) {
+ uint idx = (i + u) * verticesStride;
+ ndx[u / 2] = idx;
+ for (uint j = 0; j < maxVerticesDataSize; ++j) {
+ abc[u / 2][j] = vertices[idx + j];
+ }
+ }
+ visitor->visit(ndx[2], abc[2], ndx[1], abc[1], ndx[0], abc[0]);
+ i += 6;
+ }
+}
+
+
+template <QAttribute::VertexBaseType> struct EnumToType;
+template <> struct EnumToType<QAttribute::Byte> { typedef const char type; };
+template <> struct EnumToType<QAttribute::UnsignedByte> { typedef const uchar type; };
+template <> struct EnumToType<QAttribute::Short> { typedef const short type; };
+template <> struct EnumToType<QAttribute::UnsignedShort> { typedef const ushort type; };
+template <> struct EnumToType<QAttribute::Int> { typedef const int type; };
+template <> struct EnumToType<QAttribute::UnsignedInt> { typedef const uint type; };
+template <> struct EnumToType<QAttribute::Float> { typedef const float type; };
+template <> struct EnumToType<QAttribute::Double> { typedef const double type; };
+
+template<QAttribute::VertexBaseType v>
+typename EnumToType<v>::type *castToType(const QByteArray &u, uint byteOffset)
+{
+ return reinterpret_cast< typename EnumToType<v>::type *>(u.constData() + byteOffset);
+}
+
+template<typename Func>
+void processBuffer(const BufferInfo &info, Func &f)
+{
+ switch (info.type) {
+ case QAttribute::Byte: f(info, castToType<QAttribute::Byte>(info.data, info.byteOffset));
+ return;
+ case QAttribute::UnsignedByte: f(info, castToType<QAttribute::UnsignedByte>(info.data, info.byteOffset));
+ return;
+ case QAttribute::Short: f(info, castToType<QAttribute::Short>(info.data, info.byteOffset));
+ return;
+ case QAttribute::UnsignedShort: f(info, castToType<QAttribute::UnsignedShort>(info.data, info.byteOffset));
+ return;
+ case QAttribute::Int: f(info, castToType<QAttribute::Int>(info.data, info.byteOffset));
+ return;
+ case QAttribute::UnsignedInt: f(info, castToType<QAttribute::UnsignedInt>(info.data, info.byteOffset));
+ return;
+ case QAttribute::Float: f(info, castToType<QAttribute::Float>(info.data, info.byteOffset));
+ return;
+ case QAttribute::Double: f(info, castToType<QAttribute::Double>(info.data, info.byteOffset));
+ return;
+ default:
+ return;
+ }
+}
+
+template<typename Index>
+struct IndexedVertexExecutor
+{
+ template<typename Vertex>
+ void operator ()(const BufferInfo &vertexInfo, Vertex * vertices)
+ {
+ switch (primitiveType) {
+ case Qt3DRender::QGeometryRenderer::Triangles:
+ traverseTrianglesIndexed(indices, vertices, indexBufferInfo, vertexInfo, visitor);
+ return;
+ case Qt3DRender::QGeometryRenderer::TriangleStrip:
+ traverseTriangleStripIndexed(indices, vertices, indexBufferInfo, vertexInfo, visitor);
+ return;
+ case Qt3DRender::QGeometryRenderer::TriangleFan:
+ traverseTriangleFanIndexed(indices, vertices, indexBufferInfo, vertexInfo, visitor);
+ return;
+ case Qt3DRender::QGeometryRenderer::TrianglesAdjacency:
+ traverseTriangleAdjacencyIndexed(indices, vertices, indexBufferInfo, vertexInfo, visitor);
+ return;
+ case Qt3DRender::QGeometryRenderer::TriangleStripAdjacency: // fall through
+ default:
+ return;
+ }
+ }
+
+ BufferInfo indexBufferInfo;
+ Index *indices;
+ Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType;
+ TrianglesVisitor* visitor;
+};
+
+struct IndexExecutor
+{
+ BufferInfo vertexBufferInfo;
+
+ template<typename Index>
+ void operator ()( const BufferInfo &indexInfo, Index *indices)
+ {
+ IndexedVertexExecutor<Index> exec;
+ exec.primitiveType = primitiveType;
+ exec.indices = indices;
+ exec.indexBufferInfo = indexInfo;
+ exec.visitor = visitor;
+ processBuffer(vertexBufferInfo, exec);
+ }
+
+ Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType;
+ TrianglesVisitor* visitor;
+};
+
+struct VertexExecutor
+{
+ template<typename Vertex>
+ void operator ()(const BufferInfo &vertexInfo, Vertex *vertices)
+ {
+ switch (primitiveType) {
+ case Qt3DRender::QGeometryRenderer::Triangles:
+ traverseTriangles(vertices, vertexInfo, visitor);
+ return;
+ case Qt3DRender::QGeometryRenderer::TriangleStrip:
+ traverseTriangleStrip(vertices, vertexInfo, visitor);
+ return;
+ case Qt3DRender::QGeometryRenderer::TriangleFan:
+ traverseTriangleFan(vertices, vertexInfo, visitor);
+ return;
+ case Qt3DRender::QGeometryRenderer::TrianglesAdjacency:
+ traverseTriangleAdjacency(vertices, vertexInfo, visitor);
+ return;
+ case Qt3DRender::QGeometryRenderer::TriangleStripAdjacency: // fall through
+ default:
+ return;
+ }
+ }
+
+ Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType;
+ TrianglesVisitor* visitor;
+};
+
+} // anonymous
+
+
+TrianglesVisitor::~TrianglesVisitor()
+{
+
+}
+
+void TrianglesVisitor::apply(const Qt3DCore::QEntity *entity)
+{
+ GeometryRenderer *renderer = m_manager->geometryRendererManager()->lookupResource(entity->id());
+ apply(renderer, entity->id());
+}
+
+void TrianglesVisitor::apply(const GeometryRenderer *renderer, const Qt3DCore::QNodeId id)
+{
+ m_nodeId = id;
+ if (renderer && renderer->instanceCount() == 1 && isTriangleBased(renderer->primitiveType())) {
+ Attribute *positionAttribute = nullptr;
+ Attribute *indexAttribute = nullptr;
+ Buffer *positionBuffer = nullptr;
+ Buffer *indexBuffer = nullptr;
+ Geometry *geom = m_manager->lookupResource<Geometry, GeometryManager>(renderer->geometryId());
+
+ if (geom) {
+ Qt3DRender::Render::Attribute *attribute = nullptr;
+ const auto attrIds = geom->attributes();
+ for (const Qt3DCore::QNodeId attrId : attrIds) {
+ attribute = m_manager->lookupResource<Attribute, AttributeManager>(attrId);
+ if (attribute){
+ if (attribute->name() == QAttribute::defaultPositionAttributeName())
+ positionAttribute = attribute;
+ else if (attribute->attributeType() == QAttribute::IndexAttribute)
+ indexAttribute = attribute;
+ }
+ }
+
+ if (positionAttribute)
+ positionBuffer = m_manager->lookupResource<Buffer, BufferManager>(positionAttribute->bufferId());
+ if (indexAttribute)
+ indexBuffer = m_manager->lookupResource<Buffer, BufferManager>(indexAttribute->bufferId());
+
+ if (positionBuffer) {
+
+ BufferInfo vertexBufferInfo;
+ vertexBufferInfo.data = positionBuffer->data();
+ vertexBufferInfo.type = positionAttribute->vertexBaseType();
+ vertexBufferInfo.byteOffset = positionAttribute->byteOffset();
+ vertexBufferInfo.byteStride = positionAttribute->byteStride();
+ vertexBufferInfo.dataSize = positionAttribute->vertexSize();
+ vertexBufferInfo.count = positionAttribute->count();
+
+ if (indexBuffer) { // Indexed
+
+ BufferInfo indexBufferInfo;
+ indexBufferInfo.data = indexBuffer->data();
+ indexBufferInfo.type = indexAttribute->vertexBaseType();
+ indexBufferInfo.byteOffset = indexAttribute->byteOffset();
+ indexBufferInfo.byteStride = indexAttribute->byteStride();
+ indexBufferInfo.count = indexAttribute->count();
+
+ IndexExecutor executor;
+ executor.vertexBufferInfo = vertexBufferInfo;
+ executor.primitiveType = renderer->primitiveType();
+ executor.visitor = this;
+
+ return processBuffer(indexBufferInfo, executor);
+
+ } else { // Non Indexed
+
+ // Check into which type the buffer needs to be casted
+ VertexExecutor executor;
+ executor.primitiveType = renderer->primitiveType();
+ executor.visitor = this;
+
+ return processBuffer(vertexBufferInfo, executor);
+ }
+ }
+ }
+ }
+}
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/backend/trianglesvisitor_p.h b/src/render/backend/trianglesvisitor_p.h
new file mode 100644
index 000000000..5f7cff9c0
--- /dev/null
+++ b/src/render/backend/trianglesvisitor_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_TRIANGLESVISITOR_P_H
+#define QT3DRENDER_RENDER_TRIANGLESVISITOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QEntity;
+}
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class GeometryRenderer;
+class NodeManagers;
+
+class Q_AUTOTEST_EXPORT TrianglesVisitor
+{
+public:
+ explicit TrianglesVisitor(NodeManagers *manager) : m_manager(manager) { }
+ virtual ~TrianglesVisitor();
+
+ void apply(const Qt3DCore::QEntity *entity);
+ void apply(const GeometryRenderer *renderer, const Qt3DCore::QNodeId id);
+
+ virtual void visit(uint andx, const QVector3D &a,
+ uint bndx, const QVector3D &b,
+ uint cndx, const QVector3D &c) = 0;
+
+protected:
+ NodeManagers *m_manager;
+ Qt3DCore::QNodeId m_nodeId;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+
+#endif // QT3DRENDER_RENDER_TRIANGLESVISITOR_P_H
diff --git a/src/render/defaults/defaults.pri b/src/render/defaults/defaults.pri
deleted file mode 100644
index 1560f55ec..000000000
--- a/src/render/defaults/defaults.pri
+++ /dev/null
@@ -1,39 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/qphongmaterial.h \
- $$PWD/qphongmaterial_p.h \
- $$PWD/qdiffusemapmaterial_p.h \
- $$PWD/qdiffusemapmaterial.h \
- $$PWD/qnormaldiffusespecularmapmaterial.h \
- $$PWD/qnormaldiffusespecularmapmaterial_p.h \
- $$PWD/qnormaldiffusemapmaterial.h \
- $$PWD/qnormaldiffusemapmaterial_p.h \
- $$PWD/qnormaldiffusemapalphamaterial.h \
- $$PWD/qnormaldiffusemapalphamaterial_p.h \
- $$PWD/qdiffusespecularmapmaterial.h \
- $$PWD/qdiffusespecularmapmaterial_p.h \
- $$PWD/qforwardrenderer.h \
- $$PWD/qforwardrenderer_p.h \
- $$PWD/qpervertexcolormaterial.h \
- $$PWD/qpervertexcolormaterial_p.h \
- $$PWD/qskyboxentity.h \
- $$PWD/qskyboxentity_p.h \
- $$PWD/qgoochmaterial.h \
- $$PWD/qgoochmaterial_p.h \
- $$PWD/qphongalphamaterial.h \
- $$PWD/qphongalphamaterial_p.h
-
-SOURCES += \
- $$PWD/qphongmaterial.cpp \
- $$PWD/qdiffusemapmaterial.cpp \
- $$PWD/qnormaldiffusespecularmapmaterial.cpp \
- $$PWD/qnormaldiffusemapmaterial.cpp \
- $$PWD/qnormaldiffusemapalphamaterial.cpp \
- $$PWD/qdiffusespecularmapmaterial.cpp \
- $$PWD/qforwardrenderer.cpp \
- $$PWD/qpervertexcolormaterial.cpp \
- $$PWD/qskyboxentity.cpp \
- $$PWD/qgoochmaterial.cpp \
- $$PWD/qphongalphamaterial.cpp
-
diff --git a/src/render/defaults/qdiffusemapmaterial.cpp b/src/render/defaults/qdiffusemapmaterial.cpp
deleted file mode 100644
index 6b737fc5a..000000000
--- a/src/render/defaults/qdiffusemapmaterial.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdiffusemapmaterial.h"
-#include "qdiffusemapmaterial_p.h"
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qshaderprogram.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <QUrl>
-#include <QVector3D>
-#include <QVector4D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QDiffuseMapMaterialPrivate::QDiffuseMapMaterialPrivate()
- : QMaterialPrivate()
- , m_diffuseMapEffect(new QEffect())
- , m_diffuseTexture(new QTexture2D())
- , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
- , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture))
- , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.01f, 0.01f, 0.01f, 1.0f)))
- , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
- , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
- , m_diffuseMapGL3Technique(new QTechnique())
- , m_diffuseMapGL2Technique(new QTechnique())
- , m_diffuseMapES2Technique(new QTechnique())
- , m_diffuseMapGL3RenderPass(new QRenderPass())
- , m_diffuseMapGL2RenderPass(new QRenderPass())
- , m_diffuseMapES2RenderPass(new QRenderPass())
- , m_diffuseMapGL3Shader(new QShaderProgram())
- , m_diffuseMapGL2ES2Shader(new QShaderProgram())
-{
- m_diffuseTexture->setMagnificationFilter(QAbstractTextureProvider::Linear);
- m_diffuseTexture->setMinificationFilter(QAbstractTextureProvider::LinearMipMapLinear);
- m_diffuseTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
- m_diffuseTexture->setGenerateMipMaps(true);
- m_diffuseTexture->setMaximumAnisotropy(16.0f);
-}
-
-void QDiffuseMapMaterialPrivate::init()
-{
- connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseMapMaterialPrivate::handleAmbientChanged);
- connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseMapMaterialPrivate::handleDiffuseChanged);
- connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseMapMaterialPrivate::handleSpecularChanged);
- connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseMapMaterialPrivate::handleShininessChanged);
- connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseMapMaterialPrivate::handleTextureScaleChanged);
-
- m_diffuseMapGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/diffusemap.vert"))));
- m_diffuseMapGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/diffusemap.frag"))));
- m_diffuseMapGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/diffusemap.vert"))));
- m_diffuseMapGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/diffusemap.frag"))));
-
- m_diffuseMapGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_diffuseMapGL3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_diffuseMapGL3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_diffuseMapGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_diffuseMapGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_diffuseMapGL2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_diffuseMapGL2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_diffuseMapGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_diffuseMapES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_diffuseMapES2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_diffuseMapES2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_diffuseMapES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_diffuseMapGL3RenderPass->setShaderProgram(m_diffuseMapGL3Shader);
- m_diffuseMapGL2RenderPass->setShaderProgram(m_diffuseMapGL2ES2Shader);
- m_diffuseMapES2RenderPass->setShaderProgram(m_diffuseMapGL2ES2Shader);
-
- m_diffuseMapGL3Technique->addPass(m_diffuseMapGL3RenderPass);
- m_diffuseMapGL2Technique->addPass(m_diffuseMapGL2RenderPass);
- m_diffuseMapES2Technique->addPass(m_diffuseMapES2RenderPass);
-
- m_diffuseMapEffect->addTechnique(m_diffuseMapGL3Technique);
- m_diffuseMapEffect->addTechnique(m_diffuseMapGL2Technique);
- m_diffuseMapEffect->addTechnique(m_diffuseMapES2Technique);
-
- m_diffuseMapEffect->addParameter(m_ambientParameter);
- m_diffuseMapEffect->addParameter(m_diffuseParameter);
- m_diffuseMapEffect->addParameter(m_specularParameter);
- m_diffuseMapEffect->addParameter(m_shininessParameter);
- m_diffuseMapEffect->addParameter(m_textureScaleParameter);
-
- q_func()->setEffect(m_diffuseMapEffect);
-}
-
-void QDiffuseMapMaterialPrivate::handleAmbientChanged(const QVariant &var)
-{
- Q_Q(QDiffuseMapMaterial);
- emit q->ambientChanged(var.value<QColor>());
-}
-
-void QDiffuseMapMaterialPrivate::handleDiffuseChanged(const QVariant &var)
-{
- Q_Q(QDiffuseMapMaterial);
- emit q->diffuseChanged(var.value<QAbstractTextureProvider *>());
-}
-
-void QDiffuseMapMaterialPrivate::handleSpecularChanged(const QVariant &var)
-{
- Q_Q(QDiffuseMapMaterial);
- emit q->specularChanged(var.value<QColor>());
-}
-
-void QDiffuseMapMaterialPrivate::handleShininessChanged(const QVariant &var)
-{
- Q_Q(QDiffuseMapMaterial);
- emit q->shininessChanged(var.toFloat());
-}
-
-void QDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
-{
- Q_Q(QDiffuseMapMaterial);
- emit q->textureScaleChanged(var.toFloat());
-}
-
-/*!
- \class Qt3DRender::QDiffuseMapMaterial
- \brief The QDiffuseMapMaterial provides a default implementation of the phong lighting effect where the diffuse light component
- is read from a texture map.
- \inmodule Qt3DRender
- \since 5.5
-
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
-
- \list
- \li Ambient is the color that is emitted by an object without any other light source.
- \li Diffuse is the color that is emitted for rought surface reflections with the lights.
- \li Specular is the color emitted for shiny surface reflections with the lights.
- \li The shininess of a surface is controlled by a float property.
- \endlist
-
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
-*/
-
-/*!
- Constructs a new Qt3DRender::QDiffuseMapMaterial instance with parent object \a parent.
- */
-QDiffuseMapMaterial::QDiffuseMapMaterial(QNode *parent)
- : QMaterial(*new QDiffuseMapMaterialPrivate, parent)
-{
- Q_D(QDiffuseMapMaterial);
- d->init();
-}
-
-/*!
- Destroys the QDiffuseMapMaterial instance.
-*/
-QDiffuseMapMaterial::~QDiffuseMapMaterial()
-{
-}
-
-/*!
- \property Qt3DRender::QDiffuseMapMaterial::ambient
-
- Holds the current ambient color.
-*/
-
-QColor QDiffuseMapMaterial::ambient() const
-{
- Q_D(const QDiffuseMapMaterial);
- return d->m_ambientParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QDiffuseMapMaterial::specular
-
- Holds the current specular color.
-*/
-QColor QDiffuseMapMaterial::specular() const
-{
- Q_D(const QDiffuseMapMaterial);
- return d->m_specularParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QDiffuseMapMaterial::shininess
-
- Holds the current shininess as a float value.
-*/
-float QDiffuseMapMaterial::shininess() const
-{
- Q_D(const QDiffuseMapMaterial);
- return d->m_shininessParameter->value().toFloat();
-}
-
-/*!
- \property Qt3DRender::QDiffuseMapMaterial::diffuse
-
- Holds the current QTexture used as the diffuse map.
-
- By default, the diffuse texture has the following properties:
-
- \list
- \li Linear minification and magnification filters
- \li Linear mipmap with mipmapping enabled
- \li Repeat wrap mode
- \li Maximum anisotropy of 16.0
- \endlist
-*/
-QAbstractTextureProvider *QDiffuseMapMaterial::diffuse() const
-{
- Q_D(const QDiffuseMapMaterial);
- return d->m_diffuseParameter->value().value<QAbstractTextureProvider *>();
-}
-
-/*!
- \property Qt3DRender::QDiffuseMapMaterial::textureScale
-
- Holds the current texture scale as a float value.
-
-*/
-float QDiffuseMapMaterial::textureScale() const
-{
- Q_D(const QDiffuseMapMaterial);
- return d->m_textureScaleParameter->value().toFloat();
-}
-
-void QDiffuseMapMaterial::setAmbient(const QColor &ambient)
-{
- Q_D(const QDiffuseMapMaterial);
- d->m_ambientParameter->setValue(ambient);
-}
-
-void QDiffuseMapMaterial::setSpecular(const QColor &specular)
-{
- Q_D(QDiffuseMapMaterial);
- d->m_specularParameter->setValue(specular);
-}
-
-void QDiffuseMapMaterial::setShininess(float shininess)
-{
- Q_D(QDiffuseMapMaterial);
- d->m_shininessParameter->setValue(shininess);
-}
-
-void QDiffuseMapMaterial::setDiffuse(QAbstractTextureProvider *diffuseMap)
-{
- Q_D(QDiffuseMapMaterial);
- d->m_diffuseParameter->setValue(QVariant::fromValue(diffuseMap));
-}
-
-void QDiffuseMapMaterial::setTextureScale(float textureScale)
-{
- Q_D(QDiffuseMapMaterial);
- d->m_textureScaleParameter->setValue(textureScale);
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qdiffusemapmaterial.h b/src/render/defaults/qdiffusemapmaterial.h
deleted file mode 100644
index 8725b89a6..000000000
--- a/src/render/defaults/qdiffusemapmaterial.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QDIFFUSEMAPMATERIAL_H
-#define QT3DRENDER_RENDER_QDIFFUSEMAPMATERIAL_H
-
-#include <Qt3DRender/qmaterial.h>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QDiffuseMapMaterialPrivate;
-class QAbstractTextureProvider;
-
-class QT3DRENDERSHARED_EXPORT QDiffuseMapMaterial : public QMaterial
-{
- Q_OBJECT
- Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
- Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
- Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
- Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
-
-public:
- explicit QDiffuseMapMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QDiffuseMapMaterial();
-
- QColor ambient() const;
- QColor specular() const;
- float shininess() const;
- QAbstractTextureProvider *diffuse() const;
- float textureScale() const;
-
-public Q_SLOTS:
- void setAmbient(const QColor &color);
- void setSpecular(const QColor &specular);
- void setShininess(float shininess);
- void setDiffuse(QAbstractTextureProvider *diffuse);
- void setTextureScale(float textureScale);
-
-Q_SIGNALS:
- void ambientChanged(const QColor &ambient);
- void diffuseChanged(QAbstractTextureProvider *diffuse);
- void specularChanged(const QColor &specular);
- void shininessChanged(float shininess);
- void textureScaleChanged(float textureScale);
-
-private:
- Q_DECLARE_PRIVATE(QDiffuseMapMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QDIFFUSEMAPMATERIAL_H
diff --git a/src/render/defaults/qdiffusemapmaterial_p.h b/src/render/defaults/qdiffusemapmaterial_p.h
deleted file mode 100644
index cd3473fac..000000000
--- a/src/render/defaults/qdiffusemapmaterial_p.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QDIFFUSEMAPMATERIAL_P_H
-#define QT3DRENDER_RENDER_QDIFFUSEMAPMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QEffect;
-class QAbstractTextureProvider;
-class QTechnique;
-class QParameter;
-class QShaderProgram;
-class QRenderPass;
-class QParameterMapping;
-
-class QDiffuseMapMaterial;
-
-class QDiffuseMapMaterialPrivate : public QMaterialPrivate
-{
- QDiffuseMapMaterialPrivate();
-
- void init();
-
- void handleAmbientChanged(const QVariant &var);
- void handleDiffuseChanged(const QVariant &var);
- void handleSpecularChanged(const QVariant &var);
- void handleShininessChanged(const QVariant &var);
- void handleTextureScaleChanged(const QVariant &var);
-
- QEffect *m_diffuseMapEffect;
- QAbstractTextureProvider *m_diffuseTexture;
- QParameter *m_ambientParameter;
- QParameter *m_diffuseParameter;
- QParameter *m_specularParameter;
- QParameter *m_shininessParameter;
- QParameter *m_textureScaleParameter;
- QTechnique *m_diffuseMapGL3Technique;
- QTechnique *m_diffuseMapGL2Technique;
- QTechnique *m_diffuseMapES2Technique;
- QRenderPass *m_diffuseMapGL3RenderPass;
- QRenderPass *m_diffuseMapGL2RenderPass;
- QRenderPass *m_diffuseMapES2RenderPass;
- QShaderProgram *m_diffuseMapGL3Shader;
- QShaderProgram *m_diffuseMapGL2ES2Shader;
-
- Q_DECLARE_PUBLIC(QDiffuseMapMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QDIFFUSEAPMATERIAL_P_H
-
diff --git a/src/render/defaults/qdiffusespecularmapmaterial.cpp b/src/render/defaults/qdiffusespecularmapmaterial.cpp
deleted file mode 100644
index c3dec408b..000000000
--- a/src/render/defaults/qdiffusespecularmapmaterial.cpp
+++ /dev/null
@@ -1,315 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdiffusespecularmapmaterial.h"
-#include "qdiffusespecularmapmaterial_p.h"
-
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qshaderprogram.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <QUrl>
-#include <QVector3D>
-#include <QVector4D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QDiffuseSpecularMapMaterialPrivate::QDiffuseSpecularMapMaterialPrivate()
- : QMaterialPrivate()
- , m_diffuseSpecularMapEffect(new QEffect())
- , m_diffuseTexture(new QTexture2D())
- , m_specularTexture(new QTexture2D())
- , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
- , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture))
- , m_specularParameter(new QParameter(QStringLiteral("specularTexture"), m_specularTexture))
- , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
- , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
- , m_diffuseSpecularMapGL3Technique(new QTechnique())
- , m_diffuseSpecularMapGL2Technique(new QTechnique())
- , m_diffuseSpecularMapES2Technique(new QTechnique())
- , m_diffuseSpecularMapGL3RenderPass(new QRenderPass())
- , m_diffuseSpecularMapGL2RenderPass(new QRenderPass())
- , m_diffuseSpecularMapES2RenderPass(new QRenderPass())
- , m_diffuseSpecularMapGL3Shader(new QShaderProgram())
- , m_diffuseSpecularMapGL2ES2Shader(new QShaderProgram())
-{
- m_diffuseTexture->setMagnificationFilter(QAbstractTextureProvider::Linear);
- m_diffuseTexture->setMinificationFilter(QAbstractTextureProvider::LinearMipMapLinear);
- m_diffuseTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
- m_diffuseTexture->setGenerateMipMaps(true);
- m_diffuseTexture->setMaximumAnisotropy(16.0f);
-
- m_specularTexture->setMagnificationFilter(QAbstractTextureProvider::Linear);
- m_specularTexture->setMinificationFilter(QAbstractTextureProvider::LinearMipMapLinear);
- m_specularTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
- m_specularTexture->setGenerateMipMaps(true);
- m_specularTexture->setMaximumAnisotropy(16.0f);
-}
-
-void QDiffuseSpecularMapMaterialPrivate::init()
-{
- connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseSpecularMapMaterialPrivate::handleAmbientChanged);
- connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseSpecularMapMaterialPrivate::handleDiffuseChanged);
- connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseSpecularMapMaterialPrivate::handleSpecularChanged);
- connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseSpecularMapMaterialPrivate::handleShininessChanged);
- connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged);
-
- m_diffuseSpecularMapGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/diffusemap.vert"))));
- m_diffuseSpecularMapGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/diffusespecularmap.frag"))));
- m_diffuseSpecularMapGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/diffusemap.vert"))));
- m_diffuseSpecularMapGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/diffusespecularmap.frag"))));
-
- m_diffuseSpecularMapGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_diffuseSpecularMapGL3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_diffuseSpecularMapGL3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_diffuseSpecularMapGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_diffuseSpecularMapGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_diffuseSpecularMapGL2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_diffuseSpecularMapGL2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_diffuseSpecularMapGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_diffuseSpecularMapES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_diffuseSpecularMapES2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_diffuseSpecularMapES2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_diffuseSpecularMapES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_diffuseSpecularMapGL3RenderPass->setShaderProgram(m_diffuseSpecularMapGL3Shader);
- m_diffuseSpecularMapGL2RenderPass->setShaderProgram(m_diffuseSpecularMapGL2ES2Shader);
- m_diffuseSpecularMapES2RenderPass->setShaderProgram(m_diffuseSpecularMapGL2ES2Shader);
-
- m_diffuseSpecularMapGL3Technique->addPass(m_diffuseSpecularMapGL3RenderPass);
- m_diffuseSpecularMapGL2Technique->addPass(m_diffuseSpecularMapGL2RenderPass);
- m_diffuseSpecularMapES2Technique->addPass(m_diffuseSpecularMapES2RenderPass);
-
- m_diffuseSpecularMapEffect->addTechnique(m_diffuseSpecularMapGL3Technique);
- m_diffuseSpecularMapEffect->addTechnique(m_diffuseSpecularMapGL2Technique);
- m_diffuseSpecularMapEffect->addTechnique(m_diffuseSpecularMapES2Technique);
-
- m_diffuseSpecularMapEffect->addParameter(m_ambientParameter);
- m_diffuseSpecularMapEffect->addParameter(m_diffuseParameter);
- m_diffuseSpecularMapEffect->addParameter(m_specularParameter);
- m_diffuseSpecularMapEffect->addParameter(m_shininessParameter);
- m_diffuseSpecularMapEffect->addParameter(m_textureScaleParameter);
-
- q_func()->setEffect(m_diffuseSpecularMapEffect);
-}
-
-void QDiffuseSpecularMapMaterialPrivate::handleAmbientChanged(const QVariant &var)
-{
- Q_Q(QDiffuseSpecularMapMaterial);
- emit q->ambientChanged(var.value<QColor>());
-}
-
-void QDiffuseSpecularMapMaterialPrivate::handleDiffuseChanged(const QVariant &var)
-{
- Q_Q(QDiffuseSpecularMapMaterial);
- emit q->diffuseChanged(var.value<QAbstractTextureProvider *>());
-}
-
-void QDiffuseSpecularMapMaterialPrivate::handleSpecularChanged(const QVariant &var)
-{
- Q_Q(QDiffuseSpecularMapMaterial);
- emit q->specularChanged(var.value<QAbstractTextureProvider *>());
-}
-
-void QDiffuseSpecularMapMaterialPrivate::handleShininessChanged(const QVariant &var)
-{
- Q_Q(QDiffuseSpecularMapMaterial);
- emit q->shininessChanged(var.toFloat());
-}
-
-void QDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
-{
- Q_Q(QDiffuseSpecularMapMaterial);
- emit q->textureScaleChanged(var.toFloat());
-}
-
-/*!
- \class Qt3DRender::QDiffuseSpecularMapMaterial
- \brief The QDiffuseSpecularMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse and specular light components
- are read from texture maps.
- \inmodule Qt3DRender
- \since 5.5
-
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
-
- \list
- \li Ambient is the color that is emitted by an object without any other light source.
- \li Diffuse is the color that is emitted for rought surface reflections with the lights.
- \li Specular is the color emitted for shiny surface reflections with the lights.
- \li The shininess of a surface is controlled by a float property.
- \endlist
-
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
-*/
-
-/*!
- Constructs a new Qt3DRender::QDiffuseSpecularMapMaterial instance with parent object \a parent.
-*/
-QDiffuseSpecularMapMaterial::QDiffuseSpecularMapMaterial(QNode *parent)
- : QMaterial(*new QDiffuseSpecularMapMaterialPrivate, parent)
-{
- Q_D(QDiffuseSpecularMapMaterial);
- d->init();
-}
-
-/*!
- Destroys the QDiffuseSpecularMapMaterial instance.
-*/
-QDiffuseSpecularMapMaterial::~QDiffuseSpecularMapMaterial()
-{
-}
-
-/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::ambient
-
- Holds the current ambient color.
-*/
-QColor QDiffuseSpecularMapMaterial::ambient() const
-{
- Q_D(const QDiffuseSpecularMapMaterial);
- return d->m_ambientParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::diffuse
-
- Holds the current diffuse map texture.
-
- By default, the diffuse texture has the following properties:
-
- \list
- \li Linear minification and magnification filters
- \li Linear mipmap with mipmapping enabled
- \li Repeat wrap mode
- \li Maximum anisotropy of 16.0
- \endlist
-*/
-QAbstractTextureProvider *QDiffuseSpecularMapMaterial::diffuse() const
-{
- Q_D(const QDiffuseSpecularMapMaterial);
- return d->m_diffuseParameter->value().value<QAbstractTextureProvider *>();
-}
-
-/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::specular
-
- Holds the current specular map texture.
-
- By default, the specular texture has the following properties:
-
- \list
- \li Linear minification and magnification filters
- \li Linear mipmap with mipmapping enabled
- \li Repeat wrap mode
- \li Maximum anisotropy of 16.0
- \endlist
-*/
-QAbstractTextureProvider *QDiffuseSpecularMapMaterial::specular() const
-{
- Q_D(const QDiffuseSpecularMapMaterial);
- return d->m_specularParameter->value().value<QAbstractTextureProvider *>();
-}
-
-/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::shininess
-
- Holds the current shininess as a float value.
-*/
-float QDiffuseSpecularMapMaterial::shininess() const
-{
- Q_D(const QDiffuseSpecularMapMaterial);
- return d->m_shininessParameter->value().toFloat();
-}
-
-/*!
- \property Qt3DRender::QDiffuseSpecularMapMaterial::textureScale
-
- Holds the current texture scale as a float value.
-*/
-float QDiffuseSpecularMapMaterial::textureScale() const
-{
- Q_D(const QDiffuseSpecularMapMaterial);
- return d->m_textureScaleParameter->value().toFloat();
-}
-
-void QDiffuseSpecularMapMaterial::setAmbient(const QColor &ambient)
-{
- Q_D(QDiffuseSpecularMapMaterial);
- d->m_ambientParameter->setValue(ambient);
-}
-
-void QDiffuseSpecularMapMaterial::setDiffuse(QAbstractTextureProvider *diffuse)
-{
- Q_D(QDiffuseSpecularMapMaterial);
- d->m_diffuseParameter->setValue(QVariant::fromValue(diffuse));
-}
-
-void QDiffuseSpecularMapMaterial::setSpecular(QAbstractTextureProvider *specular)
-{
- Q_D(QDiffuseSpecularMapMaterial);
- d->m_specularParameter->setValue(QVariant::fromValue(specular));
-}
-
-void QDiffuseSpecularMapMaterial::setShininess(float shininess)
-{
- Q_D(QDiffuseSpecularMapMaterial);
- d->m_shininessParameter->setValue(shininess);
-}
-
-void QDiffuseSpecularMapMaterial::setTextureScale(float textureScale)
-{
- Q_D(QDiffuseSpecularMapMaterial);
- d->m_textureScaleParameter->setValue(textureScale);
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qdiffusespecularmapmaterial.h b/src/render/defaults/qdiffusespecularmapmaterial.h
deleted file mode 100644
index 4a0318cd9..000000000
--- a/src/render/defaults/qdiffusespecularmapmaterial.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QDIFFUSESPECULARMAPMATERIAL_H
-#define QT3DRENDER_RENDER_QDIFFUSESPECULARMAPMATERIAL_H
-
-#include <Qt3DRender/qmaterial.h>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractTextureProvider;
-class QDiffuseSpecularMapMaterialPrivate;
-
-class QT3DRENDERSHARED_EXPORT QDiffuseSpecularMapMaterial : public QMaterial
-{
- Q_OBJECT
- Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
- Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *specular READ specular WRITE setSpecular NOTIFY specularChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
- Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
-
-public:
- explicit QDiffuseSpecularMapMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QDiffuseSpecularMapMaterial();
-
- QColor ambient() const;
- QAbstractTextureProvider *diffuse() const;
- QAbstractTextureProvider *specular() const;
- float shininess() const;
- float textureScale() const;
-
-public Q_SLOTS:
- void setAmbient(const QColor &ambient);
- void setDiffuse(QAbstractTextureProvider *diffuse);
- void setSpecular(QAbstractTextureProvider *specular);
- void setShininess(float shininess);
- void setTextureScale(float textureScale);
-
-Q_SIGNALS:
- void ambientChanged(const QColor &ambient);
- void diffuseChanged(QAbstractTextureProvider *diffuse);
- void specularChanged(QAbstractTextureProvider *specular);
- void shininessChanged(float shininess);
- void textureScaleChanged(float textureScale);
-
-private:
- Q_DECLARE_PRIVATE(QDiffuseSpecularMapMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QDIFFUSESPECULARMAPMATERIAL_H
diff --git a/src/render/defaults/qdiffusespecularmapmaterial_p.h b/src/render/defaults/qdiffusespecularmapmaterial_p.h
deleted file mode 100644
index b6fb01a91..000000000
--- a/src/render/defaults/qdiffusespecularmapmaterial_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QDIFFUSESPECULARMAPMATERIAL_P_H
-#define QT3DRENDER_RENDER_QDIFFUSESPECULARMAPMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QEffect;
-class QAbstractTextureProvider;
-class QTechnique;
-class QParameter;
-class QShaderProgram;
-class QRenderPass;
-class QParameterMapping;
-
-class QDiffuseSpecularMapMaterial;
-
-class QDiffuseSpecularMapMaterialPrivate : public QMaterialPrivate
-{
-public:
- QDiffuseSpecularMapMaterialPrivate();
-
- void init();
-
- void handleAmbientChanged(const QVariant &var);
- void handleDiffuseChanged(const QVariant &var);
- void handleSpecularChanged(const QVariant &var);
- void handleShininessChanged(const QVariant &var);
- void handleTextureScaleChanged(const QVariant &var);
-
- QEffect *m_diffuseSpecularMapEffect;
- QAbstractTextureProvider *m_diffuseTexture;
- QAbstractTextureProvider *m_specularTexture;
- QParameter *m_ambientParameter;
- QParameter *m_diffuseParameter;
- QParameter *m_specularParameter;
- QParameter *m_shininessParameter;
- QParameter *m_textureScaleParameter;
- QTechnique *m_diffuseSpecularMapGL3Technique;
- QTechnique *m_diffuseSpecularMapGL2Technique;
- QTechnique *m_diffuseSpecularMapES2Technique;
- QRenderPass *m_diffuseSpecularMapGL3RenderPass;
- QRenderPass *m_diffuseSpecularMapGL2RenderPass;
- QRenderPass *m_diffuseSpecularMapES2RenderPass;
- QShaderProgram *m_diffuseSpecularMapGL3Shader;
- QShaderProgram *m_diffuseSpecularMapGL2ES2Shader;
-
- Q_DECLARE_PUBLIC(QDiffuseSpecularMapMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QDIFFUSESPECULARMAPMATERIAL_P_H
-
diff --git a/src/render/defaults/qforwardrenderer.cpp b/src/render/defaults/qforwardrenderer.cpp
deleted file mode 100644
index 56eef3514..000000000
--- a/src/render/defaults/qforwardrenderer.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qforwardrenderer.h"
-#include "qforwardrenderer_p.h"
-
-#include <Qt3DRender/qviewport.h>
-#include <Qt3DRender/qcameraselector.h>
-#include <Qt3DRender/qclearbuffer.h>
-#include <Qt3DRender/qannotation.h>
-#include <Qt3DRender/qfrustumculling.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QForwardRendererPrivate::QForwardRendererPrivate()
- : QTechniqueFilterPrivate()
- , m_viewport(new QViewport())
- , m_cameraSelector(new QCameraSelector())
- , m_clearBuffer(new QClearBuffer())
- , m_frustumCulling(new QFrustumCulling())
-{
-}
-
-void QForwardRendererPrivate::init()
-{
- Q_Q(QForwardRenderer);
-
- m_frustumCulling->setParent(m_clearBuffer);
- m_clearBuffer->setParent(m_cameraSelector);
- m_cameraSelector->setParent(m_viewport);
- m_viewport->setParent(q);
-
- m_viewport->setRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f));
- m_viewport->setClearColor(Qt::white);
- m_clearBuffer->setBuffers(QClearBuffer::ColorDepthBuffer);
-
- QAnnotation *forwardRenderingStyle = new QAnnotation(q);
- forwardRenderingStyle->setName(QStringLiteral("renderingStyle"));
- forwardRenderingStyle->setValue(QStringLiteral("forward"));
- q->addRequirement(forwardRenderingStyle);
-}
-
-/*!
- \class Qt3DRender::QForwardRenderer
- \brief The Qt3DRender::QForwardRenderer provides a default \l {QFrameGraph}{FrameGraph} implementation of a forward renderer.
- \inmodule Qt3DRender
- \since 5.5
-
- Forward rendering is how OpenGL is traditionally. It renders directly to the backbuffer
- one object at a time shading each one as it goes.
-
- Internally the Qt3DRender::QForwardRenderer is a subclass of Qt3DRender::QTechniqueFilter.
- This a is a single leaf Framegraph tree which contains a Qt3DRender::QViewport, a Qt3DRender::QCameraSelector
- and a Qt3DRender::QClearBuffer.
- The Qt3DRender::QForwardRenderer has a default requirement annotation whose name is "renderingStyle" and value "forward".
- If you need to filter out your techniques, you should do so based on that annotation.
-
- By default the viewport occupies the whole screen and the clear color is white. Frustum culling is also enabled.
-*/
-
-/*!
- Constructs a new Qt3DRender::QForwardRenderer instance with parent object \a parent.
- */
-QForwardRenderer::QForwardRenderer(QNode *parent)
- : QTechniqueFilter(*new QForwardRendererPrivate, parent)
-{
- Q_D(QForwardRenderer);
- QObject::connect(d->m_viewport, SIGNAL(clearColorChanged(const QColor &)), this, SIGNAL(clearColorChanged(const QColor &)));
- QObject::connect(d->m_viewport, SIGNAL(rectChanged(const QRectF &)), this, SIGNAL(viewportRectChanged(const QRectF &)));
- QObject::connect(d->m_cameraSelector, SIGNAL(cameraChanged(Qt3DCore::QEntity *)), this, SIGNAL(cameraChanged(Qt3DCore::QEntity *)));
- d->init();
-}
-
-/*!
- Destroys the QForwardRenderer instance.
-*/
-QForwardRenderer::~QForwardRenderer()
-{
-}
-
-void QForwardRenderer::setViewportRect(const QRectF &viewportRect)
-{
- Q_D(QForwardRenderer);
- d->m_viewport->setRect(viewportRect);
-}
-
-void QForwardRenderer::setClearColor(const QColor &clearColor)
-{
- Q_D(QForwardRenderer);
- d->m_viewport->setClearColor(clearColor);
-}
-
-/*!
- Sets the camera which should be used to render the scene to \a camera.
-
- \note A camera is a QEntity having a QCameraLens as one of its components.
-*/
-void QForwardRenderer::setCamera(Qt3DCore::QEntity *camera)
-{
- Q_D(QForwardRenderer);
- d->m_cameraSelector->setCamera(camera);
-}
-
-/*!
- \property Qt3DRender::QForwardRenderer::viewportRect
-
- Holds the current viewport rect.
- */
-QRectF QForwardRenderer::viewportRect() const
-{
- Q_D(const QForwardRenderer);
- return d->m_viewport->rect();
-}
-
-/*!
- \property Qt3DRender::QForwardRenderer::clearColor
-
- Holds the current clearColor.
-*/
-QColor QForwardRenderer::clearColor() const
-{
- Q_D(const QForwardRenderer);
- return d->m_viewport->clearColor();
-}
-
-/*!
- \property Qt3DRender::QForwardRenderer::camera
-
- Holds the current QEntity camera used to render the scene.
-
- \note A camera is a QEntity that has a QCameraLens as one of its components.
-*/
-Qt3DCore::QEntity *QForwardRenderer::camera() const
-{
- Q_D(const QForwardRenderer);
- return d->m_cameraSelector->camera();
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qforwardrenderer.h b/src/render/defaults/qforwardrenderer.h
deleted file mode 100644
index bbddbebfe..000000000
--- a/src/render/defaults/qforwardrenderer.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QFORWARDRENDERER_H
-#define QT3DRENDER_RENDER_QFORWARDRENDERER_H
-
-#include <Qt3DRender/qtechniquefilter.h>
-#include <QRectF>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QForwardRendererPrivate;
-
-class QT3DRENDERSHARED_EXPORT QForwardRenderer : public QTechniqueFilter
-{
- Q_OBJECT
- Q_PROPERTY(QRectF viewportRect READ viewportRect WRITE setViewportRect NOTIFY viewportRectChanged)
- Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
- Q_PROPERTY(Qt3DCore::QEntity *camera READ camera WRITE setCamera NOTIFY cameraChanged)
-public:
- explicit QForwardRenderer(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QForwardRenderer();
-
- QRectF viewportRect() const;
- QColor clearColor() const;
- Qt3DCore::QEntity *camera() const;
-
-public Q_SLOTS:
- void setViewportRect(const QRectF &viewportRect);
- void setClearColor(const QColor &clearColor);
- void setCamera(Qt3DCore::QEntity *camera);
-
-Q_SIGNALS:
- void viewportRectChanged(const QRectF &viewportRect);
- void clearColorChanged(const QColor &clearColor);
- void cameraChanged(Qt3DCore::QEntity *camera);
-
-private:
- Q_DECLARE_PRIVATE(QForwardRenderer)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDERER_QFORWARDRENDERER_H
diff --git a/src/render/defaults/qforwardrenderer_p.h b/src/render/defaults/qforwardrenderer_p.h
deleted file mode 100644
index cf352de09..000000000
--- a/src/render/defaults/qforwardrenderer_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QFORWARDRENDERER_P_H
-#define QT3DRENDER_RENDER_QFORWARDRENDERER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qtechniquefilter_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QForwardRenderer;
-class QViewport;
-class QClearBuffer;
-class QCameraSelector;
-class QFrustumCulling;
-
-class QForwardRendererPrivate: public QTechniqueFilterPrivate
-{
-public:
- QForwardRendererPrivate();
-
- QViewport *m_viewport;
- QCameraSelector *m_cameraSelector;
- QClearBuffer *m_clearBuffer;
- QFrustumCulling *m_frustumCulling;
-
- void init();
-
- Q_DECLARE_PUBLIC(QForwardRenderer)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QFORWARDRENDERER_P_H
-
diff --git a/src/render/defaults/qgoochmaterial.cpp b/src/render/defaults/qgoochmaterial.cpp
deleted file mode 100644
index 11cf38c76..000000000
--- a/src/render/defaults/qgoochmaterial.cpp
+++ /dev/null
@@ -1,346 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgoochmaterial.h"
-#include "qgoochmaterial_p.h"
-
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qtechnique.h>
-
-#include <QtCore/qurl.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QGoochMaterialPrivate::QGoochMaterialPrivate()
- : QMaterialPrivate()
- , m_effect(new QEffect)
- , m_diffuseParameter(new QParameter(QStringLiteral("kd"), QColor::fromRgbF(0.0f, 0.0f, 0.0f)))
- , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.0f, 0.0f, 0.0f)))
- , m_coolParameter(new QParameter(QStringLiteral("kblue"), QColor::fromRgbF(0.0f, 0.0f, 0.4f)))
- , m_warmParameter(new QParameter(QStringLiteral("kyellow"), QColor::fromRgbF(0.4f, 0.4f, 0.0f)))
- , m_alphaParameter(new QParameter(QStringLiteral("alpha"), 0.25f))
- , m_betaParameter(new QParameter(QStringLiteral("beta"), 0.5f))
- , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 100.0f))
- , m_gl3Technique(new QTechnique)
- , m_gl2Technique(new QTechnique)
- , m_es2Technique(new QTechnique)
- , m_gl3RenderPass(new QRenderPass)
- , m_gl2RenderPass(new QRenderPass)
- , m_es2RenderPass(new QRenderPass)
- , m_gl3Shader(new QShaderProgram)
- , m_gl2ES2Shader(new QShaderProgram)
-{
-}
-
-void QGoochMaterialPrivate::init()
-{
- Q_Q(QGoochMaterial);
-
- connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QGoochMaterialPrivate::handleDiffuseChanged);
- connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QGoochMaterialPrivate::handleSpecularChanged);
- connect(m_coolParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QGoochMaterialPrivate::handleCoolChanged);
- connect(m_warmParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QGoochMaterialPrivate::handleWarmChanged);
- connect(m_alphaParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QGoochMaterialPrivate::handleAlphaChanged);
- connect(m_betaParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QGoochMaterialPrivate::handleBetaChanged);
- connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QGoochMaterialPrivate::handleShininessChanged);
-
- m_gl3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/gooch.vert"))));
- m_gl3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/gooch.frag"))));
- m_gl2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/gooch.vert"))));
- m_gl2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/gooch.frag"))));
-
- m_gl3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_gl3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_gl3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_gl3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_gl2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_gl2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_gl2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_gl2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_es2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_es2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_es2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_es2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_gl3RenderPass->setShaderProgram(m_gl3Shader);
- m_gl2RenderPass->setShaderProgram(m_gl2ES2Shader);
- m_es2RenderPass->setShaderProgram(m_gl2ES2Shader);
-
- m_gl3Technique->addPass(m_gl3RenderPass);
- m_gl2Technique->addPass(m_gl2RenderPass);
- m_es2Technique->addPass(m_es2RenderPass);
-
- m_effect->addTechnique(m_gl3Technique);
- m_effect->addTechnique(m_gl2Technique);
- m_effect->addTechnique(m_es2Technique);
-
- m_effect->addParameter(m_diffuseParameter);
- m_effect->addParameter(m_specularParameter);
- m_effect->addParameter(m_coolParameter);
- m_effect->addParameter(m_warmParameter);
- m_effect->addParameter(m_alphaParameter);
- m_effect->addParameter(m_betaParameter);
- m_effect->addParameter(m_shininessParameter);
-
- q->setEffect(m_effect);
-}
-
-void QGoochMaterialPrivate::handleDiffuseChanged(const QVariant &var)
-{
- Q_Q(QGoochMaterial);
- emit q->diffuseChanged(var.value<QColor>());
-}
-
-void QGoochMaterialPrivate::handleSpecularChanged(const QVariant &var)
-{
- Q_Q(QGoochMaterial);
- emit q->specularChanged(var.value<QColor>());
-}
-
-void QGoochMaterialPrivate::handleCoolChanged(const QVariant &var)
-{
- Q_Q(QGoochMaterial);
- emit q->coolChanged(var.value<QColor>());
-}
-
-void QGoochMaterialPrivate::handleWarmChanged(const QVariant &var)
-{
- Q_Q(QGoochMaterial);
- emit q->warmChanged(var.value<QColor>());
-}
-
-void QGoochMaterialPrivate::handleAlphaChanged(const QVariant &var)
-{
- Q_Q(QGoochMaterial);
- emit q->alphaChanged(var.toFloat());
-}
-
-void QGoochMaterialPrivate::handleBetaChanged(const QVariant &var)
-{
- Q_Q(QGoochMaterial);
- emit q->betaChanged(var.toFloat());
-}
-
-void QGoochMaterialPrivate::handleShininessChanged(const QVariant &var)
-{
- Q_Q(QGoochMaterial);
- emit q->shininessChanged(var.toFloat());
-}
-
-/*!
- \class Qt3DRender::QGoochMaterial
- \brief The QGoochMaterial provides a material that implements the Gooch
- shading model, popular in CAD and CAM applications.
- \inmodule Qt3DRender
- \since 5.5
-
- The Gooch lighting model uses both color and brightness to help show the
- curvature of 3D surfaces. This is often better than models such as Phong
- that rely purely upon changes in brightness. In situations such as in CAD
- and CAM applications where photorealism is not a goal, the Gooch shading
- model in conjunction with some kind of silhouette edge inking is a popular
- solution.
-
- The Gooch lighting model is explained fully in the \l{original Gooch
- paper}. The Gooch model mixes a diffuse objetc color with a user-provided
- cool color and warm color to produce the end points of a color ramp that is
- used to shade the object based upon the cosine of the angle between the
- vector from the fragment to the light source and the fragment's normal
- vector. Optionally, a specular highlight can be added on top. The relative
- contributions to the cool and warm colors by the diffuse color are
- controlled by the alpha and beta properties respecitvely.
-
- This material uses an effect with a single render pass approach and
- performs per fragment lighting. Techniques are provided for OpenGL 2,
- OpenGL 3 or above as well as OpenGL ES 2.
-*/
-
-/*!
- Constructs a new Qt3DCore::QGoochMaterial instance with parent object \a parent.
-*/
-QGoochMaterial::QGoochMaterial(QNode *parent)
- : QMaterial(*new QGoochMaterialPrivate, parent)
-{
- Q_D(QGoochMaterial);
- d->init();
-}
-
-QGoochMaterial::QGoochMaterial(QGoochMaterialPrivate &dd, QNode *parent)
- : QMaterial(dd, parent)
-{
- Q_D(QGoochMaterial);
- d->init();
-}
-
-/*!
- \property Qt3DRender::QGoochMaterial::diffuse
-
- Holds the current diffuse color.
-*/
-QColor QGoochMaterial::diffuse() const
-{
- Q_D(const QGoochMaterial);
- return d->m_diffuseParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QGoochMaterial::specular
-
- Holds the current specular color.
-*/
-QColor QGoochMaterial::specular() const
-{
- Q_D(const QGoochMaterial);
- return d->m_specularParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QGoochMaterial::cool
-
- Holds the current cool color.
-*/
-QColor QGoochMaterial::cool() const
-{
- Q_D(const QGoochMaterial);
- return d->m_coolParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QGoochMaterial::warm
-
- Holds the current warm color.
-*/
-QColor QGoochMaterial::warm() const
-{
- Q_D(const QGoochMaterial);
- return d->m_warmParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QGoochMaterial::alpha
-
- Holds the current alpha value. The start point of the color ramp
- used by the Gooch shader is calculated as {c = cool + alpha * diffuse}.
-*/
-float QGoochMaterial::alpha() const
-{
- Q_D(const QGoochMaterial);
- return d->m_alphaParameter->value().toFloat();
-}
-
-/*!
- \property Qt3DRender::QGoochMaterial::beta
-
- Holds the current beta value. The start point of the color ramp
- used by the Gooch shader is calculated as {c = warm + beta * diffuse}.
-*/
-float QGoochMaterial::beta() const
-{
- Q_D(const QGoochMaterial);
- return d->m_betaParameter->value().toFloat();
-}
-
-/*!
- \property Qt3DRender::QGoochMaterial::shininess
-
- Holds the current shininess value. Higher values of shininess result in
- a smaller and brighter highlight.
-*/
-float QGoochMaterial::shininess() const
-{
- Q_D(const QGoochMaterial);
- return d->m_shininessParameter->value().toFloat();
-}
-
-void QGoochMaterial::setDiffuse(const QColor &diffuse)
-{
- Q_D(QGoochMaterial);
- return d->m_diffuseParameter->setValue(diffuse);
-}
-
-void QGoochMaterial::setSpecular(const QColor &specular)
-{
- Q_D(QGoochMaterial);
- return d->m_specularParameter->setValue(specular);
-}
-
-void QGoochMaterial::setCool(const QColor &cool)
-{
- Q_D(QGoochMaterial);
- return d->m_coolParameter->setValue(cool);
-}
-
-void QGoochMaterial::setWarm(const QColor &warm)
-{
- Q_D(QGoochMaterial);
- return d->m_warmParameter->setValue(warm);
-}
-
-void QGoochMaterial::setAlpha(float alpha)
-{
- Q_D(QGoochMaterial);
- return d->m_alphaParameter->setValue(alpha);
-}
-
-void QGoochMaterial::setBeta(float beta)
-{
- Q_D(QGoochMaterial);
- return d->m_betaParameter->setValue(beta);
-}
-
-void QGoochMaterial::setShininess(float shininess)
-{
- Q_D(QGoochMaterial);
- return d->m_shininessParameter->setValue(shininess);
-}
-
-}
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qgoochmaterial.h b/src/render/defaults/qgoochmaterial.h
deleted file mode 100644
index b90233abc..000000000
--- a/src/render/defaults/qgoochmaterial.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QGOOCHMATERIAL_H
-#define QT3DRENDER_RENDER_QGOOCHMATERIAL_H
-
-#include <Qt3DRender/qmaterial.h>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QGoochMaterialPrivate;
-
-class QT3DRENDERSHARED_EXPORT QGoochMaterial : public QMaterial
-{
- Q_OBJECT
- Q_PROPERTY(QColor diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
- Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
- Q_PROPERTY(QColor cool READ cool WRITE setCool NOTIFY coolChanged)
- Q_PROPERTY(QColor warm READ warm WRITE setWarm NOTIFY warmChanged)
- Q_PROPERTY(float alpha READ alpha WRITE setAlpha NOTIFY alphaChanged)
- Q_PROPERTY(float beta READ beta WRITE setBeta NOTIFY betaChanged)
- Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
-
-public:
- explicit QGoochMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- QColor diffuse() const;
- QColor specular() const;
- QColor cool() const;
- QColor warm() const;
- float alpha() const;
- float beta() const;
- float shininess() const;
-
-public Q_SLOTS:
- void setDiffuse(const QColor &diffuse);
- void setSpecular(const QColor &specular);
- void setCool(const QColor &cool);
- void setWarm(const QColor &warm);
- void setAlpha(float alpha);
- void setBeta(float beta);
- void setShininess(float shininess);
-
-Q_SIGNALS:
- void diffuseChanged(const QColor &diffuse);
- void specularChanged(const QColor &specular);
- void coolChanged(const QColor &cool);
- void warmChanged(const QColor &warm);
- void alphaChanged(float alpha);
- void betaChanged(float beta);
- void shininessChanged(float shininess);
-
-protected:
- QGoochMaterial(QGoochMaterialPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QGoochMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QGOOCHMATERIAL_H
diff --git a/src/render/defaults/qgoochmaterial_p.h b/src/render/defaults/qgoochmaterial_p.h
deleted file mode 100644
index 5d1c56280..000000000
--- a/src/render/defaults/qgoochmaterial_p.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QGOOCHMATERIAL_P_H
-#define QT3DRENDER_RENDER_QGOOCHMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QEffect;
-class QRenderPass;
-class QShaderProgram;
-class QTechnique;
-
-class QGoochMaterialPrivate : public QMaterialPrivate
-{
-public:
- QGoochMaterialPrivate();
-
- void init();
-
- void handleDiffuseChanged(const QVariant &var);
- void handleSpecularChanged(const QVariant &var);
- void handleCoolChanged(const QVariant &var);
- void handleWarmChanged(const QVariant &var);
- void handleAlphaChanged(const QVariant &var);
- void handleBetaChanged(const QVariant &var);
- void handleShininessChanged(const QVariant &var);
-
- QEffect *m_effect;
- QParameter *m_diffuseParameter;
- QParameter *m_specularParameter;
- QParameter *m_coolParameter;
- QParameter *m_warmParameter;
- QParameter *m_alphaParameter;
- QParameter *m_betaParameter;
- QParameter *m_shininessParameter;
- QTechnique *m_gl3Technique;
- QTechnique *m_gl2Technique;
- QTechnique *m_es2Technique;
- QRenderPass *m_gl3RenderPass;
- QRenderPass *m_gl2RenderPass;
- QRenderPass *m_es2RenderPass;
- QShaderProgram *m_gl3Shader;
- QShaderProgram *m_gl2ES2Shader;
-
- Q_DECLARE_PUBLIC(QGoochMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QGOOCHMATERIAL_P_H
-
diff --git a/src/render/defaults/qnormaldiffusemapalphamaterial.cpp b/src/render/defaults/qnormaldiffusemapalphamaterial.cpp
deleted file mode 100644
index 4e065baa6..000000000
--- a/src/render/defaults/qnormaldiffusemapalphamaterial.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnormaldiffusemapalphamaterial.h"
-#include "qnormaldiffusemapalphamaterial_p.h"
-
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qshaderprogram.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <Qt3DRender/qalphacoverage.h>
-#include <Qt3DRender/qdepthtest.h>
-
-#include <QUrl>
-#include <QVector3D>
-#include <QVector4D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-
-QNormalDiffuseMapAlphaMaterialPrivate::QNormalDiffuseMapAlphaMaterialPrivate()
- : QNormalDiffuseMapMaterialPrivate()
- , m_alphaCoverage(new QAlphaCoverage())
- , m_depthTest(new QDepthTest())
-{
-}
-
-void QNormalDiffuseMapAlphaMaterialPrivate::init()
-{
- m_normalDiffuseGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemap.vert"))));
- m_normalDiffuseGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemapalpha.frag"))));
- m_normalDiffuseGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemap.vert"))));
- m_normalDiffuseGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemapalpha.frag"))));
-
- m_normalDiffuseGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_normalDiffuseGL3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_normalDiffuseGL3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_normalDiffuseGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_normalDiffuseGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_normalDiffuseGL2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_normalDiffuseGL2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_normalDiffuseGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_normalDiffuseES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_normalDiffuseES2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_normalDiffuseES2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_normalDiffuseES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_depthTest->setFunc(QDepthTest::Less);
-
- m_normalDiffuseGL3RenderPass->setShaderProgram(m_normalDiffuseGL3Shader);
- m_normalDiffuseGL3RenderPass->addRenderState(m_alphaCoverage);
- m_normalDiffuseGL3RenderPass->addRenderState(m_depthTest);
-
- m_normalDiffuseGL2RenderPass->setShaderProgram(m_normalDiffuseGL2ES2Shader);
- m_normalDiffuseGL2RenderPass->addRenderState(m_alphaCoverage);
- m_normalDiffuseGL2RenderPass->addRenderState(m_depthTest);
-
- m_normalDiffuseES2RenderPass->setShaderProgram(m_normalDiffuseGL2ES2Shader);
- m_normalDiffuseES2RenderPass->addRenderState(m_alphaCoverage);
- m_normalDiffuseES2RenderPass->addRenderState(m_depthTest);
-
- m_normalDiffuseGL3Technique->addPass(m_normalDiffuseGL3RenderPass);
- m_normalDiffuseGL2Technique->addPass(m_normalDiffuseGL2RenderPass);
- m_normalDiffuseES2Technique->addPass(m_normalDiffuseES2RenderPass);
-
- m_normalDiffuseEffect->addTechnique(m_normalDiffuseGL3Technique);
- m_normalDiffuseEffect->addTechnique(m_normalDiffuseGL2Technique);
- m_normalDiffuseEffect->addTechnique(m_normalDiffuseES2Technique);
-
- m_normalDiffuseEffect->addParameter(m_ambientParameter);
- m_normalDiffuseEffect->addParameter(m_diffuseParameter);
- m_normalDiffuseEffect->addParameter(m_normalParameter);
- m_normalDiffuseEffect->addParameter(m_specularParameter);
- m_normalDiffuseEffect->addParameter(m_shininessParameter);
- m_normalDiffuseEffect->addParameter(m_textureScaleParameter);
-
- q_func()->setEffect(m_normalDiffuseEffect);
-}
-
-
-/*!
- \class Qt3DRender::QNormalDiffuseMapAlphaMaterial
- \brief The QNormalDiffuseMapAlphaMaterial provides a default implementation of the phong lighting and bump effect where the diffuse light component
- is read from a texture map and the normals of the mesh being rendered from a normal texture map. In addition, it defines an alpha to coverage and
- a depth test to be performed in the rendering pass.
- \inmodule Qt3DRender
- \since 5.5
-
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
-
- \list
- \li Ambient is the color that is emitted by an object without any other light source.
- \li Diffuse is the color that is emitted for rought surface reflections with the lights.
- \li Specular is the color emitted for shiny surface reflections with the lights.
- \li The shininess of a surface is controlled by a float property.
- \endlist
-
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
-*/
-/*!
- Constructs a new Qt3DRender::QNormalDiffuseMapAlphaMaterial instance with parent object \a parent.
-*/
-QNormalDiffuseMapAlphaMaterial::QNormalDiffuseMapAlphaMaterial(QNode *parent)
- : QNormalDiffuseMapMaterial(*new QNormalDiffuseMapAlphaMaterialPrivate, parent)
-{
-}
-
-/*!
- Destroys the QNormalDiffuseMapAlphaMaterial instance.
-*/
-QNormalDiffuseMapAlphaMaterial::~QNormalDiffuseMapAlphaMaterial()
-{
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qnormaldiffusemapalphamaterial.h b/src/render/defaults/qnormaldiffusemapalphamaterial.h
deleted file mode 100644
index 5875bbd4c..000000000
--- a/src/render/defaults/qnormaldiffusemapalphamaterial.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QNORMALDIFFUSEMAPALPHAMATERIAL_H
-#define QT3DRENDER_RENDER_QNORMALDIFFUSEMAPALPHAMATERIAL_H
-
-#include <Qt3DRender/qnormaldiffusemapmaterial.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QNormalDiffuseMapAlphaMaterialPrivate;
-
-class QT3DRENDERSHARED_EXPORT QNormalDiffuseMapAlphaMaterial : public QNormalDiffuseMapMaterial
-{
- Q_OBJECT
-public:
- explicit QNormalDiffuseMapAlphaMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QNormalDiffuseMapAlphaMaterial();
-
-private:
- Q_DECLARE_PRIVATE(QNormalDiffuseMapAlphaMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QNORMALDIFFUSEMAPALPHAMATERIAL_H
diff --git a/src/render/defaults/qnormaldiffusemapalphamaterial_p.h b/src/render/defaults/qnormaldiffusemapalphamaterial_p.h
deleted file mode 100644
index 59135908c..000000000
--- a/src/render/defaults/qnormaldiffusemapalphamaterial_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QNORMALDIFFUSEMAPALPHAMATERIAL_P_H
-#define QT3DRENDER_RENDER_QNORMALDIFFUSEMAPALPHAMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qnormaldiffusemapmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QNormalDiffuseMapAlphaMaterial;
-
-class QAlphaCoverage;
-class QDepthTest;
-
-class QNormalDiffuseMapAlphaMaterialPrivate: public QNormalDiffuseMapMaterialPrivate
-{
-public:
- QNormalDiffuseMapAlphaMaterialPrivate();
-
- void init() Q_DECL_OVERRIDE;
-
- QAlphaCoverage *m_alphaCoverage;
- QDepthTest *m_depthTest;
-
- Q_DECLARE_PUBLIC(QNormalDiffuseMapAlphaMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QNORMALDIFFUSEMAPALPHAMATERIAL_P_H
-
diff --git a/src/render/defaults/qnormaldiffusemapmaterial.cpp b/src/render/defaults/qnormaldiffusemapmaterial.cpp
deleted file mode 100644
index ce645592c..000000000
--- a/src/render/defaults/qnormaldiffusemapmaterial.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnormaldiffusemapmaterial.h"
-#include "qnormaldiffusemapmaterial_p.h"
-
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qshaderprogram.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-
-#include <QUrl>
-#include <QVector3D>
-#include <QVector4D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QNormalDiffuseMapMaterialPrivate::QNormalDiffuseMapMaterialPrivate()
- : QMaterialPrivate()
- , m_normalDiffuseEffect(new QEffect())
- , m_diffuseTexture(new QTexture2D())
- , m_normalTexture(new QTexture2D())
- , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.1f, 0.1f, 0.1f, 1.0f)))
- , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture))
- , m_normalParameter(new QParameter(QStringLiteral("normalTexture"), m_normalTexture))
- , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.01f, 0.01f, 0.01f, 1.0f)))
- , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
- , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
- , m_normalDiffuseGL3Technique(new QTechnique())
- , m_normalDiffuseGL2Technique(new QTechnique())
- , m_normalDiffuseES2Technique(new QTechnique())
- , m_normalDiffuseGL3RenderPass(new QRenderPass())
- , m_normalDiffuseGL2RenderPass(new QRenderPass())
- , m_normalDiffuseES2RenderPass(new QRenderPass())
- , m_normalDiffuseGL3Shader(new QShaderProgram())
- , m_normalDiffuseGL2ES2Shader(new QShaderProgram())
-{
- m_diffuseTexture->setMagnificationFilter(QAbstractTextureProvider::Linear);
- m_diffuseTexture->setMinificationFilter(QAbstractTextureProvider::LinearMipMapLinear);
- m_diffuseTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
- m_diffuseTexture->setGenerateMipMaps(true);
- m_diffuseTexture->setMaximumAnisotropy(16.0f);
-
- m_normalTexture->setMagnificationFilter(QAbstractTextureProvider::Linear);
- m_normalTexture->setMinificationFilter(QAbstractTextureProvider::Linear);
- m_normalTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
- m_normalTexture->setMaximumAnisotropy(16.0f);
-}
-
-void QNormalDiffuseMapMaterialPrivate::init()
-{
- connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseMapMaterialPrivate::handleAmbientChanged);
- connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseMapMaterialPrivate::handleDiffuseChanged);
- connect(m_normalParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseMapMaterialPrivate::handleNormalChanged);
- connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseMapMaterialPrivate::handleSpecularChanged);
- connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseMapMaterialPrivate::handleShininessChanged);
- connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged);
-
- m_normalDiffuseGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemap.vert"))));
- m_normalDiffuseGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemap.frag"))));
- m_normalDiffuseGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemap.vert"))));
- m_normalDiffuseGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemap.frag"))));
-
- m_normalDiffuseGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_normalDiffuseGL3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_normalDiffuseGL3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_normalDiffuseGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_normalDiffuseGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_normalDiffuseGL2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_normalDiffuseGL2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_normalDiffuseGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_normalDiffuseES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_normalDiffuseES2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_normalDiffuseES2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_normalDiffuseES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_normalDiffuseGL3RenderPass->setShaderProgram(m_normalDiffuseGL3Shader);
- m_normalDiffuseGL2RenderPass->setShaderProgram(m_normalDiffuseGL2ES2Shader);
- m_normalDiffuseES2RenderPass->setShaderProgram(m_normalDiffuseGL2ES2Shader);
-
- m_normalDiffuseGL3Technique->addPass(m_normalDiffuseGL3RenderPass);
- m_normalDiffuseGL2Technique->addPass(m_normalDiffuseGL2RenderPass);
- m_normalDiffuseES2Technique->addPass(m_normalDiffuseES2RenderPass);
-
- m_normalDiffuseEffect->addTechnique(m_normalDiffuseGL3Technique);
- m_normalDiffuseEffect->addTechnique(m_normalDiffuseGL2Technique);
- m_normalDiffuseEffect->addTechnique(m_normalDiffuseES2Technique);
-
- m_normalDiffuseEffect->addParameter(m_ambientParameter);
- m_normalDiffuseEffect->addParameter(m_diffuseParameter);
- m_normalDiffuseEffect->addParameter(m_normalParameter);
- m_normalDiffuseEffect->addParameter(m_specularParameter);
- m_normalDiffuseEffect->addParameter(m_shininessParameter);
- m_normalDiffuseEffect->addParameter(m_textureScaleParameter);
-
- q_func()->setEffect(m_normalDiffuseEffect);
-}
-
-void QNormalDiffuseMapMaterialPrivate::handleAmbientChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseMapMaterial);
- emit q->ambientChanged(var.value<QColor>());
-}
-
-void QNormalDiffuseMapMaterialPrivate::handleDiffuseChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseMapMaterial);
- emit q->diffuseChanged(var.value<QAbstractTextureProvider *>());
-}
-
-void QNormalDiffuseMapMaterialPrivate::handleNormalChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseMapMaterial);
- emit q->normalChanged(var.value<QAbstractTextureProvider *>());
-}
-
-void QNormalDiffuseMapMaterialPrivate::handleSpecularChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseMapMaterial);
- emit q->specularChanged(var.value<QColor>());
-}
-
-void QNormalDiffuseMapMaterialPrivate::handleShininessChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseMapMaterial);
- emit q->shininessChanged(var.toFloat());
-}
-
-void QNormalDiffuseMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseMapMaterial);
- emit q->textureScaleChanged(var.toFloat());
-}
-
-/*!
- \class Qt3DRender::QNormalDiffuseMapMaterial
- \brief The QNormalDiffuseMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse light component
- is read from a texture map and the normals of the mesh being rendered from a normal texture map.
- \inmodule Qt3DRender
- \since 5.5
-
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
-
- \list
- \li Ambient is the color that is emitted by an object without any other light source.
- \li Diffuse is the color that is emitted for rought surface reflections with the lights.
- \li Specular is the color emitted for shiny surface reflections with the lights.
- \li The shininess of a surface is controlled by a float property.
- \endlist
-
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
-*/
-
-/*!
- Constructs a new Qt3DRender::QNormalDiffuseMapMaterial instance with parent object \a parent.
-*/
-QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNode *parent)
- : QMaterial(*new QNormalDiffuseMapMaterialPrivate, parent)
-{
- Q_D(QNormalDiffuseMapMaterial);
- d->init();
-}
-
-/*! \internal */
-QNormalDiffuseMapMaterial::QNormalDiffuseMapMaterial(QNormalDiffuseMapMaterialPrivate &dd, QNode *parent)
- : QMaterial(dd, parent)
-{
- Q_D(QNormalDiffuseMapMaterial);
- d->init();
-}
-
-/*!
- Destroys the QNormalDiffuseMapMaterial instance.
-*/
-QNormalDiffuseMapMaterial::~QNormalDiffuseMapMaterial()
-{
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::ambient
-
- Holds the current ambient color.
-*/
-QColor QNormalDiffuseMapMaterial::ambient() const
-{
- Q_D(const QNormalDiffuseMapMaterial);
- return d->m_ambientParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::specular
-
- Holds the current specular color.
-*/
-QColor QNormalDiffuseMapMaterial::specular() const
-{
- Q_D(const QNormalDiffuseMapMaterial);
- return d->m_specularParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::diffuse
-
- Holds the current diffuse map texture.
-
- By default, the diffuse texture has these properties:
-
- \list
- \li Linear minification and magnification filters
- \li Linear mipmap with mipmapping enabled
- \li Repeat wrap modeM
- \li Maximum anisotropy of 16.0
- \endlist
-*/
-QAbstractTextureProvider *QNormalDiffuseMapMaterial::diffuse() const
-{
- Q_D(const QNormalDiffuseMapMaterial);
- return d->m_diffuseParameter->value().value<QAbstractTextureProvider *>();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::normal
-
- Holds the current normal map texture.
-
- By default, the normal texture has the following properties:
-
- \list
- \li Linear minification and magnification filters
- \li Repeat wrap mode
- \li Maximum anisotropy of 16.0
- \endlist
-*/
-QAbstractTextureProvider *QNormalDiffuseMapMaterial::normal() const
-{
- Q_D(const QNormalDiffuseMapMaterial);
- return d->m_normalParameter->value().value<QAbstractTextureProvider *>();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::shininess
-
- Holds the current shininess as a float value.
-*/
-float QNormalDiffuseMapMaterial::shininess() const
-{
- Q_D(const QNormalDiffuseMapMaterial);
- return d->m_shininessParameter->value().toFloat();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseMapMaterial::textureScale
-
- Holds the current texture scale as a float value.
-*/
-float QNormalDiffuseMapMaterial::textureScale() const
-{
- Q_D(const QNormalDiffuseMapMaterial);
- return d->m_textureScaleParameter->value().toFloat();
-}
-
-void QNormalDiffuseMapMaterial::setAmbient(const QColor &ambient)
-{
- Q_D(QNormalDiffuseMapMaterial);
- d->m_ambientParameter->setValue(ambient);
-}
-
-void QNormalDiffuseMapMaterial::setSpecular(const QColor &specular)
-{
- Q_D(QNormalDiffuseMapMaterial);
- d->m_specularParameter->setValue(specular);
-}
-
-void QNormalDiffuseMapMaterial::setDiffuse(QAbstractTextureProvider *diffuse)
-{
- Q_D(QNormalDiffuseMapMaterial);
- d->m_diffuseParameter->setValue(QVariant::fromValue(diffuse));
-}
-
-void QNormalDiffuseMapMaterial::setNormal(QAbstractTextureProvider *normal)
-{
- Q_D(QNormalDiffuseMapMaterial);
- d->m_normalParameter->setValue(QVariant::fromValue(normal));
-}
-
-void QNormalDiffuseMapMaterial::setShininess(float shininess)
-{
- Q_D(QNormalDiffuseMapMaterial);
- d->m_shininessParameter->setValue(shininess);
-}
-
-void QNormalDiffuseMapMaterial::setTextureScale(float textureScale)
-{
- Q_D(QNormalDiffuseMapMaterial);
- d->m_textureScaleParameter->setValue(textureScale);
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qnormaldiffusemapmaterial.h b/src/render/defaults/qnormaldiffusemapmaterial.h
deleted file mode 100644
index d6ca4edc8..000000000
--- a/src/render/defaults/qnormaldiffusemapmaterial.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QNORMALDIFFUSEMAPMATERIAL_H
-#define QT3DRENDER_RENDER_QNORMALDIFFUSEMAPMATERIAL_H
-
-#include <Qt3DRender/qmaterial.h>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractTextureProvider;
-class QNormalDiffuseMapMaterialPrivate;
-
-class QT3DRENDERSHARED_EXPORT QNormalDiffuseMapMaterial : public QMaterial
-{
- Q_OBJECT
- Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
- Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *normal READ normal WRITE setNormal NOTIFY normalChanged)
- Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
- Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
-
-public:
- explicit QNormalDiffuseMapMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QNormalDiffuseMapMaterial();
-
- QColor ambient() const;
- QColor specular() const;
- QAbstractTextureProvider *diffuse() const;
- QAbstractTextureProvider *normal() const;
- float shininess() const;
- float textureScale() const;
-
-public Q_SLOTS:
- void setAmbient(const QColor &ambient);
- void setSpecular(const QColor &specular);
- void setDiffuse(QAbstractTextureProvider *diffuse);
- void setNormal(QAbstractTextureProvider *normal);
- void setShininess(float shininess);
- void setTextureScale(float textureScale);
-
-Q_SIGNALS:
- void ambientChanged(const QColor &ambient);
- void diffuseChanged(QAbstractTextureProvider *diffuse);
- void normalChanged(QAbstractTextureProvider *normal);
- void specularChanged(const QColor &specular);
- void shininessChanged(float shininess);
- void textureScaleChanged(float textureScale);
-
-protected:
- QNormalDiffuseMapMaterial(QNormalDiffuseMapMaterialPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QNormalDiffuseMapMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QNORMALDIFFUSEMAPMATERIAL_H
diff --git a/src/render/defaults/qnormaldiffusemapmaterial_p.h b/src/render/defaults/qnormaldiffusemapmaterial_p.h
deleted file mode 100644
index ba28d971f..000000000
--- a/src/render/defaults/qnormaldiffusemapmaterial_p.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QNORMALDIFFUSEMAPMATERIAL_P_H
-#define QT3DRENDER_RENDER_QNORMALDIFFUSEMAPMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QEffect;
-class QAbstractTextureProvider;
-class QTechnique;
-class QParameter;
-class QShaderProgram;
-class QRenderPass;
-class QParameterMapping;
-
-class QNormalDiffuseMapMaterial;
-
-class QNormalDiffuseMapMaterialPrivate: public QMaterialPrivate
-{
-public:
- QNormalDiffuseMapMaterialPrivate();
-
- virtual void init();
-
- void handleAmbientChanged(const QVariant &var);
- void handleDiffuseChanged(const QVariant &var);
- void handleNormalChanged(const QVariant &var);
- void handleSpecularChanged(const QVariant &var);
- void handleShininessChanged(const QVariant &var);
- void handleTextureScaleChanged(const QVariant &var);
-
- QEffect *m_normalDiffuseEffect;
- QAbstractTextureProvider *m_diffuseTexture;
- QAbstractTextureProvider *m_normalTexture;
- QParameter *m_ambientParameter;
- QParameter *m_diffuseParameter;
- QParameter *m_normalParameter;
- QParameter *m_specularParameter;
- QParameter *m_shininessParameter;
- QParameter *m_textureScaleParameter;
- QTechnique *m_normalDiffuseGL3Technique;
- QTechnique *m_normalDiffuseGL2Technique;
- QTechnique *m_normalDiffuseES2Technique;
- QRenderPass *m_normalDiffuseGL3RenderPass;
- QRenderPass *m_normalDiffuseGL2RenderPass;
- QRenderPass *m_normalDiffuseES2RenderPass;
- QShaderProgram *m_normalDiffuseGL3Shader;
- QShaderProgram *m_normalDiffuseGL2ES2Shader;
-
- Q_DECLARE_PUBLIC(QNormalDiffuseMapMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QNORMALDIFFUSEMAPMATERIAL_P_H
-
diff --git a/src/render/defaults/qnormaldiffusespecularmapmaterial.cpp b/src/render/defaults/qnormaldiffusespecularmapmaterial.cpp
deleted file mode 100644
index e45b22d52..000000000
--- a/src/render/defaults/qnormaldiffusespecularmapmaterial.cpp
+++ /dev/null
@@ -1,363 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnormaldiffusespecularmapmaterial.h"
-#include "qnormaldiffusespecularmapmaterial_p.h"
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qshaderprogram.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <QUrl>
-#include <QVector3D>
-#include <QVector4D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QNormalDiffuseSpecularMapMaterialPrivate::QNormalDiffuseSpecularMapMaterialPrivate()
- : QMaterialPrivate()
- , m_normalDiffuseSpecularEffect(new QEffect())
- , m_diffuseTexture(new QTexture2D())
- , m_normalTexture(new QTexture2D())
- , m_specularTexture(new QTexture2D())
- , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
- , m_diffuseParameter(new QParameter(QStringLiteral("diffuseTexture"), m_diffuseTexture))
- , m_normalParameter(new QParameter(QStringLiteral("normalTexture"), m_normalTexture))
- , m_specularParameter(new QParameter(QStringLiteral("specularTexture"), m_specularTexture))
- , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
- , m_textureScaleParameter(new QParameter(QStringLiteral("texCoordScale"), 1.0f))
- , m_normalDiffuseSpecularGL3Technique(new QTechnique())
- , m_normalDiffuseSpecularGL2Technique(new QTechnique())
- , m_normalDiffuseSpecularES2Technique(new QTechnique())
- , m_normalDiffuseSpecularGL3RenderPass(new QRenderPass())
- , m_normalDiffuseSpecularGL2RenderPass(new QRenderPass())
- , m_normalDiffuseSpecularES2RenderPass(new QRenderPass())
- , m_normalDiffuseSpecularGL3Shader(new QShaderProgram())
- , m_normalDiffuseSpecularGL2ES2Shader(new QShaderProgram())
-{
- m_diffuseTexture->setMagnificationFilter(QAbstractTextureProvider::Linear);
- m_diffuseTexture->setMinificationFilter(QAbstractTextureProvider::LinearMipMapLinear);
- m_diffuseTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
- m_diffuseTexture->setGenerateMipMaps(true);
- m_diffuseTexture->setMaximumAnisotropy(16.0f);
-
- m_normalTexture->setMagnificationFilter(QAbstractTextureProvider::Linear);
- m_normalTexture->setMinificationFilter(QAbstractTextureProvider::Linear);
- m_normalTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
- m_normalTexture->setMaximumAnisotropy(16.0f);
-
- m_specularTexture->setMagnificationFilter(QAbstractTextureProvider::Linear);
- m_specularTexture->setMinificationFilter(QAbstractTextureProvider::LinearMipMapLinear);
- m_specularTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::Repeat));
- m_specularTexture->setGenerateMipMaps(true);
- m_specularTexture->setMaximumAnisotropy(16.0f);
-}
-
-void QNormalDiffuseSpecularMapMaterialPrivate::init()
-{
- connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseSpecularMapMaterialPrivate::handleAmbientChanged);
- connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseSpecularMapMaterialPrivate::handleDiffuseChanged);
- connect(m_normalParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseSpecularMapMaterialPrivate::handleNormalChanged);
- connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseSpecularMapMaterialPrivate::handleSpecularChanged);
- connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseSpecularMapMaterialPrivate::handleShininessChanged);
- connect(m_textureScaleParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QNormalDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged);
-
- m_normalDiffuseSpecularGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusemap.vert"))));
- m_normalDiffuseSpecularGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/normaldiffusespecularmap.frag"))));
- m_normalDiffuseSpecularGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusemap.vert"))));
- m_normalDiffuseSpecularGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/normaldiffusespecularmap.frag"))));
-
- m_normalDiffuseSpecularGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_normalDiffuseSpecularGL3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_normalDiffuseSpecularGL3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_normalDiffuseSpecularGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_normalDiffuseSpecularGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_normalDiffuseSpecularGL2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_normalDiffuseSpecularGL2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_normalDiffuseSpecularGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_normalDiffuseSpecularES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_normalDiffuseSpecularES2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_normalDiffuseSpecularES2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_normalDiffuseSpecularES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_normalDiffuseSpecularGL3RenderPass->setShaderProgram(m_normalDiffuseSpecularGL3Shader);
- m_normalDiffuseSpecularGL2RenderPass->setShaderProgram(m_normalDiffuseSpecularGL2ES2Shader);
- m_normalDiffuseSpecularES2RenderPass->setShaderProgram(m_normalDiffuseSpecularGL2ES2Shader);
-
- m_normalDiffuseSpecularGL3Technique->addPass(m_normalDiffuseSpecularGL3RenderPass);
- m_normalDiffuseSpecularGL2Technique->addPass(m_normalDiffuseSpecularGL2RenderPass);
- m_normalDiffuseSpecularES2Technique->addPass(m_normalDiffuseSpecularES2RenderPass);
-
- m_normalDiffuseSpecularEffect->addTechnique(m_normalDiffuseSpecularGL3Technique);
- m_normalDiffuseSpecularEffect->addTechnique(m_normalDiffuseSpecularGL2Technique);
- m_normalDiffuseSpecularEffect->addTechnique(m_normalDiffuseSpecularES2Technique);
-
- m_normalDiffuseSpecularEffect->addParameter(m_ambientParameter);
- m_normalDiffuseSpecularEffect->addParameter(m_diffuseParameter);
- m_normalDiffuseSpecularEffect->addParameter(m_normalParameter);
- m_normalDiffuseSpecularEffect->addParameter(m_specularParameter);
- m_normalDiffuseSpecularEffect->addParameter(m_shininessParameter);
- m_normalDiffuseSpecularEffect->addParameter(m_textureScaleParameter);
-
- q_func()->setEffect(m_normalDiffuseSpecularEffect);
-}
-
-void QNormalDiffuseSpecularMapMaterialPrivate::handleAmbientChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseSpecularMapMaterial);
- emit q->ambientChanged(var.value<QColor>());
-}
-
-void QNormalDiffuseSpecularMapMaterialPrivate::handleDiffuseChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseSpecularMapMaterial);
- emit q->diffuseChanged(var.value<QAbstractTextureProvider *>());
-}
-
-void QNormalDiffuseSpecularMapMaterialPrivate::handleNormalChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseSpecularMapMaterial);
- emit q->normalChanged(var.value<QAbstractTextureProvider *>());
-}
-
-void QNormalDiffuseSpecularMapMaterialPrivate::handleSpecularChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseSpecularMapMaterial);
- emit q->specularChanged(var.value<QAbstractTextureProvider *>());
-}
-
-void QNormalDiffuseSpecularMapMaterialPrivate::handleShininessChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseSpecularMapMaterial);
- emit q->shininessChanged(var.toFloat());
-}
-
-void QNormalDiffuseSpecularMapMaterialPrivate::handleTextureScaleChanged(const QVariant &var)
-{
- Q_Q(QNormalDiffuseSpecularMapMaterial);
- emit q->textureScaleChanged(var.toFloat());
-}
-
-/*!
- \class Qt3DRender::QNormalDiffuseSpecularMapMaterial
- \brief The QNormalDiffuseSpecularMapMaterial provides a default implementation of the phong lighting and bump effect where the diffuse and specular light components
- are read from texture maps and the normals of the mesh being rendered from a normal texture map.
- \inmodule Qt3DRender
- \since 5.5
-
- The specular lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
-
- \list
- \li Ambient is the color that is emitted by an object without any other light source.
- \li Diffuse is the color that is emitted for rought surface reflections with the lights.
- \li Specular is the color emitted for shiny surface reflections with the lights.
- \li The shininess of a surface is controlled by a float property.
- \endlist
-
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
-*/
-
-/*!
- Constructs a new Qt3DRender::QNormalDiffuseSpecularMapMaterial instance with parent object \a parent.
-*/
-QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNode *parent)
- : QMaterial(*new QNormalDiffuseSpecularMapMaterialPrivate, parent)
-{
- Q_D(QNormalDiffuseSpecularMapMaterial);
- d->init();
-}
-
-/*! \internal */
-QNormalDiffuseSpecularMapMaterial::QNormalDiffuseSpecularMapMaterial(QNormalDiffuseSpecularMapMaterialPrivate &dd, QNode *parent)
- : QMaterial(dd, parent)
-{
- Q_D(QNormalDiffuseSpecularMapMaterial);
- d->init();
-}
-
-/*!
- Destroys the Qt3DRender::QNormalDiffuseSpecularMapMaterial instance.
-*/
-QNormalDiffuseSpecularMapMaterial::~QNormalDiffuseSpecularMapMaterial()
-{
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::ambient
-
- Holds the current ambient color.
-*/
-QColor QNormalDiffuseSpecularMapMaterial::ambient() const
-{
- Q_D(const QNormalDiffuseSpecularMapMaterial);
- return d->m_ambientParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::diffuse
-
- Holds the current diffuse map texture.
-
- By default, the diffuse texture has the following properties:
-
- \list
- \li Linear minification and magnification filters
- \li Linear mipmap with mipmapping enabled
- \li Repeat wrap mode
- \li Maximum anisotropy of 16.0
- \endlist
-*/
-QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::diffuse() const
-{
- Q_D(const QNormalDiffuseSpecularMapMaterial);
- return d->m_diffuseParameter->value().value<QAbstractTextureProvider *>();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::normal
-
- Holds the current normal map texture.
-
- By default, the normal texture has the following properties:
-
- \list
- \li Linear minification and magnification filters
- \li Repeat wrap mode
- \li Maximum anisotropy of 16.0
- \endlist
-*/
-QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::normal() const
-{
- Q_D(const QNormalDiffuseSpecularMapMaterial);
- return d->m_normalParameter->value().value<QAbstractTextureProvider *>();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::specular
-
- Holds the current specular map texture.
-
- By default, the specular texture has the following properties:
-
- \list
- \li Linear minification and magnification filters
- \li Linear mipmap with mipmapping enabled
- \li Repeat wrap mode
- \li Maximum anisotropy of 16.0
- \endlist
-*/
-QAbstractTextureProvider *QNormalDiffuseSpecularMapMaterial::specular() const
-{
- Q_D(const QNormalDiffuseSpecularMapMaterial);
- return d->m_specularParameter->value().value<QAbstractTextureProvider *>();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::shininess
-
- Holds the current shininess as a float value.
-*/
-float QNormalDiffuseSpecularMapMaterial::shininess() const
-{
- Q_D(const QNormalDiffuseSpecularMapMaterial);
- return d->m_shininessParameter->value().toFloat();
-}
-
-/*!
- \property Qt3DRender::QNormalDiffuseSpecularMapMaterial::textureScale
-
- Holds the current texture scale as a float value.
-*/
-float QNormalDiffuseSpecularMapMaterial::textureScale() const
-{
- Q_D(const QNormalDiffuseSpecularMapMaterial);
- return d->m_textureScaleParameter->value().toFloat();
-}
-
-void QNormalDiffuseSpecularMapMaterial::setAmbient(const QColor &ambient)
-{
- Q_D(QNormalDiffuseSpecularMapMaterial);
- d->m_ambientParameter->setValue(ambient);
-}
-
-void QNormalDiffuseSpecularMapMaterial::setDiffuse(QAbstractTextureProvider *diffuse)
-{
- Q_D(QNormalDiffuseSpecularMapMaterial);
- d->m_diffuseParameter->setValue(QVariant::fromValue(diffuse));
-}
-
-void QNormalDiffuseSpecularMapMaterial::setNormal(QAbstractTextureProvider *normal)
-{
- Q_D(QNormalDiffuseSpecularMapMaterial);
- d->m_normalParameter->setValue(QVariant::fromValue(normal));
-}
-
-void QNormalDiffuseSpecularMapMaterial::setSpecular(QAbstractTextureProvider *specular)
-{
- Q_D(QNormalDiffuseSpecularMapMaterial);
- d->m_specularParameter->setValue(QVariant::fromValue(specular));
-}
-
-void QNormalDiffuseSpecularMapMaterial::setShininess(float shininess)
-{
- Q_D(QNormalDiffuseSpecularMapMaterial);
- d->m_shininessParameter->setValue(shininess);
-}
-
-void QNormalDiffuseSpecularMapMaterial::setTextureScale(float textureScale)
-{
- Q_D(QNormalDiffuseSpecularMapMaterial);
- d->m_textureScaleParameter->setValue(textureScale);
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qnormaldiffusespecularmapmaterial.h b/src/render/defaults/qnormaldiffusespecularmapmaterial.h
deleted file mode 100644
index 263c8fecd..000000000
--- a/src/render/defaults/qnormaldiffusespecularmapmaterial.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QNORMALDIFFUSESPECULARMAPMATERIAL_H
-#define QT3DRENDER_RENDER_QNORMALDIFFUSESPECULARMAPMATERIAL_H
-
-#include <Qt3DRender/qmaterial.h>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QNormalDiffuseSpecularMapMaterialPrivate;
-
-class QT3DRENDERSHARED_EXPORT QNormalDiffuseSpecularMapMaterial : public QMaterial
-{
- Q_OBJECT
- Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *normal READ normal WRITE setNormal NOTIFY normalChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *specular READ specular WRITE setSpecular NOTIFY specularChanged)
- Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
- Q_PROPERTY(float textureScale READ textureScale WRITE setTextureScale NOTIFY textureScaleChanged)
-
-public:
- explicit QNormalDiffuseSpecularMapMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QNormalDiffuseSpecularMapMaterial();
-
- QColor ambient() const;
- QAbstractTextureProvider *diffuse() const;
- QAbstractTextureProvider *normal() const;
- QAbstractTextureProvider *specular() const;
- float shininess() const;
- float textureScale() const;
-
-public Q_SLOTS:
- void setAmbient(const QColor &ambient);
- void setDiffuse(QAbstractTextureProvider *diffuse);
- void setNormal(QAbstractTextureProvider *normal);
- void setSpecular(QAbstractTextureProvider *specular);
- void setShininess(float shininess);
- void setTextureScale(float textureScale);
-
-Q_SIGNALS:
- void ambientChanged(const QColor &ambient);
- void diffuseChanged(QAbstractTextureProvider *diffuse);
- void normalChanged(QAbstractTextureProvider *normal);
- void specularChanged(QAbstractTextureProvider *specular);
- void shininessChanged(float shininess);
- void textureScaleChanged(float textureScale);
-
-protected:
- QNormalDiffuseSpecularMapMaterial(QNormalDiffuseSpecularMapMaterialPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QNormalDiffuseSpecularMapMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QNORMALDIFFUSESPECULARMAPMATERIAL_H
diff --git a/src/render/defaults/qnormaldiffusespecularmapmaterial_p.h b/src/render/defaults/qnormaldiffusespecularmapmaterial_p.h
deleted file mode 100644
index f3283f85e..000000000
--- a/src/render/defaults/qnormaldiffusespecularmapmaterial_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QNORMALDIFFUSESPECULARMAPMATERIAL_P_H
-#define QT3DRENDER_RENDER_QNORMALDIFFUSESPECULARMAPMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QEffect;
-class QAbstractTextureProvider;
-class QTechnique;
-class QParameter;
-class QShaderProgram;
-class QRenderPass;
-class QParameterMapping;
-
-class QNormalDiffuseSpecularMapMaterial;
-
-class QNormalDiffuseSpecularMapMaterialPrivate : public QMaterialPrivate
-{
-public:
- QNormalDiffuseSpecularMapMaterialPrivate();
-
- void init();
-
- void handleAmbientChanged(const QVariant &var);
- void handleDiffuseChanged(const QVariant &var);
- void handleNormalChanged(const QVariant &var);
- void handleSpecularChanged(const QVariant &var);
- void handleShininessChanged(const QVariant &var);
- void handleTextureScaleChanged(const QVariant &var);
-
- QEffect *m_normalDiffuseSpecularEffect;
- QAbstractTextureProvider *m_diffuseTexture;
- QAbstractTextureProvider *m_normalTexture;
- QAbstractTextureProvider *m_specularTexture;
- QParameter *m_ambientParameter;
- QParameter *m_diffuseParameter;
- QParameter *m_normalParameter;
- QParameter *m_specularParameter;
- QParameter *m_shininessParameter;
- QParameter *m_textureScaleParameter;
- QTechnique *m_normalDiffuseSpecularGL3Technique;
- QTechnique *m_normalDiffuseSpecularGL2Technique;
- QTechnique *m_normalDiffuseSpecularES2Technique;
- QRenderPass *m_normalDiffuseSpecularGL3RenderPass;
- QRenderPass *m_normalDiffuseSpecularGL2RenderPass;
- QRenderPass *m_normalDiffuseSpecularES2RenderPass;
- QShaderProgram *m_normalDiffuseSpecularGL3Shader;
- QShaderProgram *m_normalDiffuseSpecularGL2ES2Shader;
-
- Q_DECLARE_PUBLIC(QNormalDiffuseSpecularMapMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QNORMALDIFFUSESPECULARMAPMATERIAL_P_H
-
diff --git a/src/render/defaults/qpervertexcolormaterial.cpp b/src/render/defaults/qpervertexcolormaterial.cpp
deleted file mode 100644
index da01f861d..000000000
--- a/src/render/defaults/qpervertexcolormaterial.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Lorenz Esch (TU Ilmenau).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpervertexcolormaterial.h"
-#include "qpervertexcolormaterial_p.h"
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qshaderprogram.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <QUrl>
-#include <QVector3D>
-#include <QVector4D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QPerVertexColorMaterialPrivate::QPerVertexColorMaterialPrivate()
- : QMaterialPrivate()
- , m_vertexEffect(new QEffect())
- , m_vertexGL3Technique(new QTechnique())
- , m_vertexGL2Technique(new QTechnique())
- , m_vertexES2Technique(new QTechnique())
- , m_vertexGL3RenderPass(new QRenderPass())
- , m_vertexGL2RenderPass(new QRenderPass())
- , m_vertexES2RenderPass(new QRenderPass())
- , m_vertexGL3Shader(new QShaderProgram())
- , m_vertexGL2ES2Shader(new QShaderProgram())
-{
-}
-
-/*!
- \class Qt3DRender::QPerVertexColorMaterial
- \brief The QPerVertexColorMaterial class provides a default implementation for rendering the color properties set for each vertex.
- \inmodule Qt3DRender
- \since 5.5
-
- This lighting effect is based on the combination of 2 lighting components ambient and diffuse. Ambient is set by the vertex color.
- Diffuse takes in account the normal distribution of each vertex.
-
- \list
- \li Ambient is the color that is emitted by an object without any other light source.
- \li Diffuse is the color that is emitted for rough surface reflections with the lights
- \endlist
-
- This material uses an effect with a single render pass approach and forms fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
-*/
-
-/*!
- \fn Qt3DRender::QPerVertexColorMaterial::QPerVertexColorMaterial(Qt3DCore::QNode *parent)
-
- Constructs a new QPerVertexColorMaterial instance with parent object \a parent.
-*/
-QPerVertexColorMaterial::QPerVertexColorMaterial(QNode *parent)
- : QMaterial(*new QPerVertexColorMaterialPrivate, parent)
-{
- Q_D(QPerVertexColorMaterial);
- d->init();
-}
-
-/*!
- \fn Qt3DRender::QPerVertexColorMaterial::~QPerVertexColorMaterial()
-
- Destroys the QPerVertexColorMaterial
-*/
-QPerVertexColorMaterial::~QPerVertexColorMaterial()
-{
-}
-
-// TODO: Define how lights are proties are set in the shaders. Ideally using a QShaderData
-void QPerVertexColorMaterialPrivate::init()
-{
- m_vertexGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/pervertexcolor.vert"))));
- m_vertexGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/pervertexcolor.frag"))));
- m_vertexGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/pervertexcolor.vert"))));
- m_vertexGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/pervertexcolor.frag"))));
-
- m_vertexGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_vertexGL3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_vertexGL3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_vertexGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_vertexGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_vertexGL2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_vertexGL2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_vertexGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_vertexES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_vertexES2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_vertexES2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_vertexES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_vertexGL3RenderPass->setShaderProgram(m_vertexGL3Shader);
- m_vertexGL2RenderPass->setShaderProgram(m_vertexGL2ES2Shader);
- m_vertexES2RenderPass->setShaderProgram(m_vertexGL2ES2Shader);
-
- m_vertexGL3Technique->addPass(m_vertexGL3RenderPass);
- m_vertexGL2Technique->addPass(m_vertexGL2RenderPass);
- m_vertexES2Technique->addPass(m_vertexES2RenderPass);
-
- m_vertexEffect->addTechnique(m_vertexGL3Technique);
- m_vertexEffect->addTechnique(m_vertexGL2Technique);
- m_vertexEffect->addTechnique(m_vertexES2Technique);
-
- q_func()->setEffect(m_vertexEffect);
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qpervertexcolormaterial.h b/src/render/defaults/qpervertexcolormaterial.h
deleted file mode 100644
index 0e7125e3d..000000000
--- a/src/render/defaults/qpervertexcolormaterial.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Lorenz Esch (TU Ilmenau).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QPERVERTEXCOLORMATERIAL_H
-#define QT3DRENDER_RENDER_QPERVERTEXCOLORMATERIAL_H
-
-#include <Qt3DRender/qmaterial.h>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QPerVertexColorMaterialPrivate;
-
-class QT3DRENDERSHARED_EXPORT QPerVertexColorMaterial : public QMaterial
-{
- Q_OBJECT
-
-public:
- explicit QPerVertexColorMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QPerVertexColorMaterial();
-
-private:
- Q_DECLARE_PRIVATE(QPerVertexColorMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QPERVERTEXCOLORMATERIAL_H
diff --git a/src/render/defaults/qpervertexcolormaterial_p.h b/src/render/defaults/qpervertexcolormaterial_p.h
deleted file mode 100644
index 9e8298667..000000000
--- a/src/render/defaults/qpervertexcolormaterial_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Lorenz Esch (TU Ilmenau).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QPERVERTEXCOLORMATERIAL_P_H
-#define QT3DRENDER_RENDER_QPERVERTEXCOLORMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QEffect;
-class QTechnique;
-class QParameter;
-class QShaderProgram;
-class QRenderPass;
-class QParameterMapping;
-
-class QPerVertexColorMaterial;
-
-class QPerVertexColorMaterialPrivate : public QMaterialPrivate
-{
-public:
- QPerVertexColorMaterialPrivate();
-
- void init();
-
- QEffect *m_vertexEffect;
- QTechnique *m_vertexGL3Technique;
- QTechnique *m_vertexGL2Technique;
- QTechnique *m_vertexES2Technique;
- QRenderPass *m_vertexGL3RenderPass;
- QRenderPass *m_vertexGL2RenderPass;
- QRenderPass *m_vertexES2RenderPass;
- QShaderProgram *m_vertexGL3Shader;
- QShaderProgram *m_vertexGL2ES2Shader;
-
- Q_DECLARE_PUBLIC(QPerVertexColorMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QPERVERTEXCOLORMATERIAL_P_H
-
diff --git a/src/render/defaults/qphongalphamaterial.cpp b/src/render/defaults/qphongalphamaterial.cpp
deleted file mode 100644
index fb6030bff..000000000
--- a/src/render/defaults/qphongalphamaterial.cpp
+++ /dev/null
@@ -1,312 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qphongalphamaterial.h"
-#include "qphongalphamaterial_p.h"
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qshaderprogram.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <Qt3DRender/qblendequation.h>
-#include <Qt3DRender/qblendstate.h>
-#include <Qt3DRender/qdepthmask.h>
-#include <QUrl>
-#include <QVector3D>
-#include <QVector4D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QPhongAlphaMaterialPrivate::QPhongAlphaMaterialPrivate()
- : QMaterialPrivate()
- , m_phongEffect(new QEffect())
- , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
- , m_diffuseParameter(new QParameter(QStringLiteral("kd"), QColor::fromRgbF(0.7f, 0.7f, 0.7f, 1.0f)))
- , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.01f, 0.01f, 0.01f, 1.0f)))
- , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
- , m_alphaParameter(new QParameter(QStringLiteral("alpha"), 0.5f))
- , m_phongAlphaGL3Technique(new QTechnique())
- , m_phongAlphaGL2Technique(new QTechnique())
- , m_phongAlphaES2Technique(new QTechnique())
- , m_phongAlphaGL3RenderPass(new QRenderPass())
- , m_phongAlphaGL2RenderPass(new QRenderPass())
- , m_phongAlphaES2RenderPass(new QRenderPass())
- , m_phongAlphaGL3Shader(new QShaderProgram())
- , m_phongAlphaGL2ES2Shader(new QShaderProgram())
- , m_depthMask(new QDepthMask())
- , m_blendState(new QBlendState())
- , m_blendEquation(new QBlendEquation())
-{
-}
-
-// TODO: Define how lights are properties are set in the shaders. Ideally using a QShaderData
-void QPhongAlphaMaterialPrivate::init()
-{
- connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongAlphaMaterialPrivate::handleAmbientChanged);
- connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongAlphaMaterialPrivate::handleDiffuseChanged);
- connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongAlphaMaterialPrivate::handleSpecularChanged);
- connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongAlphaMaterialPrivate::handleShininessChanged);
- connect(m_alphaParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongAlphaMaterialPrivate::handleAlphaChanged);
-
- m_phongAlphaGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/phong.vert"))));
- m_phongAlphaGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/phongalpha.frag"))));
- m_phongAlphaGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/phong.vert"))));
- m_phongAlphaGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/phongalpha.frag"))));
-
- m_phongAlphaGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_phongAlphaGL3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_phongAlphaGL3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_phongAlphaGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_phongAlphaGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_phongAlphaGL2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_phongAlphaGL2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_phongAlphaGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_phongAlphaES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_phongAlphaES2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_phongAlphaES2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_phongAlphaES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_depthMask->setMask(false);
- m_blendState->setSrcRGB(QBlendState::SrcAlpha);
- m_blendState->setDstRGB(QBlendState::OneMinusSrcAlpha);
- m_blendEquation->setMode(QBlendEquation::FuncAdd);
-
- m_phongAlphaGL3RenderPass->setShaderProgram(m_phongAlphaGL3Shader);
- m_phongAlphaGL2RenderPass->setShaderProgram(m_phongAlphaGL2ES2Shader);
- m_phongAlphaES2RenderPass->setShaderProgram(m_phongAlphaGL2ES2Shader);
-
- m_phongAlphaGL3RenderPass->addRenderState(m_depthMask);
- m_phongAlphaGL3RenderPass->addRenderState(m_blendState);
- m_phongAlphaGL3RenderPass->addRenderState(m_blendEquation);
-
- m_phongAlphaGL2RenderPass->addRenderState(m_depthMask);
- m_phongAlphaGL2RenderPass->addRenderState(m_blendState);
- m_phongAlphaGL2RenderPass->addRenderState(m_blendEquation);
-
- m_phongAlphaES2RenderPass->addRenderState(m_depthMask);
- m_phongAlphaES2RenderPass->addRenderState(m_blendState);
- m_phongAlphaES2RenderPass->addRenderState(m_blendEquation);
-
- m_phongAlphaGL3Technique->addPass(m_phongAlphaGL3RenderPass);
- m_phongAlphaGL2Technique->addPass(m_phongAlphaGL2RenderPass);
- m_phongAlphaES2Technique->addPass(m_phongAlphaES2RenderPass);
-
- m_phongEffect->addTechnique(m_phongAlphaGL3Technique);
- m_phongEffect->addTechnique(m_phongAlphaGL2Technique);
- m_phongEffect->addTechnique(m_phongAlphaES2Technique);
-
- m_phongEffect->addParameter(m_ambientParameter);
- m_phongEffect->addParameter(m_diffuseParameter);
- m_phongEffect->addParameter(m_specularParameter);
- m_phongEffect->addParameter(m_shininessParameter);
- m_phongEffect->addParameter(m_alphaParameter);
-
- q_func()->setEffect(m_phongEffect);
-}
-
-void QPhongAlphaMaterialPrivate::handleAmbientChanged(const QVariant &var)
-{
- Q_Q(QPhongAlphaMaterial);
- emit q->ambientChanged(var.value<QColor>());
-}
-
-void QPhongAlphaMaterialPrivate::handleDiffuseChanged(const QVariant &var)
-{
- Q_Q(QPhongAlphaMaterial);
- emit q->diffuseChanged(var.value<QColor>());
-}
-
-void QPhongAlphaMaterialPrivate::handleSpecularChanged(const QVariant &var)
-{
- Q_Q(QPhongAlphaMaterial);
- emit q->specularChanged(var.value<QColor>());
-}
-
-void QPhongAlphaMaterialPrivate::handleShininessChanged(const QVariant &var)
-{
- Q_Q(QPhongAlphaMaterial);
- emit q->shininessChanged(var.toFloat());
-}
-
-void QPhongAlphaMaterialPrivate::handleAlphaChanged(const QVariant &var)
-{
- Q_Q(QPhongAlphaMaterial);
- emit q->alphaChanged(var.toFloat());
-}
-
-/*!
- \class Qt3DRender::QPhongAlphaMaterial
-
- \brief The QPhongAlphaMaterial class provides a default implementation of
- the phong lighting effect with alpha.
- \inmodule Qt3DRenderer
- \since 5.5
-
- The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
-
- \list
- \li Ambient is the color that is emitted by an object without any other light source.
- \li Diffuse is the color that is emitted for rought surface reflections with the lights.
- \li Specular is the color emitted for shiny surface reflections with the lights.
- \li The shininess of a surface is controlled by a float property.
- \li Alpha is the transparency of the surface between 0 (fully transparent) and 1 (opaque).
- \endlist
-
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
-*/
-
-/*!
- \fn Qt3DRender::QPhongAlphaMaterial::QPhongAlphaMaterial(Qt3DCore::QNode *parent)
-
- Constructs a new QPhongAlphaMaterial instance with parent object \a parent.
-*/
-QPhongAlphaMaterial::QPhongAlphaMaterial(QNode *parent)
- : QMaterial(*new QPhongAlphaMaterialPrivate, parent)
-{
- Q_D(QPhongAlphaMaterial);
- d->init();
-}
-
-/*!
- Destroys the QPhongAlphaMaterial.
-*/
-QPhongAlphaMaterial::~QPhongAlphaMaterial()
-{
-}
-
-/*!
- \property Qt3DRender::QPhongAlphaMaterial::ambient
-
- Holds the ambient color.
-*/
-QColor QPhongAlphaMaterial::ambient() const
-{
- Q_D(const QPhongAlphaMaterial);
- return d->m_ambientParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QPhongAlphaMaterial::diffuse
-
- Holds the diffuse color.
-*/
-QColor QPhongAlphaMaterial::diffuse() const
-{
- Q_D(const QPhongAlphaMaterial);
- return d->m_diffuseParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QPhongAlphaMaterial::specular
-
- Holds the specular color.
-*/
-QColor QPhongAlphaMaterial::specular() const
-{
- Q_D(const QPhongAlphaMaterial);
- return d->m_specularParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QPhongAlphaMaterial::shininess
-
- Holds the shininess exponent.
-*/
-float QPhongAlphaMaterial::shininess() const
-{
- Q_D(const QPhongAlphaMaterial);
- return d->m_shininessParameter->value().toFloat();
-}
-
-/*!
- \property Qt3DRender::QPhongAlphaMaterial::alpha
-
- Holds the alpha component of the object which varies between 0 and 1.
-
- \note: default value is 0.5f
-*/
-float QPhongAlphaMaterial::alpha() const
-{
- Q_D(const QPhongAlphaMaterial);
- return d->m_alphaParameter->value().toFloat();
-}
-
-void QPhongAlphaMaterial::setAmbient(const QColor &ambient)
-{
- Q_D(QPhongAlphaMaterial);
- d->m_ambientParameter->setValue(ambient);
-}
-
-void QPhongAlphaMaterial::setDiffuse(const QColor &diffuse)
-{
- Q_D(QPhongAlphaMaterial);
- d->m_diffuseParameter->setValue(diffuse);
-}
-
-void QPhongAlphaMaterial::setSpecular(const QColor &specular)
-{
- Q_D(QPhongAlphaMaterial);
- d->m_specularParameter->setValue(specular);
-}
-
-void QPhongAlphaMaterial::setShininess(float shininess)
-{
- Q_D(QPhongAlphaMaterial);
- d->m_shininessParameter->setValue(shininess);
-}
-
-void QPhongAlphaMaterial::setAlpha(float alpha)
-{
- Q_D(QPhongAlphaMaterial);
- d->m_alphaParameter->setValue(alpha);
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qphongalphamaterial.h b/src/render/defaults/qphongalphamaterial.h
deleted file mode 100644
index 263ca344e..000000000
--- a/src/render/defaults/qphongalphamaterial.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QPHONGALPHAMATERIAL_H
-#define QT3DRENDER_RENDER_QPHONGALPHAMATERIAL_H
-
-#include <Qt3DRender/qmaterial.h>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QPhongAlphaMaterialPrivate;
-
-class QT3DRENDERSHARED_EXPORT QPhongAlphaMaterial : public QMaterial
-{
- Q_OBJECT
- Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
- Q_PROPERTY(QColor diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
- Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
- Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
- Q_PROPERTY(float alpha READ alpha WRITE setAlpha NOTIFY alphaChanged)
-
-public:
- explicit QPhongAlphaMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QPhongAlphaMaterial();
-
- QColor ambient() const;
- QColor diffuse() const;
- QColor specular() const;
- float shininess() const;
- float alpha() const;
-
-public Q_SLOTS:
- void setAmbient(const QColor &ambient);
- void setDiffuse(const QColor &diffuse);
- void setSpecular(const QColor &specular);
- void setShininess(float shininess);
- void setAlpha(float alpha);
-
-Q_SIGNALS:
- void ambientChanged(const QColor &ambient);
- void diffuseChanged(const QColor &diffuse);
- void specularChanged(const QColor &specular);
- void shininessChanged(float shininess);
- void alphaChanged(float alpha);
-
-private:
- Q_DECLARE_PRIVATE(QPhongAlphaMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QPHONGALPHAMATERIAL_H
diff --git a/src/render/defaults/qphongalphamaterial_p.h b/src/render/defaults/qphongalphamaterial_p.h
deleted file mode 100644
index 10c9092b1..000000000
--- a/src/render/defaults/qphongalphamaterial_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QPHONGALPHAMATERIAL_P_H
-#define QT3DRENDER_RENDER_QPHONGALPHAMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QEffect;
-class QTechnique;
-class QParameter;
-class QShaderProgram;
-class QRenderPass;
-class QParameterMapping;
-class QDepthMask;
-class QBlendState;
-class QBlendEquation;
-
-class QPhongAlphaMaterial;
-
-class QPhongAlphaMaterialPrivate : public QMaterialPrivate
-{
-public:
- QPhongAlphaMaterialPrivate();
-
- void init();
-
- void handleAmbientChanged(const QVariant &var);
- void handleDiffuseChanged(const QVariant &var);
- void handleSpecularChanged(const QVariant &var);
- void handleShininessChanged(const QVariant &var);
- void handleAlphaChanged(const QVariant &var);
-
- QEffect *m_phongEffect;
- QParameter *m_ambientParameter;
- QParameter *m_diffuseParameter;
- QParameter *m_specularParameter;
- QParameter *m_shininessParameter;
- QParameter *m_alphaParameter;
- QTechnique *m_phongAlphaGL3Technique;
- QTechnique *m_phongAlphaGL2Technique;
- QTechnique *m_phongAlphaES2Technique;
- QRenderPass *m_phongAlphaGL3RenderPass;
- QRenderPass *m_phongAlphaGL2RenderPass;
- QRenderPass *m_phongAlphaES2RenderPass;
- QShaderProgram *m_phongAlphaGL3Shader;
- QShaderProgram *m_phongAlphaGL2ES2Shader;
- QDepthMask *m_depthMask;
- QBlendState *m_blendState;
- QBlendEquation *m_blendEquation;
-
- Q_DECLARE_PUBLIC(QPhongAlphaMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QPHONGALPHAMATERIAL_P_H
-
diff --git a/src/render/defaults/qphongmaterial.cpp b/src/render/defaults/qphongmaterial.cpp
deleted file mode 100644
index 5eed76282..000000000
--- a/src/render/defaults/qphongmaterial.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qphongmaterial.h"
-#include "qphongmaterial_p.h"
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qshaderprogram.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <QUrl>
-#include <QVector3D>
-#include <QVector4D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QPhongMaterialPrivate::QPhongMaterialPrivate()
- : QMaterialPrivate()
- , m_phongEffect(new QEffect())
- , m_ambientParameter(new QParameter(QStringLiteral("ka"), QColor::fromRgbF(0.05f, 0.05f, 0.05f, 1.0f)))
- , m_diffuseParameter(new QParameter(QStringLiteral("kd"), QColor::fromRgbF(0.7f, 0.7f, 0.7f, 1.0f)))
- , m_specularParameter(new QParameter(QStringLiteral("ks"), QColor::fromRgbF(0.01f, 0.01f, 0.01f, 1.0f)))
- , m_shininessParameter(new QParameter(QStringLiteral("shininess"), 150.0f))
- , m_phongGL3Technique(new QTechnique())
- , m_phongGL2Technique(new QTechnique())
- , m_phongES2Technique(new QTechnique())
- , m_phongGL3RenderPass(new QRenderPass())
- , m_phongGL2RenderPass(new QRenderPass())
- , m_phongES2RenderPass(new QRenderPass())
- , m_phongGL3Shader(new QShaderProgram())
- , m_phongGL2ES2Shader(new QShaderProgram())
-{
-}
-
-// TODO: Define how lights are properties are set in the shaders. Ideally using a QShaderData
-void QPhongMaterialPrivate::init()
-{
- connect(m_ambientParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongMaterialPrivate::handleAmbientChanged);
- connect(m_diffuseParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongMaterialPrivate::handleDiffuseChanged);
- connect(m_specularParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongMaterialPrivate::handleSpecularChanged);
- connect(m_shininessParameter, &Qt3DRender::QParameter::valueChanged,
- this, &QPhongMaterialPrivate::handleShininessChanged);
-
- m_phongGL3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/phong.vert"))));
- m_phongGL3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/phong.frag"))));
- m_phongGL2ES2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/phong.vert"))));
- m_phongGL2ES2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/phong.frag"))));
-
- m_phongGL3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_phongGL3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_phongGL3Technique->graphicsApiFilter()->setMinorVersion(1);
- m_phongGL3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_phongGL2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_phongGL2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_phongGL2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_phongGL2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_phongES2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_phongES2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_phongES2Technique->graphicsApiFilter()->setMinorVersion(0);
- m_phongES2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_phongGL3RenderPass->setShaderProgram(m_phongGL3Shader);
- m_phongGL2RenderPass->setShaderProgram(m_phongGL2ES2Shader);
- m_phongES2RenderPass->setShaderProgram(m_phongGL2ES2Shader);
-
- m_phongGL3Technique->addPass(m_phongGL3RenderPass);
- m_phongGL2Technique->addPass(m_phongGL2RenderPass);
- m_phongES2Technique->addPass(m_phongES2RenderPass);
-
- m_phongEffect->addTechnique(m_phongGL3Technique);
- m_phongEffect->addTechnique(m_phongGL2Technique);
- m_phongEffect->addTechnique(m_phongES2Technique);
-
- m_phongEffect->addParameter(m_ambientParameter);
- m_phongEffect->addParameter(m_diffuseParameter);
- m_phongEffect->addParameter(m_specularParameter);
- m_phongEffect->addParameter(m_shininessParameter);
-
- q_func()->setEffect(m_phongEffect);
-}
-
-void QPhongMaterialPrivate::handleAmbientChanged(const QVariant &var)
-{
- Q_Q(QPhongMaterial);
- emit q->ambientChanged(var.value<QColor>());
-}
-
-void QPhongMaterialPrivate::handleDiffuseChanged(const QVariant &var)
-{
- Q_Q(QPhongMaterial);
- emit q->diffuseChanged(var.value<QColor>());
-}
-
-void QPhongMaterialPrivate::handleSpecularChanged(const QVariant &var)
-{
- Q_Q(QPhongMaterial);
- emit q->specularChanged(var.value<QColor>());
-}
-
-void QPhongMaterialPrivate::handleShininessChanged(const QVariant &var)
-{
- Q_Q(QPhongMaterial);
- emit q->shininessChanged(var.toFloat());
-}
-
-/*!
- \class Qt3DRender::QPhongMaterial
- \brief The QPhongMaterial class provides a default implementation of the phong lighting effect.
- \inmodule Qt3DRender
- \since 5.5
-
- The phong lighting effect is based on the combination of 3 lighting components ambient, diffuse and specular.
- The relative strengths of these components is controlled by means of their reflectivity coefficients which are modelled as RGB triplets:
-
- \list
- \li Ambient is the color that is emitted by an object without any other light source.
- \li Diffuse is the color that is emitted for rought surface reflections with the lights.
- \li Specular is the color emitted for shiny surface reflections with the lights.
- \li The shininess of a surface is controlled by a float property.
- \endlist
-
- This material uses an effect with a single render pass approach and performs per fragment lighting.
- Techniques are provided for OpenGL 2, OpenGL 3 or above as well as OpenGL ES 2.
-*/
-
-/*!
- \fn Qt3DRender::QPhongMaterial::QPhongMaterial(Qt3DCore::QNode *parent)
-
- Constructs a new QPhongMaterial instance with parent object \a parent.
-*/
-QPhongMaterial::QPhongMaterial(QNode *parent)
- : QMaterial(*new QPhongMaterialPrivate, parent)
-{
- Q_D(QPhongMaterial);
- d->init();
-}
-
-/*!
- \fn Qt3DRender::QPhongMaterial::~QPhongMaterial()
-
- Destroys the QPhongMaterial.
-*/
-QPhongMaterial::~QPhongMaterial()
-{
-}
-
-/*!
- \property Qt3DRender::QPhongMaterial::ambient
-
- Holds the ambient color.
-*/
-QColor QPhongMaterial::ambient() const
-{
- Q_D(const QPhongMaterial);
- return d->m_ambientParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QPhongMaterial::diffuse
-
- Holds the diffuse color.
-*/
-QColor QPhongMaterial::diffuse() const
-{
- Q_D(const QPhongMaterial);
- return d->m_diffuseParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QPhongMaterial::specular
-
- Holds the specular color.
-*/
-QColor QPhongMaterial::specular() const
-{
- Q_D(const QPhongMaterial);
- return d->m_specularParameter->value().value<QColor>();
-}
-
-/*!
- \property Qt3DRender::QPhongMaterial::shininess
-
- Holds the shininess exponent.
-*/
-float QPhongMaterial::shininess() const
-{
- Q_D(const QPhongMaterial);
- return d->m_shininessParameter->value().toFloat();
-}
-
-void QPhongMaterial::setAmbient(const QColor &ambient)
-{
- Q_D(QPhongMaterial);
- d->m_ambientParameter->setValue(ambient);
-}
-
-void QPhongMaterial::setDiffuse(const QColor &diffuse)
-{
- Q_D(QPhongMaterial);
- d->m_diffuseParameter->setValue(diffuse);
-}
-
-void QPhongMaterial::setSpecular(const QColor &specular)
-{
- Q_D(QPhongMaterial);
- d->m_specularParameter->setValue(specular);
-}
-
-void QPhongMaterial::setShininess(float shininess)
-{
- Q_D(QPhongMaterial);
- d->m_shininessParameter->setValue(shininess);
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qphongmaterial.h b/src/render/defaults/qphongmaterial.h
deleted file mode 100644
index 2c1dfcfc5..000000000
--- a/src/render/defaults/qphongmaterial.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QPHONGMATERIAL_H
-#define QT3DRENDER_RENDER_QPHONGMATERIAL_H
-
-#include <Qt3DRender/qmaterial.h>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QPhongMaterialPrivate;
-
-class QT3DRENDERSHARED_EXPORT QPhongMaterial : public QMaterial
-{
- Q_OBJECT
- Q_PROPERTY(QColor ambient READ ambient WRITE setAmbient NOTIFY ambientChanged)
- Q_PROPERTY(QColor diffuse READ diffuse WRITE setDiffuse NOTIFY diffuseChanged)
- Q_PROPERTY(QColor specular READ specular WRITE setSpecular NOTIFY specularChanged)
- Q_PROPERTY(float shininess READ shininess WRITE setShininess NOTIFY shininessChanged)
-
-public:
- explicit QPhongMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QPhongMaterial();
-
- QColor ambient() const;
- QColor diffuse() const;
- QColor specular() const;
- float shininess() const;
-
-public Q_SLOTS:
- void setAmbient(const QColor &ambient);
- void setDiffuse(const QColor &diffuse);
- void setSpecular(const QColor &specular);
- void setShininess(float shininess);
-
-Q_SIGNALS:
- void ambientChanged(const QColor &ambient);
- void diffuseChanged(const QColor &diffuse);
- void specularChanged(const QColor &specular);
- void shininessChanged(float shininess);
-
-private:
- Q_DECLARE_PRIVATE(QPhongMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QPHONGMATERIAL_H
diff --git a/src/render/defaults/qphongmaterial_p.h b/src/render/defaults/qphongmaterial_p.h
deleted file mode 100644
index 91892af64..000000000
--- a/src/render/defaults/qphongmaterial_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QPHONGMATERIAL_P_H
-#define QT3DRENDER_RENDER_QPHONGMATERIAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qmaterial_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QEffect;
-class QTechnique;
-class QParameter;
-class QShaderProgram;
-class QRenderPass;
-class QParameterMapping;
-
-class QPhongMaterial;
-
-class QPhongMaterialPrivate : public QMaterialPrivate
-{
-public:
- QPhongMaterialPrivate();
-
- void init();
-
- void handleAmbientChanged(const QVariant &var);
- void handleDiffuseChanged(const QVariant &var);
- void handleSpecularChanged(const QVariant &var);
- void handleShininessChanged(const QVariant &var);
-
- QEffect *m_phongEffect;
- QParameter *m_ambientParameter;
- QParameter *m_diffuseParameter;
- QParameter *m_specularParameter;
- QParameter *m_shininessParameter;
- QTechnique *m_phongGL3Technique;
- QTechnique *m_phongGL2Technique;
- QTechnique *m_phongES2Technique;
- QRenderPass *m_phongGL3RenderPass;
- QRenderPass *m_phongGL2RenderPass;
- QRenderPass *m_phongES2RenderPass;
- QShaderProgram *m_phongGL3Shader;
- QShaderProgram *m_phongGL2ES2Shader;
-
- Q_DECLARE_PUBLIC(QPhongMaterial)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QPHONGMATERIAL_P_H
-
diff --git a/src/render/defaults/qskyboxentity.cpp b/src/render/defaults/qskyboxentity.cpp
deleted file mode 100644
index 19ca3388e..000000000
--- a/src/render/defaults/qskyboxentity.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qskyboxentity.h"
-#include "qskyboxentity_p.h"
-
-#include <Qt3DCore/qtransform.h>
-#include <Qt3DRender/qeffect.h>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qmaterial.h>
-#include <Qt3DRender/qcullface.h>
-#include <Qt3DRender/qdepthtest.h>
-#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qtechnique.h>
-#include <Qt3DRender/qcuboidmesh.h>
-#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qgraphicsapifilter.h>
-#include <Qt3DRender/qshaderprogram.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-
-QSkyboxEntityPrivate::QSkyboxEntityPrivate()
- : QEntityPrivate()
- , m_effect(new QEffect())
- , m_material(new QMaterial())
- , m_skyboxTexture(new QTextureCubeMap())
- , m_gl3Shader(new QShaderProgram())
- , m_gl2es2Shader(new QShaderProgram())
- , m_gl2Technique(new QTechnique())
- , m_es2Technique(new QTechnique())
- , m_gl3Technique(new QTechnique())
- , m_gl2RenderPass(new QRenderPass())
- , m_es2RenderPass(new QRenderPass())
- , m_gl3RenderPass(new QRenderPass())
- , m_mesh(new QCuboidMesh())
- , m_transform(new Qt3DCore::QTransform())
- , m_textureParameter(new QParameter(QStringLiteral("skyboxTexture"), m_skyboxTexture))
- , m_posXImage(new QTextureImage())
- , m_posYImage(new QTextureImage())
- , m_posZImage(new QTextureImage())
- , m_negXImage(new QTextureImage())
- , m_negYImage(new QTextureImage())
- , m_negZImage(new QTextureImage())
- , m_extension(QStringLiteral(".png"))
-{
-}
-
-/*!
- * \internal
- */
-void QSkyboxEntityPrivate::init()
-{
- m_gl3Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/skybox.vert"))));
- m_gl3Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/gl3/skybox.frag"))));
- m_gl2es2Shader->setVertexShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/skybox.vert"))));
- m_gl2es2Shader->setFragmentShaderCode(QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/shaders/es2/skybox.frag"))));
-
- m_gl3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_gl3Technique->graphicsApiFilter()->setMajorVersion(3);
- m_gl3Technique->graphicsApiFilter()->setMajorVersion(1);
- m_gl3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile);
-
- m_gl2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL);
- m_gl2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_gl2Technique->graphicsApiFilter()->setMajorVersion(0);
- m_gl2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_es2Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGLES);
- m_es2Technique->graphicsApiFilter()->setMajorVersion(2);
- m_es2Technique->graphicsApiFilter()->setMajorVersion(0);
- m_es2Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::NoProfile);
-
- m_gl3RenderPass->setShaderProgram(m_gl3Shader);
- m_gl2RenderPass->setShaderProgram(m_gl2es2Shader);
- m_es2RenderPass->setShaderProgram(m_gl2es2Shader);
-
- QCullFace *cullFront = new QCullFace();
- cullFront->setMode(QCullFace::Front);
- QDepthTest *depthTest = new QDepthTest();
- depthTest->setFunc(QDepthTest::LessOrEqual);
-
- m_gl3RenderPass->addRenderState(cullFront);
- m_gl3RenderPass->addRenderState(depthTest);
- m_gl2RenderPass->addRenderState(cullFront);
- m_gl2RenderPass->addRenderState(depthTest);
- m_es2RenderPass->addRenderState(cullFront);
- m_es2RenderPass->addRenderState(depthTest);
-
- m_gl3Technique->addPass(m_gl3RenderPass);
- m_gl2Technique->addPass(m_gl2RenderPass);
- m_es2Technique->addPass(m_es2RenderPass);
-
- m_effect->addTechnique(m_gl3Technique);
- m_effect->addTechnique(m_gl2Technique);
- m_effect->addTechnique(m_es2Technique);
-
- m_material->setEffect(m_effect);
- m_material->addParameter(m_textureParameter);
-
- m_mesh->setXYMeshResolution(QSize(2, 2));
- m_mesh->setXZMeshResolution(QSize(2, 2));
- m_mesh->setYZMeshResolution(QSize(2, 2));
-
- m_posXImage->setCubeMapFace(QTextureCubeMap::CubeMapPositiveX);
- m_posYImage->setCubeMapFace(QTextureCubeMap::CubeMapPositiveY);
- m_posZImage->setCubeMapFace(QTextureCubeMap::CubeMapPositiveZ);
- m_negXImage->setCubeMapFace(QTextureCubeMap::CubeMapNegativeX);
- m_negYImage->setCubeMapFace(QTextureCubeMap::CubeMapNegativeY);
- m_negZImage->setCubeMapFace(QTextureCubeMap::CubeMapNegativeZ);
-
- m_skyboxTexture->setMagnificationFilter(QTextureCubeMap::Linear);
- m_skyboxTexture->setMinificationFilter(QTextureCubeMap::Linear);
- m_skyboxTexture->setGenerateMipMaps(false);
- m_skyboxTexture->setWrapMode(QTextureWrapMode(QTextureWrapMode::ClampToEdge));
-
- m_skyboxTexture->addTextureImage(m_posXImage);
- m_skyboxTexture->addTextureImage(m_posYImage);
- m_skyboxTexture->addTextureImage(m_posZImage);
- m_skyboxTexture->addTextureImage(m_negXImage);
- m_skyboxTexture->addTextureImage(m_negYImage);
- m_skyboxTexture->addTextureImage(m_negZImage);
-
- q_func()->addComponent(m_mesh);
- q_func()->addComponent(m_material);
- q_func()->addComponent(m_transform);
-}
-
-/*!
- * \internal
- */
-void QSkyboxEntityPrivate::reloadTexture()
-{
- m_posXImage->setSource(QUrl(m_baseName + QStringLiteral("_posx") + m_extension));
- m_posYImage->setSource(QUrl(m_baseName + QStringLiteral("_posy") + m_extension));
- m_posZImage->setSource(QUrl(m_baseName + QStringLiteral("_posz") + m_extension));
- m_negXImage->setSource(QUrl(m_baseName + QStringLiteral("_negx") + m_extension));
- m_negYImage->setSource(QUrl(m_baseName + QStringLiteral("_negy") + m_extension));
- m_negZImage->setSource(QUrl(m_baseName + QStringLiteral("_negz") + m_extension));
-}
-
-/*!
- * \class Qt3DRender::QSkyboxEntity
- * \inmodule Qt3DRender
- *
- * \brief Qt3DRender::QSkyboxEntity is a convenience Qt3DCore::QEntity subclass that can
- * be used to insert a skybox in a 3D scene.
- *
- * By specifying a base name and an extension, Qt3DCore::QSkyboxEntity
- * will take care of building a TextureCubeMap to be rendered at runtime. The
- * images in the source directory should match the pattern:
- * \b base name + * "_posx|_posy|_posz|_negx|_negy|_negz" + extension
- *
- * By default the extension defaults to .png.
- *
- * \note Please note that you shouldn't try to render skybox with an
- * orthographic projection.
- *
- * \since 5.5
- */
-
-/*!
- * Constructs a new Qt3DCore::QSkyboxEntity object with \a parent as parent.
- */
-QSkyboxEntity::QSkyboxEntity(QNode *parent)
- : QEntity(*new QSkyboxEntityPrivate, parent)
-{
- d_func()->init();
-}
-
-QSkyboxEntity::~QSkyboxEntity()
-{
- QNode::cleanup();
-}
-
-/*!
- * Sets the base name to \a baseName.
- */
-void QSkyboxEntity::setBaseName(const QString &baseName)
-{
- Q_D(QSkyboxEntity);
- if (baseName != d->m_baseName) {
- d->m_baseName = baseName;
- emit sourceDirectoryChanged(baseName);
- d->reloadTexture();
- }
-}
-/*!
- * Returns the base name.
- */
-QString QSkyboxEntity::baseName() const
-{
- Q_D(const QSkyboxEntity);
- return d->m_baseName;
-}
-
-/*!
- * Sets the extension to \a extension.
- */
-void QSkyboxEntity::setExtension(const QString &extension)
-{
- Q_D(QSkyboxEntity);
- if (extension != d->m_extension) {
- d->m_extension = extension;
- emit extensionChanged(extension);
- d->reloadTexture();
- }
-}
-
-/*!
- * Returns the extension
- */
-QString QSkyboxEntity::extension() const
-{
- Q_D(const QSkyboxEntity);
- return d->m_extension;
-}
-
-/*!
- * Sets the camera position to \a cameraPosition.
- */
-void QSkyboxEntity::setCameraPosition(const QVector3D &cameraPosition)
-{
- Q_D(QSkyboxEntity);
- if (cameraPosition != d->m_position) {
- d->m_position = cameraPosition;
- d->m_transform->setTranslation(d->m_position);
- emit cameraPositionChanged(cameraPosition);
- }
-}
-
-/*!
- * Returns the camera postion.
- */
-QVector3D QSkyboxEntity::cameraPosition() const
-{
- Q_D(const QSkyboxEntity);
- return d->m_position;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/defaults/qskyboxentity.h b/src/render/defaults/qskyboxentity.h
deleted file mode 100644
index 935710d2a..000000000
--- a/src/render/defaults/qskyboxentity.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QSKYBOXENTITY_H
-#define QT3DRENDER_RENDER_QSKYBOXENTITY_H
-
-#include <Qt3DCore/qentity.h>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QSkyboxEntityPrivate;
-
-class QT3DRENDERSHARED_EXPORT QSkyboxEntity : public Qt3DCore::QEntity
-{
- Q_OBJECT
-public:
- explicit QSkyboxEntity(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QSkyboxEntity();
-
- void setBaseName(const QString &path);
- QString baseName() const;
-
- void setExtension(const QString &extension);
- QString extension() const;
-
- void setCameraPosition(const QVector3D &cameraPosition);
- QVector3D cameraPosition() const;
-
-Q_SIGNALS:
- void sourceDirectoryChanged(const QString &path);
- void extensionChanged(const QString &extension);
- void cameraPositionChanged(const QVector3D &cameraPosition);
-
-private:
- Q_DECLARE_PRIVATE(QSkyboxEntity)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QSKYBOXENTITY_H
diff --git a/src/render/defaults/qskyboxentity_p.h b/src/render/defaults/qskyboxentity_p.h
deleted file mode 100644
index 6af4be384..000000000
--- a/src/render/defaults/qskyboxentity_p.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_QSKYBOXENTITY_P_H
-#define QT3DRENDER_RENDER_QSKYBOXENTITY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/private/qentity_p.h>
-#include <QVector3D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-class QTransform;
-}
-
-namespace Qt3DRender {
-
-class QTextureCubeMap;
-class QShaderProgram;
-class QSkyboxEntity;
-class QTextureImage;
-class QCuboidMesh;
-class QRenderPass;
-class QTechnique;
-class QParameter;
-class QMaterial;
-class QEffect;
-
-class QSkyboxEntityPrivate : public Qt3DCore::QEntityPrivate
-{
- QSkyboxEntityPrivate();
-
- void init();
- void reloadTexture();
-
- Q_DECLARE_PUBLIC(QSkyboxEntity)
-
- QEffect *m_effect;
- QMaterial *m_material;
- QTextureCubeMap *m_skyboxTexture;
- QShaderProgram *m_gl3Shader;
- QShaderProgram *m_gl2es2Shader;
- QTechnique *m_gl2Technique;
- QTechnique *m_es2Technique;
- QTechnique *m_gl3Technique;
- QRenderPass *m_gl2RenderPass;
- QRenderPass *m_es2RenderPass;
- QRenderPass *m_gl3RenderPass;
- QCuboidMesh *m_mesh;
- Qt3DCore::QTransform *m_transform;
- QParameter *m_textureParameter;
- QTextureImage *m_posXImage;
- QTextureImage *m_posYImage;
- QTextureImage *m_posZImage;
- QTextureImage *m_negXImage;
- QTextureImage *m_negYImage;
- QTextureImage *m_negZImage;
- QString m_extension;
- QString m_baseName;
- QVector3D m_position;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_QSKYBOXENTITY_P_H
-
diff --git a/src/render/framegraph/cameraselectornode.cpp b/src/render/framegraph/cameraselectornode.cpp
index 0193419b6..e21fdf02c 100644
--- a/src/render/framegraph/cameraselectornode.cpp
+++ b/src/render/framegraph/cameraselectornode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,7 +42,7 @@
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/private/renderlogging_p.h>
QT_BEGIN_NAMESPACE
@@ -54,25 +57,24 @@ CameraSelector::CameraSelector()
{
}
-void CameraSelector::updateFromPeer(Qt3DCore::QNode *peer)
+void CameraSelector::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QCameraSelector *selector = static_cast<QCameraSelector *>(peer);
- m_cameraUuid = QNodeId();
- if (selector->camera() != Q_NULLPTR)
- m_cameraUuid = selector->camera()->id();
- setEnabled(selector->isEnabled());
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QCameraSelectorData>>(change);
+ const auto &data = typedChange->data;
+ m_cameraUuid = data.cameraId;
}
void CameraSelector::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
qCDebug(Render::Framegraph) << Q_FUNC_INFO;
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("camera"))
m_cameraUuid = propertyChange->value().value<QNodeId>();
- else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
+ markDirty(AbstractRenderer::AllDirty);
}
+ FrameGraphNode::sceneChangeEvent(e);
}
QNodeId CameraSelector::cameraUuid() const
diff --git a/src/render/framegraph/cameraselectornode_p.h b/src/render/framegraph/cameraselectornode_p.h
index 32f243135..e20d0cf8e 100644
--- a/src/render/framegraph/cameraselectornode_p.h
+++ b/src/render/framegraph/cameraselectornode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,7 +52,6 @@
//
#include <Qt3DRender/private/framegraphnode_p.h>
-#include <Qt3DCore/qnodeid.h>
QT_BEGIN_NAMESPACE
@@ -67,12 +69,12 @@ class CameraSelector : public FrameGraphNode
public:
CameraSelector();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
Qt3DCore::QNodeId cameraUuid() const;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
Qt3DCore::QNodeId m_cameraUuid;
};
diff --git a/src/render/framegraph/clearbuffer.cpp b/src/render/framegraph/clearbuffer.cpp
deleted file mode 100644
index c04da0fd0..000000000
--- a/src/render/framegraph/clearbuffer.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "clearbuffer_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-namespace Render {
-
-ClearBuffer::ClearBuffer()
- : FrameGraphNode(FrameGraphNode::ClearBuffer)
- , m_type(QClearBuffer::None)
-{
-}
-
-void ClearBuffer::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QClearBuffer *clearBuffer = static_cast<QClearBuffer *>(peer);
- m_type = clearBuffer->buffers();
- setEnabled(clearBuffer->isEnabled());
-}
-
-void ClearBuffer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("buffers"))
- m_type = static_cast<QClearBuffer::BufferType>(propertyChange->value().toInt());
- else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
- }
-}
-
-QClearBuffer::BufferType ClearBuffer::type() const
-{
- return m_type;
-}
-
-} // namespace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/clearbuffer_p.h b/src/render/framegraph/clearbuffer_p.h
deleted file mode 100644
index f14b476c6..000000000
--- a/src/render/framegraph/clearbuffer_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_CLEARBUFFER_P_H
-#define QT3DRENDER_RENDER_CLEARBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/framegraphnode_p.h>
-#include <Qt3DRender/qclearbuffer.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-class FrameGraphManager;
-
-class ClearBuffer : public FrameGraphNode
-{
-public:
- ClearBuffer();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- QClearBuffer::BufferType type() const;
-
-private:
- QClearBuffer::BufferType m_type;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_CLEARBUFFER_P_H
diff --git a/src/render/framegraph/clearbuffers.cpp b/src/render/framegraph/clearbuffers.cpp
new file mode 100644
index 000000000..d730123c3
--- /dev/null
+++ b/src/render/framegraph/clearbuffers.cpp
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "clearbuffers_p.h"
+#include <Qt3DRender/private/qclearbuffers_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+static QVector4D vec4dFromColor(const QColor &color)
+{
+ return QVector4D(color.redF(), color.greenF(), color.blueF(), color.alphaF());
+}
+
+ClearBuffers::ClearBuffers()
+ : FrameGraphNode(FrameGraphNode::ClearBuffers)
+ , m_type(QClearBuffers::None)
+ , m_clearDepthValue(1.f)
+ , m_clearStencilValue(0)
+{
+}
+
+void ClearBuffers::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QClearBuffersData>>(change);
+ const auto &data = typedChange->data;
+ m_type = data.buffersType;
+ m_clearColorAsColor = data.clearColor;
+ m_clearColor = vec4dFromColor(m_clearColorAsColor);
+ m_clearDepthValue = data.clearDepthValue;
+ m_clearStencilValue = data.clearStencilValue;
+ m_colorBufferId = data.bufferId;
+}
+
+void ClearBuffers::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("buffers")) {
+ m_type = static_cast<QClearBuffers::BufferType>(propertyChange->value().toInt());
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("clearColor")) {
+ m_clearColorAsColor = propertyChange->value().value<QColor>();
+ m_clearColor = vec4dFromColor(m_clearColorAsColor);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("clearDepthValue")) {
+ m_clearDepthValue = propertyChange->value().toFloat();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("clearStencilValue")) {
+ m_clearStencilValue = propertyChange->value().toInt();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("colorBuffer")) {
+ m_colorBufferId = propertyChange->value().value<QNodeId>();
+ }
+ markDirty(AbstractRenderer::AllDirty);
+ }
+ FrameGraphNode::sceneChangeEvent(e);
+}
+
+QClearBuffers::BufferType ClearBuffers::type() const
+{
+ return m_type;
+}
+
+QColor ClearBuffers::clearColorAsColor() const
+{
+ return m_clearColorAsColor;
+}
+
+QVector4D ClearBuffers::clearColor() const
+{
+ return m_clearColor;
+}
+
+float ClearBuffers::clearDepthValue() const
+{
+ return m_clearDepthValue;
+}
+
+int ClearBuffers::clearStencilValue() const
+{
+ return m_clearStencilValue;
+}
+
+Qt3DCore::QNodeId ClearBuffers::bufferId() const
+{
+ return m_colorBufferId;
+}
+
+bool ClearBuffers::clearsAllColorBuffers() const
+{
+ return m_colorBufferId.isNull();
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/clearbuffers_p.h b/src/render/framegraph/clearbuffers_p.h
new file mode 100644
index 000000000..e25860b03
--- /dev/null
+++ b/src/render/framegraph/clearbuffers_p.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_CLEARBUFFERS_P_H
+#define QT3DRENDER_RENDER_CLEARBUFFERS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/framegraphnode_p.h>
+#include <Qt3DRender/qclearbuffers.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class FrameGraphManager;
+
+class ClearBuffers : public FrameGraphNode
+{
+public:
+ ClearBuffers();
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ QClearBuffers::BufferType type() const;
+ float clearDepthValue() const;
+ int clearStencilValue() const;
+ Qt3DCore::QNodeId bufferId() const;
+
+ // in the backend we store this as a QVector4D, as the clearBuffer
+ // functions do support all float values (also those not clamped to [0,1])
+ // (for non-clamped float or int buffer types)
+ // we don't support this in the frontend yet, but let's keep our options for now
+ // and avoid QColor->QVector4D conversion every frame.
+ QVector4D clearColor() const;
+
+ // some clear operations only accept clamped values
+ QColor clearColorAsColor() const;
+
+ bool clearsAllColorBuffers() const;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QClearBuffers::BufferType m_type;
+ QVector4D m_clearColor;
+ QColor m_clearColorAsColor;
+ float m_clearDepthValue;
+ int m_clearStencilValue;
+ Qt3DCore::QNodeId m_colorBufferId;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_CLEARBUFFERS_P_H
diff --git a/src/render/framegraph/dispatchcompute.cpp b/src/render/framegraph/dispatchcompute.cpp
index 3197a1d4a..6ffb42e71 100644
--- a/src/render/framegraph/dispatchcompute.cpp
+++ b/src/render/framegraph/dispatchcompute.cpp
@@ -1,41 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "dispatchcompute_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/private/qdispatchcompute_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -62,27 +66,29 @@ void DispatchCompute::cleanup()
m_workGroups[2] = 1;
}
-void DispatchCompute::updateFromPeer(Qt3DCore::QNode *peer)
+void DispatchCompute::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QDispatchCompute *computeDispatch = static_cast<QDispatchCompute *>(peer);
- m_workGroups[0] = computeDispatch->workGroupX();
- m_workGroups[1] = computeDispatch->workGroupY();
- m_workGroups[2] = computeDispatch->workGroupZ();
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QDispatchComputeData>>(change);
+ const auto &data = typedChange->data;
+ m_workGroups[0] = data.workGroupX;
+ m_workGroups[1] = data.workGroupY;
+ m_workGroups[2] = data.workGroupZ;
}
void DispatchCompute::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- if (e->type() == Qt3DCore::NodeUpdated) {
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("workGroupX"))
m_workGroups[0] = propertyChange->value().toInt();
else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupY"))
m_workGroups[1] = propertyChange->value().toInt();
else if (propertyChange->propertyName() == QByteArrayLiteral("workGroupZ"))
m_workGroups[2] = propertyChange->value().toInt();
- else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
+ markDirty(AbstractRenderer::AllDirty);
}
+ FrameGraphNode::sceneChangeEvent(e);
}
} // Render
diff --git a/src/render/framegraph/dispatchcompute_p.h b/src/render/framegraph/dispatchcompute_p.h
index 7a90f980a..724bce742 100644
--- a/src/render/framegraph/dispatchcompute_p.h
+++ b/src/render/framegraph/dispatchcompute_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,10 +68,14 @@ public:
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ inline int x() const Q_DECL_NOEXCEPT { return m_workGroups[0]; }
+ inline int y() const Q_DECL_NOEXCEPT { return m_workGroups[1]; }
+ inline int z() const Q_DECL_NOEXCEPT { return m_workGroups[2]; }
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
int m_workGroups[3];
};
diff --git a/src/render/framegraph/framegraph.pri b/src/render/framegraph/framegraph.pri
index 422825629..1e4ca3a60 100644
--- a/src/render/framegraph/framegraph.pri
+++ b/src/render/framegraph/framegraph.pri
@@ -2,22 +2,17 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/cameraselectornode_p.h \
- $$PWD/clearbuffer_p.h \
+ $$PWD/clearbuffers_p.h \
$$PWD/framegraphnode_p.h \
- $$PWD/framegraphsubtreeselector_p.h \
$$PWD/framegraphvisitor_p.h \
$$PWD/layerfilternode_p.h \
$$PWD/nodraw_p.h \
$$PWD/qcameraselector.h \
$$PWD/qcameraselector_p.h \
- $$PWD/qclearbuffer.h \
- $$PWD/qclearbuffer_p.h \
- $$PWD/qframegraph.h \
- $$PWD/qframegraph_p.h \
+ $$PWD/qclearbuffers.h \
+ $$PWD/qclearbuffers_p.h \
$$PWD/qframegraphnode.h \
$$PWD/qframegraphnode_p.h \
- $$PWD/qframegraphselector.h \
- $$PWD/qframegraphselector_p.h \
$$PWD/qlayerfilter.h \
$$PWD/qlayerfilter_p.h \
$$PWD/qnodraw.h \
@@ -25,63 +20,56 @@ HEADERS += \
$$PWD/qrenderpassfilter_p.h \
$$PWD/qrendertargetselector.h \
$$PWD/qrendertargetselector_p.h \
- $$PWD/qsortcriterion.h \
- $$PWD/qsortcriterion_p.h \
- $$PWD/qsortmethod.h \
- $$PWD/qsortmethod_p.h \
- $$PWD/qstateset.h \
- $$PWD/qstateset_p.h \
+ $$PWD/qsortpolicy.h \
+ $$PWD/qsortpolicy_p.h \
+ $$PWD/qrenderstateset.h \
+ $$PWD/qrenderstateset_p.h \
$$PWD/qtechniquefilter.h \
$$PWD/qtechniquefilter_p.h \
$$PWD/qviewport.h \
$$PWD/qviewport_p.h \
$$PWD/renderpassfilternode_p.h \
$$PWD/rendertargetselectornode_p.h \
- $$PWD/sortcriterion_p.h \
- $$PWD/sortmethod_p.h \
+ $$PWD/sortpolicy_p.h \
$$PWD/statesetnode_p.h \
$$PWD/techniquefilternode_p.h \
$$PWD/viewportnode_p.h \
$$PWD/qfrustumculling.h \
$$PWD/frustumculling_p.h \
- $$PWD/qlighting.h \
- $$PWD/qlighting_p.h \
- $$PWD/lighting_p.h \
$$PWD/qdispatchcompute.h \
- $$PWD/dispatchcompute_p.h
+ $$PWD/dispatchcompute_p.h \
+ $$PWD/qrendersurfaceselector.h \
+ $$PWD/qrendersurfaceselector_p.h \
+ $$PWD/rendersurfaceselector_p.h \
+ $$PWD/qdispatchcompute_p.h
SOURCES += \
$$PWD/cameraselectornode.cpp \
- $$PWD/clearbuffer.cpp \
+ $$PWD/clearbuffers.cpp \
$$PWD/framegraphnode.cpp \
- $$PWD/framegraphsubtreeselector.cpp \
$$PWD/framegraphvisitor.cpp \
$$PWD/layerfilternode.cpp \
$$PWD/nodraw.cpp \
$$PWD/qcameraselector.cpp \
- $$PWD/qclearbuffer.cpp \
- $$PWD/qframegraph.cpp \
+ $$PWD/qclearbuffers.cpp \
$$PWD/qframegraphnode.cpp \
- $$PWD/qframegraphselector.cpp \
$$PWD/qlayerfilter.cpp \
$$PWD/qnodraw.cpp \
$$PWD/qrenderpassfilter.cpp \
$$PWD/qrendertargetselector.cpp \
- $$PWD/qsortcriterion.cpp \
- $$PWD/qsortmethod.cpp \
- $$PWD/qstateset.cpp \
+ $$PWD/qsortpolicy.cpp \
+ $$PWD/qrenderstateset.cpp \
$$PWD/qtechniquefilter.cpp \
$$PWD/qviewport.cpp \
$$PWD/renderpassfilternode.cpp \
$$PWD/rendertargetselectornode.cpp \
- $$PWD/sortcriterion.cpp \
- $$PWD/sortmethod.cpp \
+ $$PWD/sortpolicy.cpp \
$$PWD/statesetnode.cpp \
$$PWD/techniquefilternode.cpp \
$$PWD/viewportnode.cpp \
$$PWD/qfrustumculling.cpp \
$$PWD/frustumculling.cpp \
- $$PWD/qlighting.cpp \
- $$PWD/lighting.cpp \
$$PWD/qdispatchcompute.cpp \
- $$PWD/dispatchcompute.cpp
+ $$PWD/dispatchcompute.cpp \
+ $$PWD/qrendersurfaceselector.cpp \
+ $$PWD/rendersurfaceselector.cpp
diff --git a/src/render/framegraph/framegraphnode.cpp b/src/render/framegraph/framegraphnode.cpp
index 1c913b281..23ea95acf 100644
--- a/src/render/framegraph/framegraphnode.cpp
+++ b/src/render/framegraph/framegraphnode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,6 @@
#include "framegraphnode_p.h"
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
-#include <Qt3DRender/qframegraph.h>
QT_BEGIN_NAMESPACE
@@ -45,17 +47,15 @@ namespace Qt3DRender {
namespace Render {
FrameGraphNode::FrameGraphNode()
- : QBackendNode()
+ : BackendNode()
, m_nodeType(InvalidNodeType)
- , m_enabled(true)
- , m_manager(Q_NULLPTR)
+ , m_manager(nullptr)
{
}
FrameGraphNode::FrameGraphNode(FrameGraphNodeType nodeType)
: m_nodeType(nodeType)
- , m_enabled(true)
- , m_manager(Q_NULLPTR)
+ , m_manager(nullptr)
{
}
@@ -63,6 +63,12 @@ FrameGraphNode::~FrameGraphNode()
{
}
+void FrameGraphNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ // Set up the parent child relationship and enabled state
+ setParentId(change->parentId());
+}
+
void FrameGraphNode::setFrameGraphManager(FrameGraphManager *manager)
{
if (m_manager != manager)
@@ -74,106 +80,66 @@ FrameGraphManager *FrameGraphNode::manager() const
return m_manager;
}
-void FrameGraphNode::setHandle(HFrameGraphNode handle)
-{
- m_handle = handle;
-}
-
-void FrameGraphNode::setParentHandle(HFrameGraphNode parentHandle)
+void FrameGraphNode::setParentId(Qt3DCore::QNodeId parentId)
{
- if (m_parentHandle != parentHandle) {
- m_parentHandle = parentHandle;
- FrameGraphNode **parent = m_manager->data(m_parentHandle);
- if (parent != Q_NULLPTR && *parent != Q_NULLPTR && !(*parent)->m_childrenHandles.contains(m_handle))
- (*parent)->m_childrenHandles.append(m_handle);
+ if (m_parentId != parentId) {
+ m_parentId = parentId;
+ FrameGraphNode *parent = m_manager->lookupNode(m_parentId);
+ if (parent != nullptr && !parent->m_childrenIds.contains(peerId()))
+ parent->m_childrenIds.append(peerId());
}
}
-void FrameGraphNode::appendChildHandle(HFrameGraphNode childHandle)
+void FrameGraphNode::appendChildId(Qt3DCore::QNodeId childId)
{
- if (!m_childrenHandles.contains(childHandle)) {
- FrameGraphNode **child = m_manager->data(childHandle);
- if (child != Q_NULLPTR) {
- m_childrenHandles.append(childHandle);
- (*child)->m_parentHandle = m_handle;
+ if (!m_childrenIds.contains(childId)) {
+ FrameGraphNode *child = m_manager->lookupNode(childId);
+ if (child != nullptr) {
+ m_childrenIds.append(childId);
+ child->m_parentId = peerId();
}
}
}
-void FrameGraphNode::removeChildHandle(HFrameGraphNode childHandle)
+void FrameGraphNode::removeChildId(Qt3DCore::QNodeId childId)
{
- if (m_childrenHandles.contains(childHandle)) {
- FrameGraphNode **child = m_manager->data(childHandle);
- if (child != Q_NULLPTR) {
- (*child)->m_parentHandle = HFrameGraphNode();
+ if (m_childrenIds.contains(childId)) {
+ FrameGraphNode *child = m_manager->lookupNode(childId);
+ if (child != nullptr) {
+ child->m_parentId = Qt3DCore::QNodeId();
}
- m_childrenHandles.removeAll(childHandle);
+ m_childrenIds.removeAll(childId);
}
}
-HFrameGraphNode FrameGraphNode::handle() const
+Qt3DCore::QNodeId FrameGraphNode::parentId() const
{
- return m_handle;
+ return m_parentId;
}
-HFrameGraphNode FrameGraphNode::parentHandle() const
+QVector<Qt3DCore::QNodeId> FrameGraphNode::childrenIds() const
{
- return m_parentHandle;
-}
-
-QList<HFrameGraphNode> FrameGraphNode::childrenHandles() const
-{
- return m_childrenHandles;
+ return m_childrenIds;
}
FrameGraphNode *FrameGraphNode::parent() const
{
- FrameGraphNode **parent = m_manager->data(m_parentHandle);
- if (parent != Q_NULLPTR)
- return *parent;
- return Q_NULLPTR;
+ return m_manager->lookupNode(m_parentId);
}
QList<FrameGraphNode *> FrameGraphNode::children() const
{
QList<FrameGraphNode *> children;
- children.reserve(m_childrenHandles.size());
+ children.reserve(m_childrenIds.size());
- Q_FOREACH (HFrameGraphNode handle, m_childrenHandles) {
- FrameGraphNode **child = m_manager->data(handle);
- if (child != Q_NULLPTR)
- children << *child;
+ for (Qt3DCore::QNodeId id : m_childrenIds) {
+ FrameGraphNode *child = m_manager->lookupNode(id);
+ if (child != nullptr)
+ children << child;
}
return children;
}
-// TO DO: We need to rework that and probably add a RenderFrameGraph element
-FrameGraphComponentFunctor::FrameGraphComponentFunctor(AbstractRenderer *renderer)
- : m_renderer(renderer)
-{
-}
-
-Qt3DCore::QBackendNode *FrameGraphComponentFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *) const
-{
- // TO DO: Ideally we should have a RenderFrameGraph component and use its setPeer method
- // to do that
- QFrameGraph *framegraph = static_cast<QFrameGraph *>(frontend);
- if (framegraph->activeFrameGraph() != Q_NULLPTR)
- m_renderer->setFrameGraphRoot(framegraph->activeFrameGraph()->id());
- return Q_NULLPTR;
-}
-
-Qt3DCore::QBackendNode *FrameGraphComponentFunctor::get(const Qt3DCore::QNodeId &id) const
-{
- Q_UNUSED(id);
- return Q_NULLPTR;
-}
-
-void FrameGraphComponentFunctor::destroy(const Qt3DCore::QNodeId &id) const
-{
- Q_UNUSED(id);
-}
-
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/framegraph/framegraphnode_p.h b/src/render/framegraph/framegraphnode_p.h
index 764314438..7aeaa22be 100644
--- a/src/render/framegraph/framegraphnode_p.h
+++ b/src/render/framegraph/framegraphnode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,9 +51,9 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DCore/private/qhandle_p.h>
#include <Qt3DCore/qnode.h>
-#include <Qt3DCore/qbackendnode.h>
#include <Qt3DRender/qframegraphnode.h>
#include <Qt3DRender/private/managers_p.h>
#include <qglobal.h>
@@ -62,7 +65,9 @@ namespace Qt3DRender {
namespace Render {
-class Q_AUTOTEST_EXPORT FrameGraphNode : public Qt3DCore::QBackendNode
+class FrameGraphManager;
+
+class Q_AUTOTEST_EXPORT FrameGraphNode : public BackendNode
{
public:
FrameGraphNode();
@@ -76,113 +81,104 @@ public:
RenderTarget,
TechniqueFilter,
Viewport,
- ClearBuffer,
+ ClearBuffers,
SortMethod,
SubtreeSelector,
StateSet,
NoDraw,
FrustumCulling,
Lighting,
- ComputeDispatch
+ ComputeDispatch,
+ Surface
};
FrameGraphNodeType nodeType() const { return m_nodeType; }
- void setEnabled(bool enabled) { m_enabled = enabled; }
- inline bool isEnabled() const { return m_enabled; }
-
void setFrameGraphManager(FrameGraphManager *manager);
FrameGraphManager *manager() const;
- void setHandle(HFrameGraphNode handle);
- void setParentHandle(HFrameGraphNode parentHandle);
- void appendChildHandle(HFrameGraphNode childHandle);
- void removeChildHandle(HFrameGraphNode childHandle);
+ void setParentId(Qt3DCore::QNodeId parentId);
+ void appendChildId(Qt3DCore::QNodeId childHandle);
+ void removeChildId(Qt3DCore::QNodeId childHandle);
- HFrameGraphNode handle() const;
- HFrameGraphNode parentHandle() const;
- QList<HFrameGraphNode> childrenHandles() const;
+ Qt3DCore::QNodeId parentId() const;
+ QVector<Qt3DCore::QNodeId> childrenIds() const;
FrameGraphNode *parent() const;
QList<FrameGraphNode *> children() const;
protected:
FrameGraphNode(FrameGraphNodeType nodeType);
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_OVERRIDE;
private:
FrameGraphNodeType m_nodeType;
- bool m_enabled;
- HFrameGraphNode m_handle;
- HFrameGraphNode m_parentHandle;
- QList<HFrameGraphNode> m_childrenHandles;
+ Qt3DCore::QNodeId m_parentId;
+ QVector<Qt3DCore::QNodeId> m_childrenIds;
FrameGraphManager *m_manager;
friend class FrameGraphVisitor;
};
template<typename Backend, typename Frontend>
-class FrameGraphNodeFunctor : public Qt3DCore::QBackendNodeFunctor
+class FrameGraphNodeFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit FrameGraphNodeFunctor(FrameGraphManager *manager)
+ explicit FrameGraphNodeFunctor(AbstractRenderer *renderer, FrameGraphManager *manager)
: m_manager(manager)
+ , m_renderer(renderer)
{
}
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE
{
- return createBackendFrameGraphNode(frontend, factory);
+ return createBackendFrameGraphNode(change);
}
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE
{
- FrameGraphNode **node = m_manager->lookupResource(id);
- if (node != Q_NULLPTR)
- return *node;
- return Q_NULLPTR;
+ return m_manager->lookupNode(id);
}
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE
{
- m_manager->releaseResource(id);
+ m_manager->releaseNode(id);
}
protected:
- Backend *createBackendFrameGraphNode(Qt3DCore::QNode *n, const Qt3DCore::QBackendNodeFactory *factory) const
+ Backend *createBackendFrameGraphNode(Qt3DCore::QNode *n) const
{
Frontend *f = qobject_cast<Frontend *>(n);
- if (f != Q_NULLPTR) {
- HFrameGraphNode handle = m_manager->lookupHandle(n->id());
- if (handle.isNull()) {
- handle = m_manager->getOrAcquireHandle(n->id());
+ if (f != nullptr) {
+ if (!m_manager->containsNode(n->id())) {
Backend *backend = new Backend();
- *m_manager->data(handle) = backend;
- backend->setFactory(factory);
backend->setFrameGraphManager(m_manager);
- backend->setHandle(handle);
backend->setPeer(f);
+ backend->setRenderer(m_renderer);
QFrameGraphNode *parentFGNode = static_cast<QFrameGraphNode *>(n)->parentFrameGraphNode();
if (parentFGNode)
- backend->setParentHandle(m_manager->lookupHandle(parentFGNode->id()));
+ backend->setParentId(parentFGNode->id());
+ m_manager->appendNode(backend->peerId(), backend);
return backend;
}
- return static_cast<Backend *>(*m_manager->data(handle));
+ return static_cast<Backend *>(m_manager->lookupNode(n->id()));
}
- return Q_NULLPTR;
+ return nullptr;
}
-private:
- FrameGraphManager *m_manager;
-};
-
-class FrameGraphComponentFunctor : public Qt3DCore::QBackendNodeFunctor
-{
-public:
- explicit FrameGraphComponentFunctor(AbstractRenderer *renderer);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
+ Backend *createBackendFrameGraphNode(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
+ {
+ if (!m_manager->containsNode(change->subjectId())) {
+ Backend *backend = new Backend();
+ backend->setFrameGraphManager(m_manager);
+ backend->setRenderer(m_renderer);
+ m_manager->appendNode(change->subjectId(), backend);
+ return backend;
+ }
+ return static_cast<Backend *>(m_manager->lookupNode(change->subjectId()));
+ }
private:
+ FrameGraphManager *m_manager;
AbstractRenderer *m_renderer;
};
diff --git a/src/render/framegraph/framegraphsubtreeselector.cpp b/src/render/framegraph/framegraphsubtreeselector.cpp
deleted file mode 100644
index 4ff874118..000000000
--- a/src/render/framegraph/framegraphsubtreeselector.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "framegraphsubtreeselector_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-// TO DO: this will be completed once the QServiceLocator is in place
-
-FrameGraphSubtreeSelector::FrameGraphSubtreeSelector()
- : FrameGraphNode(FrameGraphNode::SubtreeSelector)
-{
-}
-
-FrameGraphSubtreeSelector::~FrameGraphSubtreeSelector()
-{
-}
-
-void FrameGraphSubtreeSelector::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QFrameGraphSelector *selector = static_cast<QFrameGraphSelector *>(peer);
- setEnabled(selector->isEnabled());
-}
-
-void FrameGraphSubtreeSelector::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &)
-{
-}
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/framegraphsubtreeselector_p.h b/src/render/framegraph/framegraphsubtreeselector_p.h
deleted file mode 100644
index b06238348..000000000
--- a/src/render/framegraph/framegraphsubtreeselector_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_FRAMEGRAPHSUBTREESELECTOR_H
-#define QT3DRENDER_RENDER_FRAMEGRAPHSUBTREESELECTOR_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/framegraphnode_p.h>
-#include <Qt3DRender/qframegraphselector.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-class FrameGraphSubtreeSelector : public FrameGraphNode
-{
-public:
- FrameGraphSubtreeSelector();
- ~FrameGraphSubtreeSelector();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_FINAL;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_FINAL;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_FRAMEGRAPHSUBTREESELECTOR_H
diff --git a/src/render/framegraph/framegraphvisitor.cpp b/src/render/framegraph/framegraphvisitor.cpp
index 60307469a..7142d8df8 100644
--- a/src/render/framegraph/framegraphvisitor.cpp
+++ b/src/render/framegraph/framegraphvisitor.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,8 +50,8 @@ namespace Qt3DRender {
namespace Render {
FrameGraphVisitor::FrameGraphVisitor()
- : m_renderer(Q_NULLPTR)
- , m_jobs(Q_NULLPTR)
+ : m_renderer(nullptr)
+ , m_jobs(nullptr)
, m_renderviewIndex(0)
{
@@ -68,7 +71,7 @@ void FrameGraphVisitor::traverse(FrameGraphNode *root,
// Kick off the traversal
Render::FrameGraphNode *node = root;
- if (node == Q_NULLPTR)
+ if (node == nullptr)
qCritical() << Q_FUNC_INFO << "FrameGraph is null";
visit(node);
}
@@ -82,12 +85,13 @@ void FrameGraphVisitor::visit(Render::FrameGraphNode *node)
// Recurse to children (if we have any), otherwise if this is a leaf node,
// initiate a rendering from the current camera
- Q_FOREACH (Render::FrameGraphNode *n, node->children())
+ const auto children = node->children();
+ for (Render::FrameGraphNode *n : children)
visit(n);
// Leaf node - create a RenderView ready to be populated
// TODO: Pass in only framegraph config that has changed from previous
// index RenderViewJob.
- if (node->childrenHandles().empty()) {
+ if (node->childrenIds().empty()) {
QAspectJobPtr job = m_renderer->createRenderViewJob(node, m_renderviewIndex++);
m_jobs->append(job);
}
diff --git a/src/render/framegraph/framegraphvisitor_p.h b/src/render/framegraph/framegraphvisitor_p.h
index 66d3292b9..c04d762c9 100644
--- a/src/render/framegraph/framegraphvisitor_p.h
+++ b/src/render/framegraph/framegraphvisitor_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/framegraph/frustumculling.cpp b/src/render/framegraph/frustumculling.cpp
index ccbbbdc3f..9f38d6be9 100644
--- a/src/render/framegraph/frustumculling.cpp
+++ b/src/render/framegraph/frustumculling.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "frustumculling_p.h"
#include <Qt3DRender/qfrustumculling.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -53,27 +56,6 @@ FrustumCulling::~FrustumCulling()
{
}
-void FrustumCulling::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QFrustumCulling *frustumCulling = static_cast<QFrustumCulling *>(peer);
- setEnabled(frustumCulling->isEnabled());
-}
-
-void FrustumCulling::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
-
- switch (e->type()) {
- case Qt3DCore::NodeUpdated: {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
- break;
- default:
- break;
- }
- }
-}
-
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/framegraph/frustumculling_p.h b/src/render/framegraph/frustumculling_p.h
index 1d41d8a99..7f9959c6e 100644
--- a/src/render/framegraph/frustumculling_p.h
+++ b/src/render/framegraph/frustumculling_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,11 +64,6 @@ class FrustumCulling : public FrameGraphNode
public:
FrustumCulling();
~FrustumCulling();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
};
} // namespace Render
diff --git a/src/render/framegraph/layerfilternode.cpp b/src/render/framegraph/layerfilternode.cpp
index 247d795b2..d0c1533aa 100644
--- a/src/render/framegraph/layerfilternode.cpp
+++ b/src/render/framegraph/layerfilternode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,10 @@
#include "layerfilternode_p.h"
#include "qlayerfilter.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/private/qlayerfilter_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -50,32 +56,47 @@ LayerFilterNode::LayerFilterNode()
{
}
-void LayerFilterNode::updateFromPeer(Qt3DCore::QNode *peer)
+void LayerFilterNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QLayerFilter *layerFilter = static_cast<QLayerFilter *>(peer);
- m_layers = layerFilter->layers();
- setEnabled(layerFilter->isEnabled());
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QLayerFilterData>>(change);
+ const auto &data = typedChange->data;
+ setLayerIds(data.layerIds);
}
void LayerFilterNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("layers"))
- setLayers(propertyChange->value().value<QStringList>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
+ switch (e->type()) {
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("layer"))
+ m_layerIds.append(change->addedNodeId());
+ break;
}
+
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("layer"))
+ m_layerIds.remove(change->removedNodeId());
+ break;
+ }
+
+ default:
+ break;
+ }
+ markDirty(AbstractRenderer::AllDirty);
+
+ FrameGraphNode::sceneChangeEvent(e);
}
-QStringList LayerFilterNode::layers() const
+QNodeIdVector LayerFilterNode::layerIds() const Q_DECL_NOEXCEPT
{
- return m_layers;
+ return m_layerIds;
}
-void LayerFilterNode::setLayers(const QStringList &list)
+void LayerFilterNode::setLayerIds(const QNodeIdVector &list)
{
- m_layers = list;
+ m_layerIds = list;
}
} // namespace Render
diff --git a/src/render/framegraph/layerfilternode_p.h b/src/render/framegraph/layerfilternode_p.h
index cff04b13a..029dd7bff 100644
--- a/src/render/framegraph/layerfilternode_p.h
+++ b/src/render/framegraph/layerfilternode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -66,13 +69,14 @@ class LayerFilterNode : public FrameGraphNode
public:
LayerFilterNode();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- QStringList layers() const;
- void setLayers(const QStringList &list);
+ Qt3DCore::QNodeIdVector layerIds() const Q_DECL_NOEXCEPT;
+ void setLayerIds(const Qt3DCore::QNodeIdVector &list);
private:
- QStringList m_layers;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ Qt3DCore::QNodeIdVector m_layerIds;
};
} // namespace Render
diff --git a/src/render/framegraph/lighting.cpp b/src/render/framegraph/lighting.cpp
deleted file mode 100644
index a5f65d2e1..000000000
--- a/src/render/framegraph/lighting.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "lighting_p.h"
-#include <Qt3DRender/qlighting.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-Lighting::Lighting()
- : FrameGraphNode(FrameGraphNode::Lighting)
-{
-}
-
-void Lighting::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QLighting *lighting = static_cast<QLighting *>(peer);
- setEnabled(lighting->isEnabled());
-}
-
-void Lighting::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
-
- switch (e->type()) {
- case Qt3DCore::NodeUpdated:
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
- break;
-
- default:
- break;
- }
-}
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/lighting_p.h b/src/render/framegraph/lighting_p.h
deleted file mode 100644
index fe00cea6b..000000000
--- a/src/render/framegraph/lighting_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_LIGHTING_H
-#define QT3DRENDER_RENDER_LIGHTING_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/framegraphnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-class Lighting : public FrameGraphNode
-{
-public:
- Lighting();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_LIGHTING_H
diff --git a/src/render/framegraph/nodraw.cpp b/src/render/framegraph/nodraw.cpp
index 0d5b6578a..f2020d7ce 100644
--- a/src/render/framegraph/nodraw.cpp
+++ b/src/render/framegraph/nodraw.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "nodraw_p.h"
#include <Qt3DRender/qnodraw.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -54,29 +57,6 @@ NoDraw::~NoDraw()
{
}
-void NoDraw::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QNoDraw *noDraw = static_cast<QNoDraw *>(peer);
- setEnabled(noDraw->isEnabled());
-}
-
-void NoDraw::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
-
- switch (e->type()) {
- case NodeUpdated: {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
- break;
-
- default:
- break;
- }
-
- }
-}
-
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/framegraph/nodraw_p.h b/src/render/framegraph/nodraw_p.h
index 49bd818b6..ae9fa6713 100644
--- a/src/render/framegraph/nodraw_p.h
+++ b/src/render/framegraph/nodraw_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,11 +64,6 @@ class NoDraw : public FrameGraphNode
public:
NoDraw();
~NoDraw();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
};
} // namespace Render
diff --git a/src/render/framegraph/qcameraselector.cpp b/src/render/framegraph/qcameraselector.cpp
index 42bd5d424..7e26fb7a1 100644
--- a/src/render/framegraph/qcameraselector.cpp
+++ b/src/render/framegraph/qcameraselector.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,7 +41,7 @@
#include "qcameraselector_p.h"
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/private/qentity_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -57,25 +60,18 @@ QCameraSelector::QCameraSelector(QCameraSelectorPrivate &dd, QNode *parent)
QCameraSelectorPrivate::QCameraSelectorPrivate()
: QFrameGraphNodePrivate()
- , m_camera(Q_NULLPTR)
-{}
-
-void QCameraSelector::copy(const QNode *ref)
+ , m_camera(nullptr)
{
- QFrameGraphNode::copy(ref);
- const QCameraSelector *other = static_cast<const QCameraSelector*>(ref);
-
- if (other->d_func()->m_camera)
- setCamera(qobject_cast<Qt3DCore::QEntity *>(QNode::clone(other->d_func()->m_camera)));
}
QCameraSelector::QCameraSelector(Qt3DCore::QNode *parent)
: QFrameGraphNode(*new QCameraSelectorPrivate, parent)
-{}
+{
+}
+/*! \internal */
QCameraSelector::~QCameraSelector()
{
- QNode::cleanup();
}
/*!
@@ -103,6 +99,15 @@ Qt3DCore::QEntity *QCameraSelector::camera() const
return d->m_camera;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QCameraSelector::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QCameraSelectorData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QCameraSelector);
+ data.cameraId = qIdForNode(d->m_camera);
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/framegraph/qcameraselector.h b/src/render/framegraph/qcameraselector.h
index 3be2c30a6..5cdd04028 100644
--- a/src/render/framegraph/qcameraselector.h
+++ b/src/render/framegraph/qcameraselector.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,7 +55,7 @@ class QT3DRENDERSHARED_EXPORT QCameraSelector : public QFrameGraphNode
Q_PROPERTY(Qt3DCore::QEntity *camera READ camera WRITE setCamera NOTIFY cameraChanged)
public:
- explicit QCameraSelector(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QCameraSelector(Qt3DCore::QNode *parent = nullptr);
~QCameraSelector();
Qt3DCore::QEntity *camera() const;
@@ -64,12 +67,11 @@ Q_SIGNALS:
void cameraChanged(Qt3DCore::QEntity *camera);
protected:
- QCameraSelector(QCameraSelectorPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QCameraSelector(QCameraSelectorPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
- QT3D_CLONEABLE(QCameraSelector)
Q_DECLARE_PRIVATE(QCameraSelector)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qcameraselector_p.h b/src/render/framegraph/qcameraselector_p.h
index d4fb3f24d..9e30a541b 100644
--- a/src/render/framegraph/qcameraselector_p.h
+++ b/src/render/framegraph/qcameraselector_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -66,6 +69,10 @@ public:
Qt3DCore::QEntity *m_camera;
};
+struct QCameraSelectorData
+{
+ Qt3DCore::QNodeId cameraId;
+};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qclearbuffer.cpp b/src/render/framegraph/qclearbuffer.cpp
deleted file mode 100644
index ffdca0fec..000000000
--- a/src/render/framegraph/qclearbuffer.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qclearbuffer.h"
-#include <private/qclearbuffer_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QClearBufferPrivate::QClearBufferPrivate()
- : QFrameGraphNodePrivate()
- , m_buffersType(QClearBuffer::None)
-{
-}
-
-void QClearBuffer::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QClearBuffer *b = static_cast<const QClearBuffer*>(ref);
- d_func()->m_buffersType = b->d_func()->m_buffersType;
-}
-
-QClearBuffer::QClearBuffer(QNode *parent)
- : QFrameGraphNode(*new QClearBufferPrivate, parent)
-{
-}
-
-QClearBuffer::~QClearBuffer()
-{
- QNode::cleanup();
-}
-
-/*! \internal */
-QClearBuffer::QClearBuffer(QClearBufferPrivate &dd, QNode *parent)
- : QFrameGraphNode(dd, parent)
-{
-}
-
-
-QClearBuffer::BufferType QClearBuffer::buffers() const
-{
- Q_D(const QClearBuffer);
- return d->m_buffersType;
-}
-
-void QClearBuffer::setBuffers(QClearBuffer::BufferType buffers)
-{
- Q_D(QClearBuffer);
- if (d->m_buffersType != buffers) {
- d->m_buffersType = buffers;
- emit buffersChanged(buffers);
- }
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/qclearbuffer.h b/src/render/framegraph/qclearbuffer.h
deleted file mode 100644
index 54114526d..000000000
--- a/src/render/framegraph/qclearbuffer.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QCLEARBUFFER_H
-#define QT3DRENDER_QCLEARBUFFER_H
-
-#include <Qt3DRender/qframegraphnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QClearBufferPrivate;
-
-class QT3DRENDERSHARED_EXPORT QClearBuffer : public QFrameGraphNode
-{
- Q_OBJECT
- Q_PROPERTY(BufferType buffers READ buffers WRITE setBuffers NOTIFY buffersChanged)
-public:
- explicit QClearBuffer(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QClearBuffer();
-
- enum BufferType {
- None = 0,
- ColorBuffer = (1 << 0),
- DepthBuffer = (1 << 1),
- StencilBuffer = (1 << 2),
- DepthStencilBuffer = (1 << 1) | (1 << 2),
- ColorDepthBuffer = ColorBuffer | DepthBuffer,
- ColorDepthStencilBuffer = ColorBuffer | DepthStencilBuffer,
- AllBuffers = 0xFFFFFFFF
- };
- Q_ENUM(BufferType)
-
- BufferType buffers() const;
-
-public Q_SLOTS:
- void setBuffers(BufferType buffers);
-
-Q_SIGNALS:
- void buffersChanged(BufferType buffers);
-
-protected:
- QClearBuffer(QClearBufferPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QClearBuffer)
- QT3D_CLONEABLE(QClearBuffer)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QCLEARBUFFER_H
diff --git a/src/render/framegraph/qclearbuffer_p.h b/src/render/framegraph/qclearbuffer_p.h
deleted file mode 100644
index 544b17e37..000000000
--- a/src/render/framegraph/qclearbuffer_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QCLEARBUFFER_P_H
-#define QT3DRENDER_QCLEARBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qframegraphnode_p.h>
-#include <Qt3DRender/qclearbuffer.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QClearBufferPrivate : public QFrameGraphNodePrivate
-{
-public:
- QClearBufferPrivate();
-
- Q_DECLARE_PUBLIC(QClearBuffer)
- QClearBuffer::BufferType m_buffersType;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QCLEARBUFFER_P_H
diff --git a/src/render/framegraph/qclearbuffers.cpp b/src/render/framegraph/qclearbuffers.cpp
new file mode 100644
index 000000000..48068e290
--- /dev/null
+++ b/src/render/framegraph/qclearbuffers.cpp
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qclearbuffers.h"
+#include "qclearbuffers_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QClearBuffersPrivate::QClearBuffersPrivate()
+ : QFrameGraphNodePrivate()
+ , m_buffersType(QClearBuffers::None)
+ , m_clearDepthValue(1.f)
+ , m_clearStencilValue(0)
+ , m_buffer(Q_NULLPTR)
+{
+}
+
+QClearBuffers::QClearBuffers(QNode *parent)
+ : QFrameGraphNode(*new QClearBuffersPrivate, parent)
+{
+}
+
+/*! \internal */
+QClearBuffers::~QClearBuffers()
+{
+}
+
+/*! \internal */
+QClearBuffers::QClearBuffers(QClearBuffersPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+
+QClearBuffers::BufferType QClearBuffers::buffers() const
+{
+ Q_D(const QClearBuffers);
+ return d->m_buffersType;
+}
+
+QColor QClearBuffers::clearColor() const
+{
+ Q_D(const QClearBuffers);
+ return d->m_clearColor;
+}
+
+float QClearBuffers::clearDepthValue() const
+{
+ Q_D(const QClearBuffers);
+ return d->m_clearDepthValue;
+}
+
+int QClearBuffers::clearStencilValue() const
+{
+ Q_D(const QClearBuffers);
+ return d->m_clearStencilValue;
+}
+
+QRenderTargetOutput *QClearBuffers::colorBuffer() const
+{
+ Q_D(const QClearBuffers);
+ return d->m_buffer;
+}
+
+void QClearBuffers::setBuffers(QClearBuffers::BufferType buffers)
+{
+ Q_D(QClearBuffers);
+ if (d->m_buffersType != buffers) {
+ d->m_buffersType = buffers;
+ emit buffersChanged(buffers);
+ }
+}
+
+void QClearBuffers::setClearColor(const QColor &color)
+{
+ Q_D(QClearBuffers);
+ if (d->m_clearColor != color) {
+ d->m_clearColor = color;
+ emit clearColorChanged(color);
+ }
+}
+
+void QClearBuffers::setClearDepthValue(float clearDepthValue)
+{
+ Q_D(QClearBuffers);
+ if (d->m_clearDepthValue != clearDepthValue) {
+ if (clearDepthValue >= 0.f && clearDepthValue <= 1.f) {
+ d->m_clearDepthValue = clearDepthValue;
+ emit clearDepthValueChanged(clearDepthValue);
+ } else qWarning() << "Invalid clear depth value";
+ }
+}
+
+void QClearBuffers::setClearStencilValue(int clearStencilValue)
+{
+ Q_D(QClearBuffers);
+ if (d->m_clearStencilValue != clearStencilValue) {
+ d->m_clearStencilValue = clearStencilValue;
+ emit clearStencilValueChanged(clearStencilValue);
+ }
+}
+
+/*!
+ \property Qt3DRender::QClearBuffers::colorBuffer
+ Specifies a specific color buffer to clear. If set to NULL (default), and
+ ColorBuffer flag is set, all color buffers will be cleared.
+ */
+void QClearBuffers::setColorBuffer(QRenderTargetOutput *buffer)
+{
+ Q_D(QClearBuffers);
+ if (d->m_buffer != buffer) {
+ d->m_buffer = buffer;
+ emit colorBufferChanged(buffer);
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QClearBuffers::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QClearBuffersData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QClearBuffers);
+ data.buffersType = d->m_buffersType;
+ data.clearColor = d->m_clearColor;
+ data.clearDepthValue = d->m_clearDepthValue;
+ data.clearStencilValue = d->m_clearStencilValue;
+ data.bufferId = Qt3DCore::qIdForNode(d->m_buffer);
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qclearbuffers.h b/src/render/framegraph/qclearbuffers.h
new file mode 100644
index 000000000..d45af9ce0
--- /dev/null
+++ b/src/render/framegraph/qclearbuffers.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCLEARBUFFERS_H
+#define QT3DRENDER_QCLEARBUFFERS_H
+
+#include <Qt3DRender/qframegraphnode.h>
+#include <Qt3DRender/qrendertargetoutput.h>
+#include <QColor>
+#include <QFlags>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QClearBuffersPrivate;
+
+class QT3DRENDERSHARED_EXPORT QClearBuffers : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(BufferType buffers READ buffers WRITE setBuffers NOTIFY buffersChanged)
+ Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
+ Q_PROPERTY(float clearDepthValue READ clearDepthValue WRITE setClearDepthValue NOTIFY clearDepthValueChanged)
+ Q_PROPERTY(int clearStencilValue READ clearStencilValue WRITE setClearStencilValue NOTIFY clearStencilValueChanged)
+ Q_PROPERTY(Qt3DRender::QRenderTargetOutput* colorBuffer READ colorBuffer WRITE setColorBuffer NOTIFY colorBufferChanged)
+
+public:
+ explicit QClearBuffers(Qt3DCore::QNode *parent = nullptr);
+ ~QClearBuffers();
+
+ enum BufferType {
+ None = 0,
+ ColorBuffer = (1 << 0),
+ DepthBuffer = (1 << 1),
+ StencilBuffer = (1 << 2),
+ DepthStencilBuffer = DepthBuffer | StencilBuffer,
+ ColorDepthBuffer = ColorBuffer | DepthBuffer,
+ ColorDepthStencilBuffer = ColorBuffer | DepthStencilBuffer,
+ AllBuffers = 0xFFFFFFFF
+ };
+ Q_ENUM(BufferType)
+ Q_DECLARE_FLAGS(BufferTypeFlags, BufferType)
+
+ BufferType buffers() const;
+ QColor clearColor() const;
+ float clearDepthValue() const;
+ int clearStencilValue() const;
+ QRenderTargetOutput *colorBuffer() const;
+
+public Q_SLOTS:
+ void setBuffers(BufferType buffers);
+ void setClearColor(const QColor& color);
+ void setClearDepthValue(float clearDepthValue);
+ void setClearStencilValue(int clearStencilValue);
+ void setColorBuffer(QRenderTargetOutput *buffer);
+
+Q_SIGNALS:
+ void buffersChanged(BufferType buffers);
+ void clearColorChanged(const QColor& color);
+ void clearDepthValueChanged(float clearDepthValue);
+ void clearStencilValueChanged(int clearStencilValue);
+ void colorBufferChanged(QRenderTargetOutput *buffer);
+
+protected:
+ explicit QClearBuffers(QClearBuffersPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QClearBuffers)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCLEARBUFFERS_H
diff --git a/src/render/framegraph/qclearbuffers_p.h b/src/render/framegraph/qclearbuffers_p.h
new file mode 100644
index 000000000..55e7d2f84
--- /dev/null
+++ b/src/render/framegraph/qclearbuffers_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCLEARBUFFERS_P_H
+#define QT3DRENDER_QCLEARBUFFERS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qframegraphnode_p.h>
+#include <Qt3DRender/qclearbuffers.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QClearBuffersPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QClearBuffersPrivate();
+
+ Q_DECLARE_PUBLIC(QClearBuffers)
+ QClearBuffers::BufferType m_buffersType;
+ QColor m_clearColor;
+ float m_clearDepthValue;
+ int m_clearStencilValue;
+ QRenderTargetOutput *m_buffer;
+};
+
+struct QClearBuffersData
+{
+ QClearBuffers::BufferType buffersType;
+ QColor clearColor;
+ float clearDepthValue;
+ int clearStencilValue;
+ Qt3DCore::QNodeId bufferId;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCLEARBUFFERS_P_H
diff --git a/src/render/framegraph/qdispatchcompute.cpp b/src/render/framegraph/qdispatchcompute.cpp
index 8a9ea3fce..0d3796c71 100644
--- a/src/render/framegraph/qdispatchcompute.cpp
+++ b/src/render/framegraph/qdispatchcompute.cpp
@@ -1,69 +1,57 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qdispatchcompute.h"
-#include <Qt3DRender/private/qframegraphnode_p.h>
+#include "qdispatchcompute_p.h"
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QDispatchComputePrivate : public QFrameGraphNodePrivate
-{
-public:
- QDispatchComputePrivate()
- : QFrameGraphNodePrivate()
- , m_workGroupX(1)
- , m_workGroupY(1)
- , m_workGroupZ(1)
- {}
-
- int m_workGroupX;
- int m_workGroupY;
- int m_workGroupZ;
-};
-
QDispatchCompute::QDispatchCompute(Qt3DCore::QNode *parent)
: QFrameGraphNode(*new QDispatchComputePrivate(), parent)
{
}
+/*! \internal */
QDispatchCompute::~QDispatchCompute()
{
- QFrameGraphNode::cleanup();
}
int QDispatchCompute::workGroupX() const
@@ -112,13 +100,15 @@ void QDispatchCompute::setWorkGroupZ(int workGroupZ)
}
-void QDispatchCompute::copy(const Qt3DCore::QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QDispatchCompute::createNodeCreationChange() const
{
- QFrameGraphNode::copy(ref);
- const QDispatchCompute *dispatch = static_cast<const QDispatchCompute *>(ref);
- d_func()->m_workGroupX = dispatch->workGroupX();
- d_func()->m_workGroupY = dispatch->workGroupY();
- d_func()->m_workGroupZ = dispatch->workGroupZ();
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QDispatchComputeData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QDispatchCompute);
+ data.workGroupX = d->m_workGroupX;
+ data.workGroupY = d->m_workGroupY;
+ data.workGroupZ = d->m_workGroupZ;
+ return creationChange;
}
} // Qt3DRender
diff --git a/src/render/framegraph/qdispatchcompute.h b/src/render/framegraph/qdispatchcompute.h
index dffe8000c..c5209b8c6 100644
--- a/src/render/framegraph/qdispatchcompute.h
+++ b/src/render/framegraph/qdispatchcompute.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -53,13 +56,14 @@ class QT3DRENDERSHARED_EXPORT QDispatchCompute : public QFrameGraphNode
Q_PROPERTY(int workGroupY READ workGroupY WRITE setWorkGroupY NOTIFY workGroupYChanged)
Q_PROPERTY(int workGroupZ READ workGroupZ WRITE setWorkGroupZ NOTIFY workGroupZChanged)
public:
- explicit QDispatchCompute(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QDispatchCompute(Qt3DCore::QNode *parent = nullptr);
~QDispatchCompute();
int workGroupX() const;
int workGroupY() const;
int workGroupZ() const;
+public Q_SLOTS:
void setWorkGroupX(int workGroupX);
void setWorkGroupY(int workGroupY);
void setWorkGroupZ(int workGroupZ);
@@ -69,13 +73,9 @@ Q_SIGNALS:
void workGroupYChanged();
void workGroupZChanged();
- // QNode interface
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
- QT3D_CLONEABLE(QDispatchCompute)
Q_DECLARE_PRIVATE(QDispatchCompute)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // Qt3DRender
diff --git a/src/render/framegraph/qdispatchcompute_p.h b/src/render/framegraph/qdispatchcompute_p.h
new file mode 100644
index 000000000..d64f2655f
--- /dev/null
+++ b/src/render/framegraph/qdispatchcompute_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QDISPATCHCOMPUTE_P_H
+#define QT3DRENDER_QDISPATCHCOMPUTE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QDispatchComputePrivate : public QFrameGraphNodePrivate
+{
+public:
+ QDispatchComputePrivate()
+ : QFrameGraphNodePrivate()
+ , m_workGroupX(1)
+ , m_workGroupY(1)
+ , m_workGroupZ(1)
+ {}
+
+ int m_workGroupX;
+ int m_workGroupY;
+ int m_workGroupZ;
+};
+
+struct QDispatchComputeData
+{
+ int workGroupX;
+ int workGroupY;
+ int workGroupZ;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QDISPATCHCOMPUTE_P_H
diff --git a/src/render/framegraph/qframegraph.cpp b/src/render/framegraph/qframegraph.cpp
deleted file mode 100644
index 8a004dbfe..000000000
--- a/src/render/framegraph/qframegraph.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qframegraph.h"
-#include "qframegraph_p.h"
-#include <Qt3DCore/qentity.h>
-#include <Qt3DRender/qframegraphnode.h>
-#include <Qt3DRender/private/qframegraphnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QFrameGraphPrivate::QFrameGraphPrivate()
- : QComponentPrivate()
- , m_activeFrameGraph(Q_NULLPTR)
-{
-
-}
-
-/*!
- \class Qt3DRender::QFrameGraph
- \inmodule Qt3DRender
- \since 5.3
-
- \brief Defines the rendering method to be used by the renderer.
-
- QFrameGraph is the Component that has an activeFrameGraph property
- that should reference the root FrameGraphItem of a frame graph
- tree. The Entity that contains a FrameGraph property defines the
- rendering method to be used by the renderer.
-
- \note Only one FrameGraph can be active at any moment.
- */
-
-/*!
- \qmltype FrameGraph
- \instantiates Qt3DRender::QFrameGraph
- \inherits Component3D
- \inqmlmodule Qt3D.Render
- \since 5.5
- \brief For OpenGL ...
-*/
-
-/*!
- \fn void Qt3DRender::QFrameGraph::copy(const Qt3DCore::QNode *ref)
-
- Copies the \a ref instance into this one.
- */
-void QFrameGraph::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QFrameGraph *other = static_cast<const QFrameGraph*>(ref);
- setActiveFrameGraph(qobject_cast<QFrameGraphNode *>(QNode::clone(other->d_func()->m_activeFrameGraph)));
-}
-
-/*!
- \fn Qt3DRender::QFrameGraph::QFrameGraph(Qt3DCore::QNode *parent)
-
- Constructs a new QFrameGraph with the specified \a parent.
-*/
-QFrameGraph::QFrameGraph(QNode *parent)
- : QComponent(*new QFrameGraphPrivate, parent)
-{
-}
-
-QFrameGraph::~QFrameGraph()
-{
- QNode::cleanup();
-}
-
-/*! \internal */
-QFrameGraph::QFrameGraph(QFrameGraphPrivate &dd, QNode *parent)
- : QComponent(dd, parent)
-{
-}
-
-/*!
- \qmlproperty FrameGraphNode Qt3D.Render::FrameGraph::activeFrameGraph
-
- Holds the current activeFrameGraph root node.
-*/
-
-/*!
- \property Qt3DRender::QFrameGraph::activeFrameGraph
-
- Holds the current activeFrameGraph root node.
- */
-QFrameGraphNode *QFrameGraph::activeFrameGraph() const
-{
- Q_D(const QFrameGraph);
- return d->m_activeFrameGraph;
-}
-
-void QFrameGraph::setActiveFrameGraph(QFrameGraphNode *activeFrameGraph)
-{
- Q_D(QFrameGraph);
- if (activeFrameGraph != d->m_activeFrameGraph) {
-
- if (activeFrameGraph != Q_NULLPTR && !activeFrameGraph->parent())
- activeFrameGraph->setParent(this);
-
- d->m_activeFrameGraph = activeFrameGraph;
- emit activeFrameGraphChanged(activeFrameGraph);
- }
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/qframegraph.h b/src/render/framegraph/qframegraph.h
deleted file mode 100644
index 3ed2c4125..000000000
--- a/src/render/framegraph/qframegraph.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QFRAMEGRAPH_H
-#define QT3DRENDER_QFRAMEGRAPH_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DCore/qcomponent.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QFrameGraphPrivate;
-class QFrameGraphNode;
-
-class QT3DRENDERSHARED_EXPORT QFrameGraph : public Qt3DCore::QComponent
-{
- Q_OBJECT
- // Note : The full namespace has to be used to define the property
- // otherwise this results in an error "cannot assign object to property"
- Q_PROPERTY(Qt3DRender::QFrameGraphNode *activeFrameGraph READ activeFrameGraph WRITE setActiveFrameGraph NOTIFY activeFrameGraphChanged)
- Q_CLASSINFO("DefaultProperty", "activeFrameGraph")
-
-public:
- explicit QFrameGraph(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QFrameGraph();
-
- QFrameGraphNode *activeFrameGraph() const;
-
-public Q_SLOTS:
- void setActiveFrameGraph(QFrameGraphNode *activeFrameGraph);
-
-Q_SIGNALS:
- void activeFrameGraphChanged(QFrameGraphNode *activeFrameGraph);
-
-protected:
- QFrameGraph(QFrameGraphPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QFrameGraph)
- QT3D_CLONEABLE(QFrameGraph)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QFRAMEGRAPH_H
diff --git a/src/render/framegraph/qframegraph_p.h b/src/render/framegraph/qframegraph_p.h
deleted file mode 100644
index d340c04f7..000000000
--- a/src/render/framegraph/qframegraph_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QFRAMEGRAPH_P_H
-#define QT3DRENDER_QFRAMEGRAPH_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/qt3dcore_global.h>
-#include <private/qcomponent_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QFrameGraph;
-class QFrameGraphNode;
-
-class QFrameGraphPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QFrameGraphPrivate();
-
- Q_DECLARE_PUBLIC(QFrameGraph)
-
- QFrameGraphNode *m_activeFrameGraph;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QFRAMEGRAPH_P_H
diff --git a/src/render/framegraph/qframegraphnode.cpp b/src/render/framegraph/qframegraphnode.cpp
index ee3c48a76..add8fc75d 100644
--- a/src/render/framegraph/qframegraphnode.cpp
+++ b/src/render/framegraph/qframegraphnode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -43,7 +46,6 @@ namespace Qt3DRender {
QFrameGraphNodePrivate::QFrameGraphNodePrivate()
: QNodePrivate()
- , m_enabled(true)
{
}
@@ -76,9 +78,9 @@ QFrameGraphNode::QFrameGraphNode(QNode *parent)
{
}
+/*! \internal */
QFrameGraphNode::~QFrameGraphNode()
{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QFrameGraphNode subclass didn't call QNode::cleanup in its destructor");
}
/*!
@@ -86,11 +88,11 @@ QFrameGraphNode::~QFrameGraphNode()
*/
QFrameGraphNode *QFrameGraphNode::parentFrameGraphNode() const
{
- QFrameGraphNode *parentFGNode = Q_NULLPTR;
+ QFrameGraphNode *parentFGNode = nullptr;
QNode *parentN = parentNode();
while (parentN) {
- if ((parentFGNode = qobject_cast<QFrameGraphNode *>(parentN)) != Q_NULLPTR)
+ if ((parentFGNode = qobject_cast<QFrameGraphNode *>(parentN)) != nullptr)
break;
parentN = parentN->parentNode();
}
@@ -103,34 +105,6 @@ QFrameGraphNode::QFrameGraphNode(QFrameGraphNodePrivate &dd, QNode *parent)
{
}
-/*!
- \qmlproperty bool Qt3D.Render::FrameGraphNode::enabled
-
- Holds whether the frame graph node is enabled or disabled.
-*/
-
-/*!
- \property Qt3DRender::QFrameGraphNode::enabled
-
- Holds whether the frame graph node is enabled or disabled.
-*/
-
-bool QFrameGraphNode::isEnabled() const
-{
- Q_D(const QFrameGraphNode);
- return d->m_enabled;
-}
-
-void QFrameGraphNode::setEnabled(bool enabled)
-{
- Q_D(QFrameGraphNode);
- if (d->m_enabled != enabled) {
- d->m_enabled = enabled;
- emit enabledChanged(enabled);
- }
-}
-
-
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/framegraph/qframegraphnode.h b/src/render/framegraph/qframegraphnode.h
index 36248cbc0..a7de9c1ad 100644
--- a/src/render/framegraph/qframegraphnode.h
+++ b/src/render/framegraph/qframegraphnode.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,23 +53,14 @@ class QFrameGraphNodePrivate;
class QT3DRENDERSHARED_EXPORT QFrameGraphNode : public Qt3DCore::QNode
{
Q_OBJECT
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
public:
- explicit QFrameGraphNode(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QFrameGraphNode(Qt3DCore::QNode *parent = nullptr);
~QFrameGraphNode();
QFrameGraphNode *parentFrameGraphNode() const;
- bool isEnabled() const;
-
-public Q_SLOTS:
- void setEnabled(bool enabled);
-
protected:
- QFrameGraphNode(QFrameGraphNodePrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
-
-Q_SIGNALS:
- void enabledChanged(bool enabled);
+ explicit QFrameGraphNode(QFrameGraphNodePrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QFrameGraphNode)
diff --git a/src/render/framegraph/qframegraphnode_p.h b/src/render/framegraph/qframegraphnode_p.h
index 32ba8ae38..00cc53626 100644
--- a/src/render/framegraph/qframegraphnode_p.h
+++ b/src/render/framegraph/qframegraphnode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -64,7 +67,6 @@ public:
QFrameGraphNodePrivate();
Q_DECLARE_PUBLIC(QFrameGraphNode)
- bool m_enabled;
QList<QFrameGraphNode *> m_fgChildren;
};
diff --git a/src/render/framegraph/qframegraphselector.cpp b/src/render/framegraph/qframegraphselector.cpp
deleted file mode 100644
index f7788acf1..000000000
--- a/src/render/framegraph/qframegraphselector.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qframegraphselector.h"
-#include "qframegraphselector_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QFrameGraphSelectorPrivate::QFrameGraphSelectorPrivate()
- : QFrameGraphNodePrivate()
-{
-}
-
-/*!
- \class Qt3DRender::QFrameGraphSelector
- \inmodule Qt3DRender
-
- \brief Qt3DRender::QFrameGraphSelector provide a way to select a one or more subtree of
- the FrameGraph at runtime
-
- The selection is made by executing Qt3DRender::QFrameGraphSelectorFunctor that will
- return a vector containing the indices of the \l {QFrameGraph}{FrameGraph} subtree to be used
- for the current frame.
- */
-
-/*!
- Constructs a new Qt3DRender::QFrameGraphSelector instance using \a parent as parent.
- */
-QFrameGraphSelector::QFrameGraphSelector(QNode *parent)
- : QFrameGraphNode(*new QFrameGraphSelectorPrivate, parent)
-{
-}
-
-QFrameGraphSelector::~QFrameGraphSelector()
-{
- QNode::cleanup();
-}
-
-/*!
- \return the functor to be used for selecting FrameGraph subtrees.
- */
-QFrameGraphSelectorFunctorPtr QFrameGraphSelector::selectionFunctor() const
-{
- Q_D(const QFrameGraphSelector);
- return d->m_selectionFunctor;
-}
-
-/*!
- Sets the functor \a functor to be used for selecting \l {QFrameGraph}{FrameGraph} subtrees at
- runtime.
- */
-void QFrameGraphSelector::setSelectionFunctor(QFrameGraphSelectorFunctorPtr functor)
-{
- Q_D(QFrameGraphSelector);
- d->m_selectionFunctor = functor;
-}
-
-void QFrameGraphSelector::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/qframegraphselector.h b/src/render/framegraph/qframegraphselector.h
deleted file mode 100644
index 8114dbcf2..000000000
--- a/src/render/framegraph/qframegraphselector.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QFRAMEGRAPHSELECTOR_H
-#define QT3DRENDER_QFRAMEGRAPHSELECTOR_H
-
-#include <Qt3DRender/qframegraphnode.h>
-#include <Qt3DCore/qnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QFrameGraphSelectorPrivate;
-
-class QT3DRENDERSHARED_EXPORT QFrameGraphSelectorFunctor
-{
-public:
- virtual QVector<int> operator()() = 0;
- virtual ~QFrameGraphSelectorFunctor() {}
-};
-
-typedef QSharedPointer<QFrameGraphSelectorFunctor> QFrameGraphSelectorFunctorPtr;
-
-class QT3DRENDERSHARED_EXPORT QFrameGraphSelector : public QFrameGraphNode
-{
- Q_OBJECT
-public:
- explicit QFrameGraphSelector(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QFrameGraphSelector();
-
- QFrameGraphSelectorFunctorPtr selectionFunctor() const;
- void setSelectionFunctor(QFrameGraphSelectorFunctorPtr functor);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- QT3D_CLONEABLE(QFrameGraphSelector)
- Q_DECLARE_PRIVATE(QFrameGraphSelector)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Qt3DRender::QFrameGraphSelectorFunctorPtr)
-
-#endif // QT3DRENDER_QGFRAMEGRAPHSELECTOR_H
diff --git a/src/render/framegraph/qframegraphselector_p.h b/src/render/framegraph/qframegraphselector_p.h
deleted file mode 100644
index afe91601a..000000000
--- a/src/render/framegraph/qframegraphselector_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QFRAMEGRAPHSELECTOR_P_H
-#define QT3DRENDER_QFRAMEGRAPHSELECTOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qframegraphnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QFrameGraphSelector;
-class QFrameGraphSelectorFunctor;
-typedef QSharedPointer<QFrameGraphSelectorFunctor> QFrameGraphSelectorFunctorPtr;
-
-class QFrameGraphSelectorPrivate : public QFrameGraphNodePrivate
-{
-public:
- QFrameGraphSelectorPrivate();
-
- QFrameGraphSelectorFunctorPtr m_selectionFunctor;
-
- Q_DECLARE_PUBLIC(QFrameGraphSelector)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QFRAMEGRAPHSELECTOR_P_H
-
diff --git a/src/render/framegraph/qfrustumculling.cpp b/src/render/framegraph/qfrustumculling.cpp
index 4a8eefb49..ded5aa8a8 100644
--- a/src/render/framegraph/qfrustumculling.cpp
+++ b/src/render/framegraph/qfrustumculling.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -45,9 +48,9 @@ QFrustumCulling::QFrustumCulling(Qt3DCore::QNode *parent)
{
}
+/*! \internal */
QFrustumCulling::~QFrustumCulling()
{
- QFrameGraphNode::cleanup();
}
} // Qt3DRender
diff --git a/src/render/framegraph/qfrustumculling.h b/src/render/framegraph/qfrustumculling.h
index 8d5008bef..f0ed6d032 100644
--- a/src/render/framegraph/qfrustumculling.h
+++ b/src/render/framegraph/qfrustumculling.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,11 +50,8 @@ class QT3DRENDERSHARED_EXPORT QFrustumCulling : public QFrameGraphNode
{
Q_OBJECT
public:
- explicit QFrustumCulling(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QFrustumCulling(Qt3DCore::QNode *parent = nullptr);
~QFrustumCulling();
-
-private:
- QT3D_CLONEABLE(QFrustumCulling)
};
} // Qt3DRender
diff --git a/src/render/framegraph/qlayerfilter.cpp b/src/render/framegraph/qlayerfilter.cpp
index a4a2007fe..c78142224 100644
--- a/src/render/framegraph/qlayerfilter.cpp
+++ b/src/render/framegraph/qlayerfilter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,10 @@
#include "qlayerfilter.h"
#include "qlayerfilter_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qlayer.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -63,17 +69,6 @@ QLayerFilterPrivate::QLayerFilterPrivate()
\brief For ...
*/
-/*! \fn void Qt3DRender::QLayerFilter::copy(const Qt3DCore::QNode *ref)
- Copies the \a ref instance into this one.
- */
-void QLayerFilter::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QLayerFilter *layer = static_cast<const QLayerFilter*>(ref);
- d_func()->m_layers = layer->d_func()->m_layers;
-}
-
-
/*! \fn Qt3DRender::QLayerFilter::QLayerFilter(Qt3DCore::QNode *parent)
Constructs a new QLayerFilter with the specified \a parent.
*/
@@ -82,14 +77,14 @@ QLayerFilter::QLayerFilter(QNode *parent)
{
}
-QLayerFilter::~QLayerFilter()
+/*! \internal */
+QLayerFilter::QLayerFilter(QLayerFilterPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
{
- QNode::cleanup();
}
/*! \internal */
-QLayerFilter::QLayerFilter(QLayerFilterPrivate &dd, QNode *parent)
- : QFrameGraphNode(dd, parent)
+QLayerFilter::~QLayerFilter()
{
}
@@ -103,21 +98,54 @@ QLayerFilter::QLayerFilter(QLayerFilterPrivate &dd, QNode *parent)
*/
-void QLayerFilter::setLayers(const QStringList &layers)
+void QLayerFilter::addLayer(QLayer *layer)
+{
+ Q_ASSERT(layer);
+ Q_D(QLayerFilter);
+ if (!d->m_layers.contains(layer)) {
+ d->m_layers.append(layer);
+
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, it gets destroyed as well
+ if (!layer->parent())
+ layer->setParent(this);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(id(), layer);
+ change->setPropertyName("layer");
+ d->notifyObservers(change);
+ }
+ }
+}
+
+void QLayerFilter::removeLayer(QLayer *layer)
{
+ Q_ASSERT(layer);
Q_D(QLayerFilter);
- if (d->m_layers != layers) {
- d->m_layers = layers;
- emit layersChanged(layers);
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(id(), layer);
+ change->setPropertyName("layer");
+ d->notifyObservers(change);
}
+ d->m_layers.removeOne(layer);
}
-QStringList QLayerFilter::layers() const
+QVector<QLayer *> QLayerFilter::layers() const
{
Q_D(const QLayerFilter);
return d->m_layers;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QLayerFilter::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QLayerFilterData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QLayerFilter);
+ data.layerIds = qIdsForNodes(d->m_layers);
+ return creationChange;
+}
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qlayerfilter.h b/src/render/framegraph/qlayerfilter.h
index a3e5d8af5..61eac5773 100644
--- a/src/render/framegraph/qlayerfilter.h
+++ b/src/render/framegraph/qlayerfilter.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -44,31 +47,26 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+class QLayer;
class QLayerFilterPrivate;
class QT3DRENDERSHARED_EXPORT QLayerFilter : public QFrameGraphNode
{
Q_OBJECT
- Q_PROPERTY(QStringList layers READ layers WRITE setLayers NOTIFY layersChanged)
public:
- explicit QLayerFilter(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QLayerFilter(Qt3DCore::QNode *parent = nullptr);
~QLayerFilter();
- QStringList layers() const;
-
-public Q_SLOTS:
- void setLayers(const QStringList &layers);
-
-Q_SIGNALS:
- void layersChanged(const QStringList &layers);
+ void addLayer(QLayer *layer);
+ void removeLayer(QLayer *layer);
+ QVector<QLayer *> layers() const;
protected:
- QLayerFilter(QLayerFilterPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QLayerFilter(QLayerFilterPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QLayerFilter)
- QT3D_CLONEABLE(QLayerFilter)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qlayerfilter_p.h b/src/render/framegraph/qlayerfilter_p.h
index a8c96ed79..8ad7d3301 100644
--- a/src/render/framegraph/qlayerfilter_p.h
+++ b/src/render/framegraph/qlayerfilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,6 +57,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+class QLayer;
class QLayerFilter;
class QLayerFilterPrivate : public QFrameGraphNodePrivate
@@ -62,7 +66,12 @@ public:
QLayerFilterPrivate();
Q_DECLARE_PUBLIC(QLayerFilter)
- QStringList m_layers;
+ QVector<QLayer*> m_layers;
+};
+
+struct QLayerFilterData
+{
+ Qt3DCore::QNodeIdVector layerIds;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qlighting.cpp b/src/render/framegraph/qlighting.cpp
deleted file mode 100644
index 07fe6022f..000000000
--- a/src/render/framegraph/qlighting.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlighting.h"
-#include "qlighting_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QLighting::QLighting(QNode *parent)
- : QFrameGraphNode(*new QLightingPrivate, parent)
-{
-}
-
-QLighting::QLighting(QLightingPrivate &dd, QNode *parent)
- : QFrameGraphNode(dd, parent)
-{
-}
-
-QLighting::~QLighting()
-{
- QNode::cleanup();
-}
-
-void QLighting::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QLighting *lighting = static_cast<const QLighting *>(ref);
- Q_UNUSED(lighting);
-}
-
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/qlighting.h b/src/render/framegraph/qlighting.h
deleted file mode 100644
index 603fe8e46..000000000
--- a/src/render/framegraph/qlighting.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QLIGHTING_H
-#define QT3DRENDER_QLIGHTING_H
-
-#include <Qt3DRender/qframegraphnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QLightingPrivate;
-
-class QT3DRENDERSHARED_EXPORT QLighting : public QFrameGraphNode
-{
- Q_OBJECT
-
-public:
- explicit QLighting(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QLighting();
-
-protected:
- QLighting(QLightingPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QLighting)
- QT3D_CLONEABLE(QLighting)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QLIGHTING_H
diff --git a/src/render/framegraph/qlighting_p.h b/src/render/framegraph/qlighting_p.h
deleted file mode 100644
index 83b605890..000000000
--- a/src/render/framegraph/qlighting_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QLIGHTING_P_H
-#define QT3DRENDER_QLIGHTING_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qframegraphnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QLighting;
-
-class QLightingPrivate : public QFrameGraphNodePrivate
-{
-public :
- Q_DECLARE_PUBLIC(QLighting)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QLIGHTING_P_H
diff --git a/src/render/framegraph/qnodraw.cpp b/src/render/framegraph/qnodraw.cpp
index 5d3b9107d..1f9d44717 100644
--- a/src/render/framegraph/qnodraw.cpp
+++ b/src/render/framegraph/qnodraw.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,9 +64,9 @@ QNoDraw::QNoDraw(QNode *parent)
{
}
+/*! \internal */
QNoDraw::~QNoDraw()
{
- QNode::cleanup();
}
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qnodraw.h b/src/render/framegraph/qnodraw.h
index 5e33d411c..4547aeeda 100644
--- a/src/render/framegraph/qnodraw.h
+++ b/src/render/framegraph/qnodraw.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,11 +50,8 @@ class QT3DRENDERSHARED_EXPORT QNoDraw : public QFrameGraphNode
{
Q_OBJECT
public:
- explicit QNoDraw(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QNoDraw(Qt3DCore::QNode *parent = nullptr);
~QNoDraw();
-
-private:
- QT3D_CLONEABLE(QNoDraw)
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qrenderpassfilter.cpp b/src/render/framegraph/qrenderpassfilter.cpp
index a083b78a6..202a10a35 100644
--- a/src/render/framegraph/qrenderpassfilter.cpp
+++ b/src/render/framegraph/qrenderpassfilter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,9 +40,11 @@
#include "qrenderpassfilter.h"
#include "qrenderpassfilter_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qannotation.h>
+#include <Qt3DRender/qfilterkey.h>
#include <Qt3DRender/qparameter.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -52,9 +57,9 @@ QRenderPassFilter::QRenderPassFilter(QNode *parent)
: QFrameGraphNode(*new QRenderPassFilterPrivate, parent)
{}
+/*! \internal */
QRenderPassFilter::~QRenderPassFilter()
{
- QNode::cleanup();
}
/*! \internal */
@@ -63,58 +68,50 @@ QRenderPassFilter::QRenderPassFilter(QRenderPassFilterPrivate &dd, QNode *parent
{
}
-QList<QAnnotation *> QRenderPassFilter::includes() const
+QVector<QFilterKey *> QRenderPassFilter::matchAny() const
{
Q_D(const QRenderPassFilter);
- return d->m_includeList;
+ return d->m_matchList;
}
-void QRenderPassFilter::addInclude(QAnnotation *annotation)
+void QRenderPassFilter::addMatch(QFilterKey *filterKey)
{
+ Q_ASSERT(filterKey);
Q_D(QRenderPassFilter);
- if (!d->m_includeList.contains(annotation)) {
- d->m_includeList.append(annotation);
+ if (!d->m_matchList.contains(filterKey)) {
+ d->m_matchList.append(filterKey);
// We need to add it as a child of the current node if it has been declared inline
// Or not previously added as a child of the current node so that
// 1) The backend gets notified about it's creation
// 2) When the current node is destroyed, it gets destroyed as well
- if (!annotation->parent())
- annotation->setParent(this);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- propertyChange->setPropertyName("include");
- propertyChange->setValue(QVariant::fromValue(annotation->id()));
- d->notifyObservers(propertyChange);
+ if (!filterKey->parent())
+ filterKey->setParent(this);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), filterKey);
+ change->setPropertyName("match");
+ d->notifyObservers(change);
}
}
}
-void QRenderPassFilter::removeInclude(QAnnotation *annotation)
+void QRenderPassFilter::removeMatch(QFilterKey *filterKey)
{
+ Q_ASSERT(filterKey);
Q_D(QRenderPassFilter);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- propertyChange->setPropertyName("include");
- propertyChange->setValue(QVariant::fromValue(annotation->id()));
- d->notifyObservers(propertyChange);
- }
- d->m_includeList.removeOne(annotation);
-}
-void QRenderPassFilter::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QRenderPassFilter *other = static_cast<const QRenderPassFilter*>(ref);
- Q_FOREACH (QAnnotation *c, other->d_func()->m_includeList)
- addInclude(qobject_cast<QAnnotation *>(QNode::clone(c)));
- Q_FOREACH (QParameter *p, other->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), filterKey);
+ change->setPropertyName("match");
+ d->notifyObservers(change);
+ }
+ d->m_matchList.removeOne(filterKey);
}
void QRenderPassFilter::addParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QRenderPassFilter);
if (!d->m_parameters.contains(parameter)) {
d->m_parameters.append(parameter);
@@ -126,10 +123,9 @@ void QRenderPassFilter::addParameter(QParameter *parameter)
if (!parameter->parent())
parameter->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
}
@@ -137,23 +133,33 @@ void QRenderPassFilter::addParameter(QParameter *parameter)
void QRenderPassFilter::removeParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QRenderPassFilter);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
d->m_parameters.removeOne(parameter);
}
-QList<QParameter *> QRenderPassFilter::parameters() const
+QVector<QParameter *> QRenderPassFilter::parameters() const
{
Q_D(const QRenderPassFilter);
return d->m_parameters;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderPassFilter::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderPassFilterData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QRenderPassFilter);
+ data.matchIds = qIdsForNodes(d->m_matchList);
+ data.parameterIds = qIdsForNodes(d->m_parameters);
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/framegraph/qrenderpassfilter.h b/src/render/framegraph/qrenderpassfilter.h
index 4060c267c..934d0479b 100644
--- a/src/render/framegraph/qrenderpassfilter.h
+++ b/src/render/framegraph/qrenderpassfilter.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,7 +50,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QRenderPassFilterPrivate;
-class QAnnotation;
+class QFilterKey;
class QParameter;
class QT3DRENDERSHARED_EXPORT QRenderPassFilter : public QFrameGraphNode
@@ -55,24 +58,23 @@ class QT3DRENDERSHARED_EXPORT QRenderPassFilter : public QFrameGraphNode
Q_OBJECT
public:
- explicit QRenderPassFilter(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QRenderPassFilter(Qt3DCore::QNode *parent = nullptr);
~QRenderPassFilter();
- QList<QAnnotation *> includes() const;
- void addInclude(QAnnotation *criterion);
- void removeInclude(QAnnotation *criterion);
+ QVector<QFilterKey*> matchAny() const;
+ void addMatch(QFilterKey *filterKey);
+ void removeMatch(QFilterKey *filterKey);
- void addParameter(QParameter *p);
- void removeParameter(QParameter *p);
- QList<QParameter *> parameters() const;
+ void addParameter(QParameter *parameter);
+ void removeParameter(QParameter *parameter);
+ QVector<QParameter *> parameters() const;
protected:
- QRenderPassFilter(QRenderPassFilterPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QRenderPassFilter(QRenderPassFilterPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QRenderPassFilter)
- QT3D_CLONEABLE(QRenderPassFilter)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qrenderpassfilter_p.h b/src/render/framegraph/qrenderpassfilter_p.h
index 1d92470ee..d4b68eaba 100644
--- a/src/render/framegraph/qrenderpassfilter_p.h
+++ b/src/render/framegraph/qrenderpassfilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,8 +68,14 @@ public:
Q_DECLARE_PUBLIC(QRenderPassFilter)
QString m_renderPassName;
- QList<QAnnotation *> m_includeList;
- QList<QParameter *> m_parameters;
+ QVector<QFilterKey *> m_matchList;
+ QVector<QParameter *> m_parameters;
+};
+
+struct QRenderPassFilterData
+{
+ Qt3DCore::QNodeIdVector matchIds;
+ Qt3DCore::QNodeIdVector parameterIds;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qrenderstateset.cpp b/src/render/framegraph/qrenderstateset.cpp
new file mode 100644
index 000000000..5d0db339a
--- /dev/null
+++ b/src/render/framegraph/qrenderstateset.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qrenderstateset.h"
+#include "qrenderstateset_p.h"
+
+#include <Qt3DRender/qrenderstate.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+
+QRenderStateSetPrivate::QRenderStateSetPrivate()
+ : QFrameGraphNodePrivate()
+{
+}
+
+/*!
+ * \class Qt3DRender::QRenderStateSet
+ * \inmodule Qt3DRender
+ *
+ * \brief The QRenderStateSet \l {QFrameGraphNode}{FrameGraph} node offers a way of
+ * specifying a set of QRenderState objects to be applied during the execution
+ * of a framegraph branch.
+ *
+ * States set on a QRenderStateSet are set globally, contrary to the per-material
+ * states that can be set on a QRenderPass. By default, an empty
+ * QRenderStateSet will result in all render states being disabled when
+ * executed. Adding a QRenderState state explicitly enables that render
+ * state at runtime.
+ *
+ * \since 5.5
+ *
+ * \sa QRenderState, QRenderPass
+ */
+
+QRenderStateSet::QRenderStateSet(QNode *parent)
+ : QFrameGraphNode(*new QRenderStateSetPrivate, parent)
+{
+}
+
+/*! \internal */
+QRenderStateSet::~QRenderStateSet()
+{
+}
+
+/*!
+ * Adds a new QRenderState \a state to the QRenderStateSet instance.
+ *
+ * \note Not setting any QRenderState state on a QRenderStateSet instance
+ * implies all the render states will be disabled at render time.
+ */
+void QRenderStateSet::addRenderState(QRenderState *state)
+{
+ Q_ASSERT(state);
+ Q_D(QRenderStateSet);
+
+ if (!d->m_renderStates.contains(state)) {
+ d->m_renderStates.append(state);
+
+ if (!state->parent())
+ state->setParent(this);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), state);
+ change->setPropertyName("renderState");
+ d->notifyObservers(change);
+ }
+ }
+}
+
+/*!
+ * Removes the QRenderState \a state from the QRenderStateSet instance.
+ */
+void QRenderStateSet::removeRenderState(QRenderState *state)
+{
+ Q_ASSERT(state);
+ Q_D(QRenderStateSet);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), state);
+ change->setPropertyName("renderState");
+ d->notifyObservers(change);
+ }
+ d->m_renderStates.removeOne(state);
+}
+
+/*!
+ * Returns the list of QRenderState objects that compose the QRenderStateSet instance.
+ */
+QVector<QRenderState *> QRenderStateSet::renderStates() const
+{
+ Q_D(const QRenderStateSet);
+ return d->m_renderStates;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderStateSet::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderStateSetData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QRenderStateSet);
+ data.renderStateIds = qIdsForNodes(d->m_renderStates);
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qrenderstateset.h b/src/render/framegraph/qrenderstateset.h
new file mode 100644
index 000000000..52efaf24e
--- /dev/null
+++ b/src/render/framegraph/qrenderstateset.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERSTATESET_H
+#define QT3DRENDER_QRENDERSTATESET_H
+
+#include <Qt3DRender/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderStateSetPrivate;
+class QRenderState;
+
+class QT3DRENDERSHARED_EXPORT QRenderStateSet : public QFrameGraphNode
+{
+ Q_OBJECT
+
+public:
+ explicit QRenderStateSet(Qt3DCore::QNode *parent = nullptr);
+ ~QRenderStateSet();
+
+ void addRenderState(QRenderState *state);
+ void removeRenderState(QRenderState *state);
+ QVector<QRenderState *> renderStates() const;
+
+protected:
+ explicit QRenderStateSet(QRenderStateSetPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QRenderStateSet)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERSTATESET_H
diff --git a/src/render/framegraph/qrenderstateset_p.h b/src/render/framegraph/qrenderstateset_p.h
new file mode 100644
index 000000000..2ac1db467
--- /dev/null
+++ b/src/render/framegraph/qrenderstateset_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERSTATESET_P_H
+#define QT3DRENDER_QRENDERSTATESET_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qframegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderStateSet;
+class QRenderState;
+
+class QRenderStateSetPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QRenderStateSetPrivate();
+
+ Q_DECLARE_PUBLIC(QRenderStateSet)
+ QVector<QRenderState *> m_renderStates;
+};
+
+struct QRenderStateSetData
+{
+ Qt3DCore::QNodeIdVector renderStateIds;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERSTATESET_P_H
+
diff --git a/src/render/framegraph/qrendersurfaceselector.cpp b/src/render/framegraph/qrendersurfaceselector.cpp
new file mode 100644
index 000000000..9acd4d5e1
--- /dev/null
+++ b/src/render/framegraph/qrendersurfaceselector.cpp
@@ -0,0 +1,244 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qrendersurfaceselector.h"
+#include "qrendersurfaceselector_p.h"
+
+#include <QtGui/qwindow.h>
+#include <QtGui/qoffscreensurface.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ * \class Qt3DRender::QRenderSurfaceSelector
+ * \inmodule Qt3DRender
+ * \brief QRenderSurfaceSelector
+ * \since
+ *
+ * \inherits Qt3DRender::QFrameGraphNode
+ *
+ */
+
+/*!
+ * \qmltype RenderSurfaceSelector
+ * \inqmlmodule Qt3D.Render
+ * \since
+ * \ingroup
+ * \instantiates Qt3DRender::QRenderSurfaceSelector
+ * \brief RenderSurfaceSelector
+ *
+ */
+
+/*! \qmlproperty QSurface Qt3D.Render::RenderSurfaceSelector::surface
+ *
+ * Holds the surface.
+ */
+
+/*! \qmlproperty QWindow Qt3D.Render::RenderSurfaceSelector::window
+ *
+ * Holds the window.
+ */
+
+/*! \qmlproperty QSize Qt3D.Render::RenderSurfaceSelector::externalRenderTargetSize
+ *
+ * Holds the size of the external render target.
+ */
+
+QRenderSurfaceSelectorPrivate::QRenderSurfaceSelectorPrivate()
+ : Qt3DRender::QFrameGraphNodePrivate()
+ , m_surface(nullptr)
+ , m_surfaceEventFilter(new Qt3DRender::Render::PlatformSurfaceFilter())
+{
+}
+
+void QRenderSurfaceSelectorPrivate::setExternalRenderTargetSize(const QSize &size)
+{
+ m_externalRenderTargetSize = size;
+}
+
+/*!
+ * Constructs QRenderSurfaceSelector with given \a parent.
+ */
+QRenderSurfaceSelector::QRenderSurfaceSelector(Qt3DCore::QNode *parent)
+ : Qt3DRender::QFrameGraphNode(*new QRenderSurfaceSelectorPrivate, parent)
+{
+}
+
+/*!
+ * \internal
+ */
+QRenderSurfaceSelector::~QRenderSurfaceSelector()
+{
+}
+
+/*!
+ * \internal
+ */
+QRenderSurfaceSelector::QRenderSurfaceSelector(QRenderSurfaceSelectorPrivate &dd, Qt3DCore::QNode *parent)
+ : Qt3DRender::QFrameGraphNode(dd, parent)
+{
+}
+
+QObject *QRenderSurfaceSelector::surface() const
+{
+ Q_D(const QRenderSurfaceSelector);
+ QObject *surfaceObj = nullptr;
+ if (!d->m_surface)
+ return surfaceObj;
+
+ switch (d->m_surface->surfaceClass()) {
+ case QSurface::Window:
+ surfaceObj = static_cast<QWindow *>(d->m_surface);
+ break;
+
+ case QSurface::Offscreen:
+ surfaceObj = static_cast<QOffscreenSurface *>(d->m_surface);
+ break;
+ }
+
+ return surfaceObj;
+}
+
+/*! \property QRenderSurfaceSelector::surface
+ *
+ * Sets \a surface.
+ */
+void QRenderSurfaceSelector::setSurface(QObject *surfaceObject)
+{
+ Q_D(QRenderSurfaceSelector);
+ QSurface *surface = nullptr;
+ if (surfaceObject) {
+ QWindow *window = qobject_cast<QWindow *>(surfaceObject);
+ if (window) {
+ surface = static_cast<QSurface *>(window);
+ } else {
+ QOffscreenSurface *offscreen = qobject_cast<QOffscreenSurface *>(surfaceObject);
+ if (offscreen)
+ surface = static_cast<QSurface *>(offscreen);
+ }
+
+ Q_ASSERT_X(surface, Q_FUNC_INFO, "surfaceObject is not a valid QSurface * object");
+ }
+
+ if (d->m_surface == surface)
+ return;
+ d->m_surface = surface;
+
+ // The platform surface filter only deals with QObject
+ // We assume therefore that our surface is actually a QObject underneath
+ if (d->m_surface) {
+ switch (d->m_surface->surfaceClass()) {
+ case QSurface::Window: {
+ QWindow *window = static_cast<QWindow *>(d->m_surface);
+ d->m_surfaceEventFilter->setSurface(window);
+
+ if (window) {
+ QObject::connect(window, &QWindow::widthChanged, [=] (int width) {
+ if (d->m_changeArbiter != nullptr) {
+ Qt3DCore::QPropertyUpdatedChangePtr change(
+ new Qt3DCore::QPropertyUpdatedChange(id()));
+
+ change->setPropertyName("width");
+ change->setValue(QVariant::fromValue(width));
+ d->notifyObservers(change);
+ }
+ });
+ QObject::connect(window, &QWindow::heightChanged, [=] (int height) {
+ if (d->m_changeArbiter != nullptr) {
+ Qt3DCore::QPropertyUpdatedChangePtr change(
+ new Qt3DCore::QPropertyUpdatedChange(id()));
+
+ change->setPropertyName("height");
+ change->setValue(QVariant::fromValue(height));
+ d->notifyObservers(change);
+ }
+ });
+ }
+
+ break;
+ }
+ case QSurface::Offscreen: {
+ d->m_surfaceEventFilter->setSurface(static_cast<QOffscreenSurface *>(d->m_surface));
+ break;
+ }
+
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+ } else {
+ QWindow *nullWindow = nullptr;
+ d->m_surfaceEventFilter->setSurface(nullWindow);
+ }
+ emit surfaceChanged(surfaceObject);
+}
+
+QSize QRenderSurfaceSelector::externalRenderTargetSize() const
+{
+ Q_D(const QRenderSurfaceSelector);
+ return d->externalRenderTargetSize();
+}
+
+/*!
+ * Sets render target \a size if different than underlying surface size.
+ * Tells picking the correct size.
+ */
+void QRenderSurfaceSelector::setExternalRenderTargetSize(const QSize &size)
+{
+ Q_D(QRenderSurfaceSelector);
+ d->setExternalRenderTargetSize(size);
+ emit externalRenderTargetSizeChanged(size);
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderSurfaceSelector::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderSurfaceSelectorData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QRenderSurfaceSelector);
+ data.surface = QPointer<QObject>(surface());
+ data.externalRenderTargetSize = d->m_externalRenderTargetSize;
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qrendersurfaceselector.h b/src/render/framegraph/qrendersurfaceselector.h
new file mode 100644
index 000000000..57602a89d
--- /dev/null
+++ b/src/render/framegraph/qrendersurfaceselector.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERSURFACESELECTOR_H
+#define QT3DRENDER_QRENDERSURFACESELECTOR_H
+
+#include <Qt3DRender/qframegraphnode.h>
+#include <Qt3DRender/qt3drender_global.h>
+#include <QtCore/QSize>
+
+QT_BEGIN_NAMESPACE
+
+class QSurface;
+class QWindow;
+
+namespace Qt3DRender {
+
+class QRenderSurfaceSelectorPrivate;
+
+class QT3DRENDERSHARED_EXPORT QRenderSurfaceSelector : public Qt3DRender::QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
+ Q_PROPERTY(QSize externalRenderTargetSize READ externalRenderTargetSize NOTIFY externalRenderTargetSizeChanged)
+
+public:
+ explicit QRenderSurfaceSelector(Qt3DCore::QNode *parent = nullptr);
+ ~QRenderSurfaceSelector();
+
+ QObject *surface() const;
+ QSize externalRenderTargetSize() const;
+ void setExternalRenderTargetSize(const QSize &size);
+
+public Q_SLOTS:
+ void setSurface(QObject *surfaceObject);
+
+Q_SIGNALS:
+ void surfaceChanged(QObject *surface);
+ void externalRenderTargetSizeChanged(const QSize &size);
+
+protected:
+ Q_DECLARE_PRIVATE(QRenderSurfaceSelector)
+ explicit QRenderSurfaceSelector(QRenderSurfaceSelectorPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERSURFACESELECTOR_H
diff --git a/src/render/framegraph/qrendersurfaceselector_p.h b/src/render/framegraph/qrendersurfaceselector_p.h
new file mode 100644
index 000000000..b678bc0b6
--- /dev/null
+++ b/src/render/framegraph/qrendersurfaceselector_p.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QRENDERSURFACESELECTOR_P_H
+#define QRENDERSURFACESELECTOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qframegraphnode_p.h>
+#include <Qt3DRender/private/platformsurfacefilter_p.h>
+#include <QtGui/qsurface.h>
+#include <QtGui/qwindow.h>
+#include <QtCore/qpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderSurfaceSelectorPrivate : public Qt3DRender::QFrameGraphNodePrivate
+{
+public:
+ QRenderSurfaceSelectorPrivate();
+
+ void setExternalRenderTargetSize(const QSize &size);
+ QSize externalRenderTargetSize() const { return m_externalRenderTargetSize; }
+
+ QSurface *m_surface;
+ QSize m_externalRenderTargetSize;
+ QScopedPointer<Qt3DRender::Render::PlatformSurfaceFilter> m_surfaceEventFilter;
+};
+
+struct QRenderSurfaceSelectorData
+{
+ QPointer<QObject> surface;
+ QSize externalRenderTargetSize;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QRENDERSURFACESELECTOR_P_H
diff --git a/src/render/framegraph/qrendertargetselector.cpp b/src/render/framegraph/qrendertargetselector.cpp
index 5b31941f5..f90e977a8 100644
--- a/src/render/framegraph/qrendertargetselector.cpp
+++ b/src/render/framegraph/qrendertargetselector.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#include "qrendertargetselector.h"
#include "qrendertargetselector_p.h"
#include <Qt3DRender/qrendertarget.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/private/qrenderpass_p.h>
QT_BEGIN_NAMESPACE
@@ -48,29 +51,18 @@ namespace Qt3DRender {
QRenderTargetSelectorPrivate::QRenderTargetSelectorPrivate()
: QFrameGraphNodePrivate()
- , m_target(Q_NULLPTR)
+ , m_target(nullptr)
{
}
-void QRenderTargetSelector::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
-
- const QRenderTargetSelector *other = static_cast<const QRenderTargetSelector*>(ref);
-
- setDrawBuffers(other->drawBuffers());
- if (other->d_func()->m_target)
- setTarget(qobject_cast<QRenderTarget *>(QNode::clone(other->d_func()->m_target)));
-}
-
QRenderTargetSelector::QRenderTargetSelector(QNode *parent)
: QFrameGraphNode(*new QRenderTargetSelectorPrivate, parent)
{
}
+/*! \internal */
QRenderTargetSelector::~QRenderTargetSelector()
{
- QNode::cleanup();
}
void QRenderTargetSelector::setTarget(QRenderTarget *target)
@@ -80,7 +72,7 @@ void QRenderTargetSelector::setTarget(QRenderTarget *target)
d->m_target = target;
// For inline declaration cases
- if (target != Q_NULLPTR && !target->parent())
+ if (target != nullptr && !target->parent())
target->setParent(this);
emit targetChanged(target);
}
@@ -95,7 +87,7 @@ QRenderTarget *QRenderTargetSelector::target() const
/*!
* \internal
* Sets the draw buffers \a buffers to be used. The draw buffers should be
- * matching the Qt3DRender::QRenderAttachment::RenderAttachmentType
+ * matching the Qt3DRender::QRenderTargetOutput::RenderAttachmentType
* defined in the attachments of the Qt3DRender::QRenderTarget associated to the
* Qt3DRender::QRenderTargetSelector instance.
*
@@ -103,16 +95,16 @@ QRenderTarget *QRenderTargetSelector::target() const
* default to using all the attachments' draw buffers.
*
*/
-void QRenderTargetSelector::setDrawBuffers(const QList<QRenderAttachment::RenderAttachmentType> &buffers)
+void QRenderTargetSelector::setOutputs(const QVector<QRenderTargetOutput::AttachmentPoint> &buffers)
{
Q_D(QRenderTargetSelector);
- if (buffers != d->m_drawBuffers) {
- d->m_drawBuffers = buffers;
+ if (buffers != d->m_outputs) {
+ d->m_outputs = buffers;
if (d->m_changeArbiter) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
- change->setPropertyName("drawBuffers");
- change->setValue(QVariant::fromValue(d->m_drawBuffers));
+ auto change = QPropertyUpdatedChangePtr::create(d->m_id);
+ change->setPropertyName("outputs");
+ change->setValue(QVariant::fromValue(d->m_outputs));
d->notifyObservers(change);
}
}
@@ -121,10 +113,10 @@ void QRenderTargetSelector::setDrawBuffers(const QList<QRenderAttachment::Render
/*!
* Returns the list of draw buffers for the current Qt3DRender::QRenderTargetSelector instance.
*/
-QList<QRenderAttachment::RenderAttachmentType> QRenderTargetSelector::drawBuffers() const
+QVector<QRenderTargetOutput::AttachmentPoint> QRenderTargetSelector::outputs() const
{
Q_D(const QRenderTargetSelector);
- return d->m_drawBuffers;
+ return d->m_outputs;
}
QRenderTargetSelector::QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, QNode *parent)
@@ -132,6 +124,16 @@ QRenderTargetSelector::QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, Q
{
}
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderTargetSelector::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderTargetSelectorData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QRenderTargetSelector);
+ data.targetId = qIdForNode(d->m_target);
+ data.outputs = d->m_outputs;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/framegraph/qrendertargetselector.h b/src/render/framegraph/qrendertargetselector.h
index 3b6b86d71..a92fe1335 100644
--- a/src/render/framegraph/qrendertargetselector.h
+++ b/src/render/framegraph/qrendertargetselector.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,7 +43,7 @@
#include <Qt3DRender/qt3drender_global.h>
#include <Qt3DCore/qnode.h>
#include <Qt3DRender/qframegraphnode.h>
-#include <Qt3DRender/qrenderattachment.h>
+#include <Qt3DRender/qrendertargetoutput.h>
QT_BEGIN_NAMESPACE
@@ -54,13 +57,13 @@ class QT3DRENDERSHARED_EXPORT QRenderTargetSelector : public QFrameGraphNode
Q_OBJECT
Q_PROPERTY(Qt3DRender::QRenderTarget *target READ target WRITE setTarget NOTIFY targetChanged)
public:
- explicit QRenderTargetSelector(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QRenderTargetSelector(Qt3DCore::QNode *parent = nullptr);
~QRenderTargetSelector();
QRenderTarget *target() const;
- void setDrawBuffers(const QList<QRenderAttachment::RenderAttachmentType> &buffers);
- QList<QRenderAttachment::RenderAttachmentType> drawBuffers() const;
+ void setOutputs(const QVector<QRenderTargetOutput::AttachmentPoint> &buffers);
+ QVector<QRenderTargetOutput::AttachmentPoint> outputs() const;
public Q_SLOTS:
void setTarget(QRenderTarget *target);
@@ -69,18 +72,17 @@ Q_SIGNALS:
void targetChanged(QRenderTarget *target);
protected:
- QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QRenderTargetSelector)
- QT3D_CLONEABLE(QRenderTargetSelector)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QList<Qt3DRender::QRenderAttachment::RenderAttachmentType>)
+Q_DECLARE_METATYPE(QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint>)
#endif // QT3DRENDER_QRENDERTARGETSELECTOR_H
diff --git a/src/render/framegraph/qrendertargetselector_p.h b/src/render/framegraph/qrendertargetselector_p.h
index f288bca83..be3ebea1c 100644
--- a/src/render/framegraph/qrendertargetselector_p.h
+++ b/src/render/framegraph/qrendertargetselector_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -64,7 +67,13 @@ public:
Q_DECLARE_PUBLIC(QRenderTargetSelector)
QRenderTarget *m_target;
- QList<QRenderAttachment::RenderAttachmentType> m_drawBuffers;
+ QVector<QRenderTargetOutput::AttachmentPoint> m_outputs;
+};
+
+struct QRenderTargetSelectorData
+{
+ Qt3DCore::QNodeId targetId;
+ QVector<QRenderTargetOutput::AttachmentPoint> outputs;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qsortcriterion.cpp b/src/render/framegraph/qsortcriterion.cpp
index b26f337c3..f5252b1f7 100644
--- a/src/render/framegraph/qsortcriterion.cpp
+++ b/src/render/framegraph/qsortcriterion.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "qsortcriterion.h"
#include "qsortcriterion_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qnodepropertychange.h>
QT_BEGIN_NAMESPACE
@@ -48,23 +51,11 @@ QSortCriterionPrivate::QSortCriterionPrivate()
{
}
-void QSortCriterion::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QSortCriterion *s = static_cast<const QSortCriterion*>(ref);
- d_func()->m_sort = s->d_func()->m_sort;
-}
-
QSortCriterion::QSortCriterion(QNode *parent)
: QNode(*new QSortCriterionPrivate, parent)
{
}
-QSortCriterion::~QSortCriterion()
-{
- QNode::cleanup();
-}
-
QSortCriterion::SortType QSortCriterion::sort() const
{
Q_D(const QSortCriterion);
diff --git a/src/render/framegraph/qsortcriterion.h b/src/render/framegraph/qsortcriterion.h
index 44f047b13..bf2821550 100644
--- a/src/render/framegraph/qsortcriterion.h
+++ b/src/render/framegraph/qsortcriterion.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,7 +55,6 @@ class QT3DRENDERSHARED_EXPORT QSortCriterion : public Qt3DCore::QNode
Q_PROPERTY(Qt3DRender::QSortCriterion::SortType sort READ sort WRITE setSort NOTIFY sortChanged)
public:
explicit QSortCriterion(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QSortCriterion();
enum SortType {
StateChangeCost = (1 << 0),
@@ -71,10 +73,8 @@ Q_SIGNALS:
protected:
QSortCriterion(QSortCriterionPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
- QT3D_CLONEABLE(QSortCriterion)
Q_DECLARE_PRIVATE(QSortCriterion)
};
diff --git a/src/render/framegraph/qsortcriterion_p.h b/src/render/framegraph/qsortcriterion_p.h
deleted file mode 100644
index f78bd1fd5..000000000
--- a/src/render/framegraph/qsortcriterion_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSORTCRITERION_P_H
-#define QT3DRENDER_QSORTCRITERION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qnode_p.h>
-#include <Qt3DRender/qsortcriterion.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QSortCriterionPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QSortCriterionPrivate();
-
- Q_DECLARE_PUBLIC(QSortCriterion)
- QSortCriterion::SortType m_sort;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSORTCRITERION_P_H
diff --git a/src/render/framegraph/qsortmethod.cpp b/src/render/framegraph/qsortmethod.cpp
deleted file mode 100644
index d484fa411..000000000
--- a/src/render/framegraph/qsortmethod.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsortmethod.h"
-#include "qsortmethod_p.h"
-#include "qsortcriterion_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qsortcriterion.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-
-QSortMethodPrivate::QSortMethodPrivate()
- : QFrameGraphNodePrivate()
-{
-}
-
-void QSortMethod::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QSortMethod *other = static_cast<const QSortMethod*>(ref);
- Q_FOREACH (QSortCriterion *c, other->d_func()->m_criteria)
- addCriterion(qobject_cast<QSortCriterion *>(QNode::clone(c)));
-}
-
-QSortMethod::QSortMethod(QNode *parent)
- : QFrameGraphNode(*new QSortMethodPrivate, parent)
-{
-}
-
-QSortMethod::~QSortMethod()
-{
- QNode::cleanup();
-}
-
-/*! \internal */
-QSortMethod::QSortMethod(QSortMethodPrivate &dd, QNode *parent)
- : QFrameGraphNode(dd, parent)
-{
-}
-
-void QSortMethod::addCriterion(QSortCriterion *criterion)
-{
- Q_D(QSortMethod);
- if (!d->m_criteria.contains(criterion)) {
- d->m_criteria.append(criterion);
-
- if (!criterion->parent())
- criterion->setParent(this);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- propertyChange->setPropertyName("sortCriterion");
- propertyChange->setValue(QVariant::fromValue(criterion->id()));
- d->notifyObservers(propertyChange);
- }
- }
-}
-
-void QSortMethod::removeCriterion(QSortCriterion *criterion)
-{
- Q_D(QSortMethod);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- propertyChange->setPropertyName("sortCriterion");
- propertyChange->setValue(QVariant::fromValue(criterion->id()));
- d->notifyObservers(propertyChange);
- }
- d->m_criteria.removeOne(criterion);
-}
-
-QList<QSortCriterion *> QSortMethod::criteria() const
-{
- Q_D(const QSortMethod);
- return d->m_criteria;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/qsortmethod.h b/src/render/framegraph/qsortmethod.h
deleted file mode 100644
index bffce84c5..000000000
--- a/src/render/framegraph/qsortmethod.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSORTMETHOD_H
-#define QT3DRENDER_QSORTMETHOD_H
-
-#include <Qt3DRender/qframegraphnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QSortCriterion;
-class QSortMethodPrivate;
-
-class QT3DRENDERSHARED_EXPORT QSortMethod : public QFrameGraphNode
-{
- Q_OBJECT
-
-public:
- explicit QSortMethod(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QSortMethod();
-
- void addCriterion(QSortCriterion *criterion);
- void removeCriterion(QSortCriterion *criterion);
- QList<QSortCriterion *> criteria() const;
-
-protected:
- QSortMethod(QSortMethodPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QSortMethod)
- QT3D_CLONEABLE(QSortMethod)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSORTMETHOD_H
diff --git a/src/render/framegraph/qsortmethod_p.h b/src/render/framegraph/qsortmethod_p.h
deleted file mode 100644
index 149550389..000000000
--- a/src/render/framegraph/qsortmethod_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSORTMETHOD_P_H
-#define QT3DRENDER_QSORTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qframegraphnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QSortMethod;
-class QSortCriterion;
-
-class QSortMethodPrivate : public QFrameGraphNodePrivate
-{
-public:
- QSortMethodPrivate();
- Q_DECLARE_PUBLIC(QSortMethod)
- QList<QSortCriterion *> m_criteria;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSORTMETHOD_P_H
diff --git a/src/render/framegraph/qsortpolicy.cpp b/src/render/framegraph/qsortpolicy.cpp
new file mode 100644
index 000000000..ec4f58850
--- /dev/null
+++ b/src/render/framegraph/qsortpolicy.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsortpolicy_p.h"
+#include <Qt3DCore/qpropertyvalueaddedchange.h>
+#include <Qt3DCore/qpropertyvalueremovedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+
+QSortPolicyPrivate::QSortPolicyPrivate()
+ : QFrameGraphNodePrivate()
+{
+}
+
+QSortPolicy::QSortPolicy(QNode *parent)
+ : QFrameGraphNode(*new QSortPolicyPrivate, parent)
+{
+}
+
+/*! \internal */
+QSortPolicy::~QSortPolicy()
+{
+}
+
+/*! \internal */
+QSortPolicy::QSortPolicy(QSortPolicyPrivate &dd, QNode *parent)
+ : QFrameGraphNode(dd, parent)
+{
+}
+
+QNodeCreatedChangeBasePtr QSortPolicy::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QSortPolicyData>::create(this);
+ QSortPolicyData &data = creationChange->data;
+ Q_D(const QSortPolicy);
+ data.sortTypes = d->m_sortTypes;
+ return creationChange;
+}
+
+void QSortPolicy::addSortType(Qt3DRender::QSortPolicy::SortType sortType)
+{
+ Q_D(QSortPolicy);
+ if (!d->m_sortTypes.contains(sortType)) {
+ d->m_sortTypes.append(sortType);
+
+ if (d->m_changeArbiter != nullptr) {
+ QPropertyValueAddedChangePtr propertyChange(new QPropertyValueAddedChange(id()));
+ propertyChange->setPropertyName("sortType");
+ propertyChange->setAddedValue(QVariant::fromValue(sortType));
+ d->notifyObservers(propertyChange);
+ }
+ }
+}
+
+void QSortPolicy::removeSortType(SortType sortType)
+{
+ Q_D(QSortPolicy);
+ if (d->m_changeArbiter != nullptr) {
+ QPropertyValueRemovedChangePtr propertyChange(new QPropertyValueRemovedChange(id()));
+ propertyChange->setPropertyName("sortType");
+ propertyChange->setRemovedValue(QVariant::fromValue(sortType));
+ d->notifyObservers(propertyChange);
+ }
+ d->m_sortTypes.removeOne(sortType);
+}
+
+QVector<QSortPolicy::SortType> QSortPolicy::sortTypes() const
+{
+ Q_D(const QSortPolicy);
+ return d->m_sortTypes;
+}
+
+QVariantList QSortPolicy::sortTypeList() const
+{
+ Q_D(const QSortPolicy);
+ QVariantList ret;
+ ret.reserve(d->m_sortTypes.size());
+ for (const auto type : d->m_sortTypes)
+ ret.append(QVariant(type));
+
+ return ret;
+}
+
+void QSortPolicy::setSortTypes(QVector<QSortPolicy::SortType> sortTypes)
+{
+ Q_D(QSortPolicy);
+ d->m_sortTypes = std::move(sortTypes);
+}
+
+void QSortPolicy::setSortTypes(const QVariantList &sortTypes)
+{
+ Q_D(QSortPolicy);
+ d->m_sortTypes.clear();
+ for (const auto &typeVariant : sortTypes)
+ d->m_sortTypes.append(static_cast<QSortPolicy::SortType>(typeVariant.toInt()));
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/qsortpolicy.h b/src/render/framegraph/qsortpolicy.h
new file mode 100644
index 000000000..ba92b542c
--- /dev/null
+++ b/src/render/framegraph/qsortpolicy.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSORTPOLICY_H
+#define QT3DRENDER_QSORTPOLICY_H
+
+#include <Qt3DRender/qframegraphnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSortPolicyPrivate;
+
+class QT3DRENDERSHARED_EXPORT QSortPolicy : public QFrameGraphNode
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariantList sortTypes READ sortTypeList WRITE setSortTypes NOTIFY sortTypesChanged)
+public:
+ explicit QSortPolicy(Qt3DCore::QNode *parent = nullptr);
+ ~QSortPolicy();
+
+ enum SortType {
+ StateChangeCost = (1 << 0),
+ BackToFront = (1 << 1),
+ Material = (1 << 2)
+ };
+ Q_ENUM(SortType)
+
+ void addSortType(SortType sortType);
+ void removeSortType(SortType sortType);
+ QVector<SortType> sortTypes() const;
+ QVariantList sortTypeList() const;
+
+public Q_SLOTS:
+ void setSortTypes(QVector<QSortPolicy::SortType> sortTypes);
+ void setSortTypes(const QVariantList &sortTypes);
+
+Q_SIGNALS:
+ void sortTypesChanged(const QVector<SortType> &sortTypes);
+ void sortTypesChanged(const QVariantList &sortTypes);
+
+protected:
+ explicit QSortPolicy(QSortPolicyPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QSortPolicy)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSORTPOLICY_H
diff --git a/src/render/framegraph/qsortpolicy_p.h b/src/render/framegraph/qsortpolicy_p.h
new file mode 100644
index 000000000..e9e27408d
--- /dev/null
+++ b/src/render/framegraph/qsortpolicy_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSORTPOLICY_P_H
+#define QT3DRENDER_QSORTPOLICY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qframegraphnode_p.h>
+#include "qsortpolicy.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+
+class QSortPolicyPrivate : public QFrameGraphNodePrivate
+{
+public:
+ QSortPolicyPrivate();
+ Q_DECLARE_PUBLIC(QSortPolicy)
+ QVector<QSortPolicy::SortType> m_sortTypes;
+};
+
+
+struct QSortPolicyData
+{
+ QVector<QSortPolicy::SortType> sortTypes;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSORTPOLICY_P_H
diff --git a/src/render/framegraph/qstateset.cpp b/src/render/framegraph/qstateset.cpp
deleted file mode 100644
index c36284da0..000000000
--- a/src/render/framegraph/qstateset.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qstateset.h"
-#include "qstateset_p.h"
-
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qrenderstate.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-
-QStateSetPrivate::QStateSetPrivate()
- : QFrameGraphNodePrivate()
-{
-}
-
-/*!
- * \class Qt3DRender::QStateSet
- * \inmodule Qt3DRender
- *
- * \brief The QStateSet \l {QFrameGraphNode}{FrameGraph} node offers a way of
- * specifying a set of QRenderState objects to be applied during the execution
- * of a framegraph branch.
- *
- * States set on a QStateSet are set globally, contrary to the per-material
- * states that can be set on a QRenderPass. By default, an empty
- * QStateSet will result in all render states being disabled when
- * executed. Adding a QRenderState state explicitly enables that render
- * state at runtime.
- *
- * \since 5.5
- *
- * \sa QRenderState, QRenderPass
- */
-
-QStateSet::QStateSet(QNode *parent)
- : QFrameGraphNode(*new QStateSetPrivate, parent)
-{
-}
-
-QStateSet::QStateSet(QStateSetPrivate &dd, QNode *parent)
- : QFrameGraphNode(dd, parent)
-{
-}
-
-QStateSet::~QStateSet()
-{
- QNode::cleanup();
-}
-
-void QStateSet::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QStateSet *other = static_cast<const QStateSet*>(ref);
-
- Q_FOREACH (QRenderState *renderState, other->d_func()->m_renderStates)
- addRenderState(qobject_cast<QRenderState *>(QNode::clone(renderState)));
-}
-
-/*!
- * Adds a new QRenderState \a state to the QStateSet instance.
- *
- * \note Not setting any QRenderState state on a QStateSet instance
- * implies all the render states will be disabled at render time.
- */
-void QStateSet::addRenderState(QRenderState *state)
-{
- Q_D(QStateSet);
-
- if (!d->m_renderStates.contains(state)) {
- d->m_renderStates.append(state);
-
- if (!state->parent())
- state->setParent(this);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- change->setPropertyName("renderState");
- // Since we have no RenderState managers, we need to send a clone
- change->setValue(QVariant::fromValue(QNodePtr(QNode::clone(state))));
- d->notifyObservers(change);
- }
- }
-}
-
-/*!
- * Removes the QRenderState \a state from the QStateSet instance.
- */
-void QStateSet::removeRenderState(QRenderState *state)
-{
- Q_D(QStateSet);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- change->setPropertyName("renderState");
- change->setValue(QVariant::fromValue(state->id()));
- d->notifyObservers(change);
- }
- d->m_renderStates.removeOne(state);
-}
-
-/*!
- * Returns the list of QRenderState objects that compose the QStateSet instance.
- */
-QList<QRenderState *> QStateSet::renderStates() const
-{
- Q_D(const QStateSet);
- return d->m_renderStates;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/qstateset.h b/src/render/framegraph/qstateset.h
deleted file mode 100644
index c9838a403..000000000
--- a/src/render/framegraph/qstateset.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSTATESET_H
-#define QT3DRENDER_QSTATESET_H
-
-#include <Qt3DRender/qframegraphnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QStateSetPrivate;
-class QRenderState;
-
-class QT3DRENDERSHARED_EXPORT QStateSet : public QFrameGraphNode
-{
- Q_OBJECT
-
-public:
- explicit QStateSet(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QStateSet();
-
- void addRenderState(QRenderState *state);
- void removeRenderState(QRenderState *state);
- QList<QRenderState *> renderStates() const;
-
-protected:
- QStateSet(QStateSetPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QStateSet)
- QT3D_CLONEABLE(QStateSet)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSTATESET_H
diff --git a/src/render/framegraph/qstateset_p.h b/src/render/framegraph/qstateset_p.h
deleted file mode 100644
index 5142c36bb..000000000
--- a/src/render/framegraph/qstateset_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSTATESET_P_H
-#define QT3DRENDER_QSTATESET_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qframegraphnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QStateSet;
-class QRenderState;
-
-class QStateSetPrivate : public QFrameGraphNodePrivate
-{
-public:
- QStateSetPrivate();
-
- Q_DECLARE_PUBLIC(QStateSet)
- QList<QRenderState *> m_renderStates;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSTATESET_P_H
-
diff --git a/src/render/framegraph/qtechniquefilter.cpp b/src/render/framegraph/qtechniquefilter.cpp
index eddf9defe..49ac03041 100644
--- a/src/render/framegraph/qtechniquefilter.cpp
+++ b/src/render/framegraph/qtechniquefilter.cpp
@@ -1,35 +1,37 @@
-
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,9 +39,11 @@
#include "qtechniquefilter.h"
#include "qtechniquefilter_p.h"
-#include <Qt3DRender/qannotation.h>
+#include <Qt3DRender/qfilterkey.h>
#include <Qt3DRender/qparameter.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -52,25 +56,14 @@ QTechniqueFilterPrivate::QTechniqueFilterPrivate()
{
}
-void QTechniqueFilter::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QTechniqueFilter *other = static_cast<const QTechniqueFilter*>(ref);
-
- Q_FOREACH (QAnnotation *crit, other->d_func()->m_requireList)
- addRequirement(qobject_cast<QAnnotation *>(QNode::clone(crit)));
- Q_FOREACH (QParameter *p, other->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-}
-
QTechniqueFilter::QTechniqueFilter(QNode *parent)
: QFrameGraphNode(*new QTechniqueFilterPrivate, parent)
{
}
+/*! \internal */
QTechniqueFilter::~QTechniqueFilter()
{
- QNode::cleanup();
}
/*! \internal */
@@ -79,48 +72,49 @@ QTechniqueFilter::QTechniqueFilter(QTechniqueFilterPrivate &dd, QNode *parent)
{
}
-QList<QAnnotation *> QTechniqueFilter::criteria() const
+QVector<QFilterKey *> QTechniqueFilter::matchAll() const
{
Q_D(const QTechniqueFilter);
- return d->m_requireList;
+ return d->m_matchList;
}
-void QTechniqueFilter::addRequirement(QAnnotation *criterion)
+void QTechniqueFilter::addMatch(QFilterKey *filterKey)
{
+ Q_ASSERT(filterKey);
Q_D(QTechniqueFilter);
- if (!d->m_requireList.contains(criterion)) {
- d->m_requireList.append(criterion);
+ if (!d->m_matchList.contains(filterKey)) {
+ d->m_matchList.append(filterKey);
// We need to add it as a child of the current node if it has been declared inline
// Or not previously added as a child of the current node so that
// 1) The backend gets notified about it's creation
// 2) When the current node is destroyed, it gets destroyed as well
- if (!criterion->parent())
- criterion->setParent(this);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- propertyChange->setPropertyName("require");
- propertyChange->setValue(QVariant::fromValue(criterion->id()));
- d->notifyObservers(propertyChange);
+ if (!filterKey->parent())
+ filterKey->setParent(this);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), filterKey);
+ change->setPropertyName("matchAll");
+ d->notifyObservers(change);
}
}
}
-void QTechniqueFilter::removeRequirement(QAnnotation *criterion)
+void QTechniqueFilter::removeMatch(QFilterKey *filterKey)
{
+ Q_ASSERT(filterKey);
Q_D(QTechniqueFilter);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr propertyChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- propertyChange->setPropertyName("require");
- propertyChange->setValue(QVariant::fromValue(criterion->id()));
- d->notifyObservers(propertyChange);
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), filterKey);
+ change->setPropertyName("matchAll");
+ d->notifyObservers(change);
}
- d->m_requireList.removeOne(criterion);
+ d->m_matchList.removeOne(filterKey);
}
void QTechniqueFilter::addParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QTechniqueFilter);
if (!d->m_parameters.contains(parameter)) {
d->m_parameters.append(parameter);
@@ -132,10 +126,9 @@ void QTechniqueFilter::addParameter(QParameter *parameter)
if (!parameter->parent())
parameter->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
}
@@ -143,23 +136,32 @@ void QTechniqueFilter::addParameter(QParameter *parameter)
void QTechniqueFilter::removeParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QTechniqueFilter);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
d->m_parameters.removeOne(parameter);
}
-QList<QParameter *> QTechniqueFilter::parameters() const
+QVector<QParameter *> QTechniqueFilter::parameters() const
{
Q_D(const QTechniqueFilter);
return d->m_parameters;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QTechniqueFilter::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QTechniqueFilterData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QTechniqueFilter);
+ data.matchIds = qIdsForNodes(d->m_matchList);
+ data.parameterIds = qIdsForNodes(d->m_parameters);
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/framegraph/qtechniquefilter.h b/src/render/framegraph/qtechniquefilter.h
index 90f5f7e28..59b297c7d 100644
--- a/src/render/framegraph/qtechniquefilter.h
+++ b/src/render/framegraph/qtechniquefilter.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -45,31 +48,30 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QTechniqueFilterPrivate;
-class QAnnotation;
+class QFilterKey;
class QParameter;
class QT3DRENDERSHARED_EXPORT QTechniqueFilter : public QFrameGraphNode
{
Q_OBJECT
public:
- explicit QTechniqueFilter(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QTechniqueFilter(Qt3DCore::QNode *parent = nullptr);
~QTechniqueFilter();
- QList<QAnnotation *> criteria() const;
- void addRequirement(QAnnotation *criterion);
- void removeRequirement(QAnnotation *criterion);
+ QVector<QFilterKey*> matchAll() const;
+ void addMatch(QFilterKey *filterKey);
+ void removeMatch(QFilterKey *filterKey);
void addParameter(QParameter *p);
void removeParameter(QParameter *p);
- QList<QParameter *> parameters() const;
+ QVector<QParameter *> parameters() const;
protected:
- QTechniqueFilter(QTechniqueFilterPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ QTechniqueFilter(QTechniqueFilterPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QTechniqueFilter)
- QT3D_CLONEABLE(QTechniqueFilter)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qtechniquefilter_p.h b/src/render/framegraph/qtechniquefilter_p.h
index 986e1797b..d25f10a79 100644
--- a/src/render/framegraph/qtechniquefilter_p.h
+++ b/src/render/framegraph/qtechniquefilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,6 +51,7 @@
// We mean it.
//
+#include <Qt3DRender/private/qt3drender_global_p.h>
#include <private/qframegraphnode_p.h>
QT_BEGIN_NAMESPACE
@@ -56,14 +60,20 @@ namespace Qt3DRender {
class QTechniqueFilter;
-class QTechniqueFilterPrivate : public QFrameGraphNodePrivate
+class QT3DRENDERSHARED_PRIVATE_EXPORT QTechniqueFilterPrivate : public QFrameGraphNodePrivate
{
public :
QTechniqueFilterPrivate();
Q_DECLARE_PUBLIC(QTechniqueFilter)
- QList<QAnnotation *> m_requireList;
- QList<QParameter *> m_parameters;
+ QVector<QFilterKey *> m_matchList;
+ QVector<QParameter *> m_parameters;
+};
+
+struct QTechniqueFilterData
+{
+ Qt3DCore::QNodeIdVector matchIds;
+ Qt3DCore::QNodeIdVector parameterIds;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qviewport.cpp b/src/render/framegraph/qviewport.cpp
index 15ef85e02..cdbe7efb5 100644
--- a/src/render/framegraph/qviewport.cpp
+++ b/src/render/framegraph/qviewport.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#include "qviewport.h"
#include "qviewport_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -45,26 +48,18 @@ namespace Qt3DRender {
QViewportPrivate::QViewportPrivate()
: QFrameGraphNodePrivate()
- , m_rect(QRectF(0.0f, 0.0f, 1.0f, 1.0f))
+ , m_normalizedRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f))
{
}
-void QViewport::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QViewport *viewport = static_cast<const QViewport*>(ref);
- d_func()->m_rect = viewport->d_func()->m_rect;
- d_func()->m_clearColor = viewport->d_func()->m_clearColor;
-}
-
QViewport::QViewport(QNode *parent)
: QFrameGraphNode(*new QViewportPrivate, parent)
{
}
+/*! \internal */
QViewport::~QViewport()
{
- QNode::cleanup();
}
/*! \internal */
@@ -73,34 +68,28 @@ QViewport::QViewport(QViewportPrivate &dd, QNode *parent)
{
}
-QRectF QViewport::rect() const
+QRectF QViewport::normalizedRect() const
{
Q_D(const QViewport);
- return d->m_rect;
+ return d->m_normalizedRect;
}
-void QViewport::setRect(const QRectF &rect)
+void QViewport::setNormalizedRect(const QRectF &normalizedRect)
{
Q_D(QViewport);
- if (rect != d->m_rect) {
- d->m_rect = rect;
- emit rectChanged(rect);
+ if (normalizedRect != d->m_normalizedRect) {
+ d->m_normalizedRect = normalizedRect;
+ emit normalizedRectChanged(normalizedRect);
}
}
-QColor QViewport::clearColor() const
+Qt3DCore::QNodeCreatedChangeBasePtr QViewport::createNodeCreationChange() const
{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QViewportData>::create(this);
+ auto &data = creationChange->data;
Q_D(const QViewport);
- return d->m_clearColor;
-}
-
-void QViewport::setClearColor(const QColor &color)
-{
- Q_D(QViewport);
- if (color != d->m_clearColor) {
- d->m_clearColor = color;
- emit clearColorChanged(color);
- }
+ data.normalizedRect = d->m_normalizedRect;
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qviewport.h b/src/render/framegraph/qviewport.h
index 4dd4c17e9..5959ed791 100644
--- a/src/render/framegraph/qviewport.h
+++ b/src/render/framegraph/qviewport.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,31 +53,26 @@ class QViewportPrivate;
class QT3DRENDERSHARED_EXPORT QViewport : public QFrameGraphNode
{
Q_OBJECT
- Q_PROPERTY(QRectF rect READ rect WRITE setRect NOTIFY rectChanged)
- Q_PROPERTY(QColor clearColor READ clearColor WRITE setClearColor NOTIFY clearColorChanged)
+ Q_PROPERTY(QRectF normalizedRect READ normalizedRect WRITE setNormalizedRect NOTIFY normalizedRectChanged)
public:
- explicit QViewport(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QViewport(Qt3DCore::QNode *parent = nullptr);
~QViewport();
- QRectF rect() const;
- QColor clearColor() const;
+ QRectF normalizedRect() const;
public Q_SLOTS:
- void setRect(const QRectF& rect);
- void setClearColor(const QColor &color);
+ void setNormalizedRect(const QRectF& normalizedRect);
Q_SIGNALS:
- void rectChanged(const QRectF& rect);
- void clearColorChanged(const QColor &clearColor);
+ void normalizedRectChanged(const QRectF& normalizedRect);
protected:
- QViewport(QViewportPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QViewport(QViewportPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QViewport)
- QT3D_CLONEABLE(QViewport)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qviewport_p.h b/src/render/framegraph/qviewport_p.h
index 2ee16bdeb..790cd3d06 100644
--- a/src/render/framegraph/qviewport_p.h
+++ b/src/render/framegraph/qviewport_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,10 +65,15 @@ public :
QViewportPrivate();
Q_DECLARE_PUBLIC(QViewport)
- QRectF m_rect;
+ QRectF m_normalizedRect;
QColor m_clearColor;
};
+struct QViewportData
+{
+ QRectF normalizedRect;
+};
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/framegraph/renderpassfilternode.cpp b/src/render/framegraph/renderpassfilternode.cpp
index bd1a48286..c9277b951 100644
--- a/src/render/framegraph/renderpassfilternode.cpp
+++ b/src/render/framegraph/renderpassfilternode.cpp
@@ -1,44 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "renderpassfilternode_p.h"
-#include "qannotation.h"
+#include "qfilterkey.h"
#include "qrenderpassfilter.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/private/qrenderpassfilter_p.h>
#include <Qt3DRender/qparameter.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -52,67 +58,69 @@ RenderPassFilter::RenderPassFilter()
{
}
-void RenderPassFilter::updateFromPeer(Qt3DCore::QNode *peer)
+void RenderPassFilter::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QRenderPassFilter *filter = static_cast<QRenderPassFilter *>(peer);
- m_filters.clear();
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QRenderPassFilterData>>(change);
+ const auto &data = typedChange->data;
+ m_filters = data.matchIds;
m_parameterPack.clear();
- setEnabled(filter->isEnabled());
- Q_FOREACH (QAnnotation *criterion, filter->includes())
- appendFilter(criterion->id());
- Q_FOREACH (QParameter *p, filter->parameters())
- m_parameterPack.appendParameter(p->id());
+ m_parameterPack.setParameters(data.parameterIds);
}
-QList<Qt3DCore::QNodeId> RenderPassFilter::filters() const
+QVector<Qt3DCore::QNodeId> RenderPassFilter::filters() const
{
return m_filters;
}
-void RenderPassFilter::appendFilter(const Qt3DCore::QNodeId &criterionId)
+void RenderPassFilter::appendFilter(Qt3DCore::QNodeId criterionId)
{
if (!m_filters.contains(criterionId))
m_filters.append(criterionId);
}
-void RenderPassFilter::removeFilter(const Qt3DCore::QNodeId &criterionId)
+void RenderPassFilter::removeFilter(Qt3DCore::QNodeId criterionId)
{
m_filters.removeOne(criterionId);
}
-QList<Qt3DCore::QNodeId> RenderPassFilter::parameters() const
+QVector<Qt3DCore::QNodeId> RenderPassFilter::parameters() const
{
return m_parameterPack.parameters();
}
void RenderPassFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
switch (e->type()) {
- case NodeUpdated: {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
- }
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("match")) {
+ appendFilter(change->addedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ } else if (change->propertyName() == QByteArrayLiteral("parameter")) {
+ m_parameterPack.appendParameter(change->addedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ }
break;
-
- case NodeAdded: {
- if (propertyChange->propertyName() == QByteArrayLiteral("include"))
- appendFilter(propertyChange->value().value<QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
- m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
}
+
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("match")) {
+ removeFilter(change->removedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ } else if (change->propertyName() == QByteArrayLiteral("parameter")) {
+ m_parameterPack.removeParameter(change->removedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ }
break;
- case NodeRemoved: {
- if (propertyChange->propertyName() == QByteArrayLiteral("include"))
- removeFilter(propertyChange->value().value<QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
- m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>());
}
- break;
+
default:
break;
}
+ FrameGraphNode::sceneChangeEvent(e);
}
} // namespace Render
diff --git a/src/render/framegraph/renderpassfilternode_p.h b/src/render/framegraph/renderpassfilternode_p.h
index e1625c3ba..ee9137b04 100644
--- a/src/render/framegraph/renderpassfilternode_p.h
+++ b/src/render/framegraph/renderpassfilternode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -56,7 +59,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAnnotation;
+class QFilterKey;
class QRenderPassFilter;
template <typename T, uint INDEXBITS>
@@ -64,21 +67,21 @@ class QHandle;
namespace Render {
-class RenderPassFilter
- : public Render::FrameGraphNode
+class RenderPassFilter : public Render::FrameGraphNode
{
public:
RenderPassFilter();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- QList<Qt3DCore::QNodeId> filters() const;
- QList<Qt3DCore::QNodeId> parameters() const;
- void appendFilter(const Qt3DCore::QNodeId &criterionId);
- void removeFilter(const Qt3DCore::QNodeId &criterionId);
+ QVector<Qt3DCore::QNodeId> filters() const;
+ QVector<Qt3DCore::QNodeId> parameters() const;
+ void appendFilter(Qt3DCore::QNodeId criterionId);
+ void removeFilter(Qt3DCore::QNodeId criterionId);
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
- QList<Qt3DCore::QNodeId> m_filters;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<Qt3DCore::QNodeId> m_filters;
ParameterPack m_parameterPack;
};
diff --git a/src/render/framegraph/rendersurfaceselector.cpp b/src/render/framegraph/rendersurfaceselector.cpp
new file mode 100644
index 000000000..c0059e686
--- /dev/null
+++ b/src/render/framegraph/rendersurfaceselector.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "rendersurfaceselector_p.h"
+#include <Qt3DRender/qrendersurfaceselector.h>
+#include <Qt3DRender/private/qrendersurfaceselector_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+#include <QtGui/qwindow.h>
+#include <QtGui/qscreen.h>
+#include <QtGui/qoffscreensurface.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace {
+
+QSurface *surfaceFromQObject(QObject *o)
+{
+ QSurface *surface = nullptr;
+ QWindow *window = qobject_cast<QWindow *>(o);
+ if (window) {
+ surface = static_cast<QSurface *>(window);
+ } else {
+ QOffscreenSurface *offscreen = qobject_cast<QOffscreenSurface *>(o);
+ if (offscreen)
+ surface = static_cast<QSurface *>(offscreen);
+ }
+ return surface;
+}
+
+}
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderSurfaceSelector::RenderSurfaceSelector()
+ : FrameGraphNode(FrameGraphNode::Surface)
+ , m_surface(nullptr)
+ , m_width(0)
+ , m_height(0)
+ , m_devicePixelRatio(0.0f)
+{
+}
+
+void RenderSurfaceSelector::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QRenderSurfaceSelectorData>>(change);
+ const auto &data = typedChange->data;
+ m_surface = surfaceFromQObject(data.surface);
+ m_renderTargetSize = data.externalRenderTargetSize;
+ if (m_surface && m_surface->surfaceClass() == QSurface::Window) {
+ QWindow *window = static_cast<QWindow *>(m_surface);
+ m_width = window->width();
+ m_height = window->height();
+ if (window->screen())
+ m_devicePixelRatio = window->screen()->devicePixelRatio();
+ }
+}
+
+void RenderSurfaceSelector::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ qCDebug(Render::Framegraph) << Q_FUNC_INFO;
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("surface"))
+ m_surface = surfaceFromQObject(propertyChange->value().value<QObject *>());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("externalRenderTargetSize"))
+ setRenderTargetSize(propertyChange->value().toSize());
+ else if (propertyChange->propertyName() == QByteArrayLiteral("width"))
+ m_width = propertyChange->value().toInt();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("height"))
+ m_height = propertyChange->value().toInt();
+ markDirty(AbstractRenderer::AllDirty);
+ }
+ FrameGraphNode::sceneChangeEvent(e);
+}
+
+QSize RenderSurfaceSelector::renderTargetSize() const
+{
+ if (m_renderTargetSize.isValid())
+ return m_renderTargetSize;
+ if (m_surface && m_surface->size().isValid())
+ return m_surface->size();
+ return QSize();
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/rendersurfaceselector_p.h b/src/render/framegraph/rendersurfaceselector_p.h
new file mode 100644
index 000000000..6602cd18b
--- /dev/null
+++ b/src/render/framegraph/rendersurfaceselector_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_RENDERSURFACENODE_H
+#define QT3DRENDER_RENDER_RENDERSURFACENODE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/framegraphnode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSurface;
+
+namespace Qt3DRender {
+namespace Render {
+
+class RenderSurfaceSelector : public Qt3DRender::Render::FrameGraphNode
+{
+public:
+ RenderSurfaceSelector();
+
+ QSize renderTargetSize() const;
+ void setRenderTargetSize(const QSize &size) { m_renderTargetSize = size; }
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ QSurface *surface() const { return m_surface; }
+ inline int width() const Q_DECL_NOEXCEPT { return m_width; }
+ inline int height() const Q_DECL_NOEXCEPT { return m_height; }
+ inline float devicePixelRatio() const Q_DECL_NOEXCEPT { return m_devicePixelRatio; }
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QSurface *m_surface;
+ QSize m_renderTargetSize;
+ int m_width;
+ int m_height;
+ float m_devicePixelRatio;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERSURFACENODE_H
diff --git a/src/render/framegraph/rendertargetselectornode.cpp b/src/render/framegraph/rendertargetselectornode.cpp
index f9ba5ed78..4b6e2da84 100644
--- a/src/render/framegraph/rendertargetselectornode.cpp
+++ b/src/render/framegraph/rendertargetselectornode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,10 +41,11 @@
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
#include <Qt3DRender/qrendertargetselector.h>
+#include <Qt3DRender/private/qrendertargetselector_p.h>
#include <Qt3DRender/qrendertarget.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/private/renderlogging_p.h>
-#include <Qt3DRender/qrenderattachment.h>
+#include <Qt3DRender/qrendertargetoutput.h>
QT_BEGIN_NAMESPACE
@@ -55,38 +59,27 @@ RenderTargetSelector::RenderTargetSelector() :
{
}
-void RenderTargetSelector::updateFromPeer(Qt3DCore::QNode *peer)
+void RenderTargetSelector::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QRenderTargetSelector *selector = static_cast<QRenderTargetSelector *>(peer);
- m_renderTargetUuid = QNodeId();
- if (selector->target() != Q_NULLPTR)
- m_renderTargetUuid = selector->target()->id();
- setEnabled(selector->isEnabled());
- m_drawBuffers = selector->drawBuffers();
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QRenderTargetSelectorData>>(change);
+ const auto &data = typedChange->data;
+ m_renderTargetUuid = data.targetId;
+ m_outputs = data.outputs;
}
void RenderTargetSelector::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
qCDebug(Render::Framegraph) << Q_FUNC_INFO;
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("target"))
m_renderTargetUuid = propertyChange->value().value<QNodeId>();
- else if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
- else if (propertyChange->propertyName() == QByteArrayLiteral("drawBuffers"))
- m_drawBuffers = propertyChange->value().value<QList<Qt3DRender::QRenderAttachment::RenderAttachmentType> >();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("outputs"))
+ m_outputs = propertyChange->value().value<QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint> >();
+ markDirty(AbstractRenderer::AllDirty);
}
-}
-
-Qt3DCore::QNodeId RenderTargetSelector::renderTargetUuid() const
-{
- return m_renderTargetUuid;
-}
-
-QList<QRenderAttachment::RenderAttachmentType> RenderTargetSelector::drawBuffers() const
-{
- return m_drawBuffers;
+ FrameGraphNode::sceneChangeEvent(e);
}
} // namespace Render
diff --git a/src/render/framegraph/rendertargetselectornode_p.h b/src/render/framegraph/rendertargetselectornode_p.h
index 1c5abc10c..359a433ec 100644
--- a/src/render/framegraph/rendertargetselectornode_p.h
+++ b/src/render/framegraph/rendertargetselectornode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -63,14 +66,16 @@ class RenderTargetSelector : public FrameGraphNode
public:
RenderTargetSelector();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- Qt3DCore::QNodeId renderTargetUuid() const;
- QList<QRenderAttachment::RenderAttachmentType> drawBuffers() const;
+
+ Qt3DCore::QNodeId renderTargetUuid() const { return m_renderTargetUuid; }
+ QVector<QRenderTargetOutput::AttachmentPoint> outputs() const { return m_outputs; }
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
Qt3DCore::QNodeId m_renderTargetUuid;
- QList<QRenderAttachment::RenderAttachmentType> m_drawBuffers;
+ QVector<QRenderTargetOutput::AttachmentPoint> m_outputs;
};
} // namespace Render
diff --git a/src/render/framegraph/sortcriterion.cpp b/src/render/framegraph/sortcriterion.cpp
index 650d6f80a..9854d991f 100644
--- a/src/render/framegraph/sortcriterion.cpp
+++ b/src/render/framegraph/sortcriterion.cpp
@@ -1,41 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "sortcriterion_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qnodepropertychange.h>
#include <QVariant>
QT_BEGIN_NAMESPACE
@@ -46,13 +49,14 @@ namespace Qt3DRender {
namespace Render {
SortCriterion::SortCriterion()
- : QBackendNode()
+ : BackendNode()
, m_type(QSortCriterion::StateChangeCost)
{
}
void SortCriterion::cleanup()
{
+ QBackendNode::setEnabled(false);
}
void SortCriterion::updateFromPeer(Qt3DCore::QNode *peer)
@@ -68,10 +72,13 @@ QSortCriterion::SortType SortCriterion::sortType() const
void SortCriterion::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ QNodePropertyChangePtr propertyChange = qSharedPointerCast<QNodePropertyChange>(e);
if (e->type() == NodeUpdated && propertyChange->propertyName() == QByteArrayLiteral("sort")) {
m_type = static_cast<QSortCriterion::SortType>(propertyChange->value().toInt());
}
+ markDirty(AbstractRenderer::AllDirty);
+
+ BackendNode::sceneChangeEvent(e);
}
} // namespace Render
diff --git a/src/render/framegraph/sortcriterion_p.h b/src/render/framegraph/sortcriterion_p.h
deleted file mode 100644
index b230cb1bb..000000000
--- a/src/render/framegraph/sortcriterion_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_SORTCRITERION_P_H
-#define QT3DRENDER_RENDER_SORTCRITERION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/qsortcriterion.h>
-#include <Qt3DCore/qbackendnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-class SortCriterionManager;
-
-class SortCriterion : public Qt3DCore::QBackendNode
-{
-public:
- SortCriterion();
-
- void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
- QSortCriterion::SortType sortType() const;
-
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-
-private:
- QSortCriterion::SortType m_type;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_SORTCRITERION_P_H
diff --git a/src/render/framegraph/sortmethod.cpp b/src/render/framegraph/sortmethod.cpp
deleted file mode 100644
index 9a6a91f97..000000000
--- a/src/render/framegraph/sortmethod.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "sortmethod_p.h"
-#include <Qt3DRender/qsortcriterion.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-namespace Render {
-
-SortMethod::SortMethod()
- : FrameGraphNode(FrameGraphNode::SortMethod)
-{
-}
-
-void SortMethod::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QSortMethod *sortMethod = static_cast<QSortMethod *>(peer);
- m_criteria.clear();
- Q_FOREACH (QSortCriterion *c, sortMethod->criteria())
- m_criteria.append(c->id());
- setEnabled(sortMethod->isEnabled());
-}
-
-void SortMethod::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("sortCriterion")) {
- const QNodeId cId = propertyChange->value().value<QNodeId>();
- if (!cId.isNull()) {
- if (e->type() == NodeAdded)
- m_criteria.append(cId);
- else if (e->type() == NodeRemoved)
- m_criteria.removeAll(cId);
- }
- } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled") && e->type() == NodeUpdated) {
- setEnabled(propertyChange->value().toBool());
- }
-}
-
-QList<QNodeId> SortMethod::criteria() const
-{
- return m_criteria;
-}
-
-} // namepace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/framegraph/sortmethod_p.h b/src/render/framegraph/sortmethod_p.h
deleted file mode 100644
index 206aa220e..000000000
--- a/src/render/framegraph/sortmethod_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_SORTMETHOD_P_H
-#define QT3DRENDER_RENDER_SORTMETHOD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/framegraphnode_p.h>
-#include <Qt3DRender/qsortmethod.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-class SortMethod : public FrameGraphNode
-{
-public:
- SortMethod();
-
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
-
- QList<Qt3DCore::QNodeId> criteria() const;
-
-private:
- QList<Qt3DCore::QNodeId> m_criteria;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_SORTMETHOD_P_H
diff --git a/src/render/framegraph/sortpolicy.cpp b/src/render/framegraph/sortpolicy.cpp
new file mode 100644
index 000000000..e5e0c40d2
--- /dev/null
+++ b/src/render/framegraph/sortpolicy.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "sortpolicy_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DRender/private/qsortpolicy_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+SortPolicy::SortPolicy()
+ : FrameGraphNode(FrameGraphNode::SortMethod)
+{
+}
+
+void SortPolicy::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("sortType")) {
+ const QSortPolicy::SortType cId = propertyChange->value().value<QSortPolicy::SortType>();
+ if (cId == QSortPolicy::StateChangeCost || cId == QSortPolicy::BackToFront || cId == QSortPolicy::Material) {
+ if (e->type() == PropertyValueAdded)
+ m_sortTypes.append(cId);
+ else if (e->type() == PropertyValueRemoved)
+ m_sortTypes.removeAll(cId);
+ }
+ }
+ markDirty(AbstractRenderer::AllDirty);
+ FrameGraphNode::sceneChangeEvent(e);
+}
+
+QVector<QSortPolicy::SortType> SortPolicy::sortTypes() const
+{
+ return m_sortTypes;
+}
+
+void SortPolicy::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QSortPolicyData>>(change);
+ const QSortPolicyData &data = typedChange->data;
+ m_sortTypes = data.sortTypes;
+}
+
+} // namepace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/framegraph/sortpolicy_p.h b/src/render/framegraph/sortpolicy_p.h
new file mode 100644
index 000000000..32d2888c3
--- /dev/null
+++ b/src/render/framegraph/sortpolicy_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_SORTPOLICY_P_H
+#define QT3DRENDER_RENDER_SORTPOLICY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/framegraphnode_p.h>
+#include <Qt3DRender/qsortpolicy.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class SortPolicy : public FrameGraphNode
+{
+public:
+ SortPolicy();
+
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ QVector<Qt3DRender::QSortPolicy::SortType> sortTypes() const;
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<Qt3DRender::QSortPolicy::SortType> m_sortTypes;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_SORTPOLICY_P_H
diff --git a/src/render/framegraph/statesetnode.cpp b/src/render/framegraph/statesetnode.cpp
index 30d6ffbcf..1436db265 100644
--- a/src/render/framegraph/statesetnode.cpp
+++ b/src/render/framegraph/statesetnode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,10 +39,13 @@
#include "statesetnode_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qstateset.h>
+#include <Qt3DRender/qrenderstateset.h>
+#include <Qt3DRender/private/qrenderstateset_p.h>
#include <Qt3DRender/private/genericstate_p.h>
#include <Qt3DRender/private/renderstateset_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -57,53 +63,40 @@ StateSetNode::~StateSetNode()
{
}
-void StateSetNode::updateFromPeer(Qt3DCore::QNode *peer)
+void StateSetNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QStateSet *stateSet = static_cast<QStateSet*>(peer);
-
- setEnabled(stateSet->isEnabled());
- Q_FOREACH (QRenderState *renderState, stateSet->renderStates())
- appendRenderState(renderState->id(), RenderState::getOrCreateBackendState(renderState));
-}
-
-QList<RenderState *> StateSetNode::renderStates() const
-{
- return m_renderStates.values();
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QRenderStateSetData>>(change);
+ const auto &data = typedChange->data;
+ for (const auto &stateId : qAsConst(data.renderStateIds))
+ appendRenderState(stateId);
}
void StateSetNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
switch (e->type()) {
- case NodeAdded: {
- if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) {
- QNodePtr nodePtr = propertyChange->value().value<QNodePtr>();
- QRenderState *renderState = static_cast<QRenderState *>(nodePtr.data());
- appendRenderState(renderState->id(), RenderState::getOrCreateBackendState(renderState));
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("renderState")) {
+ appendRenderState(change->addedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
}
- }
break;
-
- case NodeRemoved: {
- if (propertyChange->propertyName() == QByteArrayLiteral("renderState"))
- removeRenderState(propertyChange->value().value<QNodeId>());
}
+
+ case PropertyValueRemoved: {
+ const auto propertyChange = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) {
+ removeRenderState(propertyChange->removedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ }
break;
+ }
default:
break;
}
-}
-
-void StateSetNode::appendRenderState(const Qt3DCore::QNodeId &id, RenderState *renderState)
-{
- if (!m_renderStates.contains(id))
- m_renderStates[id] = renderState;
-}
-
-void StateSetNode::removeRenderState(const Qt3DCore::QNodeId &renderStateId)
-{
- m_renderStates.remove(renderStateId);
+ FrameGraphNode::sceneChangeEvent(e);
}
} // namespace Render
diff --git a/src/render/framegraph/statesetnode_p.h b/src/render/framegraph/statesetnode_p.h
index e6cc72de2..bb7b88603 100644
--- a/src/render/framegraph/statesetnode_p.h
+++ b/src/render/framegraph/statesetnode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,6 +52,7 @@
//
#include <Qt3DRender/private/framegraphnode_p.h>
+#include <Qt3DRender/private/renderstatecollection_p.h>
QT_BEGIN_NAMESPACE
@@ -56,23 +60,17 @@ namespace Qt3DRender {
namespace Render {
-class StateSetNode : public FrameGraphNode
+class StateSetNode : public FrameGraphNode, public RenderStateCollection
{
public:
StateSetNode();
~StateSetNode();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
- QList<RenderState *> renderStates() const;
-
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- void appendRenderState(const Qt3DCore::QNodeId &id, RenderState *renderState);
- void removeRenderState(const Qt3DCore::QNodeId &renderStateId);
-
- QHash<Qt3DCore::QNodeId, RenderState *> m_renderStates;
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
};
} // namespace Render
diff --git a/src/render/framegraph/techniquefilternode.cpp b/src/render/framegraph/techniquefilternode.cpp
index fae93ae2a..59f49af02 100644
--- a/src/render/framegraph/techniquefilternode.cpp
+++ b/src/render/framegraph/techniquefilternode.cpp
@@ -1,45 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "techniquefilternode_p.h"
-#include "qannotation.h"
+#include "qfilterkey.h"
#include "qtechniquefilter.h"
+#include <Qt3DRender/private/qtechniquefilter_p.h>
#include <Qt3DRender/private/managers_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
#include <Qt3DRender/qparameter.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -53,67 +59,67 @@ TechniqueFilter::TechniqueFilter()
{
}
-void TechniqueFilter::updateFromPeer(Qt3DCore::QNode *peer)
+void TechniqueFilter::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QTechniqueFilter *filter = static_cast<QTechniqueFilter *>(peer);
- m_filters.clear();
- m_parameterPack.clear();
- Q_FOREACH (QAnnotation *criterion, filter->criteria())
- appendFilter(criterion->id());
- Q_FOREACH (QParameter *p, filter->parameters())
- m_parameterPack.appendParameter(p->id());
- setEnabled(filter->isEnabled());
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QTechniqueFilterData>>(change);
+ const auto &data = typedChange->data;
+ m_filters = data.matchIds;
+ m_parameterPack.setParameters(data.parameterIds);
}
-QList<Qt3DCore::QNodeId> TechniqueFilter::parameters() const
+QVector<Qt3DCore::QNodeId> TechniqueFilter::parameters() const
{
return m_parameterPack.parameters();
}
-QList<Qt3DCore::QNodeId> TechniqueFilter::filters() const
+QVector<Qt3DCore::QNodeId> TechniqueFilter::filters() const
{
return m_filters;
}
-void TechniqueFilter::appendFilter(const QNodeId &criterionId)
+void TechniqueFilter::appendFilter(QNodeId criterionId)
{
if (!m_filters.contains(criterionId))
m_filters.append(criterionId);
}
-void TechniqueFilter::removeFilter(const Qt3DCore::QNodeId &criterionId)
+void TechniqueFilter::removeFilter(Qt3DCore::QNodeId criterionId)
{
m_filters.removeOne(criterionId);
}
void TechniqueFilter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
-
switch (e->type()) {
- case NodeUpdated: {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- setEnabled(propertyChange->value().toBool());
- }
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("matchAll")) {
+ appendFilter(change->addedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ } else if (change->propertyName() == QByteArrayLiteral("parameter")) {
+ m_parameterPack.appendParameter(change->addedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ }
break;
-
- case NodeAdded: {
- if (propertyChange->propertyName() == QByteArrayLiteral("require"))
- appendFilter(propertyChange->value().value<QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
- m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
}
+
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("matchAll")) {
+ removeFilter(change->removedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ } else if (change->propertyName() == QByteArrayLiteral("parameter")) {
+ m_parameterPack.removeParameter(change->removedNodeId());
+ markDirty(AbstractRenderer::AllDirty);
+ }
break;
- case NodeRemoved: {
- if (propertyChange->propertyName() == QByteArrayLiteral("require"))
- removeFilter(propertyChange->value().value<QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
- m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>());
}
- break;
+
default:
break;
}
+ FrameGraphNode::sceneChangeEvent(e);
}
} // namespace Render
diff --git a/src/render/framegraph/techniquefilternode_p.h b/src/render/framegraph/techniquefilternode_p.h
index 17e0d7066..091dc1cf7 100644
--- a/src/render/framegraph/techniquefilternode_p.h
+++ b/src/render/framegraph/techniquefilternode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -59,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAnnotation;
+class QFilterKey;
class QTechniqueFilter;
template <typename T, uint INDEXBITS>
@@ -72,18 +75,19 @@ class TechniqueFilter
{
public:
TechniqueFilter();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- QList<Qt3DCore::QNodeId> parameters() const;
+ QVector<Qt3DCore::QNodeId> parameters() const;
- QList<Qt3DCore::QNodeId> filters() const;
+ QVector<Qt3DCore::QNodeId> filters() const;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
- void appendFilter(const Qt3DCore::QNodeId &criterionId);
- void removeFilter(const Qt3DCore::QNodeId &criterionId);
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
- QList<Qt3DCore::QNodeId> m_filters;
+ void appendFilter(Qt3DCore::QNodeId criterionId);
+ void removeFilter(Qt3DCore::QNodeId criterionId);
+
+ QVector<Qt3DCore::QNodeId> m_filters;
ParameterPack m_parameterPack;
};
diff --git a/src/render/framegraph/viewportnode.cpp b/src/render/framegraph/viewportnode.cpp
index 5834a5950..ccdb68918 100644
--- a/src/render/framegraph/viewportnode.cpp
+++ b/src/render/framegraph/viewportnode.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,8 @@
#include "viewportnode_p.h"
#include <Qt3DRender/qviewport.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/private/qviewport_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -54,15 +58,15 @@ ViewportNode::ViewportNode()
{
}
-void ViewportNode::updateFromPeer(Qt3DCore::QNode *peer)
+void ViewportNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QViewport *viewport = static_cast<QViewport *>(peer);
- setXMin(viewport->rect().x());
- setXMax(viewport->rect().width());
- setYMin(viewport->rect().y());
- setYMax(viewport->rect().height());
- m_clearColor = viewport->clearColor();
- setEnabled(viewport->isEnabled());
+ FrameGraphNode::initializeFromPeer(change);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QViewportData>>(change);
+ const auto &data = typedChange->data;
+ m_xMin = data.normalizedRect.x();
+ m_xMax = data.normalizedRect.width();
+ m_yMin = data.normalizedRect.y();
+ m_yMax = data.normalizedRect.height();
}
float ViewportNode::xMin() const
@@ -102,28 +106,20 @@ void ViewportNode::setYMax(float yMax)
m_yMax = yMax;
}
-QColor ViewportNode::clearColor() const
-{
- return m_clearColor;
-}
-
void ViewportNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("rect")) {
- QRectF rect = propertyChange->value().value<QRectF>();
- setXMin(rect.x());
- setYMin(rect.y());
- setXMax(rect.width());
- setYMax(rect.height());
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("clearColor")) {
- m_clearColor = propertyChange->value().value<QColor>();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("enabled")) {
- setEnabled(propertyChange->value().toBool());
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("normalizedRect")) {
+ QRectF normalizedRect = propertyChange->value().value<QRectF>();
+ setXMin(normalizedRect.x());
+ setYMin(normalizedRect.y());
+ setXMax(normalizedRect.width());
+ setYMax(normalizedRect.height());
}
+ markDirty(AbstractRenderer::AllDirty);
}
+ FrameGraphNode::sceneChangeEvent(e);
}
QRectF computeViewport(const QRectF &childViewport, const ViewportNode *parentViewport)
diff --git a/src/render/framegraph/viewportnode_p.h b/src/render/framegraph/viewportnode_p.h
index 439f1b70b..882aa4d86 100644
--- a/src/render/framegraph/viewportnode_p.h
+++ b/src/render/framegraph/viewportnode_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -66,8 +69,6 @@ class ViewportNode : public FrameGraphNode
public:
ViewportNode();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
float xMin() const;
void setXMin(float xMin);
@@ -80,16 +81,15 @@ public:
float yMax() const;
void setYMax(float yMax);
- QColor clearColor() const;
-
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
float m_xMin;
float m_yMin;
float m_xMax;
float m_yMax;
- QColor m_clearColor;
};
QRectF computeViewport(const QRectF &childViewport, const ViewportNode *parentViewport);
diff --git a/src/render/frontend/qabstractfunctor.cpp b/src/render/frontend/qabstractfunctor.cpp
index 60b7816a0..f3367a2b5 100644
--- a/src/render/frontend/qabstractfunctor.cpp
+++ b/src/render/frontend/qabstractfunctor.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/frontend/qabstractfunctor.h b/src/render/frontend/qabstractfunctor.h
index 7bcfd1da6..7d0dbc1f1 100644
--- a/src/render/frontend/qabstractfunctor.h
+++ b/src/render/frontend/qabstractfunctor.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -53,7 +56,7 @@ struct FunctorType
// The MSVC linker can under some cases optimize all the template
// functions into a single function. The code below is there to ensure
// that the linker won't collapse all these distincts functions into one
- static T *t = Q_NULLPTR;
+ static T *t = nullptr;
return reinterpret_cast<qintptr>(t);
}
};
@@ -81,10 +84,18 @@ public:
{
if (other->id() == functorTypeId<T>())
return static_cast<const T *>(other);
- return Q_NULLPTR;
+ return nullptr;
}
};
+template<class T>
+const T *functor_cast(const QAbstractFunctor *other)
+{
+ if (other->id() == functorTypeId<T>())
+ return static_cast<const T *>(other);
+ return nullptr;
+}
+
} // Qt3D
QT_END_NAMESPACE
diff --git a/src/render/frontend/qboundingvolumedebug.cpp b/src/render/frontend/qboundingvolumedebug.cpp
index e383658d4..4ee6816d6 100644
--- a/src/render/frontend/qboundingvolumedebug.cpp
+++ b/src/render/frontend/qboundingvolumedebug.cpp
@@ -1,48 +1,52 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qboundingvolumedebug.h"
+#if 0
+
+#include "qboundingvolumedebug_p.h"
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/private/qcomponent_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qspheremesh.h>
#include <Qt3DCore/qtransform.h>
#include <Qt3DRender/qphongalphamaterial.h>
#include <Qt3DRender/qlayer.h>
-
#include <QThread>
QT_BEGIN_NAMESPACE
@@ -55,11 +59,11 @@ public:
QBoundingVolumeDebugPrivate()
: QComponentPrivate()
, m_recursive(false)
- , m_debugSubtree(Q_NULLPTR)
- , m_sphereMesh(Q_NULLPTR)
- , m_transform(Q_NULLPTR)
- , m_material(Q_NULLPTR)
- , m_layer(Q_NULLPTR)
+ , m_debugSubtree(nullptr)
+ , m_sphereMesh(nullptr)
+ , m_transform(nullptr)
+ , m_material(nullptr)
+ , m_layer(nullptr)
, m_bvRadius(0.0f)
{
m_shareable = false;
@@ -106,18 +110,11 @@ bool QBoundingVolumeDebug::recursive() const
return d->m_recursive;
}
-void QBoundingVolumeDebug::copy(const Qt3DCore::QNode *ref)
-{
- QComponent::copy(ref);
- const QBoundingVolumeDebug *debugVolume = static_cast<const QBoundingVolumeDebug *>(ref);
- d_func()->m_recursive = debugVolume->d_func()->m_recursive;
-}
-
void QBoundingVolumeDebug::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_D(QBoundingVolumeDebug);
- Qt3DCore::QBackendScenePropertyChangePtr e = qSharedPointerCast<Qt3DCore::QBackendScenePropertyChange>(change);
- if (e->type() == Qt3DCore::NodeUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
+ if (e->type() == Qt3DCore::PropertyUpdated) {
if (e->propertyName() == QByteArrayLiteral("center")) {
d->m_bvCenter = e->value().value<QVector3D>();
d->updateSubtree();
@@ -131,9 +128,9 @@ void QBoundingVolumeDebug::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &cha
// Executed in the frontend thread
Qt3DCore::QEntity *QBoundingVolumeDebugPrivate::findRootEntity(Qt3DCore::QEntity *e)
{
- Qt3DCore::QEntity *tmp = Q_NULLPTR;
- Qt3DCore::QEntity *parentEntity = Q_NULLPTR;
- while (e && (tmp = e->parentEntity()) != Q_NULLPTR) {
+ Qt3DCore::QEntity *tmp = nullptr;
+ Qt3DCore::QEntity *parentEntity = nullptr;
+ while (e && (tmp = e->parentEntity()) != nullptr) {
parentEntity = tmp;
e = parentEntity;
}
@@ -143,7 +140,7 @@ Qt3DCore::QEntity *QBoundingVolumeDebugPrivate::findRootEntity(Qt3DCore::QEntity
void QBoundingVolumeDebugPrivate::updateSubtree()
{
Q_Q(QBoundingVolumeDebug);
- if (m_debugSubtree == Q_NULLPTR) {
+ if (m_debugSubtree == nullptr) {
m_debugSubtree = new Qt3DCore::QEntity();
m_sphereMesh = new Qt3DRender::QSphereMesh();
m_transform = new Qt3DCore::QTransform();
@@ -168,8 +165,8 @@ void QBoundingVolumeDebugPrivate::updateSubtree()
// Insert into scene
if (q->entities().size() > 0) {
- Qt3DCore::QEntity *rootEntity = findRootEntity(q->entities().first());
- m_debugSubtree->setParent(rootEntity ? rootEntity : q->entities().first());
+ Qt3DCore::QEntity *rootEntity = findRootEntity(q->entities().constFirst());
+ m_debugSubtree->setParent(rootEntity ? rootEntity : q->entities().constFirst());
}
} else {
// Just update the mesh
@@ -181,3 +178,5 @@ void QBoundingVolumeDebugPrivate::updateSubtree()
} // Qt3DRender
QT_END_NAMESPACE
+
+#endif
diff --git a/src/render/frontend/qboundingvolumedebug.h b/src/render/frontend/qboundingvolumedebug.h
deleted file mode 100644
index e6151c1ee..000000000
--- a/src/render/frontend/qboundingvolumedebug.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QBOUNDINGVOLUMEDEBUG_H
-#define QT3DRENDER_QBOUNDINGVOLUMEDEBUG_H
-
-#include <Qt3DCore/qcomponent.h>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QGeometry;
-class QBoundingVolumeDebugPrivate;
-
-class QT3DRENDERSHARED_EXPORT QBoundingVolumeDebug : public Qt3DCore::QComponent
-{
- Q_OBJECT
- Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged)
-
-public:
- explicit QBoundingVolumeDebug(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QBoundingVolumeDebug();
-
- bool recursive() const;
-
-public Q_SLOTS:
- void setRecursive(bool recursive);
-
-Q_SIGNALS:
- void recursiveChanged(bool recursive);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QBoundingVolumeDebug)
- QT3D_CLONEABLE(QBoundingVolumeDebug)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QBOUNDINGVOLUMEDEBUG_H
diff --git a/src/render/frontend/qboundingvolumedebug_p.h b/src/render/frontend/qboundingvolumedebug_p.h
new file mode 100644
index 000000000..8ffe556b5
--- /dev/null
+++ b/src/render/frontend/qboundingvolumedebug_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#if 0
+
+#ifndef QT3DRENDER_QBOUNDINGVOLUMEDEBUG_P_H
+#define QT3DRENDER_QBOUNDINGVOLUMEDEBUG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DRender/qt3drender_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QGeometry;
+class QBoundingVolumeDebugPrivate;
+
+class QT3DRENDERSHARED_EXPORT QBoundingVolumeDebug : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+ Q_PROPERTY(bool recursive READ recursive WRITE setRecursive NOTIFY recursiveChanged)
+
+public:
+ explicit QBoundingVolumeDebug(Qt3DCore::QNode *parent = nullptr);
+ ~QBoundingVolumeDebug();
+
+ bool recursive() const;
+
+public Q_SLOTS:
+ void setRecursive(bool recursive);
+
+Q_SIGNALS:
+ void recursiveChanged(bool recursive);
+
+protected:
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
+
+private:
+ Q_DECLARE_PRIVATE(QBoundingVolumeDebug)
+
+ // TODO: Handle creation changes
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QBOUNDINGVOLUMEDEBUG_P_H
+
+#endif
diff --git a/src/render/frontend/qcamera.cpp b/src/render/frontend/qcamera.cpp
new file mode 100644
index 000000000..f73960c77
--- /dev/null
+++ b/src/render/frontend/qcamera.cpp
@@ -0,0 +1,500 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcamera.h"
+#include "qcamera_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \internal
+*/
+QCameraPrivate::QCameraPrivate()
+ : Qt3DCore::QEntityPrivate()
+ , m_position(0.0f, 0.0f, 0.0f)
+ , m_viewCenter(0.0f, 0.0f, -100.0f)
+ , m_upVector(0.0f, 1.0f, 0.0f)
+ , m_cameraToCenter(m_viewCenter - m_position)
+ , m_viewMatrixDirty(false)
+ , m_lens(new QCameraLens())
+ , m_transform(new Qt3DCore::QTransform())
+{
+ updateViewMatrix();
+}
+
+/*!
+ \qmltype Camera
+ \instantiates Qt3DRender::QCamera
+ \inherits Entity
+ \inqmlmodule Qt3D.Core
+ \since 5.5
+*/
+
+QCamera::QCamera(Qt3DCore::QNode *parent)
+ : Qt3DCore::QEntity(*new QCameraPrivate, parent)
+{
+ QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)), this, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)));
+ QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged(float)), this, SIGNAL(nearPlaneChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged(float)), this, SIGNAL(farPlaneChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged(float)), this, SIGNAL(fieldOfViewChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged(float)), this, SIGNAL(aspectRatioChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(leftChanged(float)), this, SIGNAL(leftChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(rightChanged(float)), this, SIGNAL(rightChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged(float)), this, SIGNAL(bottomChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(topChanged(float)), this, SIGNAL(topChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)), this, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)));
+ QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged(const QMatrix4x4 &)), this, SIGNAL(viewMatrixChanged(const QMatrix4x4 &)));
+ addComponent(d_func()->m_lens);
+ addComponent(d_func()->m_transform);
+}
+
+/*! \internal */
+QCamera::~QCamera()
+{
+}
+
+/*! \internal */
+QCamera::QCamera(QCameraPrivate &dd, Qt3DCore::QNode *parent)
+ : Qt3DCore::QEntity(dd, parent)
+{
+ QObject::connect(d_func()->m_lens, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)), this, SIGNAL(projectionTypeChanged(QCameraLens::ProjectionType)));
+ QObject::connect(d_func()->m_lens, SIGNAL(nearPlaneChanged(float)), this, SIGNAL(nearPlaneChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(farPlaneChanged(float)), this, SIGNAL(farPlaneChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(fieldOfViewChanged(float)), this, SIGNAL(fieldOfViewChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(aspectRatioChanged(float)), this, SIGNAL(aspectRatioChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(leftChanged(float)), this, SIGNAL(leftChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(rightChanged(float)), this, SIGNAL(rightChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(bottomChanged(float)), this, SIGNAL(bottomChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(topChanged(float)), this, SIGNAL(topChanged(float)));
+ QObject::connect(d_func()->m_lens, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)), this, SIGNAL(projectionMatrixChanged(const QMatrix4x4 &)));
+ QObject::connect(d_func()->m_transform, SIGNAL(matrixChanged(const QMatrix4x4 &)), this, SIGNAL(viewMatrixChanged(const QMatrix4x4 &)));
+ addComponent(d_func()->m_lens);
+ addComponent(d_func()->m_transform);
+}
+
+QCameraLens *QCamera::lens() const
+{
+ Q_D(const QCamera);
+ return d->m_lens;
+}
+
+Qt3DCore::QTransform *QCamera::transform() const
+{
+ Q_D(const QCamera);
+ return d->m_transform;
+}
+
+void QCamera::translate(const QVector3D &vLocal, CameraTranslationOption option)
+{
+ QVector3D viewVector = viewCenter() - position(); // From "camera" position to view center
+
+ // Calculate the amount to move by in world coordinates
+ QVector3D vWorld;
+ if (!qFuzzyIsNull(vLocal.x())) {
+ // Calculate the vector for the local x axis
+ const QVector3D x = QVector3D::crossProduct(viewVector, upVector()).normalized();
+ vWorld += vLocal.x() * x;
+ }
+
+ if (!qFuzzyIsNull(vLocal.y()))
+ vWorld += vLocal.y() * upVector();
+
+ if (!qFuzzyIsNull(vLocal.z()))
+ vWorld += vLocal.z() * viewVector.normalized();
+
+ // Update the camera position using the calculated world vector
+ setPosition(position() + vWorld);
+
+ // May be also update the view center coordinates
+ if (option == TranslateViewCenter)
+ setViewCenter(viewCenter() + vWorld);
+
+ // Refresh the camera -> view center vector
+ viewVector = viewCenter() - position();
+
+ // Calculate a new up vector. We do this by:
+ // 1) Calculate a new local x-direction vector from the cross product of the new
+ // camera to view center vector and the old up vector.
+ // 2) The local x vector is the normal to the plane in which the new up vector
+ // must lay. So we can take the cross product of this normal and the new
+ // x vector. The new normal vector forms the last part of the orthonormal basis
+ const QVector3D x = QVector3D::crossProduct(viewVector, upVector()).normalized();
+ setUpVector(QVector3D::crossProduct(x, viewVector).normalized());
+}
+
+void QCamera::translateWorld(const QVector3D &vWorld, CameraTranslationOption option)
+{
+ // Update the camera position using the calculated world vector
+ setPosition(position() + vWorld);
+
+ // May be also update the view center coordinates
+ if (option == TranslateViewCenter)
+ setViewCenter(viewCenter() + vWorld);
+}
+
+QQuaternion QCamera::tiltRotation(float angle) const
+{
+ const QVector3D viewVector = viewCenter() - position();
+ const QVector3D xBasis = QVector3D::crossProduct(upVector(), viewVector.normalized()).normalized();
+ return QQuaternion::fromAxisAndAngle(xBasis, -angle);
+}
+
+QQuaternion QCamera::panRotation(float angle) const
+{
+ return QQuaternion::fromAxisAndAngle(upVector(), angle);
+}
+
+QQuaternion QCamera::rollRotation(float angle) const
+{
+ QVector3D viewVector = viewCenter() - position();
+ return QQuaternion::fromAxisAndAngle(viewVector, -angle);
+}
+
+QQuaternion QCamera::rotation(float angle, const QVector3D &axis) const
+{
+ return QQuaternion::fromAxisAndAngle(axis, angle);
+}
+
+void QCamera::tilt(float angle)
+{
+ QQuaternion q = tiltRotation(angle);
+ rotate(q);
+}
+
+void QCamera::pan(float angle)
+{
+ QQuaternion q = panRotation(-angle);
+ rotate(q);
+}
+
+void QCamera::pan(float angle, const QVector3D &axis)
+{
+ QQuaternion q = rotation(-angle, axis);
+ rotate(q);
+}
+
+void QCamera::roll(float angle)
+{
+ QQuaternion q = rollRotation(-angle);
+ rotate(q);
+}
+
+void QCamera::tiltAboutViewCenter(float angle)
+{
+ QQuaternion q = tiltRotation(-angle);
+ rotateAboutViewCenter(q);
+}
+
+void QCamera::panAboutViewCenter(float angle)
+{
+ QQuaternion q = panRotation(angle);
+ rotateAboutViewCenter(q);
+}
+
+void QCamera::panAboutViewCenter(float angle, const QVector3D &axis)
+{
+ QQuaternion q = rotation(angle, axis);
+ rotateAboutViewCenter(q);
+}
+
+void QCamera::rollAboutViewCenter(float angle)
+{
+ QQuaternion q = rollRotation(angle);
+ rotateAboutViewCenter(q);
+}
+
+void QCamera::rotate(const QQuaternion& q)
+{
+ setUpVector(q * upVector());
+ QVector3D viewVector = viewCenter() - position();
+ QVector3D cameraToCenter = q * viewVector;
+ setViewCenter(position() + cameraToCenter);
+}
+
+void QCamera::rotateAboutViewCenter(const QQuaternion& q)
+{
+ setUpVector(q * upVector());
+ QVector3D viewVector = viewCenter() - position();
+ QVector3D cameraToCenter = q * viewVector;
+ setPosition(viewCenter() - cameraToCenter);
+ setViewCenter(position() + cameraToCenter);
+}
+
+void QCamera::setProjectionType(QCameraLens::ProjectionType type)
+{
+ Q_D(QCamera);
+ d->m_lens->setProjectionType(type);
+}
+
+/*!
+ \qmlproperty enumeration Qt3DCore::Camera::projectionType
+
+ Holds the type of the camera projection (orthogonal or perspective).
+
+ \value CameraLens.OrthographicProjection Orthographic projection
+ \value CameraLens.PerspectiveProjection Perspective projection
+*/
+QCameraLens::ProjectionType QCamera::projectionType() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->projectionType();
+}
+
+void QCamera::setNearPlane(float nearPlane)
+{
+ Q_D(QCamera);
+ d->m_lens->setNearPlane(nearPlane);
+}
+
+/*!
+ \qmlproperty float Qt3DCore::Camera::nearPlane
+*/
+float QCamera::nearPlane() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->nearPlane();
+}
+
+void QCamera::setFarPlane(float farPlane)
+{
+ Q_D(QCamera);
+ d->m_lens->setFarPlane(farPlane);
+}
+
+/*!
+ \qmlproperty float Qt3DCore::Camera::farPlane
+*/
+float QCamera::farPlane() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->farPlane();
+}
+
+void QCamera::setFieldOfView(float fieldOfView)
+{
+ Q_D(QCamera);
+ d->m_lens->setFieldOfView(fieldOfView);
+}
+
+/*!
+ \qmlproperty float Qt3DCore::Camera::fieldOfView
+*/
+float QCamera::fieldOfView() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->fieldOfView();
+}
+
+void QCamera::setAspectRatio(float aspectRatio)
+{
+ Q_D(QCamera);
+ d->m_lens->setAspectRatio(aspectRatio);
+}
+
+/*!
+ \qmlproperty float Qt3DCore::Camera::aspectRatio
+*/
+float QCamera::aspectRatio() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->aspectRatio();
+}
+
+void QCamera::setLeft(float left)
+{
+ Q_D(QCamera);
+ d->m_lens->setLeft(left);
+}
+
+/*!
+ \qmlproperty float Qt3DCore::Camera::left
+*/
+float QCamera::left() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->left();
+}
+
+void QCamera::setRight(float right)
+{
+ Q_D(QCamera);
+ d->m_lens->setRight(right);
+}
+
+/*!
+ \qmlproperty float Qt3DCore::Camera::right
+*/
+float QCamera::right() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->right();
+}
+
+void QCamera::setBottom(float bottom)
+{
+ Q_D(QCamera);
+ d->m_lens->setBottom(bottom);
+}
+
+/*!
+ \qmlproperty float Qt3DCore::Camera::bottom
+*/
+float QCamera::bottom() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->bottom();
+}
+
+void QCamera::setTop(float top)
+{
+ Q_D(QCamera);
+ d->m_lens->setTop(top);
+}
+
+/*!
+ \qmlproperty float Qt3DCore::Camera::top
+*/
+float QCamera::top() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->top();
+}
+
+/*!
+ \qmlproperty matrix4x4 Qt3DCore::Camera::projectionMatrix
+*/
+void QCamera::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
+{
+ Q_D(QCamera);
+ d->m_lens->setProjectionMatrix(projectionMatrix);
+}
+
+QMatrix4x4 QCamera::projectionMatrix() const
+{
+ Q_D(const QCamera);
+ return d->m_lens->projectionMatrix();
+}
+
+void QCamera::setPosition(const QVector3D &position)
+{
+ Q_D(QCamera);
+ if (d->m_position != position) {
+ d->m_position = position;
+ d->m_cameraToCenter = d->m_viewCenter - position;
+ d->m_viewMatrixDirty = true;
+ emit positionChanged(position);
+ emit viewVectorChanged(d->m_cameraToCenter);
+ d->updateViewMatrix();
+ }
+}
+
+/*!
+ \qmlproperty vector3d Qt3DCore::Camera::position
+*/
+QVector3D QCamera::position() const
+{
+ Q_D(const QCamera);
+ return d->m_position;
+}
+
+void QCamera::setUpVector(const QVector3D &upVector)
+{
+ Q_D(QCamera);
+ if (d->m_upVector != upVector) {
+ d->m_upVector = upVector;
+ d->m_viewMatrixDirty = true;
+ emit upVectorChanged(upVector);
+ d->updateViewMatrix();
+ }
+}
+
+/*!
+ \qmlproperty vector3d Qt3DCore::Camera::upVector
+*/
+QVector3D QCamera::upVector() const
+{
+ Q_D(const QCamera);
+ return d->m_upVector;
+}
+
+void QCamera::setViewCenter(const QVector3D &viewCenter)
+{
+ Q_D(QCamera);
+ if (d->m_viewCenter != viewCenter) {
+ d->m_viewCenter = viewCenter;
+ d->m_cameraToCenter = viewCenter - d->m_position;
+ d->m_viewMatrixDirty = true;
+ emit viewCenterChanged(viewCenter);
+ emit viewVectorChanged(d->m_cameraToCenter);
+ d->updateViewMatrix();
+ }
+}
+
+/*!
+ \qmlproperty vector3d Qt3DCore::Camera::viewCenter
+*/
+QVector3D QCamera::viewCenter() const
+{
+ Q_D(const QCamera);
+ return d->m_viewCenter;
+}
+
+/*!
+ \qmlproperty vector3d Qt3DCore::Camera::viewVector
+*/
+QVector3D QCamera::viewVector() const
+{
+ Q_D(const QCamera);
+ return d->m_cameraToCenter;
+}
+
+/*!
+ \qmlproperty matrix4x4 Qt3DCore::Camera::viewMatrix
+*/
+QMatrix4x4 QCamera::viewMatrix() const
+{
+ Q_D(const QCamera);
+ return d->m_transform->matrix();
+}
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/frontend/qcamera.h b/src/render/frontend/qcamera.h
new file mode 100644
index 000000000..73ab05cca
--- /dev/null
+++ b/src/render/frontend/qcamera.h
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_CAMERA_H
+#define QT3DRENDER_CAMERA_H
+
+#include <Qt3DCore/qentity.h>
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DRender/qcameralens.h>
+#include <QMatrix4x4>
+#include <QQuaternion>
+#include <QVector3D>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QEntity;
+class QTransform;
+}
+
+namespace Qt3DRender {
+
+class QCameraPrivate;
+
+class QT3DRENDERSHARED_EXPORT QCamera : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+ // CameraLens
+ Q_PROPERTY(Qt3DRender::QCameraLens::ProjectionType projectionType READ projectionType WRITE setProjectionType NOTIFY projectionTypeChanged)
+ Q_PROPERTY(float nearPlane READ nearPlane WRITE setNearPlane NOTIFY nearPlaneChanged)
+ Q_PROPERTY(float farPlane READ farPlane WRITE setFarPlane NOTIFY farPlaneChanged)
+ Q_PROPERTY(float fieldOfView READ fieldOfView WRITE setFieldOfView NOTIFY fieldOfViewChanged)
+ Q_PROPERTY(float aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged)
+ Q_PROPERTY(float left READ left WRITE setLeft NOTIFY leftChanged)
+ Q_PROPERTY(float right READ right WRITE setRight NOTIFY rightChanged)
+ Q_PROPERTY(float bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
+ Q_PROPERTY(float top READ top WRITE setTop NOTIFY topChanged)
+ Q_PROPERTY(QMatrix4x4 projectionMatrix READ projectionMatrix WRITE setProjectionMatrix NOTIFY projectionMatrixChanged)
+ // LookAt
+ Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
+ Q_PROPERTY(QVector3D upVector READ upVector WRITE setUpVector NOTIFY upVectorChanged)
+ Q_PROPERTY(QVector3D viewCenter READ viewCenter WRITE setViewCenter NOTIFY viewCenterChanged)
+ Q_PROPERTY(QVector3D viewVector READ viewVector NOTIFY viewVectorChanged)
+ Q_PROPERTY(QMatrix4x4 viewMatrix READ viewMatrix NOTIFY viewMatrixChanged)
+
+public:
+ explicit QCamera(QNode *parent = nullptr);
+ ~QCamera();
+
+ enum CameraTranslationOption {
+ TranslateViewCenter,
+ DontTranslateViewCenter
+ };
+ Q_ENUM(CameraTranslationOption)
+
+ QCameraLens *lens() const;
+ Qt3DCore::QTransform *transform() const;
+
+ Q_INVOKABLE QQuaternion tiltRotation(float angle) const;
+ Q_INVOKABLE QQuaternion panRotation(float angle) const;
+ Q_INVOKABLE QQuaternion rollRotation(float angle) const;
+ Q_INVOKABLE QQuaternion rotation(float angle, const QVector3D &axis) const;
+
+ // Translate relative to camera orientation axes
+ Q_INVOKABLE void translate(const QVector3D& vLocal, CameraTranslationOption option = TranslateViewCenter);
+
+ // Translate relative to world axes
+ Q_INVOKABLE void translateWorld(const QVector3D& vWorld, CameraTranslationOption option = TranslateViewCenter);
+
+ Q_INVOKABLE void tilt(float angle);
+ Q_INVOKABLE void pan(float angle);
+ Q_INVOKABLE void pan(float angle, const QVector3D &axis);
+ Q_INVOKABLE void roll(float angle);
+
+ Q_INVOKABLE void tiltAboutViewCenter(float angle);
+ Q_INVOKABLE void panAboutViewCenter(float angle);
+ Q_INVOKABLE void panAboutViewCenter(float angle, const QVector3D &axis);
+ Q_INVOKABLE void rollAboutViewCenter(float angle);
+
+ Q_INVOKABLE void rotate(const QQuaternion& q);
+ Q_INVOKABLE void rotateAboutViewCenter(const QQuaternion& q);
+
+ QCameraLens::ProjectionType projectionType() const;
+ float nearPlane() const;
+ float farPlane() const;
+ float fieldOfView() const;
+ float aspectRatio() const;
+ float left() const;
+ float right() const;
+ float bottom() const;
+ float top() const;
+ QMatrix4x4 projectionMatrix() const;
+ QVector3D position() const;
+ QVector3D upVector() const;
+ QVector3D viewCenter() const;
+ QVector3D viewVector() const;
+ QMatrix4x4 viewMatrix() const;
+
+public Q_SLOTS:
+ void setProjectionType(QCameraLens::ProjectionType type);
+ void setNearPlane(float nearPlane);
+ void setFarPlane(float farPlane);
+ void setFieldOfView(float fieldOfView);
+ void setAspectRatio(float aspectRatio);
+ void setLeft(float left);
+ void setRight(float right);
+ void setBottom(float bottom);
+ void setTop(float top);
+ void setProjectionMatrix(const QMatrix4x4 &projectionMatrix);
+ void setPosition(const QVector3D &position);
+ void setUpVector(const QVector3D &upVector);
+ void setViewCenter(const QVector3D &viewCenter);
+
+Q_SIGNALS:
+ void projectionTypeChanged(QCameraLens::ProjectionType projectionType);
+ void nearPlaneChanged(float nearPlane);
+ void farPlaneChanged(float farPlane);
+ void fieldOfViewChanged(float fieldOfView);
+ void aspectRatioChanged(float aspectRatio);
+ void leftChanged(float left);
+ void rightChanged(float right);
+ void bottomChanged(float bottom);
+ void topChanged(float top);
+ void projectionMatrixChanged(const QMatrix4x4 &projectionMatrix);
+ void positionChanged(const QVector3D &position);
+ void upVectorChanged(const QVector3D &upVector);
+ void viewCenterChanged(const QVector3D &viewCenter);
+ void viewVectorChanged(const QVector3D &viewVector);
+ void viewMatrixChanged(const QMatrix4x4 &viewMatrix);
+
+protected:
+ Q_DECLARE_PRIVATE(QCamera)
+ explicit QCamera(QCameraPrivate &dd, QNode *parent = nullptr);
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_CAMERA_H
diff --git a/src/render/frontend/qcamera_p.h b/src/render/frontend/qcamera_p.h
new file mode 100644
index 000000000..ae2ef7a3b
--- /dev/null
+++ b/src/render/frontend/qcamera_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_CAMERA_P_H
+#define QT3DRENDER_CAMERA_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/qcameralens.h>
+#include <Qt3DCore/qtransform.h>
+#include <private/qentity_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QCameraPrivate : public Qt3DCore::QEntityPrivate
+{
+public:
+ QCameraPrivate();
+
+ Q_DECLARE_PUBLIC(QCamera)
+
+ void updateViewMatrix()
+ {
+ QMatrix4x4 m;
+ m.lookAt(m_position, m_viewCenter, m_upVector);
+ m_transform->setMatrix(m);
+ }
+
+ QVector3D m_position;
+ QVector3D m_viewCenter;
+ QVector3D m_upVector;
+
+ QVector3D m_cameraToCenter; // The vector from the camera position to the view center
+ bool m_viewMatrixDirty;
+
+ // Components
+ QCameraLens *m_lens;
+ Qt3DCore::QTransform *m_transform;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_CAMERA_P_H
diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp
new file mode 100644
index 000000000..3f7a9f4f7
--- /dev/null
+++ b/src/render/frontend/qcameralens.cpp
@@ -0,0 +1,498 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcameralens.h"
+#include "qcameralens_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \internal
+*/
+QCameraLensPrivate::QCameraLensPrivate()
+ : Qt3DCore::QComponentPrivate()
+ , m_projectionType(QCameraLens::PerspectiveProjection)
+ , m_nearPlane(0.1f)
+ , m_farPlane(1024.0f)
+ , m_fieldOfView(25.0f)
+ , m_aspectRatio(1.0f)
+ , m_left(-0.5f)
+ , m_right(0.5f)
+ , m_bottom(-0.5f)
+ , m_top(0.5f)
+{
+}
+
+QCameraLens::QCameraLens(QNode *parent)
+ : Qt3DCore::QComponent(*new QCameraLensPrivate, parent)
+{
+ Q_D(QCameraLens);
+ d->updateProjectionMatrix();
+}
+
+/*! \internal */
+QCameraLens::~QCameraLens()
+{
+}
+
+/*! \class Qt3DRender::QCameraLens
+ * \inmodule Qt3DCore
+ *
+ * \brief Qt3DRender::QCameraLens specifies the projection matrix that will be used to
+ * define a Camera for a 3D scene.
+ *
+ * \since 5.5
+ */
+QCameraLens::QCameraLens(QCameraLensPrivate &dd, QNode *parent)
+ : QComponent(dd, parent)
+{
+ Q_D(QCameraLens);
+ d->updateOrthographicProjection();
+}
+
+/*!
+ * \enum Qt3DRender::QCameraLens::ProjectionType
+ *
+ * Specifies which parameters of Qt3DRender::QCameraLens are used to compute the projection matrix.
+ *
+ * \value OrthographicProjection
+ * \value PerspectiveProjection
+ * \value FrustumProjection
+ * \value CustomProjection
+ */
+
+/*!
+ * Sets the lens' projection type \a projectionType.
+ *
+ * \note Qt3DRender::QCameraLens::Frustum and
+ * Qt3DRender::QCameraLens::PerspectiveProjection are two different ways of
+ * specifying the same projection.
+ */
+void QCameraLens::setProjectionType(QCameraLens::ProjectionType projectionType)
+{
+ Q_D(QCameraLens);
+ if (d->m_projectionType != projectionType) {
+ d->m_projectionType = projectionType;
+ emit projectionTypeChanged(projectionType);
+ d->updateProjectionMatrix();
+ }
+}
+
+/*!
+ * Returns the lens' projection type.
+ */
+QCameraLens::ProjectionType QCameraLens::projectionType() const
+{
+ Q_D(const QCameraLens);
+ return d->m_projectionType;
+}
+
+/*!
+ * Defines an orthographic projection based on \a left, \a right, \a bottom, \a
+ * top, \a nearPlane, \a farPlane.
+ */
+void QCameraLens::setOrthographicProjection(float left, float right,
+ float bottom, float top,
+ float nearPlane, float farPlane)
+{
+ Q_D(QCameraLens);
+ bool block = blockNotifications(true);
+ setLeft(left);
+ setRight(right);
+ setBottom(bottom);
+ setTop(top);
+ setNearPlane(nearPlane);
+ setFarPlane(farPlane);
+ setProjectionType(OrthographicProjection);
+ blockNotifications(block);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Defines an orthographic projection based on \a left, \a right, \a bottom, \a
+ * top, \a nearPlane, \a farPlane.
+ */
+void QCameraLens::setFrustumProjection(float left, float right,
+ float bottom, float top,
+ float nearPlane, float farPlane)
+{
+ Q_D(QCameraLens);
+ bool block = blockNotifications(true);
+ setLeft(left);
+ setRight(right);
+ setBottom(bottom);
+ setTop(top);
+ setNearPlane(nearPlane);
+ setFarPlane(farPlane);
+ setProjectionType(FrustumProjection);
+ blockNotifications(block);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Defines a perspective projection based on \a fieldOfView, \a aspectRatio, \a
+ * nearPlane, \a farPlane.
+ */
+void QCameraLens::setPerspectiveProjection(float fieldOfView, float aspectRatio,
+ float nearPlane, float farPlane)
+{
+ Q_D(QCameraLens);
+ bool block = blockNotifications(true);
+ setFieldOfView(fieldOfView);
+ setAspectRatio(aspectRatio);
+ setNearPlane(nearPlane);
+ setFarPlane(farPlane);
+ setProjectionType(PerspectiveProjection);
+ blockNotifications(block);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Sets the projection's near plane to \a nearPlane. This triggers a projection
+ * matrix update.
+ */
+void QCameraLens::setNearPlane(float nearPlane)
+{
+ Q_D(QCameraLens);
+ if (qFuzzyCompare(d->m_nearPlane, nearPlane))
+ return;
+ d->m_nearPlane = nearPlane;
+ emit nearPlaneChanged(nearPlane);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Returns the projection's near plane.
+ */
+float QCameraLens::nearPlane() const
+{
+ Q_D(const QCameraLens);
+ return d->m_nearPlane;
+}
+
+/*!
+ * Sets the projection's far plane to \a farPlane. This triggers a projection
+ * matrix update.
+ */
+void QCameraLens::setFarPlane(float farPlane)
+{
+ Q_D(QCameraLens);
+ if (qFuzzyCompare(d->m_farPlane, farPlane))
+ return;
+ d->m_farPlane = farPlane;
+ emit farPlaneChanged(farPlane);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Returns the projection's far plane.
+ */
+float QCameraLens::farPlane() const
+{
+ Q_D(const QCameraLens);
+ return d->m_farPlane;
+}
+
+/*!
+ * Sets the projection's field of view to \a fieldOfView degrees. This triggers
+ * a projection matrix update.
+ *
+ * \note this has no effect if the projection type is not
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+void QCameraLens::setFieldOfView(float fieldOfView)
+{
+ Q_D(QCameraLens);
+ if (qFuzzyCompare(d->m_fieldOfView, fieldOfView))
+ return;
+ d->m_fieldOfView = fieldOfView;
+ emit fieldOfViewChanged(fieldOfView);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Returns the projection's field of view in degrees.
+ *
+ * \note: The return value may be undefined if the projection type is not
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+float QCameraLens::fieldOfView() const
+{
+ Q_D(const QCameraLens);
+ return d->m_fieldOfView;
+}
+
+/*!
+ * Sets the projection's aspect ratio to \a aspectRatio. This triggers a projection
+ * matrix update.
+ *
+ * \note this has no effect if the projection type is not
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+void QCameraLens::setAspectRatio(float aspectRatio)
+{
+ Q_D(QCameraLens);
+ if (qFuzzyCompare(d->m_aspectRatio, aspectRatio))
+ return;
+ d->m_aspectRatio = aspectRatio;
+ emit aspectRatioChanged(aspectRatio);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Returns the projection's aspect ratio.
+ *
+ * \note: The return value may be undefined if the projection type is not
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+float QCameraLens::aspectRatio() const
+{
+ Q_D(const QCameraLens);
+ return d->m_aspectRatio;
+}
+
+/*!
+ * Sets the projection's lower left window coordinate to \a left. This
+ * triggers a projection matrix update.
+ *
+ * \note this has no effect if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+void QCameraLens::setLeft(float left)
+{
+ Q_D(QCameraLens);
+ if (qFuzzyCompare(d->m_left, left))
+ return;
+ d->m_left = left;
+ emit leftChanged(left);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Returns the lower left window coordinate of the projection.
+ *
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+float QCameraLens::left() const
+{
+ Q_D(const QCameraLens);
+ return d->m_left;
+}
+
+/*!
+ * Sets the projection's upper right window coordinate to \a right. This triggers
+ * a projection matrix update.
+ *
+ * \note this has no effect if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+void QCameraLens::setRight(float right)
+{
+ Q_D(QCameraLens);
+ if (qFuzzyCompare(d->m_right, right))
+ return;
+ d->m_right = right;
+ emit rightChanged(right);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Returns the upper right window coordinate of the projection.
+ *
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+float QCameraLens::right() const
+{
+ Q_D(const QCameraLens);
+ return d->m_right;
+}
+
+/*!
+ * Sets the projection's bottom window coordinate to \a bottom. This triggers a
+ * projection matrix update.
+ *
+ * \note this has no effect if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+void QCameraLens::setBottom(float bottom)
+{
+ Q_D(QCameraLens);
+ if (qFuzzyCompare(d->m_bottom, bottom))
+ return;
+ d->m_bottom = bottom;
+ emit bottomChanged(bottom);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Returns the bottom window coordinate of the projection.
+ *
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+float QCameraLens::bottom() const
+{
+ Q_D(const QCameraLens);
+ return d->m_bottom;
+}
+
+/*!
+ * Sets the projection's top window coordinate to \a top. This triggers a
+ * projection matrix update.
+ *
+ * \note this has no effect if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+void QCameraLens::setTop(float top)
+{
+ Q_D(QCameraLens);
+ if (qFuzzyCompare(d->m_top, top))
+ return;
+ d->m_top = top;
+ emit topChanged(top);
+ d->updateProjectionMatrix();
+}
+
+/*!
+ * Returns the bottom window coordinate of the projection.
+ *
+ * \note The return value may be undefined if the projection type is
+ * Qt3DRender::QCameraLens::PerspectiveProjection.
+ */
+float QCameraLens::top() const
+{
+ Q_D(const QCameraLens);
+ return d->m_top;
+}
+
+/*!
+ * Sets the project matrix.
+ *
+ * \note This will set the projection type to Qt3DRender::QCameraLens::CustomProjection and thus
+ * ignore all other camera parameters that might have been specified.
+ */
+void QCameraLens::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
+{
+ Q_D(QCameraLens);
+ setProjectionType(CustomProjection);
+ if (qFuzzyCompare(d->m_projectionMatrix, projectionMatrix))
+ return;
+ d->m_projectionMatrix = projectionMatrix;
+ emit projectionMatrixChanged(projectionMatrix);
+}
+
+/*!
+ * Returns the projection matrix.
+ */
+QMatrix4x4 QCameraLens::projectionMatrix() const
+{
+ Q_D(const QCameraLens);
+ return d->m_projectionMatrix;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QCameraLens::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QCameraLensData>::create(this);
+ auto &data = creationChange->data;
+ data.projectionMatrix = d_func()->m_projectionMatrix;
+ return creationChange;
+}
+
+} // Qt3DRender
+
+/*!
+ \qmltype CameraLens
+ \instantiates Qt3DRender::QCameraLens
+ \inqmlmodule Qt3D.Core
+ \inherits Component3D
+ \since 5.5
+ \brief Provides the projection matrix that is used to define a Camera for 3D scene.
+*/
+
+/*!
+ \qmlproperty enumeration Qt3DCore::CameraLens::projectionType
+
+ Holds the type of the camera projection (orthogonal or perspective).
+
+ \value CameraLens.OrthographicProjection Orthogonal projection
+ \value CameraLens.PerspectiveProjection Perspective projection
+*/
+
+/*!
+ \qmlproperty float Qt3DCore::CameraLens::nearPlane
+*/
+
+/*!
+ \qmlproperty float Qt3DCore::CameraLens::farPlane
+*/
+
+/*!
+ \qmlproperty float Qt3DCore::CameraLens::fieldOfView
+*/
+
+/*!
+ \qmlproperty float Qt3DCore::CameraLens::aspectRatio
+*/
+
+/*!
+ \qmlproperty float Qt3DCore::CameraLens::left
+*/
+
+/*!
+ \qmlproperty float Qt3DCore::CameraLens::right
+*/
+
+/*!
+ \qmlproperty float Qt3DCore::CameraLens::bottom
+*/
+
+/*!
+ \qmlproperty float Qt3DCore::CameraLens::top
+*/
+
+/*!
+ \qmlproperty matrix4x4 Qt3DCore::CameraLens::projectionMatrix
+ \readonly
+*/
+
+QT_END_NAMESPACE
diff --git a/src/render/frontend/qcameralens.h b/src/render/frontend/qcameralens.h
new file mode 100644
index 000000000..6739369dc
--- /dev/null
+++ b/src/render/frontend/qcameralens.h
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_CAMERALENS_H
+#define QT3DRENDER_CAMERALENS_H
+
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DRender/qt3drender_global.h>
+
+#include <QMatrix4x4>
+#include <QQuaternion>
+#include <QVector3D>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QCameraLensPrivate;
+
+class QT3DRENDERSHARED_EXPORT QCameraLens : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+ Q_PROPERTY(ProjectionType projectionType READ projectionType WRITE setProjectionType NOTIFY projectionTypeChanged)
+ Q_PROPERTY(float nearPlane READ nearPlane WRITE setNearPlane NOTIFY nearPlaneChanged)
+ Q_PROPERTY(float farPlane READ farPlane WRITE setFarPlane NOTIFY farPlaneChanged)
+ Q_PROPERTY(float fieldOfView READ fieldOfView WRITE setFieldOfView NOTIFY fieldOfViewChanged)
+ Q_PROPERTY(float aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged)
+ Q_PROPERTY(float left READ left WRITE setLeft NOTIFY leftChanged)
+ Q_PROPERTY(float right READ right WRITE setRight NOTIFY rightChanged)
+ Q_PROPERTY(float bottom READ bottom WRITE setBottom NOTIFY bottomChanged)
+ Q_PROPERTY(float top READ top WRITE setTop NOTIFY topChanged)
+ Q_PROPERTY(QMatrix4x4 projectionMatrix READ projectionMatrix WRITE setProjectionMatrix NOTIFY projectionMatrixChanged)
+
+public:
+ explicit QCameraLens(QNode *parent = nullptr);
+ ~QCameraLens();
+
+ enum ProjectionType {
+ OrthographicProjection,
+ PerspectiveProjection,
+ FrustumProjection,
+ CustomProjection
+ };
+ Q_ENUM(ProjectionType)
+
+ ProjectionType projectionType() const;
+ float nearPlane() const;
+ float farPlane() const;
+ float fieldOfView() const;
+ float aspectRatio() const;
+ float left() const;
+ float right() const;
+ float bottom() const;
+ float top() const;
+
+ QMatrix4x4 projectionMatrix() const;
+
+ void setOrthographicProjection(float left, float right,
+ float bottom, float top,
+ float nearPlane, float farPlane);
+
+ void setFrustumProjection(float left, float right,
+ float bottom, float top,
+ float nearPlane, float farPlane);
+
+ void setPerspectiveProjection(float fieldOfView, float aspect,
+ float nearPlane, float farPlane);
+
+public Q_SLOTS:
+ void setProjectionType(ProjectionType projectionType);
+ void setNearPlane(float nearPlane);
+ void setFarPlane(float farPlane);
+ void setFieldOfView(float fieldOfView);
+ void setAspectRatio(float aspectRatio);
+ void setLeft(float left);
+ void setRight(float right);
+ void setBottom(float bottom);
+ void setTop(float top);
+ void setProjectionMatrix(const QMatrix4x4 &projectionMatrix);
+
+Q_SIGNALS:
+ void projectionTypeChanged(QCameraLens::ProjectionType projectionType);
+ void nearPlaneChanged(float nearPlane);
+ void farPlaneChanged(float farPlane);
+ void fieldOfViewChanged(float fieldOfView);
+ void aspectRatioChanged(float aspectRatio);
+ void leftChanged(float left);
+ void rightChanged(float right);
+ void bottomChanged(float bottom);
+ void topChanged(float top);
+ void projectionMatrixChanged(const QMatrix4x4 &projectionMatrix);
+
+protected:
+ explicit QCameraLens(QCameraLensPrivate &dd, QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QCameraLens)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_CAMERALENS_H
diff --git a/src/render/frontend/qcameralens_p.h b/src/render/frontend/qcameralens_p.h
new file mode 100644
index 000000000..ecaa45b68
--- /dev/null
+++ b/src/render/frontend/qcameralens_p.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_CAMERALENS_P_H
+#define QT3DRENDER_CAMERALENS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qcomponent_p.h>
+#include "qcameralens.h"
+
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+#include <QtGui/qmatrix4x4.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QCameraLensPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QCameraLensPrivate();
+
+ inline void updateProjectionMatrix()
+ {
+ switch (m_projectionType) {
+ case QCameraLens::OrthographicProjection:
+ updateOrthographicProjection();
+ break;
+ case QCameraLens::PerspectiveProjection:
+ updatePerpectiveProjection();
+ break;
+ case QCameraLens::FrustumProjection:
+ updateFrustumProjection();
+ break;
+ case QCameraLens::CustomProjection:
+ break;
+ }
+ }
+
+ Q_DECLARE_PUBLIC(QCameraLens)
+
+ QCameraLens::ProjectionType m_projectionType;
+
+ float m_nearPlane;
+ float m_farPlane;
+
+ float m_fieldOfView;
+ float m_aspectRatio;
+
+ float m_left;
+ float m_right;
+ float m_bottom;
+ float m_top;
+
+ mutable QMatrix4x4 m_projectionMatrix;
+
+private:
+ inline void updatePerpectiveProjection()
+ {
+ Q_Q(QCameraLens);
+ m_projectionMatrix.setToIdentity();
+ m_projectionMatrix.perspective(m_fieldOfView, m_aspectRatio, m_nearPlane, m_farPlane);
+ Q_EMIT q->projectionMatrixChanged(m_projectionMatrix);
+ }
+
+ inline void updateOrthographicProjection()
+ {
+ Q_Q(QCameraLens);
+ m_projectionMatrix.setToIdentity();
+ m_projectionMatrix.ortho(m_left, m_right, m_bottom, m_top, m_nearPlane, m_farPlane);
+ Q_EMIT q->projectionMatrixChanged(m_projectionMatrix);
+ }
+
+ inline void updateFrustumProjection()
+ {
+ Q_Q(QCameraLens);
+ m_projectionMatrix.setToIdentity();
+ m_projectionMatrix.frustum(m_left, m_right, m_bottom, m_top, m_nearPlane, m_farPlane);
+ Q_EMIT q->projectionMatrixChanged(m_projectionMatrix);
+ }
+};
+
+struct QCameraLensData
+{
+ QMatrix4x4 projectionMatrix;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_CAMERALENS_P_H
diff --git a/src/render/frontend/qcomputecommand.cpp b/src/render/frontend/qcomputecommand.cpp
new file mode 100644
index 000000000..0c1403169
--- /dev/null
+++ b/src/render/frontend/qcomputecommand.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qcomputecommand.h"
+#include "qcomputecommand_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QComputeCommandPrivate::QComputeCommandPrivate()
+ : Qt3DCore::QComponentPrivate()
+ , m_workGroupX(1)
+ , m_workGroupY(1)
+ , m_workGroupZ(1)
+{
+}
+
+QComputeCommand::QComputeCommand(Qt3DCore::QNode *parent)
+ : Qt3DCore::QComponent(*new QComputeCommandPrivate, parent)
+{
+}
+
+/*! \internal */
+QComputeCommand::~QComputeCommand()
+{
+}
+
+int QComputeCommand::workGroupX() const
+{
+ Q_D(const QComputeCommand);
+ return d->m_workGroupX;
+}
+
+int QComputeCommand::workGroupY() const
+{
+ Q_D(const QComputeCommand);
+ return d->m_workGroupX;
+}
+
+int QComputeCommand::workGroupZ() const
+{
+ Q_D(const QComputeCommand);
+ return d->m_workGroupX;
+}
+
+void QComputeCommand::setWorkGroupX(int workGroupX)
+{
+ Q_D(QComputeCommand);
+ if (d->m_workGroupX != workGroupX) {
+ d->m_workGroupX = workGroupX;
+ emit workGroupXChanged();
+ }
+}
+
+void QComputeCommand::setWorkGroupY(int workGroupY)
+{
+ Q_D(QComputeCommand);
+ if (d->m_workGroupY != workGroupY) {
+ d->m_workGroupY = workGroupY;
+ emit workGroupYChanged();
+ }
+}
+
+void QComputeCommand::setWorkGroupZ(int workGroupZ)
+{
+ Q_D(QComputeCommand);
+ if (d->m_workGroupZ != workGroupZ) {
+ d->m_workGroupZ = workGroupZ;
+ emit workGroupZChanged();
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QComputeCommand::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QComputeCommandData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QComputeCommand);
+ data.workGroupX = d->m_workGroupX;
+ data.workGroupY = d->m_workGroupY;
+ data.workGroupZ = d->m_workGroupZ;
+ return creationChange;
+}
+
+} // Render
+
+QT_END_NAMESPACE
diff --git a/src/render/frontend/qcomputecommand.h b/src/render/frontend/qcomputecommand.h
new file mode 100644
index 000000000..6bc31c6f6
--- /dev/null
+++ b/src/render/frontend/qcomputecommand.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCOMPUTECOMMAND_H
+#define QT3DRENDER_QCOMPUTECOMMAND_H
+
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DRender/qt3drender_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QComputeCommandPrivate;
+
+class QT3DRENDERSHARED_EXPORT QComputeCommand : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+ Q_PROPERTY(int workGroupX READ workGroupX WRITE setWorkGroupX NOTIFY workGroupXChanged)
+ Q_PROPERTY(int workGroupY READ workGroupY WRITE setWorkGroupY NOTIFY workGroupYChanged)
+ Q_PROPERTY(int workGroupZ READ workGroupZ WRITE setWorkGroupZ NOTIFY workGroupZChanged)
+
+public:
+ explicit QComputeCommand(Qt3DCore::QNode *parent = nullptr);
+ ~QComputeCommand();
+
+ int workGroupX() const;
+ int workGroupY() const;
+ int workGroupZ() const;
+
+public Q_SLOTS:
+ void setWorkGroupX(int workGroupX);
+ void setWorkGroupY(int workGroupY);
+ void setWorkGroupZ(int workGroupZ);
+
+Q_SIGNALS:
+ void workGroupXChanged();
+ void workGroupYChanged();
+ void workGroupZChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QComputeCommand)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCOMPUTECOMMAND_H
diff --git a/src/render/frontend/qcomputecommand_p.h b/src/render/frontend/qcomputecommand_p.h
new file mode 100644
index 000000000..3b595ef99
--- /dev/null
+++ b/src/render/frontend/qcomputecommand_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCOMPUTECOMMAND_P_H
+#define QT3DRENDER_QCOMPUTECOMMAND_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qcomponent_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QComputeCommandPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QComputeCommandPrivate();
+
+ int m_workGroupX;
+ int m_workGroupY;
+ int m_workGroupZ;
+};
+
+struct QComputeCommandData
+{
+ int workGroupX;
+ int workGroupY;
+ int workGroupZ;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCOMPUTECOMMAND_P_H
diff --git a/src/render/frontend/qitemmodelbuffer.cpp b/src/render/frontend/qitemmodelbuffer.cpp
index b7561b4c9..3941ac2fd 100644
--- a/src/render/frontend/qitemmodelbuffer.cpp
+++ b/src/render/frontend/qitemmodelbuffer.cpp
@@ -1,40 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qitemmodelbuffer.h"
+#include "qitemmodelbuffer_p.h"
#include <Qt3DRender/private/graphicscontext_p.h>
#include <QDebug>
#include <QColor>
@@ -111,33 +114,33 @@ void variantToBytes(void* dest, const QVariant& v, GLint type)
namespace {
-QAbstractAttribute::DataType typeFromGLType(GLint dataType, uint &dataCount)
+QAttribute::VertexBaseType typeFromGLType(GLint dataType, uint &dataCount)
{
switch (dataType) {
case GL_UNSIGNED_SHORT:
dataCount = 1;
- return QAbstractAttribute::UnsignedShort;
+ return QAttribute::UnsignedShort;
case GL_UNSIGNED_BYTE:
dataCount = 1;
- return QAbstractAttribute::UnsignedByte;
+ return QAttribute::UnsignedByte;
case GL_UNSIGNED_INT:
dataCount = 1;
- return QAbstractAttribute::UnsignedInt;
+ return QAttribute::UnsignedInt;
case GL_SHORT:
dataCount = 1;
- return QAbstractAttribute::Short;
+ return QAttribute::Short;
case GL_BYTE:
dataCount = 1;
- return QAbstractAttribute::Byte;
+ return QAttribute::Byte;
case GL_INT:
dataCount = 1;
- return QAbstractAttribute::Int;
+ return QAttribute::Int;
case GL_FLOAT:
dataCount = 1;
@@ -161,13 +164,13 @@ QAbstractAttribute::DataType typeFromGLType(GLint dataType, uint &dataCount)
Q_UNREACHABLE();
}
- return QAbstractAttribute::Float;
+ return QAttribute::Float;
}
} // anonymous
QItemModelBuffer::QItemModelBuffer()
- : m_buffer(Q_NULLPTR)
+ : m_buffer(nullptr)
{
}
@@ -178,7 +181,7 @@ void QItemModelBuffer::setModel(QAbstractItemModel *model)
m_model = model;
delete m_buffer;
- m_buffer = Q_NULLPTR;
+ m_buffer = nullptr;
connect(m_model, SIGNAL(modelReset()), this, SLOT(onModelReset()));
connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
@@ -189,7 +192,7 @@ void QItemModelBuffer::setRoot(const QModelIndex &rootIndex)
{
m_rootIndex = rootIndex;
delete m_buffer;
- m_buffer = Q_NULLPTR;
+ m_buffer = nullptr;
}
void QItemModelBuffer::mapRoleName(QByteArray roleName, int elementType)
@@ -207,7 +210,7 @@ void QItemModelBuffer::mapRoleName(QByteArray roleName, QString attributeName, i
m_mappings.append(RoleMapping(roleName, attributeName, elementType));
delete m_buffer;
- m_buffer = Q_NULLPTR;
+ m_buffer = nullptr;
}
QBuffer *QItemModelBuffer::buffer()
@@ -233,7 +236,7 @@ QBuffer *QItemModelBuffer::buffer()
for (int m=0; m<mappingCount; ++m) {
const RoleMapping mapping(m_mappings.at(m));
uint dataSize = 0;
- QAttribute::DataType dataType = typeFromGLType(mapping.type, dataSize);
+ QAttribute::VertexBaseType dataType = typeFromGLType(mapping.type, dataSize);
QAttribute *attr(new QAttribute(m_buffer, dataType,
dataSize, rowCount,
offset, m_itemStride));
@@ -254,7 +257,7 @@ QStringList QItemModelBuffer::attributeNames() const
QAttribute *QItemModelBuffer::attributeByName(QString nm) const
{
- return m_attributes.value(nm);
+ return m_attributes.value(nm, nullptr);
}
void QItemModelBuffer::onModelDataChanged(const QModelIndex& topLeft,
@@ -324,8 +327,8 @@ bool QItemModelBuffer::validateRoles()
QHash<int, QByteArray> roles(m_model->roleNames());
// create a lookup that's the the way round we need
QHash<QByteArray, int> inverseRoles;
- foreach (int r, roles.keys())
- inverseRoles[roles.value(r)] = r;
+ for (auto it = roles.cbegin(), end = roles.cend(); it != end; ++it)
+ inverseRoles[it.value()] = it.key();
for (int m=0; m<m_mappings.count(); ++m) {
QByteArray rnm(m_mappings.at(m).roleName);
diff --git a/src/render/frontend/qitemmodelbuffer.h b/src/render/frontend/qitemmodelbuffer.h
deleted file mode 100644
index 5c10234ce..000000000
--- a/src/render/frontend/qitemmodelbuffer.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QITEMMODELBUFFER_H
-#define QT3DRENDER_QITEMMODELBUFFER_H
-
-#include <QObject>
-#include <Qt3DRender/qt3drender_global.h>
-
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qattribute.h>
-
-#include <QAbstractItemModel>
-#include <QMap>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QT3DRENDERSHARED_EXPORT QItemModelBuffer : public QObject
-{
- Q_OBJECT
-public:
- QItemModelBuffer();
-
- void setModel(QAbstractItemModel* model);
- void setRoot(const QModelIndex& rootIndex);
-
- void mapRoleName(QByteArray roleName, int type);
- void mapRoleName(QByteArray roleName, QString attributeName, int type);
-
- QBuffer *buffer();
-
- QStringList attributeNames() const;
- QAttribute *attributeByName(QString nm) const;
-
-private Q_SLOTS:
-
- void onModelReset();
-
- void onModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
-private:
- QAbstractItemModel* m_model;
- QModelIndex m_rootIndex;
-
- struct RoleMapping {
- RoleMapping(QByteArray role, QString attr, int ty);
-
- QByteArray roleName;
- int cachedRole;
- QString attribute;
- int type;
- int byteSize;
- };
-
- QList<RoleMapping> m_mappings;
-
- QBuffer *m_buffer;
- QMap<QString, QAttribute *> m_attributes;
- int m_itemStride;
-
- QByteArray computeBufferData();
-
- void writeDataForIndex(const QModelIndex &index, int mappingCount, char *bufferPtr);
- bool validateRoles();
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QITEMMODELBUFFER_H
diff --git a/src/render/frontend/qitemmodelbuffer_p.h b/src/render/frontend/qitemmodelbuffer_p.h
new file mode 100644
index 000000000..8574de87c
--- /dev/null
+++ b/src/render/frontend/qitemmodelbuffer_p.h
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QITEMMODELBUFFER_P_H
+#define QT3DRENDER_QITEMMODELBUFFER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <Qt3DRender/private/qt3drender_global_p.h>
+
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qattribute.h>
+
+#include <QAbstractItemModel>
+#include <QMap>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QT3DRENDERSHARED_PRIVATE_EXPORT QItemModelBuffer : public QObject
+{
+ Q_OBJECT
+public:
+ QItemModelBuffer();
+
+ void setModel(QAbstractItemModel* model);
+ void setRoot(const QModelIndex& rootIndex);
+
+ void mapRoleName(QByteArray roleName, int type);
+ void mapRoleName(QByteArray roleName, QString attributeName, int type);
+
+ QBuffer *buffer();
+
+ QStringList attributeNames() const;
+ QAttribute *attributeByName(QString nm) const;
+
+private Q_SLOTS:
+
+ void onModelReset();
+
+ void onModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+private:
+ QAbstractItemModel* m_model;
+ QModelIndex m_rootIndex;
+
+ struct RoleMapping {
+ RoleMapping(QByteArray role, QString attr, int ty);
+
+ QByteArray roleName;
+ int cachedRole;
+ QString attribute;
+ int type;
+ int byteSize;
+ };
+
+ QList<RoleMapping> m_mappings;
+
+ QBuffer *m_buffer;
+ QMap<QString, QAttribute *> m_attributes;
+ int m_itemStride;
+
+ QByteArray computeBufferData();
+
+ void writeDataForIndex(const QModelIndex &index, int mappingCount, char *bufferPtr);
+ bool validateRoles();
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QITEMMODELBUFFER_P_H
diff --git a/src/render/frontend/qlayer.cpp b/src/render/frontend/qlayer.cpp
index 3b295f01b..e9f23a015 100644
--- a/src/render/frontend/qlayer.cpp
+++ b/src/render/frontend/qlayer.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,17 +65,6 @@ QLayerPrivate::QLayerPrivate()
\brief For ...
*/
-
-/*! \fn void Qt3DRender::QLayer::copy(const Qt3DCore::QNode *ref)
- Copies the \a ref instance into this one.
- */
-void QLayer::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QLayer *layer = static_cast<const QLayer*>(ref);
- d_func()->m_names = layer->d_func()->m_names;
-}
-
/*! \fn Qt3DRender::QLayer::QLayer(Qt3DCore::QNode *parent)
Constructs a new QLayer with the specified \a parent.
*/
@@ -82,9 +74,9 @@ QLayer::QLayer(QNode *parent)
{
}
+/*! \internal */
QLayer::~QLayer()
{
- QNode::cleanup();
}
/*! \internal */
@@ -93,31 +85,6 @@ QLayer::QLayer(QLayerPrivate &dd, QNode *parent)
{
}
-/*!
- \property Qt3DRender::QLayer::names
-
- */
-
-/*!
- \qmlproperty stringlist Qt3D.Render::Layer::names
-
-*/
-
-QStringList QLayer::names() const
-{
- Q_D(const QLayer);
- return d->m_names;
-}
-
-void QLayer::setNames(const QStringList &names)
-{
- Q_D(QLayer);
- if (d->m_names != names) {
- d->m_names = names;
- emit namesChanged(names);
- }
-}
-
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/frontend/qlayer.h b/src/render/frontend/qlayer.h
index 3405f368c..f44685d7e 100644
--- a/src/render/frontend/qlayer.h
+++ b/src/render/frontend/qlayer.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,26 +53,15 @@ class QLayerPrivate;
class QT3DRENDERSHARED_EXPORT QLayer : public Qt3DCore::QComponent
{
Q_OBJECT
- Q_PROPERTY(QStringList names READ names WRITE setNames NOTIFY namesChanged)
public:
- explicit QLayer(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QLayer(Qt3DCore::QNode *parent = nullptr);
~QLayer();
- QStringList names() const;
-
-public Q_SLOTS:
- void setNames(const QStringList &names);
-
-Q_SIGNALS:
- void namesChanged(const QStringList &names);
-
protected:
- QLayer(QLayerPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QLayer(QLayerPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QLayer)
- QT3D_CLONEABLE(QLayer)
};
} // namespace Qt3DRender
diff --git a/src/render/frontend/qlayer_p.h b/src/render/frontend/qlayer_p.h
index a5c9109af..e31d8fe7a 100644
--- a/src/render/frontend/qlayer_p.h
+++ b/src/render/frontend/qlayer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,7 +64,6 @@ public:
QLayerPrivate();
Q_DECLARE_PUBLIC(QLayer)
- QStringList m_names;
};
} // namespace Qt3DRender
diff --git a/src/render/frontend/qpickingsettings.cpp b/src/render/frontend/qpickingsettings.cpp
new file mode 100644
index 000000000..a8bf38353
--- /dev/null
+++ b/src/render/frontend/qpickingsettings.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpickingsettings.h"
+#include "qpickingsettings_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QPickingSettingsPrivate::QPickingSettingsPrivate()
+ : Qt3DCore::QNodePrivate()
+ , m_pickMethod(QPickingSettings::BoundingVolumePicking)
+ , m_pickResultMode(QPickingSettings::NearestPick)
+{
+}
+
+QPickingSettings::QPickingSettings(Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(*new QPickingSettingsPrivate, parent)
+{
+}
+
+/*! \internal */
+QPickingSettings::~QPickingSettings()
+{
+}
+
+QPickingSettings::QPickingSettings(QPickingSettingsPrivate &dd, Qt3DCore::QNode *parent)
+ : Qt3DCore::QNode(dd, parent)
+{
+}
+
+QPickingSettings::PickMethod QPickingSettings::pickMethod() const
+{
+ Q_D(const QPickingSettings);
+ return d->m_pickMethod;
+}
+
+QPickingSettings::PickResultMode QPickingSettings::pickResultMode() const
+{
+ Q_D(const QPickingSettings);
+ return d->m_pickResultMode;
+}
+
+void QPickingSettings::setPickMethod(QPickingSettings::PickMethod pickMethod)
+{
+ Q_D(QPickingSettings);
+ if (d->m_pickMethod == pickMethod)
+ return;
+
+ d->m_pickMethod = pickMethod;
+ emit pickMethodChanged(pickMethod);
+}
+
+void QPickingSettings::setPickResultMode(QPickingSettings::PickResultMode pickResultMode)
+{
+ Q_D(QPickingSettings);
+ if (d->m_pickResultMode == pickResultMode)
+ return;
+
+ d->m_pickResultMode = pickResultMode;
+ emit pickResultModeChanged(pickResultMode);
+}
+
+} // namespace Qt3Drender
+
+QT_END_NAMESPACE
diff --git a/src/render/frontend/qpickingsettings.h b/src/render/frontend/qpickingsettings.h
new file mode 100644
index 000000000..a530a4b33
--- /dev/null
+++ b/src/render/frontend/qpickingsettings.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QPICKINGSETTINGS_H
+#define QT3DRENDER_QPICKINGSETTINGS_H
+
+#include <Qt3DCore/qnode.h>
+#include <Qt3DRender/qt3drender_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QPickingSettingsPrivate;
+
+class QT3DRENDERSHARED_EXPORT QPickingSettings : public Qt3DCore::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(PickMethod pickMethod READ pickMethod WRITE setPickMethod NOTIFY pickMethodChanged)
+ Q_PROPERTY(PickResultMode pickResultMode READ pickResultMode WRITE setPickResultMode NOTIFY pickResultModeChanged)
+
+public:
+ explicit QPickingSettings(Qt3DCore::QNode *parent = nullptr);
+ ~QPickingSettings();
+
+ enum PickMethod {
+ BoundingVolumePicking,
+ TrianglePicking
+ };
+ Q_ENUM(PickMethod)
+
+ enum PickResultMode {
+ NearestPick,
+ AllPicks
+ };
+ Q_ENUM(PickResultMode)
+
+ PickMethod pickMethod() const;
+ PickResultMode pickResultMode() const;
+
+public Q_SLOTS:
+ void setPickMethod(PickMethod pickMethod);
+ void setPickResultMode(PickResultMode pickResultMode);
+
+Q_SIGNALS:
+ void pickMethodChanged(QPickingSettings::PickMethod pickMethod);
+ void pickResultModeChanged(QPickingSettings::PickResultMode pickResult);
+
+protected:
+ Q_DECLARE_PRIVATE(QPickingSettings)
+ explicit QPickingSettings(QPickingSettingsPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+};
+
+} // namespace Qt3Drender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QPICKINGSETTINGS_H
diff --git a/src/render/frontend/qpickingsettings_p.h b/src/render/frontend/qpickingsettings_p.h
new file mode 100644
index 000000000..57c989606
--- /dev/null
+++ b/src/render/frontend/qpickingsettings_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QPICKINGSETTINGS_P_H
+#define QT3DRENDER_QPICKINGSETTINGS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DRender/qpickingsettings.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QPickingSettingsPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QPickingSettingsPrivate();
+
+ QPickingSettings::PickMethod m_pickMethod;
+ QPickingSettings::PickResultMode m_pickResultMode;
+};
+
+} // namespace Qt3Drender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QPICKINGSETTINGS_P_H
diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp
index b5d5ef780..fac2687bb 100644
--- a/src/render/frontend/qrenderaspect.cpp
+++ b/src/render/frontend/qrenderaspect.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -43,41 +46,41 @@
#include <Qt3DRender/private/scenemanager_p.h>
#include <Qt3DRender/private/geometryrenderermanager_p.h>
-#include <Qt3DRender/qabstractsceneloader.h>
+#include <Qt3DRender/qsceneloader.h>
#include <Qt3DRender/qcameraselector.h>
-#include <Qt3DRender/qframegraph.h>
#include <Qt3DRender/qlayer.h>
#include <Qt3DRender/qlayerfilter.h>
#include <Qt3DRender/qmaterial.h>
#include <Qt3DRender/qmesh.h>
#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qparametermapping.h>
#include <Qt3DRender/qrenderpassfilter.h>
#include <Qt3DRender/qrendertargetselector.h>
#include <Qt3DRender/qtechniquefilter.h>
#include <Qt3DRender/qviewport.h>
#include <Qt3DRender/qrendertarget.h>
-#include <Qt3DRender/qclearbuffer.h>
+#include <Qt3DRender/qclearbuffers.h>
#include <Qt3DRender/qtexture.h>
#include <Qt3DRender/qeffect.h>
#include <Qt3DRender/qshaderdata.h>
-#include <Qt3DRender/qstateset.h>
+#include <Qt3DRender/qrenderstateset.h>
#include <Qt3DRender/qnodraw.h>
-#include <Qt3DCore/qcameralens.h>
+#include <Qt3DRender/qcameralens.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
#include <Qt3DRender/qgeometry.h>
#include <Qt3DRender/qgeometryrenderer.h>
#include <Qt3DRender/qobjectpicker.h>
-#include <Qt3DRender/qboundingvolumedebug.h>
#include <Qt3DRender/qfrustumculling.h>
-#include <Qt3DRender/qlight.h>
-#include <Qt3DRender/qlighting.h>
+#include <Qt3DRender/qabstractlight.h>
#include <Qt3DRender/qdispatchcompute.h>
+#include <Qt3DRender/qcomputecommand.h>
+#include <Qt3DRender/qrendersurfaceselector.h>
+#include <Qt3DRender/qrendersettings.h>
+#include <Qt3DRender/private/qboundingvolumedebug_p.h>
#include <Qt3DRender/private/cameraselectornode_p.h>
#include <Qt3DRender/private/layerfilternode_p.h>
-#include <Qt3DRender/private/annotation_p.h>
+#include <Qt3DRender/private/filterkey_p.h>
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/shaderdata_p.h>
@@ -87,10 +90,8 @@
#include <Qt3DRender/private/viewportnode_p.h>
#include <Qt3DRender/private/rendertarget_p.h>
#include <Qt3DRender/private/scenemanager_p.h>
-#include <Qt3DRender/private/clearbuffer_p.h>
-#include <Qt3DRender/private/sortmethod_p.h>
-#include <Qt3DRender/private/sortcriterion_p.h>
-#include <Qt3DRender/private/framegraphsubtreeselector_p.h>
+#include <Qt3DRender/private/clearbuffers_p.h>
+#include <Qt3DRender/private/sortpolicy_p.h>
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DRender/private/nodefunctor_p.h>
#include <Qt3DRender/private/framegraphnode_p.h>
@@ -112,11 +113,14 @@
#include <Qt3DRender/private/geometryrenderermanager_p.h>
#include <Qt3DRender/private/loadbufferjob_p.h>
#include <Qt3DRender/private/loadgeometryjob_p.h>
-#include <Qt3DRender/private/qsceneparserfactory_p.h>
+#include <Qt3DRender/private/qsceneiofactory_p.h>
#include <Qt3DRender/private/frustumculling_p.h>
#include <Qt3DRender/private/light_p.h>
-#include <Qt3DRender/private/lighting_p.h>
#include <Qt3DRender/private/dispatchcompute_p.h>
+#include <Qt3DRender/private/computecommand_p.h>
+#include <Qt3DRender/private/rendersurfaceselector_p.h>
+#include <Qt3DRender/private/rendersettings_p.h>
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/qtransform.h>
@@ -143,15 +147,13 @@ namespace Qt3DRender {
QRenderAspectPrivate::QRenderAspectPrivate(QRenderAspect::RenderType type)
: QAbstractAspectPrivate()
, m_nodeManagers(new Render::NodeManagers())
- , m_renderer(Q_NULLPTR)
- , m_surfaceEventFilter(new Render::PlatformSurfaceFilter())
- , m_surface(Q_NULLPTR)
+ , m_renderer(nullptr)
, m_initialized(false)
- , m_framePreparationJob(new Render::FramePreparationJob(m_nodeManagers))
- , m_cleanupJob(new Render::FrameCleanupJob(m_nodeManagers))
- , m_worldTransformJob(new Render::UpdateWorldTransformJob())
- , m_updateBoundingVolumeJob(new Render::UpdateBoundingVolumeJob())
- , m_calculateBoundingVolumeJob(new Render::CalculateBoundingVolumeJob(m_nodeManagers))
+ , m_framePreparationJob(Render::FramePreparationJobPtr::create(m_nodeManagers))
+ , m_cleanupJob(Render::FrameCleanupJobPtr::create(m_nodeManagers))
+ , m_worldTransformJob(Render::UpdateWorldTransformJobPtr::create())
+ , m_updateBoundingVolumeJob(Render::UpdateBoundingVolumeJobPtr::create())
+ , m_calculateBoundingVolumeJob(Render::CalculateBoundingVolumeJobPtr::create(m_nodeManagers))
{
initResources();
@@ -166,137 +168,119 @@ QRenderAspectPrivate::QRenderAspectPrivate(QRenderAspect::RenderType type)
// All world stuff depends on the RenderEntity's localBoundingVolume
m_worldTransformJob->addDependency(m_calculateBoundingVolumeJob);
- // Create property renderer implementation given
- // a targeted rendering API -> only OpenGL for now
+ // Create a renderer implementation given
+ // a specific rendering API -> only OpenGL for now
m_renderer = new Render::Renderer(type);
m_renderer->setNodeManagers(m_nodeManagers);
- m_surfaceEventFilter->setRenderer(m_renderer);
}
-void QRenderAspectPrivate::setSurface(QSurface *surface)
+QRenderAspectPrivate::~QRenderAspectPrivate()
{
- if (m_surface == surface)
- return;
-
- m_surface = surface;
-
- // If we have a new surface, install the platform surface event filter onto it
- // so that we get informed when the underlying platform surface is about to be
- // deleted and we can tell the renderer about it before it's too late.
- if (m_surface) {
- bool hasPlatformSurface = false;
- switch (m_surface->surfaceClass()) {
- case QSurface::Window: {
- QWindow *window = static_cast<QWindow *>(m_surface);
- m_surfaceEventFilter->setWindow(window);
- hasPlatformSurface = (window->handle() != Q_NULLPTR);
- break;
- }
-
- case QSurface::Offscreen: {
- QOffscreenSurface *offscreen = static_cast<QOffscreenSurface *>(m_surface);
- m_surfaceEventFilter->setOffscreenSurface(offscreen);
- hasPlatformSurface = (offscreen->handle() != Q_NULLPTR);
- break;
- }
- }
-
- // If the window/offscreen surface has a native surface, tell the renderer
- if (hasPlatformSurface)
- m_renderer->setSurface(surface);
- }
+ // The renderer should have been shutdown as part of onUnregistered().
+ // If it still exists then this aspect is being deleted before the aspect
+ // engine is finished with it.
+ Q_ASSERT(m_renderer == nullptr);
+ delete m_nodeManagers;
}
-QRenderAspect::QRenderAspect(QObject *parent)
- : QAbstractAspect(*new QRenderAspectPrivate(Threaded), parent)
+void QRenderAspectPrivate::registerBackendTypes()
{
- // Won't return until the private RenderThread in Renderer has been created
- // The Renderer is set to wait the surface with a wait condition
- // Threads modifying the Renderer should be synchronized using the Renderer's mutex
- registerBackendTypes();
+ Q_Q(QRenderAspect);
+
+ q->registerBackendType<Qt3DCore::QEntity>(QSharedPointer<Render::RenderEntityFunctor>::create(m_renderer, m_nodeManagers));
+ q->registerBackendType<Qt3DCore::QTransform>(QSharedPointer<Render::NodeFunctor<Render::Transform, Render::TransformManager> >::create(m_renderer, m_nodeManagers->transformManager()));
+
+ q->registerBackendType<Qt3DRender::QCameraLens>(QSharedPointer<Render::NodeFunctor<Render::CameraLens, Render::CameraManager> >::create(m_renderer, m_nodeManagers->cameraManager()));
+ q->registerBackendType<QLayer>(QSharedPointer<Render::NodeFunctor<Render::Layer, Render::LayerManager> >::create(m_renderer, m_nodeManagers->layerManager()));
+ q->registerBackendType<QSceneLoader>(QSharedPointer<Render::RenderSceneFunctor>::create(m_renderer, m_nodeManagers->sceneManager()));
+ q->registerBackendType<QRenderTarget>(QSharedPointer<Render::NodeFunctor<Render::RenderTarget, Render::RenderTargetManager> >::create(m_renderer, m_nodeManagers->renderTargetManager()));
+ q->registerBackendType<QRenderTargetOutput>(QSharedPointer<Render::NodeFunctor<Render::RenderTargetOutput, Render::AttachmentManager> >::create(m_renderer, m_nodeManagers->attachmentManager()));
+ q->registerBackendType<QRenderSettings>(QSharedPointer<Render::RenderSettingsFunctor>::create(m_renderer));
+ q->registerBackendType<QRenderState>(QSharedPointer<Render::NodeFunctor<Render::RenderStateNode, Render::RenderStateManager> >::create(m_renderer, m_nodeManagers->renderStateManager()));
+
+ // Geometry + Compute
+ q->registerBackendType<QAttribute>(QSharedPointer<Render::NodeFunctor<Render::Attribute, Render::AttributeManager> >::create(m_renderer, m_nodeManagers->attributeManager()));
+ q->registerBackendType<QBuffer>(QSharedPointer<Render::BufferFunctor>::create(m_renderer, m_nodeManagers->bufferManager()));
+ q->registerBackendType<QComputeCommand>(QSharedPointer<Render::NodeFunctor<Render::ComputeCommand, Render::ComputeCommandManager> >::create(m_renderer, m_nodeManagers->computeJobManager()));
+ q->registerBackendType<QGeometry>(QSharedPointer<Render::NodeFunctor<Render::Geometry, Render::GeometryManager> >::create(m_renderer, m_nodeManagers->geometryManager()));
+ q->registerBackendType<QGeometryRenderer>(QSharedPointer<Render::GeometryRendererFunctor>::create(m_renderer, m_nodeManagers->geometryRendererManager()));
+
+ // Textures
+ q->registerBackendType<QAbstractTexture>(QSharedPointer<Render::TextureFunctor>::create(m_renderer, m_nodeManagers->textureManager(), m_nodeManagers->textureImageManager(), m_nodeManagers->textureDataManager()));
+ q->registerBackendType<QAbstractTextureImage>(QSharedPointer<Render::TextureImageFunctor>::create(m_renderer, m_nodeManagers->textureManager(), m_nodeManagers->textureImageManager(), m_nodeManagers->textureDataManager()));
+
+ // Material system
+ q->registerBackendType<QEffect>(QSharedPointer<Render::NodeFunctor<Render::Effect, Render::EffectManager> >::create(m_renderer, m_nodeManagers->effectManager()));
+ q->registerBackendType<QFilterKey>(QSharedPointer<Render::NodeFunctor<Render::FilterKey, Render::FilterKeyManager> >::create(m_renderer, m_nodeManagers->filterKeyManager()));
+ q->registerBackendType<QAbstractLight>(QSharedPointer<Render::RenderLightFunctor>::create(m_renderer, m_nodeManagers));
+ q->registerBackendType<QMaterial>(QSharedPointer<Render::NodeFunctor<Render::Material, Render::MaterialManager> >::create(m_renderer, m_nodeManagers->materialManager()));
+ q->registerBackendType<QParameter>(QSharedPointer<Render::NodeFunctor<Render::Parameter, Render::ParameterManager> >::create(m_renderer, m_nodeManagers->parameterManager()));
+ q->registerBackendType<QRenderPass>(QSharedPointer<Render::NodeFunctor<Render::RenderPass, Render::RenderPassManager> >::create(m_renderer, m_nodeManagers->renderPassManager()));
+ q->registerBackendType<QShaderData>(QSharedPointer<Render::RenderShaderDataFunctor>::create(m_renderer, m_nodeManagers));
+ q->registerBackendType<QShaderProgram>(QSharedPointer<Render::NodeFunctor<Render::Shader, Render::ShaderManager> >::create(m_renderer, m_nodeManagers->shaderManager()));
+ q->registerBackendType<QTechnique>(QSharedPointer<Render::NodeFunctor<Render::Technique, Render::TechniqueManager> >::create(m_renderer, m_nodeManagers->techniqueManager()));
+
+ // Framegraph
+ q->registerBackendType<QCameraSelector>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::CameraSelector, QCameraSelector> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QClearBuffers>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ClearBuffers, QClearBuffers> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QDispatchCompute>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::DispatchCompute, QDispatchCompute> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QFrustumCulling>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::FrustumCulling, QFrustumCulling> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QLayerFilter>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::LayerFilterNode, QLayerFilter> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QNoDraw>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::NoDraw, QNoDraw> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QRenderPassFilter>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderPassFilter, QRenderPassFilter> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QRenderStateSet>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::StateSetNode, QRenderStateSet> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QRenderSurfaceSelector>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderSurfaceSelector, QRenderSurfaceSelector> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QRenderTargetSelector>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::RenderTargetSelector, QRenderTargetSelector> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QSortPolicy>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::SortPolicy, QSortPolicy> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QTechniqueFilter>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::TechniqueFilter, QTechniqueFilter> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+ q->registerBackendType<QViewport>(QSharedPointer<Render::FrameGraphNodeFunctor<Render::ViewportNode, QViewport> >::create(m_renderer, m_nodeManagers->frameGraphManager()));
+
+ // Picking
+ // q->registerBackendType<QBoundingVolumeDebug>(QSharedPointer<Render::NodeFunctor<Render::BoundingVolumeDebug, Render::BoundingVolumeDebugManager> >::create(m_renderer, m_nodeManagers->boundingVolumeDebugManager()));
+ q->registerBackendType<QObjectPicker>(QSharedPointer<Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager> >::create(m_renderer, m_nodeManagers->objectPickerManager()));
}
+QRenderAspect::QRenderAspect(QObject *parent)
+ : QRenderAspect(Threaded, parent) {}
+
QRenderAspect::QRenderAspect(QRenderAspect::RenderType type, QObject *parent)
- : QAbstractAspect(*new QRenderAspectPrivate(type), parent)
-{
- registerBackendTypes();
-}
+ : QRenderAspect(*new QRenderAspectPrivate(type), parent) {}
/*! \internal */
QRenderAspect::QRenderAspect(QRenderAspectPrivate &dd, QObject *parent)
-
: QAbstractAspect(dd, parent)
{
- registerBackendTypes();
+ // Won't return until the private RenderThread in Renderer has been created
+ // The Renderer is set to wait the surface with a wait condition
+ // Threads modifying the Renderer should be synchronized using the Renderer's mutex
+ setObjectName(QStringLiteral("Render Aspect"));
+ Q_D(QRenderAspect);
+ d->registerBackendTypes();
}
-void QRenderAspect::registerBackendTypes()
+/*! \internal */
+QRenderAspect::~QRenderAspect()
{
- Q_D(QRenderAspect);
-
- registerBackendType<Qt3DCore::QEntity>(QBackendNodeFunctorPtr(new Render::RenderEntityFunctor(d->m_nodeManagers)));
- registerBackendType<Qt3DCore::QTransform>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Transform, Render::TransformManager>(d->m_nodeManagers->transformManager())));
- registerBackendType<QMaterial>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Material, Render::MaterialManager>(d->m_nodeManagers->materialManager())));
- registerBackendType<QTechnique>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Technique, Render::TechniqueManager>(d->m_nodeManagers->techniqueManager())));
- registerBackendType<QAbstractTextureProvider>(QBackendNodeFunctorPtr(new Render::TextureFunctor(d->m_nodeManagers->textureManager(), d->m_nodeManagers->textureImageManager(), d->m_nodeManagers->textureDataManager())));
- registerBackendType<QShaderProgram>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Shader, Render::ShaderManager>(d->m_nodeManagers->shaderManager())));
- registerBackendType<QEffect>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Effect, Render::EffectManager>(d->m_nodeManagers->effectManager())));
- registerBackendType<QAnnotation>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Annotation, Render::CriterionManager>(d->m_nodeManagers->criterionManager())));
- registerBackendType<Qt3DCore::QCameraLens>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::CameraLens, Render::CameraManager>(d->m_nodeManagers->cameraManager())));
- registerBackendType<QLayer>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Layer, Render::LayerManager>(d->m_nodeManagers->layerManager())));
- registerBackendType<QRenderPass>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::RenderPass, Render::RenderPassManager>(d->m_nodeManagers->renderPassManager())));
- registerBackendType<QAbstractSceneLoader>(QBackendNodeFunctorPtr(new Render::RenderSceneFunctor(d->m_nodeManagers->sceneManager())));
- registerBackendType<QRenderTarget>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::RenderTarget, Render::RenderTargetManager>(d->m_nodeManagers->renderTargetManager())));
- registerBackendType<QRenderAttachment>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::RenderAttachment, Render::AttachmentManager>(d->m_nodeManagers->attachmentManager())));
- registerBackendType<QSortCriterion>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::SortCriterion, Render::SortCriterionManager>(d->m_nodeManagers->sortCriterionManager())));
- registerBackendType<QClearBuffer>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::ClearBuffer, QClearBuffer>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QTechniqueFilter>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::TechniqueFilter, QTechniqueFilter>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QViewport>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::ViewportNode, QViewport>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QRenderPassFilter>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::RenderPassFilter, QRenderPassFilter>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QCameraSelector>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::CameraSelector, QCameraSelector>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QRenderTargetSelector>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::RenderTargetSelector, QRenderTargetSelector>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QLayerFilter>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::LayerFilterNode, QLayerFilter>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QSortMethod>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::SortMethod, QSortMethod>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QFrameGraphSelector>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::FrameGraphSubtreeSelector, QFrameGraphSelector>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QFrameGraph>(QBackendNodeFunctorPtr(new Render::FrameGraphComponentFunctor(d->m_renderer)));
- registerBackendType<QParameter>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Parameter, Render::ParameterManager>(d->m_nodeManagers->parameterManager())));
- registerBackendType<QShaderData>(QBackendNodeFunctorPtr(new Render::RenderShaderDataFunctor(d->m_nodeManagers)));
- registerBackendType<QAbstractTextureImage>(QBackendNodeFunctorPtr(new Render::TextureImageFunctor(d->m_nodeManagers->textureManager(), d->m_nodeManagers->textureImageManager(), d->m_nodeManagers->textureDataManager())));
- registerBackendType<QStateSet>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::StateSetNode, QStateSet>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QNoDraw>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::NoDraw, QNoDraw>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QBuffer>(QBackendNodeFunctorPtr(new Render::BufferFunctor(d->m_nodeManagers->bufferManager())));
- registerBackendType<QAttribute>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Attribute, Render::AttributeManager>(d->m_nodeManagers->attributeManager())));
- registerBackendType<QGeometry>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::Geometry, Render::GeometryManager>(d->m_nodeManagers->geometryManager())));
- registerBackendType<QGeometryRenderer>(QBackendNodeFunctorPtr(new Render::GeometryRendererFunctor(d->m_nodeManagers->geometryRendererManager())));
- registerBackendType<QObjectPicker>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager>(d->m_nodeManagers->objectPickerManager())));
- registerBackendType<QBoundingVolumeDebug>(QBackendNodeFunctorPtr(new Render::NodeFunctor<Render::BoundingVolumeDebug, Render::BoundingVolumeDebugManager>(d->m_nodeManagers->boundingVolumeDebugManager())));
- registerBackendType<QFrustumCulling>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::FrustumCulling, QFrustumCulling>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QLight>(QBackendNodeFunctorPtr(new Render::RenderLightFunctor(d->m_nodeManagers)));
- registerBackendType<QLighting>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::Lighting, QLighting>(d->m_nodeManagers->frameGraphManager())));
- registerBackendType<QDispatchCompute>(QBackendNodeFunctorPtr(new Render::FrameGraphNodeFunctor<Render::DispatchCompute, QDispatchCompute>(d->m_nodeManagers->frameGraphManager())));
}
-void QRenderAspect::renderInitialize(QOpenGLContext *context)
+void QRenderAspectPrivate::renderInitialize(QOpenGLContext *context)
{
- Q_D(QRenderAspect);
- if (d->m_renderer->api() == Render::AbstractRenderer::OpenGL)
- static_cast<Render::Renderer *>(d->m_renderer)->setOpenGLContext(context);
- d->m_renderer->initialize();
+ if (m_renderer->api() == Render::AbstractRenderer::OpenGL)
+ static_cast<Render::Renderer *>(m_renderer)->setOpenGLContext(context);
+ m_renderer->initialize();
}
-void QRenderAspect::renderSynchronous()
+void QRenderAspectPrivate::renderSynchronous()
{
- Q_D(QRenderAspect);
- d->m_renderer->doRender();
+ m_renderer->doRender();
}
/*!
* Only called when rendering with QtQuick 2 and a Scene3D item
*/
-void QRenderAspect::renderShutdown()
+void QRenderAspectPrivate::renderShutdown()
{
- Q_D(QRenderAspect);
- d->m_renderer->shutdown();
+ m_renderer->shutdown();
}
QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time)
@@ -304,6 +288,10 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time)
Q_D(QRenderAspect);
d->m_renderer->setTime(time);
+#if defined(QT3D_RENDER_DUMP_BACKEND_NODES)
+ d->m_renderer->dumpInfo();
+#endif
+
// Create jobs that will get exectued by the threadpool
QVector<QAspectJobPtr> jobs;
@@ -316,7 +304,12 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time)
// 7 Cleanup Job (depends on RV)
// Create jobs to load in any meshes that are pending
- if (d->m_renderer != Q_NULLPTR && d->m_renderer->isRunning()) {
+ if (d->m_renderer != nullptr && d->m_renderer->isRunning()) {
+ // don't spawn any jobs, if the renderer decides to skip this frame
+ if (!d->m_renderer->shouldRender()) {
+ d->m_renderer->skipNextFrame();
+ return jobs;
+ }
Render::NodeManagers *manager = d->m_renderer->nodeManagers();
QAspectJobPtr pickBoundingVolumeJob = d->m_renderer->pickBoundingVolumeJob();
@@ -329,8 +322,8 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time)
d->m_cleanupJob->setRoot(d->m_renderer->sceneRoot());
const QVector<QNodeId> texturesPending = manager->textureDataManager()->texturesPending();
- Q_FOREACH (const QNodeId &textureId, texturesPending) {
- Render::LoadTextureDataJobPtr loadTextureJob(new Render::LoadTextureDataJob(textureId));
+ for (const QNodeId textureId : texturesPending) {
+ auto loadTextureJob = Render::LoadTextureDataJobPtr::create(textureId);
loadTextureJob->setNodeManagers(manager);
jobs.append(loadTextureJob);
}
@@ -338,35 +331,26 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time)
// One for urgent jobs that are mandatory for the rendering of a frame
// Another for jobs that can span across multiple frames (Scene/Mesh loading)
const QVector<Render::LoadSceneJobPtr> sceneJobs = manager->sceneManager()->pendingSceneLoaderJobs();
- Q_FOREACH (Render::LoadSceneJobPtr job, sceneJobs) {
+ for (const Render::LoadSceneJobPtr &job : sceneJobs) {
job->setNodeManagers(d->m_nodeManagers);
- job->setSceneParsers(d->m_sceneParsers);
+ job->setSceneIOHandlers(d->m_sceneIOHandler);
jobs.append(job);
}
// Clear any previous temporary dependency
d->m_calculateBoundingVolumeJob->removeDependency(QWeakPointer<QAspectJob>());
- const QVector<QAspectJobPtr> bufferJobs = createRenderBufferJobs();
- Q_FOREACH (const QAspectJobPtr bufferJob, bufferJobs)
+ const QVector<QAspectJobPtr> bufferJobs = d->createRenderBufferJobs();
+ for (const QAspectJobPtr &bufferJob : bufferJobs)
d->m_calculateBoundingVolumeJob->addDependency(bufferJob);
jobs.append(bufferJobs);
- const QVector<QAspectJobPtr> geometryJobs = createGeometryRendererJobs();
+ const QVector<QAspectJobPtr> geometryJobs = d->createGeometryRendererJobs();
jobs.append(geometryJobs);
-
- const QVector<QNodeId> geometryRendererTriangleUpdates = manager->geometryRendererManager()->geometryRenderersRequiringTriangleDataRefresh();
- Q_FOREACH (const QNodeId geomRendererId, geometryRendererTriangleUpdates) {
- Render::CalcGeometryTriangleVolumesPtr triangleComputeJob(new Render::CalcGeometryTriangleVolumes(geomRendererId, manager));
- triangleComputeJob->addDependency(d->m_framePreparationJob);
- pickBoundingVolumeJob->addDependency(triangleComputeJob);
- jobs.append(triangleComputeJob);
- }
-
// Only add dependency if not already present
const QVector<QWeakPointer<QAspectJob> > dependencies = pickBoundingVolumeJob->dependencies();
- if (std::find(dependencies.begin(), dependencies.end(), d->m_updateBoundingVolumeJob) == dependencies.end())
- pickBoundingVolumeJob->addDependency(d->m_updateBoundingVolumeJob);
+ if (std::find(dependencies.begin(), dependencies.end(), d->m_framePreparationJob) == dependencies.end())
+ pickBoundingVolumeJob->addDependency(d->m_framePreparationJob);
// Add all jobs to queue
jobs.append(d->m_calculateBoundingVolumeJob);
@@ -378,31 +362,33 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::jobsToExecute(qint64 time)
// Clear any old dependencies from previous frames
d->m_cleanupJob->removeDependency(QWeakPointer<QAspectJob>());
- // Do not create any more RenderView jobs when the platform surface is gone.
- if (d->m_renderer->surface()) {
- // Traverse the current framegraph and create jobs to populate
- // RenderBins with RenderCommands
- QVector<QAspectJobPtr> renderBinJobs = d->m_renderer->renderBinJobs();
- // TODO: Add wrapper around ThreadWeaver::Collection
- for (int i = 0; i < renderBinJobs.size(); ++i) {
- QAspectJobPtr renderBinJob = renderBinJobs.at(i);
- renderBinJob->addDependency(d->m_updateBoundingVolumeJob);
- jobs.append(renderBinJob);
- d->m_cleanupJob->addDependency(renderBinJob);
- }
+ // Note: We need the RenderBinJobs to set the surface
+ // so we must create the RenderViews in all cases
+
+ // Traverse the current framegraph and create jobs to populate
+ // RenderBins with RenderCommands
+ QVector<QAspectJobPtr> renderBinJobs = d->m_renderer->renderBinJobs();
+ for (int i = 0; i < renderBinJobs.size(); ++i) {
+ QAspectJobPtr renderBinJob = renderBinJobs.at(i);
+ renderBinJob->addDependency(d->m_updateBoundingVolumeJob);
+ jobs.append(renderBinJob);
+ d->m_cleanupJob->addDependency(renderBinJob);
}
jobs.append(d->m_cleanupJob);
}
return jobs;
}
-void QRenderAspect::onRootEntityChanged(Qt3DCore::QEntity *rootEntity)
+void QRenderAspect::onEngineStartup()
{
Q_D(QRenderAspect);
- d->m_renderer->setSceneRoot(d, d->m_renderer->nodeManagers()->lookupResource<Render::Entity, Render::EntityManager>(rootEntity->id()));
+ Render::NodeManagers *managers = d->m_renderer->nodeManagers();
+ Render::Entity *rootEntity = managers->lookupResource<Render::Entity, Render::EntityManager>(rootEntityId());
+ Q_ASSERT(rootEntity);
+ d->m_renderer->setSceneRoot(d, rootEntity);
}
-void QRenderAspect::onInitialize(const QVariantMap &data)
+void QRenderAspect::onRegistered()
{
// TODO: Remove the m_initialized variable and split out onInitialize()
// and setting a resource (the QSurface) on the aspects.
@@ -423,41 +409,49 @@ void QRenderAspect::onInitialize(const QVariantMap &data)
d->m_initialized = true;
}
- QSurface *surface = Q_NULLPTR;
- const QVariant &v = data.value(QStringLiteral("surface"));
- if (v.isValid())
- surface = v.value<QSurface *>();
+ // QSurface *surface = nullptr;
+ // const QVariant &v = data.value(QStringLiteral("surface"));
+ // if (v.isValid())
+ // surface = v.value<QSurface *>();
- if (surface)
- d->setSurface(surface);
+ // if (surface)
+ // d->setSurface(surface);
if (d->m_aspectManager)
d->m_renderer->registerEventFilter(d->services()->eventFilterService());
}
-void QRenderAspect::onCleanup()
+void QRenderAspect::onUnregistered()
{
Q_D(QRenderAspect);
- if (d->m_renderer)
+ if (d->m_renderer) {
+ // Request the renderer shuts down. In the threaded renderer case, the
+ // Renderer destructor is the synchronization point where we wait for the
+ // thread to join (see below).
+ d->m_renderer->shutdown();
+
+ // Free the per-thread threadpool allocators
d->m_renderer->destroyAllocators(d->jobManager());
+ }
+
+ // Waits for the render thread to join (if using threaded renderer)
delete d->m_renderer;
- d->m_renderer = Q_NULLPTR;
+ d->m_renderer = nullptr;
}
// Returns a vector of jobs to be performed for dirty buffers
// 1 dirty buffer == 1 job, all job can be performed in parallel
-QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::createRenderBufferJobs()
+QVector<Qt3DCore::QAspectJobPtr> QRenderAspectPrivate::createRenderBufferJobs()
{
- Q_D(QRenderAspect);
- const QVector<QNodeId> dirtyBuffers = d->m_nodeManagers->bufferManager()->dirtyBuffers();
+ const QVector<QNodeId> dirtyBuffers = m_nodeManagers->bufferManager()->dirtyBuffers();
QVector<QAspectJobPtr> dirtyBuffersJobs;
- Q_FOREACH (const QNodeId &bufId, dirtyBuffers) {
- Render::HBuffer bufferHandle = d->m_nodeManagers->lookupHandle<Render::Buffer, Render::BufferManager, Render::HBuffer>(bufId);
+ for (const QNodeId bufId : dirtyBuffers) {
+ Render::HBuffer bufferHandle = m_nodeManagers->lookupHandle<Render::Buffer, Render::BufferManager, Render::HBuffer>(bufId);
if (!bufferHandle.isNull()) {
// Create new buffer job
- Render::LoadBufferJobPtr job(new Render::LoadBufferJob(bufferHandle));
- job->setNodeManager(d->m_nodeManagers);
+ auto job = Render::LoadBufferJobPtr::create(bufferHandle);
+ job->setNodeManager(m_nodeManagers);
dirtyBuffersJobs.push_back(job);
}
}
@@ -465,18 +459,17 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::createRenderBufferJobs()
return dirtyBuffersJobs;
}
-QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::createGeometryRendererJobs()
+QVector<Qt3DCore::QAspectJobPtr> QRenderAspectPrivate::createGeometryRendererJobs()
{
- Q_D(QRenderAspect);
- Render::GeometryRendererManager *geomRendererManager = d->m_nodeManagers->geometryRendererManager();
+ Render::GeometryRendererManager *geomRendererManager = m_nodeManagers->geometryRendererManager();
const QVector<QNodeId> dirtyGeometryRenderers = geomRendererManager->dirtyGeometryRenderers();
QVector<QAspectJobPtr> dirtyGeometryRendererJobs;
- Q_FOREACH (const QNodeId &geoRendererId, dirtyGeometryRenderers) {
+ for (const QNodeId geoRendererId : dirtyGeometryRenderers) {
Render::HGeometryRenderer geometryRendererHandle = geomRendererManager->lookupHandle(geoRendererId);
if (!geometryRendererHandle.isNull()) {
- Render::LoadGeometryJobPtr job(new Render::LoadGeometryJob(geometryRendererHandle));
- job->setNodeManagers(d->m_nodeManagers);
+ auto job = Render::LoadGeometryJobPtr::create(geometryRendererHandle);
+ job->setNodeManagers(m_nodeManagers);
dirtyGeometryRendererJobs.push_back(job);
}
}
@@ -486,11 +479,11 @@ QVector<Qt3DCore::QAspectJobPtr> QRenderAspect::createGeometryRendererJobs()
void QRenderAspectPrivate::loadSceneParsers()
{
- QStringList keys = QSceneParserFactory::keys();
- Q_FOREACH (QString key, keys) {
- QAbstractSceneParser *sceneParser = QSceneParserFactory::create(key, QStringList());
- if (sceneParser != Q_NULLPTR)
- m_sceneParsers.append(sceneParser);
+ const QStringList keys = QSceneIOFactory::keys();
+ for (const QString &key : keys) {
+ QSceneIOHandler *sceneIOHandler = QSceneIOFactory::create(key, QStringList());
+ if (sceneIOHandler != nullptr)
+ m_sceneIOHandler.append(sceneIOHandler);
}
}
diff --git a/src/render/frontend/qrenderaspect.h b/src/render/frontend/qrenderaspect.h
index 2213e10cc..45e982873 100644
--- a/src/render/frontend/qrenderaspect.h
+++ b/src/render/frontend/qrenderaspect.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -61,26 +64,20 @@ public:
Threaded
};
- explicit QRenderAspect(QObject *parent = Q_NULLPTR);
- explicit QRenderAspect(RenderType type, QObject *parent = Q_NULLPTR);
-
- void renderInitialize(QOpenGLContext *context);
- void renderSynchronous();
- void renderShutdown();
+ explicit QRenderAspect(QObject *parent = nullptr);
+ explicit QRenderAspect(RenderType type, QObject *parent = nullptr);
+ ~QRenderAspect();
QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time) Q_DECL_OVERRIDE;
protected:
- void registerBackendTypes();
QRenderAspect(QRenderAspectPrivate &dd, QObject *parent);
Q_DECLARE_PRIVATE(QRenderAspect)
- void onRootEntityChanged(Qt3DCore::QEntity *rootObject) Q_DECL_OVERRIDE;
- void onInitialize(const QVariantMap &data) Q_DECL_OVERRIDE;
- void onCleanup() Q_DECL_OVERRIDE;
+ void onRegistered() Q_DECL_OVERRIDE;
+ void onUnregistered() Q_DECL_OVERRIDE;
- QVector<Qt3DCore::QAspectJobPtr> createRenderBufferJobs();
- QVector<Qt3DCore::QAspectJobPtr> createGeometryRendererJobs();
+ void onEngineStartup() Q_DECL_OVERRIDE;
private:
friend class Render::Renderer;
diff --git a/src/render/frontend/qrenderaspect_p.h b/src/render/frontend/qrenderaspect_p.h
index 4690e98ac..e0ea0cc00 100644
--- a/src/render/frontend/qrenderaspect_p.h
+++ b/src/render/frontend/qrenderaspect_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -63,38 +66,39 @@ class QSurface;
namespace Qt3DRender {
-class QAbstractSceneParser;
-
+class QSceneIOHandler;
namespace Render {
class AbstractRenderer;
class NodeManagers;
}
-class QRenderAspectPrivate : public Qt3DCore::QAbstractAspectPrivate
+class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderAspectPrivate : public Qt3DCore::QAbstractAspectPrivate
{
public:
QRenderAspectPrivate(QRenderAspect::RenderType type);
+ ~QRenderAspectPrivate();
Q_DECLARE_PUBLIC(QRenderAspect)
- void setSurface(QSurface *surface);
+ void registerBackendTypes();
void loadSceneParsers();
+ void renderInitialize(QOpenGLContext *context);
+ void renderSynchronous();
+ void renderShutdown();
+ QVector<Qt3DCore::QAspectJobPtr> createRenderBufferJobs();
+ QVector<Qt3DCore::QAspectJobPtr> createGeometryRendererJobs();
Render::NodeManagers *m_nodeManagers;
Render::AbstractRenderer *m_renderer;
- // The filter has affinity with the main thread so we have to delete it there
- // via QScopedPointerDeleteLater
- QScopedPointer<Render::PlatformSurfaceFilter, QScopedPointerDeleteLater> m_surfaceEventFilter;
- QSurface *m_surface;
-
bool m_initialized;
Render::FramePreparationJobPtr m_framePreparationJob;
Render::FrameCleanupJobPtr m_cleanupJob;
Render::UpdateWorldTransformJobPtr m_worldTransformJob;
Render::UpdateBoundingVolumeJobPtr m_updateBoundingVolumeJob;
Render::CalculateBoundingVolumeJobPtr m_calculateBoundingVolumeJob;
- QList<QAbstractSceneParser *> m_sceneParsers;
+ QList<QSceneIOHandler *> m_sceneIOHandler;
+
};
}
diff --git a/src/render/frontend/qrenderattachment.cpp b/src/render/frontend/qrenderattachment.cpp
deleted file mode 100644
index c69e1d478..000000000
--- a/src/render/frontend/qrenderattachment.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qrenderattachment_p.h"
-#include "qrenderattachment.h"
-#include "qtexture.h"
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QRenderAttachmentPrivate::QRenderAttachmentPrivate()
- : QNodePrivate()
- , m_texture(Q_NULLPTR)
- , m_type(QRenderAttachment::ColorAttachment0)
- , m_mipLevel(0)
- , m_layer(0)
- , m_face(QRenderAttachment::CubeMapNegativeX)
-{
-}
-
-void QRenderAttachment::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QRenderAttachment *rA = static_cast<const QRenderAttachment*>(ref);
- d_func()->m_type = rA->d_func()->m_type;
- setTexture(qobject_cast<QAbstractTextureProvider *>(QNode::clone(rA->d_func()->m_texture)));
-}
-
-QRenderAttachment::QRenderAttachment(QNode *parent)
- : QNode(*new QRenderAttachmentPrivate, parent)
-{
-}
-
-QRenderAttachment::~QRenderAttachment()
-{
- QNode::cleanup();
-}
-
-/*! \internal */
-QRenderAttachment::QRenderAttachment(QRenderAttachmentPrivate &dd, QNode *parent)
- : QNode(dd, parent)
-{
-}
-
-void QRenderAttachment::setType(QRenderAttachment::RenderAttachmentType type)
-{
- Q_D(QRenderAttachment);
- if (type != d->m_type) {
- d->m_type = type;
- emit typeChanged(type);
- }
-}
-
-QRenderAttachment::RenderAttachmentType QRenderAttachment::type() const
-{
- Q_D(const QRenderAttachment);
- return d->m_type;
-}
-
-void QRenderAttachment::setTexture(QAbstractTextureProvider *texture)
-{
- Q_D(QRenderAttachment);
- if (texture != d->m_texture) {
- d->m_texture = texture;
-
- // Handle inline declaration
- if (!texture->parent())
- texture->setParent(this);
- emit textureChanged(texture);
- }
-}
-
-QAbstractTextureProvider *QRenderAttachment::texture() const
-{
- Q_D(const QRenderAttachment);
- return d->m_texture;
-}
-
-void QRenderAttachment::setMipLevel(int level)
-{
- Q_D(QRenderAttachment);
- if (d->m_mipLevel != level) {
- d->m_mipLevel = level;
- emit mipLevelChanged(level);
- }
-}
-
-int QRenderAttachment::mipLevel() const
-{
- Q_D(const QRenderAttachment);
- return d->m_mipLevel;
-}
-
-void QRenderAttachment::setLayer(int layer)
-{
- Q_D(QRenderAttachment);
- if (d->m_layer != layer) {
- d->m_layer = layer;
- emit layerChanged(layer);
- }
-}
-
-int QRenderAttachment::layer() const
-{
- Q_D(const QRenderAttachment);
- return d->m_layer;
-}
-
-void QRenderAttachment::setFace(QRenderAttachment::CubeMapFace face)
-{
- Q_D(QRenderAttachment);
- if (d->m_face != face) {
- d->m_face = face;
- emit faceChanged(face);
- }
-}
-
-QRenderAttachment::CubeMapFace QRenderAttachment::face() const
-{
- Q_D(const QRenderAttachment);
- return d->m_face;
-}
-
-void QRenderAttachment::setName(const QString &name)
-{
- Q_D(QRenderAttachment);
- if (d->m_name != name) {
- d->m_name = name;
- emit nameChanged(name);
- }
-}
-
-QString QRenderAttachment::name() const
-{
- Q_D(const QRenderAttachment);
- return d->m_name;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/frontend/qrenderattachment.h b/src/render/frontend/qrenderattachment.h
deleted file mode 100644
index a4efe299f..000000000
--- a/src/render/frontend/qrenderattachment.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QRENDERATTACHMENT_H
-#define QT3DRENDER_QRENDERATTACHMENT_H
-
-#include <Qt3DCore/qnode.h>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractTextureProvider;
-class QRenderAttachmentPrivate;
-
-class QT3DRENDERSHARED_EXPORT QRenderAttachment : public Qt3DCore::QNode
-{
- Q_OBJECT
- Q_PROPERTY(RenderAttachmentType type READ type WRITE setType NOTIFY typeChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider *texture READ texture WRITE setTexture NOTIFY textureChanged)
- Q_PROPERTY(int mipLevel READ mipLevel WRITE setMipLevel NOTIFY mipLevelChanged)
- Q_PROPERTY(int layer READ layer WRITE setLayer NOTIFY layerChanged)
- Q_PROPERTY(CubeMapFace face READ face WRITE setFace NOTIFY faceChanged)
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
-
-public:
- enum RenderAttachmentType {
- ColorAttachment0 = 0,
- ColorAttachment1,
- ColorAttachment2,
- ColorAttachment3,
- ColorAttachment4,
- ColorAttachment5,
- ColorAttachment6,
- ColorAttachment7,
- ColorAttachment8,
- ColorAttachment9,
- ColorAttachment10,
- ColorAttachment11,
- ColorAttachment12,
- ColorAttachment13,
- ColorAttachment14,
- ColorAttachment15,
- DepthAttachment,
- StencilAttachment,
- DepthStencilAttachment
- };
- Q_ENUM(RenderAttachmentType)
-
- enum CubeMapFace {
- CubeMapPositiveX = 0x8515, // GL_TEXTURE_CUBE_MAP_POSITIVE_X
- CubeMapNegativeX = 0x8516, // GL_TEXTURE_CUBE_MAP_NEGATIVE_X
- CubeMapPositiveY = 0x8517, // GL_TEXTURE_CUBE_MAP_POSITIVE_Y
- CubeMapNegativeY = 0x8518, // GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
- CubeMapPositiveZ = 0x8519, // GL_TEXTURE_CUBE_MAP_POSITIVE_Z
- CubeMapNegativeZ = 0x851A // GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
- };
- Q_ENUM(CubeMapFace)
-
- explicit QRenderAttachment(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QRenderAttachment();
-
- RenderAttachmentType type() const;
- QAbstractTextureProvider *texture() const;
- int mipLevel() const;
- int layer() const;
- CubeMapFace face() const;
- QString name() const;
-
-public Q_SLOTS:
- void setType(RenderAttachmentType type);
- void setTexture(QAbstractTextureProvider *texture);
- void setMipLevel(int level);
- void setLayer(int layer);
- void setFace(CubeMapFace face);
- void setName(const QString &name);
-
-Q_SIGNALS:
- void typeChanged(RenderAttachmentType type);
- void textureChanged(QAbstractTextureProvider *texture);
- void mipLevelChanged(int mipLevel);
- void layerChanged(int layer);
- void faceChanged(CubeMapFace face);
- void nameChanged(const QString &name);
-
-protected:
- QRenderAttachment(QRenderAttachmentPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QRenderAttachment)
- QT3D_CLONEABLE(QRenderAttachment)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Qt3DRender::QRenderAttachment::RenderAttachmentType)
-
-#endif // QT3DRENDER_QRENDERATTACHMENT_H
diff --git a/src/render/frontend/qrenderattachment_p.h b/src/render/frontend/qrenderattachment_p.h
deleted file mode 100644
index 1a9b7c91d..000000000
--- a/src/render/frontend/qrenderattachment_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QRENDERATTACHMENT_P_H
-#define QT3DRENDER_QRENDERATTACHMENT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DRender/qrenderattachment.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractTextureProvider;
-
-class QRenderAttachmentPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QRenderAttachmentPrivate();
-
- Q_DECLARE_PUBLIC(QRenderAttachment)
-
- QAbstractTextureProvider *m_texture;
- QRenderAttachment::RenderAttachmentType m_type;
- int m_mipLevel;
- int m_layer;
- QRenderAttachment::CubeMapFace m_face;
- QString m_name;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QRENDERATTACHMENT_P_H
diff --git a/src/render/frontend/qrendersettings.cpp b/src/render/frontend/qrendersettings.cpp
new file mode 100644
index 000000000..a6e4a99eb
--- /dev/null
+++ b/src/render/frontend/qrendersettings.cpp
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qrendersettings.h"
+#include "qrendersettings_p.h"
+#include "qframegraphnode.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QRenderSettingsPrivate::QRenderSettingsPrivate()
+ : Qt3DCore::QComponentPrivate()
+ , m_activeFrameGraph(nullptr)
+ , m_renderPolicy(QRenderSettings::OnDemand)
+{
+}
+
+void QRenderSettingsPrivate::init()
+{
+ Q_Q(QRenderSettings);
+ QObject::connect(&m_pickingSettings, SIGNAL(pickMethodChanged(QPickingSettings::PickMethod)),
+ q, SLOT(_q_onPickingMethodChanged(QPickingSettings::PickMethod)));
+ QObject::connect(&m_pickingSettings, SIGNAL(pickResultModeChanged(QPickingSettings::PickResultMode)),
+ q, SLOT(_q_onPickResultModeChanged(QPickingSettings::PickResultMode)));
+}
+
+void QRenderSettingsPrivate::_q_onPickingMethodChanged(QPickingSettings::PickMethod pickMethod)
+{
+ notifyPropertyChange("pickMethod", pickMethod);
+}
+
+void QRenderSettingsPrivate::_q_onPickResultModeChanged(QPickingSettings::PickResultMode pickResultMode)
+{
+ notifyPropertyChange("pickResultMode", pickResultMode);
+}
+
+QRenderSettings::QRenderSettings(Qt3DCore::QNode *parent)
+ : QRenderSettings(*new QRenderSettingsPrivate, parent) {}
+
+QRenderSettings::QRenderSettings(QRenderSettingsPrivate &dd, Qt3DCore::QNode *parent)
+ : Qt3DCore::QComponent(dd, parent)
+{
+ Q_D(QRenderSettings);
+ d->init();
+}
+
+/*! \internal */
+QRenderSettings::~QRenderSettings()
+{
+}
+
+QPickingSettings *QRenderSettings::pickingSettings()
+{
+ Q_D(QRenderSettings);
+ return &(d->m_pickingSettings);
+}
+
+QFrameGraphNode *QRenderSettings::activeFrameGraph() const
+{
+ Q_D(const QRenderSettings);
+ return d->m_activeFrameGraph;
+}
+
+QRenderSettings::RenderPolicy QRenderSettings::renderPolicy() const
+{
+ Q_D(const QRenderSettings);
+ return d->m_renderPolicy;
+}
+
+void QRenderSettings::setActiveFrameGraph(QFrameGraphNode *activeFrameGraph)
+{
+ Q_D(QRenderSettings);
+ if (d->m_activeFrameGraph == activeFrameGraph)
+ return;
+
+ if (activeFrameGraph != nullptr && !activeFrameGraph->parent())
+ activeFrameGraph->setParent(this);
+ d->m_activeFrameGraph = activeFrameGraph;
+ emit activeFrameGraphChanged(activeFrameGraph);
+}
+
+void QRenderSettings::setRenderPolicy(QRenderSettings::RenderPolicy renderPolicy)
+{
+ Q_D(QRenderSettings);
+ if (d->m_renderPolicy == renderPolicy)
+ return;
+
+ d->m_renderPolicy = renderPolicy;
+ emit renderPolicyChanged(renderPolicy);
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderSettings::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderSettingsData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QRenderSettings);
+ data.activeFrameGraphId = qIdForNode(d->m_activeFrameGraph);
+ data.renderPolicy = d->m_renderPolicy;
+ data.pickMethod = d->m_pickingSettings.pickMethod();
+ data.pickResultMode = d->m_pickingSettings.pickResultMode();
+ return creationChange;
+}
+
+} // namespace Qt3Drender
+
+QT_END_NAMESPACE
+
+#include "moc_qrendersettings.cpp"
diff --git a/src/render/frontend/qrendersettings.h b/src/render/frontend/qrendersettings.h
new file mode 100644
index 000000000..55fe3007a
--- /dev/null
+++ b/src/render/frontend/qrendersettings.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERSETTINGS_H
+#define QT3DRENDER_QRENDERSETTINGS_H
+
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DRender/qpickingsettings.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFrameGraphNode;
+class QRenderSettingsPrivate;
+
+class QT3DRENDERSHARED_EXPORT QRenderSettings : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QPickingSettings* pickingSettings READ pickingSettings CONSTANT)
+ Q_PROPERTY(RenderPolicy renderPolicy READ renderPolicy WRITE setRenderPolicy NOTIFY renderPolicyChanged)
+ Q_PROPERTY(Qt3DRender::QFrameGraphNode *activeFrameGraph READ activeFrameGraph WRITE setActiveFrameGraph NOTIFY activeFrameGraphChanged)
+ Q_CLASSINFO("DefaultProperty", "activeFrameGraph")
+
+public:
+ explicit QRenderSettings(Qt3DCore::QNode *parent = nullptr);
+ ~QRenderSettings();
+
+ enum RenderPolicy {
+ OnDemand,
+ Always
+ };
+ Q_ENUM(RenderPolicy)
+
+ QPickingSettings* pickingSettings();
+ QFrameGraphNode *activeFrameGraph() const;
+ RenderPolicy renderPolicy() const;
+
+public Q_SLOTS:
+ void setActiveFrameGraph(QFrameGraphNode *activeFrameGraph);
+ void setRenderPolicy(RenderPolicy renderPolicy);
+
+Q_SIGNALS:
+ void activeFrameGraphChanged(QFrameGraphNode *activeFrameGraph);
+ void renderPolicyChanged(RenderPolicy renderPolicy);
+
+protected:
+ Q_DECLARE_PRIVATE(QRenderSettings)
+ explicit QRenderSettings(QRenderSettingsPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_PRIVATE_SLOT(d_func(), void _q_onPickingMethodChanged(QPickingSettings::PickMethod))
+ Q_PRIVATE_SLOT(d_func(), void _q_onPickResultModeChanged(QPickingSettings::PickResultMode))
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3Drender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERSETTINGS_H
diff --git a/src/render/frontend/qrendersettings_p.h b/src/render/frontend/qrendersettings_p.h
new file mode 100644
index 000000000..efbd7f8f1
--- /dev/null
+++ b/src/render/frontend/qrendersettings_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERSETTINGS_P_H
+#define QT3DRENDER_QRENDERSETTINGS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qcomponent_p.h>
+#include <Qt3DRender/qrendersettings.h>
+#include <Qt3DRender/qpickingsettings.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderSettingsPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QRenderSettingsPrivate();
+
+ void init();
+
+ QPickingSettings m_pickingSettings;
+ QFrameGraphNode *m_activeFrameGraph;
+ QRenderSettings::RenderPolicy m_renderPolicy;
+
+ void _q_onPickingMethodChanged(QPickingSettings::PickMethod pickMethod);
+ void _q_onPickResultModeChanged(QPickingSettings::PickResultMode pickResultMode);
+
+ Q_DECLARE_PUBLIC(QRenderSettings)
+};
+
+struct QRenderSettingsData
+{
+ Qt3DCore::QNodeId activeFrameGraphId;
+ QRenderSettings::RenderPolicy renderPolicy;
+ QPickingSettings::PickMethod pickMethod;
+ QPickingSettings::PickResultMode pickResultMode;
+};
+
+} // namespace Qt3Drender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERSETTINGS_P_H
diff --git a/src/render/frontend/qrendertarget.cpp b/src/render/frontend/qrendertarget.cpp
index 3a62d0eea..0157a16f0 100644
--- a/src/render/frontend/qrendertarget.cpp
+++ b/src/render/frontend/qrendertarget.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,8 +39,10 @@
#include "qrendertarget.h"
#include "qrendertarget_p.h"
-#include "qrenderattachment.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qrendertargetoutput.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -50,22 +55,14 @@ QRenderTargetPrivate::QRenderTargetPrivate()
{
}
-void QRenderTarget::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QRenderTarget *other = static_cast<const QRenderTarget*>(ref);
- Q_FOREACH (QRenderAttachment *attachment, other->d_func()->m_attachments)
- addAttachment(qobject_cast<QRenderAttachment *>(QNode::clone(attachment)));
-}
-
QRenderTarget::QRenderTarget(QNode *parent)
: QComponent(*new QRenderTargetPrivate, parent)
{
}
+/*! \internal */
QRenderTarget::~QRenderTarget()
{
- QNode::cleanup();
}
/*! \internal */
@@ -74,41 +71,47 @@ QRenderTarget::QRenderTarget(QRenderTargetPrivate &dd, QNode *parent)
{
}
-void QRenderTarget::addAttachment(QRenderAttachment *attachment)
+void QRenderTarget::addOutput(QRenderTargetOutput *output)
{
Q_D(QRenderTarget);
- if (!d->m_attachments.contains(attachment)) {
- d->m_attachments.append(attachment);
+ if (output && !d->m_outputs.contains(output)) {
+ d->m_outputs.append(output);
- if (!attachment->parent())
- attachment->setParent(this);
+ if (!output->parent())
+ output->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- change->setPropertyName("attachment");
- change->setValue(QVariant::fromValue(attachment->id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), output);
+ change->setPropertyName("output");
d->notifyObservers(change);
}
}
}
-void QRenderTarget::removeAttachment(QRenderAttachment *attachment)
+void QRenderTarget::removeOutput(QRenderTargetOutput *output)
{
Q_D(QRenderTarget);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- change->setPropertyName("attachment");
- change->setValue(QVariant::fromValue(attachment->id()));
+ if (output && d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), output);
+ change->setPropertyName("output");
d->notifyObservers(change);
}
- d->m_attachments.removeOne(attachment);
+ d->m_outputs.removeOne(output);
}
-QList<QRenderAttachment *> QRenderTarget::attachments() const
+QVector<QRenderTargetOutput *> QRenderTarget::outputs() const
{
Q_D(const QRenderTarget);
- return d->m_attachments;
+ return d->m_outputs;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderTarget::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderTargetData>::create(this);
+ auto &data = creationChange->data;
+ data.outputIds = qIdsForNodes(outputs());
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/frontend/qrendertarget.h b/src/render/frontend/qrendertarget.h
index 0010c68cd..cb0edde51 100644
--- a/src/render/frontend/qrendertarget.h
+++ b/src/render/frontend/qrendertarget.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -45,26 +48,25 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QRenderTargetPrivate;
-class QRenderAttachment;
+class QRenderTargetOutput;
class QT3DRENDERSHARED_EXPORT QRenderTarget : public Qt3DCore::QComponent
{
Q_OBJECT
public:
- explicit QRenderTarget(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QRenderTarget(Qt3DCore::QNode *parent = nullptr);
~QRenderTarget();
- void addAttachment(QRenderAttachment *attachment);
- void removeAttachment(QRenderAttachment *attachment);
- QList<QRenderAttachment *> attachments() const;
+ void addOutput(QRenderTargetOutput *output);
+ void removeOutput(QRenderTargetOutput *output);
+ QVector<QRenderTargetOutput *> outputs() const;
protected:
- QRenderTarget(QRenderTargetPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QRenderTarget(QRenderTargetPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QRenderTarget)
- QT3D_CLONEABLE(QRenderTarget)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/frontend/qrendertarget_p.h b/src/render/frontend/qrendertarget_p.h
index 8b300faed..44a8ac0c1 100644
--- a/src/render/frontend/qrendertarget_p.h
+++ b/src/render/frontend/qrendertarget_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,7 +57,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QRenderAttachment;
+class QRenderTargetOutput;
class QRenderTarget;
class QRenderTargetPrivate : public Qt3DCore::QComponentPrivate
@@ -63,7 +66,12 @@ public:
QRenderTargetPrivate();
Q_DECLARE_PUBLIC(QRenderTarget)
- QList<QRenderAttachment *> m_attachments;
+ QVector<QRenderTargetOutput *> m_outputs;
+};
+
+struct QRenderTargetData
+{
+ Qt3DCore::QNodeIdVector outputIds;
};
}
diff --git a/src/render/frontend/qrendertargetoutput.cpp b/src/render/frontend/qrendertargetoutput.cpp
new file mode 100644
index 000000000..75bf1ab91
--- /dev/null
+++ b/src/render/frontend/qrendertargetoutput.cpp
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qrendertargetoutput.h"
+#include "qrendertargetoutput_p.h"
+#include "qtexture.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QRenderTargetOutputPrivate::QRenderTargetOutputPrivate()
+ : QNodePrivate()
+ , m_texture(nullptr)
+ , m_attachmentPoint(QRenderTargetOutput::Color0)
+ , m_mipLevel(0)
+ , m_layer(0)
+ , m_face(QAbstractTexture::CubeMapNegativeX)
+{
+}
+
+QRenderTargetOutput::QRenderTargetOutput(QNode *parent)
+ : QNode(*new QRenderTargetOutputPrivate, parent)
+{
+}
+
+/*! \internal */
+QRenderTargetOutput::~QRenderTargetOutput()
+{
+}
+
+/*! \internal */
+QRenderTargetOutput::QRenderTargetOutput(QRenderTargetOutputPrivate &dd, QNode *parent)
+ : QNode(dd, parent)
+{
+}
+
+void QRenderTargetOutput::setAttachmentPoint(QRenderTargetOutput::AttachmentPoint attachmentPoint)
+{
+ Q_D(QRenderTargetOutput);
+ if (attachmentPoint != d->m_attachmentPoint) {
+ d->m_attachmentPoint = attachmentPoint;
+ emit attachmentPointChanged(attachmentPoint);
+ }
+}
+
+QRenderTargetOutput::AttachmentPoint QRenderTargetOutput::attachmentPoint() const
+{
+ Q_D(const QRenderTargetOutput);
+ return d->m_attachmentPoint;
+}
+
+void QRenderTargetOutput::setTexture(QAbstractTexture *texture)
+{
+ Q_D(QRenderTargetOutput);
+ if (texture != d->m_texture) {
+ d->m_texture = texture;
+
+ // Handle inline declaration
+ if (!texture->parent())
+ texture->setParent(this);
+ emit textureChanged(texture);
+ }
+}
+
+QAbstractTexture *QRenderTargetOutput::texture() const
+{
+ Q_D(const QRenderTargetOutput);
+ return d->m_texture;
+}
+
+void QRenderTargetOutput::setMipLevel(int level)
+{
+ Q_D(QRenderTargetOutput);
+ if (d->m_mipLevel != level) {
+ d->m_mipLevel = level;
+ emit mipLevelChanged(level);
+ }
+}
+
+int QRenderTargetOutput::mipLevel() const
+{
+ Q_D(const QRenderTargetOutput);
+ return d->m_mipLevel;
+}
+
+void QRenderTargetOutput::setLayer(int layer)
+{
+ Q_D(QRenderTargetOutput);
+ if (d->m_layer != layer) {
+ d->m_layer = layer;
+ emit layerChanged(layer);
+ }
+}
+
+int QRenderTargetOutput::layer() const
+{
+ Q_D(const QRenderTargetOutput);
+ return d->m_layer;
+}
+
+void QRenderTargetOutput::setFace(QAbstractTexture::CubeMapFace face)
+{
+ Q_D(QRenderTargetOutput);
+ if (d->m_face != face) {
+ d->m_face = face;
+ emit faceChanged(face);
+ }
+}
+
+QAbstractTexture::CubeMapFace QRenderTargetOutput::face() const
+{
+ Q_D(const QRenderTargetOutput);
+ return d->m_face;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderTargetOutput::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderTargetOutputData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QRenderTargetOutput);
+ data.textureId = qIdForNode(texture());
+ data.attachmentPoint = d->m_attachmentPoint;
+ data.mipLevel = d->m_mipLevel;
+ data.layer = d->m_layer;
+ data.face = d->m_face;
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/frontend/qrendertargetoutput.h b/src/render/frontend/qrendertargetoutput.h
new file mode 100644
index 000000000..1f78dd279
--- /dev/null
+++ b/src/render/frontend/qrendertargetoutput.h
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERTARGETOUTPUT_H
+#define QT3DRENDER_QRENDERTARGETOUTPUT_H
+
+#include <Qt3DCore/qnode.h>
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DRender/QAbstractTexture>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractTexture;
+class QRenderTargetOutputPrivate;
+
+class QT3DRENDERSHARED_EXPORT QRenderTargetOutput : public Qt3DCore::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(AttachmentPoint attachmentPoint READ attachmentPoint WRITE setAttachmentPoint NOTIFY attachmentPointChanged)
+ Q_PROPERTY(QAbstractTexture *texture READ texture WRITE setTexture NOTIFY textureChanged)
+ Q_PROPERTY(int mipLevel READ mipLevel WRITE setMipLevel NOTIFY mipLevelChanged)
+ Q_PROPERTY(int layer READ layer WRITE setLayer NOTIFY layerChanged)
+ Q_PROPERTY(QAbstractTexture::CubeMapFace face READ face WRITE setFace NOTIFY faceChanged)
+
+public:
+ enum AttachmentPoint {
+ Color0 = 0,
+ Color1,
+ Color2,
+ Color3,
+ Color4,
+ Color5,
+ Color6,
+ Color7,
+ Color8,
+ Color9,
+ Color10,
+ Color11,
+ Color12,
+ Color13,
+ Color14,
+ Color15,
+ Depth,
+ Stencil,
+ DepthStencil
+ };
+ Q_ENUM(AttachmentPoint)
+
+ explicit QRenderTargetOutput(Qt3DCore::QNode *parent = nullptr);
+ ~QRenderTargetOutput();
+
+ AttachmentPoint attachmentPoint() const;
+ QAbstractTexture *texture() const;
+ int mipLevel() const;
+ int layer() const;
+ QAbstractTexture::CubeMapFace face() const;
+
+public Q_SLOTS:
+ void setAttachmentPoint(AttachmentPoint attachmentPoint);
+ void setTexture(QAbstractTexture *texture);
+ void setMipLevel(int level);
+ void setLayer(int layer);
+ void setFace(QAbstractTexture::CubeMapFace face);
+
+Q_SIGNALS:
+ void attachmentPointChanged(AttachmentPoint attachmentPoint);
+ void textureChanged(QAbstractTexture *texture);
+ void mipLevelChanged(int mipLevel);
+ void layerChanged(int layer);
+ void faceChanged(QAbstractTexture::CubeMapFace face);
+
+protected:
+ explicit QRenderTargetOutput(QRenderTargetOutputPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+ Q_DECLARE_PRIVATE(QRenderTargetOutput)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::QRenderTargetOutput::AttachmentPoint)
+
+#endif // QT3DRENDER_QRENDERTARGETOUTPUT_H
diff --git a/src/render/frontend/qrendertargetoutput_p.h b/src/render/frontend/qrendertargetoutput_p.h
new file mode 100644
index 000000000..abd352ac9
--- /dev/null
+++ b/src/render/frontend/qrendertargetoutput_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERTARGETOUTPUT_P_H
+#define QT3DRENDER_QRENDERTARGETOUTPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DRender/qrendertargetoutput.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractTexture;
+
+class QRenderTargetOutputPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QRenderTargetOutputPrivate();
+
+ Q_DECLARE_PUBLIC(QRenderTargetOutput)
+
+ QAbstractTexture *m_texture;
+ QRenderTargetOutput::AttachmentPoint m_attachmentPoint;
+ int m_mipLevel;
+ int m_layer;
+ QAbstractTexture::CubeMapFace m_face;
+};
+
+struct QRenderTargetOutputData
+{
+ Qt3DCore::QNodeId textureId;
+ QRenderTargetOutput::AttachmentPoint attachmentPoint;
+ int mipLevel;
+ int layer;
+ QAbstractTexture::CubeMapFace face;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERTARGETOUTPUT_P_H
diff --git a/src/render/frontend/qwindow.cpp b/src/render/frontend/qwindow.cpp
deleted file mode 100644
index 07db56bba..000000000
--- a/src/render/frontend/qwindow.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwindow.h"
-#include "qwindow_p.h"
-
-#include <Qt3DCore/qaspectengine.h>
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qcamera.h>
-#include <Qt3DRender/qframegraph.h>
-#include <Qt3DRender/qrenderaspect.h>
-#include <Qt3DRender/qforwardrenderer.h>
-#include <QOpenGLContext>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-
-QWindowPrivate::QWindowPrivate()
- : ::QWindowPrivate()
- , m_root(new QEntity())
- , m_userRoot(Q_NULLPTR)
- , m_defaultCamera(new QCamera())
- , m_frameGraph(Q_NULLPTR)
- , m_engine(new QAspectEngine())
- , m_renderAspect(new QRenderAspect())
-{
- m_engine->registerAspect(m_renderAspect);
-
- // TO DO: Find a nice way to set the camera on the controller which is in
- // the input aspect
-}
-
-QWindow::QWindow(::QWindow *parent)
- : ::QWindow(*new QWindowPrivate(), parent)
-{
- setSurfaceType(QSurface::OpenGLSurface);
-
- resize(1024, 768);
-
- QSurfaceFormat format;
- if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
- format.setVersion(4, 3);
- format.setProfile(QSurfaceFormat::CoreProfile);
- }
- format.setDepthBufferSize(24);
- format.setSamples(4);
- format.setStencilBufferSize(8);
- setFormat(format);
- create();
-}
-
-QWindow::QWindow(QWindowPrivate &dd, ::QWindow *parent)
- : ::QWindow(dd, parent)
-{
- setSurfaceType(QSurface::OpenGLSurface);
-
- resize(1024, 768);
-
- QSurfaceFormat format;
- if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
- format.setVersion(4, 3);
- format.setProfile(QSurfaceFormat::CoreProfile);
- }
- format.setDepthBufferSize(24);
- format.setSamples(4);
- format.setStencilBufferSize(8);
- setFormat(format);
- create();
-}
-
-void QWindow::resizeEvent(QResizeEvent *)
-{
- Q_D(QWindow);
- d->m_defaultCamera->setAspectRatio(float(width()) / float(height()));
-}
-
-QWindow::~QWindow()
-{
-}
-
-void QWindow::setFrameGraph(QFrameGraph *frameGraph)
-{
- Q_ASSERT(!isVisible());
- Q_D(QWindow);
- d->m_frameGraph = frameGraph;
-}
-
-QFrameGraph *QWindow::frameGraph() const
-{
- Q_D(const QWindow);
- return d->m_frameGraph;
-}
-
-Qt3DCore::QCamera *QWindow::defaultCamera()
-{
- Q_D(const QWindow);
- return d->m_defaultCamera;
-}
-
-void QWindow::registerAspect(Qt3DCore::QAbstractAspect *aspect)
-{
- Q_ASSERT(!isVisible());
- Q_D(QWindow);
- d->m_engine->registerAspect(aspect);
-}
-
-void QWindow::registerAspect(const QString &name)
-{
- Q_ASSERT(!isVisible());
- Q_D(QWindow);
- d->m_engine->registerAspect(name);
-}
-
-void QWindow::setRootEntity(Qt3DCore::QEntity *root)
-{
- Q_ASSERT(!isVisible());
- Q_D(QWindow);
- d->m_userRoot = root;
-}
-
-void QWindow::show()
-{
- Q_D(QWindow);
-
- if (d->m_userRoot != Q_NULLPTR)
- d->m_userRoot->setParent(d->m_root);
-
- if (d->m_frameGraph == Q_NULLPTR) {
- d->m_frameGraph = new QFrameGraph();
- QForwardRenderer *forwardRenderer = new QForwardRenderer();
- forwardRenderer->setCamera(d->m_defaultCamera);
- d->m_frameGraph->setActiveFrameGraph(forwardRenderer);
- }
-
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(this)));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(this));
- d->m_engine->setData(data);
-
- d->m_root->addComponent(d->m_frameGraph);
- d->m_engine->setRootEntity(d->m_root);
-
- ::QWindow::show();
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/frontend/qwindow.h b/src/render/frontend/qwindow.h
deleted file mode 100644
index 73fceb9de..000000000
--- a/src/render/frontend/qwindow.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QWINDOW_H
-#define QT3DRENDER_QWINDOW_H
-
-#include <QtGui/qwindow.h>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-class QAbstractAspect;
-class QCamera;
-class QEntity;
-}
-
-namespace Qt3DRender {
-
-class QWindowPrivate;
-class QFrameGraph;
-
-class QT3DRENDERSHARED_EXPORT QWindow : public ::QWindow
-{
-public:
- explicit QWindow(::QWindow *parent = Q_NULLPTR);
- ~QWindow();
-
- void setFrameGraph(QFrameGraph *frameGraph);
- QFrameGraph *frameGraph() const;
- Qt3DCore::QCamera *defaultCamera();
-
- void registerAspect(Qt3DCore::QAbstractAspect *aspect);
- void registerAspect(const QString &name);
-
- void setRootEntity(Qt3DCore::QEntity *root);
- void show();
-
-protected:
- QWindow(QWindowPrivate &dd, ::QWindow *parent = Q_NULLPTR);
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QWindow)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QWINDOW_H
diff --git a/src/render/frontend/qwindow_p.h b/src/render/frontend/qwindow_p.h
deleted file mode 100644
index 25f4376a7..000000000
--- a/src/render/frontend/qwindow_p.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QWINDOW_P_H
-#define QT3DRENDER_QWINDOW_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/private/qwindow_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-class QAspectEngine;
-class QCamera;
-class QEntity;
-}
-
-namespace Qt3DRender {
-
-class QWindow;
-class QFrameGraph;
-class QRenderAspect;
-
-class QWindowPrivate : public ::QWindowPrivate
-{
-public:
- QWindowPrivate();
-
- Q_DECLARE_PUBLIC(QWindow)
- Qt3DCore::QEntity *m_root;
- Qt3DCore::QEntity * m_userRoot;
- Qt3DCore::QCamera *m_defaultCamera;
- QFrameGraph *m_frameGraph;
- QScopedPointer<Qt3DCore::QAspectEngine> m_engine;
- QRenderAspect *m_renderAspect;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-
-#endif // QT3DRENDER_QWINDOW_P_H
-
diff --git a/src/render/frontend/render-frontend.pri b/src/render/frontend/render-frontend.pri
index d20f89a56..5f5246518 100644
--- a/src/render/frontend/render-frontend.pri
+++ b/src/render/frontend/render-frontend.pri
@@ -4,17 +4,25 @@ HEADERS += \
$$PWD/qabstractfunctor.h \
$$PWD/qrenderaspect.h \
$$PWD/qrenderaspect_p.h \
- $$PWD/qitemmodelbuffer.h \
+ $$PWD/qitemmodelbuffer_p.h \
$$PWD/qlayer.h \
$$PWD/qlayer_p.h \
- $$PWD/qrenderattachment.h \
- $$PWD/qrenderattachment_p.h \
$$PWD/qrendertarget.h \
$$PWD/qrendertarget_p.h \
- $$PWD/qwindow.h \
- $$PWD/qwindow_p.h \
$$PWD/sphere_p.h \
- $$PWD/qboundingvolumedebug.h
+ $$PWD/qboundingvolumedebug_p.h \
+ $$PWD/qcamera_p.h \
+ $$PWD/qcamera.h \
+ $$PWD/qcameralens.h \
+ $$PWD/qcameralens_p.h \
+ $$PWD/qrendertargetoutput.h \
+ $$PWD/qrendertargetoutput_p.h \
+ $$PWD/qrendersettings.h \
+ $$PWD/qrendersettings_p.h \
+ $$PWD/qpickingsettings.h \
+ $$PWD/qpickingsettings_p.h \
+ $$PWD/qcomputecommand_p.h \
+ $$PWD/qcomputecommand.h
SOURCES += \
$$PWD/qabstractfunctor.cpp \
@@ -22,7 +30,12 @@ SOURCES += \
$$PWD/qitemmodelbuffer.cpp \
$$PWD/sphere.cpp \
$$PWD/qlayer.cpp \
- $$PWD/qrenderattachment.cpp \
$$PWD/qrendertarget.cpp \
- $$PWD/qwindow.cpp \
- $$PWD/qboundingvolumedebug.cpp
+ $$PWD/qboundingvolumedebug.cpp \
+ $$PWD/qcamera.cpp \
+ $$PWD/qcameralens.cpp \
+ $$PWD/qrendersettings.cpp \
+ $$PWD/qpickingsettings.cpp \
+ $$PWD/qrendertargetoutput.cpp \
+ $$PWD/qcomputecommand.cpp
+
diff --git a/src/render/frontend/sphere.cpp b/src/render/frontend/sphere.cpp
index f87be42d3..4ff17ea8e 100644
--- a/src/render/frontend/sphere.cpp
+++ b/src/render/frontend/sphere.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "sphere_p.h"
-#include <Qt3DCore/qray3d.h>
+#include <Qt3DRender/private/qray3d_p.h>
#include <QPair>
@@ -50,7 +53,7 @@ namespace {
// Intersects ray r = p + td, |d| = 1, with sphere s and, if intersecting,
// returns true and intersection point q; false otherwise
-bool intersectRaySphere(const Qt3DCore::QRay3D &ray, const Qt3DRender::Render::Sphere &s, QVector3D *q = Q_NULLPTR)
+bool intersectRaySphere(const Qt3DRender::QRay3D &ray, const Qt3DRender::Render::Sphere &s, QVector3D *q = nullptr)
{
const QVector3D p = ray.origin();
const QVector3D d = ray.direction();
@@ -58,7 +61,7 @@ bool intersectRaySphere(const Qt3DCore::QRay3D &ray, const Qt3DRender::Render::S
const float c = QVector3D::dotProduct(m, m) - s.radius() * s.radius();
// If there is definitely at least one real root, there must be an intersection
- if (q == Q_NULLPTR && c <= 0.0f)
+ if (q == nullptr && c <= 0.0f)
return true;
const float b = QVector3D::dotProduct(m, d);
@@ -72,7 +75,7 @@ bool intersectRaySphere(const Qt3DCore::QRay3D &ray, const Qt3DRender::Render::S
return false;
// If we don't need the intersection point, return early
- if (q == Q_NULLPTR)
+ if (q == nullptr)
return true;
// Ray now found to intersect sphere, compute smallest t value of intersection
@@ -219,7 +222,7 @@ Qt3DCore::QNodeId Sphere::id() const
return m_id;
}
-bool Sphere::intersects(const Qt3DCore::QRay3D &ray, QVector3D *q) const
+bool Sphere::intersects(const QRay3D &ray, QVector3D *q) const
{
return intersectRaySphere(ray, *this, q);
}
diff --git a/src/render/frontend/sphere_p.h b/src/render/frontend/sphere_p.h
index 37a30ce74..de93faa05 100644
--- a/src/render/frontend/sphere_p.h
+++ b/src/render/frontend/sphere_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -64,13 +67,13 @@ namespace Render {
class QT3DRENDERSHARED_PRIVATE_EXPORT Sphere : public QBoundingSphere
{
public:
- inline Sphere(const Qt3DCore::QNodeId &i = Qt3DCore::QNodeId())
+ inline Sphere(Qt3DCore::QNodeId i = Qt3DCore::QNodeId())
: m_center()
, m_radius(0.0f)
, m_id(i)
{}
- inline Sphere(const QVector3D &c, float r, const Qt3DCore::QNodeId &i = Qt3DCore::QNodeId())
+ inline Sphere(const QVector3D &c, float r, Qt3DCore::QNodeId i = Qt3DCore::QNodeId())
: m_center(c)
, m_radius(r)
, m_id(i)
@@ -89,7 +92,7 @@ public:
void expandToContain(const QVector3D &point);
inline void expandToContain(const QVector<QVector3D> &points)
{
- Q_FOREACH (const QVector3D &p, points)
+ for (const QVector3D &p : points)
expandToContain(p);
}
@@ -103,7 +106,7 @@ public:
}
Qt3DCore::QNodeId id() const Q_DECL_FINAL;
- bool intersects(const Qt3DCore::QRay3D &ray, QVector3D *q) const Q_DECL_FINAL;
+ bool intersects(const QRay3D &ray, QVector3D *q) const Q_DECL_FINAL;
Type type() const Q_DECL_FINAL;
static Sphere fromPoints(const QVector<QVector3D> &points);
diff --git a/src/render/geometry/attribute.cpp b/src/render/geometry/attribute.cpp
index fa7cfa444..85c69cdb7 100644
--- a/src/render/geometry/attribute.cpp
+++ b/src/render/geometry/attribute.cpp
@@ -1,42 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "attribute_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/private/qattribute_p.h>
+#include <Qt3DRender/private/stringtoint_p.h>
QT_BEGIN_NAMESPACE
@@ -46,14 +51,15 @@ namespace Qt3DRender {
namespace Render {
Attribute::Attribute()
- : QBackendNode(ReadOnly)
- , m_dataType(QAbstractAttribute::Float)
- , m_dataSize(1)
+ : BackendNode(ReadOnly)
+ , m_nameId(0)
+ , m_vertexDataType(QAttribute::Float)
+ , m_vertexSize(1)
, m_count(0)
, m_byteStride(0)
, m_byteOffset(0)
, m_divisor(0)
- , m_attributeType(QAbstractAttribute::VertexAttribute)
+ , m_attributeType(QAttribute::VertexAttribute)
, m_attributeDirty(false)
{
}
@@ -64,52 +70,52 @@ Attribute::~Attribute()
void Attribute::cleanup()
{
- m_dataType = QAbstractAttribute::Float;
- m_dataSize = 1;
+ m_vertexDataType = QAttribute::Float;
+ m_vertexSize = 1;
m_count = 0;
m_byteStride = 0;
m_byteOffset = 0;
m_divisor = 0;
- m_attributeType = QAbstractAttribute::VertexAttribute;
+ m_attributeType = QAttribute::VertexAttribute;
m_bufferId = Qt3DCore::QNodeId();
m_name.clear();
m_attributeDirty = false;
+ m_nameId = 0;
}
-void Attribute::updateFromPeer(Qt3DCore::QNode *peer)
+void Attribute::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QAttribute *attribute = static_cast<QAttribute *>(peer);
- if (attribute) {
- m_dataType = attribute->dataType();
- m_dataSize = attribute->dataSize();
- m_count = attribute->count();
- m_byteOffset = attribute->byteOffset();
- m_byteStride = attribute->byteStride();
- m_divisor = attribute->divisor();
- m_attributeType = attribute->attributeType();
- m_name = attribute->name();
- if (attribute->buffer())
- m_bufferId = attribute->buffer()->id();
- m_attributeDirty = true;
- }
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAttributeData>>(change);
+ const auto &data = typedChange->data;
+ m_bufferId = data.bufferId;
+ m_name = data.name;
+ m_nameId = StringToInt::lookupId(m_name);
+ m_vertexDataType = data.dataType;
+ m_vertexSize = data.dataSize;
+ m_count = data.count;
+ m_byteStride = data.byteStride;
+ m_byteOffset = data.byteOffset;
+ m_divisor = data.divisor;
+ m_attributeType = data.attributeType;
+ m_attributeDirty = true;
}
void Attribute::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- QByteArray propertyName = propertyChange->propertyName();
-
switch (e->type()) {
+ case PropertyUpdated: {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ QByteArray propertyName = propertyChange->propertyName();
- case NodeUpdated: {
if (propertyName == QByteArrayLiteral("name")) {
m_name = propertyChange->value().value<QString>();
+ m_nameId = StringToInt::lookupId(m_name);
m_attributeDirty = true;
- } else if (propertyName == QByteArrayLiteral("dataType")) {
- m_dataType = static_cast<QAbstractAttribute::DataType>(propertyChange->value().value<int>());
+ } else if (propertyName == QByteArrayLiteral("vertexBaseType")) {
+ m_vertexDataType = static_cast<QAttribute::VertexBaseType>(propertyChange->value().value<int>());
m_attributeDirty = true;
- } else if (propertyName == QByteArrayLiteral("dataSize")) {
- m_dataSize = propertyChange->value().value<uint>();
+ } else if (propertyName == QByteArrayLiteral("vertexSize")) {
+ m_vertexSize = propertyChange->value().value<uint>();
m_attributeDirty = true;
} else if (propertyName == QByteArrayLiteral("count")) {
m_count = propertyChange->value().value<uint>();
@@ -124,18 +130,20 @@ void Attribute::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_divisor = propertyChange->value().value<uint>();
m_attributeDirty = true;
} else if (propertyName == QByteArrayLiteral("attributeType")) {
- m_attributeType = static_cast<QAbstractAttribute::AttributeType>(propertyChange->value().value<int>());
+ m_attributeType = static_cast<QAttribute::AttributeType>(propertyChange->value().value<int>());
m_attributeDirty = true;
} else if (propertyName == QByteArrayLiteral("buffer")) {
m_bufferId = propertyChange->value().value<QNodeId>();
m_attributeDirty = true;
}
+ markDirty(AbstractRenderer::AllDirty);
break;
}
default:
break;
}
+ BackendNode::sceneChangeEvent(e);
}
void Attribute::unsetDirty()
diff --git a/src/render/geometry/attribute_p.h b/src/render/geometry/attribute_p.h
index 2320e97b0..6364639dd 100644
--- a/src/render/geometry/attribute_p.h
+++ b/src/render/geometry/attribute_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/qattribute.h>
QT_BEGIN_NAMESPACE
@@ -57,7 +60,7 @@ namespace Qt3DRender {
namespace Render {
-class Q_AUTOTEST_EXPORT Attribute : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT Attribute : public BackendNode
{
public:
Attribute();
@@ -65,31 +68,34 @@ public:
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
inline Qt3DCore::QNodeId bufferId() const { return m_bufferId; }
inline QString name() const { return m_name; }
- inline QAbstractAttribute::DataType dataType() const { return m_dataType; }
- inline uint dataSize() const { return m_dataSize; }
+ inline int nameId() const { return m_nameId; }
+ inline QAttribute::VertexBaseType vertexBaseType() const { return m_vertexDataType; }
+ inline uint vertexSize() const { return m_vertexSize; }
inline uint count() const { return m_count; }
inline uint byteStride() const { return m_byteStride; }
inline uint byteOffset() const { return m_byteOffset; }
inline uint divisor() const { return m_divisor; }
- inline QAbstractAttribute::AttributeType attributeType() const { return m_attributeType; }
+ inline QAttribute::AttributeType attributeType() const { return m_attributeType; }
inline bool isDirty() const { return m_attributeDirty; }
void unsetDirty();
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
Qt3DCore::QNodeId m_bufferId;
QString m_name;
- QAbstractAttribute::DataType m_dataType;
- uint m_dataSize;
+ int m_nameId;
+ QAttribute::VertexBaseType m_vertexDataType;
+ uint m_vertexSize;
uint m_count;
uint m_byteStride;
uint m_byteOffset;
uint m_divisor;
- QAbstractAttribute::AttributeType m_attributeType;
+ QAttribute::AttributeType m_attributeType;
bool m_attributeDirty;
};
diff --git a/src/render/geometry/buffer.cpp b/src/render/geometry/buffer.cpp
index 9a8e824a5..a41d7bb94 100644
--- a/src/render/geometry/buffer.cpp
+++ b/src/render/geometry/buffer.cpp
@@ -1,43 +1,46 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "buffer_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/private/buffermanager_p.h>
+#include <Qt3DRender/private/qbuffer_p.h>
QT_BEGIN_NAMESPACE
@@ -47,12 +50,12 @@ namespace Qt3DRender {
namespace Render {
Buffer::Buffer()
- : QBackendNode(QBackendNode::ReadWrite)
+ : BackendNode(QBackendNode::ReadWrite)
, m_type(QBuffer::VertexBuffer)
, m_usage(QBuffer::StaticDraw)
, m_bufferDirty(false)
- , m_sync(false)
- , m_manager(Q_NULLPTR)
+ , m_syncData(false)
+ , m_manager(nullptr)
{
// Maybe it could become read write if we want to inform
// the frontend QBuffer node of any backend issue
@@ -69,7 +72,7 @@ void Buffer::cleanup()
m_data.clear();
m_functor.reset();
m_bufferDirty = false;
- m_sync = false;
+ m_syncData = false;
}
@@ -82,36 +85,36 @@ void Buffer::executeFunctor()
{
Q_ASSERT(m_functor);
m_data = (*m_functor)();
- if (m_sync) {
+ if (m_syncData) {
// Send data back to the frontend
- QBackendScenePropertyChangePtr e(new QBackendScenePropertyChange(NodeUpdated, peerUuid()));
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("data");
- e->setTargetNode(peerUuid());
e->setValue(QVariant::fromValue(m_data));
notifyObservers(e);
}
}
-void Buffer::updateFromPeer(Qt3DCore::QNode *peer)
+void Buffer::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QBuffer *buffer = static_cast<QBuffer *>(peer);
- if (buffer != Q_NULLPTR) {
- m_type = buffer->type();
- m_usage = buffer->usage();
- m_data = buffer->data();
- m_functor = buffer->bufferFunctor();
- // Add to dirty list in the manager
- if (m_functor && m_manager != Q_NULLPTR)
- m_manager->addDirtyBuffer(peerUuid());
- m_bufferDirty = true;
- m_sync = buffer->isSync();
- }
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QBufferData>>(change);
+ const auto &data = typedChange->data;
+ m_data = data.data;
+ m_type = data.type;
+ m_usage = data.usage;
+ m_syncData = data.syncData;
+ m_bufferDirty = true;
+
+ m_functor = data.functor;
+ Q_ASSERT(m_manager);
+ if (m_functor)
+ m_manager->addDirtyBuffer(peerId());
}
void Buffer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
QByteArray propertyName = propertyChange->propertyName();
if (propertyName == QByteArrayLiteral("data")) {
QByteArray newData = propertyChange->value().value<QByteArray>();
@@ -123,16 +126,18 @@ void Buffer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
} else if (propertyName == QByteArrayLiteral("usage")) {
m_usage = static_cast<QBuffer::UsageType>(propertyChange->value().value<int>());
m_bufferDirty = true;
- } else if (propertyName == QByteArrayLiteral("bufferFunctor")) {
- QBufferFunctorPtr newFunctor = propertyChange->value().value<QBufferFunctorPtr>();
- m_bufferDirty |= !(newFunctor && m_functor && *newFunctor == *m_functor);
- m_functor = newFunctor;
- if (m_functor && m_manager != Q_NULLPTR)
- m_manager->addDirtyBuffer(peerUuid());
- } else if (propertyName == QByteArrayLiteral("sync")) {
- m_sync = propertyChange->value().toBool();
+ } else if (propertyName == QByteArrayLiteral("dataGenerator")) {
+ QBufferDataGeneratorPtr newGenerator = propertyChange->value().value<QBufferDataGeneratorPtr>();
+ m_bufferDirty |= !(newGenerator && m_functor && *newGenerator == *m_functor);
+ m_functor = newGenerator;
+ if (m_functor && m_manager != nullptr)
+ m_manager->addDirtyBuffer(peerId());
+ } else if (propertyName == QByteArrayLiteral("syncData")) {
+ m_syncData = propertyChange->value().toBool();
}
+ markDirty(AbstractRenderer::AllDirty);
}
+ BackendNode::sceneChangeEvent(e);
}
// Called by Renderer once the buffer has been uploaded to OpenGL
@@ -141,26 +146,26 @@ void Buffer::unsetDirty()
m_bufferDirty = false;
}
-BufferFunctor::BufferFunctor(BufferManager *manager)
+BufferFunctor::BufferFunctor(AbstractRenderer *renderer, BufferManager *manager)
: m_manager(manager)
+ , m_renderer(renderer)
{
}
-Qt3DCore::QBackendNode *BufferFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *BufferFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- Buffer *buffer = m_manager->getOrCreateResource(frontend->id());
- buffer->setFactory(factory);
+ Buffer *buffer = m_manager->getOrCreateResource(change->subjectId());
buffer->setManager(m_manager);
- buffer->setPeer(frontend);
+ buffer->setRenderer(m_renderer);
return buffer;
}
-Qt3DCore::QBackendNode *BufferFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *BufferFunctor::get(Qt3DCore::QNodeId id) const
{
return m_manager->lookupResource(id);
}
-void BufferFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void BufferFunctor::destroy(Qt3DCore::QNodeId id) const
{
return m_manager->releaseResource(id);
}
diff --git a/src/render/geometry/buffer_p.h b/src/render/geometry/buffer_p.h
index 2aad578ea..d6bfe1d8f 100644
--- a/src/render/geometry/buffer_p.h
+++ b/src/render/geometry/buffer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,9 +51,9 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
QT_BEGIN_NAMESPACE
@@ -60,14 +63,13 @@ namespace Render {
class BufferManager;
-class Q_AUTOTEST_EXPORT Buffer : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT Buffer : public BackendNode
{
public:
Buffer();
~Buffer();
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
void setManager(BufferManager *manager);
@@ -77,29 +79,32 @@ public:
inline QBuffer::UsageType usage() const { return m_usage; }
inline QByteArray data() const { return m_data; }
inline bool isDirty() const { return m_bufferDirty; }
- inline QBufferFunctorPtr bufferFunctor() const { return m_functor; }
- inline bool isSync() const { return m_sync; }
+ inline QBufferDataGeneratorPtr dataGenerator() const { return m_functor; }
+ inline bool isSyncData() const { return m_syncData; }
void unsetDirty();
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QBuffer::BufferType m_type;
QBuffer::UsageType m_usage;
QByteArray m_data;
bool m_bufferDirty;
- bool m_sync;
- QBufferFunctorPtr m_functor;
+ bool m_syncData;
+ QBufferDataGeneratorPtr m_functor;
BufferManager *m_manager;
};
-class BufferFunctor : public Qt3DCore::QBackendNodeFunctor
+class BufferFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit BufferFunctor(BufferManager *manager);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
+ explicit BufferFunctor(AbstractRenderer *renderer, BufferManager *manager);
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
private:
BufferManager *m_manager;
+ AbstractRenderer *m_renderer;
};
} // namespace Render
diff --git a/src/render/geometry/buffermanager.cpp b/src/render/geometry/buffermanager.cpp
index fbbee4b23..af9c83198 100644
--- a/src/render/geometry/buffermanager.cpp
+++ b/src/render/geometry/buffermanager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,7 +52,7 @@ BufferManager::~BufferManager()
{
}
-void BufferManager::addDirtyBuffer(const Qt3DCore::QNodeId &bufferId)
+void BufferManager::addDirtyBuffer(Qt3DCore::QNodeId bufferId)
{
if (!m_dirtyBuffers.contains(bufferId))
m_dirtyBuffers.push_back(bufferId);
diff --git a/src/render/geometry/buffermanager_p.h b/src/render/geometry/buffermanager_p.h
index 52b8c0ffd..bfa0ac6bc 100644
--- a/src/render/geometry/buffermanager_p.h
+++ b/src/render/geometry/buffermanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,7 +60,7 @@ namespace Qt3DRender {
namespace Render {
-class BufferManager : public Qt3DCore::QResourceManager<
+class Q_AUTOTEST_EXPORT BufferManager : public Qt3DCore::QResourceManager<
Buffer,
Qt3DCore::QNodeId,
16,
@@ -69,7 +72,7 @@ public:
~BufferManager();
// Aspect Thread
- void addDirtyBuffer(const Qt3DCore::QNodeId &bufferId);
+ void addDirtyBuffer(Qt3DCore::QNodeId bufferId);
QVector<Qt3DCore::QNodeId> dirtyBuffers();
private:
diff --git a/src/render/geometry/geometry.cpp b/src/render/geometry/geometry.cpp
index 02f7b0582..2eebb8222 100644
--- a/src/render/geometry/geometry.cpp
+++ b/src/render/geometry/geometry.cpp
@@ -1,44 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "geometry_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qabstractattribute.h>
+#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qgeometry.h>
-#include <Qt3DRender/qboundingvolumespecifier.h>
+#include <Qt3DRender/private/qgeometry_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -48,8 +53,7 @@ namespace Qt3DRender {
namespace Render {
Geometry::Geometry()
- : QBackendNode(ReadOnly)
- , m_verticesPerPatch(0)
+ : BackendNode(ReadOnly)
, m_geometryDirty(false)
{
}
@@ -60,63 +64,56 @@ Geometry::~Geometry()
void Geometry::cleanup()
{
- m_verticesPerPatch = 0;
+ QBackendNode::setEnabled(false);
m_attributes.clear();
m_geometryDirty = false;
m_boundingPositionAttribute = Qt3DCore::QNodeId();
}
-void Geometry::updateFromPeer(Qt3DCore::QNode *peer)
+void Geometry::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QGeometry *geometry = static_cast<QGeometry *>(peer);
- if (geometry != Q_NULLPTR) {
- m_attributes.reserve(geometry->attributes().size());
- Q_FOREACH (QAbstractAttribute *attribute, geometry->attributes())
- m_attributes.push_back(attribute->id());
- m_verticesPerPatch = geometry->verticesPerPatch();
- m_geometryDirty = true;
- if (geometry->boundingVolumeSpecifier()->positionAttribute() != Q_NULLPTR)
- m_boundingPositionAttribute = geometry->boundingVolumeSpecifier()->positionAttribute()->id();
- }
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QGeometryData>>(change);
+ const auto &data = typedChange->data;
+ m_attributes = data.attributeIds;
+ m_boundingPositionAttribute = data.boundingVolumePositionAttributeId;
+ m_geometryDirty = true;
}
void Geometry::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- QByteArray propertyName = propertyChange->propertyName();
-
switch (e->type()) {
- case NodeAdded: {
- if (propertyName == QByteArrayLiteral("attribute")) {
- m_attributes.push_back(propertyChange->value().value<QNodeId>());
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("attribute")) {
+ m_attributes.push_back(change->addedNodeId());
m_geometryDirty = true;
}
break;
}
- case NodeRemoved: {
- if (propertyName == QByteArrayLiteral("attribute")) {
- m_attributes.removeOne(propertyChange->value().value<QNodeId>());
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("attribute")) {
+ m_attributes.removeOne(change->removedNodeId());
m_geometryDirty = true;
}
break;
}
- case NodeUpdated:
- if (propertyName == QByteArrayLiteral("verticesPerPatch")) {
- m_verticesPerPatch = propertyChange->value().value<int>();
- break;
-
- // Note: doesn't set dirtyness as this parameter changing doesn't need
- // a new VAO update.
- } else if (propertyName == QByteArrayLiteral("boundingVolumeSpecifierPositionAttribute")) {
- m_boundingPositionAttribute = propertyChange->value().value<Qt3DCore::QNodeId>();
+ case PropertyUpdated: {
+ // Note: doesn't set dirtyness as this parameter changing doesn't need a new VAO update.
+ const auto change = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("boundingVolumePositionAttribute")) {
+ m_boundingPositionAttribute = change->value().value<QNodeId>();
break;
}
+ }
default:
break;
}
+ markDirty(AbstractRenderer::AllDirty);
+ BackendNode::sceneChangeEvent(e);
}
void Geometry::unsetDirty()
diff --git a/src/render/geometry/geometry.pri b/src/render/geometry/geometry.pri
index acc53474f..742cc1fef 100644
--- a/src/render/geometry/geometry.pri
+++ b/src/render/geometry/geometry.pri
@@ -7,38 +7,18 @@ HEADERS += \
$$PWD/geometry_p.h \
$$PWD/geometryrenderer_p.h \
$$PWD/geometryrenderermanager_p.h \
- $$PWD/qabstractattribute.h \
- $$PWD/qabstractattribute_p.h \
- $$PWD/qabstractbuffer.h \
- $$PWD/qabstractbuffer_p.h \
- $$PWD/qattribute.h \
- $$PWD/qattribute_p.h \
$$PWD/qbuffer.h \
$$PWD/qbuffer_p.h \
- $$PWD/qbufferfunctor.h \
- $$PWD/qcuboidmesh.h \
- $$PWD/qcylindergeometry.h \
- $$PWD/qcylindergeometry_p.h \
- $$PWD/qcylindermesh.h \
$$PWD/qgeometry.h \
$$PWD/qgeometry_p.h \
- $$PWD/qgeometryfunctor.h \
+ $$PWD/qgeometryfactory.h \
$$PWD/qgeometryrenderer.h \
$$PWD/qgeometryrenderer_p.h \
$$PWD/qmesh.h \
$$PWD/qmesh_p.h \
- $$PWD/qplanemesh.h \
- $$PWD/qspheremesh.h \
- $$PWD/qtorusmesh.h \
- $$PWD/qtorusgeometry.h \
- $$PWD/qtorusgeometry_p.h \
- $$PWD/qspheregeometry.h \
- $$PWD/qspheregeometry_p.h \
- $$PWD/qcuboidgeometry.h \
- $$PWD/qcuboidgeometry_p.h \
- $$PWD/qplanegeometry.h \
- $$PWD/qplanegeometry_p.h \
- $$PWD/qboundingvolumespecifier.h
+ $$PWD/qattribute_p.h \
+ $$PWD/qattribute.h \
+ $$PWD/qbufferdatagenerator.h
SOURCES += \
$$PWD/attribute.cpp \
@@ -47,22 +27,9 @@ SOURCES += \
$$PWD/geometry.cpp \
$$PWD/geometryrenderer.cpp \
$$PWD/geometryrenderermanager.cpp \
- $$PWD/qabstractattribute.cpp \
- $$PWD/qabstractbuffer.cpp \
- $$PWD/qattribute.cpp \
$$PWD/qbuffer.cpp \
- $$PWD/qcuboidmesh.cpp \
- $$PWD/qcylindergeometry.cpp \
- $$PWD/qcylindermesh.cpp \
$$PWD/qgeometry.cpp \
$$PWD/qgeometryrenderer.cpp \
$$PWD/qmesh.cpp \
- $$PWD/qplanemesh.cpp \
- $$PWD/qspheremesh.cpp \
- $$PWD/qtorusmesh.cpp \
- $$PWD/qtorusgeometry.cpp \
- $$PWD/qspheregeometry.cpp \
- $$PWD/qcuboidgeometry.cpp \
- $$PWD/qplanegeometry.cpp \
- $$PWD/qboundingvolumespecifier.cpp
+ $$PWD/qattribute.cpp
diff --git a/src/render/geometry/geometry_p.h b/src/render/geometry/geometry_p.h
index c27f1f262..41d54cb54 100644
--- a/src/render/geometry/geometry_p.h
+++ b/src/render/geometry/geometry_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRender/private/backendnode_p.h>
QT_BEGIN_NAMESPACE
@@ -57,7 +60,7 @@ namespace Qt3DRender {
namespace Render {
-class Q_AUTOTEST_EXPORT Geometry : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT Geometry : public BackendNode
{
public:
Geometry();
@@ -65,18 +68,17 @@ public:
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
inline QVector<Qt3DCore::QNodeId> attributes() const { return m_attributes; }
inline bool isDirty() const { return m_geometryDirty; }
- inline int verticesPerPatch() const { return m_verticesPerPatch; }
inline Qt3DCore::QNodeId boundingPositionAttribute() const { return m_boundingPositionAttribute; }
void unsetDirty();
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QVector<Qt3DCore::QNodeId> m_attributes;
- int m_verticesPerPatch;
bool m_geometryDirty;
Qt3DCore::QNodeId m_boundingPositionAttribute;
};
diff --git a/src/render/geometry/geometryrenderer.cpp b/src/render/geometry/geometryrenderer.cpp
index bbe30e5fe..25cf43642 100644
--- a/src/render/geometry/geometryrenderer.cpp
+++ b/src/render/geometry/geometryrenderer.cpp
@@ -1,45 +1,54 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "geometryrenderer_p.h"
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
#include <Qt3DRender/private/geometryrenderermanager_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
#include <Qt3DRender/private/qboundingvolume_p.h>
+#include <Qt3DRender/private/qgeometryrenderer_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qtypedpropertyupdatechange_p.h>
+#include <QtCore/qcoreapplication.h>
+
+#include <memory>
QT_BEGIN_NAMESPACE
@@ -49,17 +58,18 @@ namespace Qt3DRender {
namespace Render {
GeometryRenderer::GeometryRenderer()
- : QBackendNode(ReadWrite)
+ : BackendNode(ReadWrite)
, m_instanceCount(0)
- , m_primitiveCount(0)
- , m_baseVertex(0)
- , m_baseInstance(0)
- , m_restartIndex(-1)
- , m_primitiveRestart(false)
+ , m_vertexCount(0)
+ , m_indexOffset(0)
+ , m_firstInstance(0)
+ , m_firstVertex(0)
+ , m_restartIndexValue(-1)
+ , m_verticesPerPatch(0)
+ , m_primitiveRestartEnabled(false)
, m_primitiveType(QGeometryRenderer::Triangles)
, m_dirty(false)
- , m_enabled(true)
- , m_manager(Q_NULLPTR)
+ , m_manager(nullptr)
{
}
@@ -69,17 +79,19 @@ GeometryRenderer::~GeometryRenderer()
void GeometryRenderer::cleanup()
{
+ BackendNode::setEnabled(false);
m_instanceCount = 0;
- m_primitiveCount = 0;
- m_baseVertex = 0;
- m_baseInstance = 0;
- m_restartIndex = -1;
- m_primitiveRestart = false;
+ m_vertexCount = 0;
+ m_indexOffset = 0;
+ m_firstInstance = 0;
+ m_firstVertex = 0;
+ m_restartIndexValue = -1;
+ m_verticesPerPatch = 0;
+ m_primitiveRestartEnabled = false;
m_primitiveType = QGeometryRenderer::Triangles;
m_geometryId = Qt3DCore::QNodeId();
m_dirty = false;
- m_enabled = true;
- m_functor.reset();
+ m_geometryFactory.reset();
qDeleteAll(m_triangleVolumes);
m_triangleVolumes.clear();
}
@@ -89,78 +101,85 @@ void GeometryRenderer::setManager(GeometryRendererManager *manager)
m_manager = manager;
}
-void GeometryRenderer::updateFromPeer(Qt3DCore::QNode *peer)
+void GeometryRenderer::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QGeometryRenderer *geometryRenderer = static_cast<QGeometryRenderer *>(peer);
- if (geometryRenderer) {
- m_instanceCount = geometryRenderer->instanceCount();
- m_primitiveCount = geometryRenderer->primitiveCount();
- m_baseVertex = geometryRenderer->baseVertex();
- m_baseInstance = geometryRenderer->baseInstance();
- m_restartIndex = geometryRenderer->restartIndex();
- m_primitiveRestart = geometryRenderer->primitiveRestart();
- m_primitiveType = geometryRenderer->primitiveType();
- m_enabled = geometryRenderer->isEnabled();
- if (geometryRenderer->geometry() != Q_NULLPTR)
- m_geometryId = geometryRenderer->geometry()->id();
- m_functor = geometryRenderer->geometryFunctor();
- if (m_functor && m_manager != Q_NULLPTR)
- m_manager->addDirtyGeometryRenderer(peerUuid());
- m_dirty = true;
- }
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QGeometryRendererData>>(change);
+ const auto &data = typedChange->data;
+ m_geometryId = data.geometryId;
+ m_instanceCount = data.instanceCount;
+ m_vertexCount = data.vertexCount;
+ m_indexOffset = data.indexOffset;
+ m_firstInstance = data.firstInstance;
+ m_firstVertex = data.firstVertex;
+ m_restartIndexValue = data.restartIndexValue;
+ m_verticesPerPatch = data.verticesPerPatch;
+ m_primitiveRestartEnabled = data.primitiveRestart;
+ m_primitiveType = data.primitiveType;
+
+ Q_ASSERT(m_manager);
+ m_geometryFactory = data.geometryFactory;
+ if (m_geometryFactory)
+ m_manager->addDirtyGeometryRenderer(peerId());
+
+ m_dirty = true;
}
void GeometryRenderer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- QByteArray propertyName = propertyChange->propertyName();
-
switch (e->type()) {
+ case PropertyUpdated: {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ QByteArray propertyName = propertyChange->propertyName();
- case NodeUpdated: {
if (propertyName == QByteArrayLiteral("instanceCount")) {
m_instanceCount = propertyChange->value().value<int>();
m_dirty = true;
- } else if (propertyName == QByteArrayLiteral("primitiveCount")) {
- m_primitiveCount = propertyChange->value().value<int>();
+ } else if (propertyName == QByteArrayLiteral("vertexCount")) {
+ m_vertexCount = propertyChange->value().value<int>();
m_dirty = true;
- } else if (propertyName == QByteArrayLiteral("baseVertex")) {
- m_baseVertex = propertyChange->value().value<int>();
+ } else if (propertyName == QByteArrayLiteral("indexOffset")) {
+ m_indexOffset = propertyChange->value().value<int>();
m_dirty = true;
- } else if (propertyName == QByteArrayLiteral("baseInstance")) {
- m_baseInstance = propertyChange->value().value<int>();
+ } else if (propertyName == QByteArrayLiteral("firstInstance")) {
+ m_firstInstance = propertyChange->value().value<int>();
m_dirty = true;
- } else if (propertyName == QByteArrayLiteral("restartIndex")) {
- m_restartIndex = propertyChange->value().value<int>();
+ } else if (propertyName == QByteArrayLiteral("firstVertex")) {
+ m_firstVertex = propertyChange->value().value<int>();
m_dirty = true;
- } else if (propertyName == QByteArrayLiteral("primitiveRestart")) {
- m_primitiveRestart = propertyChange->value().value<bool>();
+ } else if (propertyName == QByteArrayLiteral("restartIndexValue")) {
+ m_restartIndexValue = propertyChange->value().value<int>();
+ m_dirty = true;
+ } else if (propertyName == QByteArrayLiteral("verticesPerPatch")) {
+ m_verticesPerPatch = propertyChange->value().value<int>();
+ m_dirty = true;
+ } else if (propertyName == QByteArrayLiteral("primitiveRestartEnabled")) {
+ m_primitiveRestartEnabled = propertyChange->value().value<bool>();
m_dirty = true;
- } else if (propertyName == QByteArrayLiteral("enabled")) {
- m_enabled = propertyChange->value().value<bool>();
} else if (propertyName == QByteArrayLiteral("primitiveType")) {
m_primitiveType = static_cast<QGeometryRenderer::PrimitiveType>(propertyChange->value().value<int>());
m_dirty = true;
- } else if (propertyName == QByteArrayLiteral("geometryFunctor")) {
- QGeometryFunctorPtr newFunctor = propertyChange->value().value<QGeometryFunctorPtr>();
- m_dirty |= !(newFunctor && m_functor && *newFunctor == *m_functor);
- m_functor = newFunctor;
- if (m_functor && m_manager != Q_NULLPTR)
- m_manager->addDirtyGeometryRenderer(peerUuid());
+ } else if (propertyName == QByteArrayLiteral("geometryFactory")) {
+ QGeometryFactoryPtr newFunctor = propertyChange->value().value<QGeometryFactoryPtr>();
+ m_dirty |= !(newFunctor && m_geometryFactory && *newFunctor == *m_geometryFactory);
+ m_geometryFactory = newFunctor;
+ if (m_geometryFactory && m_manager != nullptr)
+ m_manager->addDirtyGeometryRenderer(peerId());
}
break;
}
- case NodeAdded: {
- if (propertyName == QByteArrayLiteral("geometry")) {
- m_geometryId = propertyChange->value().value<QNodeId>();
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("geometry")) {
+ m_geometryId = change->addedNodeId();
m_dirty = true;
}
break;
}
- case NodeRemoved: {
- if (propertyName == QByteArrayLiteral("geometry")) {
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("geometry")) {
m_geometryId = QNodeId();
m_dirty = true;
}
@@ -171,22 +190,32 @@ void GeometryRenderer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
break;
}
+ markDirty(AbstractRenderer::AllDirty);
+
+ BackendNode::sceneChangeEvent(e);
+
// Add to dirty list in manager
}
void GeometryRenderer::executeFunctor()
{
- Q_ASSERT(m_functor);
- QGeometry *geometry = (*m_functor)();
+ Q_ASSERT(m_geometryFactory);
+ std::unique_ptr<QGeometry> geometry((*m_geometryFactory)());
+ if (!geometry)
+ return;
+
+ // Move the QGeometry object to the main thread and notify the
+ // corresponding QGeometryRenderer
+ const auto appThread = QCoreApplication::instance()->thread();
+ geometry->moveToThread(appThread);
- QBackendScenePropertyChangePtr e(new QBackendScenePropertyChange(NodeUpdated, peerUuid()));
+ auto e = QGeometryChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("geometry");
- // The Frontend element has to perform the clone
- // So that the objects are created in the main thread
- e->setValue(QVariant::fromValue(QNodePtr(geometry, &QNodePrivate::nodePtrDeleter)));
- e->setTargetNode(peerUuid());
+ e->data = std::move(geometry);
notifyObservers(e);
- // Maybe we could also send a status to help troubleshoot errors
+
+ // TODO: Maybe we could also send a status to help troubleshoot errors
}
void GeometryRenderer::unsetDirty()
@@ -206,26 +235,26 @@ QVector<QBoundingVolume *> GeometryRenderer::triangleData() const
return m_triangleVolumes;
}
-GeometryRendererFunctor::GeometryRendererFunctor(GeometryRendererManager *manager)
+GeometryRendererFunctor::GeometryRendererFunctor(AbstractRenderer *renderer, GeometryRendererManager *manager)
: m_manager(manager)
+ , m_renderer(renderer)
{
}
-Qt3DCore::QBackendNode *GeometryRendererFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *GeometryRendererFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- GeometryRenderer *geometryRenderer = m_manager->getOrCreateResource(frontend->id());
- geometryRenderer->setFactory(factory);
+ GeometryRenderer *geometryRenderer = m_manager->getOrCreateResource(change->subjectId());
geometryRenderer->setManager(m_manager);
- geometryRenderer->setPeer(frontend);
+ geometryRenderer->setRenderer(m_renderer);
return geometryRenderer;
}
-Qt3DCore::QBackendNode *GeometryRendererFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *GeometryRendererFunctor::get(Qt3DCore::QNodeId id) const
{
return m_manager->lookupResource(id);
}
-void GeometryRendererFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void GeometryRendererFunctor::destroy(Qt3DCore::QNodeId id) const
{
return m_manager->releaseResource(id);
}
diff --git a/src/render/geometry/geometryrenderer_p.h b/src/render/geometry/geometryrenderer_p.h
index 8e68ab1f8..3399e6f70 100644
--- a/src/render/geometry/geometryrenderer_p.h
+++ b/src/render/geometry/geometryrenderer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,9 +51,9 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/qgeometryrenderer.h>
-#include <Qt3DRender/qgeometryfunctor.h>
+#include <Qt3DRender/qgeometryfactory.h>
QT_BEGIN_NAMESPACE
@@ -62,7 +65,7 @@ namespace Render {
class GeometryRendererManager;
-class Q_AUTOTEST_EXPORT GeometryRenderer : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT GeometryRenderer : public BackendNode
{
public:
GeometryRenderer();
@@ -70,21 +73,21 @@ public:
void cleanup();
void setManager(GeometryRendererManager *manager);
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
void executeFunctor();
inline Qt3DCore::QNodeId geometryId() const { return m_geometryId; }
inline int instanceCount() const { return m_instanceCount; }
- inline int primitiveCount() const { return m_primitiveCount; }
- inline int baseVertex() const { return m_baseVertex; }
- inline int baseInstance() const { return m_baseInstance; }
- inline int restartIndex() const { return m_restartIndex; }
- inline bool primitiveRestart() const { return m_primitiveRestart; }
+ inline int vertexCount() const { return m_vertexCount; }
+ inline int indexOffset() const { return m_indexOffset; }
+ inline int firstInstance() const { return m_firstInstance; }
+ inline int firstVertex() const { return m_firstVertex; }
+ inline int restartIndexValue() const { return m_restartIndexValue; }
+ inline int verticesPerPatch() const { return m_verticesPerPatch; }
+ inline bool primitiveRestartEnabled() const { return m_primitiveRestartEnabled; }
inline QGeometryRenderer::PrimitiveType primitiveType() const { return m_primitiveType; }
inline bool isDirty() const { return m_dirty; }
- inline bool isEnabled() const { return m_enabled; }
- inline QGeometryFunctorPtr geometryFunctor() const { return m_functor; }
+ inline QGeometryFactoryPtr geometryFactory() const { return m_geometryFactory; }
void unsetDirty();
// Build triangle data Job thread
@@ -93,30 +96,34 @@ public:
QVector<QBoundingVolume *> triangleData() const;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
Qt3DCore::QNodeId m_geometryId;
int m_instanceCount;
- int m_primitiveCount;
- int m_baseVertex;
- int m_baseInstance;
- int m_restartIndex;
- bool m_primitiveRestart;
+ int m_vertexCount;
+ int m_indexOffset;
+ int m_firstInstance;
+ int m_firstVertex;
+ int m_restartIndexValue;
+ int m_verticesPerPatch;
+ bool m_primitiveRestartEnabled;
QGeometryRenderer::PrimitiveType m_primitiveType;
bool m_dirty;
- bool m_enabled;
- QGeometryFunctorPtr m_functor;
+ QGeometryFactoryPtr m_geometryFactory;
GeometryRendererManager *m_manager;
QVector<QBoundingVolume *> m_triangleVolumes;
};
-class GeometryRendererFunctor : public Qt3DCore::QBackendNodeFunctor
+class GeometryRendererFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit GeometryRendererFunctor(GeometryRendererManager *manager);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
+ explicit GeometryRendererFunctor(AbstractRenderer *renderer, GeometryRendererManager *manager);
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
private:
GeometryRendererManager *m_manager;
+ AbstractRenderer *m_renderer;
};
} // namespace Render
diff --git a/src/render/geometry/geometryrenderermanager.cpp b/src/render/geometry/geometryrenderermanager.cpp
index b39a0269f..be5cc2487 100644
--- a/src/render/geometry/geometryrenderermanager.cpp
+++ b/src/render/geometry/geometryrenderermanager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,7 +52,7 @@ GeometryRendererManager::~GeometryRendererManager()
{
}
-void GeometryRendererManager::addDirtyGeometryRenderer(const Qt3DCore::QNodeId &bufferId)
+void GeometryRendererManager::addDirtyGeometryRenderer(Qt3DCore::QNodeId bufferId)
{
if (!m_dirtyGeometryRenderers.contains(bufferId))
m_dirtyGeometryRenderers.push_back(bufferId);
diff --git a/src/render/geometry/geometryrenderermanager_p.h b/src/render/geometry/geometryrenderermanager_p.h
index 769f4ad63..4dea63862 100644
--- a/src/render/geometry/geometryrenderermanager_p.h
+++ b/src/render/geometry/geometryrenderermanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,7 +60,7 @@ namespace Qt3DRender {
namespace Render {
-class GeometryRendererManager : public Qt3DCore::QResourceManager<
+class Q_AUTOTEST_EXPORT GeometryRendererManager : public Qt3DCore::QResourceManager<
GeometryRenderer,
Qt3DCore::QNodeId,
16,
@@ -69,7 +72,7 @@ public:
~GeometryRendererManager();
// Aspect Thread
- void addDirtyGeometryRenderer(const Qt3DCore::QNodeId &bufferId);
+ void addDirtyGeometryRenderer(Qt3DCore::QNodeId bufferId);
QVector<Qt3DCore::QNodeId> dirtyGeometryRenderers();
void requestTriangleDataRefreshForGeometryRenderer(const Qt3DCore::QNodeId geometryRenderer);
diff --git a/src/render/geometry/qabstractattribute.cpp b/src/render/geometry/qabstractattribute.cpp
deleted file mode 100644
index a503d48d6..000000000
--- a/src/render/geometry/qabstractattribute.cpp
+++ /dev/null
@@ -1,397 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractattribute.h"
-#include "qabstractattribute_p.h"
-#include "qabstractbuffer.h"
-
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QAbstractAttributePrivate::QAbstractAttributePrivate()
- : QNodePrivate()
- , m_buffer(Q_NULLPTR)
- , m_name()
- , m_dataType(QAbstractAttribute::Float)
- , m_dataSize(1)
- , m_count(0)
- , m_byteStride(0)
- , m_byteOffset(0)
- , m_divisor(0)
- , m_attributeType(QAbstractAttribute::VertexAttribute)
-{
-}
-
-/*!
- * \qmltype AbstractAttribute
- * \instantiates Qt3DRender::QAbstractAttribute
- * \inqmlmodule Qt3D.Render
- * \brief Uncreatable
- */
-
-/*!
- * \class Qt3DRender::QAbstractAttribute
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DCore::QNode
- *
- * Abstract class.
- */
-
-/*!
- * \typedef Qt3DRender::QAbstractBufferPtr
- * \relates Qt3DRender::QAbstractAttribute
- */
-
-/*!
- * \fn QVector<QVector4D> Qt3DRender::QAbstractAttribute::asVector4D() const
- */
-
-/*!
- * \fn QVector<QVector3D> Qt3DRender::QAbstractAttribute::asVector3D() const
- */
-
-/*!
- * \fn QVector<QVector2D> Qt3DRender::QAbstractAttribute::asVector2D() const
- */
-
-/*!
- * \fn void Qt3DRender::QAbstractAttribute::dump(int count)
- * \a count
- */
-
-/*!
- * \enum QAbstractAttribute::AttributeType
- *
- * The type of the attribute.
- *
- * \value VertexAttribute
- * \value IndexAttribute
- */
-
-/*!
- * \enum QAbstractAttribute::DataType
- *
- * The type of the data.
- *
- * \value Byte
- * \value UnsignedByte
- * \value Short
- * \value UnsignedShort
- * \value Int
- * \value UnsignedInt
- * \value HalfFloat
- * \value Float
- * \value Double
- */
-
-/*!
- * Constructs a new QAbstractAttribute with \a parent.
- */
-QAbstractAttribute::QAbstractAttribute(QNode *parent)
- : QNode(*new QAbstractAttributePrivate(), parent)
-{
-}
-
-/*!
- * Destroys the abstract attribute.
- */
-QAbstractAttribute::~QAbstractAttribute()
-{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QAbstractAttribute subclass didn't call QNode::cleanup in its destructor");
-}
-
-/*!
- * Constructs a new QAbstractAttribute from \a buf of \a type, \a dataSize, \a count, \a offset,
- * and \a stride with \a parent.
- */
-QAbstractAttribute::QAbstractAttribute(QAbstractBuffer *buf, DataType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent)
- : QNode(*new QAbstractAttributePrivate(), parent)
-{
- Q_D(QAbstractAttribute);
- setBuffer(buf);
- d->m_count = count;
- d->m_byteOffset = offset;
- d->m_dataType = type;
- d->m_dataSize = dataSize;
- d->m_byteStride = stride;
-}
-
-/*!
- * \internal
- */
-QAbstractAttribute::QAbstractAttribute(QAbstractAttributePrivate &dd, QNode *parent)
- : QNode(dd, parent)
-{
-}
-
-/*!
- * \internal
- */
-QAbstractAttribute::QAbstractAttribute(QAbstractAttributePrivate &dd, QAbstractBuffer *buf, const QString &name, DataType dataType, uint dataSize, uint count, uint offset, uint stride, QNode *parent)
- : QNode(dd, parent)
-{
- Q_D(QAbstractAttribute);
- setBuffer(buf);
- d->m_name = name;
- d->m_count = count;
- d->m_byteOffset = offset;
- d->m_dataType = dataType;
- d->m_dataSize = dataSize;
- d->m_byteStride = stride;
-}
-
-/*!
- * \internal
- */
-void QAbstractAttribute::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QAbstractAttribute *attribute = static_cast<const QAbstractAttribute *>(ref);
- d_func()->m_buffer = qobject_cast<QAbstractBuffer *>(QNode::clone(attribute->d_func()->m_buffer));
- d_func()->m_name = attribute->d_func()->m_name;
- d_func()->m_count = attribute->d_func()->m_count;
- d_func()->m_divisor = attribute->d_func()->m_divisor;
- d_func()->m_byteOffset = attribute->d_func()->m_byteOffset;
- d_func()->m_dataType = attribute->d_func()->m_dataType;
- d_func()->m_dataSize = attribute->d_func()->m_dataSize;
- d_func()->m_byteStride = attribute->d_func()->m_byteStride;
- d_func()->m_attributeType = attribute->d_func()->m_attributeType;
-}
-
-/*!
- * \property QAbstractAttribute::buffer
- *
- * Holds the buffer.
- */
-QAbstractBuffer *QAbstractAttribute::buffer() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_buffer;
-}
-
-/*!
- * \property QAbstractAttribute::name
- *
- * Holds the name.
- */
-QString QAbstractAttribute::name() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_name;
-}
-
-/*!
- * \property QAbstractAttribute::dataSize
- *
- * Holds the data size.
- */
-uint QAbstractAttribute::dataSize() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_dataSize;
-}
-
-/*!
- * \property QAbstractAttribute::dataType
- *
- * Holds the data type.
- */
-QAbstractAttribute::DataType QAbstractAttribute::dataType() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_dataType;
-}
-
-/*!
- * \property QAbstractAttribute::count
- *
- * Holds the count.
- */
-uint QAbstractAttribute::count() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_count;
-}
-
-/*!
- * \property QAbstractAttribute::byteStride
- *
- * Holds the byte stride.
- */
-uint QAbstractAttribute::byteStride() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_byteStride;
-}
-
-/*!
- * \property QAbstractAttribute::byteOffset
- *
- * Holds the byte offset.
- */
-uint QAbstractAttribute::byteOffset() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_byteOffset;
-}
-
-/*!
- * \property QAbstractAttribute::divisor
- *
- * Holds the divisor.
- */
-uint QAbstractAttribute::divisor() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_divisor;
-}
-
-/*!
- * \property QAbstractAttribute::attributeType
- *
- * Holds the attribute type.
- */
-QAbstractAttribute::AttributeType QAbstractAttribute::attributeType() const
-{
- Q_D(const QAbstractAttribute);
- return d->m_attributeType;
-}
-
-void QAbstractAttribute::setBuffer(QAbstractBuffer *buffer)
-{
- Q_D(QAbstractAttribute);
- if (d->m_buffer == buffer)
- return;
-
- // We need to add it as a child of the current node if it has been declared inline
- // Or not previously added as a child of the current node so that
- // 1) The backend gets notified about it's creation
- // 2) When the current node is destroyed, it gets destroyed as well
- if (buffer && !buffer->parent())
- buffer->setParent(this);
-
- d->m_buffer = buffer;
- emit bufferChanged(buffer);
-}
-
-void QAbstractAttribute::setName(const QString &name)
-{
- Q_D(QAbstractAttribute);
- if (d->m_name == name)
- return;
-
- d->m_name = name;
- emit nameChanged(name);
-}
-
-void QAbstractAttribute::setDataType(DataType type)
-{
- Q_D(QAbstractAttribute);
-
- if (d->m_dataType == type)
- return;
-
- d->m_dataType = type;
- emit dataTypeChanged(type);
-}
-
-void QAbstractAttribute::setDataSize(uint size)
-{
- Q_D(QAbstractAttribute);
- if (d->m_dataSize == size)
- return;
- Q_ASSERT(size >= 1 && size <= 4);
- d->m_dataSize = size;
- emit dataSizeChanged(size);
-}
-
-void QAbstractAttribute::setCount(uint count)
-{
- Q_D(QAbstractAttribute);
- if (d->m_count == count)
- return;
-
- d->m_count = count;
- emit countChanged(count);
-}
-
-void QAbstractAttribute::setByteStride(uint byteStride)
-{
- Q_D(QAbstractAttribute);
- if (d->m_byteStride == byteStride)
- return;
-
- d->m_byteStride = byteStride;
- emit byteStrideChanged(byteStride);
-}
-
-void QAbstractAttribute::setByteOffset(uint byteOffset)
-{
- Q_D(QAbstractAttribute);
- if (d->m_byteOffset == byteOffset)
- return;
-
- d->m_byteOffset = byteOffset;
- emit byteOffsetChanged(byteOffset);
-}
-
-void QAbstractAttribute::setDivisor(uint divisor)
-{
- Q_D(QAbstractAttribute);
- if (d->m_divisor == divisor)
- return;
-
- d->m_divisor = divisor;
- emit divisorChanged(divisor);
-}
-
-void QAbstractAttribute::setAttributeType(AttributeType attributeType)
-{
- Q_D(QAbstractAttribute);
- if (d->m_attributeType == attributeType)
- return;
-
- d->m_attributeType = attributeType;
- emit attributeTypeChanged(attributeType);
-}
-
-} // Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qabstractattribute.h b/src/render/geometry/qabstractattribute.h
deleted file mode 100644
index 29d1e44f3..000000000
--- a/src/render/geometry/qabstractattribute.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QABSTRACTATTRIBUTE_H
-#define QT3DRENDER_QABSTRACTATTRIBUTE_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DCore/QNode>
-#include <QtCore/QSharedPointer>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractBuffer;
-class QAbstractAttributePrivate;
-
-typedef QSharedPointer<QAbstractBuffer> QAbstractBufferPtr;
-
-class QT3DRENDERSHARED_EXPORT QAbstractAttribute : public Qt3DCore::QNode
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DRender::QAbstractBuffer *buffer READ buffer WRITE setBuffer NOTIFY bufferChanged)
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
- Q_PROPERTY(DataType dataType READ dataType WRITE setDataType NOTIFY dataTypeChanged)
- Q_PROPERTY(uint dataSize READ dataSize WRITE setDataSize NOTIFY dataSizeChanged)
- Q_PROPERTY(uint count READ count WRITE setCount NOTIFY countChanged)
- Q_PROPERTY(uint byteStride READ byteStride WRITE setByteStride NOTIFY byteStrideChanged)
- Q_PROPERTY(uint byteOffset READ byteOffset WRITE setByteOffset NOTIFY byteOffsetChanged)
- Q_PROPERTY(uint divisor READ divisor WRITE setDivisor NOTIFY divisorChanged)
- Q_PROPERTY(AttributeType attributeType READ attributeType WRITE setAttributeType NOTIFY attributeTypeChanged)
-
-public:
- enum AttributeType {
- VertexAttribute,
- IndexAttribute
- };
-
- Q_ENUM(AttributeType)
-
- enum DataType {
- Byte = 0,
- UnsignedByte,
- Short,
- UnsignedShort,
- Int,
- UnsignedInt,
- HalfFloat,
- Float,
- Double
- };
- Q_ENUM(DataType)
-
- explicit QAbstractAttribute(QNode *parent = Q_NULLPTR);
- ~QAbstractAttribute();
- QAbstractAttribute(QAbstractBuffer *buf, DataType dataType, uint dataSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = Q_NULLPTR);
-
- QAbstractBuffer *buffer() const;
- QString name() const;
- DataType dataType() const;
- uint dataSize() const;
- uint count() const;
- uint byteStride() const;
- uint byteOffset() const;
- uint divisor() const;
- AttributeType attributeType() const;
-
- virtual QVector<QVector4D> asVector4D() const = 0;
- virtual QVector<QVector3D> asVector3D() const = 0;
- virtual QVector<QVector2D> asVector2D() const = 0;
- virtual void dump(int count) = 0;
-
-public Q_SLOTS:
- void setBuffer(QAbstractBuffer *buffer);
- void setName(const QString &name);
- void setDataType(DataType type);
- void setDataSize(uint size);
- void setCount(uint count);
- void setByteStride(uint byteStride);
- void setByteOffset(uint byteOffset);
- void setDivisor(uint divisor);
- void setAttributeType(AttributeType attributeType);
-
-Q_SIGNALS:
- void bufferChanged(QAbstractBuffer *buffer);
- void nameChanged(const QString &name);
- void dataTypeChanged(DataType dataType);
- void dataSizeChanged(uint dataSize);
- void countChanged(uint count);
- void byteStrideChanged(uint byteStride);
- void byteOffsetChanged(uint byteOffset);
- void divisorChanged(uint divisor);
- void attributeTypeChanged(AttributeType attributeType);
-
-protected:
- QAbstractAttribute(QAbstractAttributePrivate &dd, QNode *parent = Q_NULLPTR);
- QAbstractAttribute(QAbstractAttributePrivate &dd, QAbstractBuffer *buf, const QString &name, DataType dataType, uint dataSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = Q_NULLPTR);
-
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QAbstractAttribute)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QABSTRACTATTRIBUTE_H
diff --git a/src/render/geometry/qabstractattribute_p.h b/src/render/geometry/qabstractattribute_p.h
deleted file mode 100644
index a9a2127ae..000000000
--- a/src/render/geometry/qabstractattribute_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QABSTRACTATTRIBUTE_P_H
-#define QT3DRENDER_QABSTRACTATTRIBUTE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/QAbstractAttribute>
-#include <Qt3DRender/QAbstractBuffer>
-#include <private/qnode_p.h>
-#include <private/qt3drender_global_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractAttribute;
-
-class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractAttributePrivate : public Qt3DCore::QNodePrivate
-{
-public:
- Q_DECLARE_PUBLIC(QAbstractAttribute)
-
- QAbstractAttributePrivate();
-
- QAbstractBuffer *m_buffer;
- QString m_name;
- QAbstractAttribute::DataType m_dataType;
- uint m_dataSize;
- uint m_count;
- uint m_byteStride;
- uint m_byteOffset;
- uint m_divisor;
- QAbstractAttribute::AttributeType m_attributeType;
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QABSTRACTATTRIBUTE_P_H
diff --git a/src/render/geometry/qabstractbuffer.cpp b/src/render/geometry/qabstractbuffer.cpp
deleted file mode 100644
index 3a63af3a8..000000000
--- a/src/render/geometry/qabstractbuffer.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractbuffer.h"
-#include "qabstractbuffer_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-
-QAbstractBufferPrivate::QAbstractBufferPrivate()
- : QNodePrivate()
-{
-}
-
-/*!
- * \qmltype AbstractBuffer
- * \instantiates Qt3DRender::QAbstractBuffer
- * \inqmlmodule Qt3D.Render
- * \brief Uncreatable
- */
-
-/*!
- * \class Qt3DRender::QAbstractBuffer
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DCore::QNode
- *
- * Abstract class.
- */
-
-/*!
- * \fn void Qt3DRender::QAbstractBuffer::dataChanged(const QByteArray &bytes)
- *
- * This signal is emitted with \a bytes when data changes.
- */
-
-/*!
- * Constructs a new QAbstractBuffer with \a parent.
- */
-QAbstractBuffer::QAbstractBuffer(QNode *parent)
- : QNode(*new QAbstractBufferPrivate(), parent)
-{
-}
-
-/*!
- * Destroys the abstract buffer.
- */
-QAbstractBuffer::~QAbstractBuffer()
-{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QAbstractBuffer subclass didn't call QNode::cleanup in its destructor");
-}
-
-/*!
- * \internal
- */
-QAbstractBuffer::QAbstractBuffer(QAbstractBufferPrivate &dd, QNode *parent)
- : QNode(dd, parent)
-{
-}
-
-/*!
- * \internal
- */
-void QAbstractBuffer::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QAbstractBuffer *buffer = static_cast<const QAbstractBuffer *>(ref);
- d_func()->m_data = buffer->d_func()->m_data;
-}
-
-/*!
- * Sets \a bytes as data.
- */
-void QAbstractBuffer::setData(const QByteArray &bytes)
-{
- Q_D(QAbstractBuffer);
- if (bytes != d->m_data) {
- d->m_data = bytes;
- Qt3DCore::QNodePrivate::get(this)->notifyPropertyChange("data", QVariant::fromValue(d->m_data));
- emit dataChanged(bytes);
- }
-}
-
-/*!
- * \return the data.
- */
-QByteArray QAbstractBuffer::data() const
-{
- Q_D(const QAbstractBuffer);
- return d->m_data;
-}
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qabstractbuffer.h b/src/render/geometry/qabstractbuffer.h
deleted file mode 100644
index b62907eb2..000000000
--- a/src/render/geometry/qabstractbuffer.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QABSTRACTBUFFER_H
-#define QT3DRENDER_QABSTRACTBUFFER_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DCore/QNode>
-#include <QtCore/QSharedPointer>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractBufferPrivate;
-
-class QT3DRENDERSHARED_EXPORT QAbstractBuffer : public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- QAbstractBuffer(QNode *parent = Q_NULLPTR);
- virtual ~QAbstractBuffer();
-
- void setData(const QByteArray &bytes);
- QByteArray data() const;
-
-protected:
- QAbstractBuffer(QAbstractBufferPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
-Q_SIGNALS:
- void dataChanged(const QByteArray &bytes);
-
-private:
- Q_DECLARE_PRIVATE(QAbstractBuffer)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QABSTRACTBUFFER_H
diff --git a/src/render/geometry/qabstractbuffer_p.h b/src/render/geometry/qabstractbuffer_p.h
deleted file mode 100644
index 67ef0bb74..000000000
--- a/src/render/geometry/qabstractbuffer_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QABSTRACTBUFFER_P_H
-#define QT3DRENDER_QABSTRACTBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qnode_p.h>
-#include <private/qt3drender_global_p.h>
-
-#include <QByteArray>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractBuffer;
-
-class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractBufferPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- Q_DECLARE_PUBLIC(QAbstractBuffer)
-
- QAbstractBufferPrivate();
- QByteArray m_data;
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QABSTRACTBUFFER_P_H
diff --git a/src/render/geometry/qattribute.cpp b/src/render/geometry/qattribute.cpp
index 615945188..1e9348567 100644
--- a/src/render/geometry/qattribute.cpp
+++ b/src/render/geometry/qattribute.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,202 +39,315 @@
#include "qattribute.h"
#include "qattribute_p.h"
-#include <QVector4D>
-#include <QVector3D>
-#include <QVector2D>
-#include <QVector>
#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/private/renderlogging_p.h>
+
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-/*!
- class Qt3DCore::AttributePrivate
- \internal
-*/
QAttributePrivate::QAttributePrivate()
- : QAbstractAttributePrivate()
+ : QNodePrivate()
+ , m_buffer(nullptr)
+ , m_name()
+ , m_dataType(QAttribute::Float)
+ , m_dataSize(1)
+ , m_count(0)
+ , m_byteStride(0)
+ , m_byteOffset(0)
+ , m_divisor(0)
+ , m_attributeType(QAttribute::VertexAttribute)
{
}
+/*!
+ * \qmltype Attribute
+ * \instantiates Qt3DRender::QAttribute
+ * \inqmlmodule Qt3D.Render
+ * \brief Uncreatable
+ */
+
+/*!
+ * \class Qt3DRender::QAttribute
+ * \inmodule Qt3DRender
+ *
+ * \inherits Qt3DCore::QNode
+ *
+ */
+
+/*!
+ * \typedef Qt3DRender::QBufferPtr
+ * \relates Qt3DRender::QAttribute
+ */
+
+/*!
+ * \enum QAttribute::AttributeType
+ *
+ * The type of the attribute.
+ *
+ * \value VertexAttribute
+ * \value IndexAttribute
+ */
+
+/*!
+ * \enum QAttribute::DataType
+ *
+ * The type of the data.
+ *
+ * \value Byte
+ * \value UnsignedByte
+ * \value Short
+ * \value UnsignedShort
+ * \value Int
+ * \value UnsignedInt
+ * \value HalfFloat
+ * \value Float
+ * \value Double
+ */
+
+/*!
+ * Constructs a new QAttribute with \a parent.
+ */
QAttribute::QAttribute(QNode *parent)
- : QAbstractAttribute(*new QAttributePrivate(), parent)
+ : QNode(*new QAttributePrivate(), parent)
{
}
-QAttribute::QAttribute(QBuffer *buf, DataType type, uint dataSize, int count, int offset, int stride)
- : QAbstractAttribute(*new QAttributePrivate(), buf, QString(), type, dataSize, count, offset, stride)
+/*!
+ * Constructs a new QAttribute from \a buf of \a type, \a dataSize, \a count, \a offset,
+ * and \a stride with \a parent.
+ */
+QAttribute::QAttribute(QBuffer *buf, VertexBaseType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent)
+ : QNode(*new QAttributePrivate(), parent)
{
+ Q_D(QAttribute);
+ setBuffer(buf);
+ d->m_count = count;
+ d->m_byteOffset = offset;
+ d->m_dataType = type;
+ d->m_dataSize = dataSize;
+ d->m_byteStride = stride;
}
-QAttribute::QAttribute(QBuffer *buf, const QString &name, DataType type, uint dataSize, int count, int offset, int stride)
- : QAbstractAttribute(*new QAttributePrivate(), buf, name, type, dataSize, count, offset, stride)
+
+/*!
+ * Constructs a new QAttribute named \a name from \a buf of \a type, \a
+ * dataSize, \a count, \a offset, and \a stride with \a parent.
+ */
+QAttribute::QAttribute(QBuffer *buf, const QString &name, VertexBaseType type, uint dataSize, uint count, uint offset, uint stride, QNode *parent)
+ : QNode(*new QAttributePrivate(), parent)
{
+ Q_D(QAttribute);
+ setBuffer(buf);
+ d->m_name = name;
+ d->m_count = count;
+ d->m_byteOffset = offset;
+ d->m_dataType = type;
+ d->m_dataSize = dataSize;
+ d->m_byteStride = stride;
}
+/*! \internal */
QAttribute::~QAttribute()
{
- QAbstractAttribute::cleanup();
}
-void QAttribute::copy(const QNode *ref)
+/*!
+ * \property QAttribute::buffer
+ *
+ * Holds the buffer.
+ */
+QBuffer *QAttribute::buffer() const
+{
+ Q_D(const QAttribute);
+ return d->m_buffer;
+}
+
+/*!
+ * \property QAttribute::name
+ *
+ * Holds the name.
+ */
+QString QAttribute::name() const
{
- QAbstractAttribute::copy(ref);
+ Q_D(const QAttribute);
+ return d->m_name;
}
-QVector<QVector4D> QAttribute::asVector4D() const
+/*!
+ * \property QAttribute::dataSize
+ *
+ * Holds the data size.
+ */
+uint QAttribute::vertexSize() const
{
Q_D(const QAttribute);
- const QByteArray buffer = d->m_buffer->data();
- const char *rawBuffer = buffer.constData();
- rawBuffer += d->m_byteOffset;
- const float* fptr;
- int stride;
-
- switch (dataType()) {
- case QAttribute::Float:
- stride = sizeof(float) * dataSize();
- break;
-
- default:
- qCDebug(Render::Io) << Q_FUNC_INFO << "can't convert" << dataType() << "x" << dataSize() << "to QVector3D";
- return QVector<QVector4D>();
- }
-
- if (d->m_byteStride != 0)
- stride = d->m_byteStride;
- QVector<QVector4D> result;
- result.resize(d->m_count);
-
- for (uint c = 0; c < d->m_count; ++c) {
- QVector4D v;
- fptr = reinterpret_cast<const float*>(rawBuffer);
-
- for (uint i = 0, m = dataSize(); i < m; ++i)
- v[i] = fptr[i];
-
- result[c] = v;
- rawBuffer += stride;
- }
-
- return result;
+ return d->m_dataSize;
}
-QVector<QVector3D> QAttribute::asVector3D() const
+/*!
+ * \property QAttribute::dataType
+ *
+ * Holds the data type.
+ */
+QAttribute::VertexBaseType QAttribute::vertexBaseType() const
{
Q_D(const QAttribute);
- const QByteArray buffer = d->m_buffer->data();
- const char *rawBuffer = buffer.constData();
- rawBuffer += d->m_byteOffset;
- const float* fptr;
- int stride;
-
- switch (dataType()) {
- case QAttribute::Float:
- stride = sizeof(float) * dataSize();
- break;
-
- default:
- qCDebug(Render::Io) << Q_FUNC_INFO << "can't convert" << dataType() << "x" << dataSize() << "to QVector3D";
- return QVector<QVector3D>();
- }
-
- if (d->m_byteStride != 0)
- stride = d->m_byteStride;
- QVector<QVector3D> result;
- result.resize(d->m_count);
-
- for (uint c = 0; c < d->m_count; ++c) {
- QVector3D v;
- fptr = reinterpret_cast<const float*>(rawBuffer);
-
- for (uint i = 0, m = qMin(dataSize(), 3U); i < m; ++i)
- v[i] = fptr[i];
-
- result[c] = v;
- rawBuffer += stride;
- }
-
- return result;
+ return d->m_dataType;
}
-QVector<QVector2D> QAttribute::asVector2D() const
+/*!
+ * \property QAttribute::count
+ *
+ * Holds the count.
+ */
+uint QAttribute::count() const
{
Q_D(const QAttribute);
- char* rawBuffer = d->m_buffer->data().data();
- rawBuffer += d->m_byteOffset;
- float* fptr;
- int stride;
-
- switch (dataType()) {
- case QAttribute::Float:
- stride = sizeof(float) * dataSize();
- break;
-
- default:
- qCDebug(Render::Io) << Q_FUNC_INFO << "can't convert" << dataType() << "x" << dataSize() << "to QVector3D";
- return QVector<QVector2D>();
- }
-
- if (d->m_byteStride != 0)
- stride = d->m_byteStride;
-
- QVector<QVector2D> result;
- result.resize(d->m_count);
-
- for (uint c = 0; c < d->m_count; ++c) {
- QVector2D v;
- fptr = reinterpret_cast<float*>(rawBuffer);
- for (uint i = 0, m = qMin(dataSize(), 2U); i < m; ++i)
- v[i] = fptr[i];
- result[c] = v;
- rawBuffer += stride;
- }
-
- return result;
+ return d->m_count;
}
-void QAttribute::dump(int count)
+/*!
+ * \property QAttribute::byteStride
+ *
+ * Holds the byte stride.
+ */
+uint QAttribute::byteStride() const
{
Q_D(const QAttribute);
- const char* rawBuffer = d->m_buffer->data().data();
- rawBuffer += d->m_byteOffset;
-
- const float* fptr;
- const quint16* usptr;
-
- int stride = d->m_byteStride;
-
- for (int c=0; c<count; ++c) {
- switch (dataType()) {
- case QAttribute::UnsignedShort:
- if (stride == 0)
- stride = sizeof(quint16);
- usptr = reinterpret_cast<const quint16*>(rawBuffer + stride * c);
- qCDebug(Render::Io) << c << ":u16:" << usptr[0];
- break;
- case QAttribute::UnsignedInt:
- if (stride == 0)
- stride = sizeof(quint32);
- qCDebug(Render::Io) << c << ":u32:" << reinterpret_cast<const quint32*>(rawBuffer + stride * c)[0];
- break;
- case QAttribute::Float:
- if (stride == 0)
- stride = sizeof(float) * dataSize();
- fptr = reinterpret_cast<const float*>(rawBuffer + stride * c);
- qCDebug(Render::Io) << c << QString::fromLatin1(":vec") + QString::number(dataSize()) << fptr[0] << fptr[1];
- break;
-
- default: qCDebug(Render::Io) << Q_FUNC_INFO << "unspported type:" << dataType();
- }
- }
+ return d->m_byteStride;
}
-QBuffer *QAttribute::buffer() const
+/*!
+ * \property QAttribute::byteOffset
+ *
+ * Holds the byte offset.
+ */
+uint QAttribute::byteOffset() const
+{
+ Q_D(const QAttribute);
+ return d->m_byteOffset;
+}
+
+/*!
+ * \property QAttribute::divisor
+ *
+ * Holds the divisor.
+ */
+uint QAttribute::divisor() const
+{
+ Q_D(const QAttribute);
+ return d->m_divisor;
+}
+
+/*!
+ * \property QAttribute::attributeType
+ *
+ * Holds the attribute type.
+ */
+QAttribute::AttributeType QAttribute::attributeType() const
{
- return static_cast<QBuffer *>(QAbstractAttribute::buffer());
+ Q_D(const QAttribute);
+ return d->m_attributeType;
+}
+
+void QAttribute::setBuffer(QBuffer *buffer)
+{
+ Q_D(QAttribute);
+ if (d->m_buffer == buffer)
+ return;
+
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, it gets destroyed as well
+ if (buffer && !buffer->parent())
+ buffer->setParent(this);
+
+ d->m_buffer = buffer;
+ emit bufferChanged(buffer);
+}
+
+void QAttribute::setName(const QString &name)
+{
+ Q_D(QAttribute);
+ if (d->m_name == name)
+ return;
+
+ d->m_name = name;
+ emit nameChanged(name);
+}
+
+void QAttribute::setDataType(VertexBaseType type)
+{
+ Q_D(QAttribute);
+
+ if (d->m_dataType == type)
+ return;
+
+ d->m_dataType = type;
+ emit dataTypeChanged(type);
+}
+
+void QAttribute::setDataSize(uint size)
+{
+ Q_D(QAttribute);
+ if (d->m_dataSize == size)
+ return;
+ Q_ASSERT(size >= 1 && size <= 4);
+ d->m_dataSize = size;
+ emit dataSizeChanged(size);
+}
+
+void QAttribute::setCount(uint count)
+{
+ Q_D(QAttribute);
+ if (d->m_count == count)
+ return;
+
+ d->m_count = count;
+ emit countChanged(count);
+}
+
+void QAttribute::setByteStride(uint byteStride)
+{
+ Q_D(QAttribute);
+ if (d->m_byteStride == byteStride)
+ return;
+
+ d->m_byteStride = byteStride;
+ emit byteStrideChanged(byteStride);
+}
+
+void QAttribute::setByteOffset(uint byteOffset)
+{
+ Q_D(QAttribute);
+ if (d->m_byteOffset == byteOffset)
+ return;
+
+ d->m_byteOffset = byteOffset;
+ emit byteOffsetChanged(byteOffset);
+}
+
+void QAttribute::setDivisor(uint divisor)
+{
+ Q_D(QAttribute);
+ if (d->m_divisor == divisor)
+ return;
+
+ d->m_divisor = divisor;
+ emit divisorChanged(divisor);
+}
+
+void QAttribute::setAttributeType(AttributeType attributeType)
+{
+ Q_D(QAttribute);
+ if (d->m_attributeType == attributeType)
+ return;
+
+ d->m_attributeType = attributeType;
+ emit attributeTypeChanged(attributeType);
}
QString QAttribute::defaultPositionAttributeName()
@@ -259,6 +375,23 @@ QString QAttribute::defaultTangentAttributeName()
return QStringLiteral("vertexTangent");
}
-} // namespace Qt3DRender
+Qt3DCore::QNodeCreatedChangeBasePtr QAttribute::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAttributeData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QAttribute);
+ data.bufferId = qIdForNode(d->m_buffer);
+ data.name = d->m_name;
+ data.dataType = d->m_dataType;
+ data.dataSize = d->m_dataSize;
+ data.count = d->m_count;
+ data.byteStride = d->m_byteStride;
+ data.byteOffset = d->m_byteOffset;
+ data.divisor = d->m_divisor;
+ data.attributeType = d->m_attributeType;
+ return creationChange;
+}
+
+} // Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/geometry/qattribute.h b/src/render/geometry/qattribute.h
index 274aecb8d..e6b525dc4 100644
--- a/src/render/geometry/qattribute.h
+++ b/src/render/geometry/qattribute.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,34 +40,67 @@
#ifndef QT3DRENDER_QATTRIBUTE_H
#define QT3DRENDER_QATTRIBUTE_H
-#include <Qt3DRender/qabstractattribute.h>
#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DCore/qnode.h>
#include <QtCore/QSharedPointer>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAttributePrivate;
class QBuffer;
+class QAttributePrivate;
+
+typedef QSharedPointer<QBuffer> QBufferPtr;
-class QT3DRENDERSHARED_EXPORT QAttribute : public QAbstractAttribute
+class QT3DRENDERSHARED_EXPORT QAttribute : public Qt3DCore::QNode
{
Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QBuffer *buffer READ buffer WRITE setBuffer NOTIFY bufferChanged)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(VertexBaseType vertexBaseType READ vertexBaseType WRITE setDataType NOTIFY dataTypeChanged)
+ Q_PROPERTY(uint vertexSize READ vertexSize WRITE setDataSize NOTIFY dataSizeChanged)
+ Q_PROPERTY(uint count READ count WRITE setCount NOTIFY countChanged)
+ Q_PROPERTY(uint byteStride READ byteStride WRITE setByteStride NOTIFY byteStrideChanged)
+ Q_PROPERTY(uint byteOffset READ byteOffset WRITE setByteOffset NOTIFY byteOffsetChanged)
+ Q_PROPERTY(uint divisor READ divisor WRITE setDivisor NOTIFY divisorChanged)
+ Q_PROPERTY(AttributeType attributeType READ attributeType WRITE setAttributeType NOTIFY attributeTypeChanged)
public:
- explicit QAttribute(Qt3DCore::QNode *parent = Q_NULLPTR);
- QAttribute(QBuffer *buf, DataType type, uint dataSize, int count, int offset=0, int stride = 0);
- QAttribute(QBuffer *buf, const QString &name, DataType type, uint dataSize, int count, int offset=0, int stride = 0);
+ enum AttributeType {
+ VertexAttribute,
+ IndexAttribute
+ };
+
+ Q_ENUM(AttributeType)
+
+ enum VertexBaseType {
+ Byte = 0,
+ UnsignedByte,
+ Short,
+ UnsignedShort,
+ Int,
+ UnsignedInt,
+ HalfFloat,
+ Float,
+ Double
+ };
+ Q_ENUM(VertexBaseType)
+
+ explicit QAttribute(QNode *parent = nullptr);
+ explicit QAttribute(QBuffer *buf, VertexBaseType vertexBaseType, uint vertexSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = nullptr);
+ explicit QAttribute(QBuffer *buf, const QString &name, VertexBaseType vertexBaseType, uint vertexSize, uint count, uint offset = 0, uint stride = 0, QNode *parent = nullptr);
~QAttribute();
- QVector<QVector4D> asVector4D() const Q_DECL_OVERRIDE;
- QVector<QVector3D> asVector3D() const Q_DECL_OVERRIDE;
- QVector<QVector2D> asVector2D() const Q_DECL_OVERRIDE;
-
- void dump(int count) Q_DECL_OVERRIDE;
-
QBuffer *buffer() const;
+ QString name() const;
+ VertexBaseType vertexBaseType() const;
+ uint vertexSize() const;
+ uint count() const;
+ uint byteStride() const;
+ uint byteOffset() const;
+ uint divisor() const;
+ AttributeType attributeType() const;
Q_INVOKABLE static QString defaultPositionAttributeName();
Q_INVOKABLE static QString defaultNormalAttributeName();
@@ -72,15 +108,34 @@ public:
Q_INVOKABLE static QString defaultTextureCoordinateAttributeName();
Q_INVOKABLE static QString defaultTangentAttributeName();
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+public Q_SLOTS:
+ void setBuffer(QBuffer *buffer);
+ void setName(const QString &name);
+ void setDataType(VertexBaseType type);
+ void setDataSize(uint size);
+ void setCount(uint count);
+ void setByteStride(uint byteStride);
+ void setByteOffset(uint byteOffset);
+ void setDivisor(uint divisor);
+ void setAttributeType(AttributeType attributeType);
+
+Q_SIGNALS:
+ void bufferChanged(QBuffer *buffer);
+ void nameChanged(const QString &name);
+ void dataTypeChanged(VertexBaseType vertexBaseType);
+ void dataSizeChanged(uint vertexSize);
+ void countChanged(uint count);
+ void byteStrideChanged(uint byteStride);
+ void byteOffsetChanged(uint byteOffset);
+ void divisorChanged(uint divisor);
+ void attributeTypeChanged(AttributeType attributeType);
private:
- QT3D_CLONEABLE(QAttribute)
Q_DECLARE_PRIVATE(QAttribute)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
-} // namespace Qt3DRender
+} // Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/geometry/qattribute_p.h b/src/render/geometry/qattribute_p.h
index a64adfd8b..8731e3195 100644
--- a/src/render/geometry/qattribute_p.h
+++ b/src/render/geometry/qattribute_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,8 +51,10 @@
// We mean it.
//
-#include <private/qabstractattribute_p.h>
-#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DRender/QAttribute>
+#include <Qt3DRender/QBuffer>
+#include <private/qnode_p.h>
+#include <private/qt3drender_global_p.h>
QT_BEGIN_NAMESPACE
@@ -57,13 +62,38 @@ namespace Qt3DRender {
class QAttribute;
-class QT3DRENDERSHARED_EXPORT QAttributePrivate : public QAbstractAttributePrivate
+class QT3DRENDERSHARED_PRIVATE_EXPORT QAttributePrivate : public Qt3DCore::QNodePrivate
{
public:
+ Q_DECLARE_PUBLIC(QAttribute)
+
QAttributePrivate();
+
+ QBuffer *m_buffer;
+ QString m_name;
+ QAttribute::VertexBaseType m_dataType;
+ uint m_dataSize;
+ uint m_count;
+ uint m_byteStride;
+ uint m_byteOffset;
+ uint m_divisor;
+ QAttribute::AttributeType m_attributeType;
+};
+
+struct QAttributeData
+{
+ Qt3DCore::QNodeId bufferId;
+ QString name;
+ QAttribute::VertexBaseType dataType;
+ uint dataSize;
+ uint count;
+ uint byteStride;
+ uint byteOffset;
+ uint divisor;
+ QAttribute::AttributeType attributeType;
};
-} // namespace Qt3DRender
+} // Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/geometry/qboundingvolumespecifier.cpp b/src/render/geometry/qboundingvolumespecifier.cpp
deleted file mode 100644
index 04689a644..000000000
--- a/src/render/geometry/qboundingvolumespecifier.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qboundingvolumespecifier.h"
-#include <private/qobject_p.h>
-#include <Qt3DRender/qabstractattribute.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QBoundingVolumeSpecifierPrivate : public QObjectPrivate
-{
-public:
- QBoundingVolumeSpecifierPrivate()
- : QObjectPrivate()
- , m_positionAttribute(Q_NULLPTR)
- {}
-
- QAbstractAttribute *m_positionAttribute;
-};
-
-/*!
- * \qmltype BoundingVolumeSpecifier
- * \instantiates Qt3DRender::QBoundingVolumeSpecifier
- * \inqmlmodule Qt3D.Render
- * \brief Uncreatable
- */
-
-/*!
- * \qmlproperty AbstractAttribute BoundingVolumeSpecifier::positionAttribute
- *
- * Holds the position attribute.
- */
-
-/*!
- * \class Qt3DRender::QBoundingVolumeSpecifier
- * \inmodule Qt3DRender
- *
- * \inherits QObject
- */
-
-/*!
- * Constructs a new QBoundingVolumeSpecifier with \a parent.
- */
-QBoundingVolumeSpecifier::QBoundingVolumeSpecifier(QObject *parent)
- : QObject(*new QBoundingVolumeSpecifierPrivate(), parent)
-{
-}
-
-/*!
- * \property QBoundingVolumeSpecifier::positionAttribute
- *
- * Holds the position attribute.
- */
-QAbstractAttribute *QBoundingVolumeSpecifier::positionAttribute() const
-{
- Q_D(const QBoundingVolumeSpecifier);
- return d->m_positionAttribute;
-}
-
-void QBoundingVolumeSpecifier::setPositionAttribute(QAbstractAttribute *positionAttribute)
-{
- Q_D(QBoundingVolumeSpecifier);
- if (positionAttribute != d->m_positionAttribute) {
- d->m_positionAttribute = positionAttribute;
- emit positionAttributeChanged(positionAttribute);
- }
-}
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qboundingvolumespecifier.h b/src/render/geometry/qboundingvolumespecifier.h
deleted file mode 100644
index 34b61d51a..000000000
--- a/src/render/geometry/qboundingvolumespecifier.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QBOUNDINGVOLUMESPECIFIER_H
-#define QT3DRENDER_QBOUNDINGVOLUMESPECIFIER_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractAttribute;
-class QBoundingVolumeSpecifierPrivate;
-
-class QT3DRENDERSHARED_EXPORT QBoundingVolumeSpecifier : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DRender::QAbstractAttribute *positionAttribute READ positionAttribute WRITE setPositionAttribute NOTIFY positionAttributeChanged)
-public:
- explicit QBoundingVolumeSpecifier(QObject *parent = Q_NULLPTR);
-
- QAbstractAttribute *positionAttribute() const;
-
-public Q_SLOTS:
- void setPositionAttribute(QAbstractAttribute *positionAttribute);
-
-Q_SIGNALS:
- void positionAttributeChanged(QAbstractAttribute *positionAttribute);
-
-private:
- Q_DECLARE_PRIVATE(QBoundingVolumeSpecifier)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QBOUNDINGVOLUMESPECIFIER_H
diff --git a/src/render/geometry/qbuffer.cpp b/src/render/geometry/qbuffer.cpp
index 6a9d30063..2b265f520 100644
--- a/src/render/geometry/qbuffer.cpp
+++ b/src/render/geometry/qbuffer.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#include "qbuffer.h"
#include "qbuffer_p.h"
#include <Qt3DRender/private/renderlogging_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -46,9 +49,9 @@ using namespace Qt3DCore;
namespace Qt3DRender {
QBufferPrivate::QBufferPrivate()
- : QAbstractBufferPrivate()
+ : QNodePrivate()
, m_usage(QBuffer::StaticDraw)
- , m_sync(false)
+ , m_syncData(false)
{
}
@@ -71,11 +74,11 @@ QBufferPrivate::QBufferPrivate()
*/
/*!
- * \qmlproperty bool Buffer::sync
+ * \qmlproperty bool Buffer::syncData
*
- * Holds the sync flag. When sync is true, this will force data created
- * by a Qt3DRender::QBufferFunctor to also be updated on the frontend
- * Qt3DRender::QBuffer node. By default sync is false.
+ * Holds the syncData flag. When syncData is true, this will force data created
+ * by a Qt3DRender::QBufferDataGenerator to also be updated on the frontend
+ * Qt3DRender::QBuffer node. By default syncData is false.
*
* \note: This has no effect if the buffer's data was set directly using the data
* property.
@@ -85,10 +88,17 @@ QBufferPrivate::QBufferPrivate()
* \class Qt3DRender::QBuffer
* \inmodule Qt3DRender
*
- * \inherits Qt3DRender::QAbstractBuffer
+ * \inherits Qt3DCore::QNode
*/
/*!
+ * \fn void Qt3DRender::QBuffer::dataChanged(const QByteArray &bytes)
+ *
+ * This signal is emitted with \a bytes when data changes.
+ */
+
+
+/*!
* \enum QBuffer::BufferType
*
* The type of the buffer.
@@ -129,7 +139,7 @@ QBufferPrivate::QBufferPrivate()
*/
/*!
- * \typedef Qt3DRender::QBufferFunctorPtr
+ * \typedef Qt3DRender::QBufferDataGeneratorPtr
* \relates QBuffer
*/
@@ -137,54 +147,52 @@ QBufferPrivate::QBufferPrivate()
* Constructs a new QBuffer of buffer type \a ty with \a parent.
*/
QBuffer::QBuffer(QBuffer::BufferType ty, QNode *parent)
- : QAbstractBuffer(*new QBufferPrivate(), parent)
+ : QNode(*new QBufferPrivate(), parent)
{
Q_D(QBuffer);
d->m_type = ty;
}
/*!
- * Destroys this buffer.
+ * \internal
*/
QBuffer::~QBuffer()
{
- QAbstractBuffer::cleanup();
}
/*!
* \internal
*/
-QBuffer::QBuffer(QBufferPrivate &dd, QBuffer::BufferType ty, QNode *parent)
- : QAbstractBuffer(dd, parent)
+void QBuffer::sceneChangeEvent(const QSceneChangePtr &change)
{
- Q_D(QBuffer);
- d->m_type = ty;
+ QPropertyUpdatedChangePtr e = qSharedPointerCast<QPropertyUpdatedChange>(change);
+ if (e->type() == PropertyUpdated && e->propertyName() == QByteArrayLiteral("data")) {
+ const bool blocked = blockNotifications(true);
+ setData(e->value().toByteArray());
+ blockNotifications(blocked);
+ }
}
/*!
- * \internal
+ * Sets \a bytes as data.
*/
-void QBuffer::copy(const QNode *ref)
+void QBuffer::setData(const QByteArray &bytes)
{
- QAbstractBuffer::copy(ref);
- const QBuffer *buffer = static_cast<const QBuffer *>(ref);
- d_func()->m_type = buffer->d_func()->m_type;
- d_func()->m_usage = buffer->d_func()->m_usage;
- d_func()->m_functor = buffer->d_func()->m_functor;
- d_func()->m_sync = buffer->d_func()->m_sync;
+ Q_D(QBuffer);
+ if (bytes != d->m_data) {
+ d->m_data = bytes;
+ Qt3DCore::QNodePrivate::get(this)->notifyPropertyChange("data", QVariant::fromValue(d->m_data));
+ emit dataChanged(bytes);
+ }
}
/*!
- * \internal
+ * \return the data.
*/
-void QBuffer::sceneChangeEvent(const QSceneChangePtr &change)
+QByteArray QBuffer::data() const
{
- QScenePropertyChangePtr e = qSharedPointerCast<QScenePropertyChange>(change);
- if (e->type() == NodeUpdated && e->propertyName() == QByteArrayLiteral("data")) {
- const bool blocked = blockNotifications(true);
- setData(e->value().toByteArray());
- blockNotifications(blocked);
- }
+ Q_D(const QBuffer);
+ return d->m_data;
}
/*!
@@ -221,15 +229,15 @@ QBuffer::BufferType QBuffer::type() const
/*!
* Sets the buffer \a functor.
*/
-void QBuffer::setBufferFunctor(const QBufferFunctorPtr &functor)
+void QBuffer::setDataGenerator(const QBufferDataGeneratorPtr &functor)
{
Q_D(QBuffer);
if (functor && d->m_functor && *functor == *d->m_functor)
return;
d->m_functor = functor;
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
- change->setPropertyName("bufferFunctor");
+ if (d->m_changeArbiter != nullptr) {
+ auto change = QPropertyUpdatedChangePtr::create(d->m_id);
+ change->setPropertyName("dataGenerator");
change->setValue(QVariant::fromValue(d->m_functor));
d->notifyObservers(change);
}
@@ -238,35 +246,35 @@ void QBuffer::setBufferFunctor(const QBufferFunctorPtr &functor)
/*!
* \return the buffer functor.
*/
-QBufferFunctorPtr QBuffer::bufferFunctor() const
+QBufferDataGeneratorPtr QBuffer::dataGenerator() const
{
Q_D(const QBuffer);
return d->m_functor;
}
/*!
- * \property QBuffer::sync
+ * \property QBuffer::syncData
*
- * Holds the sync flag. When sync is true, this will force data created
- * by a Qt3DRender::QBufferFunctor to also be updated on the frontend
- * Qt3DRender::QBuffer node. By default sync is false.
+ * Holds the syncData flag. When syncData is true, this will force data created
+ * by a Qt3DRender::QBufferDataGenerator to also be updated on the frontend
+ * Qt3DRender::QBuffer node. By default syncData is false.
*
* \note: This has no effect if the buffer's data was set directly using the data
* property.
*/
-void QBuffer::setSync(bool sync)
+void QBuffer::setSyncData(bool syncData)
{
Q_D(QBuffer);
- if (d->m_sync != sync) {
- d->m_sync = sync;
- emit syncChanged(sync);
+ if (d->m_syncData != syncData) {
+ d->m_syncData = syncData;
+ emit syncDataChanged(syncData);
}
}
-bool QBuffer::isSync() const
+bool QBuffer::isSyncData() const
{
Q_D(const QBuffer);
- return d->m_sync;
+ return d->m_syncData;
}
void QBuffer::setType(QBuffer::BufferType type)
@@ -278,6 +286,19 @@ void QBuffer::setType(QBuffer::BufferType type)
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QBuffer::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QBufferData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QBuffer);
+ data.data = d->m_data;
+ data.type = d->m_type;
+ data.usage = d->m_usage;
+ data.functor = d->m_functor;
+ data.syncData = d->m_syncData;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/geometry/qbuffer.h b/src/render/geometry/qbuffer.h
index 5034d7106..ba5877e6e 100644
--- a/src/render/geometry/qbuffer.h
+++ b/src/render/geometry/qbuffer.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DRENDER_QBUFFER_H
#define QT3DRENDER_QBUFFER_H
-#include <Qt3DRender/qabstractbuffer.h>
+#include <Qt3DCore/qnode.h>
#include <Qt3DRender/qt3drender_global.h>
#include <QSharedPointer>
@@ -46,15 +49,15 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QBufferPrivate;
-class QBufferFunctor;
-typedef QSharedPointer<QBufferFunctor> QBufferFunctorPtr;
+class QBufferDataGenerator;
+typedef QSharedPointer<QBufferDataGenerator> QBufferDataGeneratorPtr;
-class QT3DRENDERSHARED_EXPORT QBuffer : public QAbstractBuffer
+class QT3DRENDERSHARED_EXPORT QBuffer : public Qt3DCore::QNode
{
Q_OBJECT
Q_PROPERTY(BufferType type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(UsageType usage READ usage WRITE setUsage NOTIFY usageChanged)
- Q_PROPERTY(bool sync READ isSync WRITE setSync NOTIFY syncChanged)
+ Q_PROPERTY(bool syncData READ isSyncData WRITE setSyncData NOTIFY syncDataChanged)
public:
enum BufferType
@@ -62,7 +65,9 @@ public:
VertexBuffer = 0x8892, // GL_ARRAY_BUFFER
IndexBuffer = 0x8893, // GL_ELEMENT_ARRAY_BUFFER
PixelPackBuffer = 0x88EB, // GL_PIXEL_PACK_BUFFER
- PixelUnpackBuffer = 0x88EC // GL_PIXEL_UNPACK_BUFFER
+ PixelUnpackBuffer = 0x88EC, // GL_PIXEL_UNPACK_BUFFER
+ UniformBuffer = 0x8A11, // GL_UNIFORM_BUFFER
+ ShaderStorageBuffer = 0x90D2 // GL_SHADER_STORAGE_BUFFER
};
Q_ENUM(BufferType)
@@ -80,34 +85,36 @@ public:
};
Q_ENUM(UsageType)
- explicit QBuffer(BufferType ty = QBuffer::VertexBuffer, Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QBuffer(BufferType ty = QBuffer::VertexBuffer, Qt3DCore::QNode *parent = nullptr);
~QBuffer();
UsageType usage() const;
BufferType type() const;
- bool isSync() const;
+ bool isSyncData() const;
- void setBufferFunctor(const QBufferFunctorPtr &functor);
- QBufferFunctorPtr bufferFunctor() const;
+ void setData(const QByteArray &bytes);
+ QByteArray data() const;
+
+ void setDataGenerator(const QBufferDataGeneratorPtr &functor);
+ QBufferDataGeneratorPtr dataGenerator() const;
public Q_SLOTS:
void setType(BufferType type);
void setUsage(UsageType usage);
- void setSync(bool sync);
+ void setSyncData(bool syncData);
protected:
- QBuffer(QBufferPrivate &dd, QBuffer::BufferType ty, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
Q_SIGNALS:
+ void dataChanged(const QByteArray &bytes);
void typeChanged(BufferType type);
void usageChanged(UsageType usage);
- void syncChanged(bool sync);
+ void syncDataChanged(bool syncData);
private:
Q_DECLARE_PRIVATE(QBuffer)
- QT3D_CLONEABLE(QBuffer)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/geometry/qbuffer_p.h b/src/render/geometry/qbuffer_p.h
index 31d66c744..1c1f20db6 100644
--- a/src/render/geometry/qbuffer_p.h
+++ b/src/render/geometry/qbuffer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,24 +51,38 @@
// We mean it.
//
-#include <private/qabstractbuffer_p.h>
+#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
#include <Qt3DRender/qt3drender_global.h>
+#include <private/qnode_p.h>
+#include <QByteArray>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QBufferPrivate : public QAbstractBufferPrivate
+class QT3DRENDERSHARED_EXPORT QBufferPrivate : public Qt3DCore::QNodePrivate
{
public:
+ Q_DECLARE_PUBLIC(QBuffer)
+
QBufferPrivate();
+ QByteArray m_data;
QBuffer::BufferType m_type;
QBuffer::UsageType m_usage;
- QBufferFunctorPtr m_functor;
- bool m_sync;
+ QBufferDataGeneratorPtr m_functor;
+ bool m_syncData;
+};
+
+struct QBufferData
+{
+ QByteArray data;
+ QBuffer::BufferType type;
+ QBuffer::UsageType usage;
+ QBufferDataGeneratorPtr functor;
+ bool syncData;
};
} // namespace Qt3DRender
diff --git a/src/render/geometry/qbufferdatagenerator.h b/src/render/geometry/qbufferdatagenerator.h
new file mode 100644
index 000000000..2b37ec24d
--- /dev/null
+++ b/src/render/geometry/qbufferdatagenerator.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QBUFFERDATAGENERATOR
+#define QT3DRENDER_QBUFFERDATAGENERATOR
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DRender/qabstractfunctor.h>
+#include <QSharedPointer>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QT3DRENDERSHARED_EXPORT QBufferDataGenerator : public QAbstractFunctor
+{
+public:
+ virtual ~QBufferDataGenerator() {}
+ virtual QByteArray operator()() = 0;
+ virtual bool operator ==(const QBufferDataGenerator &other) const = 0;
+};
+
+typedef QSharedPointer<QBufferDataGenerator> QBufferDataGeneratorPtr;
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::QBufferDataGeneratorPtr)
+
+#endif // QT3DRENDER_QBUFFERDATAGENERATOR
+
diff --git a/src/render/geometry/qbufferfunctor.h b/src/render/geometry/qbufferfunctor.h
deleted file mode 100644
index 2bed2c894..000000000
--- a/src/render/geometry/qbufferfunctor.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QBUFFERFUNCTOR
-#define QT3DRENDER_QBUFFERFUNCTOR
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qabstractfunctor.h>
-#include <QSharedPointer>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QT3DRENDERSHARED_EXPORT QBufferFunctor : public QAbstractFunctor
-{
-public:
- virtual ~QBufferFunctor() {}
- virtual QByteArray operator()() = 0;
- virtual bool operator ==(const QBufferFunctor &other) const = 0;
-};
-
-typedef QSharedPointer<QBufferFunctor> QBufferFunctorPtr;
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Qt3DRender::QBufferFunctorPtr)
-
-#endif // QT3DRENDER_QBUFFERFUNCTOR
-
diff --git a/src/render/geometry/qcuboidgeometry.cpp b/src/render/geometry/qcuboidgeometry.cpp
deleted file mode 100644
index e6354d090..000000000
--- a/src/render/geometry/qcuboidgeometry.cpp
+++ /dev/null
@@ -1,822 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcuboidgeometry.h"
-#include "qcuboidgeometry_p.h"
-#include <Qt3DRender/qattribute.h>
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
-#include <Qt3DRender/private/renderlogging_p.h>
-#include <limits>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace {
-
-enum PlaneNormal {
- PositiveX,
- NegativeX,
- PositiveY,
- NegativeY,
- PositiveZ,
- NegativeZ
-};
-
-void createPlaneVertexData(float w, float h, const QSize &resolution,
- PlaneNormal normal, float planeDistance,
- float *vertices)
-{
- const float a0 = -w / 2.0f;
- const float b0 = -h / 2.0f;
- const float da = w / (resolution.width() - 1);
- const float db = h / (resolution.height() - 1);
- const float du = 1.0 / (resolution.width() - 1);
- const float dv = 1.0 / (resolution.height() - 1);
- float n = 1.0f;
-
- switch (normal) {
- case NegativeX:
- n = -1.0f; // fall through
- case PositiveX: {
- // Iterate over z
- for (int j = 0; j < resolution.height(); ++j) {
- const float b = b0 + static_cast<float>(j) * db;
- const float v = static_cast<float>(j) * dv;
-
- // Iterate over y
- for (int i = 0; i < resolution.width(); ++i) {
- const float a = a0 + static_cast<float>(i) * da;
- const float u = static_cast<float>(i) * du;
-
- // position
- *vertices++ = planeDistance;
- *vertices++ = a;
- *vertices++ = b;
-
- // texture coordinates
- *vertices++ = u;
- *vertices++ = v;
-
- // normal
- *vertices++ = n;
- *vertices++ = 0.0f;
- *vertices++ = 0.0f;
-
- // tangent
- *vertices++ = 0.0f;
- *vertices++ = 0.0f;
- *vertices++ = 1.0f;
- *vertices++ = 1.0f;
- }
- }
- break;
- }
-
- case NegativeY:
- n = -1.0f;
- case PositiveY: {
- // Iterate over z
- for (int j = 0; j < resolution.height(); ++j) {
- const float b = b0 + static_cast<float>(j) * db;
- const float v = static_cast<float>(j) * dv;
-
- // Iterate over x
- // This iterates in the opposite sense to the other directions
- // so that the winding order is correct
- for (int i = resolution.width() - 1; i >= 0; --i) {
- const float a = a0 + static_cast<float>(i) * da;
- const float u = static_cast<float>(i) * du;
-
- // position
- *vertices++ = a;
- *vertices++ = planeDistance;
- *vertices++ = b;
-
- // texture coordinates
- *vertices++ = u;
- *vertices++ = v;
-
- // normal
- *vertices++ = 0.0f;
- *vertices++ = n;
- *vertices++ = 0.0f;
-
- // tangent
- *vertices++ = 1.0f;
- *vertices++ = 0.0f;
- *vertices++ = 0.0f;
- *vertices++ = 1.0f;
- }
- }
- break;
- }
-
- case NegativeZ:
- n = -1.0f;
- case PositiveZ: {
- // Iterate over y
- for (int j = 0; j < resolution.height(); ++j) {
- const float b = b0 + static_cast<float>(j) * db;
- const float v = static_cast<float>(j) * dv;
-
- // Iterate over x
- for (int i = 0; i < resolution.width(); ++i) {
- const float a = a0 + static_cast<float>(i) * da;
- const float u = static_cast<float>(i) * du;
-
- // position
- *vertices++ = a;
- *vertices++ = b;
- *vertices++ = planeDistance;
-
- // texture coordinates
- *vertices++ = u;
- *vertices++ = v;
-
- // normal
- *vertices++ = 0.0f;
- *vertices++ = 0.0f;
- *vertices++ = n;
-
- // tangent
- *vertices++ = 1.0f;
- *vertices++ = 0.0f;
- *vertices++ = 0.0f;
- *vertices++ = 1.0f;
- }
- }
- break;
- }
- } // switch (normal)
-}
-
-void createPlaneIndexData(PlaneNormal normal, const QSize &resolution, quint16 *indices, quint16 &baseVertex)
-{
- float n = 1.0f;
-
- switch (normal) {
- case NegativeX:
- case NegativeY:
- case NegativeZ:
- n = -1.0f;
- break;
- default:
- break;
- }
-
- // Populate indices taking care to get correct CCW winding on all faces
- if (n > 0.0f) {
- for (int j = 0; j < resolution.height() - 1; ++j) {
- const int rowStartIndex = j * resolution.width() + baseVertex;
- const int nextRowStartIndex = (j + 1) * resolution.width() + baseVertex;
-
- // Iterate over x
- for (int i = 0; i < resolution.width() - 1; ++i) {
- // Split quad into two triangles
- *indices++ = rowStartIndex + i;
- *indices++ = rowStartIndex + i + 1;
- *indices++ = nextRowStartIndex + i;
-
- *indices++ = nextRowStartIndex + i;
- *indices++ = rowStartIndex + i + 1;
- *indices++ = nextRowStartIndex + i + 1;
- }
- }
- } else {
- for (int j = 0; j < resolution.height() - 1; ++j) {
- const int rowStartIndex = j * resolution.width() + baseVertex;
- const int nextRowStartIndex = (j + 1) * resolution.width() + baseVertex;
-
- // Iterate over x
- for (int i = 0; i < resolution.width() - 1; ++i) {
- // Split quad into two triangles
- *indices++ = rowStartIndex + i;
- *indices++ = nextRowStartIndex + i;
- *indices++ = rowStartIndex + i + 1;
-
- *indices++ = nextRowStartIndex + i;
- *indices++ = nextRowStartIndex + i + 1;
- *indices++ = rowStartIndex + i + 1;
- }
- }
- }
- baseVertex += resolution.width() * resolution.height();
-}
-
-QByteArray createCuboidVertexData(float xExtent,
- float yExtent,
- float zExtent,
- const QSize &yzResolution,
- const QSize &xzResolution,
- const QSize &xyResolution)
-{
- Q_ASSERT(xExtent > 0.0f && yExtent > 0.0f && zExtent > 0.0);
- Q_ASSERT(yzResolution.width() >= 2 && yzResolution.height() >=2);
- Q_ASSERT(xzResolution.width() >= 2 && xzResolution.height() >=2);
- Q_ASSERT(xyResolution.width() >= 2 && xyResolution.height() >=2);
-
- const int yzVerts = yzResolution.width() * yzResolution.height();
- const int xzVerts = xzResolution.width() * xzResolution.height();
- const int xyVerts = xyResolution.width() * xyResolution.height();
- const int nVerts = 2 * (yzVerts + xzVerts + xyVerts);
-
- const quint32 elementSize = 3 + 3 + 2 + 4;
- const quint32 stride = elementSize * sizeof(float);
- QByteArray vertexBytes;
- vertexBytes.resize(stride * nVerts);
- float* vertices = reinterpret_cast<float*>(vertexBytes.data());
-
- createPlaneVertexData(yExtent, zExtent, yzResolution, PositiveX, xExtent * 0.5f, vertices);
- vertices += yzVerts * elementSize;
- createPlaneVertexData(yExtent, zExtent, yzResolution, NegativeX, -xExtent * 0.5f, vertices);
- vertices += yzVerts * elementSize;
- createPlaneVertexData(xExtent, zExtent, xzResolution, PositiveY, yExtent * 0.5f, vertices);
- vertices += xzVerts * elementSize;
- createPlaneVertexData(xExtent, zExtent, xzResolution, NegativeY, -yExtent * 0.5f, vertices);
- vertices += xzVerts * elementSize;
- createPlaneVertexData(xExtent, yExtent, xyResolution, PositiveZ, zExtent * 0.5f, vertices);
- vertices += xyVerts * elementSize;
- createPlaneVertexData(xExtent, yExtent, xyResolution, NegativeZ, -zExtent * 0.5f, vertices);
-
- return vertexBytes;
-}
-
-QByteArray createCuboidIndexData(const QSize &yzResolution,
- const QSize &xzResolution,
- const QSize &xyResolution)
-{
- Q_ASSERT(yzResolution.width() >= 2 && yzResolution.height() >= 2);
- Q_ASSERT(xzResolution.width() >= 2 && xzResolution.height() >= 2);
- Q_ASSERT(xyResolution.width() >= 2 && xyResolution.height() >= 2);
-
- const int yzIndices = 2 * 3 * (yzResolution.width() - 1) * (yzResolution.height() - 1);
- const int xzIndices = 2 * 3 * (xzResolution.width() - 1) * (xzResolution.height() - 1);
- const int xyIndices = 2 * 3 * (xyResolution.width() - 1) * (xyResolution.height() - 1);
- const int indexCount = 2 * (yzIndices + xzIndices + xyIndices);
-
- QByteArray indexData;
- indexData.resize(indexCount * sizeof(quint16));
- quint16 *indices = reinterpret_cast<quint16 *>(indexData.data());
- quint16 baseIndex = 0;
-
- createPlaneIndexData(PositiveX, yzResolution, indices, baseIndex);
- indices += yzIndices;
- createPlaneIndexData(NegativeX, yzResolution, indices, baseIndex);
- indices += yzIndices;
- createPlaneIndexData(PositiveY, xzResolution, indices, baseIndex);
- indices += xzIndices;
- createPlaneIndexData(NegativeY, xzResolution, indices, baseIndex);
- indices += xzIndices;
- createPlaneIndexData(PositiveZ, xyResolution, indices, baseIndex);
- indices += xyIndices;
- createPlaneIndexData(NegativeZ, xyResolution, indices, baseIndex);
-
- return indexData;
-}
-
-} // anonymous
-
-class CuboidVertexBufferFunctor : public QBufferFunctor
-{
-public:
- explicit CuboidVertexBufferFunctor(float xExtent,
- float yExtent,
- float zExtent,
- const QSize &yzResolution,
- const QSize &xzResolution,
- const QSize &xyResolution)
- : m_xExtent(xExtent)
- , m_yExtent(yExtent)
- , m_zExtent(zExtent)
- , m_yzFaceResolution(yzResolution)
- , m_xzFaceResolution(xzResolution)
- , m_xyFaceResolution(xyResolution)
- {}
-
- ~CuboidVertexBufferFunctor() {}
-
- QByteArray operator()() Q_DECL_FINAL
- {
- return createCuboidVertexData(m_xExtent, m_yExtent, m_zExtent,
- m_yzFaceResolution, m_xzFaceResolution, m_xyFaceResolution);
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_FINAL
- {
- const CuboidVertexBufferFunctor *otherFunctor = functor_cast<CuboidVertexBufferFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_xExtent == m_xExtent &&
- otherFunctor->m_yExtent == m_yExtent &&
- otherFunctor->m_zExtent == m_zExtent &&
- otherFunctor->m_yzFaceResolution == m_yzFaceResolution &&
- otherFunctor->m_xzFaceResolution == m_xzFaceResolution &&
- otherFunctor->m_xyFaceResolution == m_xyFaceResolution);
- return false;
- }
-
- QT3D_FUNCTOR(CuboidVertexBufferFunctor)
-
-private:
- float m_xExtent;
- float m_yExtent;
- float m_zExtent;
- QSize m_yzFaceResolution;
- QSize m_xzFaceResolution;
- QSize m_xyFaceResolution;
-};
-
-class CuboidIndexBufferFunctor : public QBufferFunctor
-{
-public:
- explicit CuboidIndexBufferFunctor(const QSize &yzResolution,
- const QSize &xzResolution,
- const QSize &xyResolution)
- : m_yzFaceResolution(yzResolution)
- , m_xzFaceResolution(xzResolution)
- , m_xyFaceResolution(xyResolution)
- {}
-
- ~CuboidIndexBufferFunctor() {}
-
- QByteArray operator()() Q_DECL_FINAL
- {
- return createCuboidIndexData(m_yzFaceResolution, m_xzFaceResolution, m_xyFaceResolution);
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_FINAL
- {
- const CuboidIndexBufferFunctor *otherFunctor = functor_cast<CuboidIndexBufferFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_yzFaceResolution == m_yzFaceResolution &&
- otherFunctor->m_xzFaceResolution == m_xzFaceResolution &&
- otherFunctor->m_xyFaceResolution == m_xyFaceResolution);
- return false;
- }
-
- QT3D_FUNCTOR(CuboidIndexBufferFunctor)
-
-private:
- QSize m_yzFaceResolution;
- QSize m_xzFaceResolution;
- QSize m_xyFaceResolution;
-};
-
-QCuboidGeometryPrivate::QCuboidGeometryPrivate()
- : QGeometryPrivate()
- , m_xExtent(1.0f)
- , m_yExtent(1.0f)
- , m_zExtent(1.0f)
- , m_yzFaceResolution(2, 2)
- , m_xzFaceResolution(2, 2)
- , m_xyFaceResolution(2, 2)
- , m_positionAttribute(Q_NULLPTR)
- , m_normalAttribute(Q_NULLPTR)
- , m_texCoordAttribute(Q_NULLPTR)
- , m_tangentAttribute(Q_NULLPTR)
- , m_indexAttribute(Q_NULLPTR)
- , m_vertexBuffer(Q_NULLPTR)
- , m_indexBuffer(Q_NULLPTR)
-{
-}
-
-void QCuboidGeometryPrivate::init()
-{
- Q_Q(QCuboidGeometry);
- m_positionAttribute = new QAttribute(q);
- m_normalAttribute = new QAttribute(q);
- m_texCoordAttribute = new QAttribute(q);
- m_tangentAttribute = new QAttribute(q);
- m_indexAttribute = new QAttribute(q);
- m_vertexBuffer = new QBuffer(QBuffer::VertexBuffer, q);
- m_indexBuffer = new QBuffer(QBuffer::IndexBuffer, q);
-
- // vec3 pos vec2 tex vec3 normal vec4 tangent
- const quint32 stride = (3 + 2 + 3 + 4) * sizeof(float);
- const int yzIndices = 2 * 3 * (m_yzFaceResolution.width() - 1) * (m_yzFaceResolution.height() - 1);
- const int xzIndices = 2 * 3 * (m_xzFaceResolution.width() - 1) * (m_xzFaceResolution.height() - 1);
- const int xyIndices = 2 * 3 * (m_xyFaceResolution.width() - 1) * (m_xyFaceResolution.height() - 1);
- const int yzVerts = m_yzFaceResolution.width() * m_yzFaceResolution.height();
- const int xzVerts = m_xzFaceResolution.width() * m_xzFaceResolution.height();
- const int xyVerts = m_xyFaceResolution.width() * m_xyFaceResolution.height();
-
- const int nVerts = 2 * (yzVerts + xzVerts + xyVerts);
- const int indexCount = 2 * (yzIndices + xzIndices + xyIndices);
-
- m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
- m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_positionAttribute->setBuffer(m_vertexBuffer);
- m_positionAttribute->setByteStride(stride);
- m_positionAttribute->setCount(nVerts);
-
- m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
- m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_texCoordAttribute->setBuffer(m_vertexBuffer);
- m_texCoordAttribute->setByteStride(stride);
- m_texCoordAttribute->setByteOffset(3 * sizeof(float));
- m_texCoordAttribute->setCount(nVerts);
-
- m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
- m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_normalAttribute->setBuffer(m_vertexBuffer);
- m_normalAttribute->setByteStride(stride);
- m_normalAttribute->setByteOffset(5 * sizeof(float));
- m_normalAttribute->setCount(nVerts);
-
- m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
- m_tangentAttribute->setDataType(QAttribute::Float);
- m_tangentAttribute->setDataSize(4);
- m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_tangentAttribute->setBuffer(m_vertexBuffer);
- m_tangentAttribute->setByteStride(stride);
- m_tangentAttribute->setByteOffset(8 * sizeof(float));
- m_tangentAttribute->setCount(nVerts);
-
- m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
- m_indexAttribute->setBuffer(m_indexBuffer);
-
- m_indexAttribute->setCount(indexCount);
-
- m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new CuboidVertexBufferFunctor(m_xExtent, m_yExtent, m_zExtent,
- m_yzFaceResolution, m_xzFaceResolution, m_xyFaceResolution)));
- m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new CuboidIndexBufferFunctor(m_yzFaceResolution, m_xzFaceResolution, m_xyFaceResolution)));
-
- q->addAttribute(m_positionAttribute);
- q->addAttribute(m_texCoordAttribute);
- q->addAttribute(m_normalAttribute);
- q->addAttribute(m_tangentAttribute);
- q->addAttribute(m_indexAttribute);
-}
-
-/*!
- * \qmltype CuboidGeometry
- * \instantiates Qt3DRender::QCuboidGeometry
- * \inqmlmodule Qt3D.Render
- */
-
-/*!
- * \qmlproperty float CuboidGeometry::xExtent
- *
- * Holds the x extent.
- */
-
-/*!
- * \qmlproperty float CuboidGeometry::yExtent
- *
- * Holds the y extent.
- */
-
-/*!
- * \qmlproperty float CuboidGeometry::zExtent
- *
- * Holds the z extent.
- */
-
-/*!
- * \qmlproperty size CuboidGeometry::yzMeshResolution
- *
- * Holds the y-z resolution.
- */
-
-/*!
- * \qmlproperty size CuboidGeometry::xzMeshResolution
- *
- * Holds the x-z resolution.
- */
-
-/*!
- * \qmlproperty size CuboidGeometry::xyMeshResolution
- *
- * Holds the x-y resolution.
- */
-
-/*!
- * \qmlproperty Attribute CuboidGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-
-/*!
- * \qmlproperty Attribute CuboidGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-
-/*!
- * \qmlproperty Attribute CuboidGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-
-/*!
- * \qmlproperty Attribute CuboidGeometry::tangentAttribute
- *
- * Holds the geometry tangent attribute.
- */
-
-/*!
- * \qmlproperty Attribute CuboidGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-
-/*!
- * \class Qt3DRender::QCuboidGeometry
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometry
- *
- */
-
-/*!
- * Constructs a new QCuboidGeometry with \a parent.
- */
-QCuboidGeometry::QCuboidGeometry(QNode *parent)
- : QGeometry(*new QCuboidGeometryPrivate(), parent)
-{
- Q_D(QCuboidGeometry);
- d->init();
-}
-
-/*!
- * \internal
- */
-QCuboidGeometry::QCuboidGeometry(QCuboidGeometryPrivate &dd, QNode *parent)
- : QGeometry(dd, parent)
-{
- Q_D(QCuboidGeometry);
- d->init();
-}
-
-/*!
- * Destroys this geometry.
- */
-QCuboidGeometry::~QCuboidGeometry()
-{
- QGeometry::cleanup();
-}
-
-/*!
- * Updates indices based on mesh resolutions.
- */
-void QCuboidGeometry::updateIndices()
-{
- Q_D(QCuboidGeometry);
- const int yzIndices = 2 * 3 * (d->m_yzFaceResolution.width() - 1) * (d->m_yzFaceResolution.height() - 1);
- const int xzIndices = 2 * 3 * (d->m_xzFaceResolution.width() - 1) * (d->m_xzFaceResolution.height() - 1);
- const int xyIndices = 2 * 3 * (d->m_xyFaceResolution.width() - 1) * (d->m_xyFaceResolution.height() - 1);
- const int indexCount = 2 * (yzIndices + xzIndices + xyIndices);
-
- d->m_indexAttribute->setCount(indexCount);
- d->m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new CuboidIndexBufferFunctor(d->m_yzFaceResolution, d->m_xzFaceResolution, d->m_xyFaceResolution)));
-
-}
-
-/*!
- * Updates vertices based on mesh resolutions.
- */
-void QCuboidGeometry::updateVertices()
-{
- Q_D(QCuboidGeometry);
- const int yzVerts = d->m_yzFaceResolution.width() * d->m_yzFaceResolution.height();
- const int xzVerts = d->m_xzFaceResolution.width() * d->m_xzFaceResolution.height();
- const int xyVerts = d->m_xyFaceResolution.width() * d->m_xyFaceResolution.height();
- const int nVerts = 2 * (yzVerts + xzVerts + xyVerts);
-
- d->m_positionAttribute->setCount(nVerts);
- d->m_normalAttribute->setCount(nVerts);
- d->m_texCoordAttribute->setCount(nVerts);
- d->m_tangentAttribute->setCount(nVerts);
-
- d->m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new CuboidVertexBufferFunctor(d->m_xExtent, d->m_yExtent, d->m_zExtent,
- d->m_yzFaceResolution, d->m_xzFaceResolution, d->m_xyFaceResolution)));
-}
-
-void QCuboidGeometry::setXExtent(float xExtent)
-{
- Q_D(QCuboidGeometry);
- if (d->m_xExtent != xExtent) {
- d->m_xExtent = xExtent;
- updateVertices();
- emit xExtentChanged(xExtent);
- }
-}
-
-void QCuboidGeometry::setYExtent(float yExtent)
-{
- Q_D(QCuboidGeometry);
- if (d->m_yExtent != yExtent) {
- d->m_yExtent = yExtent;
- updateVertices();
- emit yExtentChanged(yExtent);
- }
-}
-
-void QCuboidGeometry::setZExtent(float zExtent)
-{
- Q_D(QCuboidGeometry);
- if (d->m_zExtent != zExtent) {
- d->m_zExtent = zExtent;
- updateVertices();
- emit zExtentChanged(zExtent);
- }
-}
-
-void QCuboidGeometry::setYZMeshResolution(const QSize &resolution)
-{
- Q_D(QCuboidGeometry);
- if (d->m_yzFaceResolution != resolution) {
- d->m_yzFaceResolution = resolution;
- updateVertices();
- updateIndices();
- emit yzMeshResolutionChanged(resolution);
- }
-}
-
-void QCuboidGeometry::setXZMeshResolution(const QSize &resolution)
-{
- Q_D(QCuboidGeometry);
- if (d->m_xzFaceResolution != resolution) {
- d->m_xzFaceResolution = resolution;
- updateVertices();
- updateIndices();
- emit xzMeshResolutionChanged(resolution);
- }
-}
-
-void QCuboidGeometry::setXYMeshResolution(const QSize &resolution)
-{
- Q_D(QCuboidGeometry);
- if (d->m_xyFaceResolution != resolution) {
- d->m_xyFaceResolution = resolution;
- updateVertices();
- updateIndices();
- emit xyMeshResolutionChanged(resolution);
- }
-}
-
-/*!
- * \property QCuboidGeometry::xExtent
- *
- * Holds the x extent.
- */
-float QCuboidGeometry::xExtent() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_xExtent;
-}
-
-/*!
- * \property QCuboidGeometry::yExtent
- *
- * Holds the y extent.
- */
-float QCuboidGeometry::yExtent() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_yExtent;
-}
-
-/*!
- * \property QCuboidGeometry::zExtent
- *
- * Holds the z extent.
- */
-float QCuboidGeometry::zExtent() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_zExtent;
-}
-
-/*!
- * \property QCuboidGeometry::yzMeshResolution
- *
- * Holds the y-z resolution.
- */
-QSize QCuboidGeometry::yzMeshResolution() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_yzFaceResolution;
-}
-
-/*!
- * \property QCuboidGeometry::xzMeshResolution
- *
- * Holds the x-z resolution.
- */
-QSize QCuboidGeometry::xyMeshResolution() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_xyFaceResolution;
-}
-
-/*!
- * \property QCuboidGeometry::xyMeshResolution
- *
- * Holds the x-y resolution.
- */
-QSize QCuboidGeometry::xzMeshResolution() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_xzFaceResolution;
-}
-
-/*!
- * \property QCuboidGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-QAttribute *QCuboidGeometry::positionAttribute() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_positionAttribute;
-}
-
-/*!
- * \property QCuboidGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-QAttribute *QCuboidGeometry::normalAttribute() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_normalAttribute;
-}
-
-/*!
- * \property QCuboidGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-QAttribute *QCuboidGeometry::texCoordAttribute() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_texCoordAttribute;
-}
-
-/*!
- * \property QCuboidGeometry::tangentAttribute
- *
- * Holds the geometry tangent attribute.
- */
-QAttribute *QCuboidGeometry::tangentAttribute() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_tangentAttribute;
-}
-
-/*!
- * \property QCuboidGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-QAttribute *QCuboidGeometry::indexAttribute() const
-{
- Q_D(const QCuboidGeometry);
- return d->m_indexAttribute;
-}
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qcuboidgeometry.h b/src/render/geometry/qcuboidgeometry.h
deleted file mode 100644
index 6118aa123..000000000
--- a/src/render/geometry/qcuboidgeometry.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QCUBOIDGEOMETRY_H
-#define QT3DRENDER_QCUBOIDGEOMETRY_H
-
-#include <Qt3DRender/qgeometry.h>
-#include <QSize>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QCuboidGeometryPrivate;
-class QAttribute;
-
-class QT3DRENDERSHARED_EXPORT QCuboidGeometry : public QGeometry
-{
- Q_OBJECT
- Q_PROPERTY(float xExtent READ xExtent WRITE setXExtent NOTIFY xExtentChanged)
- Q_PROPERTY(float yExtent READ yExtent WRITE setYExtent NOTIFY yExtentChanged)
- Q_PROPERTY(float zExtent READ zExtent WRITE setZExtent NOTIFY zExtentChanged)
- Q_PROPERTY(QSize xyMeshResolution READ xyMeshResolution WRITE setXYMeshResolution NOTIFY xyMeshResolutionChanged)
- Q_PROPERTY(QSize yzMeshResolution READ yzMeshResolution WRITE setYZMeshResolution NOTIFY yzMeshResolutionChanged)
- Q_PROPERTY(QSize xzMeshResolution READ xzMeshResolution WRITE setXZMeshResolution NOTIFY xzMeshResolutionChanged)
- Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *tangentAttribute READ tangentAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
-
-public:
- explicit QCuboidGeometry(QNode *parent = Q_NULLPTR);
- ~QCuboidGeometry();
-
- void updateIndices();
- void updateVertices();
-
- float xExtent() const;
- float yExtent() const;
- float zExtent() const;
- QSize yzMeshResolution() const;
- QSize xyMeshResolution() const;
- QSize xzMeshResolution() const;
-
- QAttribute *positionAttribute() const;
- QAttribute *normalAttribute() const;
- QAttribute *texCoordAttribute() const;
- QAttribute *tangentAttribute() const;
- QAttribute *indexAttribute() const;
-
-public Q_SLOTS:
- void setXExtent(float xExtent);
- void setYExtent(float yExtent);
- void setZExtent(float zExtent);
- void setYZMeshResolution(const QSize &resolution);
- void setXZMeshResolution(const QSize &resolution);
- void setXYMeshResolution(const QSize &resolution);
-
-Q_SIGNALS:
- void xExtentChanged(float xExtent);
- void yExtentChanged(float yExtent);
- void zExtentChanged(float zExtent);
-
- void yzMeshResolutionChanged(const QSize &yzMeshResolution);
- void xzMeshResolutionChanged(const QSize &xzMeshResolution);
- void xyMeshResolutionChanged(const QSize &xyMeshResolution);
-
-protected:
- QCuboidGeometry(QCuboidGeometryPrivate &dd, QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QCuboidGeometry)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QCUBOIDGEOMETRY_H
diff --git a/src/render/geometry/qcuboidgeometry_p.h b/src/render/geometry/qcuboidgeometry_p.h
deleted file mode 100644
index 34b4ef29d..000000000
--- a/src/render/geometry/qcuboidgeometry_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QCUBOIDGEOMETRY_P_H
-#define QT3DRENDER_QCUBOIDGEOMETRY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qgeometry_p.h>
-#include <QSize>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAttribute;
-class QBuffer;
-
-class QCuboidGeometryPrivate : public QGeometryPrivate
-{
-public:
- QCuboidGeometryPrivate();
- void init();
-
- // Dimensions
- float m_xExtent;
- float m_yExtent;
- float m_zExtent;
-
- // Resolutions of faces with normal x, y, and z
- QSize m_yzFaceResolution;
- QSize m_xzFaceResolution;
- QSize m_xyFaceResolution;
-
- QAttribute *m_positionAttribute;
- QAttribute *m_normalAttribute;
- QAttribute *m_texCoordAttribute;
- QAttribute *m_tangentAttribute;
- QAttribute *m_indexAttribute;
- QBuffer *m_vertexBuffer;
- QBuffer *m_indexBuffer;
-
- Q_DECLARE_PUBLIC(QCuboidGeometry)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QCUBOIDGEOMETRY_P_H
-
diff --git a/src/render/geometry/qcuboidmesh.cpp b/src/render/geometry/qcuboidmesh.cpp
deleted file mode 100644
index 7924308b6..000000000
--- a/src/render/geometry/qcuboidmesh.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcuboidmesh.h"
-#include "qcuboidgeometry.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-/*!
- * \qmltype QCuboidMesh
- * \instantiates Qt3DRender::QCuboidMesh
- * \inqmlmodule Qt3D.Render
- * \brief A cube mesh.
- */
-
-/*!
- * \qmlproperty float CuboidMesh::xExtent
- *
- * Holds the x extent.
- */
-
-/*!
- * \qmlproperty float CuboidMesh::yExtent
- *
- * Holds the y extent.
- */
-
-/*!
- * \qmlproperty float CuboidMesh::zExtent
- *
- * Holds the z extent.
- */
-
-/*!
- * \qmlproperty size CuboidMesh::yzMeshResolution
- *
- * Holds the y-z resolution.
- */
-
-/*!
- * \qmlproperty size CuboidMesh::xzMeshResolution
- *
- * Holds the x-z resolution.
- */
-
-/*!
- * \qmlproperty size CuboidMesh::xyMeshResolution
- *
- * Holds the x-y resolution.
- */
-
-/*!
- * \class Qt3DRender::QCuboidMesh
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometryRenderer
- *
- * \brief A cube mesh.
- */
-
-/*!
- * Constructs a new QCuboidMedh with \a parent.
- */
-QCuboidMesh::QCuboidMesh(QNode *parent)
- : QGeometryRenderer(parent)
-{
- QCuboidGeometry *geometry = new QCuboidGeometry(this);
- QObject::connect(geometry, &QCuboidGeometry::xExtentChanged, this, &QCuboidMesh::xExtentChanged);
- QObject::connect(geometry, &QCuboidGeometry::yExtentChanged, this, &QCuboidMesh::yExtentChanged);
- QObject::connect(geometry, &QCuboidGeometry::zExtentChanged, this, &QCuboidMesh::zExtentChanged);
- QObject::connect(geometry, &QCuboidGeometry::xyMeshResolutionChanged, this, &QCuboidMesh::xyMeshResolutionChanged);
- QObject::connect(geometry, &QCuboidGeometry::xzMeshResolutionChanged, this, &QCuboidMesh::xzMeshResolutionChanged);
- QObject::connect(geometry, &QCuboidGeometry::yzMeshResolutionChanged, this, &QCuboidMesh::yzMeshResolutionChanged);
- QGeometryRenderer::setGeometry(geometry);
-}
-
-/*!
- * Destroys this cube mesh.
- */
-QCuboidMesh::~QCuboidMesh()
-{
- QNode::cleanup();
-}
-
-void QCuboidMesh::setXExtent(float xExtent)
-{
- static_cast<QCuboidGeometry *>(geometry())->setXExtent(xExtent);
-}
-
-/*!
- * \property QCuboidMesh::xExtent
- *
- * Holds the x extent.
- */
-float QCuboidMesh::xExtent() const
-{
- return static_cast<QCuboidGeometry *>(geometry())->xExtent();
-}
-
-void QCuboidMesh::setYExtent(float yExtent)
-{
- static_cast<QCuboidGeometry *>(geometry())->setYExtent(yExtent);
-}
-
-/*!
- * \property QCuboidMesh::yExtent
- *
- * Holds the y extent.
- */
-float QCuboidMesh::yExtent() const
-{
- return static_cast<QCuboidGeometry *>(geometry())->yExtent();
-}
-
-void QCuboidMesh::setZExtent(float zExtent)
-{
- static_cast<QCuboidGeometry *>(geometry())->setZExtent(zExtent);
-}
-
-/*!
- * \property QCuboidMesh::zExtent
- *
- * Holds the z extent.
- */
-float QCuboidMesh::zExtent() const
-{
- return static_cast<QCuboidGeometry *>(geometry())->zExtent();
-}
-
-void QCuboidMesh::setYZMeshResolution(const QSize &resolution)
-{
- static_cast<QCuboidGeometry *>(geometry())->setYZMeshResolution(resolution);
-}
-
-/*!
- * \property QCuboidMesh::yzMeshResolution
- *
- * Holds the y-z resolution.
- */
-QSize QCuboidMesh::yzMeshResolution() const
-{
- return static_cast<QCuboidGeometry *>(geometry())->yzMeshResolution();
-}
-
-void QCuboidMesh::setXZMeshResolution(const QSize &resolution)
-{
- static_cast<QCuboidGeometry *>(geometry())->setXZMeshResolution(resolution);
-}
-
-/*!
- * \property QCuboidMesh::xzMeshResolution
- *
- * Holds the x-z resolution.
- */
-QSize QCuboidMesh::xzMeshResolution() const
-{
- return static_cast<QCuboidGeometry *>(geometry())->xzMeshResolution();
-}
-
-void QCuboidMesh::setXYMeshResolution(const QSize &resolution)
-{
- static_cast<QCuboidGeometry *>(geometry())->setXYMeshResolution(resolution);
-}
-
-/*!
- * \property QCuboidMesh::xyMeshResolution
- *
- * Holds the x-y resolution.
- */
-QSize QCuboidMesh::xyMeshResolution() const
-{
- return static_cast<QCuboidGeometry *>(geometry())->xyMeshResolution();
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qcuboidmesh.h b/src/render/geometry/qcuboidmesh.h
deleted file mode 100644
index ea369cdc4..000000000
--- a/src/render/geometry/qcuboidmesh.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_CUBOIDMESH_H
-#define QT3DRENDER_CUBOIDMESH_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qgeometryrenderer.h>
-#include <QSize>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QT3DRENDERSHARED_EXPORT QCuboidMesh : public QGeometryRenderer
-{
- Q_OBJECT
-
- Q_PROPERTY(float xExtent READ xExtent WRITE setXExtent NOTIFY xExtentChanged)
- Q_PROPERTY(float yExtent READ yExtent WRITE setYExtent NOTIFY yExtentChanged)
- Q_PROPERTY(float zExtent READ zExtent WRITE setZExtent NOTIFY zExtentChanged)
- Q_PROPERTY(QSize yzMeshResolution READ yzMeshResolution WRITE setYZMeshResolution NOTIFY yzMeshResolutionChanged)
- Q_PROPERTY(QSize xzMeshResolution READ xzMeshResolution WRITE setXZMeshResolution NOTIFY xzMeshResolutionChanged)
- Q_PROPERTY(QSize xyMeshResolution READ xyMeshResolution WRITE setXYMeshResolution NOTIFY xyMeshResolutionChanged)
-
-public:
- explicit QCuboidMesh(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QCuboidMesh();
-
- float xExtent() const;
- float yExtent() const;
- float zExtent() const;
- QSize yzMeshResolution() const;
- QSize xzMeshResolution() const;
- QSize xyMeshResolution() const;
-
-public Q_SLOTS:
- void setXExtent(float xExtent);
- void setYExtent(float yExtent);
- void setZExtent(float zExtent);
- void setYZMeshResolution(const QSize &resolution);
- void setXZMeshResolution(const QSize &resolution);
- void setXYMeshResolution(const QSize &resolution);
-
-Q_SIGNALS:
- void xExtentChanged(float xExtent);
- void yExtentChanged(float yExtent);
- void zExtentChanged(float zExtent);
-
- void yzMeshResolutionChanged(const QSize &yzMeshResolution);
- void xzMeshResolutionChanged(const QSize &xzMeshResolution);
- void xyMeshResolutionChanged(const QSize &xyMeshResolution);
-
-private:
- // As this is a default provided geometry renderer, no one should be able
- // to modify the QGeometryRenderer's properties
-
- void setInstanceCount(int instanceCount);
- void setPrimitiveCount(int primitiveCount);
- void setBaseVertex(int baseVertex);
- void setBaseInstance(int baseInstance);
- void setRestartIndex(int index);
- void setPrimitiveRestart(bool enabled);
- void setGeometry(QGeometry *geometry);
- void setPrimitiveType(PrimitiveType primitiveType);
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_CUBOIDMESH_H
diff --git a/src/render/geometry/qcylindergeometry.cpp b/src/render/geometry/qcylindergeometry.cpp
deleted file mode 100644
index 2acd8a75f..000000000
--- a/src/render/geometry/qcylindergeometry.cpp
+++ /dev/null
@@ -1,592 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef _USE_MATH_DEFINES
-# define _USE_MATH_DEFINES // For MSVC
-#endif
-
-#include "qcylindergeometry.h"
-#include "qcylindergeometry_p.h"
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
-#include <Qt3DRender/qattribute.h>
-#include <qmath.h>
-#include <QVector3D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace {
-
-void createSidesVertices(float *&verticesPtr,
- int rings,
- int slices,
- double radius,
- double length)
-{
- const float dY = length / static_cast<float>(rings - 1);
- const float dTheta = (M_PI * 2) / static_cast<float>(slices);
-
- for (int ring = 0; ring < rings; ++ring) {
- const float y = -length / 2.0f + static_cast<float>(ring) * dY;
-
- for (int slice = 0; slice <= slices; ++slice) {
- const float theta = static_cast<float>(slice) * dTheta;
- const float ct = qCos(theta);
- const float st = qSin(theta);
-
- *verticesPtr++ = radius * ct;
- *verticesPtr++ = y;
- *verticesPtr++ = radius * st;
-
- *verticesPtr++ = (y + length / 2.0) / length;
- *verticesPtr++ = theta / (M_PI * 2);
-
- QVector3D n(ct, 0.0f, st);
- n.normalize();
- *verticesPtr++ = n.x();
- *verticesPtr++ = n.y();
- *verticesPtr++ = n.z();
-
- if (slice == slices)
- continue;
- }
- }
-}
-
-void createSidesIndices(quint16 *&indicesPtr, int rings, int slices)
-{
- for (int ring = 0; ring < rings; ++ring) {
- const int ringIndexStart = ring * (slices + 1);
- const int nextRingIndexStart = (ring + 1) * (slices + 1);
-
- for (int slice = 0; slice <= slices; ++slice) {
- if (slice == slices)
- continue;
-
- const int nextSlice = slice + 1;
-
- *indicesPtr++ = (ringIndexStart + slice);
- *indicesPtr++ = (nextRingIndexStart + slice);
- *indicesPtr++ = (ringIndexStart + nextSlice);
- *indicesPtr++ = (ringIndexStart + nextSlice);
- *indicesPtr++ = (nextRingIndexStart + slice);
- *indicesPtr++ = (nextRingIndexStart + nextSlice);
- }
- }
-}
-
-void createDiscVertices(float *&verticesPtr,
- int slices,
- double radius,
- double yPosition)
-{
- const float dTheta = (M_PI * 2) / static_cast<float>(slices);
- const double yNormal = (yPosition < 0.0f) ? -1.0f : 1.0f;
-
- *verticesPtr++ = 0.0f;
- *verticesPtr++ = yPosition;
- *verticesPtr++ = 0.0f;
-
- *verticesPtr++ = 1.0f;
- *verticesPtr++ = 0.0f;
-
- *verticesPtr++ = 0.0f;
- *verticesPtr++ = yNormal;
- *verticesPtr++ = 0.0f;
-
- for (int slice = 0; slice <= slices; ++slice) {
- const float theta = static_cast<float>(slice) * dTheta;
- const float ct = qCos(theta);
- const float st = qSin(theta);
-
- *verticesPtr++ = radius * ct;
- *verticesPtr++ = yPosition;
- *verticesPtr++ = radius * st;
-
- *verticesPtr++ = 1.0f;
- *verticesPtr++ = theta / (M_PI * 2);
-
- *verticesPtr++ = 0.0f;
- *verticesPtr++ = yNormal;
- *verticesPtr++ = 0.0f;
-
- if (slice == slices)
- continue;
- }
-}
-
-void createDiscIndices(quint16 *&indicesPtr,
- int discCenterIndex,
- int slices,
- double yPosition)
-{
- const double yNormal = (yPosition < 0.0f) ? -1.0f : 1.0f;
-
- for (int slice = 0; slice <= slices; ++slice) {
- if (slice == slices)
- continue;
-
- const int nextSlice = slice + 1;
-
- *indicesPtr++ = discCenterIndex;
- *indicesPtr++ = (discCenterIndex + 1 + nextSlice);
- *indicesPtr++ = (discCenterIndex + 1 + slice);
-
- if (yNormal < 0.0f)
- qSwap(*(indicesPtr -1), *(indicesPtr - 2));
- }
-}
-
-} // anonymous
-
-
-class CylinderVertexDataFunctor : public QBufferFunctor
-{
-public:
- CylinderVertexDataFunctor(int rings, int slices, float radius, float length)
- : m_rings(rings)
- , m_slices(slices)
- , m_radius(radius)
- , m_length(length)
- {}
-
- QByteArray operator ()() Q_DECL_OVERRIDE
- {
- const int verticesCount = (m_slices + 1) * m_rings + 2 * (m_slices + 1) + 2;
- // vec3 pos, vec2 texCoord, vec3 normal
- const quint32 vertexSize = (3 + 2 + 3) * sizeof(float);
-
- QByteArray verticesData;
- verticesData.resize(vertexSize * verticesCount);
- float *verticesPtr = reinterpret_cast<float*>(verticesData.data());
-
- createSidesVertices(verticesPtr, m_rings, m_slices, m_radius, m_length);
- createDiscVertices(verticesPtr, m_slices, m_radius, -m_length * 0.5f);
- createDiscVertices(verticesPtr, m_slices, m_radius, m_length * 0.5f);
-
- return verticesData;
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_OVERRIDE
- {
- const CylinderVertexDataFunctor *otherFunctor = functor_cast<CylinderVertexDataFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_rings == m_rings &&
- otherFunctor->m_slices == m_slices &&
- otherFunctor->m_radius == m_radius &&
- otherFunctor->m_length == m_length);
- return false;
- }
-
- QT3D_FUNCTOR(CylinderVertexDataFunctor)
-
-private:
- int m_rings;
- int m_slices;
- float m_radius;
- float m_length;
-};
-
-class CylinderIndexDataFunctor : public QBufferFunctor
-{
-public:
- CylinderIndexDataFunctor(int rings, int slices, float length)
- : m_rings(rings)
- , m_slices(slices)
- , m_length(length)
- {
- }
-
- QByteArray operator ()() Q_DECL_OVERRIDE
- {
- const int facesCount = (m_slices * 2) * m_rings // two tris per side, for all rings
- + m_slices * 2; // two caps
- const int indicesCount = facesCount * 3;
- const int indexSize = sizeof(quint16);
- Q_ASSERT(indicesCount < 65536);
-
- QByteArray indicesBytes;
- indicesBytes.resize(indicesCount * indexSize);
- quint16 *indicesPtr = reinterpret_cast<quint16*>(indicesBytes.data());
-
- createSidesIndices(indicesPtr, m_rings, m_slices);
- createDiscIndices(indicesPtr, m_rings * (m_slices + 1), m_slices, -m_length * 0.5);
- createDiscIndices(indicesPtr, m_rings * (m_slices + 1) + m_slices + 2, m_slices, m_length * 0.5);
-
- return indicesBytes;
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_OVERRIDE
- {
- const CylinderIndexDataFunctor *otherFunctor = functor_cast<CylinderIndexDataFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_rings == m_rings &&
- otherFunctor->m_slices == m_slices &&
- otherFunctor->m_length == m_length);
- return false;
- }
-
- QT3D_FUNCTOR(CylinderIndexDataFunctor)
-
-private:
- int m_rings;
- int m_slices;
- float m_length;
-};
-
-
-QCylinderGeometryPrivate::QCylinderGeometryPrivate()
- : QGeometryPrivate()
- , m_rings(16)
- , m_slices(16)
- , m_radius(1.0f)
- , m_length(1.0f)
- , m_positionAttribute(Q_NULLPTR)
- , m_normalAttribute(Q_NULLPTR)
- , m_texCoordAttribute(Q_NULLPTR)
- , m_indexAttribute(Q_NULLPTR)
- , m_vertexBuffer(Q_NULLPTR)
- , m_indexBuffer(Q_NULLPTR)
-{
-}
-
-void QCylinderGeometryPrivate::init()
-{
- Q_Q(QCylinderGeometry);
- m_positionAttribute = new QAttribute(q);
- m_normalAttribute = new QAttribute(q);
- m_texCoordAttribute = new QAttribute(q);
- m_indexAttribute = new QAttribute(q);
- m_vertexBuffer = new QBuffer(QBuffer::VertexBuffer, q);
- m_indexBuffer = new QBuffer(QBuffer::IndexBuffer, q);
-
- // vec3 pos, vec2 tex, vec3 normal
- const quint32 elementSize = 3 + 2 + 3;
- const quint32 stride = elementSize * sizeof(float);
- const int nVerts = (m_slices + 1) * (m_rings + 1);
- const int faces = (m_slices * 2) * m_rings + (2 * m_slices);
-
- m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
- m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_positionAttribute->setBuffer(m_vertexBuffer);
- m_positionAttribute->setByteStride(stride);
- m_positionAttribute->setCount(nVerts);
-
- m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
- m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_texCoordAttribute->setBuffer(m_vertexBuffer);
- m_texCoordAttribute->setByteStride(stride);
- m_texCoordAttribute->setByteOffset(3 * sizeof(float));
- m_texCoordAttribute->setCount(nVerts);
-
- m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
- m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_normalAttribute->setBuffer(m_vertexBuffer);
- m_normalAttribute->setByteStride(stride);
- m_normalAttribute->setByteOffset(5 * sizeof(float));
- m_normalAttribute->setCount(nVerts);
-
- m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
- m_indexAttribute->setBuffer(m_indexBuffer);
-
- m_indexAttribute->setCount(faces * 3);
-
- m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new CylinderVertexDataFunctor(m_rings, m_slices, m_radius, m_length)));
- m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new CylinderIndexDataFunctor(m_rings, m_slices, m_length)));
-
- q->addAttribute(m_positionAttribute);
- q->addAttribute(m_texCoordAttribute);
- q->addAttribute(m_normalAttribute);
- q->addAttribute(m_indexAttribute);
-}
-
-/*!
- * \qmltype CylinderGeometry
- * \instantiates Qt3DRender::QCylinderGeometry
- * \inqmlmodule Qt3D.Render
- */
-
-/*!
- * \qmlproperty int CylinderGeometry::rings
- *
- * Holds the number of rings in the cylinder.
- */
-
-/*!
- * \qmlproperty int CylinderGeometry::slices
- *
- * Holds the number of slices in the cylinder.
- */
-
-/*!
- * \qmlproperty float CylinderGeometry::radius
- *
- * Holds the radius of the cylinder.
- */
-
-/*!
- * \qmlproperty float CylinderGeometry::length
- *
- * Holds the length of the cylinder.
- */
-
-/*!
- * \qmlproperty Attribute CylinderGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-
-/*!
- * \qmlproperty Attribute CylinderGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-
-/*!
- * \qmlproperty Attribute CylinderGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-
-/*!
- * \qmlproperty Attribute CylinderGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-
-/*!
- * \class Qt3DRender::QCylinderGeometry
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometry
- */
-
-/*!
- * Constructs a new QCylinderMesh with \a parent.
- */
-QCylinderGeometry::QCylinderGeometry(QNode *parent)
- : QGeometry(*new QCylinderGeometryPrivate, parent)
-{
- Q_D(QCylinderGeometry);
- d->init();
-}
-
-/*!
- * \internal
- */
-QCylinderGeometry::QCylinderGeometry(QCylinderGeometryPrivate &dd, QNode *parent)
- :QGeometry(dd, parent)
-{
- Q_D(QCylinderGeometry);
- d->init();
-}
-
-/*!
- * Destroys the geometry.
- */
-QCylinderGeometry::~QCylinderGeometry()
-{
- QGeometry::cleanup();
-}
-
-/*!
- * Updates the vertices based on rings and slices.
- */
-void QCylinderGeometry::updateVertices()
-{
- Q_D(QCylinderGeometry);
- const int nVerts = (d->m_slices + 1) * (d->m_rings + 1);
- d->m_positionAttribute->setCount(nVerts);
- d->m_texCoordAttribute->setCount(nVerts);
- d->m_normalAttribute->setCount(nVerts);
-
- d->m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new CylinderVertexDataFunctor(d->m_rings, d->m_slices, d->m_radius, d->m_length)));
-}
-
-/*!
- * Updates the indices based on rings and slices.
- */
-void QCylinderGeometry::updateIndices()
-{
- Q_D(QCylinderGeometry);
- const int faces = (d->m_slices * 2) * d->m_rings + (2 * d->m_slices);
- d->m_indexAttribute->setCount(faces * 3);
- d->m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new CylinderIndexDataFunctor(d->m_rings, d->m_slices, d->m_length)));
-}
-
-void QCylinderGeometry::setRings(int rings)
-{
- Q_D(QCylinderGeometry);
- if (rings != d->m_rings) {
- d->m_rings = rings;
- updateVertices();
- updateIndices();
- emit ringsChanged(rings);
- }
-}
-
-void QCylinderGeometry::setSlices(int slices)
-{
- Q_D(QCylinderGeometry);
- if (slices != d->m_slices) {
- d->m_slices = slices;
- updateVertices();
- updateIndices();
- emit slicesChanged(slices);
- }
-}
-
-void QCylinderGeometry::setRadius(float radius)
-{
- Q_D(QCylinderGeometry);
- if (radius != d->m_radius) {
- d->m_radius = radius;
- updateVertices();
- emit radiusChanged(radius);
- }
-}
-
-void QCylinderGeometry::setLength(float length)
-{
- Q_D(QCylinderGeometry);
- if (length != d->m_length) {
- d->m_length = length;
- updateVertices();
- updateIndices();
- emit lengthChanged(length);
- }
-}
-
-/*!
- * \property QCylinderGeometry::rings
- *
- * Holds the number of rings in the cylinder.
- */
-int QCylinderGeometry::rings() const
-{
- Q_D(const QCylinderGeometry);
- return d->m_rings;
-}
-
-/*!
- * \property QCylinderGeometry::slices
- *
- * Holds the number of slices in the cylinder.
- */
-int QCylinderGeometry::slices() const
-{
- Q_D(const QCylinderGeometry);
- return d->m_slices;
-}
-
-/*!
- * \property QCylinderGeometry::radius
- *
- * Holds the radius of the cylinder.
- */
-float QCylinderGeometry::radius() const
-{
- Q_D(const QCylinderGeometry);
- return d->m_radius;
-}
-
-/*!
- * \property QCylinderGeometry::length
- *
- * Holds the length of the cylinder.
- */
-float QCylinderGeometry::length() const
-{
- Q_D(const QCylinderGeometry);
- return d->m_length;
-}
-
-/*!
- * \property QCylinderGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-QAttribute *QCylinderGeometry::positionAttribute() const
-{
- Q_D(const QCylinderGeometry);
- return d->m_positionAttribute;
-}
-
-/*!
- * \property QCylinderGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-QAttribute *QCylinderGeometry::normalAttribute() const
-{
- Q_D(const QCylinderGeometry);
- return d->m_normalAttribute;
-}
-
-/*!
- * \property QCylinderGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-QAttribute *QCylinderGeometry::texCoordAttribute() const
-{
- Q_D(const QCylinderGeometry);
- return d->m_texCoordAttribute;
-}
-
-/*!
- * \property QCylinderGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-QAttribute *QCylinderGeometry::indexAttribute() const
-{
- Q_D(const QCylinderGeometry);
- return d->m_indexAttribute;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qcylindergeometry.h b/src/render/geometry/qcylindergeometry.h
deleted file mode 100644
index 24e280928..000000000
--- a/src/render/geometry/qcylindergeometry.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QCYLINDERGEOMETRY_H
-#define QT3DRENDER_QCYLINDERGEOMETRY_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qgeometry.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QCylinderGeometryPrivate;
-class QAttribute;
-
-class QT3DRENDERSHARED_EXPORT QCylinderGeometry : public QGeometry
-{
- Q_OBJECT
- Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
- Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
- Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
-
-public:
- explicit QCylinderGeometry(QNode *parent = Q_NULLPTR);
- ~QCylinderGeometry();
-
- void updateVertices();
- void updateIndices();
-
- int rings() const;
- int slices() const;
- float radius() const;
- float length() const;
-
- QAttribute *positionAttribute() const;
- QAttribute *normalAttribute() const;
- QAttribute *texCoordAttribute() const;
- QAttribute *indexAttribute() const;
-
-public Q_SLOTS:
- void setRings(int rings);
- void setSlices(int slices);
- void setRadius(float radius);
- void setLength(float length);
-
-Q_SIGNALS:
- void radiusChanged(float radius);
- void ringsChanged(int rings);
- void slicesChanged(int slices);
- void lengthChanged(float length);
-
-protected:
- QCylinderGeometry(QCylinderGeometryPrivate &dd, QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QCylinderGeometry)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QCYLINDERGEOMETRY_H
diff --git a/src/render/geometry/qcylindergeometry_p.h b/src/render/geometry/qcylindergeometry_p.h
deleted file mode 100644
index b6aad91c7..000000000
--- a/src/render/geometry/qcylindergeometry_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QCYLINDERGEOMETRY_P_H
-#define QT3DRENDER_QCYLINDERGEOMETRY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qgeometry_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAttribute;
-class QBuffer;
-
-class QCylinderGeometryPrivate : public QGeometryPrivate
-{
-public:
- QCylinderGeometryPrivate();
-
- void init();
-
- Q_DECLARE_PUBLIC(QCylinderGeometry)
-
- int m_rings;
- int m_slices;
- float m_radius;
- float m_length;
- QAttribute *m_positionAttribute;
- QAttribute *m_normalAttribute;
- QAttribute *m_texCoordAttribute;
- QAttribute *m_indexAttribute;
- QBuffer *m_vertexBuffer;
- QBuffer *m_indexBuffer;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QCYLINDERGEOMETRY_P_H
-
diff --git a/src/render/geometry/qcylindermesh.cpp b/src/render/geometry/qcylindermesh.cpp
deleted file mode 100644
index 5893acefc..000000000
--- a/src/render/geometry/qcylindermesh.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef _USE_MATH_DEFINES
-# define _USE_MATH_DEFINES // For MSVC
-#endif
-
-#include "qcylindermesh.h"
-#include "qcylindergeometry.h"
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
-#include <Qt3DRender/qattribute.h>
-#include <qmath.h>
-#include <QVector3D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-/*!
- * \qmltype CylinderMesh
- * \instantiates Qt3DRender::QCylinderMesh
- * \inqmlmodule Qt3D.Render
- * \brief A cylindrical mesh.
- */
-
-/*!
- * \qmlproperty int CylinderMesh::rings
- *
- * Holds the number of rings in the mesh.
- */
-
-/*!
- * \qmlproperty int CylinderMesh::slices
- *
- * Holds the number of slices in the mesh.
- */
-
-/*!
- * \qmlproperty float CylinderMesh::radius
- *
- * Holds the radius of the cylinder.
- */
-
-/*!
- * \qmlproperty float CylinderMesh::length
- *
- * Holds the length of the cylinder.
- */
-
-/*!
- * \class Qt3DRender::QCylinderMesh
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometryRenderer
- *
- * \brief A cylindrical mesh.
- */
-
-/*!
- * Constructs a new QCylinderMesh with \a parent.
- */
-QCylinderMesh::QCylinderMesh(QNode *parent)
- : QGeometryRenderer(parent)
-{
- QCylinderGeometry *geometry = new QCylinderGeometry(this);
- QObject::connect(geometry, &QCylinderGeometry::radiusChanged, this, &QCylinderMesh::radiusChanged);
- QObject::connect(geometry, &QCylinderGeometry::ringsChanged, this, &QCylinderMesh::ringsChanged);
- QObject::connect(geometry, &QCylinderGeometry::slicesChanged, this, &QCylinderMesh::slicesChanged);
- QObject::connect(geometry, &QCylinderGeometry::lengthChanged, this, &QCylinderMesh::lengthChanged);
-
- QGeometryRenderer::setGeometry(geometry);
-}
-
-/*!
- * Destroys this cylinder mesh.
- */
-QCylinderMesh::~QCylinderMesh()
-{
- QNode::cleanup();
-}
-
-void QCylinderMesh::setRings(int rings)
-{
- static_cast<QCylinderGeometry *>(geometry())->setRings(rings);
-}
-
-void QCylinderMesh::setSlices(int slices)
-{
- static_cast<QCylinderGeometry *>(geometry())->setSlices(slices);
-}
-
-void QCylinderMesh::setRadius(float radius)
-{
- static_cast<QCylinderGeometry *>(geometry())->setRadius(radius);
-}
-
-void QCylinderMesh::setLength(float length)
-{
- static_cast<QCylinderGeometry *>(geometry())->setLength(length);
-}
-
-/*!
- * \property QCylinderMesh::rings
- *
- * Holds the number of rings in the mesh.
- */
-int QCylinderMesh::rings() const
-{
- return static_cast<QCylinderGeometry *>(geometry())->rings();
-}
-
-/*!
- * \property QCylinderMesh::slices
- *
- * Holds the number of slices in the mesh.
- */
-int QCylinderMesh::slices() const
-{
- return static_cast<QCylinderGeometry *>(geometry())->slices();
-}
-
-/*!
- * \property QCylinderMesh::radius
- *
- * Holds the radius of the cylinder.
- */
-float QCylinderMesh::radius() const
-{
- return static_cast<QCylinderGeometry *>(geometry())->radius();
-}
-
-/*!
- * \property QCylinderMesh::length
- *
- * Holds the length of the cylinder.
- */
-float QCylinderMesh::length() const
-{
- return static_cast<QCylinderGeometry *>(geometry())->length();
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qcylindermesh.h b/src/render/geometry/qcylindermesh.h
deleted file mode 100644
index 2dcc60b7f..000000000
--- a/src/render/geometry/qcylindermesh.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QCYLINDERMESH_H
-#define QT3DRENDER_QCYLINDERMESH_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qgeometryrenderer.h>
-
-QT_BEGIN_NAMESPACE
-
-
-namespace Qt3DRender {
-
-class QT3DRENDERSHARED_EXPORT QCylinderMesh : public QGeometryRenderer
-{
- Q_OBJECT
- Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
- Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(float length READ length WRITE setLength NOTIFY lengthChanged)
-public:
- explicit QCylinderMesh(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QCylinderMesh();
-
- int rings() const;
- int slices() const;
- float radius() const;
- float length() const;
-
-public Q_SLOTS:
- void setRings(int rings);
- void setSlices(int slices);
- void setRadius(float radius);
- void setLength(float length);
-
-Q_SIGNALS:
- void radiusChanged(float radius);
- void ringsChanged(int rings);
- void slicesChanged(int slices);
- void lengthChanged(float length);
-
-private:
- // As this is a default provided geometry renderer, no one should be able
- // to modify the QGeometryRenderer's properties
-
- void setInstanceCount(int instanceCount);
- void setPrimitiveCount(int primitiveCount);
- void setBaseVertex(int baseVertex);
- void setBaseInstance(int baseInstance);
- void setRestartIndex(int index);
- void setPrimitiveRestart(bool enabled);
- void setGeometry(QGeometry *geometry);
- void setPrimitiveType(PrimitiveType primitiveType);
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QCYLINDERMESH_H
diff --git a/src/render/geometry/qgeometry.cpp b/src/render/geometry/qgeometry.cpp
index b2a7e1671..57222a364 100644
--- a/src/render/geometry/qgeometry.cpp
+++ b/src/render/geometry/qgeometry.cpp
@@ -1,45 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qgeometry.h"
+#include "qgeometryfactory.h"
#include "qgeometry_p.h"
#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qabstractattribute.h>
-#include <Qt3DRender/qboundingvolumespecifier.h>
+#include <Qt3DRender/qattribute.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -47,20 +52,18 @@ using namespace Qt3DCore;
namespace Qt3DRender {
-/*!
- * \internal
- */
-void QGeometryPrivate::_q_boundingVolumeSpecifierChanged(QAbstractAttribute *)
+QGeometryFactory::~QGeometryFactory()
+{
+}
+
+QGeometryPrivate::QGeometryPrivate()
+ : QNodePrivate(),
+ m_boundingVolumePositionAttribute(nullptr)
+{
+}
+
+QGeometryPrivate::~QGeometryPrivate()
{
- if (m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, m_id));
- change->setPropertyName("boundingVolumeSpecifierPositionAttribute");
- Qt3DCore::QNodeId positionAttributeId;
- if (m_boundingVolumeSpecifier.positionAttribute())
- positionAttributeId = m_boundingVolumeSpecifier.positionAttribute()->id();
- change->setValue(QVariant::fromValue(positionAttributeId));
- notifyObservers(change);
- }
}
/*!
@@ -70,15 +73,9 @@ void QGeometryPrivate::_q_boundingVolumeSpecifierChanged(QAbstractAttribute *)
*/
/*!
- * \qmlproperty int Geometry::verticesPerPatch
- *
- * Holds vertices per patch.
- */
-
-/*!
- * \qmlproperty BoundingVolumeSpecifier Geometry::boundingVolumeSpecifier
+ * \qmlproperty QAttribute Geometry::boundingVolumePositionAttribute
*
- * Holds bounding volume specifier.
+ * Holds the property used to compute the bounding volume.
*/
/*!
@@ -93,44 +90,36 @@ void QGeometryPrivate::_q_boundingVolumeSpecifierChanged(QAbstractAttribute *)
* \typedef Qt3DRender::QAttributeList
* \relates Qt3DRender::QGeometry
*
- * A vector of {QAbstractAttribute}s.
+ * A vector of {QAttribute}s.
*/
/*!
* Constructs a new QGeometry with \a parent.
*/
QGeometry::QGeometry(QNode *parent)
- : QNode(*new QGeometryPrivate(), parent)
-{
- Q_D(QGeometry);
- QObject::connect(&d->m_boundingVolumeSpecifier, SIGNAL(positionAttributeChanged(QAbstractAttribute *)),
- this, SLOT(_q_boundingVolumeSpecifierChanged(QAbstractAttribute *)));
-}
+ : QGeometry(*new QGeometryPrivate(), parent) {}
/*!
* \internal
*/
-QGeometry::QGeometry(QGeometryPrivate &dd, QNode *parent)
- : QNode(dd, parent)
+QGeometry::~QGeometry()
{
- Q_D(QGeometry);
- QObject::connect(&d->m_boundingVolumeSpecifier, SIGNAL(positionAttributeChanged(QAbstractAttribute *)),
- this, SLOT(_q_boundingVolumeSpecifierChanged(QAbstractAttribute *)));
}
/*!
- * Destroys this geometry.
+ * \internal
*/
-QGeometry::~QGeometry()
+QGeometry::QGeometry(QGeometryPrivate &dd, QNode *parent)
+ : QNode(dd, parent)
{
- QNode::cleanup();
}
/*!
* Adds an \a attribute to this geometry.
*/
-void QGeometry::addAttribute(QAbstractAttribute *attribute)
+void QGeometry::addAttribute(QAttribute *attribute)
{
+ Q_ASSERT(attribute);
Q_D(QGeometry);
if (!d->m_attributes.contains(attribute)) {
d->m_attributes.append(attribute);
@@ -142,10 +131,9 @@ void QGeometry::addAttribute(QAbstractAttribute *attribute)
if (!attribute->parent())
attribute->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), attribute);
change->setPropertyName("attribute");
- change->setValue(QVariant::fromValue(attribute->id()));
d->notifyObservers(change);
}
}
@@ -154,71 +142,55 @@ void QGeometry::addAttribute(QAbstractAttribute *attribute)
/*!
* Removes the given \a attribute from this geometry.
*/
-void QGeometry::removeAttribute(QAbstractAttribute *attribute)
+void QGeometry::removeAttribute(QAttribute *attribute)
{
+ Q_ASSERT(attribute);
Q_D(QGeometry);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), attribute);
change->setPropertyName("attribute");
- change->setValue(QVariant::fromValue(attribute->id()));
d->notifyObservers(change);
}
d->m_attributes.removeOne(attribute);
}
-void QGeometry::setVerticesPerPatch(int verticesPerPatch)
+void QGeometry::setBoundingVolumePositionAttribute(QAttribute *boundingVolumePositionAttribute)
{
Q_D(QGeometry);
- if (d->m_verticesPerPatch != verticesPerPatch) {
- d->m_verticesPerPatch = verticesPerPatch;
- emit verticesPerPatchChanged(verticesPerPatch);
+ if (d->m_boundingVolumePositionAttribute != boundingVolumePositionAttribute) {
+ d->m_boundingVolumePositionAttribute = boundingVolumePositionAttribute;
+ emit boundingVolumePositionAttributeChanged(boundingVolumePositionAttribute);
}
}
/*!
- * \property QGeometry::verticesPerPatch
+ * \property QGeometry::boundingVolumePositionAttribute
*
- * Holds vertices per patch.
+ * Holds atribute used to compute the bounding volume .
*/
-int QGeometry::verticesPerPatch() const
+QAttribute *QGeometry::boundingVolumePositionAttribute() const
{
Q_D(const QGeometry);
- return d->m_verticesPerPatch;
-}
-
-/*!
- * \property QGeometry::boundingVolumeSpecifier
- *
- * Holds bounding volume specifier.
- */
-QBoundingVolumeSpecifier *QGeometry::boundingVolumeSpecifier()
-{
- Q_D(QGeometry);
- return &d->m_boundingVolumeSpecifier;
+ return d->m_boundingVolumePositionAttribute;
}
/*!
* \return the list of attributes in this geometry.
*/
-QAttributeList QGeometry::attributes() const
+QVector<QAttribute *> QGeometry::attributes() const
{
Q_D(const QGeometry);
return d->m_attributes;
}
-/*!
- * \internal
- */
-void QGeometry::copy(const QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QGeometry::createNodeCreationChange() const
{
- QNode::copy(ref);
- const QGeometry *geometry = static_cast<const QGeometry *>(ref);
- d_func()->m_verticesPerPatch = geometry->d_func()->m_verticesPerPatch;
- Q_FOREACH (QAbstractAttribute *attribute, geometry->d_func()->m_attributes)
- d_func()->m_attributes.append(qobject_cast<QAbstractAttribute *>(QNode::clone(attribute)));
- // Copy bounding volume specifier attribute
- if (geometry->d_func()->m_boundingVolumeSpecifier.positionAttribute() != Q_NULLPTR)
- d_func()->m_boundingVolumeSpecifier.setPositionAttribute(qobject_cast<QAbstractAttribute *>(QNode::clone(geometry->d_func()->m_boundingVolumeSpecifier.positionAttribute())));
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QGeometryData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QGeometry);
+ data.attributeIds = qIdsForNodes(d->m_attributes);
+ data.boundingVolumePositionAttributeId = qIdForNode(d->m_boundingVolumePositionAttribute);
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/geometry/qgeometry.h b/src/render/geometry/qgeometry.h
index e0a22e50a..70fea8cd9 100644
--- a/src/render/geometry/qgeometry.h
+++ b/src/render/geometry/qgeometry.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -44,43 +47,35 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAbstractAttribute;
+class QAttribute;
class QGeometryPrivate;
-class QBoundingVolumeSpecifier;
-
-typedef QVector<QAbstractAttribute *> QAttributeList;
class QT3DRENDERSHARED_EXPORT QGeometry : public Qt3DCore::QNode
{
Q_OBJECT
- Q_PROPERTY(int verticesPerPatch READ verticesPerPatch WRITE setVerticesPerPatch NOTIFY verticesPerPatchChanged)
- Q_PROPERTY(Qt3DRender::QBoundingVolumeSpecifier *boundingVolumeSpecifier READ boundingVolumeSpecifier CONSTANT)
+ Q_PROPERTY(Qt3DRender::QAttribute *boundingVolumePositionAttribute READ boundingVolumePositionAttribute WRITE setBoundingVolumePositionAttribute NOTIFY boundingVolumePositionAttributeChanged)
public:
- explicit QGeometry(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QGeometry(Qt3DCore::QNode *parent = nullptr);
~QGeometry();
- QAttributeList attributes() const;
- void addAttribute(QAbstractAttribute *attribute);
- void removeAttribute(QAbstractAttribute *attribute);
-
- int verticesPerPatch() const;
+ QVector<QAttribute *> attributes() const;
+ void addAttribute(QAttribute *attribute);
+ void removeAttribute(QAttribute *attribute);
- QBoundingVolumeSpecifier *boundingVolumeSpecifier();
+ QAttribute *boundingVolumePositionAttribute() const;
public Q_SLOTS:
- void setVerticesPerPatch(int verticesPerPatch);
+ void setBoundingVolumePositionAttribute(QAttribute *boundingVolumePositionAttribute);
Q_SIGNALS:
- void verticesPerPatchChanged(int verticesPerPatch);
+ void boundingVolumePositionAttributeChanged(QAttribute *boundingVolumePositionAttribute);
protected:
- QGeometry(QGeometryPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QGeometry(QGeometryPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QGeometry)
- QT3D_CLONEABLE(QGeometry)
- Q_PRIVATE_SLOT(d_func(), void _q_boundingVolumeSpecifierChanged(QAbstractAttribute *))
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/geometry/qgeometry_p.h b/src/render/geometry/qgeometry_p.h
index 8f4119d3a..e07b9ff0d 100644
--- a/src/render/geometry/qgeometry_p.h
+++ b/src/render/geometry/qgeometry_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,28 +51,29 @@
// We mean it.
//
+#include <Qt3DRender/private/qt3drender_global_p.h>
#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DRender/qboundingvolumespecifier.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QGeometryPrivate : public Qt3DCore::QNodePrivate
+class QT3DRENDERSHARED_PRIVATE_EXPORT QGeometryPrivate : public Qt3DCore::QNodePrivate
{
public:
Q_DECLARE_PUBLIC(QGeometry)
- QGeometryPrivate()
- : QNodePrivate()
- , m_verticesPerPatch(0)
- {}
+ QGeometryPrivate();
+ ~QGeometryPrivate();
- QAttributeList m_attributes;
- int m_verticesPerPatch;
- QBoundingVolumeSpecifier m_boundingVolumeSpecifier;
-private:
- void _q_boundingVolumeSpecifierChanged(Qt3DRender::QAbstractAttribute *);
+ QVector<QAttribute *> m_attributes;
+ QAttribute *m_boundingVolumePositionAttribute;
+};
+
+struct QGeometryData
+{
+ Qt3DCore::QNodeIdVector attributeIds;
+ Qt3DCore::QNodeId boundingVolumePositionAttributeId;
};
} // namespace Qt3DRender
diff --git a/src/render/geometry/qgeometryfactory.h b/src/render/geometry/qgeometryfactory.h
new file mode 100644
index 000000000..affcc0e52
--- /dev/null
+++ b/src/render/geometry/qgeometryfactory.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QGEOMETRYFACTORY
+#define QT3DRENDER_QGEOMETRYFACTORY
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DRender/qabstractfunctor.h>
+#include <QSharedPointer>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QGeometry;
+
+class QT3DRENDERSHARED_EXPORT QGeometryFactory : public QAbstractFunctor
+{
+public:
+ virtual ~QGeometryFactory();
+ virtual QGeometry *operator()() = 0;
+ virtual bool operator ==(const QGeometryFactory &other) const = 0;
+};
+
+typedef QSharedPointer<QGeometryFactory> QGeometryFactoryPtr;
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::QGeometryFactoryPtr)
+
+#endif // QT3DRENDER_QGEOMETRYFACTORY
+
diff --git a/src/render/geometry/qgeometryfunctor.h b/src/render/geometry/qgeometryfunctor.h
deleted file mode 100644
index 38fe6ebfc..000000000
--- a/src/render/geometry/qgeometryfunctor.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QGEOMETRYFUNCTOR
-#define QT3DRENDER_QGEOMETRYFUNCTOR
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qabstractfunctor.h>
-#include <QSharedPointer>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QGeometry;
-
-class QT3DRENDERSHARED_EXPORT QGeometryFunctor : public QAbstractFunctor
-{
-public:
- virtual ~QGeometryFunctor() {}
- virtual QGeometry *operator()() = 0;
- virtual bool operator ==(const QGeometryFunctor &other) const = 0;
-};
-
-typedef QSharedPointer<QGeometryFunctor> QGeometryFunctorPtr;
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Qt3DRender::QGeometryFunctorPtr)
-
-#endif // QT3DRENDER_QGEOMETRYFUNCTOR
-
diff --git a/src/render/geometry/qgeometryrenderer.cpp b/src/render/geometry/qgeometryrenderer.cpp
index 335c83daa..a714c3155 100644
--- a/src/render/geometry/qgeometryrenderer.cpp
+++ b/src/render/geometry/qgeometryrenderer.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,7 +41,9 @@
#include "qgeometryrenderer_p.h"
#include <private/qcomponent_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -49,16 +54,22 @@ namespace Qt3DRender {
QGeometryRendererPrivate::QGeometryRendererPrivate()
: QComponentPrivate()
, m_instanceCount(1)
- , m_primitiveCount(0)
- , m_baseVertex(0)
- , m_baseInstance(0)
- , m_restartIndex(-1)
+ , m_vertexCount(0)
+ , m_indexOffset(0)
+ , m_firstInstance(0)
+ , m_firstVertex(0)
+ , m_restartIndexValue(-1)
+ , m_verticesPerPatch(0)
, m_primitiveRestart(false)
- , m_geometry(Q_NULLPTR)
+ , m_geometry(nullptr)
, m_primitiveType(QGeometryRenderer::Triangles)
{
}
+QGeometryRendererPrivate::~QGeometryRendererPrivate()
+{
+}
+
/*!
* \qmltype GeometryRenderer
* \instantiates Qt3DRender::QGeometryRenderer
@@ -72,19 +83,25 @@ QGeometryRendererPrivate::QGeometryRendererPrivate()
*/
/*!
- * \qmlproperty int GeometryRenderer::primitiveCount
+ * \qmlproperty int GeometryRenderer::vertexCount
*
- * Holds the primitive count.
+ * Holds the vertex count.
*/
/*!
- * \qmlproperty int GeometryRenderer::baseVertex
+ * \qmlproperty int GeometryRenderer::indexOffset
*
* Holds the base vertex.
*/
/*!
- * \qmlproperty int GeometryRenderer::baseInstance
+ * \qmlproperty int GeometryRenderer::firstInstance
+ *
+ * Holds the first vertex.
+ */
+
+/*!
+ * \qmlproperty int GeometryRenderer::firstVertex
*
* Holds the base instance.
*/
@@ -96,6 +113,12 @@ QGeometryRendererPrivate::QGeometryRendererPrivate()
*/
/*!
+ * \qmlproperty int GeometryRenderer::verticesPerPatch
+ *
+ * Holds vertices per patch.
+ */
+
+/*!
* \qmlproperty bool GeometryRenderer::primitiveRestart
*
* Holds the primitive restart flag.
@@ -149,11 +172,10 @@ QGeometryRenderer::QGeometryRenderer(QNode *parent)
}
/*!
- * Destroys this geometry renderer.
+ * \internal
*/
QGeometryRenderer::~QGeometryRenderer()
{
- QComponent::cleanup();
}
/*!
@@ -176,36 +198,47 @@ int QGeometryRenderer::instanceCount() const
}
/*!
- * \property QGeometryRenderer::primitiveCount
+ * \property QGeometryRenderer::vertexCount
*
* Holds the primitive count.
*/
-int QGeometryRenderer::primitiveCount() const
+int QGeometryRenderer::vertexCount() const
{
Q_D(const QGeometryRenderer);
- return d->m_primitiveCount;
+ return d->m_vertexCount;
}
/*!
- * \property QGeometryRenderer::baseVertex
+ * \property QGeometryRenderer::indexOffset
*
* Holds the base vertex.
*/
-int QGeometryRenderer::baseVertex() const
+int QGeometryRenderer::indexOffset() const
{
Q_D(const QGeometryRenderer);
- return d->m_baseVertex;
+ return d->m_indexOffset;
}
/*!
- * \property QGeometryRenderer::baseInstance
+ * \property QGeometryRenderer::firstInstance
*
* Holds the base instance.
*/
-int QGeometryRenderer::baseInstance() const
+int QGeometryRenderer::firstInstance() const
{
Q_D(const QGeometryRenderer);
- return d->m_baseInstance;
+ return d->m_firstInstance;
+}
+
+/*!
+ * \property QGeometryRenderer::firstVertex
+ *
+ * Holds the base vertex.
+ */
+int QGeometryRenderer::firstVertex() const
+{
+ Q_D(const QGeometryRenderer);
+ return d->m_firstVertex;
}
/*!
@@ -213,10 +246,21 @@ int QGeometryRenderer::baseInstance() const
*
* Holds the restart index.
*/
-int QGeometryRenderer::restartIndex() const
+int QGeometryRenderer::restartIndexValue() const
+{
+ Q_D(const QGeometryRenderer);
+ return d->m_restartIndexValue;
+}
+
+/*!
+ * \property QGeometry::verticesPerPatch
+ *
+ * Holds vertices per patch.
+ */
+int QGeometryRenderer::verticesPerPatch() const
{
Q_D(const QGeometryRenderer);
- return d->m_restartIndex;
+ return d->m_verticesPerPatch;
}
/*!
@@ -224,7 +268,7 @@ int QGeometryRenderer::restartIndex() const
*
* Holds the primitive restart flag.
*/
-bool QGeometryRenderer::primitiveRestart() const
+bool QGeometryRenderer::primitiveRestartEnabled() const
{
Q_D(const QGeometryRenderer);
return d->m_primitiveRestart;
@@ -255,10 +299,10 @@ QGeometryRenderer::PrimitiveType QGeometryRenderer::primitiveType() const
/*!
* \return the geometry functor.
*/
-QGeometryFunctorPtr QGeometryRenderer::geometryFunctor() const
+QGeometryFactoryPtr QGeometryRenderer::geometryFactory() const
{
Q_D(const QGeometryRenderer);
- return d->m_functor;
+ return d->m_geometryFactory;
}
void QGeometryRenderer::setInstanceCount(int instanceCount)
@@ -271,54 +315,73 @@ void QGeometryRenderer::setInstanceCount(int instanceCount)
emit instanceCountChanged(instanceCount);
}
-void QGeometryRenderer::setPrimitiveCount(int primitiveCount)
+void QGeometryRenderer::setVertexCount(int vertexCount)
{
Q_D(QGeometryRenderer);
- if (d->m_primitiveCount == primitiveCount)
+ if (d->m_vertexCount == vertexCount)
return;
- d->m_primitiveCount = primitiveCount;
- emit primitiveCountChanged(primitiveCount);
+ d->m_vertexCount = vertexCount;
+ emit vertexCountChanged(vertexCount);
}
-void QGeometryRenderer::setBaseVertex(int baseVertex)
+void QGeometryRenderer::setIndexOffset(int indexOffset)
{
Q_D(QGeometryRenderer);
- if (d->m_baseVertex == baseVertex)
+ if (d->m_indexOffset == indexOffset)
return;
- d->m_baseVertex = baseVertex;
- emit baseVertexChanged(baseVertex);
+ d->m_indexOffset = indexOffset;
+ emit indexOffsetChanged(indexOffset);
}
-void QGeometryRenderer::setBaseInstance(int baseInstance)
+void QGeometryRenderer::setFirstInstance(int firstInstance)
{
Q_D(QGeometryRenderer);
- if (d->m_baseInstance == baseInstance)
+ if (d->m_firstInstance == firstInstance)
return;
- d->m_baseInstance = baseInstance;
- emit baseInstanceChanged(baseInstance);
+ d->m_firstInstance = firstInstance;
+ emit firstInstanceChanged(firstInstance);
}
-void QGeometryRenderer::setRestartIndex(int index)
+void QGeometryRenderer::setFirstVertex(int firstVertex)
{
Q_D(QGeometryRenderer);
- if (index == d->m_restartIndex)
+ if (d->m_firstVertex == firstVertex)
return;
- d->m_restartIndex = index;
- emit restartIndexChanged(index);
+ d->m_firstVertex = firstVertex;
+ emit firstVertexChanged(firstVertex);
}
-void QGeometryRenderer::setPrimitiveRestart(bool enabled)
+void QGeometryRenderer::setRestartIndexValue(int index)
+{
+ Q_D(QGeometryRenderer);
+ if (index == d->m_restartIndexValue)
+ return;
+
+ d->m_restartIndexValue = index;
+ emit restartIndexValueChanged(index);
+}
+
+void QGeometryRenderer::setVerticesPerPatch(int verticesPerPatch)
+{
+ Q_D(QGeometryRenderer);
+ if (d->m_verticesPerPatch != verticesPerPatch) {
+ d->m_verticesPerPatch = verticesPerPatch;
+ emit verticesPerPatchChanged(verticesPerPatch);
+ }
+}
+
+void QGeometryRenderer::setPrimitiveRestartEnabled(bool enabled)
{
Q_D(QGeometryRenderer);
if (enabled == d->m_primitiveRestart)
return;
d->m_primitiveRestart = enabled;
- emit primitiveRestartChanged(enabled);
+ emit primitiveRestartEnabledChanged(enabled);
}
void QGeometryRenderer::setGeometry(QGeometry *geometry)
@@ -327,10 +390,11 @@ void QGeometryRenderer::setGeometry(QGeometry *geometry)
if (d->m_geometry == geometry)
return;
+ // TODO: Investigate if we can rely upon the automatic property change notifications
+ // rather than having to manually send a PropertyValueRemoved followed by a PropertyValueAdded change.
if (d->m_geometry && d->m_changeArbiter) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), d->m_geometry);
change->setPropertyName("geometry");
- change->setValue(QVariant::fromValue(d->m_geometry->id()));
d->notifyObservers(change);
}
@@ -343,9 +407,8 @@ void QGeometryRenderer::setGeometry(QGeometry *geometry)
blockNotifications(blocked);
if (d->m_geometry && d->m_changeArbiter) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), d->m_geometry);
change->setPropertyName("geometry");
- change->setValue(QVariant::fromValue(d->m_geometry->id()));
d->notifyObservers(change);
}
}
@@ -363,16 +426,16 @@ void QGeometryRenderer::setPrimitiveType(QGeometryRenderer::PrimitiveType primit
/*!
* Sets the geometry \a functor.
*/
-void QGeometryRenderer::setGeometryFunctor(const QGeometryFunctorPtr &functor)
+void QGeometryRenderer::setGeometryFactory(const QGeometryFactoryPtr &factory)
{
Q_D(QGeometryRenderer);
- if (functor && d->m_functor && *functor == *d->m_functor)
+ if (factory && d->m_geometryFactory && *factory == *d->m_geometryFactory)
return;
- d->m_functor = functor;
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
- change->setPropertyName("geometryFunctor");
- change->setValue(QVariant::fromValue(d->m_functor));
+ d->m_geometryFactory = factory;
+ if (d->m_changeArbiter != nullptr) {
+ auto change = QPropertyUpdatedChangePtr::create(d->m_id);
+ change->setPropertyName("geometryFactory");
+ change->setValue(QVariant::fromValue(d->m_geometryFactory));
d->notifyObservers(change);
}
}
@@ -380,39 +443,34 @@ void QGeometryRenderer::setGeometryFunctor(const QGeometryFunctorPtr &functor)
/*!
* \internal
*/
-void QGeometryRenderer::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QGeometryRenderer *other = static_cast<const QGeometryRenderer *>(ref);
- d_func()->m_instanceCount = other->d_func()->m_instanceCount;
- d_func()->m_primitiveCount = other->d_func()->m_primitiveCount;
- d_func()->m_baseVertex = other->d_func()->m_baseVertex;
- d_func()->m_baseInstance = other->d_func()->m_baseInstance;
- d_func()->m_restartIndex = other->d_func()->m_restartIndex;
- d_func()->m_primitiveRestart = other->d_func()->m_primitiveRestart;
- d_func()->m_primitiveType = other->d_func()->m_primitiveType;
- d_func()->m_geometry = static_cast<QGeometry *>(QNode::clone(other->d_func()->m_geometry));
- d_func()->m_functor = other->d_func()->m_functor;
-}
-
-/*!
- * \internal
- */
void QGeometryRenderer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- Q_D(QGeometryRenderer);
- QScenePropertyChangePtr change = qSharedPointerCast<QScenePropertyChange>(e);
- if (change->type() == NodeUpdated && change->propertyName() == QByteArrayLiteral("geometry")) {
- QNodePtr nodePtr = change->value().value<QNodePtr>();
- QGeometry *backendGeometry = static_cast<QGeometry *>(nodePtr.data());
- QGeometry *frontendGeometry = static_cast<QGeometry *>(QNode::clone(backendGeometry));
- if (frontendGeometry != Q_NULLPTR)
- d->insertTree(frontendGeometry);
- setGeometry(frontendGeometry);
+ auto change = qSharedPointerCast<QStaticPropertyUpdatedChangeBase>(e);
+ if (change->type() == PropertyUpdated && change->propertyName() == QByteArrayLiteral("geometry")) {
+ auto typedChange = qSharedPointerCast<QGeometryChange>(e);
+ auto geometry = std::move(typedChange->data);
+ setGeometry(geometry.release());
}
}
-
+Qt3DCore::QNodeCreatedChangeBasePtr QGeometryRenderer::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QGeometryRendererData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QGeometryRenderer);
+ data.instanceCount = d->m_instanceCount;
+ data.vertexCount = d->m_vertexCount;
+ data.indexOffset = d->m_indexOffset;
+ data.firstInstance = d->m_firstInstance;
+ data.firstVertex = d->m_firstVertex;
+ data.restartIndexValue = d->m_restartIndexValue;
+ data.verticesPerPatch = d->m_verticesPerPatch;
+ data.primitiveRestart = d->m_primitiveRestart;
+ data.geometryId = qIdForNode(d->m_geometry);
+ data.primitiveType = d->m_primitiveType;
+ data.geometryFactory = d->m_geometryFactory;
+ return creationChange;
+}
} // namespace Qt3DRender
diff --git a/src/render/geometry/qgeometryrenderer.h b/src/render/geometry/qgeometryrenderer.h
index 290d13b29..be3bb6146 100644
--- a/src/render/geometry/qgeometryrenderer.h
+++ b/src/render/geometry/qgeometryrenderer.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -46,24 +49,26 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QGeometryRendererPrivate;
-class QGeometryFunctor;
+class QGeometryFactory;
-typedef QSharedPointer<QGeometryFunctor> QGeometryFunctorPtr;
+typedef QSharedPointer<QGeometryFactory> QGeometryFactoryPtr;
class QT3DRENDERSHARED_EXPORT QGeometryRenderer : public Qt3DCore::QComponent
{
Q_OBJECT
Q_PROPERTY(int instanceCount READ instanceCount WRITE setInstanceCount NOTIFY instanceCountChanged)
- Q_PROPERTY(int primitiveCount READ primitiveCount WRITE setPrimitiveCount NOTIFY primitiveCountChanged)
- Q_PROPERTY(int baseVertex READ baseVertex WRITE setBaseVertex NOTIFY baseVertexChanged)
- Q_PROPERTY(int baseInstance READ baseInstance WRITE setBaseInstance NOTIFY baseInstanceChanged)
- Q_PROPERTY(int restartIndex READ restartIndex WRITE setRestartIndex NOTIFY restartIndexChanged)
- Q_PROPERTY(bool primitiveRestart READ primitiveRestart WRITE setPrimitiveRestart NOTIFY primitiveRestartChanged)
+ Q_PROPERTY(int vertexCount READ vertexCount WRITE setVertexCount NOTIFY vertexCountChanged)
+ Q_PROPERTY(int indexOffset READ indexOffset WRITE setIndexOffset NOTIFY indexOffsetChanged)
+ Q_PROPERTY(int firstInstance READ firstInstance WRITE setFirstInstance NOTIFY firstInstanceChanged)
+ Q_PROPERTY(int firstVertex READ firstVertex WRITE setFirstVertex NOTIFY firstVertexChanged)
+ Q_PROPERTY(int restartIndexValue READ restartIndexValue WRITE setRestartIndexValue NOTIFY restartIndexValueChanged)
+ Q_PROPERTY(int verticesPerPatch READ verticesPerPatch WRITE setVerticesPerPatch NOTIFY verticesPerPatchChanged)
+ Q_PROPERTY(bool primitiveRestartEnabled READ primitiveRestartEnabled WRITE setPrimitiveRestartEnabled NOTIFY primitiveRestartEnabledChanged)
Q_PROPERTY(Qt3DRender::QGeometry* geometry READ geometry WRITE setGeometry NOTIFY geometryChanged)
Q_PROPERTY(PrimitiveType primitiveType READ primitiveType WRITE setPrimitiveType NOTIFY primitiveTypeChanged)
public:
- explicit QGeometryRenderer(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QGeometryRenderer(Qt3DCore::QNode *parent = nullptr);
~QGeometryRenderer();
enum PrimitiveType {
@@ -86,45 +91,50 @@ public:
// also how to figure out which attribute(s?) hold the indices?
int instanceCount() const;
- int primitiveCount() const;
- int baseVertex() const;
- int baseInstance() const;
- int restartIndex() const;
- bool primitiveRestart() const;
+ int vertexCount() const;
+ int indexOffset() const;
+ int firstInstance() const;
+ int firstVertex() const;
+ int restartIndexValue() const;
+ int verticesPerPatch() const;
+ bool primitiveRestartEnabled() const;
QGeometry *geometry() const;
PrimitiveType primitiveType() const;
- QGeometryFunctorPtr geometryFunctor() const;
- void setGeometryFunctor(const QGeometryFunctorPtr &functor);
+ QGeometryFactoryPtr geometryFactory() const;
+ void setGeometryFactory(const QGeometryFactoryPtr &factory);
public Q_SLOTS:
void setInstanceCount(int instanceCount);
- void setPrimitiveCount(int primitiveCount);
- void setBaseVertex(int baseVertex);
- void setBaseInstance(int baseInstance);
- void setRestartIndex(int index);
- void setPrimitiveRestart(bool enabled);
+ void setVertexCount(int vertexCount);
+ void setIndexOffset(int indexOffset);
+ void setFirstInstance(int firstInstance);
+ void setFirstVertex(int firstVertex);
+ void setRestartIndexValue(int index);
+ void setVerticesPerPatch(int verticesPerPatch);
+ void setPrimitiveRestartEnabled(bool enabled);
void setGeometry(QGeometry *geometry);
void setPrimitiveType(PrimitiveType primitiveType);
Q_SIGNALS:
void instanceCountChanged(int instanceCount);
- void primitiveCountChanged(int primitiveCount);
- void baseVertexChanged(int baseVertex);
- void baseInstanceChanged(int baseInstance);
- void restartIndexChanged(int restartIndex);
- void primitiveRestartChanged(bool primitiveRestart);
+ void vertexCountChanged(int vertexCount);
+ void indexOffsetChanged(int indexOffset);
+ void firstInstanceChanged(int firstInstance);
+ void firstVertexChanged(int firstVertex);
+ void restartIndexValueChanged(int restartIndexValue);
+ void verticesPerPatchChanged(int verticesPerPatch);
+ void primitiveRestartEnabledChanged(bool primitiveRestartEnabled);
void geometryChanged(QGeometry *geometry);
void primitiveTypeChanged(PrimitiveType primitiveType);
protected:
- QGeometryRenderer(QGeometryRendererPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QGeometryRenderer(QGeometryRendererPrivate &dd, Qt3DCore::QNode *parent = nullptr);
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QGeometryRenderer)
- QT3D_CLONEABLE(QGeometryRenderer)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/geometry/qgeometryrenderer_p.h b/src/render/geometry/qgeometryrenderer_p.h
index d6e34e4da..622cfb254 100644
--- a/src/render/geometry/qgeometryrenderer_p.h
+++ b/src/render/geometry/qgeometryrenderer_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,9 @@
#include <Qt3DCore/private/qcomponent_p.h>
#include <Qt3DRender/qgeometryrenderer.h>
-#include <Qt3DRender/qgeometryfunctor.h>
+#include <Qt3DRender/qgeometryfactory.h>
+#include <Qt3DCore/private/qtypedpropertyupdatechange_p.h>
+#include <memory>
QT_BEGIN_NAMESPACE
@@ -60,19 +65,42 @@ class QGeometryRendererPrivate : public Qt3DCore::QComponentPrivate
{
public:
QGeometryRendererPrivate();
+ ~QGeometryRendererPrivate();
+
Q_DECLARE_PUBLIC(QGeometryRenderer)
int m_instanceCount;
- int m_primitiveCount;
- int m_baseVertex;
- int m_baseInstance;
- int m_restartIndex;
+ int m_vertexCount;
+ int m_indexOffset;
+ int m_firstInstance;
+ int m_firstVertex;
+ int m_restartIndexValue;
+ int m_verticesPerPatch;
bool m_primitiveRestart;
QGeometry *m_geometry;
QGeometryRenderer::PrimitiveType m_primitiveType;
- QGeometryFunctorPtr m_functor;
+ QGeometryFactoryPtr m_geometryFactory;
};
+struct QGeometryRendererData
+{
+ int instanceCount;
+ int vertexCount;
+ int indexOffset;
+ int firstInstance;
+ int firstVertex;
+ int restartIndexValue;
+ int verticesPerPatch;
+ bool primitiveRestart;
+ Qt3DCore::QNodeId geometryId;
+ QGeometryRenderer::PrimitiveType primitiveType;
+ QGeometryFactoryPtr geometryFactory;
+};
+
+class QGeometry;
+typedef Qt3DCore::QTypedPropertyUpdatedChange<std::unique_ptr<QGeometry>> QGeometryChange;
+typedef Qt3DCore::QTypedPropertyUpdatedChangePtr<std::unique_ptr<QGeometry>> QGeometryChangePtr;
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/geometry/qmesh.cpp b/src/render/geometry/qmesh.cpp
index b36f3c444..0d4faf2f8 100644
--- a/src/render/geometry/qmesh.cpp
+++ b/src/render/geometry/qmesh.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -41,7 +44,7 @@
#include <QFile>
#include <QFileInfo>
#include <Qt3DRender/private/objloader_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DRender/private/qurlhelper_p.h>
@@ -49,17 +52,17 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class MeshFunctor : public QGeometryFunctor
+class MeshFunctor : public QGeometryFactory
{
public :
- MeshFunctor(const QUrl &sourcePath, const QString &subMesh = QString());
+ MeshFunctor(const QUrl &sourcePath, const QString &meshName = QString());
QGeometry *operator()() Q_DECL_OVERRIDE;
- bool operator ==(const QGeometryFunctor &other) const Q_DECL_OVERRIDE;
+ bool operator ==(const QGeometryFactory &other) const Q_DECL_OVERRIDE;
QT3D_FUNCTOR(MeshFunctor)
private:
QUrl m_sourcePath;
- QString m_subMesh;
+ QString m_meshName;
};
@@ -104,12 +107,9 @@ QMesh::QMesh(QNode *parent)
{
}
-/*!
- * Destroys this mesh.
- */
+/*! \internal */
QMesh::~QMesh()
{
- QNode::cleanup();
}
/*! \internal */
@@ -125,7 +125,7 @@ void QMesh::setSource(const QUrl& source)
return;
d->m_source = source;
// update the functor
- QGeometryRenderer::setGeometryFunctor(QGeometryFunctorPtr(new MeshFunctor(d->m_source, d->m_subMesh)));
+ QGeometryRenderer::setGeometryFactory(QGeometryFactoryPtr(new MeshFunctor(d->m_source, d->m_meshName)));
emit sourceChanged(source);
}
@@ -140,15 +140,15 @@ QUrl QMesh::source() const
return d->m_source;
}
-void QMesh::setSubMesh(const QString &subMesh)
+void QMesh::setMeshName(const QString &meshName)
{
Q_D(QMesh);
- if (d->m_subMesh == subMesh)
+ if (d->m_meshName == meshName)
return;
- d->m_subMesh = subMesh;
+ d->m_meshName = meshName;
// update the functor
- QGeometryRenderer::setGeometryFunctor(QGeometryFunctorPtr(new MeshFunctor(d->m_source, d->m_subMesh)));
- emit subMeshChanged(subMesh);
+ QGeometryRenderer::setGeometryFactory(QGeometryFactoryPtr(new MeshFunctor(d->m_source, d->m_meshName)));
+ emit meshNameChanged(meshName);
}
/*!
@@ -156,19 +156,19 @@ void QMesh::setSubMesh(const QString &subMesh)
*
* Holds the subMesh for the mesh.
*/
-QString QMesh::subMesh() const
+QString QMesh::meshName() const
{
Q_D(const QMesh);
- return d->m_subMesh;
+ return d->m_meshName;
}
/*!
* \internal
*/
-MeshFunctor::MeshFunctor(const QUrl &sourcePath, const QString& subMesh)
- : QGeometryFunctor()
+MeshFunctor::MeshFunctor(const QUrl &sourcePath, const QString& meshName)
+ : QGeometryFactory()
, m_sourcePath(sourcePath)
- , m_subMesh(subMesh)
+ , m_meshName(meshName)
{
}
@@ -179,33 +179,33 @@ QGeometry *MeshFunctor::operator()()
{
if (m_sourcePath.isEmpty()) {
qCWarning(Render::Jobs) << Q_FUNC_INFO << "Mesh is empty, nothing to load";
- return Q_NULLPTR;
+ return nullptr;
}
// TO DO : Maybe use Assimp instead of ObjLoader to handle more sources
ObjLoader loader;
loader.setLoadTextureCoordinatesEnabled(true);
loader.setTangentGenerationEnabled(true);
- qCDebug(Render::Jobs) << Q_FUNC_INFO << "Loading mesh from" << m_sourcePath << " part:" << m_subMesh;
+ qCDebug(Render::Jobs) << Q_FUNC_INFO << "Loading mesh from" << m_sourcePath << " part:" << m_meshName;
// TO DO: Handle file download if remote url
QString filePath = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_sourcePath);
- if (loader.load(filePath, m_subMesh))
+ if (loader.load(filePath, m_meshName))
return loader.geometry();
qCWarning(Render::Jobs) << Q_FUNC_INFO << "OBJ load failure for:" << filePath;
- return Q_NULLPTR;
+ return nullptr;
}
/*!
* \internal
*/
-bool MeshFunctor::operator ==(const QGeometryFunctor &other) const
+bool MeshFunctor::operator ==(const QGeometryFactory &other) const
{
const MeshFunctor *otherFunctor = functor_cast<MeshFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
+ if (otherFunctor != nullptr)
return (otherFunctor->m_sourcePath == m_sourcePath);
return false;
}
diff --git a/src/render/geometry/qmesh.h b/src/render/geometry/qmesh.h
index 072ad2dd2..fab76a249 100644
--- a/src/render/geometry/qmesh.h
+++ b/src/render/geometry/qmesh.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,25 +58,25 @@ class QT3DRENDERSHARED_EXPORT QMesh : public QGeometryRenderer
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(QString subMesh READ subMesh WRITE setSubMesh NOTIFY subMeshChanged)
+ Q_PROPERTY(QString meshName READ meshName WRITE setMeshName NOTIFY meshNameChanged)
public:
- explicit QMesh(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QMesh(Qt3DCore::QNode *parent = nullptr);
~QMesh();
QUrl source() const;
- QString subMesh() const;
+ QString meshName() const;
public Q_SLOTS:
void setSource(const QUrl &source);
- void setSubMesh(const QString &subMesh);
+ void setMeshName(const QString &meshName);
Q_SIGNALS:
void sourceChanged(const QUrl &source);
- void subMeshChanged(const QString &subMesh);
+ void meshNameChanged(const QString &meshName);
protected:
- QMesh(QMeshPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QMesh(QMeshPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QMesh)
diff --git a/src/render/geometry/qmesh_p.h b/src/render/geometry/qmesh_p.h
index 59772bbb8..c9a6cc1e8 100644
--- a/src/render/geometry/qmesh_p.h
+++ b/src/render/geometry/qmesh_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,7 +68,7 @@ public:
Q_DECLARE_PUBLIC(QMesh)
QUrl m_source;
- QString m_subMesh;
+ QString m_meshName;
};
} // namespace Qt3DRender
diff --git a/src/render/geometry/qplanegeometry.cpp b/src/render/geometry/qplanegeometry.cpp
deleted file mode 100644
index 57ca9b7d5..000000000
--- a/src/render/geometry/qplanegeometry.cpp
+++ /dev/null
@@ -1,524 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplanegeometry.h"
-#include "qplanegeometry_p.h"
-#include <Qt3DRender/qattribute.h>
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
-#include <limits>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace {
-
-QByteArray createPlaneVertexData(float w, float h, const QSize &resolution)
-{
- Q_ASSERT(w > 0.0f);
- Q_ASSERT(h > 0.0f);
- Q_ASSERT(resolution.width() >= 2);
- Q_ASSERT(resolution.height() >= 2);
-
- const int nVerts = resolution.width() * resolution.height();
-
- // Populate a buffer with the interleaved per-vertex data with
- // vec3 pos, vec2 texCoord, vec3 normal, vec4 tangent
- const quint32 elementSize = 3 + 2 + 3 + 4;
- const quint32 stride = elementSize * sizeof(float);
- QByteArray bufferBytes;
- bufferBytes.resize(stride * nVerts);
- float* fptr = reinterpret_cast<float*>(bufferBytes.data());
-
- const float x0 = -w / 2.0f;
- const float z0 = -h / 2.0f;
- const float dx = w / (resolution.width() - 1);
- const float dz = h / (resolution.height() - 1);
- const float du = 1.0 / (resolution.width() - 1);
- const float dv = 1.0 / (resolution.height() - 1);
-
- // Iterate over z
- for (int j = 0; j < resolution.height(); ++j) {
- const float z = z0 + static_cast<float>(j) * dz;
- const float v = static_cast<float>(j) * dv;
-
- // Iterate over x
- for (int i = 0; i < resolution.width(); ++i) {
- const float x = x0 + static_cast<float>(i) * dx;
- const float u = static_cast<float>(i) * du;
-
- // position
- *fptr++ = x;
- *fptr++ = 0.0;
- *fptr++ = z;
-
- // texture coordinates
- *fptr++ = u;
- *fptr++ = v;
-
- // normal
- *fptr++ = 0.0f;
- *fptr++ = 1.0f;
- *fptr++ = 0.0f;
-
- // tangent
- *fptr++ = 1.0f;
- *fptr++ = 0.0f;
- *fptr++ = 0.0f;
- *fptr++ = 1.0f;
- }
- }
-
- return bufferBytes;
-}
-
-QByteArray createPlaneIndexData(const QSize &resolution)
-{
- // Create the index data. 2 triangles per rectangular face
- const int faces = 2 * (resolution.width() - 1) * (resolution.height() - 1);
- const int indices = 3 * faces;
- Q_ASSERT(indices < std::numeric_limits<quint16>::max());
- QByteArray indexBytes;
- indexBytes.resize(indices * sizeof(quint16));
- quint16* indexPtr = reinterpret_cast<quint16*>(indexBytes.data());
-
- // Iterate over z
- for (int j = 0; j < resolution.height() - 1; ++j) {
- const int rowStartIndex = j * resolution.width();
- const int nextRowStartIndex = (j + 1) * resolution.width();
-
- // Iterate over x
- for (int i = 0; i < resolution.width() - 1; ++i) {
- // Split quad into two triangles
- *indexPtr++ = rowStartIndex + i;
- *indexPtr++ = nextRowStartIndex + i;
- *indexPtr++ = rowStartIndex + i + 1;
-
- *indexPtr++ = nextRowStartIndex + i;
- *indexPtr++ = nextRowStartIndex + i + 1;
- *indexPtr++ = rowStartIndex + i + 1;
- }
- }
-
- return indexBytes;
-}
-
-} // anonymous
-
-class PlaneVertexBufferFunctor : public QBufferFunctor
-{
-public:
- explicit PlaneVertexBufferFunctor(float w, float h, const QSize &resolution)
- : m_width(w)
- , m_height(h)
- , m_resolution(resolution)
- {}
-
- ~PlaneVertexBufferFunctor() {}
-
- QByteArray operator()() Q_DECL_FINAL
- {
- return createPlaneVertexData(m_width, m_height, m_resolution);
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_FINAL
- {
- const PlaneVertexBufferFunctor *otherFunctor = functor_cast<PlaneVertexBufferFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_width == m_width &&
- otherFunctor->m_height == m_height &&
- otherFunctor->m_resolution == m_resolution);
- return false;
- }
-
- QT3D_FUNCTOR(PlaneVertexBufferFunctor)
-
- private:
- float m_width;
- float m_height;
- QSize m_resolution;
-};
-
-class PlaneIndexBufferFunctor : public QBufferFunctor
-{
-public:
- explicit PlaneIndexBufferFunctor(const QSize &resolution)
- : m_resolution(resolution)
- {}
-
- ~PlaneIndexBufferFunctor() {}
-
- QByteArray operator()() Q_DECL_FINAL
- {
- return createPlaneIndexData(m_resolution);
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_FINAL
- {
- const PlaneIndexBufferFunctor *otherFunctor = functor_cast<PlaneIndexBufferFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_resolution == m_resolution);
- return false;
- }
-
- QT3D_FUNCTOR(PlaneIndexBufferFunctor)
-
- private:
- QSize m_resolution;
-};
-
-/*!
- * \qmltype PlaneGeometry
- * \instantiates Qt3DRender::QPlaneGeometry
- * \inqmlmodule Qt3D.Render
- */
-
-/*!
- * \qmlproperty float PlaneGeometry::width
- *
- * Holds the plane width.
- */
-
-/*!
- * \qmlproperty float PlaneGeometry::height
- *
- * Holds the plane height.
- */
-
-/*!
- * \qmlproperty size PlaneGeometry::resolution
- *
- * Holds the plane resolution.
- */
-
-/*!
- * \qmlproperty Attribute PlaneGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-
-/*!
- * \qmlproperty Attribute PlaneGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-
-/*!
- * \qmlproperty Attribute PlaneGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-
-/*!
- * \qmlproperty Attribute PlaneGeometry::tangentAttribute
- *
- * Holds the geometry tangent attribute.
- */
-
-/*!
- * \qmlproperty Attribute PlaneGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-
-/*!
- * \class Qt3DRender::QPlaneGeometry
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometry
- */
-
-/*!
- * Constructs a new QPlaneGeometry with \a parent.
- */
-QPlaneGeometry::QPlaneGeometry(QPlaneGeometry::QNode *parent)
- : QGeometry(*new QPlaneGeometryPrivate(), parent)
-{
- Q_D(QPlaneGeometry);
- d->init();
-}
-
-/*!
- * \internal
- */
-QPlaneGeometry::QPlaneGeometry(QPlaneGeometryPrivate &dd, QNode *parent)
- : QGeometry(dd, parent)
-{
- Q_D(QPlaneGeometry);
- d->init();
-}
-
-/*!
- * Destroys this geometry.
- */
-QPlaneGeometry::~QPlaneGeometry()
-{
- QGeometry::cleanup();
-}
-
-/*!
- * Updates vertices based on resolution.
- */
-void QPlaneGeometry::updateVertices()
-{
- Q_D(QPlaneGeometry);
- const int nVerts = d->m_meshResolution.width() * d->m_meshResolution.height();
-
- d->m_positionAttribute->setCount(nVerts);
- d->m_normalAttribute->setCount(nVerts);
- d->m_texCoordAttribute->setCount(nVerts);
- d->m_tangentAttribute->setCount(nVerts);
- d->m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new PlaneVertexBufferFunctor(d->m_width, d->m_height, d->m_meshResolution)));
-}
-
-/*!
- * Updates indices based on resolution.
- */
-void QPlaneGeometry::updateIndices()
-{
- Q_D(QPlaneGeometry);
- const int faces = 2 * (d->m_meshResolution.width() - 1) * (d->m_meshResolution.height() - 1);
- // Each primitive has 3 vertices
- d->m_indexAttribute->setCount(faces * 3);
- d->m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new PlaneIndexBufferFunctor(d->m_meshResolution)));
-
-}
-
-void QPlaneGeometry::setResolution(const QSize &resolution)
-{
- Q_D(QPlaneGeometry);
- if (d->m_meshResolution == resolution)
- return;
- d->m_meshResolution = resolution;
- updateVertices();
- updateIndices();
- emit resolutionChanged(resolution);
-}
-
-void QPlaneGeometry::setWidth(float width)
-{
- Q_D(QPlaneGeometry);
- if (width == d->m_width)
- return;
- d->m_width = width;
- updateVertices();
- emit widthChanged(width);
-}
-
-void QPlaneGeometry::setHeight(float height)
-{
- Q_D(QPlaneGeometry);
- if (height == d->m_height)
- return;
- d->m_height = height;
- updateVertices();
- emit heightChanged(height);
-}
-
-/*!
- * \property QPlaneGeometry::resolution
- *
- * Holds the plane resolution.
- */
-QSize QPlaneGeometry::resolution() const
-{
- Q_D(const QPlaneGeometry);
- return d->m_meshResolution;
-}
-
-/*!
- * \property QPlaneGeometry::width
- *
- * Holds the plane width.
- */
-float QPlaneGeometry::width() const
-{
- Q_D(const QPlaneGeometry);
- return d->m_width;
-}
-
-/*!
- * \property QPlaneGeometry::height
- *
- * Holds the plane height.
- */
-float QPlaneGeometry::height() const
-{
- Q_D(const QPlaneGeometry);
- return d->m_height;
-}
-
-/*!
- * \property QPlaneGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-QAttribute *QPlaneGeometry::positionAttribute() const
-{
- Q_D(const QPlaneGeometry);
- return d->m_positionAttribute;
-}
-
-/*!
- * \property QPlaneGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-QAttribute *QPlaneGeometry::normalAttribute() const
-{
- Q_D(const QPlaneGeometry);
- return d->m_normalAttribute;
-}
-
-/*!
- * \property QPlaneGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-QAttribute *QPlaneGeometry::texCoordAttribute() const
-{
- Q_D(const QPlaneGeometry);
- return d->m_texCoordAttribute;
-}
-
-/*!
- * \property QPlaneGeometry::tangentAttribute
- *
- * Holds the geometry tangent attribute.
- */
-QAttribute *QPlaneGeometry::tangentAttribute() const
-{
- Q_D(const QPlaneGeometry);
- return d->m_tangentAttribute;
-}
-
-/*!
- * \property QPlaneGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-QAttribute *QPlaneGeometry::indexAttribute() const
-{
- Q_D(const QPlaneGeometry);
- return d->m_indexAttribute;
-}
-
-QPlaneGeometryPrivate::QPlaneGeometryPrivate()
- : QGeometryPrivate()
- , m_width(1.0f)
- , m_height(1.0f)
- , m_meshResolution(QSize(2, 2))
- , m_positionAttribute(Q_NULLPTR)
- , m_normalAttribute(Q_NULLPTR)
- , m_texCoordAttribute(Q_NULLPTR)
- , m_tangentAttribute(Q_NULLPTR)
- , m_indexAttribute(Q_NULLPTR)
- , m_vertexBuffer(Q_NULLPTR)
- , m_indexBuffer(Q_NULLPTR)
-{
-}
-
-void QPlaneGeometryPrivate::init()
-{
- Q_Q(QPlaneGeometry);
- m_positionAttribute = new QAttribute(q);
- m_normalAttribute = new QAttribute(q);
- m_texCoordAttribute = new QAttribute(q);
- m_tangentAttribute = new QAttribute(q);
- m_indexAttribute = new QAttribute(q);
- m_vertexBuffer = new QBuffer(QBuffer::VertexBuffer, q);
- m_indexBuffer = new QBuffer(QBuffer::IndexBuffer, q);
-
- const int nVerts = m_meshResolution.width() * m_meshResolution.height();
- const int stride = (3 + 2 + 3 + 4) * sizeof(float);
- const int faces = 2 * (m_meshResolution.width() - 1) * (m_meshResolution.height() - 1);
-
- m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
- m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_positionAttribute->setBuffer(m_vertexBuffer);
- m_positionAttribute->setByteStride(stride);
- m_positionAttribute->setCount(nVerts);
-
- m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
- m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_texCoordAttribute->setBuffer(m_vertexBuffer);
- m_texCoordAttribute->setByteStride(stride);
- m_texCoordAttribute->setByteOffset(3 * sizeof(float));
- m_texCoordAttribute->setCount(nVerts);
-
- m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
- m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_normalAttribute->setBuffer(m_vertexBuffer);
- m_normalAttribute->setByteStride(stride);
- m_normalAttribute->setByteOffset(5 * sizeof(float));
- m_normalAttribute->setCount(nVerts);
-
- m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
- m_tangentAttribute->setDataType(QAttribute::Float);
- m_tangentAttribute->setDataSize(4);
- m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_tangentAttribute->setBuffer(m_vertexBuffer);
- m_tangentAttribute->setByteStride(stride);
- m_tangentAttribute->setByteOffset(8 * sizeof(float));
- m_tangentAttribute->setCount(nVerts);
-
- m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
- m_indexAttribute->setBuffer(m_indexBuffer);
-
- // Each primitive has 3 vertives
- m_indexAttribute->setCount(faces * 3);
-
- m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new PlaneVertexBufferFunctor(m_width, m_height, m_meshResolution)));
- m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new PlaneIndexBufferFunctor(m_meshResolution)));
-
- q->addAttribute(m_positionAttribute);
- q->addAttribute(m_texCoordAttribute);
- q->addAttribute(m_normalAttribute);
- q->addAttribute(m_tangentAttribute);
- q->addAttribute(m_indexAttribute);
-}
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qplanegeometry.h b/src/render/geometry/qplanegeometry.h
deleted file mode 100644
index cd99a6cde..000000000
--- a/src/render/geometry/qplanegeometry.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QPLANEGEOMETRY_H
-#define QT3DRENDER_QPLANEGEOMETRY_H
-
-#include <Qt3DRender/qgeometry.h>
-#include <QSize>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QPlaneGeometryPrivate;
-class QAttribute;
-
-class QT3DRENDERSHARED_EXPORT QPlaneGeometry : public QGeometry
-{
- Q_OBJECT
- Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
- Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged)
- Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged)
- Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *tangentAttribute READ tangentAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
-
-public:
- explicit QPlaneGeometry(QNode *parent = Q_NULLPTR);
- ~QPlaneGeometry();
-
- void updateVertices();
- void updateIndices();
-
- QSize resolution() const;
- float width() const;
- float height() const;
-
- QAttribute *positionAttribute() const;
- QAttribute *normalAttribute() const;
- QAttribute *texCoordAttribute() const;
- QAttribute *tangentAttribute() const;
- QAttribute *indexAttribute() const;
-
-public Q_SLOTS:
- void setResolution(const QSize &resolution);
- void setWidth(float width);
- void setHeight(float height);
-
-Q_SIGNALS:
- void resolutionChanged(const QSize &resolution);
- void widthChanged(float width);
- void heightChanged(float height);
-
-protected:
- QPlaneGeometry(QPlaneGeometryPrivate &dd, QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QPlaneGeometry)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QPLANEGEOMETRY_H
diff --git a/src/render/geometry/qplanegeometry_p.h b/src/render/geometry/qplanegeometry_p.h
deleted file mode 100644
index 3b8d84fba..000000000
--- a/src/render/geometry/qplanegeometry_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QPLANEGEOMETRY_P_H
-#define QT3DRENDER_QPLANEGEOMETRY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qgeometry_p.h>
-#include <QSize>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAttribute;
-class QBuffer;
-
-class QPlaneGeometryPrivate : public QGeometryPrivate
-{
-public:
- QPlaneGeometryPrivate();
- void init();
-
- float m_width;
- float m_height;
- QSize m_meshResolution;
- QAttribute *m_positionAttribute;
- QAttribute *m_normalAttribute;
- QAttribute *m_texCoordAttribute;
- QAttribute *m_tangentAttribute;
- QAttribute *m_indexAttribute;
- QBuffer *m_vertexBuffer;
- QBuffer *m_indexBuffer;
-
- Q_DECLARE_PUBLIC(QPlaneGeometry)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QPLANEGEOMETRY_P_H
-
diff --git a/src/render/geometry/qplanemesh.cpp b/src/render/geometry/qplanemesh.cpp
deleted file mode 100644
index ce7860fea..000000000
--- a/src/render/geometry/qplanemesh.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qplanemesh.h"
-#include "qplanegeometry.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-/*!
- * \qmltype PlaneMesh
- * \instantiates Qt3DRender::QPlaneMesh
- * \inqmlmodule Qt3D.Render
- * \brief A square planar mesh.
- */
-
-/*!
- * \qmlproperty float PlaneMesh::width
- *
- * Holds the plane width.
- */
-
-/*!
- * \qmlproperty float PlaneMesh::height
- *
- * Holds the plane height.
- */
-
-/*!
- * \qmlproperty size PlaneMesh::meshResolution
- *
- * Holds the plane resolution.
- */
-
-/*!
- * \class Qt3DRender::QPlaneMesh
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometryRenderer
- *
- * \brief A square planar mesh.
- */
-
-/*!
- * Constructs a new QPlaneMesh with \a parent.
- */
-QPlaneMesh::QPlaneMesh(QNode *parent)
- : QGeometryRenderer(parent)
-{
- QPlaneGeometry *geometry = new QPlaneGeometry(this);
- QObject::connect(geometry, &QPlaneGeometry::widthChanged, this, &QPlaneMesh::widthChanged);
- QObject::connect(geometry, &QPlaneGeometry::heightChanged, this, &QPlaneMesh::heightChanged);
- QObject::connect(geometry, &QPlaneGeometry::resolutionChanged, this, &QPlaneMesh::meshResolutionChanged);
- QGeometryRenderer::setGeometry(geometry);
-}
-
-/*!
- * Destroys this plane mesh.
- */
-QPlaneMesh::~QPlaneMesh()
-{
- QNode::cleanup();
-}
-
-void QPlaneMesh::setWidth(float width)
-{
- static_cast<QPlaneGeometry *>(geometry())->setWidth(width);
-}
-
-/*!
- * \property QPlaneMesh::width
- *
- * Holds the plane width.
- */
-float QPlaneMesh::width() const
-{
- return static_cast<QPlaneGeometry *>(geometry())->width();
-}
-
-void QPlaneMesh::setHeight(float height)
-{
- static_cast<QPlaneGeometry *>(geometry())->setHeight(height);
-}
-
-/*!
- * \property QPlaneMesh::height
- *
- * Holds the plane height.
- */
-float QPlaneMesh::height() const
-{
- return static_cast<QPlaneGeometry *>(geometry())->height();
-}
-
-void QPlaneMesh::setMeshResolution(const QSize &resolution)
-{
- static_cast<QPlaneGeometry *>(geometry())->setResolution(resolution);
-}
-
-/*!
- * \property QPlaneMesh::meshResolution
- *
- * Holds the plane resolution.
- */
-QSize QPlaneMesh::meshResolution() const
-{
- return static_cast<QPlaneGeometry *>(geometry())->resolution();
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qplanemesh.h b/src/render/geometry/qplanemesh.h
deleted file mode 100644
index 8c2e6a4de..000000000
--- a/src/render/geometry/qplanemesh.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QPLANEMESH_H
-#define QT3DRENDER_QPLANEMESH_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qgeometryrenderer.h>
-#include <QSize>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QT3DRENDERSHARED_EXPORT QPlaneMesh : public QGeometryRenderer
-{
- Q_OBJECT
- Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
- Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged)
- Q_PROPERTY(QSize meshResolution READ meshResolution WRITE setMeshResolution NOTIFY meshResolutionChanged)
-
-public:
- explicit QPlaneMesh(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QPlaneMesh();
-
- float width() const;
- float height() const;
- QSize meshResolution() const;
-
-public Q_SLOTS:
- void setWidth(float width);
- void setHeight(float height);
- void setMeshResolution(const QSize &resolution);
-
-Q_SIGNALS:
- void meshResolutionChanged(const QSize &meshResolution);
- void widthChanged(float width);
- void heightChanged(float height);
-
-private:
- // As this is a default provided geometry renderer, no one should be able
- // to modify the QGeometryRenderer's properties
-
- void setInstanceCount(int instanceCount);
- void setPrimitiveCount(int primitiveCount);
- void setBaseVertex(int baseVertex);
- void setBaseInstance(int baseInstance);
- void setRestartIndex(int index);
- void setPrimitiveRestart(bool enabled);
- void setGeometry(QGeometry *geometry);
- void setPrimitiveType(PrimitiveType primitiveType);
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QPLANEMESH_H
diff --git a/src/render/geometry/qspheregeometry.cpp b/src/render/geometry/qspheregeometry.cpp
deleted file mode 100644
index 94b90bca1..000000000
--- a/src/render/geometry/qspheregeometry.cpp
+++ /dev/null
@@ -1,579 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qspheregeometry.h"
-#include "qspheregeometry_p.h"
-#include <Qt3DRender/qbufferfunctor.h>
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qattribute.h>
-
-#ifndef _USE_MATH_DEFINES
-# define _USE_MATH_DEFINES // For MSVC
-#endif
-
-#include <qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace {
-
-QByteArray createSphereMeshVertexData(float radius, int rings, int slices)
-{
- QByteArray bufferBytes;
- // vec3 pos, vec2 texCoord, vec3 normal, vec4 tangent
- const quint32 elementSize = 3 + 2 + 3 + 4;
- const quint32 stride = elementSize * sizeof(float);
- const int nVerts = (slices + 1) * (rings + 1);
- bufferBytes.resize(stride * nVerts);
-
- float* fptr = reinterpret_cast<float*>(bufferBytes.data());
-
- const float dTheta = (M_PI * 2) / static_cast<float>( slices );
- const float dPhi = M_PI / static_cast<float>( rings );
- const float du = 1.0f / static_cast<float>( slices );
- const float dv = 1.0f / static_cast<float>( rings );
-
- // Iterate over latitudes (rings)
- for ( int lat = 0; lat < rings + 1; ++lat )
- {
- const float phi = M_PI_2 - static_cast<float>( lat ) * dPhi;
- const float cosPhi = qCos( phi );
- const float sinPhi = qSin( phi );
- const float v = 1.0f - static_cast<float>( lat ) * dv;
-
- // Iterate over longitudes (slices)
- for ( int lon = 0; lon < slices + 1; ++lon )
- {
- const float theta = static_cast<float>( lon ) * dTheta;
- const float cosTheta = qCos( theta );
- const float sinTheta = qSin( theta );
- const float u = static_cast<float>( lon ) * du;
-
- *fptr++ = radius * cosTheta * cosPhi;
- *fptr++ = radius * sinPhi;
- *fptr++ = radius * sinTheta * cosPhi;
-
- *fptr++ = u;
- *fptr++ = v;
-
- *fptr++ = cosTheta * cosPhi;
- *fptr++ = sinPhi;
- *fptr++ = sinTheta * cosPhi;
-
- *fptr++ = sinTheta;
- *fptr++ = 0.0;
- *fptr++ = -cosTheta;
- *fptr++ = 1.0;
- }
- }
- return bufferBytes;
-}
-
-QByteArray createSphereMeshIndexData(int rings, int slices)
-{
- int faces = (slices * 2) * (rings - 2); // two tris per slice, for all middle rings
- faces += 2 * slices; // tri per slice for both top and bottom
-
- QByteArray indexBytes;
- const int indices = faces * 3;
- Q_ASSERT(indices < 65536);
- indexBytes.resize(indices * sizeof(quint16));
- quint16 *indexPtr = reinterpret_cast<quint16*>(indexBytes.data());
-
- // top cap
- {
- const int nextRingStartIndex = slices + 1;
- for ( int j = 0; j < slices; ++j )
- {
- *indexPtr++ = nextRingStartIndex + j;
- *indexPtr++ = 0;
- *indexPtr++ = nextRingStartIndex + j + 1;
- }
- }
-
- for ( int i = 1; i < (rings - 1); ++i )
- {
- const int ringStartIndex = i * ( slices + 1 );
- const int nextRingStartIndex = ( i + 1 ) * ( slices + 1 );
-
- for ( int j = 0; j < slices; ++j )
- {
- // Split the quad into two triangles
- *indexPtr++ = ringStartIndex + j;
- *indexPtr++ = ringStartIndex + j + 1;
- *indexPtr++ = nextRingStartIndex + j;
- *indexPtr++ = nextRingStartIndex + j;
- *indexPtr++ = ringStartIndex + j + 1;
- *indexPtr++ = nextRingStartIndex + j + 1;
- }
- }
-
- // bottom cap
- {
- const int ringStartIndex = (rings - 1) * ( slices + 1);
- const int nextRingStartIndex = (rings) * ( slices + 1);
- for ( int j = 0; j < slices; ++j )
- {
- *indexPtr++ = ringStartIndex + j + 1;
- *indexPtr++ = nextRingStartIndex;
- *indexPtr++ = ringStartIndex + j;
- }
- }
-
- return indexBytes;
-}
-
-} // anonymous
-
-class SphereVertexDataFunctor : public QBufferFunctor
-{
-public:
- SphereVertexDataFunctor(int rings, int slices, float radius)
- : m_rings(rings)
- , m_slices(slices)
- , m_radius(radius)
- {
- }
-
- QByteArray operator ()() Q_DECL_OVERRIDE
- {
- return createSphereMeshVertexData(m_radius, m_rings, m_slices);
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_OVERRIDE
- {
- const SphereVertexDataFunctor *otherFunctor = functor_cast<SphereVertexDataFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_rings == m_rings &&
- otherFunctor->m_slices == m_slices &&
- otherFunctor->m_radius == m_radius);
- return false;
- }
-
- QT3D_FUNCTOR(SphereVertexDataFunctor)
-
-private:
- int m_rings;
- int m_slices;
- float m_radius;
-};
-
-class SphereIndexDataFunctor : public QBufferFunctor
-{
-public:
- SphereIndexDataFunctor(int rings, int slices)
- : m_rings(rings)
- , m_slices(slices)
- {
- }
-
- QByteArray operator ()() Q_DECL_OVERRIDE
- {
- return createSphereMeshIndexData(m_rings, m_slices);
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_OVERRIDE
- {
- const SphereIndexDataFunctor *otherFunctor = functor_cast<SphereIndexDataFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_rings == m_rings &&
- otherFunctor->m_slices == m_slices);
- return false;
- }
-
- QT3D_FUNCTOR(SphereIndexDataFunctor)
-
-private:
- int m_rings;
- int m_slices;
-};
-
-QSphereGeometryPrivate::QSphereGeometryPrivate()
- : QGeometryPrivate()
- , m_generateTangents(false)
- , m_rings(16)
- , m_slices(16)
- , m_radius(1.0f)
- , m_positionAttribute(Q_NULLPTR)
- , m_normalAttribute(Q_NULLPTR)
- , m_texCoordAttribute(Q_NULLPTR)
- , m_tangentAttribute(Q_NULLPTR)
- , m_indexAttribute(Q_NULLPTR)
- , m_vertexBuffer(Q_NULLPTR)
- , m_indexBuffer(Q_NULLPTR)
-{
-}
-
-void QSphereGeometryPrivate::init()
-{
- Q_Q(QSphereGeometry);
- m_positionAttribute = new QAttribute(q);
- m_normalAttribute = new QAttribute(q);
- m_texCoordAttribute = new QAttribute(q);
- m_tangentAttribute = new QAttribute(q);
- m_indexAttribute = new QAttribute(q);
- m_vertexBuffer = new QBuffer(QBuffer::VertexBuffer, q);
- m_indexBuffer = new QBuffer(QBuffer::IndexBuffer, q);
-
- // vec3 pos, vec2 tex, vec3 normal, vec4 tangent
- const quint32 elementSize = 3 + 2 + 3 + 4;
- const quint32 stride = elementSize * sizeof(float);
- const int nVerts = (m_slices + 1) * (m_rings + 1);
- const int faces = (m_slices * 2) * (m_rings - 2) + (2 * m_slices);
-
- m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
- m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_positionAttribute->setBuffer(m_vertexBuffer);
- m_positionAttribute->setByteStride(stride);
- m_positionAttribute->setCount(nVerts);
-
- m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
- m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_texCoordAttribute->setBuffer(m_vertexBuffer);
- m_texCoordAttribute->setByteStride(stride);
- m_texCoordAttribute->setByteOffset(3 * sizeof(float));
- m_texCoordAttribute->setCount(nVerts);
-
- m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
- m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_normalAttribute->setBuffer(m_vertexBuffer);
- m_normalAttribute->setByteStride(stride);
- m_normalAttribute->setByteOffset(5 * sizeof(float));
- m_normalAttribute->setCount(nVerts);
-
- m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
- m_tangentAttribute->setDataType(QAttribute::Float);
- m_tangentAttribute->setDataSize(4);
- m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_tangentAttribute->setBuffer(m_vertexBuffer);
- m_tangentAttribute->setByteStride(stride);
- m_tangentAttribute->setByteOffset(8 * sizeof(float));
- m_tangentAttribute->setCount(nVerts);
-
- m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
- m_indexAttribute->setBuffer(m_indexBuffer);
-
- m_indexAttribute->setCount(faces * 3);
-
- m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new SphereVertexDataFunctor(m_rings, m_slices, m_radius)));
- m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new SphereIndexDataFunctor(m_rings, m_slices)));
-
- q->addAttribute(m_positionAttribute);
- q->addAttribute(m_texCoordAttribute);
- q->addAttribute(m_normalAttribute);
- if (m_generateTangents)
- q->addAttribute(m_tangentAttribute);
- q->addAttribute(m_indexAttribute);
-}
-
-/*!
- * \qmltype SphereGeometry
- * \instantiates Qt3DRender::QSphereGeometry
- * \inqmlmodule Qt3D.Render
- */
-
-/*!
- * \qmlproperty int SphereGeometry::rings
- *
- * Holds the number of rings in the sphere.
- */
-
-/*!
- * \qmlproperty int SphereGeometry::slices
- *
- * Holds the number of slices in the sphere.
- */
-
-/*!
- * \qmlproperty float SphereGeometry::radius
- *
- * Holds the radius of the sphere.
- */
-
-/*!
- * \qmlproperty bool SphereGeometry::generateTangents
- *
- * Holds the value of the automatic tangent generation flag.
- */
-
-/*!
- * \qmlproperty Attribute SphereGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-
-/*!
- * \qmlproperty Attribute SphereGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-
-/*!
- * \qmlproperty Attribute SphereGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-
-/*!
- * \qmlproperty Attribute SphereGeometry::tangentAttribute
- *
- * Holds the geometry tangent attribute.
- */
-
-/*!
- * \qmlproperty Attribute SphereGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-
-/*!
- * \class Qt3DRender::QSphereGeometry
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometry
- */
-
-/*!
- * Constructs a new QSphereGeometry with \a parent.
- */
-QSphereGeometry::QSphereGeometry(QNode *parent)
- : QGeometry(*new QSphereGeometryPrivate(), parent)
-{
- Q_D(QSphereGeometry);
- d->init();
-}
-
-/*!
- * \internal
- */
-QSphereGeometry::QSphereGeometry(QSphereGeometryPrivate &dd, QNode *parent)
- : QGeometry(dd, parent)
-{
- Q_D(QSphereGeometry);
- d->init();
-}
-
-/*!
- * Destroys this geometry.
- */
-QSphereGeometry::~QSphereGeometry()
-{
- QGeometry::cleanup();
-}
-
-/*!
- * Updates vertices based on rings and slices.
- */
-void QSphereGeometry::updateVertices()
-{
- Q_D(QSphereGeometry);
- const int nVerts = (d->m_slices + 1) * (d->m_rings + 1);
- d->m_positionAttribute->setCount(nVerts);
- d->m_texCoordAttribute->setCount(nVerts);
- d->m_normalAttribute->setCount(nVerts);
- d->m_tangentAttribute->setCount(nVerts);
- d->m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new SphereVertexDataFunctor(d->m_rings, d->m_slices, d->m_radius)));
-}
-
-/*!
- * Updates indices based on rings and slices.
- */
-void QSphereGeometry::updateIndices()
-{
- Q_D(QSphereGeometry);
- const int faces = (d->m_slices * 2) * (d->m_rings - 2) + (2 * d->m_slices);
- d->m_indexAttribute->setCount(faces * 3);
- d->m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new SphereIndexDataFunctor(d->m_rings, d->m_slices)));
-
-}
-
-void QSphereGeometry::setRings(int rings)
-{
- Q_D(QSphereGeometry);
- if (rings != d->m_rings) {
- d->m_rings = rings;
- updateVertices();
- updateIndices();
- emit ringsChanged(rings);
- }
-}
-
-void QSphereGeometry::setSlices(int slices)
-{
- Q_D(QSphereGeometry);
- if (slices != d->m_slices) {
- d->m_slices = slices;
- updateVertices();
- updateIndices();
- emit slicesChanged(slices);
- }
-}
-
-void QSphereGeometry::setRadius(float radius)
-{
- Q_D(QSphereGeometry);
- if (radius != d->m_radius) {
- d->m_radius = radius;
- updateVertices();
- emit radiusChanged(radius);
- }
-}
-
-void QSphereGeometry::setGenerateTangents(bool gen)
-{
- Q_D(QSphereGeometry);
- if (d->m_generateTangents != gen) {
- if (d->m_generateTangents)
- removeAttribute(d->m_tangentAttribute);
- d->m_generateTangents = gen;
- if (d->m_generateTangents)
- addAttribute(d->m_tangentAttribute);
- emit generateTangentsChanged(gen);
- }
-}
-
-/*!
- * \property QSphereGeometry::generateTangents
- *
- * Holds the value of the automatic tangent generation flag.
- */
-bool QSphereGeometry::generateTangents() const
-{
- Q_D(const QSphereGeometry);
- return d->m_generateTangents;
-}
-
-/*!
- * \property QSphereGeometry::rings
- *
- * Holds the number of rings in the sphere.
- */
-int QSphereGeometry::rings() const
-{
- Q_D(const QSphereGeometry);
- return d->m_rings;
-}
-
-/*!
- * \property QSphereGeometry::slices
- *
- * Holds the number of slices in the sphere.
- */
-int QSphereGeometry::slices() const
-{
- Q_D(const QSphereGeometry);
- return d->m_slices;
-}
-
-/*!
- * \property QSphereGeometry::radius
- *
- * Holds the radius of the sphere.
- */
-float QSphereGeometry::radius() const
-{
- Q_D(const QSphereGeometry);
- return d->m_radius;
-}
-
-/*!
- * \property QSphereGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-QAttribute *QSphereGeometry::positionAttribute() const
-{
- Q_D(const QSphereGeometry);
- return d->m_positionAttribute;
-}
-
-/*!
- * \property QSphereGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-QAttribute *QSphereGeometry::normalAttribute() const
-{
- Q_D(const QSphereGeometry);
- return d->m_normalAttribute;
-}
-
-/*!
- * \property QSphereGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-QAttribute *QSphereGeometry::texCoordAttribute() const
-{
- Q_D(const QSphereGeometry);
- return d->m_texCoordAttribute;
-}
-
-/*!
- * \property QSphereGeometry::tangentAttribute
- *
- * Holds the geometry tangent attribute.
- */
-QAttribute *QSphereGeometry::tangentAttribute() const
-{
- Q_D(const QSphereGeometry);
- return d->m_tangentAttribute;
-}
-
-/*!
- * \property QSphereGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-QAttribute *QSphereGeometry::indexAttribute() const
-{
- Q_D(const QSphereGeometry);
- return d->m_indexAttribute;
-}
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
diff --git a/src/render/geometry/qspheregeometry.h b/src/render/geometry/qspheregeometry.h
deleted file mode 100644
index 10a90a3e1..000000000
--- a/src/render/geometry/qspheregeometry.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSPHEREGEOMETRY_H
-#define QT3DRENDER_QSPHEREGEOMETRY_H
-
-#include <Qt3DRender/qgeometry.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QSphereGeometryPrivate;
-class QAttribute;
-
-class QT3DRENDERSHARED_EXPORT QSphereGeometry : public QGeometry
-{
- Q_OBJECT
- Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
- Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(bool generateTangents READ generateTangents WRITE setGenerateTangents NOTIFY generateTangentsChanged)
- Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *tangentAttribute READ tangentAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
-
-public:
- explicit QSphereGeometry(QNode *parent = Q_NULLPTR);
- ~QSphereGeometry();
-
- void updateVertices();
- void updateIndices();
-
- bool generateTangents() const;
- int rings() const;
- int slices() const;
- float radius() const;
-
- QAttribute *positionAttribute() const;
- QAttribute *normalAttribute() const;
- QAttribute *texCoordAttribute() const;
- QAttribute *tangentAttribute() const;
- QAttribute *indexAttribute() const;
-
-public Q_SLOTS:
- void setRings(int rings);
- void setSlices(int slices);
- void setRadius(float radius);
- void setGenerateTangents(bool gen);
-
-Q_SIGNALS:
- void radiusChanged(float radius);
- void ringsChanged(int rings);
- void slicesChanged(int slices);
- void generateTangentsChanged(bool generateTangents);
-
-protected:
- QSphereGeometry(QSphereGeometryPrivate &dd, QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QSphereGeometry)
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSPHEREGEOMETRY_H
diff --git a/src/render/geometry/qspheregeometry_p.h b/src/render/geometry/qspheregeometry_p.h
deleted file mode 100644
index d46ef9ecd..000000000
--- a/src/render/geometry/qspheregeometry_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSPHEREGEOMETRY_P_H
-#define QT3DRENDER_QSPHEREGEOMETRY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qgeometry_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAttribute;
-class QBuffer;
-
-class QSphereGeometryPrivate : public QGeometryPrivate
-{
-public:
- QSphereGeometryPrivate();
- void init();
-
- bool m_generateTangents;
- int m_rings;
- int m_slices;
- float m_radius;
- QAttribute *m_positionAttribute;
- QAttribute *m_normalAttribute;
- QAttribute *m_texCoordAttribute;
- QAttribute *m_tangentAttribute;
- QAttribute *m_indexAttribute;
- QBuffer *m_vertexBuffer;
- QBuffer *m_indexBuffer;
-
- Q_DECLARE_PUBLIC(QSphereGeometry);
-};
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSPHEREGEOMETRY_P_H
-
diff --git a/src/render/geometry/qspheremesh.cpp b/src/render/geometry/qspheremesh.cpp
deleted file mode 100644
index 47fbf9ea4..000000000
--- a/src/render/geometry/qspheremesh.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qspheremesh.h"
-#include "qspheregeometry.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-/*!
- * \qmltype SphereMesh
- * \instantiates Qt3DRender::QSphereMesh
- * \inqmlmodule Qt3D.Render
- * \brief A spherical mesh.
- */
-
-/*!
- * \qmlproperty int SphereMesh::rings
- *
- * Holds the number of rings in the mesh.
- */
-
-/*!
- * \qmlproperty int SphereMesh::slices
- *
- * Holds the number of slices in the mesh.
- */
-
-/*!
- * \qmlproperty float SphereMesh::radius
- *
- * Holds the radius of the sphere.
- */
-
-/*!
- * \qmlproperty bool SphereMesh::generateTangents
- *
- * Holds the value of the automatic tangent generation flag.
- */
-
-/*!
- * \class Qt3DRender::QSphereMesh
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometryRenderer
- *
- * \brief A spherical mesh.
- */
-
-/*!
- * Constructs a new QSphereMesh with \a parent.
- */
-QSphereMesh::QSphereMesh(QNode *parent)
- : QGeometryRenderer(parent)
-{
- QSphereGeometry *geometry = new QSphereGeometry(this);
- QObject::connect(geometry, &QSphereGeometry::radiusChanged, this, &QSphereMesh::radiusChanged);
- QObject::connect(geometry, &QSphereGeometry::ringsChanged, this, &QSphereMesh::ringsChanged);
- QObject::connect(geometry, &QSphereGeometry::slicesChanged, this, &QSphereMesh::slicesChanged);
- QObject::connect(geometry, &QSphereGeometry::generateTangentsChanged, this, &QSphereMesh::generateTangentsChanged);
- QGeometryRenderer::setGeometry(geometry);
-}
-
-/*!
- * Destroys this sphere mesh.
- */
-QSphereMesh::~QSphereMesh()
-{
- QNode::cleanup();
-}
-
-void QSphereMesh::setRings(int rings)
-{
- static_cast<QSphereGeometry *>(geometry())->setRings(rings);
-}
-
-void QSphereMesh::setSlices(int slices)
-{
- static_cast<QSphereGeometry *>(geometry())->setSlices(slices);
-}
-
-void QSphereMesh::setRadius(float radius)
-{
- static_cast<QSphereGeometry *>(geometry())->setRadius(radius);
-}
-
-void QSphereMesh::setGenerateTangents(bool gen)
-{
- static_cast<QSphereGeometry *>(geometry())->setGenerateTangents(gen);
-}
-
-/*!
- * \property QSphereMesh::generateTangents
- *
- * Holds the value of the automatic tangent generation flag.
- */
-bool QSphereMesh::generateTangents() const
-{
- return static_cast<QSphereGeometry *>(geometry())->generateTangents();
-}
-
-/*!
- * \property QSphereMesh::rings
- *
- * Holds the number of rings in the mesh.
- */
-int QSphereMesh::rings() const
-{
- return static_cast<QSphereGeometry *>(geometry())->rings();
-}
-
-/*!
- * \property QSphereMesh::slices
- *
- * Holds the number of slices in the mesh.
- */
-int QSphereMesh::slices() const
-{
- return static_cast<QSphereGeometry *>(geometry())->slices();
-}
-
-/*!
- * \property QSphereMesh::radius
- *
- * Holds the radius of the sphere.
- */
-float QSphereMesh::radius() const
-{
- return static_cast<QSphereGeometry *>(geometry())->radius();
-}
-
-} //Qt3D
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qspheremesh.h b/src/render/geometry/qspheremesh.h
deleted file mode 100644
index 5eca84128..000000000
--- a/src/render/geometry/qspheremesh.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSPHEREMESH_H
-#define QT3DRENDER_QSPHEREMESH_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qgeometryrenderer.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QSphereMeshPrivate;
-
-class QT3DRENDERSHARED_EXPORT QSphereMesh : public QGeometryRenderer
-{
- Q_OBJECT
- Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
- Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(bool generateTangents READ generateTangents WRITE setGenerateTangents NOTIFY generateTangentsChanged)
-
-public:
- explicit QSphereMesh(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QSphereMesh();
-
- int rings() const;
- int slices() const;
- float radius() const;
- bool generateTangents() const;
-
-public Q_SLOTS:
- void setRings(int rings);
- void setSlices(int slices);
- void setRadius(float radius);
- void setGenerateTangents(bool gen);
-
-Q_SIGNALS:
- void radiusChanged(float radius);
- void ringsChanged(int rings);
- void slicesChanged(int slices);
- void generateTangentsChanged(bool generateTangents);
-
-private:
- // As this is a default provided geometry renderer, no one should be able
- // to modify the QGeometryRenderer's properties
-
- void setPrimitiveCount(int primitiveCount);
- void setBaseVertex(int baseVertex);
- void setBaseInstance(int baseInstance);
- void setRestartIndex(int index);
- void setPrimitiveRestart(bool enabled);
- void setGeometry(QGeometry *geometry);
- void setPrimitiveType(PrimitiveType primitiveType);
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSPHEREMESH_H
diff --git a/src/render/geometry/qtorusgeometry.cpp b/src/render/geometry/qtorusgeometry.cpp
deleted file mode 100644
index cedfaa7d4..000000000
--- a/src/render/geometry/qtorusgeometry.cpp
+++ /dev/null
@@ -1,506 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtorusgeometry.h"
-#include "qtorusgeometry_p.h"
-#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
-#include <Qt3DRender/qattribute.h>
-#include <qmath.h>
-#include <QVector3D>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace {
-
-QByteArray createTorusVertexData(double radius, double minorRadius,
- int rings, int sides)
-{
- const int nVerts = sides * (rings + 1);
- QByteArray bufferBytes;
- // vec3 pos, vec2 texCoord, vec3 normal
- const quint32 elementSize = 3 + 2 + 3;
- const quint32 stride = elementSize * sizeof(float);
- bufferBytes.resize(stride * nVerts);
-
- float* fptr = reinterpret_cast<float*>(bufferBytes.data());
-
- const float ringFactor = (M_PI * 2) / static_cast<float>( rings );
- const float sideFactor = (M_PI * 2) / static_cast<float>( sides );
-
- for (int ring = 0; ring <= rings; ++ring) {
- const float u = ring * ringFactor;
- const float cu = qCos( u );
- const float su = qSin( u );
-
- for (int side = 0; side < sides; ++side) {
- const float v = side * sideFactor;
- const float cv = qCos( v );
- const float sv = qSin( v );
- const float r = (radius + minorRadius * cv);
-
- *fptr++ = r * cu;
- *fptr++ = r * su;
- *fptr++ = minorRadius * sv;
-
- *fptr++ = u / (M_PI * 2);
- *fptr++ = v / (M_PI * 2);
-
- QVector3D n(cv * cu * r, cv * su * r, sv * r);
- n.normalize();
- *fptr++ = n.x();
- *fptr++ = n.y();
- *fptr++ = n.z();
- }
- }
-
- return bufferBytes;
-}
-
-QByteArray createTorusIndexData(int rings, int sides)
-{
- QByteArray indexBytes;
- int faces = (sides * 2) * rings; // two tris per side, for all rings
- int indices = faces * 3;
- Q_ASSERT(indices < 65536);
- indexBytes.resize(indices * sizeof(quint16));
- quint16* indexPtr = reinterpret_cast<quint16*>(indexBytes.data());
-
- for (int ring = 0; ring < rings; ++ring) {
- const int ringStart = ring * sides;
- const int nextRingStart = (ring + 1) * sides;
- for (int side = 0; side < sides; ++side) {
- const int nextSide = (side + 1) % sides;
- *indexPtr++ = (ringStart + side);
- *indexPtr++ = (nextRingStart + side);
- *indexPtr++ = (nextRingStart + nextSide);
- *indexPtr++ = ringStart + side;
- *indexPtr++ = nextRingStart + nextSide;
- *indexPtr++ = (ringStart + nextSide);
- }
- }
-
- return indexBytes;
-}
-
-} // anonymous
-
-class TorusVertexDataFunctor : public QBufferFunctor
-{
-public:
- TorusVertexDataFunctor(int rings, int slices, float radius, float minorRadius)
- : m_rings(rings)
- , m_sides(slices)
- , m_radius(radius)
- , m_minorRadius(minorRadius)
- {
- }
-
- QByteArray operator ()() Q_DECL_OVERRIDE
- {
- return createTorusVertexData(m_radius, m_minorRadius, m_rings, m_sides);
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_OVERRIDE
- {
- const TorusVertexDataFunctor *otherFunctor = functor_cast<TorusVertexDataFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_rings == m_rings &&
- otherFunctor->m_sides == m_sides &&
- otherFunctor->m_radius == m_radius &&
- otherFunctor->m_minorRadius == m_minorRadius);
- return false;
- }
-
- QT3D_FUNCTOR(TorusVertexDataFunctor)
-
-private:
- int m_rings;
- int m_sides;
- float m_radius;
- float m_minorRadius;
-};
-
-class TorusIndexDataFunctor : public QBufferFunctor
-{
-public:
- TorusIndexDataFunctor(int rings, int slices)
- : m_rings(rings)
- , m_sides(slices)
- {
- }
-
- QByteArray operator ()() Q_DECL_OVERRIDE
- {
- return createTorusIndexData(m_rings, m_sides);
- }
-
- bool operator ==(const QBufferFunctor &other) const Q_DECL_OVERRIDE
- {
- const TorusIndexDataFunctor *otherFunctor = functor_cast<TorusIndexDataFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return (otherFunctor->m_rings == m_rings &&
- otherFunctor->m_sides == m_sides);
- return false;
- }
-
- QT3D_FUNCTOR(TorusIndexDataFunctor)
-
-private:
- int m_rings;
- int m_sides;
-};
-
-QTorusGeometryPrivate::QTorusGeometryPrivate()
- : QGeometryPrivate()
- , m_rings(16)
- , m_slices(16)
- , m_radius(1.0f)
- , m_minorRadius(1.0f)
- , m_positionAttribute(Q_NULLPTR)
- , m_normalAttribute(Q_NULLPTR)
- , m_texCoordAttribute(Q_NULLPTR)
- , m_indexAttribute(Q_NULLPTR)
- , m_vertexBuffer(Q_NULLPTR)
- , m_indexBuffer(Q_NULLPTR)
-{
-}
-
-void QTorusGeometryPrivate::init()
-{
- Q_Q(QTorusGeometry);
- m_positionAttribute = new QAttribute(q);
- m_normalAttribute = new QAttribute(q);
- m_texCoordAttribute = new QAttribute(q);
- m_indexAttribute = new QAttribute(q);
- m_vertexBuffer = new QBuffer(QBuffer::VertexBuffer, q);
- m_indexBuffer = new QBuffer(QBuffer::IndexBuffer, q);
- // vec3 pos, vec2 tex, vec3 normal
- const quint32 elementSize = 3 + 2 + 3;
- const quint32 stride = elementSize * sizeof(float);
- const int nVerts = (m_slices + 1) * (m_rings + 1);
- const int faces = (m_slices * 2) * m_rings;
-
- m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
- m_positionAttribute->setDataType(QAttribute::Float);
- m_positionAttribute->setDataSize(3);
- m_positionAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_positionAttribute->setBuffer(m_vertexBuffer);
- m_positionAttribute->setByteStride(stride);
- m_positionAttribute->setCount(nVerts);
-
- m_texCoordAttribute->setName(QAttribute::defaultTextureCoordinateAttributeName());
- m_texCoordAttribute->setDataType(QAttribute::Float);
- m_texCoordAttribute->setDataSize(2);
- m_texCoordAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_texCoordAttribute->setBuffer(m_vertexBuffer);
- m_texCoordAttribute->setByteStride(stride);
- m_texCoordAttribute->setByteOffset(3 * sizeof(float));
- m_texCoordAttribute->setCount(nVerts);
-
- m_normalAttribute->setName(QAttribute::defaultNormalAttributeName());
- m_normalAttribute->setDataType(QAttribute::Float);
- m_normalAttribute->setDataSize(3);
- m_normalAttribute->setAttributeType(QAttribute::VertexAttribute);
- m_normalAttribute->setBuffer(m_vertexBuffer);
- m_normalAttribute->setByteStride(stride);
- m_normalAttribute->setByteOffset(5 * sizeof(float));
- m_normalAttribute->setCount(nVerts);
-
- m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
- m_indexAttribute->setDataType(QAttribute::UnsignedShort);
- m_indexAttribute->setBuffer(m_indexBuffer);
-
- m_indexAttribute->setCount(faces * 3);
-
- m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new TorusVertexDataFunctor(m_rings, m_slices, m_radius, m_minorRadius)));
- m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new TorusIndexDataFunctor(m_rings, m_slices)));
-
- q->addAttribute(m_positionAttribute);
- q->addAttribute(m_texCoordAttribute);
- q->addAttribute(m_normalAttribute);
- q->addAttribute(m_indexAttribute);
-}
-
-/*!
- * \qmltype TorusGeometry
- * \instantiates Qt3DRender::QTorusGeometry
- * \inqmlmodule Qt3D.Render
- */
-
-/*!
- * \qmlproperty int TorusGeometry::rings
- *
- * Holds the number of rings in the torus.
- */
-
-/*!
- * \qmlproperty int TorusGeometry::slices
- *
- * Holds the number of slices in the torus.
- */
-
-/*!
- * \qmlproperty float TorusGeometry::radius
- *
- * Holds the outer radius of the torus.
- */
-
-/*!
- * \qmlproperty float TorusGeometry::minorRadius
- *
- * Holds the inner radius of the torus.
- */
-
-/*!
- * \qmlproperty Attribute TorusGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-
-/*!
- * \qmlproperty Attribute TorusGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-
-/*!
- * \qmlproperty Attribute TorusGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-
-/*!
- * \qmlproperty Attribute TorusGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-
-/*!
- * \class Qt3DRender::QTorusGeometry
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometry
- */
-
-/*!
- * Constructs a new QTorusGeometry with \a parent.
- */
-QTorusGeometry::QTorusGeometry(QNode *parent)
- : QGeometry(*new QTorusGeometryPrivate(), parent)
-{
- Q_D(QTorusGeometry);
- d->init();
-}
-
-/*!
- * \internal
- */
-QTorusGeometry::QTorusGeometry(QTorusGeometryPrivate &dd, QNode *parent)
- : QGeometry(dd, parent)
-{
- Q_D(QTorusGeometry);
- d->init();
-}
-
-/*!
- * Destroys this geometry.
- */
-QTorusGeometry::~QTorusGeometry()
-{
- QGeometry::cleanup();
-}
-
-/*!
- * Updates vertices based on rings and slices.
- */
-void QTorusGeometry::updateVertices()
-{
- Q_D(QTorusGeometry);
- const int nVerts = (d->m_slices + 1) * (d->m_rings + 1);
- d->m_positionAttribute->setCount(nVerts);
- d->m_texCoordAttribute->setCount(nVerts);
- d->m_normalAttribute->setCount(nVerts);
- d->m_vertexBuffer->setBufferFunctor(QBufferFunctorPtr(new TorusVertexDataFunctor(d->m_rings, d->m_slices, d->m_radius, d->m_minorRadius)));
-}
-
-/*!
- * Updates indices based on rings and slices.
- */
-void QTorusGeometry::updateIndices()
-{
- Q_D(QTorusGeometry);
- const int faces = (d->m_slices * 2) * d->m_rings;
- d->m_indexAttribute->setCount(faces * 3);
- d->m_indexBuffer->setBufferFunctor(QBufferFunctorPtr(new TorusIndexDataFunctor(d->m_rings, d->m_slices)));
-
-}
-
-void QTorusGeometry::setRings(int rings)
-{
- Q_D(QTorusGeometry);
- if (rings != d->m_rings) {
- d->m_rings = rings;
- updateVertices();
- updateIndices();
- emit ringsChanged(rings);
- }
-}
-
-void QTorusGeometry::setSlices(int slices)
-{
- Q_D(QTorusGeometry);
- if (slices != d->m_slices) {
- d->m_slices = slices;
- updateVertices();
- updateIndices();
- emit slicesChanged(slices);
- }
-}
-
-void QTorusGeometry::setRadius(float radius)
-{
- Q_D(QTorusGeometry);
- if (radius != d->m_radius) {
- d->m_radius = radius;
- updateVertices();
- emit radiusChanged(radius);
- }
-}
-
-void QTorusGeometry::setMinorRadius(float minorRadius)
-{
- Q_D(QTorusGeometry);
- if (minorRadius != d->m_minorRadius) {
- d->m_minorRadius = minorRadius;
- updateVertices();
- emit minorRadiusChanged(minorRadius);
- }
-}
-
-/*!
- * \property QTorusGeometry::rings
- *
- * Holds the number of rings in the torus.
- */
-int QTorusGeometry::rings() const
-{
- Q_D(const QTorusGeometry);
- return d->m_rings;
-}
-
-/*!
- * \property QTorusGeometry::slices
- *
- * Holds the number of slices in the torus.
- */
-int QTorusGeometry::slices() const
-{
- Q_D(const QTorusGeometry);
- return d->m_slices;
-}
-
-/*!
- * \property QTorusGeometry::radius
- *
- * Holds the outer radius of the torus.
- */
-float QTorusGeometry::radius() const
-{
- Q_D(const QTorusGeometry);
- return d->m_radius;
-}
-
-/*!
- * \property QTorusGeometry::minorRadius
- *
- * Holds the inner radius of the torus.
- */
-float QTorusGeometry::minorRadius() const
-{
- Q_D(const QTorusGeometry);
- return d->m_minorRadius;
-}
-
-/*!
- * \property QTorusGeometry::positionAttribute
- *
- * Holds the geometry position attribute.
- */
-QAttribute *QTorusGeometry::positionAttribute() const
-{
- Q_D(const QTorusGeometry);
- return d->m_positionAttribute;
-}
-
-/*!
- * \property QTorusGeometry::normalAttribute
- *
- * Holds the geometry normal attribute.
- */
-QAttribute *QTorusGeometry::normalAttribute() const
-{
- Q_D(const QTorusGeometry);
- return d->m_normalAttribute;
-}
-
-/*!
- * \property QTorusGeometry::texCoordAttribute
- *
- * Holds the geometry texture coordinate attribute.
- */
-QAttribute *QTorusGeometry::texCoordAttribute() const
-{
- Q_D(const QTorusGeometry);
- return d->m_texCoordAttribute;
-}
-
-/*!
- * \property QTorusGeometry::indexAttribute
- *
- * Holds the geometry index attribute.
- */
-QAttribute *QTorusGeometry::indexAttribute() const
-{
- Q_D(const QTorusGeometry);
- return d->m_indexAttribute;
-}
-
-} // Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qtorusgeometry.h b/src/render/geometry/qtorusgeometry.h
deleted file mode 100644
index 874e0e7a7..000000000
--- a/src/render/geometry/qtorusgeometry.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3D_QTORUSGEOMETRY_H
-#define QT3D_QTORUSGEOMETRY_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qgeometry.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QTorusGeometryPrivate;
-class QAttribute;
-
-class QT3DRENDERSHARED_EXPORT QTorusGeometry : public QGeometry
-{
- Q_OBJECT
- Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
- Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(float minorRadius READ minorRadius WRITE setMinorRadius NOTIFY minorRadiusChanged)
- Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
- Q_PROPERTY(Qt3DRender::QAttribute *indexAttribute READ indexAttribute CONSTANT)
-
-public:
- explicit QTorusGeometry(QNode *parent = Q_NULLPTR);
- ~QTorusGeometry();
-
- void updateVertices();
- void updateIndices();
-
- int rings() const;
- int slices() const;
- float radius() const;
- float minorRadius() const;
-
- QAttribute *positionAttribute() const;
- QAttribute *normalAttribute() const;
- QAttribute *texCoordAttribute() const;
- QAttribute *indexAttribute() const;
-
-public Q_SLOTS:
- void setRings(int rings);
- void setSlices(int slices);
- void setRadius(float radius);
- void setMinorRadius(float minorRadius);
-
-Q_SIGNALS:
- void radiusChanged(float radius);
- void ringsChanged(int rings);
- void slicesChanged(int slices);
- void minorRadiusChanged(float minorRadius);
-
-
-protected:
- QTorusGeometry(QTorusGeometryPrivate &dd, QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QTorusGeometry)
-};
-
-} // Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3D_QTORUSGEOMETRY_H
diff --git a/src/render/geometry/qtorusgeometry_p.h b/src/render/geometry/qtorusgeometry_p.h
deleted file mode 100644
index ba19d1b9f..000000000
--- a/src/render/geometry/qtorusgeometry_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QTORUSGEOMETRY_P_H
-#define QT3DRENDER_QTORUSGEOMETRY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/private/qgeometry_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAttribute;
-class QBuffer;
-
-class QTorusGeometryPrivate : public QGeometryPrivate
-{
-public:
- QTorusGeometryPrivate();
- void init();
-
- int m_rings;
- int m_slices;
- float m_radius;
- float m_minorRadius;
- QAttribute *m_positionAttribute;
- QAttribute *m_normalAttribute;
- QAttribute *m_texCoordAttribute;
- QAttribute *m_indexAttribute;
- QBuffer *m_vertexBuffer;
- QBuffer *m_indexBuffer;
-
- Q_DECLARE_PUBLIC(QTorusGeometry)
-};
-
-} // Qt3D
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QTORUSGEOMETRY_P_H
-
diff --git a/src/render/geometry/qtorusmesh.cpp b/src/render/geometry/qtorusmesh.cpp
deleted file mode 100644
index 01aa79fba..000000000
--- a/src/render/geometry/qtorusmesh.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef _USE_MATH_DEFINES
-# define _USE_MATH_DEFINES // For MSVC
-#endif
-
-#include "qtorusmesh.h"
-#include "qtorusgeometry.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-/*!
- * \qmltype TorusMesh
- * \instantiates Qt3DRender::QTorusMesh
- * \inqmlmodule Qt3D.Render
- * \brief A custom mesh.
- */
-
-/*!
- * \qmlproperty int TorusMesh::rings
- *
- * Holds the number of rings in the mesh.
- */
-
-/*!
- * \qmlproperty int TorusMesh::slices
- *
- * Holds the number of slices in the mesh.
- */
-
-/*!
- * \qmlproperty float TorusMesh::radius
- *
- * Holds the outer radius of the torus.
- */
-
-/*!
- * \qmlproperty float TorusMesh::minorRadius
- *
- * Holds the inner radius of the torus.
- */
-
-/*!
- * \class Qt3DRender::QTorusMesh
- * \inmodule Qt3DRender
- *
- * \inherits Qt3DRender::QGeometryRenderer
- *
- * \brief A custom mesh.
- */
-
-/*!
- * Constructs a new QTorusMesh with \a parent.
- */
-QTorusMesh::QTorusMesh(QNode *parent)
- : QGeometryRenderer(parent)
-{
- QTorusGeometry *geometry = new QTorusGeometry(this);
- QObject::connect(geometry, &QTorusGeometry::radiusChanged, this, &QTorusMesh::radiusChanged);
- QObject::connect(geometry, &QTorusGeometry::ringsChanged, this, &QTorusMesh::ringsChanged);
- QObject::connect(geometry, &QTorusGeometry::slicesChanged, this, &QTorusMesh::slicesChanged);
- QObject::connect(geometry, &QTorusGeometry::minorRadiusChanged, this, &QTorusMesh::minorRadiusChanged);
-
- QGeometryRenderer::setGeometry(geometry);
-}
-
-/*!
- * Destroys this torus mesh.
- */
-QTorusMesh::~QTorusMesh()
-{
- QGeometryRenderer::cleanup();
-}
-
-void QTorusMesh::setRings(int rings)
-{
- static_cast<QTorusGeometry *>(geometry())->setRings(rings);
-}
-
-void QTorusMesh::setSlices(int slices)
-{
- static_cast<QTorusGeometry *>(geometry())->setSlices(slices);
-}
-
-void QTorusMesh::setRadius(float radius)
-{
- static_cast<QTorusGeometry *>(geometry())->setRadius(radius);
-}
-
-void QTorusMesh::setMinorRadius(float minorRadius)
-{
- static_cast<QTorusGeometry *>(geometry())->setMinorRadius(minorRadius);
-}
-
-/*!
- * \property QTorusMesh::rings
- *
- * Holds the number of rings in the mesh.
- */
-int QTorusMesh::rings() const
-{
- return static_cast<QTorusGeometry *>(geometry())->rings();
-}
-
-/*!
- * \property QTorusMesh::slices
- *
- * Holds the number of slices in the mesh.
- */
-int QTorusMesh::slices() const
-{
- return static_cast<QTorusGeometry *>(geometry())->slices();
-}
-
-/*!
- * \property QTorusMesh::radius
- *
- * Holds the outer radius of the torus.
- */
-float QTorusMesh::radius() const
-{
- return static_cast<QTorusGeometry *>(geometry())->radius();
-}
-
-/*!
- * \property QTorusMesh::minorRadius
- *
- * Holds the inner radius of the torus.
- */
-float QTorusMesh::minorRadius() const
-{
- return static_cast<QTorusGeometry *>(geometry())->minorRadius();
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/geometry/qtorusmesh.h b/src/render/geometry/qtorusmesh.h
deleted file mode 100644
index be8ed58e4..000000000
--- a/src/render/geometry/qtorusmesh.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QTORUSMESH_H
-#define QT3DRENDER_QTORUSMESH_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qgeometryrenderer.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QT3DRENDERSHARED_EXPORT QTorusMesh : public QGeometryRenderer
-{
- Q_OBJECT
- Q_PROPERTY(int rings READ rings WRITE setRings NOTIFY ringsChanged)
- Q_PROPERTY(int slices READ slices WRITE setSlices NOTIFY slicesChanged)
- Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(float minorRadius READ minorRadius WRITE setMinorRadius NOTIFY minorRadiusChanged)
-public:
- explicit QTorusMesh(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTorusMesh();
-
- int rings() const;
- int slices() const;
- float radius() const;
- float minorRadius() const;
-
-public Q_SLOTS:
- void setRings(int rings);
- void setSlices(int slices);
- void setRadius(float radius);
- void setMinorRadius(float minorRadius);
-
-Q_SIGNALS:
- void radiusChanged(float radius);
- void ringsChanged(int rings);
- void slicesChanged(int slices);
- void minorRadiusChanged(float minorRadius);
-
-private:
- // As this is a default provided geometry renderer, no one should be able
- // to modify the QGeometryRenderer's properties
-
- void setInstanceCount(int instanceCount);
- void setPrimitiveCount(int primitiveCount);
- void setBaseVertex(int baseVertex);
- void setBaseInstance(int baseInstance);
- void setRestartIndex(int index);
- void setPrimitiveRestart(bool enabled);
- void setGeometry(QGeometry *geometry);
- void setPrimitiveType(PrimitiveType primitiveType);
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QTORUSMESH_H
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index e94611010..1372d217e 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -51,6 +54,7 @@
#include <Qt3DRender/private/graphicshelperinterface_p.h>
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
+#include <Qt3DRender/private/buffermanager_p.h>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/attachmentpack_p.h>
#include <QOpenGLShaderProgram>
@@ -70,6 +74,7 @@
#include <QSurface>
#include <QWindow>
#include <QOpenGLTexture>
+#include <QOpenGLDebugLogger>
QT_BEGIN_NAMESPACE
@@ -78,32 +83,31 @@ namespace Render {
static QHash<unsigned int, GraphicsContext*> static_contexts;
-namespace {
-
-QOpenGLBuffer createGLBufferFor(Buffer *buffer)
+static void logOpenGLDebugMessage(const QOpenGLDebugMessage &debugMessage)
{
- QOpenGLBuffer b(static_cast<QOpenGLBuffer::Type>(buffer->type()));
- b.setUsagePattern(static_cast<QOpenGLBuffer::UsagePattern>(buffer->usage()));
- if (!b.create())
- qCWarning(Render::Io) << Q_FUNC_INFO << "buffer creation failed";
-
- if (!b.bind())
- qCWarning(Render::Io) << Q_FUNC_INFO << "buffer binding failed";
-
- b.allocate(buffer->data().constData(), buffer->data().size());
- return b;
+ qDebug() << "OpenGL debug message:" << debugMessage;
}
-void uploadDataToGLBuffer(Buffer *buffer, QOpenGLBuffer &b, bool releaseBuffer = false)
+namespace {
+
+GLBuffer::Type bufferTypeToGLBufferType(QBuffer::BufferType type)
{
- if (!b.bind())
- qCWarning(Render::Io) << Q_FUNC_INFO << "buffer bind failed";
- const int bufferSize = buffer->data().size();
- b.allocate(NULL, bufferSize); // orphan the buffer
- b.allocate(buffer->data().constData(), bufferSize);
- if (releaseBuffer)
- b.release();
- qCDebug(Render::Io) << "uploaded buffer size=" << buffer->data().size();
+ switch (type) {
+ case QBuffer::VertexBuffer:
+ return GLBuffer::ArrayBuffer;
+ case QBuffer::IndexBuffer:
+ return GLBuffer::IndexBuffer;
+ case QBuffer::PixelPackBuffer:
+ return GLBuffer::PixelPackBuffer;
+ case QBuffer::PixelUnpackBuffer:
+ return GLBuffer::PixelUnpackBuffer;
+ case QBuffer::UniformBuffer:
+ return GLBuffer::UniformBuffer;
+ case QBuffer::ShaderStorageBuffer:
+ return GLBuffer::ShaderStorageBuffer;
+ default:
+ Q_UNREACHABLE();
+ }
}
} // anonymous
@@ -122,19 +126,23 @@ unsigned int nextFreeContextId()
GraphicsContext::GraphicsContext()
: m_initialized(false)
, m_id(nextFreeContextId())
- , m_gl(Q_NULLPTR)
- , m_surface(Q_NULLPTR)
- , m_glHelper(Q_NULLPTR)
+ , m_gl(nullptr)
+ , m_surface(nullptr)
+ , m_glHelper(nullptr)
, m_ownCurrent(true)
- , m_activeShader(Q_NULLPTR)
- , m_material(Q_NULLPTR)
+ , m_activeShader(nullptr)
+ , m_currClearStencilValue(0)
+ , m_currClearDepthValue(1.f)
+ , m_currClearColorValue(0,0,0,0)
+ , m_material(nullptr)
, m_activeFBO(0)
, m_defaultFBO(0)
- , m_stateSet(Q_NULLPTR)
- , m_renderer(Q_NULLPTR)
- , m_contextInfo(new QGraphicsApiFilter())
+ , m_boundArrayBuffer(nullptr)
+ , m_stateSet(nullptr)
+ , m_renderer(nullptr)
, m_uboTempArray(QByteArray(1024, 0))
, m_supportsVAO(true)
+ , m_debugLogger(nullptr)
{
static_contexts[m_id] = this;
}
@@ -174,51 +182,67 @@ void GraphicsContext::initialize()
qCDebug(Backend) << "VAO support = " << m_supportsVAO;
}
-bool GraphicsContext::beginDrawing(QSurface *surface, const QColor &color)
+bool GraphicsContext::beginDrawing(QSurface *surface)
{
Q_ASSERT(surface);
Q_ASSERT(m_gl);
m_surface = surface;
- if (m_surface && m_surface->surfaceClass() == QSurface::Window) {
- if (!static_cast<QWindow *>(m_surface)->isExposed())
- return false;
- }
+ // TO DO: Find a way to make to pause work if the window is not exposed
+ // if (m_surface && m_surface->surfaceClass() == QSurface::Window) {
+ // qDebug() << Q_FUNC_INFO << 1;
+ // if (!static_cast<QWindow *>(m_surface)->isExposed())
+ // return false;
+ // qDebug() << Q_FUNC_INFO << 2;
+ // }
+ // Makes the surface current on the OpenGLContext
+ // and sets the right glHelper
m_ownCurrent = !(m_gl->surface() == m_surface);
if (m_ownCurrent && !makeCurrent(m_surface))
return false;
+ // Sets or Create the correct m_glHelper
+ // for the current surface
+ activateGLHelper();
+
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
GLint err = m_gl->functions()->glGetError();
if (err != 0) {
qCWarning(Backend) << Q_FUNC_INFO << "glGetError:" << err;
}
+#endif
if (!m_initialized) {
initialize();
}
- clearColor(color);
+ // need to reset these values every frame, may get overwritten elsewhere
+ m_gl->functions()->glClearColor(m_currClearColorValue.redF(), m_currClearColorValue.greenF(), m_currClearColorValue.blueF(), m_currClearColorValue.alphaF());
+ m_gl->functions()->glClearDepthf(m_currClearDepthValue);
+ m_gl->functions()->glClearStencil(m_currClearStencilValue);
+
if (m_activeShader)
m_activeShader = NULL;
m_activeTextures.fill(0);
+ m_boundArrayBuffer = nullptr;
return true;
}
-void GraphicsContext::clearBackBuffer(QClearBuffer::BufferType buffers)
+void GraphicsContext::clearBackBuffer(QClearBuffers::BufferTypeFlags buffers)
{
- if (buffers != QClearBuffer::None) {
+ if (buffers != QClearBuffers::None) {
GLbitfield mask = 0;
- if (buffers & QClearBuffer::ColorBuffer)
+ if (buffers & QClearBuffers::ColorBuffer)
mask |= GL_COLOR_BUFFER_BIT;
- if (buffers & QClearBuffer::DepthBuffer)
+ if (buffers & QClearBuffers::DepthBuffer)
mask |= GL_DEPTH_BUFFER_BIT;
- if (buffers & QClearBuffer::StencilBuffer)
+ if (buffers & QClearBuffers::StencilBuffer)
mask |= GL_STENCIL_BUFFER_BIT;
m_gl->functions()->glClear(mask);
@@ -231,11 +255,11 @@ void GraphicsContext::endDrawing(bool swapBuffers)
m_gl->swapBuffers(m_surface);
if (m_ownCurrent)
m_gl->doneCurrent();
- m_stateSet = Q_NULLPTR;
+ m_stateSet = nullptr;
decayTextureScores();
}
-void GraphicsContext::setViewport(const QRectF &viewport)
+void GraphicsContext::setViewport(const QRectF &viewport, const QSize &surfaceSize)
{
m_viewport = viewport;
QSize renderTargetSize;
@@ -243,6 +267,8 @@ void GraphicsContext::setViewport(const QRectF &viewport)
// For external FBOs we may not have a m_renderTargets entry.
if (m_renderTargetsSize.contains(m_activeFBO)) {
renderTargetSize = m_renderTargetsSize[m_activeFBO];
+ } else if (surfaceSize.isValid()) {
+ renderTargetSize = surfaceSize;
} else {
// External FBO (when used with QtQuick2 Scene3D)
@@ -296,22 +322,41 @@ void GraphicsContext::releaseOpenGL()
{
m_renderShaderHash.clear();
m_renderBufferHash.clear();
+
+ // Stop and destroy the OpenGL logger
+ if (m_debugLogger) {
+ m_debugLogger->stopLogging();
+ m_debugLogger.reset(nullptr);
+ }
}
-void GraphicsContext::setOpenGLContext(QOpenGLContext* ctx, QSurface *surface)
+// The OpenGLContext is not current on any surface at this point
+void GraphicsContext::setOpenGLContext(QOpenGLContext* ctx)
{
- Q_ASSERT(surface);
Q_ASSERT(ctx);
releaseOpenGL();
m_gl = ctx;
+}
- if (makeCurrent(surface)) {
- resolveHighestOpenGLFunctions();
- m_gl->doneCurrent();
+void GraphicsContext::activateGLHelper()
+{
+ // Sets the correct GL Helper depending on the surface
+ // If no helper exists, create one
+ m_glHelper = m_glHelpers.value(m_surface);
+ if (!m_glHelper) {
+ m_glHelper = resolveHighestOpenGLFunctions();
+ m_glHelpers.insert(m_surface, m_glHelper);
+ // Note: OpenGLContext is current at this point
+ m_gl->functions()->glDisable(GL_DITHER);
}
}
+bool GraphicsContext::hasValidGLHelper() const
+{
+ return m_glHelper != nullptr;
+}
+
bool GraphicsContext::makeCurrent(QSurface *surface)
{
Q_ASSERT(m_gl);
@@ -319,6 +364,15 @@ bool GraphicsContext::makeCurrent(QSurface *surface)
qCWarning(Backend) << Q_FUNC_INFO << "makeCurrent failed";
return false;
}
+
+ // Set the correct GL Helper depending on the surface
+ // If no helper exists, create one
+
+ m_glHelper = m_glHelpers.value(surface);
+ if (!m_glHelper) {
+ m_glHelper = resolveHighestOpenGLFunctions();
+ m_glHelpers.insert(surface, m_glHelper);
+ }
return true;
}
@@ -331,9 +385,9 @@ void GraphicsContext::doneCurrent()
// That assumes that the shaderProgram in Shader stays the same
void GraphicsContext::activateShader(Shader *shader)
{
- if (shader == Q_NULLPTR) {
- m_activeShader = Q_NULLPTR;
- m_material = Q_NULLPTR;
+ if (shader == nullptr) {
+ m_activeShader = nullptr;
+ m_material = nullptr;
m_glHelper->useProgram(0);
return;
}
@@ -348,7 +402,9 @@ void GraphicsContext::activateShader(Shader *shader)
shader->initializeAttributes(m_glHelper->programAttributesAndLocations(prog->programId()));
if (m_glHelper->supportsFeature(GraphicsHelperInterface::UniformBufferObject))
shader->initializeUniformBlocks(m_glHelper->programUniformBlocks(prog->programId()));
- m_activeShader = Q_NULLPTR;
+ if (m_glHelper->supportsFeature(GraphicsHelperInterface::ShaderStorageObject))
+ shader->initializeShaderStorageBlocks(m_glHelper->programShaderStorageBlocks(prog->programId()));
+ m_activeShader = nullptr;
} else if (!shader->isLoaded()) {
// Shader program is already in the m_shaderHash but we still need to
// ensure that the Shader has full knowledge of attributes, uniforms,
@@ -356,45 +412,51 @@ void GraphicsContext::activateShader(Shader *shader)
shader->initialize(*m_renderShaderHash.value(shader->dna()));
}
- if (m_activeShader != Q_NULLPTR && m_activeShader->dna() == shader->dna()) {
-
+ if (m_activeShader != nullptr && m_activeShader->dna() == shader->dna()) {
// no op
} else {
m_activeShader = shader;
QOpenGLShaderProgram* prog = m_renderShaderHash[shader->dna()]->getOrCreateProgram(this);
prog->bind();
// ensure material uniforms are re-applied
- m_material = Q_NULLPTR;
+ m_material = nullptr;
}
}
/*!
* \internal
* Returns the QOpenGLShaderProgram matching the ProgramDNA \a dna. If no match
- * is found, Q_NULLPTR is returned.
+ * is found, nullptr is returned.
*/
QOpenGLShaderProgram *GraphicsContext::containsProgram(const ProgramDNA &dna)
{
- Shader *renderShader = m_renderShaderHash.value(dna, Q_NULLPTR);
+ Shader *renderShader = m_renderShaderHash.value(dna, nullptr);
if (renderShader)
return renderShader->getOrCreateProgram(this);
- return Q_NULLPTR;
+ return nullptr;
+}
+
+void GraphicsContext::removeProgram(const ProgramDNA &dna, Qt3DCore::QNodeId id)
+{
+ Shader *renderShader = m_renderShaderHash.value(dna, nullptr);
+ if (renderShader && renderShader->peerId() == id)
+ m_renderShaderHash.remove(dna);
}
void GraphicsContext::activateRenderTarget(RenderTarget *renderTarget, const AttachmentPack &attachments, GLuint defaultFboId)
{
GLuint fboId = defaultFboId; // Default FBO
- if (renderTarget != Q_NULLPTR) {
+ if (renderTarget != nullptr) {
// New RenderTarget
- if (!m_renderTargets.contains(renderTarget->peerUuid())) {
+ if (!m_renderTargets.contains(renderTarget->peerId())) {
if (m_defaultFBO && fboId == m_defaultFBO) {
// this is the default fbo that some platforms create (iOS), we just register it
// Insert FBO into hash
- m_renderTargets.insert(renderTarget->peerUuid(), fboId);
+ m_renderTargets.insert(renderTarget->peerId(), fboId);
} else if ((fboId = m_glHelper->createFrameBufferObject()) != 0) {
// The FBO is created and its attachments are set once
// Insert FBO into hash
- m_renderTargets.insert(renderTarget->peerUuid(), fboId);
+ m_renderTargets.insert(renderTarget->peerId(), fboId);
// Bind FBO
m_glHelper->bindFrameBufferObject(fboId);
bindFrameBufferAttachmentHelper(fboId, attachments);
@@ -402,14 +464,15 @@ void GraphicsContext::activateRenderTarget(RenderTarget *renderTarget, const Att
qCritical() << "Failed to create FBO";
}
} else {
- fboId = m_renderTargets.value(renderTarget->peerUuid());
+ fboId = m_renderTargets.value(renderTarget->peerId());
// We need to check if one of the attachment was resized
TextureManager *textureManager = m_renderer->nodeManagers()->textureManager();
bool needsResize = false;
- Q_FOREACH (const Attachment &attachment, attachments.attachments()) {
+ const auto attachments_ = attachments.attachments();
+ for (const Attachment &attachment : attachments_) {
Texture *rTex = textureManager->lookupResource(attachment.m_textureUuid);
- if (rTex != Q_NULLPTR)
+ if (rTex != nullptr)
needsResize |= rTex->isTextureReset();
}
if (needsResize) {
@@ -430,11 +493,12 @@ void GraphicsContext::bindFrameBufferAttachmentHelper(GLuint fboId, const Attach
QSize fboSize;
TextureManager *textureManager = m_renderer->nodeManagers()->textureManager();
- Q_FOREACH (const Attachment &attachment, attachments.attachments()) {
+ const auto attachments_ = attachments.attachments();
+ for (const Attachment &attachment : attachments_) {
Texture *rTex =textureManager->lookupResource(attachment.m_textureUuid);
- if (rTex != Q_NULLPTR) {
+ if (rTex != nullptr) {
QOpenGLTexture *glTex = rTex->getOrCreateGLTexture();
- if (glTex != Q_NULLPTR) {
+ if (glTex != nullptr) {
if (fboSize.isEmpty())
fboSize = QSize(glTex->width(), glTex->height());
else
@@ -448,27 +512,13 @@ void GraphicsContext::bindFrameBufferAttachmentHelper(GLuint fboId, const Attach
void GraphicsContext::activateDrawBuffers(const AttachmentPack &attachments)
{
- int activeDrawBuffers[QRenderAttachment::ColorAttachment15 + 1];
- int i = 0;
-
- const QList<QRenderAttachment::RenderAttachmentType> &drawBuffers = attachments.drawBuffers();
-
- // If drawBuffers is empty, use all the attachments as draw buffers
- if (drawBuffers.isEmpty()) {
- Q_FOREACH (const Attachment &attachment, attachments.attachments())
- if (attachment.m_type <= QRenderAttachment::ColorAttachment15)
- activeDrawBuffers[i++] = attachment.m_type;
- } else {
- Q_FOREACH (const QRenderAttachment::RenderAttachmentType drawBuffer, drawBuffers)
- if (drawBuffer <= QRenderAttachment::ColorAttachment15)
- activeDrawBuffers[i++] = drawBuffer;
- }
+ const QVector<int> activeDrawBuffers = attachments.getGlDrawBuffers();
if (m_glHelper->checkFrameBufferComplete()) {
- if (i > 1) {// We need MRT
+ if (activeDrawBuffers.size() > 1) {// We need MRT
if (m_glHelper->supportsFeature(GraphicsHelperInterface::MRT)) {
// Set up MRT, glDrawBuffers...
- m_glHelper->drawBuffers(i, activeDrawBuffers);
+ m_glHelper->drawBuffers(activeDrawBuffers.size(), activeDrawBuffers.data());
}
}
} else {
@@ -486,11 +536,6 @@ void GraphicsContext::setActiveMaterial(Material *rmat)
m_material = rmat;
}
-// TO DO : Try to move what's in Renderer here
-void GraphicsContext::executeCommand(const RenderCommand *)
-{
-}
-
int GraphicsContext::activateTexture(TextureScope scope, Texture *tex, int onUnit)
{
// Returns the texture unit to use for the texture
@@ -504,16 +549,18 @@ int GraphicsContext::activateTexture(TextureScope scope, Texture *tex, int onUni
// actually re-bind if required, the tex->dna on the unit not being the same
// Note: tex->dna() could be 0 if the texture has not been created yet
- if (m_activeTextures[onUnit] != tex->dna() || tex->dna() == 0) {
+ if (m_activeTextures[onUnit] != tex->dna() || tex->dna() == 0 || tex->dataUploadRequired()) {
QOpenGLTexture *glTex = tex->getOrCreateGLTexture();
glTex->bind(onUnit);
m_activeTextures[onUnit] = tex->dna();
}
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
int err = m_gl->functions()->glGetError();
if (err)
qCWarning(Backend) << "GL error after activating texture" << QString::number(err, 16)
<< tex->textureId() << "on unit" << onUnit;
+#endif
m_textureScores.insert(m_activeTextures[onUnit], 200);
m_pinnedTextureUnits[onUnit] = true;
@@ -539,46 +586,77 @@ void GraphicsContext::deactivateTexturesWithScope(TextureScope ts)
* Finds the highest supported opengl version and internally use the most optimized
* helper for a given version.
*/
-void GraphicsContext::resolveHighestOpenGLFunctions()
+GraphicsHelperInterface *GraphicsContext::resolveHighestOpenGLFunctions()
{
Q_ASSERT(m_gl);
+ GraphicsHelperInterface *glHelper = nullptr;
if (m_gl->isOpenGLES()) {
- m_glHelper = new GraphicsHelperES2();
- m_glHelper->initializeHelper(m_gl, Q_NULLPTR);
+ glHelper = new GraphicsHelperES2();
+ glHelper->initializeHelper(m_gl, nullptr);
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 2/ES2 Helper";
}
#ifndef QT_OPENGL_ES_2
else {
- QAbstractOpenGLFunctions *glFunctions = Q_NULLPTR;
- if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_4_3_Core>()) != Q_NULLPTR) {
+ QAbstractOpenGLFunctions *glFunctions = nullptr;
+ if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_4_3_Core>()) != nullptr) {
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 4.3";
- m_glHelper = new GraphicsHelperGL4();
- } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_3_3_Core>()) != Q_NULLPTR) {
+ glHelper = new GraphicsHelperGL4();
+ } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_3_3_Core>()) != nullptr) {
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 3.3";
- m_glHelper = new GraphicsHelperGL3_3();
- } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_3_2_Core>()) != Q_NULLPTR) {
+ glHelper = new GraphicsHelperGL3_3();
+ } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_3_2_Core>()) != nullptr) {
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 3.2";
- m_glHelper = new GraphicsHelperGL3();
- } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_2_0>()) != Q_NULLPTR) {
+ glHelper = new GraphicsHelperGL3();
+ } else if ((glFunctions = m_gl->versionFunctions<QOpenGLFunctions_2_0>()) != nullptr) {
qCDebug(Backend) << Q_FUNC_INFO << " Building OpenGL 2 Helper";
- m_glHelper = new GraphicsHelperGL2();
+ glHelper = new GraphicsHelperGL2();
}
- Q_ASSERT_X(m_glHelper, "GraphicsContext::resolveHighestOpenGLFunctions", "unable to create valid helper for available OpenGL version");
- m_glHelper->initializeHelper(m_gl, glFunctions);
+ Q_ASSERT_X(glHelper, "GraphicsContext::resolveHighestOpenGLFunctions", "unable to create valid helper for available OpenGL version");
+ glHelper->initializeHelper(m_gl, glFunctions);
}
#endif
+ // Note: at this point we are certain the context (m_gl) is current with a surface
+ const QByteArray debugLoggingMode = qgetenv("QT3DRENDER_DEBUG_LOGGING");
+ const bool enableDebugLogging = !debugLoggingMode.isEmpty();
+
+ if (enableDebugLogging && !m_debugLogger) {
+ if (m_gl->hasExtension("GL_KHR_debug")) {
+ qCDebug(Backend) << "Qt3D: Enabling OpenGL debug logging";
+ m_debugLogger.reset(new QOpenGLDebugLogger);
+ if (m_debugLogger->initialize()) {
+ QObject::connect(m_debugLogger.data(), &QOpenGLDebugLogger::messageLogged, &logOpenGLDebugMessage);
+ const QString mode = QString::fromLocal8Bit(debugLoggingMode);
+ m_debugLogger->startLogging(mode.toLower().startsWith(QLatin1String("sync"))
+ ? QOpenGLDebugLogger::SynchronousLogging
+ : QOpenGLDebugLogger::AsynchronousLogging);
+
+ const auto msgs = m_debugLogger->loggedMessages();
+ for (const QOpenGLDebugMessage &msg : msgs)
+ logOpenGLDebugMessage(msg);
+ }
+ } else {
+ qCDebug(Backend) << "Qt3D: OpenGL debug logging requested but GL_KHR_debug not supported";
+ }
+ }
+
+
// Set Vendor and Extensions of reference GraphicsApiFilter
+ // TO DO: would that vary like the glHelper ?
+
QStringList extensions;
- Q_FOREACH (const QByteArray &ext, m_gl->extensions().values())
+ const auto exts = m_gl->extensions();
+ for (const QByteArray &ext : exts)
extensions << QString::fromUtf8(ext);
- m_contextInfo->setMajorVersion(m_gl->format().version().first);
- m_contextInfo->setMinorVersion(m_gl->format().version().second);
- m_contextInfo->setApi(m_gl->isOpenGLES() ? QGraphicsApiFilter::OpenGLES : QGraphicsApiFilter::OpenGL);
- m_contextInfo->setProfile(static_cast<QGraphicsApiFilter::Profile>(m_gl->format().profile()));
- m_contextInfo->setExtensions(extensions);
- m_contextInfo->setVendor(QString::fromUtf8(reinterpret_cast<const char *>(m_gl->functions()->glGetString(GL_VENDOR))));
+ m_contextInfo.m_major = m_gl->format().version().first;
+ m_contextInfo.m_minor = m_gl->format().version().second;
+ m_contextInfo.m_api = m_gl->isOpenGLES() ? QGraphicsApiFilter::OpenGLES : QGraphicsApiFilter::OpenGL;
+ m_contextInfo.m_profile = static_cast<QGraphicsApiFilter::OpenGLProfile>(m_gl->format().profile());
+ m_contextInfo.m_extensions = extensions;
+ m_contextInfo.m_vendor = QString::fromUtf8(reinterpret_cast<const char *>(m_gl->functions()->glGetString(GL_VENDOR)));
+
+ return glHelper;
}
void GraphicsContext::deactivateTexture(Texture* tex)
@@ -608,9 +686,14 @@ RenderStateSet *GraphicsContext::currentStateSet() const
return m_stateSet;
}
-QGraphicsApiFilter *GraphicsContext::contextInfo() const
+const GraphicsApiFilterData *GraphicsContext::contextInfo() const
+{
+ return &m_contextInfo;
+}
+
+bool GraphicsContext::supportsDrawBuffersBlend() const
{
- return m_contextInfo;
+ return m_glHelper->supportsFeature(GraphicsHelperInterface::DrawBuffersBlend);
}
/*!
@@ -618,21 +701,21 @@ QGraphicsApiFilter *GraphicsContext::contextInfo() const
* If the call is not supported by the system's OpenGL version,
* it is simulated with a loop.
*/
-void GraphicsContext::drawElementsInstanced(GLenum primitiveType,
- GLsizei primitiveCount,
- GLint indexType,
- void *indices,
- GLsizei instances,
- GLint baseVertex,
- GLint baseInstance)
-{
- m_glHelper->drawElementsInstanced(primitiveType,
- primitiveCount,
- indexType,
- indices,
- instances,
- baseVertex,
- baseInstance);
+void GraphicsContext::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType,
+ GLsizei primitiveCount,
+ GLint indexType,
+ void *indices,
+ GLsizei instances,
+ GLint baseVertex,
+ GLint baseInstance)
+{
+ m_glHelper->drawElementsInstancedBaseVertexBaseInstance(primitiveType,
+ primitiveCount,
+ indexType,
+ indices,
+ instances,
+ baseVertex,
+ baseInstance);
}
/*!
@@ -649,6 +732,15 @@ void GraphicsContext::drawArraysInstanced(GLenum primitiveType,
instances);
}
+void GraphicsContext::drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseinstance)
+{
+ m_glHelper->drawArraysInstancedBaseInstance(primitiveType,
+ first,
+ count,
+ instances,
+ baseinstance);
+}
+
/*!
* Wraps an OpenGL call to glDrawElements.
*/
@@ -692,6 +784,11 @@ void GraphicsContext::blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
m_glHelper->blendFunci(buf, sfactor, dfactor);
}
+void GraphicsContext::blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha)
+{
+ m_glHelper->blendFuncSeparatei(buf, sRGB, dRGB, sAlpha, dAlpha);
+}
+
void GraphicsContext::alphaTest(GLenum mode1, GLenum mode2)
{
m_glHelper->alphaTest(mode1, mode2);
@@ -707,11 +804,6 @@ void GraphicsContext::depthMask(GLenum mode)
m_glHelper->depthMask(mode);
}
-void GraphicsContext::cullFace(GLenum mode)
-{
- m_glHelper->cullFace(mode);
-}
-
void GraphicsContext::frontFace(GLenum mode)
{
m_glHelper->frontFace(mode);
@@ -734,6 +826,11 @@ void GraphicsContext::bindUniformBlock(GLuint programId, GLuint uniformBlockInde
m_glHelper->bindUniformBlock(programId, uniformBlockIndex, uniformBlockBinding);
}
+void GraphicsContext::bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding)
+{
+ m_glHelper->bindShaderStorageBlock(programId, shaderStorageBlockIndex, shaderStorageBlockBinding);
+}
+
void GraphicsContext::bindBufferBase(GLenum target, GLuint bindingIndex, GLuint buffer)
{
m_glHelper->bindBufferBase(target, bindingIndex, buffer);
@@ -744,14 +841,19 @@ void GraphicsContext::buildUniformBuffer(const QVariant &v, const ShaderUniform
m_glHelper->buildUniformBuffer(v, description, buffer);
}
-void GraphicsContext::enableAlphaCoverage()
+void GraphicsContext::setMSAAEnabled(bool enabled)
{
- m_glHelper->enableAlphaCoverage();
+ m_glHelper->setMSAAEnabled(enabled);
}
-void GraphicsContext::disableAlphaCoverage()
+void GraphicsContext::setAlphaCoverageEnabled(bool enabled)
{
- m_glHelper->disableAlphaCoverage();
+ m_glHelper->setAlphaCoverageEnabled(enabled);
+}
+
+void GraphicsContext::clearBufferf(GLint drawbuffer, const QVector4D &values)
+{
+ m_glHelper->clearBufferf(drawbuffer, values);
}
GLuint GraphicsContext::boundFrameBufferObject()
@@ -761,7 +863,26 @@ GLuint GraphicsContext::boundFrameBufferObject()
void GraphicsContext::clearColor(const QColor &color)
{
- m_gl->functions()->glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF());
+ if (m_currClearColorValue != color) {
+ m_currClearColorValue = color;
+ m_gl->functions()->glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF());
+ }
+}
+
+void GraphicsContext::clearDepthValue(float depth)
+{
+ if (m_currClearDepthValue != depth) {
+ m_currClearDepthValue = depth;
+ m_gl->functions()->glClearDepthf(depth);
+ }
+}
+
+void GraphicsContext::clearStencilValue(int stencil)
+{
+ if (m_currClearStencilValue != stencil) {
+ m_currClearStencilValue = stencil;
+ m_gl->functions()->glClearStencil(stencil);
+ }
}
void GraphicsContext::enableClipPlane(int clipPlane)
@@ -774,6 +895,11 @@ void GraphicsContext::disableClipPlane(int clipPlane)
m_glHelper->disableClipPlane(clipPlane);
}
+void GraphicsContext::setClipPlane(int clipPlane, const QVector3D &normal, float distance)
+{
+ m_glHelper->setClipPlane(clipPlane, normal, distance);
+}
+
GLint GraphicsContext::maxClipPlaneCount()
{
return m_glHelper->maxClipPlaneCount();
@@ -796,6 +922,27 @@ void GraphicsContext::pointSize(bool programmable, GLfloat value)
m_glHelper->pointSize(programmable, value);
}
+void GraphicsContext::dispatchCompute(int x, int y, int z)
+{
+ if (m_glHelper->supportsFeature(GraphicsHelperInterface::Compute))
+ m_glHelper->dispatchCompute(x, y, z);
+}
+
+void GraphicsContext::enablei(GLenum cap, GLuint index)
+{
+ m_glHelper->enablei(cap, index);
+}
+
+void GraphicsContext::disablei(GLenum cap, GLuint index)
+{
+ m_glHelper->disablei(cap, index);
+}
+
+void GraphicsContext::setSeamlessCubemap(bool enable)
+{
+ m_glHelper->setSeamlessCubemap(enable);
+}
+
/*!
\internal
Returns a texture unit for a texture, -1 if all texture units are assigned.
@@ -858,7 +1005,7 @@ void GraphicsContext::setRenderer(Renderer *renderer)
// It will be easier if the QGraphicContext applies the QUniformPack
// than the other way around
-void GraphicsContext::setUniforms(QUniformPack &uniforms)
+void GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
{
// Activate textures and update TextureUniform in the pack
// with the correct textureUnit
@@ -869,83 +1016,77 @@ void GraphicsContext::setUniforms(QUniformPack &uniforms)
deactivateTexturesWithScope(TextureScopeMaterial);
// Update the uniforms with the correct texture unit id's
- const QHash<QString, const QUniformValue *> &uniformValues = uniforms.uniforms();
- for (int i = 0; i < uniforms.textures().size(); ++i) {
- const QUniformPack::NamedTexture &namedTex = uniforms.textures().at(i);
+ PackUniformHash &uniformValues = parameterPack.uniforms();
+
+ for (int i = 0; i < parameterPack.textures().size(); ++i) {
+ const ShaderParameterPack::NamedTexture &namedTex = parameterPack.textures().at(i);
Texture *t = manager->lookupResource<Texture, TextureManager>(namedTex.texId);
- const TextureUniform *texUniform = Q_NULLPTR;
// TO DO : Rework the way textures are loaded
- if (t != Q_NULLPTR) {
+ if (t != nullptr) {
int texUnit = activateTexture(TextureScopeMaterial, t);
- if (uniformValues.contains(namedTex.glslName)) {
- texUniform = static_cast<const TextureUniform *>(uniformValues[namedTex.glslName]);
- if (texUniform != Q_NULLPTR)
- const_cast<TextureUniform *>(texUniform)->setTextureUnit(texUnit);
+ if (uniformValues.contains(namedTex.glslNameId)) {
+ QUniformValue &texUniform = uniformValues[namedTex.glslNameId];
+ texUniform.setTextureUnit(texUnit);
}
}
}
- // Bind UniformBlocks to UBO and update UBO from ShaderData
- const QVector<BlockToUBO> &blockToUbos = uniforms.uniformBuffers();
- UniformBuffer *ubo = Q_NULLPTR;
- bool needsToUnbindUBO = false;
- for (int i = 0; i < blockToUbos.length(); ++i) {
- const ShaderUniformBlock &block = m_activeShader->uniformBlock(blockToUbos[i].m_blockIndex);
- if (block.m_index != -1 && block.m_size > 0) {
- ubo = manager->lookupResource<UniformBuffer, UBOManager>(ShaderDataShaderUboKey(blockToUbos[i].m_shaderDataID,
- m_activeShader->peerUuid()));
- // bind Uniform Block of index ubos[i].m_index to binding point i
- bindUniformBlock(m_activeShader->getOrCreateProgram(this)->programId(), block.m_index, i);
- // bind the UBO to the binding point i
- // Specs specify that there are at least 14 binding points
-
- // Allocate ubo if not allocated previously
- if (!ubo->isCreated()) {
- ubo->create(this);
- ubo->bind(this);
- ubo->allocate(this, block.m_size);
- }
-
- // update the ubo if needed
- if (blockToUbos[i].m_needsUpdate) {
- if (!ubo->isBound())
- ubo->bind(this);
- needsToUnbindUBO |= true;
- const QHash<QString, ShaderUniform> &activeUniformsInBlock = m_activeShader->activeUniformsForBlock(block.m_index);
- const QHash<QString, ShaderUniform>::const_iterator uniformsEnd = activeUniformsInBlock.end();
- QHash<QString, ShaderUniform>::const_iterator uniformsIt = activeUniformsInBlock.begin();
-
- while (uniformsIt != uniformsEnd) {
- if (blockToUbos[i].m_updatedProperties.contains(uniformsIt.key())) {
- buildUniformBuffer(blockToUbos[i].m_updatedProperties.value(uniformsIt.key()),
- uniformsIt.value(),
- m_uboTempArray);
- ubo->update(this, m_uboTempArray.constData() + uniformsIt.value().m_offset,
- uniformsIt.value().m_rawByteSize,
- uniformsIt.value().m_offset);
- }
- ++uniformsIt;
- }
- }
- // bind UBO to binding point
- ubo->bindToUniformBlock(this, i);
+ QOpenGLShaderProgram *shader = m_activeShader->getOrCreateProgram(this);
+
+ // TO DO: We could cache the binding points somehow and only do the binding when necessary
+ // for SSBO and UBO
+
+ // Bind Shader Storage block to SSBO and update SSBO
+ const QVector<BlockToSSBO> blockToSSBOs = parameterPack.shaderStorageBuffers();
+ int ssboIndex = 0;
+ for (const BlockToSSBO b : blockToSSBOs) {
+ Buffer *cpuBuffer = m_renderer->nodeManagers()->bufferManager()->lookupResource(b.m_bufferID);
+ GLBuffer *ssbo = glBufferForRenderBuffer(cpuBuffer);
+ bindShaderStorageBlock(shader->programId(), b.m_blockIndex, ssboIndex);
+ // Needed to avoid conflict where the buffer would already
+ // be bound as a VertexArray
+ bindGLBuffer(ssbo, GLBuffer::ShaderStorageBuffer);
+ ssbo->bindBufferBase(this, ssboIndex++, GLBuffer::ShaderStorageBuffer);
+ // Perform update if required
+ if (cpuBuffer->isDirty()) {
+ uploadDataToGLBuffer(cpuBuffer, ssbo);
+ cpuBuffer->unsetDirty();
}
+ // TO DO: Make sure that there's enough binding points
}
- if (needsToUnbindUBO)
- ubo->release(this);
+ // Bind UniformBlocks to UBO and update UBO from Buffer
+ // TO DO: Convert ShaderData to Buffer so that we can use that generic process
+ const QVector<BlockToUBO> blockToUBOs = parameterPack.uniformBuffers();
+ int uboIndex = 0;
+ for (const BlockToUBO &b : blockToUBOs) {
+ Buffer *cpuBuffer = m_renderer->nodeManagers()->bufferManager()->lookupResource(b.m_bufferID);
+ GLBuffer *ubo = glBufferForRenderBuffer(cpuBuffer);
+ bindUniformBlock(shader->programId(), b.m_blockIndex, uboIndex);
+ // Needed to avoid conflict where the buffer would already
+ // be bound as a VertexArray
+ bindGLBuffer(ubo, GLBuffer::UniformBuffer);
+ ubo->bindBufferBase(this, uboIndex++, GLBuffer::UniformBuffer);
+ if (cpuBuffer->isDirty()) {
+ // Perform update if required
+ uploadDataToGLBuffer(cpuBuffer, ubo);
+ cpuBuffer->unsetDirty();
+ }
+ // TO DO: Make sure that there's enough binding points
+ }
// Update uniforms in the Default Uniform Block
- m_activeShader->updateUniforms(this, uniforms);
+ m_activeShader->updateUniforms(this, parameterPack);
}
void GraphicsContext::specifyAttribute(const Attribute *attribute, Buffer *buffer, const QString &shaderName)
{
- if (attribute == Q_NULLPTR || buffer == Q_NULLPTR)
+ if (attribute == nullptr || buffer == nullptr)
return;
- QOpenGLBuffer buf = glBufferForRenderBuffer(buffer);
- buf.bind();
+ GLBuffer *buf = glBufferForRenderBuffer(buffer);
+ bindGLBuffer(buf, bufferTypeToGLBufferType(buffer->type()));
+ // bound within the current VAO
QOpenGLShaderProgram* prog = activeShader();
int location = prog->attributeLocation(shaderName);
@@ -955,9 +1096,9 @@ void GraphicsContext::specifyAttribute(const Attribute *attribute, Buffer *buffe
}
prog->enableAttributeArray(location);
prog->setAttributeBuffer(location,
- glDataTypeFromAttributeDataType(attribute->dataType()),
+ glDataTypeFromAttributeDataType(attribute->vertexBaseType()),
attribute->byteOffset(),
- attribute->dataSize(),
+ attribute->vertexSize(),
attribute->byteStride());
if (attribute->divisor() != 0) {
@@ -970,8 +1111,8 @@ void GraphicsContext::specifyIndices(Buffer *buffer)
{
Q_ASSERT(buffer->type() == QBuffer::IndexBuffer);
- QOpenGLBuffer buf = glBufferForRenderBuffer(buffer);
- if (!buf.bind())
+ GLBuffer *buf = glBufferForRenderBuffer(buffer);
+ if (!bindGLBuffer(buf, GLBuffer::IndexBuffer))
qCWarning(Backend) << Q_FUNC_INFO << "binding index buffer failed";
// bound within the current VAO
@@ -979,19 +1120,61 @@ void GraphicsContext::specifyIndices(Buffer *buffer)
void GraphicsContext::updateBuffer(Buffer *buffer)
{
- const QHash<Buffer *, QOpenGLBuffer>::iterator it = m_renderBufferHash.find(buffer);
+ const QHash<Qt3DCore::QNodeId, HGLBuffer>::iterator it = m_renderBufferHash.find(buffer->peerId());
if (it != m_renderBufferHash.end())
- uploadDataToGLBuffer(buffer, it.value());
+ uploadDataToGLBuffer(buffer, m_renderer->nodeManagers()->glBufferManager()->data(it.value()));
}
-QOpenGLBuffer GraphicsContext::glBufferForRenderBuffer(Buffer *buf)
+GLBuffer *GraphicsContext::glBufferForRenderBuffer(Buffer *buf)
{
- if (m_renderBufferHash.contains(buf))
- return m_renderBufferHash.value(buf);
+ if (!m_renderBufferHash.contains(buf->peerId()))
+ m_renderBufferHash.insert(buf->peerId(), createGLBufferFor(buf));
+ return m_renderer->nodeManagers()->glBufferManager()->data(m_renderBufferHash.value(buf->peerId()));
+}
+
+HGLBuffer GraphicsContext::createGLBufferFor(Buffer *buffer)
+{
+ GLBuffer *b = m_renderer->nodeManagers()->glBufferManager()->getOrCreateResource(buffer->peerId());
+ // b.setUsagePattern(static_cast<QOpenGLBuffer::UsagePattern>(buffer->usage()));
+ Q_ASSERT(b);
+ if (!b->create(this))
+ qCWarning(Render::Io) << Q_FUNC_INFO << "buffer creation failed";
- QOpenGLBuffer glbuf = createGLBufferFor(buf);
- m_renderBufferHash.insert(buf, glbuf);
- return glbuf;
+ if (!bindGLBuffer(b, bufferTypeToGLBufferType(buffer->type())))
+ qCWarning(Render::Io) << Q_FUNC_INFO << "buffer binding failed";
+
+ // TO DO: Handle usage pattern
+ b->allocate(this, buffer->data().constData(), buffer->data().size(), false);
+ return m_renderer->nodeManagers()->glBufferManager()->lookupHandle(buffer->peerId());
+}
+
+bool GraphicsContext::bindGLBuffer(GLBuffer *buffer, GLBuffer::Type type)
+{
+ if (type == GLBuffer::ArrayBuffer && buffer == m_boundArrayBuffer)
+ return true;
+
+ if (buffer->bind(this, type)) {
+ if (type == GLBuffer::ArrayBuffer)
+ m_boundArrayBuffer = buffer;
+ return true;
+ }
+ return false;
+}
+
+void GraphicsContext::uploadDataToGLBuffer(Buffer *buffer, GLBuffer *b, bool releaseBuffer)
+{
+ if (!bindGLBuffer(b, bufferTypeToGLBufferType(buffer->type())))
+ qCWarning(Render::Io) << Q_FUNC_INFO << "buffer bind failed";
+ const int bufferSize = buffer->data().size();
+ // TO DO: Handle usage pattern and sub data updates
+ b->allocate(this, bufferSize, false); // orphan the buffer
+ b->allocate(this, buffer->data().constData(), bufferSize, false);
+ if (releaseBuffer) {
+ b->release(this);
+ if (bufferTypeToGLBufferType(buffer->type()) == GLBuffer::ArrayBuffer)
+ m_boundArrayBuffer = nullptr;
+ }
+ qCDebug(Render::Io) << "uploaded buffer size=" << buffer->data().size();
}
GLint GraphicsContext::elementType(GLint type)
@@ -1080,7 +1263,7 @@ GLuint GraphicsContext::byteSizeFromType(GLint type)
return 0;
}
-GLint GraphicsContext::glDataTypeFromAttributeDataType(QAttribute::DataType dataType)
+GLint GraphicsContext::glDataTypeFromAttributeDataType(QAttribute::VertexBaseType dataType)
{
switch (dataType) {
case QAttribute::Byte:
diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h
index c377d237b..4c41c0e4b 100644
--- a/src/render/graphicshelpers/graphicscontext_p.h
+++ b/src/render/graphicshelpers/graphicscontext_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -51,26 +54,27 @@
#include <QOpenGLContext>
#include <QOpenGLFunctions>
-#include <QOpenGLBuffer>
#include <QOpenGLVertexArrayObject>
#include <QHash>
#include <QColor>
#include <QMatrix4x4>
#include <QBitArray>
#include <Qt3DRender/private/quniformvalue_p.h>
-#include <Qt3DRender/qclearbuffer.h>
+#include <Qt3DRender/qclearbuffers.h>
#include <Qt3DRender/private/shader_p.h>
+#include <Qt3DRender/private/glbuffer_p.h>
#include <Qt3DRender/qattribute.h>
+#include <Qt3DRender/private/handle_types_p.h>
+#include <Qt3DRender/private/qgraphicsapifilter_p.h>
QT_BEGIN_NAMESPACE
+class QOpenGLDebugLogger;
class QOpenGLShaderProgram;
class QAbstractOpenGLFunctions;
namespace Qt3DRender {
-class QGraphicsApiFilter;
-
namespace Render {
class Renderer;
@@ -101,11 +105,11 @@ public:
int id() const; // unique, small integer ID of this context
- bool beginDrawing(QSurface *surface, const QColor &color);
- void clearBackBuffer(QClearBuffer::BufferType buffers);
+ bool beginDrawing(QSurface *surface);
+ void clearBackBuffer(QClearBuffers::BufferTypeFlags buffers);
void endDrawing(bool swapBuffers);
- void setViewport(const QRectF &viewport);
+ void setViewport(const QRectF &viewport, const QSize &surfaceSize);
QRectF viewport() const { return m_viewport; }
/**
@@ -113,13 +117,16 @@ public:
* this context
*/
void releaseOpenGL();
- void setOpenGLContext(QOpenGLContext* ctx, QSurface *surface);
+ void setOpenGLContext(QOpenGLContext* ctx);
QOpenGLContext *openGLContext() { return m_gl; }
bool makeCurrent(QSurface *surface);
void doneCurrent();
+ void activateGLHelper();
+ bool hasValidGLHelper() const;
void activateShader(Shader* shader);
QOpenGLShaderProgram *containsProgram(const ProgramDNA &dna);
+ void removeProgram(const ProgramDNA &dna, Qt3DCore::QNodeId id);
GLuint activeFBO() const { return m_activeFBO; }
GLuint defaultFBO() const { return m_defaultFBO; }
@@ -143,7 +150,7 @@ public:
void specifyIndices(Buffer *buffer);
void updateBuffer(Buffer *buffer);
- void setUniforms(QUniformPack &uniforms);
+ void setParameters(ShaderParameterPack &parameterPack);
/**
* @brief glBufferFor - given a client-side (CPU) buffer, provide the
@@ -151,8 +158,7 @@ public:
* @param buf
* @return
*/
- QOpenGLBuffer glBufferForRenderBuffer(Buffer *buf);
-
+ GLBuffer *glBufferForRenderBuffer(Buffer *buf);
/**
* @brief activateTexture - make a texture active on a hardware unit
@@ -166,7 +172,7 @@ public:
void setCurrentStateSet(RenderStateSet* ss);
RenderStateSet *currentStateSet() const;
- QGraphicsApiFilter *contextInfo() const;
+ const GraphicsApiFilterData *contextInfo() const;
// Wrapper methods
void alphaTest(GLenum mode1, GLenum mode2);
@@ -174,36 +180,46 @@ public:
void bindFragOutputs(GLuint shader, const QHash<QString, int> &outputs);
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
void bindUniform(const QVariant &v, const ShaderUniform &description);
+ void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding);
void blendEquation(GLenum mode);
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor);
+ void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha);
GLuint boundFrameBufferObject();
void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer);
+ void clearBufferf(GLint drawbuffer, const QVector4D &values);
void clearColor(const QColor &color);
- void cullFace(GLenum mode);
+ void clearDepthValue(float depth);
+ void clearStencilValue(int stencil);
void depthMask(GLenum mode);
void depthTest(GLenum mode);
- void disableAlphaCoverage();
void disableClipPlane(int clipPlane);
+ void disablei(GLenum cap, GLuint index);
void disablePrimitiveRestart();
+ void dispatchCompute(int x, int y, int z);
void drawArrays(GLenum primitiveType, GLint first, GLsizei count);
void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances);
- void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLint baseVertex = 0);
- void drawElementsInstanced(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0);
- void enableAlphaCoverage();
+ void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseinstance);
+ void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLint baseVertex);
+ void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLsizei instances, GLint baseVertex, GLint baseInstance);
void enableClipPlane(int clipPlane);
+ void enablei(GLenum cap, GLuint index);
void enablePrimitiveRestart(int restartIndex);
void frontFace(GLenum mode);
GLint maxClipPlaneCount();
void pointSize(bool programmable, GLfloat value);
+ void setMSAAEnabled(bool enabled);
+ void setAlphaCoverageEnabled(bool enabled);
+ void setClipPlane(int clipPlane, const QVector3D &normal, float distance);
+ void setSeamlessCubemap(bool enable);
void setVerticesPerPatch(GLint verticesPerPatch);
// Helper methods
static GLint elementType(GLint type);
static GLint tupleSizeFromType(GLint type);
static GLuint byteSizeFromType(GLint type);
- static GLint glDataTypeFromAttributeDataType(QAttribute::DataType dataType);
-
+ static GLint glDataTypeFromAttributeDataType(QAttribute::VertexBaseType dataType);
+ bool supportsDrawBuffersBlend() const;
bool supportsVAO() const { return m_supportsVAO; }
private:
@@ -214,10 +230,13 @@ private:
GLint assignUnitForTexture(Texture* tex);
void deactivateTexturesWithScope(TextureScope ts);
- void resolveHighestOpenGLFunctions();
+ GraphicsHelperInterface *resolveHighestOpenGLFunctions();
void bindFrameBufferAttachmentHelper(GLuint fboId, const AttachmentPack &attachments);
void activateDrawBuffers(const AttachmentPack &attachments);
+ HGLBuffer createGLBufferFor(Buffer *buffer);
+ void uploadDataToGLBuffer(Buffer *buffer, GLBuffer *b, bool releaseBuffer = false);
+ bool bindGLBuffer(GLBuffer *buffer, GLBuffer::Type type);
bool m_initialized;
const unsigned int m_id;
@@ -228,15 +247,22 @@ private:
Shader *m_activeShader;
QHash<ProgramDNA, Shader *> m_renderShaderHash;
- QHash<Buffer *, QOpenGLBuffer> m_renderBufferHash;
+ QHash<Qt3DCore::QNodeId, HGLBuffer> m_renderBufferHash;
QHash<Qt3DCore::QNodeId, GLuint> m_renderTargets;
QHash<GLuint, QSize> m_renderTargetsSize;
+ QHash<QSurface *, GraphicsHelperInterface*> m_glHelpers;
+
// active textures, indexed by texture unit
QVector<uint> m_activeTextures;
QBitArray m_pinnedTextureUnits;
QVector<TextureScope> m_textureScopes;
+ // cache some current state, to make sure we don't issue unnecessary GL calls
+ int m_currClearStencilValue;
+ float m_currClearDepthValue;
+ QColor m_currClearColorValue;
+
// recency score for all render-textures we've seen. Higher scores
// mean more recently used.
QHash<uint, int> m_textureScores;
@@ -246,14 +272,17 @@ private:
GLuint m_activeFBO;
GLuint m_defaultFBO;
+ GLBuffer *m_boundArrayBuffer;
+
RenderStateSet* m_stateSet;
Renderer *m_renderer;
- QGraphicsApiFilter *m_contextInfo;
+ GraphicsApiFilterData m_contextInfo;
QByteArray m_uboTempArray;
bool m_supportsVAO;
+ QScopedPointer<QOpenGLDebugLogger> m_debugLogger;
};
} // namespace Render
diff --git a/src/render/graphicshelpers/graphicshelperes2.cpp b/src/render/graphicshelpers/graphicshelperes2.cpp
index 86e526d61..140fcf2af 100644
--- a/src/render/graphicshelpers/graphicshelperes2.cpp
+++ b/src/render/graphicshelpers/graphicshelperes2.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -80,13 +83,13 @@ void GraphicsHelperES2::initializeHelper(QOpenGLContext *context,
m_isES3 = context->format().majorVersion() >= 3;
}
-void GraphicsHelperES2::drawElementsInstanced(GLenum primitiveType,
- GLsizei primitiveCount,
- GLint indexType,
- void *indices,
- GLsizei instances,
- GLint baseVertex,
- GLint baseInstance)
+void GraphicsHelperES2::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType,
+ GLsizei primitiveCount,
+ GLint indexType,
+ void *indices,
+ GLsizei instances,
+ GLint baseVertex,
+ GLint baseInstance)
{
if (baseInstance != 0)
qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2";
@@ -112,6 +115,16 @@ void GraphicsHelperES2::drawArraysInstanced(GLenum primitiveType,
count);
}
+void GraphicsHelperES2::drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance)
+{
+ if (baseInstance != 0)
+ qWarning() << "glDrawArraysInstancedBaseInstance is not supported with OpenGL ES 2";
+ for (GLint i = 0; i < instances; i++)
+ drawArrays(primitiveType,
+ first,
+ count);
+}
+
void GraphicsHelperES2::drawElements(GLenum primitiveType,
GLsizei primitiveCount,
GLint indexType,
@@ -208,6 +221,14 @@ QVector<ShaderUniformBlock> GraphicsHelperES2::programUniformBlocks(GLuint progr
return blocks;
}
+QVector<ShaderStorageBlock> GraphicsHelperES2::programShaderStorageBlocks(GLuint programId)
+{
+ Q_UNUSED(programId);
+ QVector<ShaderStorageBlock> blocks;
+ qWarning() << "SSBO are not supported by OpenGL ES 2.0 (since OpenGL ES 3.1)";
+ return blocks;
+}
+
void GraphicsHelperES2::vertexAttribDivisor(GLuint index, GLuint divisor)
{
Q_UNUSED(index);
@@ -228,6 +249,17 @@ void GraphicsHelperES2::blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
qWarning() << "glBlendFunci() not supported by OpenGL ES 2.0";
}
+void GraphicsHelperES2::blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha)
+{
+ Q_UNUSED(buf);
+ Q_UNUSED(sRGB);
+ Q_UNUSED(dRGB);
+ Q_UNUSED(sAlpha);
+ Q_UNUSED(dAlpha);
+
+ qWarning() << "glBlendFuncSeparatei() not supported by OpenGL ES 2.0";
+}
+
void GraphicsHelperES2::alphaTest(GLenum, GLenum)
{
qCWarning(Render::Rendering) << Q_FUNC_INFO << "AlphaTest not available with OpenGL ES 2.0";
@@ -244,25 +276,21 @@ void GraphicsHelperES2::depthMask(GLenum mode)
m_funcs->glDepthMask(mode);
}
-void GraphicsHelperES2::cullFace(GLenum mode)
-{
- m_funcs->glEnable(GL_CULL_FACE);
- m_funcs->glCullFace(mode);
-}
-
void GraphicsHelperES2::frontFace(GLenum mode)
{
m_funcs->glFrontFace(mode);
}
-void GraphicsHelperES2::enableAlphaCoverage()
+void GraphicsHelperES2::setMSAAEnabled(bool enabled)
{
- m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ Q_UNUSED(enabled);
+ qWarning() << "MSAA not available with OpenGL ES 2.0";
}
-void GraphicsHelperES2::disableAlphaCoverage()
+void GraphicsHelperES2::setAlphaCoverageEnabled(bool enabled)
{
- m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
+ : m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
}
GLuint GraphicsHelperES2::createFrameBufferObject()
@@ -298,11 +326,11 @@ void GraphicsHelperES2::bindFrameBufferAttachment(QOpenGLTexture *texture, const
{
GLenum attr = GL_COLOR_ATTACHMENT0;
- if (attachment.m_type == QRenderAttachment::ColorAttachment0)
+ if (attachment.m_point == QRenderTargetOutput::Color0)
attr = GL_COLOR_ATTACHMENT0;
- else if (attachment.m_type == QRenderAttachment::DepthAttachment)
+ else if (attachment.m_point == QRenderTargetOutput::Depth)
attr = GL_DEPTH_ATTACHMENT;
- else if (attachment.m_type == QRenderAttachment::StencilAttachment)
+ else if (attachment.m_point == QRenderTargetOutput::Stencil)
attr = GL_STENCIL_ATTACHMENT;
else
qCritical() << "Unsupported FBO attachment OpenGL ES 2.0";
@@ -329,7 +357,7 @@ bool GraphicsHelperES2::supportsFeature(GraphicsHelperInterface::Feature feature
}
void GraphicsHelperES2::drawBuffers(GLsizei , const int *)
{
- qCritical() << "drawBuffers is not supported by ES 2.0";
+ qWarning() << "drawBuffers is not supported by ES 2.0";
}
void GraphicsHelperES2::bindUniform(const QVariant &v, const ShaderUniform &description)
@@ -452,6 +480,14 @@ void GraphicsHelperES2::bindUniformBlock(GLuint programId, GLuint uniformBlockIn
qWarning() << "UBO are not supported by ES 2.0 (since ES 3.0)";
}
+void GraphicsHelperES2::bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding)
+{
+ Q_UNUSED(programId);
+ Q_UNUSED(shaderStorageBlockIndex);
+ Q_UNUSED(shaderStorageBlockBinding);
+ qWarning() << "SSBO are not supported by ES 2.0 (since ES 3.1)";
+}
+
void GraphicsHelperES2::bindBufferBase(GLenum target, GLuint index, GLuint buffer)
{
Q_UNUSED(target);
@@ -538,6 +574,11 @@ void GraphicsHelperES2::disableClipPlane(int)
{
}
+void GraphicsHelperES2::setClipPlane(int, const QVector3D &, float)
+{
+ qWarning() << "Clip planes not supported by OpenGL ES 2.0";
+}
+
GLint GraphicsHelperES2::maxClipPlaneCount()
{
return 0;
@@ -551,6 +592,13 @@ void GraphicsHelperES2::disablePrimitiveRestart()
{
}
+void GraphicsHelperES2::clearBufferf(GLint drawbuffer, const QVector4D &values)
+{
+ Q_UNUSED(drawbuffer);
+ Q_UNUSED(values);
+ qWarning() << "glClearBuffer*() not supported by OpenGL ES 2.0";
+}
+
void GraphicsHelperES2::pointSize(bool programmable, GLfloat value)
{
// If this is not a reset to default values, print a warning
@@ -563,6 +611,26 @@ void GraphicsHelperES2::pointSize(bool programmable, GLfloat value)
}
}
+void GraphicsHelperES2::enablei(GLenum cap, GLuint index)
+{
+ Q_UNUSED(cap);
+ Q_UNUSED(index);
+ qWarning() << "glEnablei() not supported by OpenGL ES 2.0";
+}
+
+void GraphicsHelperES2::disablei(GLenum cap, GLuint index)
+{
+ Q_UNUSED(cap);
+ Q_UNUSED(index);
+ qWarning() << "glDisablei() not supported by OpenGL ES 2.0";
+}
+
+void GraphicsHelperES2::setSeamlessCubemap(bool enable)
+{
+ Q_UNUSED(enable);
+ qWarning() << "GL_TEXTURE_CUBE_MAP_SEAMLESS not supported by OpenGL ES 2.0";
+}
+
QSize GraphicsHelperES2::getRenderBufferDimensions(GLuint renderBufferId)
{
GLint width = 0;
@@ -585,6 +653,14 @@ QSize GraphicsHelperES2::getTextureDimensions(GLuint textureId, GLenum target, u
return QSize(0, 0);
}
+void GraphicsHelperES2::dispatchCompute(GLuint wx, GLuint wy, GLuint wz)
+{
+ Q_UNUSED(wx);
+ Q_UNUSED(wy);
+ Q_UNUSED(wz);
+ qWarning() << "Compute Shaders are not supported by ES 2.0 (since ES 3.1)";
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelperes2_p.h b/src/render/graphicshelpers/graphicshelperes2_p.h
index 5d75137e9..896008dc8 100644
--- a/src/render/graphicshelpers/graphicshelperes2_p.h
+++ b/src/render/graphicshelpers/graphicshelperes2_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -69,27 +72,31 @@ public:
void bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) Q_DECL_OVERRIDE;
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE;
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
+ void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
GLuint boundFrameBufferObject() Q_DECL_OVERRIDE;
void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) Q_DECL_OVERRIDE;
bool checkFrameBufferComplete() Q_DECL_OVERRIDE;
+ void clearBufferf(GLint drawbuffer, const QVector4D &values) Q_DECL_OVERRIDE;
GLuint createFrameBufferObject() Q_DECL_OVERRIDE;
- void cullFace(GLenum mode) Q_DECL_OVERRIDE;
void depthMask(GLenum mode) Q_DECL_OVERRIDE;
void depthTest(GLenum mode) Q_DECL_OVERRIDE;
- void disableAlphaCoverage() Q_DECL_OVERRIDE;
void disableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void disablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) Q_DECL_OVERRIDE;
void drawArrays(GLenum primitiveType, GLint first, GLsizei count) Q_DECL_OVERRIDE;
void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) Q_DECL_OVERRIDE;
+ void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) Q_DECL_OVERRIDE;
void drawBuffers(GLsizei n, const int *bufs) Q_DECL_OVERRIDE;
void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) Q_DECL_OVERRIDE;
- void drawElementsInstanced(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
- void enableAlphaCoverage() Q_DECL_OVERRIDE;
+ void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
void enableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void enablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void frontFace(GLenum mode) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
@@ -100,14 +107,17 @@ public:
QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
+ QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
+ void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
void setVerticesPerPatch(GLint verticesPerPatch) Q_DECL_OVERRIDE;
bool supportsFeature(Feature feature) const Q_DECL_OVERRIDE;
uint uniformByteSize(const ShaderUniform &description) Q_DECL_OVERRIDE;
void useProgram(GLuint programId) Q_DECL_OVERRIDE;
void vertexAttribDivisor(GLuint index, GLuint divisor) Q_DECL_OVERRIDE;
-
-
private:
QOpenGLFunctions *m_funcs;
bool m_isES3;
diff --git a/src/render/graphicshelpers/graphicshelpergl2.cpp b/src/render/graphicshelpers/graphicshelpergl2.cpp
index a73833b28..a8f6ce510 100644
--- a/src/render/graphicshelpers/graphicshelpergl2.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl2.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,8 +51,8 @@ namespace Qt3DRender {
namespace Render {
GraphicsHelperGL2::GraphicsHelperGL2()
- : m_funcs(Q_NULLPTR)
- , m_fboFuncs(Q_NULLPTR)
+ : m_funcs(nullptr)
+ , m_fboFuncs(nullptr)
{
}
@@ -70,13 +73,13 @@ void GraphicsHelperGL2::initializeHelper(QOpenGLContext *context,
}
}
-void GraphicsHelperGL2::drawElementsInstanced(GLenum primitiveType,
- GLsizei primitiveCount,
- GLint indexType,
- void *indices,
- GLsizei instances,
- GLint baseVertex,
- GLint baseInstance)
+void GraphicsHelperGL2::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType,
+ GLsizei primitiveCount,
+ GLint indexType,
+ void *indices,
+ GLsizei instances,
+ GLint baseVertex,
+ GLint baseInstance)
{
if (baseInstance != 0)
qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2";
@@ -102,6 +105,16 @@ void GraphicsHelperGL2::drawArraysInstanced(GLenum primitiveType,
count);
}
+void GraphicsHelperGL2::drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance)
+{
+ if (baseInstance != 0)
+ qWarning() << "glDrawArraysInstancedBaseInstance is not supported with OpenGL 2";
+ for (GLint i = 0; i < instances; i++)
+ drawArrays(primitiveType,
+ first,
+ count);
+}
+
void GraphicsHelperGL2::drawElements(GLenum primitiveType,
GLsizei primitiveCount,
GLint indexType,
@@ -190,6 +203,13 @@ QVector<ShaderUniformBlock> GraphicsHelperGL2::programUniformBlocks(GLuint progr
return blocks;
}
+QVector<ShaderStorageBlock> GraphicsHelperGL2::programShaderStorageBlocks(GLuint programId)
+{
+ Q_UNUSED(programId);
+ qWarning() << "SSBO are not supported by OpenGL 2.0 (since OpenGL 4.3)";
+ return QVector<ShaderStorageBlock>();
+}
+
void GraphicsHelperGL2::vertexAttribDivisor(GLuint index,
GLuint divisor)
{
@@ -211,6 +231,17 @@ void GraphicsHelperGL2::blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
qWarning() << "glBlendFunci() not supported by OpenGL 2.0 (since OpenGL 4.0)";
}
+void GraphicsHelperGL2::blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha)
+{
+ Q_UNUSED(buf);
+ Q_UNUSED(sRGB);
+ Q_UNUSED(dRGB);
+ Q_UNUSED(sAlpha);
+ Q_UNUSED(dAlpha);
+
+ qWarning() << "glBlendFuncSeparatei() not supported by OpenGL 2.0 (since OpenGL 4.0)";
+}
+
void GraphicsHelperGL2::alphaTest(GLenum mode1, GLenum mode2)
{
m_funcs->glEnable(GL_ALPHA_TEST);
@@ -228,30 +259,26 @@ void GraphicsHelperGL2::depthMask(GLenum mode)
m_funcs->glDepthMask(mode);
}
-void GraphicsHelperGL2::cullFace(GLenum mode)
-{
- m_funcs->glEnable(GL_CULL_FACE);
- m_funcs->glCullFace(mode);
-}
-
void GraphicsHelperGL2::frontFace(GLenum mode)
{
m_funcs->glFrontFace(mode);
}
-void GraphicsHelperGL2::enableAlphaCoverage()
+void GraphicsHelperGL2::setMSAAEnabled(bool enabled)
{
- m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_MULTISAMPLE)
+ : m_funcs->glDisable(GL_MULTISAMPLE);
}
-void GraphicsHelperGL2::disableAlphaCoverage()
+void GraphicsHelperGL2::setAlphaCoverageEnabled(bool enabled)
{
- m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
+ : m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
}
GLuint GraphicsHelperGL2::createFrameBufferObject()
{
- if (m_fboFuncs != Q_NULLPTR) {
+ if (m_fboFuncs != nullptr) {
GLuint id;
m_fboFuncs->glGenFramebuffers(1, &id);
return id;
@@ -262,7 +289,7 @@ GLuint GraphicsHelperGL2::createFrameBufferObject()
void GraphicsHelperGL2::releaseFrameBufferObject(GLuint frameBufferId)
{
- if (m_fboFuncs != Q_NULLPTR)
+ if (m_fboFuncs != nullptr)
m_fboFuncs->glDeleteFramebuffers(1, &frameBufferId);
else
qWarning() << "FBO not supported by your OpenGL hardware";
@@ -270,21 +297,21 @@ void GraphicsHelperGL2::releaseFrameBufferObject(GLuint frameBufferId)
bool GraphicsHelperGL2::checkFrameBufferComplete()
{
- if (m_fboFuncs != Q_NULLPTR)
+ if (m_fboFuncs != nullptr)
return (m_fboFuncs->glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
return false;
}
void GraphicsHelperGL2::bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment)
{
- if (m_fboFuncs != Q_NULLPTR) {
+ if (m_fboFuncs != nullptr) {
GLenum attr = GL_DEPTH_STENCIL_ATTACHMENT;
- if (attachment.m_type <= QRenderAttachment::ColorAttachment15)
- attr = GL_COLOR_ATTACHMENT0 + attachment.m_type;
- else if (attachment.m_type == QRenderAttachment::DepthAttachment)
+ if (attachment.m_point <= QRenderTargetOutput::Color15)
+ attr = GL_COLOR_ATTACHMENT0 + attachment.m_point;
+ else if (attachment.m_point == QRenderTargetOutput::Depth)
attr = GL_DEPTH_ATTACHMENT;
- else if (attachment.m_type == QRenderAttachment::StencilAttachment)
+ else if (attachment.m_point == QRenderTargetOutput::Stencil)
attr = GL_STENCIL_ATTACHMENT;
else
qCritical() << "DepthStencil Attachment not supported on OpenGL 2.0";
@@ -309,7 +336,7 @@ bool GraphicsHelperGL2::supportsFeature(GraphicsHelperInterface::Feature feature
{
switch (feature) {
case MRT:
- return (m_fboFuncs != Q_NULLPTR);
+ return (m_fboFuncs != nullptr);
case TextureDimensionRetrieval:
return true;
default:
@@ -425,8 +452,8 @@ void GraphicsHelperGL2::bindUniform(const QVariant &v, const ShaderUniform &desc
void GraphicsHelperGL2::bindFrameBufferObject(GLuint frameBufferId)
{
- if (m_fboFuncs != Q_NULLPTR)
- m_fboFuncs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId);
+ if (m_fboFuncs != nullptr)
+ m_fboFuncs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId);
else
qWarning() << "FBO not supported by your OpenGL hardware";
}
@@ -446,6 +473,14 @@ void GraphicsHelperGL2::bindUniformBlock(GLuint programId, GLuint uniformBlockIn
qWarning() << "UBO are not supported by OpenGL 2.0 (since OpenGL 3.1)";
}
+void GraphicsHelperGL2::bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding)
+{
+ Q_UNUSED(programId);
+ Q_UNUSED(shaderStorageBlockIndex);
+ Q_UNUSED(shaderStorageBlockBinding);
+ qWarning() << "SSBO are not supported by OpenGL 2.0 (since OpenGL 4.3)";
+}
+
void GraphicsHelperGL2::bindBufferBase(GLenum target, GLuint index, GLuint buffer)
{
Q_UNUSED(target);
@@ -534,6 +569,17 @@ void GraphicsHelperGL2::disableClipPlane(int clipPlane)
m_funcs->glDisable(GL_CLIP_DISTANCE0 + clipPlane);
}
+void GraphicsHelperGL2::setClipPlane(int clipPlane, const QVector3D &normal, float distance)
+{
+ double plane[4];
+ plane[0] = normal.x();
+ plane[1] = normal.y();
+ plane[2] = normal.z();
+ plane[3] = distance;
+
+ m_funcs->glClipPlane(GL_CLIP_PLANE0 + clipPlane, plane);
+}
+
GLint GraphicsHelperGL2::maxClipPlaneCount()
{
GLint max = 0;
@@ -549,6 +595,13 @@ void GraphicsHelperGL2::disablePrimitiveRestart()
{
}
+void GraphicsHelperGL2::clearBufferf(GLint drawbuffer, const QVector4D &values)
+{
+ Q_UNUSED(drawbuffer);
+ Q_UNUSED(values);
+ qWarning() << "glClearBuffer*() not supported by OpenGL 2.0";
+}
+
void GraphicsHelperGL2::pointSize(bool programmable, GLfloat value)
{
// Print a warning once for trying to set GL_PROGRAM_POINT_SIZE
@@ -562,6 +615,26 @@ void GraphicsHelperGL2::pointSize(bool programmable, GLfloat value)
m_funcs->glPointSize(value);
}
+void GraphicsHelperGL2::enablei(GLenum cap, GLuint index)
+{
+ Q_UNUSED(cap);
+ Q_UNUSED(index);
+ qWarning() << "glEnablei() not supported by OpenGL 2.0 (since 3.0)";
+}
+
+void GraphicsHelperGL2::disablei(GLenum cap, GLuint index)
+{
+ Q_UNUSED(cap);
+ Q_UNUSED(index);
+ qWarning() << "glDisablei() not supported by OpenGL 2.0 (since 3.0)";
+}
+
+void GraphicsHelperGL2::setSeamlessCubemap(bool enable)
+{
+ Q_UNUSED(enable);
+ qWarning() << "GL_TEXTURE_CUBE_MAP_SEAMLESS not supported by OpenGL 2.0 (since 3.2)";
+}
+
QSize GraphicsHelperGL2::getRenderBufferDimensions(GLuint renderBufferId)
{
Q_UNUSED(renderBufferId);
@@ -582,6 +655,14 @@ QSize GraphicsHelperGL2::getTextureDimensions(GLuint textureId, GLenum target, u
return QSize(width, height);
}
+void GraphicsHelperGL2::dispatchCompute(GLuint wx, GLuint wy, GLuint wz)
+{
+ Q_UNUSED(wx);
+ Q_UNUSED(wy);
+ Q_UNUSED(wz);
+ qWarning() << "Compute Shaders are not supported by OpenGL 2.0 (since OpenGL 4.3)";
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelpergl2_p.h b/src/render/graphicshelpers/graphicshelpergl2_p.h
index 62016c9e8..719f9c92c 100644
--- a/src/render/graphicshelpers/graphicshelpergl2_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl2_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -71,27 +74,31 @@ public:
void bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) Q_DECL_OVERRIDE;
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE;
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
+ void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
GLuint boundFrameBufferObject() Q_DECL_OVERRIDE;
void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) Q_DECL_OVERRIDE;
bool checkFrameBufferComplete() Q_DECL_OVERRIDE;
+ void clearBufferf(GLint drawbuffer, const QVector4D &values) Q_DECL_OVERRIDE;
GLuint createFrameBufferObject() Q_DECL_OVERRIDE;
- void cullFace(GLenum mode) Q_DECL_OVERRIDE;
void depthMask(GLenum mode) Q_DECL_OVERRIDE;
void depthTest(GLenum mode) Q_DECL_OVERRIDE;
- void disableAlphaCoverage() Q_DECL_OVERRIDE;
void disableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void disablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) Q_DECL_OVERRIDE;
void drawArrays(GLenum primitiveType, GLint first, GLsizei count) Q_DECL_OVERRIDE;
void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) Q_DECL_OVERRIDE;
+ void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) Q_DECL_OVERRIDE;
void drawBuffers(GLsizei n, const int *bufs) Q_DECL_OVERRIDE;
void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) Q_DECL_OVERRIDE;
- void drawElementsInstanced(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
- void enableAlphaCoverage() Q_DECL_OVERRIDE;
+ void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
void enableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void enablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void frontFace(GLenum mode) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
@@ -102,7 +109,12 @@ public:
QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
+ QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
+ void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
void setVerticesPerPatch(GLint verticesPerPatch) Q_DECL_OVERRIDE;
bool supportsFeature(Feature feature) const Q_DECL_OVERRIDE;
uint uniformByteSize(const ShaderUniform &description) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl3.cpp b/src/render/graphicshelpers/graphicshelpergl3.cpp
index 181093cbc..549c665c3 100644
--- a/src/render/graphicshelpers/graphicshelpergl3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -46,11 +49,30 @@
QT_BEGIN_NAMESPACE
+# ifndef QT_OPENGL_3
+# define GL_PATCH_VERTICES 36466
+# define GL_ACTIVE_RESOURCES 0x92F5
+# define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+# define GL_BUFFER_BINDING 0x9302
+# define GL_BUFFER_DATA_SIZE 0x9303
+# define GL_NUM_ACTIVE_VARIABLES 0x9304
+# define GL_SHADER_STORAGE_BLOCK 0x92E6
+# define GL_UNIFORM 0x92E1
+# define GL_UNIFORM_BLOCK 0x92E2
+# define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+# define GL_UNIFORM_OFFSET 0x8A3B
+# define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+# define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+# define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+# define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+# define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+# endif
+
namespace Qt3DRender {
namespace Render {
GraphicsHelperGL3::GraphicsHelperGL3()
- : m_funcs(Q_NULLPTR)
+ : m_funcs(nullptr)
, m_tessFuncs()
{
}
@@ -69,13 +91,13 @@ void GraphicsHelperGL3::initializeHelper(QOpenGLContext *context,
}
}
-void GraphicsHelperGL3::drawElementsInstanced(GLenum primitiveType,
- GLsizei primitiveCount,
- GLint indexType,
- void *indices,
- GLsizei instances,
- GLint baseVertex,
- GLint baseInstance)
+void GraphicsHelperGL3::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType,
+ GLsizei primitiveCount,
+ GLint indexType,
+ void *indices,
+ GLsizei instances,
+ GLint baseVertex,
+ GLint baseInstance)
{
if (baseInstance != 0)
qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2";
@@ -101,6 +123,16 @@ void GraphicsHelperGL3::drawArraysInstanced(GLenum primitiveType,
instances);
}
+void GraphicsHelperGL3::drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance)
+{
+ if (baseInstance != 0)
+ qWarning() << "glDrawArraysInstancedBaseInstance is not supported with OpenGL 3";
+ m_funcs->glDrawArraysInstanced(primitiveType,
+ first,
+ count,
+ instances);
+}
+
void GraphicsHelperGL3::drawElements(GLenum primitiveType,
GLsizei primitiveCount,
GLint indexType,
@@ -218,6 +250,14 @@ QVector<ShaderUniformBlock> GraphicsHelperGL3::programUniformBlocks(GLuint progr
return blocks;
}
+QVector<ShaderStorageBlock> GraphicsHelperGL3::programShaderStorageBlocks(GLuint programId)
+{
+ Q_UNUSED(programId);
+ QVector<ShaderStorageBlock> blocks;
+ qWarning() << "SSBO are not supported by OpenGL 3.2 (since OpenGL 4.3)";
+ return blocks;
+}
+
void GraphicsHelperGL3::vertexAttribDivisor(GLuint index, GLuint divisor)
{
Q_UNUSED(index);
@@ -239,6 +279,17 @@ void GraphicsHelperGL3::blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
qWarning() << "glBlendFunci() not supported by OpenGL 3.0 (since OpenGL 4.0)";
}
+void GraphicsHelperGL3::blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha)
+{
+ Q_UNUSED(buf);
+ Q_UNUSED(sRGB);
+ Q_UNUSED(dRGB);
+ Q_UNUSED(sAlpha);
+ Q_UNUSED(dAlpha);
+
+ qWarning() << "glBlendFuncSeparatei() not supported by OpenGL 3.0 (since OpenGL 4.0)";
+}
+
void GraphicsHelperGL3::alphaTest(GLenum, GLenum)
{
qCWarning(Render::Rendering) << "AlphaTest not available with OpenGL 3.2 core";
@@ -255,26 +306,22 @@ void GraphicsHelperGL3::depthMask(GLenum mode)
m_funcs->glDepthMask(mode);
}
-void GraphicsHelperGL3::cullFace(GLenum mode)
-{
- m_funcs->glEnable(GL_CULL_FACE);
- m_funcs->glCullFace(mode);
-}
-
void GraphicsHelperGL3::frontFace(GLenum mode)
{
m_funcs->glFrontFace(mode);
}
-void GraphicsHelperGL3::enableAlphaCoverage()
+void GraphicsHelperGL3::setMSAAEnabled(bool enabled)
{
- m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_MULTISAMPLE)
+ : m_funcs->glDisable(GL_MULTISAMPLE);
}
-void GraphicsHelperGL3::disableAlphaCoverage()
+void GraphicsHelperGL3::setAlphaCoverageEnabled(bool enabled)
{
- m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
+ : m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
}
GLuint GraphicsHelperGL3::createFrameBufferObject()
@@ -310,11 +357,11 @@ void GraphicsHelperGL3::bindFrameBufferAttachment(QOpenGLTexture *texture, const
{
GLenum attr = GL_DEPTH_STENCIL_ATTACHMENT;
- if (attachment.m_type <= QRenderAttachment::ColorAttachment15)
- attr = GL_COLOR_ATTACHMENT0 + attachment.m_type;
- else if (attachment.m_type == QRenderAttachment::DepthAttachment)
+ if (attachment.m_point <= QRenderTargetOutput::Color15)
+ attr = GL_COLOR_ATTACHMENT0 + attachment.m_point;
+ else if (attachment.m_point == QRenderTargetOutput::Depth)
attr = GL_DEPTH_ATTACHMENT;
- else if (attachment.m_type == QRenderAttachment::StencilAttachment)
+ else if (attachment.m_point == QRenderTargetOutput::Stencil)
attr = GL_STENCIL_ATTACHMENT;
texture->bind();
@@ -359,8 +406,8 @@ void GraphicsHelperGL3::drawBuffers(GLsizei n, const int *bufs)
void GraphicsHelperGL3::bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs)
{
- Q_FOREACH (const QString &name, outputs.keys())
- m_funcs->glBindFragDataLocation(shader, outputs.value(name), name.toStdString().c_str());
+ for (auto it = outputs.begin(), end = outputs.end(); it != end; ++it)
+ m_funcs->glBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str());
}
void GraphicsHelperGL3::bindUniform(const QVariant &v, const ShaderUniform &description)
@@ -544,6 +591,14 @@ void GraphicsHelperGL3::bindUniformBlock(GLuint programId, GLuint uniformBlockIn
m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding);
}
+void GraphicsHelperGL3::bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding)
+{
+ Q_UNUSED(programId);
+ Q_UNUSED(shaderStorageBlockIndex);
+ Q_UNUSED(shaderStorageBlockBinding);
+ qWarning() << "SSBO are not supported by OpenGL 3.0 (since OpenGL 4.3)";
+}
+
void GraphicsHelperGL3::bindBufferBase(GLenum target, GLuint index, GLuint buffer)
{
m_funcs->glBindBufferBase(target, index, buffer);
@@ -887,6 +942,14 @@ void GraphicsHelperGL3::disableClipPlane(int clipPlane)
m_funcs->glDisable(GL_CLIP_DISTANCE0 + clipPlane);
}
+void GraphicsHelperGL3::setClipPlane(int clipPlane, const QVector3D &normal, float distance)
+{
+ // deprecated
+ Q_UNUSED(clipPlane);
+ Q_UNUSED(normal);
+ Q_UNUSED(distance);
+}
+
GLint GraphicsHelperGL3::maxClipPlaneCount()
{
GLint max = 0;
@@ -905,6 +968,12 @@ void GraphicsHelperGL3::disablePrimitiveRestart()
m_funcs->glDisable(GL_PRIMITIVE_RESTART);
}
+void GraphicsHelperGL3::clearBufferf(GLint drawbuffer, const QVector4D &values)
+{
+ GLfloat vec[4] = {values[0], values[1], values[2], values[3]};
+ m_funcs->glClearBufferfv(GL_COLOR, drawbuffer, vec);
+}
+
void GraphicsHelperGL3::pointSize(bool programmable, GLfloat value)
{
if (programmable) {
@@ -915,6 +984,22 @@ void GraphicsHelperGL3::pointSize(bool programmable, GLfloat value)
}
}
+void GraphicsHelperGL3::enablei(GLenum cap, GLuint index)
+{
+ m_funcs->glEnablei(cap, index);
+}
+
+void GraphicsHelperGL3::disablei(GLenum cap, GLuint index)
+{
+ m_funcs->glDisablei(cap, index);
+}
+
+void GraphicsHelperGL3::setSeamlessCubemap(bool enable)
+{
+ Q_UNUSED(enable);
+ qWarning() << "GL_TEXTURE_CUBE_MAP_SEAMLESS not supported by OpenGL 3.0 (since 3.2)";
+}
+
QSize GraphicsHelperGL3::getRenderBufferDimensions(GLuint renderBufferId)
{
GLint width = 0;
@@ -941,6 +1026,14 @@ QSize GraphicsHelperGL3::getTextureDimensions(GLuint textureId, GLenum target, u
return QSize(width, height);
}
+void GraphicsHelperGL3::dispatchCompute(GLuint wx, GLuint wy, GLuint wz)
+{
+ Q_UNUSED(wx);
+ Q_UNUSED(wy);
+ Q_UNUSED(wz);
+ qWarning() << "Compute Shaders are not supported by OpenGL 3.0 (since OpenGL 4.3)";
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
index e5e7c23e1..fe257ce27 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl3_3.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -43,13 +46,32 @@
#include <private/attachmentpack_p.h>
#include <private/qgraphicsutils_p.h>
+# ifndef QT_OPENGL_3_2
+# define GL_PATCH_VERTICES 36466
+# define GL_ACTIVE_RESOURCES 0x92F5
+# define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+# define GL_BUFFER_BINDING 0x9302
+# define GL_BUFFER_DATA_SIZE 0x9303
+# define GL_NUM_ACTIVE_VARIABLES 0x9304
+# define GL_SHADER_STORAGE_BLOCK 0x92E6
+# define GL_UNIFORM 0x92E1
+# define GL_UNIFORM_BLOCK 0x92E2
+# define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+# define GL_UNIFORM_OFFSET 0x8A3B
+# define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+# define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+# define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+# define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+# define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+# endif
+
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
GraphicsHelperGL3_3::GraphicsHelperGL3_3()
- : m_funcs(Q_NULLPTR)
+ : m_funcs(nullptr)
, m_tessFuncs()
{
}
@@ -68,13 +90,13 @@ void GraphicsHelperGL3_3::initializeHelper(QOpenGLContext *context,
}
}
-void GraphicsHelperGL3_3::drawElementsInstanced(GLenum primitiveType,
- GLsizei primitiveCount,
- GLint indexType,
- void *indices,
- GLsizei instances,
- GLint baseVertex,
- GLint baseInstance)
+void GraphicsHelperGL3_3::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType,
+ GLsizei primitiveCount,
+ GLint indexType,
+ void *indices,
+ GLsizei instances,
+ GLint baseVertex,
+ GLint baseInstance)
{
if (baseInstance != 0)
qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL 3";
@@ -100,6 +122,16 @@ void GraphicsHelperGL3_3::drawArraysInstanced(GLenum primitiveType,
instances);
}
+void GraphicsHelperGL3_3::drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance)
+{
+ if (baseInstance != 0)
+ qWarning() << "glDrawArraysInstancedBaseInstance is not supported with OpenGL 3";
+ m_funcs->glDrawArraysInstanced(primitiveType,
+ first,
+ count,
+ instances);
+}
+
void GraphicsHelperGL3_3::drawElements(GLenum primitiveType,
GLsizei primitiveCount,
GLint indexType,
@@ -217,6 +249,14 @@ QVector<ShaderUniformBlock> GraphicsHelperGL3_3::programUniformBlocks(GLuint pro
return blocks;
}
+QVector<ShaderStorageBlock> GraphicsHelperGL3_3::programShaderStorageBlocks(GLuint programId)
+{
+ Q_UNUSED(programId);
+ QVector<ShaderStorageBlock> blocks;
+ qWarning() << "SSBO are not supported by OpenGL 3.3 (since OpenGL 4.3)";
+ return blocks;
+}
+
void GraphicsHelperGL3_3::vertexAttribDivisor(GLuint index, GLuint divisor)
{
m_funcs->glVertexAttribDivisor(index, divisor);
@@ -236,6 +276,17 @@ void GraphicsHelperGL3_3::blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
qWarning() << "glBlendFunci() not supported by OpenGL 3.3 (since OpenGL 4.0)";
}
+void GraphicsHelperGL3_3::blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha)
+{
+ Q_UNUSED(buf);
+ Q_UNUSED(sRGB);
+ Q_UNUSED(dRGB);
+ Q_UNUSED(sAlpha);
+ Q_UNUSED(dAlpha);
+
+ qWarning() << "glBlendFuncSeparatei() not supported by OpenGL 3.3 (since OpenGL 4.0)";
+}
+
void GraphicsHelperGL3_3::alphaTest(GLenum, GLenum)
{
qCWarning(Render::Rendering) << "AlphaTest not available with OpenGL 3.2 core";
@@ -252,26 +303,22 @@ void GraphicsHelperGL3_3::depthMask(GLenum mode)
m_funcs->glDepthMask(mode);
}
-void GraphicsHelperGL3_3::cullFace(GLenum mode)
-{
- m_funcs->glEnable(GL_CULL_FACE);
- m_funcs->glCullFace(mode);
-}
-
void GraphicsHelperGL3_3::frontFace(GLenum mode)
{
m_funcs->glFrontFace(mode);
}
-void GraphicsHelperGL3_3::enableAlphaCoverage()
+void GraphicsHelperGL3_3::setMSAAEnabled(bool enabled)
{
- m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_MULTISAMPLE)
+ : m_funcs->glDisable(GL_MULTISAMPLE);
}
-void GraphicsHelperGL3_3::disableAlphaCoverage()
+void GraphicsHelperGL3_3::setAlphaCoverageEnabled(bool enabled)
{
- m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
+ : m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
}
GLuint GraphicsHelperGL3_3::createFrameBufferObject()
@@ -307,11 +354,11 @@ void GraphicsHelperGL3_3::bindFrameBufferAttachment(QOpenGLTexture *texture, con
{
GLenum attr = GL_DEPTH_STENCIL_ATTACHMENT;
- if (attachment.m_type <= QRenderAttachment::ColorAttachment15)
- attr = GL_COLOR_ATTACHMENT0 + attachment.m_type;
- else if (attachment.m_type == QRenderAttachment::DepthAttachment)
+ if (attachment.m_point <= QRenderTargetOutput::Color15)
+ attr = GL_COLOR_ATTACHMENT0 + attachment.m_point;
+ else if (attachment.m_point == QRenderTargetOutput::Depth)
attr = GL_DEPTH_ATTACHMENT;
- else if (attachment.m_type == QRenderAttachment::StencilAttachment)
+ else if (attachment.m_point == QRenderTargetOutput::Stencil)
attr = GL_STENCIL_ATTACHMENT;
texture->bind();
@@ -356,8 +403,8 @@ void GraphicsHelperGL3_3::drawBuffers(GLsizei n, const int *bufs)
void GraphicsHelperGL3_3::bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs)
{
- Q_FOREACH (const QString &name, outputs.keys())
- m_funcs->glBindFragDataLocation(shader, outputs.value(name), name.toStdString().c_str());
+ for (auto it = outputs.begin(), end = outputs.end(); it != end; ++it)
+ m_funcs->glBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str());
}
void GraphicsHelperGL3_3::bindUniform(const QVariant &v, const ShaderUniform &description)
@@ -541,6 +588,14 @@ void GraphicsHelperGL3_3::bindUniformBlock(GLuint programId, GLuint uniformBlock
m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding);
}
+void GraphicsHelperGL3_3::bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding)
+{
+ Q_UNUSED(programId);
+ Q_UNUSED(shaderStorageBlockIndex);
+ Q_UNUSED(shaderStorageBlockBinding);
+ qWarning() << "SSBO are not supported by OpenGL 3.3 (since OpenGL 4.3)";
+}
+
void GraphicsHelperGL3_3::bindBufferBase(GLenum target, GLuint index, GLuint buffer)
{
m_funcs->glBindBufferBase(target, index, buffer);
@@ -884,6 +939,14 @@ void GraphicsHelperGL3_3::disableClipPlane(int clipPlane)
m_funcs->glDisable(GL_CLIP_DISTANCE0 + clipPlane);
}
+void GraphicsHelperGL3_3::setClipPlane(int clipPlane, const QVector3D &normal, float distance)
+{
+ // deprecated
+ Q_UNUSED(clipPlane);
+ Q_UNUSED(normal);
+ Q_UNUSED(distance);
+}
+
GLint GraphicsHelperGL3_3::maxClipPlaneCount()
{
GLint max = 0;
@@ -902,6 +965,12 @@ void GraphicsHelperGL3_3::disablePrimitiveRestart()
m_funcs->glDisable(GL_PRIMITIVE_RESTART);
}
+void GraphicsHelperGL3_3::clearBufferf(GLint drawbuffer, const QVector4D &values)
+{
+ GLfloat vec[4] = {values[0], values[1], values[2], values[3]};
+ m_funcs->glClearBufferfv(GL_COLOR, drawbuffer, vec);
+}
+
void GraphicsHelperGL3_3::pointSize(bool programmable, GLfloat value)
{
if (programmable) {
@@ -912,6 +981,24 @@ void GraphicsHelperGL3_3::pointSize(bool programmable, GLfloat value)
}
}
+void GraphicsHelperGL3_3::enablei(GLenum cap, GLuint index)
+{
+ m_funcs->glEnablei(cap, index);
+}
+
+void GraphicsHelperGL3_3::disablei(GLenum cap, GLuint index)
+{
+ m_funcs->glDisablei(cap, index);
+}
+
+void GraphicsHelperGL3_3::setSeamlessCubemap(bool enable)
+{
+ if (enable)
+ m_funcs->glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
+ else
+ m_funcs->glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
+}
+
QSize GraphicsHelperGL3_3::getRenderBufferDimensions(GLuint renderBufferId)
{
GLint width = 0;
@@ -938,6 +1025,14 @@ QSize GraphicsHelperGL3_3::getTextureDimensions(GLuint textureId, GLenum target,
return QSize(width, height);
}
+void GraphicsHelperGL3_3::dispatchCompute(GLuint wx, GLuint wy, GLuint wz)
+{
+ Q_UNUSED(wx);
+ Q_UNUSED(wy);
+ Q_UNUSED(wz);
+ qWarning() << "Compute Shaders are not supported by OpenGL 3.3 (since OpenGL 4.3)";
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/graphicshelpers/graphicshelpergl3_3_p.h
index 625720d06..bb6946a20 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_3_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl3_3_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -72,27 +75,31 @@ public:
void bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) Q_DECL_OVERRIDE;
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE;
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
+ void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
GLuint boundFrameBufferObject() Q_DECL_OVERRIDE;
void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) Q_DECL_OVERRIDE;
bool checkFrameBufferComplete() Q_DECL_OVERRIDE;
+ void clearBufferf(GLint drawbuffer, const QVector4D &values) Q_DECL_OVERRIDE;
GLuint createFrameBufferObject() Q_DECL_OVERRIDE;
- void cullFace(GLenum mode) Q_DECL_OVERRIDE;
void depthMask(GLenum mode) Q_DECL_OVERRIDE;
void depthTest(GLenum mode) Q_DECL_OVERRIDE;
- void disableAlphaCoverage() Q_DECL_OVERRIDE;
void disableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void disablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) Q_DECL_OVERRIDE;
void drawArrays(GLenum primitiveType, GLint first, GLsizei count) Q_DECL_OVERRIDE;
void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) Q_DECL_OVERRIDE;
+ void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) Q_DECL_OVERRIDE;
void drawBuffers(GLsizei n, const int *bufs) Q_DECL_OVERRIDE;
void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) Q_DECL_OVERRIDE;
- void drawElementsInstanced(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
- void enableAlphaCoverage() Q_DECL_OVERRIDE;
+ void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
void enableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void enablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void frontFace(GLenum mode) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
@@ -103,7 +110,12 @@ public:
QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
+ QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
+ void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
void setVerticesPerPatch(GLint verticesPerPatch) Q_DECL_OVERRIDE;
bool supportsFeature(Feature feature) const Q_DECL_OVERRIDE;
uint uniformByteSize(const ShaderUniform &description) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl3_p.h b/src/render/graphicshelpers/graphicshelpergl3_p.h
index 59337a690..721078130 100644
--- a/src/render/graphicshelpers/graphicshelpergl3_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl3_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -72,27 +75,31 @@ public:
void bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) Q_DECL_OVERRIDE;
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE;
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
+ void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
GLuint boundFrameBufferObject() Q_DECL_OVERRIDE;
void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) Q_DECL_OVERRIDE;
bool checkFrameBufferComplete() Q_DECL_OVERRIDE;
+ void clearBufferf(GLint drawbuffer, const QVector4D &values) Q_DECL_OVERRIDE;
GLuint createFrameBufferObject() Q_DECL_OVERRIDE;
- void cullFace(GLenum mode) Q_DECL_OVERRIDE;
void depthMask(GLenum mode) Q_DECL_OVERRIDE;
void depthTest(GLenum mode) Q_DECL_OVERRIDE;
- void disableAlphaCoverage() Q_DECL_OVERRIDE;
void disableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void disablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) Q_DECL_OVERRIDE;
void drawArrays(GLenum primitiveType, GLint first, GLsizei count) Q_DECL_OVERRIDE;
void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) Q_DECL_OVERRIDE;
+ void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) Q_DECL_OVERRIDE;
void drawBuffers(GLsizei n, const int *bufs) Q_DECL_OVERRIDE;
void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) Q_DECL_OVERRIDE;
- void drawElementsInstanced(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
- void enableAlphaCoverage() Q_DECL_OVERRIDE;
+ void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
void enableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void enablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void frontFace(GLenum mode) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
@@ -103,7 +110,12 @@ public:
QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
+ QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
+ void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
void setVerticesPerPatch(GLint verticesPerPatch) Q_DECL_OVERRIDE;
bool supportsFeature(Feature feature) const Q_DECL_OVERRIDE;
uint uniformByteSize(const ShaderUniform &description) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelpergl4.cpp b/src/render/graphicshelpers/graphicshelpergl4.cpp
index 74f7b4d4f..6d7a3b5b1 100644
--- a/src/render/graphicshelpers/graphicshelpergl4.cpp
+++ b/src/render/graphicshelpers/graphicshelpergl4.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -43,8 +46,24 @@
#include <private/attachmentpack_p.h>
#include <private/qgraphicsutils_p.h>
-# ifndef QT_OPENGL_4
-# define GL_PATCH_VERTICES 36466
+# ifndef QT_OPENGL_4_3
+# ifndef GL_PATCH_VERTICES
+# define GL_PATCH_VERTICES 36466
+# endif
+# define GL_ACTIVE_RESOURCES 0x92F5
+# define GL_BUFFER_BINDING 0x9302
+# define GL_BUFFER_DATA_SIZE 0x9303
+# define GL_NUM_ACTIVE_VARIABLES 0x9304
+# define GL_SHADER_STORAGE_BLOCK 0x92E6
+# define GL_UNIFORM 0x92E1
+# define GL_UNIFORM_BLOCK 0x92E2
+# define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+# define GL_UNIFORM_OFFSET 0x8A3B
+# define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+# define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+# define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+# define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+# define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
# endif
QT_BEGIN_NAMESPACE
@@ -53,12 +72,12 @@ namespace Qt3DRender {
namespace Render {
GraphicsHelperGL4::GraphicsHelperGL4()
- : m_funcs(Q_NULLPTR)
+ : m_funcs(nullptr)
{
}
void GraphicsHelperGL4::initializeHelper(QOpenGLContext *context,
- QAbstractOpenGLFunctions *functions)
+ QAbstractOpenGLFunctions *functions)
{
Q_UNUSED(context);
m_funcs = static_cast<QOpenGLFunctions_4_3_Core*>(functions);
@@ -67,13 +86,13 @@ void GraphicsHelperGL4::initializeHelper(QOpenGLContext *context,
Q_UNUSED(ok);
}
-void GraphicsHelperGL4::drawElementsInstanced(GLenum primitiveType,
- GLsizei primitiveCount,
- GLint indexType,
- void *indices,
- GLsizei instances,
- GLint baseVertex,
- GLint baseInstance)
+void GraphicsHelperGL4::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType,
+ GLsizei primitiveCount,
+ GLint indexType,
+ void *indices,
+ GLsizei instances,
+ GLint baseVertex,
+ GLint baseInstance)
{
if (baseInstance != 0)
qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2";
@@ -88,9 +107,9 @@ void GraphicsHelperGL4::drawElementsInstanced(GLenum primitiveType,
}
void GraphicsHelperGL4::drawArraysInstanced(GLenum primitiveType,
- GLint first,
- GLsizei count,
- GLsizei instances)
+ GLint first,
+ GLsizei count,
+ GLsizei instances)
{
// glDrawArraysInstanced OpenGL 3.1 or greater
m_funcs->glDrawArraysInstanced(primitiveType,
@@ -99,11 +118,20 @@ void GraphicsHelperGL4::drawArraysInstanced(GLenum primitiveType,
instances);
}
+void GraphicsHelperGL4::drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance)
+{
+ m_funcs->glDrawArraysInstancedBaseInstance(primitiveType,
+ first,
+ count,
+ instances,
+ baseInstance);
+}
+
void GraphicsHelperGL4::drawElements(GLenum primitiveType,
- GLsizei primitiveCount,
- GLint indexType,
- void *indices,
- GLint baseVertex)
+ GLsizei primitiveCount,
+ GLint indexType,
+ void *indices,
+ GLint baseVertex)
{
m_funcs->glDrawElementsBaseVertex(primitiveType,
primitiveCount,
@@ -113,8 +141,8 @@ void GraphicsHelperGL4::drawElements(GLenum primitiveType,
}
void GraphicsHelperGL4::drawArrays(GLenum primitiveType,
- GLint first,
- GLsizei count)
+ GLint first,
+ GLsizei count)
{
m_funcs->glDrawArrays(primitiveType,
first,
@@ -136,10 +164,10 @@ QVector<ShaderUniform> GraphicsHelperGL4::programUniformsAndLocations(GLuint pro
QVector<ShaderUniform> uniforms;
GLint nbrActiveUniforms = 0;
- m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORMS, &nbrActiveUniforms);
+ m_funcs->glGetProgramInterfaceiv(programId, GL_UNIFORM, GL_ACTIVE_RESOURCES, &nbrActiveUniforms);
uniforms.reserve(nbrActiveUniforms);
char uniformName[256];
- for (GLint i = 0; i < nbrActiveUniforms; i++) {
+ for (GLint i = 0; i < nbrActiveUniforms; ++i) {
ShaderUniform uniform;
GLsizei uniformNameLength = 0;
// Size is 1 for scalar and more for struct or arrays
@@ -170,7 +198,7 @@ QVector<ShaderAttribute> GraphicsHelperGL4::programAttributesAndLocations(GLuint
m_funcs->glGetProgramiv(programId, GL_ACTIVE_ATTRIBUTES, &nbrActiveAttributes);
attributes.reserve(nbrActiveAttributes);
char attributeName[256];
- for (GLint i = 0; i < nbrActiveAttributes; i++) {
+ for (GLint i = 0; i < nbrActiveAttributes; ++i) {
ShaderAttribute attribute;
GLsizei attributeNameLength = 0;
// Size is 1 for scalar and more for struct or arrays
@@ -189,23 +217,50 @@ QVector<ShaderUniformBlock> GraphicsHelperGL4::programUniformBlocks(GLuint progr
{
QVector<ShaderUniformBlock> blocks;
GLint nbrActiveUniformsBlocks = 0;
- m_funcs->glGetProgramiv(programId, GL_ACTIVE_UNIFORM_BLOCKS, &nbrActiveUniformsBlocks);
+ m_funcs->glGetProgramInterfaceiv(programId, GL_UNIFORM_BLOCK, GL_ACTIVE_RESOURCES, &nbrActiveUniformsBlocks);
blocks.reserve(nbrActiveUniformsBlocks);
- for (GLint i = 0; i < nbrActiveUniformsBlocks; i++) {
+ for (GLint i = 0; i < nbrActiveUniformsBlocks; ++i) {
QByteArray uniformBlockName(256, '\0');
GLsizei length = 0;
ShaderUniformBlock uniformBlock;
- m_funcs->glGetActiveUniformBlockName(programId, i, 256, &length, uniformBlockName.data());
+ m_funcs->glGetProgramResourceName(programId, GL_UNIFORM_BLOCK, i, 256, &length, uniformBlockName.data());
uniformBlock.m_name = QString::fromUtf8(uniformBlockName.left(length));
uniformBlock.m_index = i;
- m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS, &uniformBlock.m_activeUniformsCount);
- m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_BINDING, &uniformBlock.m_binding);
- m_funcs->glGetActiveUniformBlockiv(programId, i, GL_UNIFORM_BLOCK_DATA_SIZE, &uniformBlock.m_size);
+ GLenum prop = GL_BUFFER_BINDING;
+ m_funcs->glGetProgramResourceiv(programId, GL_UNIFORM_BLOCK, i, 1, &prop, 4, NULL, &uniformBlock.m_binding);
+ prop = GL_BUFFER_DATA_SIZE;
+ m_funcs->glGetProgramResourceiv(programId, GL_UNIFORM_BLOCK, i, 1, &prop, 4, NULL, &uniformBlock.m_size);
+ prop = GL_NUM_ACTIVE_VARIABLES;
+ m_funcs->glGetProgramResourceiv(programId, GL_UNIFORM_BLOCK, i, 1, &prop, 4, NULL, &uniformBlock.m_activeUniformsCount);
blocks.append(uniformBlock);
}
return blocks;
}
+QVector<ShaderStorageBlock> GraphicsHelperGL4::programShaderStorageBlocks(GLuint programId)
+{
+ QVector<ShaderStorageBlock> blocks;
+ GLint nbrActiveShaderStorageBlocks = 0;
+ m_funcs->glGetProgramInterfaceiv(programId, GL_SHADER_STORAGE_BLOCK, GL_ACTIVE_RESOURCES, &nbrActiveShaderStorageBlocks);
+ blocks.reserve(nbrActiveShaderStorageBlocks);
+ for (GLint i = 0; i < nbrActiveShaderStorageBlocks; ++i) {
+ QByteArray storageBlockName(256, '\0');
+ GLsizei length = 0;
+ ShaderStorageBlock storageBlock;
+ m_funcs->glGetProgramResourceName(programId, GL_SHADER_STORAGE_BLOCK, i, 256, &length, storageBlockName.data());
+ storageBlock.m_index = i;
+ storageBlock.m_name = QString::fromUtf8(storageBlockName.left(length));
+ GLenum prop = GL_BUFFER_BINDING;
+ m_funcs->glGetProgramResourceiv(programId, GL_SHADER_STORAGE_BLOCK, i, 1, &prop, 4, NULL, &storageBlock.m_binding);
+ prop = GL_BUFFER_DATA_SIZE;
+ m_funcs->glGetProgramResourceiv(programId, GL_SHADER_STORAGE_BLOCK, i, 1, &prop, 4, NULL, &storageBlock.m_size);
+ prop = GL_NUM_ACTIVE_VARIABLES;
+ m_funcs->glGetProgramResourceiv(programId, GL_SHADER_STORAGE_BLOCK, i, 1, &prop, 4, NULL, &storageBlock.m_activeVariablesCount);
+ blocks.push_back(storageBlock);
+ }
+ return blocks;
+}
+
void GraphicsHelperGL4::vertexAttribDivisor(GLuint index, GLuint divisor)
{
m_funcs->glVertexAttribDivisor(index, divisor);
@@ -221,6 +276,11 @@ void GraphicsHelperGL4::blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor)
m_funcs->glBlendFunci(buf, sfactor, dfactor);
}
+void GraphicsHelperGL4::blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha)
+{
+ m_funcs->glBlendFuncSeparatei(buf, sRGB, dRGB, sAlpha, dAlpha);
+}
+
void GraphicsHelperGL4::alphaTest(GLenum, GLenum)
{
qCWarning(Render::Rendering) << "AlphaTest not available with OpenGL 3.2 core";
@@ -237,26 +297,22 @@ void GraphicsHelperGL4::depthMask(GLenum mode)
m_funcs->glDepthMask(mode);
}
-void GraphicsHelperGL4::cullFace(GLenum mode)
-{
- m_funcs->glEnable(GL_CULL_FACE);
- m_funcs->glCullFace(mode);
-}
-
void GraphicsHelperGL4::frontFace(GLenum mode)
{
m_funcs->glFrontFace(mode);
}
-void GraphicsHelperGL4::enableAlphaCoverage()
+void GraphicsHelperGL4::setMSAAEnabled(bool enabled)
{
- m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_MULTISAMPLE)
+ : m_funcs->glDisable(GL_MULTISAMPLE);
}
-void GraphicsHelperGL4::disableAlphaCoverage()
+void GraphicsHelperGL4::setAlphaCoverageEnabled(bool enabled)
{
- m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
+ enabled ? m_funcs->glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE)
+ : m_funcs->glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
}
GLuint GraphicsHelperGL4::createFrameBufferObject()
@@ -292,11 +348,11 @@ void GraphicsHelperGL4::bindFrameBufferAttachment(QOpenGLTexture *texture, const
{
GLenum attr = GL_DEPTH_STENCIL_ATTACHMENT;
- if (attachment.m_type <= QRenderAttachment::ColorAttachment15)
- attr = GL_COLOR_ATTACHMENT0 + attachment.m_type;
- else if (attachment.m_type == QRenderAttachment::DepthAttachment)
+ if (attachment.m_point <= QRenderTargetOutput::Color15)
+ attr = GL_COLOR_ATTACHMENT0 + attachment.m_point;
+ else if (attachment.m_point == QRenderTargetOutput::Depth)
attr = GL_DEPTH_ATTACHMENT;
- else if (attachment.m_type == QRenderAttachment::StencilAttachment)
+ else if (attachment.m_point == QRenderTargetOutput::Stencil)
attr = GL_STENCIL_ATTACHMENT;
texture->bind();
@@ -321,6 +377,9 @@ bool GraphicsHelperGL4::supportsFeature(GraphicsHelperInterface::Feature feature
case UniformBufferObject:
case RenderBufferDimensionRetrieval:
case TextureDimensionRetrieval:
+ case ShaderStorageObject:
+ case Compute:
+ case DrawBuffersBlend:
return true;
default:
return false;
@@ -339,8 +398,8 @@ void GraphicsHelperGL4::drawBuffers(GLsizei n, const int *bufs)
void GraphicsHelperGL4::bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs)
{
- Q_FOREACH (const QString &name, outputs.keys())
- m_funcs->glBindFragDataLocation(shader, outputs.value(name), name.toStdString().c_str());
+ for (auto it = outputs.begin(), end = outputs.end(); it != end; ++it)
+ m_funcs->glBindFragDataLocation(shader, it.value(), it.key().toStdString().c_str());
}
void GraphicsHelperGL4::bindUniform(const QVariant &v, const ShaderUniform &description)
@@ -524,6 +583,11 @@ void GraphicsHelperGL4::bindUniformBlock(GLuint programId, GLuint uniformBlockIn
m_funcs->glUniformBlockBinding(programId, uniformBlockIndex, uniformBlockBinding);
}
+void GraphicsHelperGL4::bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding)
+{
+ m_funcs->glShaderStorageBlockBinding(programId, shaderStorageBlockIndex, shaderStorageBlockBinding);
+}
+
void GraphicsHelperGL4::bindBufferBase(GLenum target, GLuint index, GLuint buffer)
{
m_funcs->glBindBufferBase(target, index, buffer);
@@ -867,6 +931,11 @@ void GraphicsHelperGL4::disableClipPlane(int clipPlane)
m_funcs->glDisable(GL_CLIP_DISTANCE0 + clipPlane);
}
+void GraphicsHelperGL4::setClipPlane(int, const QVector3D &, float)
+{
+ // deprecated
+}
+
GLint GraphicsHelperGL4::maxClipPlaneCount()
{
GLint max = 0;
@@ -885,6 +954,12 @@ void GraphicsHelperGL4::disablePrimitiveRestart()
m_funcs->glDisable(GL_PRIMITIVE_RESTART);
}
+void GraphicsHelperGL4::clearBufferf(GLint drawbuffer, const QVector4D &values)
+{
+ GLfloat vec[4] = {values[0], values[1], values[2], values[3]};
+ m_funcs->glClearBufferfv(GL_COLOR, drawbuffer, vec);
+}
+
void GraphicsHelperGL4::pointSize(bool programmable, GLfloat value)
{
if (programmable) {
@@ -895,6 +970,24 @@ void GraphicsHelperGL4::pointSize(bool programmable, GLfloat value)
}
}
+void GraphicsHelperGL4::enablei(GLenum cap, GLuint index)
+{
+ m_funcs->glEnablei(cap, index);
+}
+
+void GraphicsHelperGL4::disablei(GLenum cap, GLuint index)
+{
+ m_funcs->glDisablei(cap, index);
+}
+
+void GraphicsHelperGL4::setSeamlessCubemap(bool enable)
+{
+ if (enable)
+ m_funcs->glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
+ else
+ m_funcs->glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
+}
+
QSize GraphicsHelperGL4::getRenderBufferDimensions(GLuint renderBufferId)
{
GLint width = 0;
@@ -921,6 +1014,11 @@ QSize GraphicsHelperGL4::getTextureDimensions(GLuint textureId, GLenum target, u
return QSize(width, height);
}
+void GraphicsHelperGL4::dispatchCompute(GLuint wx, GLuint wy, GLuint wz)
+{
+ m_funcs->glDispatchCompute(wx, wy, wz);
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/graphicshelpers/graphicshelpergl4_p.h b/src/render/graphicshelpers/graphicshelpergl4_p.h
index 0ed007482..38a01e271 100644
--- a/src/render/graphicshelpers/graphicshelpergl4_p.h
+++ b/src/render/graphicshelpers/graphicshelpergl4_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -71,27 +74,31 @@ public:
void bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) Q_DECL_OVERRIDE;
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) Q_DECL_OVERRIDE;
void bindFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) Q_DECL_OVERRIDE;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) Q_DECL_OVERRIDE;
void bindUniform(const QVariant &v, const ShaderUniform &description) Q_DECL_OVERRIDE;
void blendEquation(GLenum mode) Q_DECL_OVERRIDE;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_DECL_OVERRIDE;
+ void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) Q_DECL_OVERRIDE;
GLuint boundFrameBufferObject() Q_DECL_OVERRIDE;
void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) Q_DECL_OVERRIDE;
bool checkFrameBufferComplete() Q_DECL_OVERRIDE;
+ void clearBufferf(GLint drawbuffer, const QVector4D &values) Q_DECL_OVERRIDE;
GLuint createFrameBufferObject() Q_DECL_OVERRIDE;
- void cullFace(GLenum mode) Q_DECL_OVERRIDE;
void depthMask(GLenum mode) Q_DECL_OVERRIDE;
void depthTest(GLenum mode) Q_DECL_OVERRIDE;
- void disableAlphaCoverage() Q_DECL_OVERRIDE;
void disableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void disablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void disablePrimitiveRestart() Q_DECL_OVERRIDE;
+ void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) Q_DECL_OVERRIDE;
void drawArrays(GLenum primitiveType, GLint first, GLsizei count) Q_DECL_OVERRIDE;
void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) Q_DECL_OVERRIDE;
+ void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) Q_DECL_OVERRIDE;
void drawBuffers(GLsizei n, const int *bufs) Q_DECL_OVERRIDE;
void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLint baseVertex = 0) Q_DECL_OVERRIDE;
- void drawElementsInstanced(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
- void enableAlphaCoverage() Q_DECL_OVERRIDE;
+ void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) Q_DECL_OVERRIDE;
void enableClipPlane(int clipPlane) Q_DECL_OVERRIDE;
+ void enablei(GLenum cap, GLuint index) Q_DECL_OVERRIDE;
void enablePrimitiveRestart(int primitiveRestartIndex) Q_DECL_OVERRIDE;
void frontFace(GLenum mode) Q_DECL_OVERRIDE;
QSize getRenderBufferDimensions(GLuint renderBufferId) Q_DECL_OVERRIDE;
@@ -102,7 +109,12 @@ public:
QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) Q_DECL_OVERRIDE;
QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) Q_DECL_OVERRIDE;
+ QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) Q_DECL_OVERRIDE;
void releaseFrameBufferObject(GLuint frameBufferId) Q_DECL_OVERRIDE;
+ void setMSAAEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setAlphaCoverageEnabled(bool enable) Q_DECL_OVERRIDE;
+ void setClipPlane(int clipPlane, const QVector3D &normal, float distance) Q_DECL_OVERRIDE;
+ void setSeamlessCubemap(bool enable) Q_DECL_OVERRIDE;
void setVerticesPerPatch(GLint verticesPerPatch) Q_DECL_OVERRIDE;
bool supportsFeature(Feature feature) const Q_DECL_OVERRIDE;
uint uniformByteSize(const ShaderUniform &description) Q_DECL_OVERRIDE;
diff --git a/src/render/graphicshelpers/graphicshelperinterface_p.h b/src/render/graphicshelpers/graphicshelperinterface_p.h
index 15c950253..6e7caee6a 100644
--- a/src/render/graphicshelpers/graphicshelperinterface_p.h
+++ b/src/render/graphicshelpers/graphicshelperinterface_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -70,7 +73,10 @@ public:
BindableFragmentOutputs,
PrimitiveRestart,
RenderBufferDimensionRetrieval,
- TextureDimensionRetrieval
+ TextureDimensionRetrieval,
+ ShaderStorageObject,
+ Compute,
+ DrawBuffersBlend
};
virtual ~GraphicsHelperInterface() {}
@@ -79,27 +85,31 @@ public:
virtual void bindFragDataLocation(GLuint shader, const QHash<QString, int> &outputs) = 0;
virtual void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) = 0;
virtual void bindFrameBufferObject(GLuint frameBufferId) = 0;
+ virtual void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) = 0;
virtual void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) = 0;
virtual void bindUniform(const QVariant &v, const ShaderUniform &description) = 0;
virtual void blendEquation(GLenum mode) = 0;
virtual void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) = 0;
+ virtual void blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, GLenum sAlpha, GLenum dAlpha) = 0;
virtual GLuint boundFrameBufferObject() = 0;
virtual void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) = 0;
virtual bool checkFrameBufferComplete() = 0;
+ virtual void clearBufferf(GLint drawbuffer, const QVector4D &values) = 0;
virtual GLuint createFrameBufferObject() = 0;
- virtual void cullFace(GLenum mode) = 0;
virtual void depthMask(GLenum mode) = 0;
virtual void depthTest(GLenum mode) = 0;
- virtual void disableAlphaCoverage() = 0;
virtual void disableClipPlane(int clipPlane) = 0;
+ virtual void disablei(GLenum cap, GLuint index) = 0;
virtual void disablePrimitiveRestart() = 0;
+ virtual void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) = 0;
virtual void drawArrays(GLenum primitiveType, GLint first, GLsizei count) = 0;
virtual void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) = 0;
+ virtual void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseinstance) = 0;
virtual void drawBuffers(GLsizei n, const int *bufs) = 0;
- virtual void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLint baseVertex = 0) = 0;
- virtual void drawElementsInstanced(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) = 0;
- virtual void enableAlphaCoverage() = 0;
+ virtual void drawElements(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLint baseVertex) = 0;
+ virtual void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void * indices, GLsizei instances, GLint baseVertex, GLint baseInstance) = 0;
virtual void enableClipPlane(int clipPlane) = 0;
+ virtual void enablei(GLenum cap, GLuint index) = 0;
virtual void enablePrimitiveRestart(int primitiveRestartIndex) = 0;
virtual void frontFace(GLenum mode) = 0;
virtual QSize getRenderBufferDimensions(GLuint renderBufferId) = 0;
@@ -110,7 +120,12 @@ public:
virtual QVector<ShaderAttribute> programAttributesAndLocations(GLuint programId) = 0;
virtual QVector<ShaderUniform> programUniformsAndLocations(GLuint programId) = 0;
virtual QVector<ShaderUniformBlock> programUniformBlocks(GLuint programId) = 0;
+ virtual QVector<ShaderStorageBlock> programShaderStorageBlocks(GLuint programId) = 0;
virtual void releaseFrameBufferObject(GLuint frameBufferId) = 0;
+ virtual void setAlphaCoverageEnabled(bool enable) = 0;
+ virtual void setClipPlane(int clipPlane, const QVector3D &normal, float distance) = 0;
+ virtual void setMSAAEnabled(bool enable) = 0;
+ virtual void setSeamlessCubemap(bool enable) = 0;
virtual void setVerticesPerPatch(GLint verticesPerPatch) = 0;
virtual bool supportsFeature(Feature feature) const = 0;
virtual uint uniformByteSize(const ShaderUniform &description) = 0;
diff --git a/src/render/graphicshelpers/graphicshelpers.pri b/src/render/graphicshelpers/graphicshelpers.pri
index 7f29801bc..a5dcbe808 100644
--- a/src/render/graphicshelpers/graphicshelpers.pri
+++ b/src/render/graphicshelpers/graphicshelpers.pri
@@ -1,3 +1,5 @@
+#DEFINES += QT3D_RENDER_ASPECT_OPENGL_DEBUG
+
INCLUDEPATH += $$PWD
HEADERS += \
diff --git a/src/render/io/glbuffer.cpp b/src/render/io/glbuffer.cpp
new file mode 100644
index 000000000..23b8483fd
--- /dev/null
+++ b/src/render/io/glbuffer.cpp
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "glbuffer_p.h"
+#include <private/graphicscontext_p.h>
+
+#if !defined(GL_UNIFORM_BUFFER)
+#define GL_UNIFORM_BUFFER 0x8A11
+#endif
+#if !defined(GL_ARRAY_BUFFER)
+#define GL_ARRAY_BUFFER 0x8892
+#endif
+#if !defined(GL_ELEMENT_ARRAY_BUFFER)
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#endif
+#if !defined(GL_SHADER_STORAGE_BUFFER)
+#define GL_SHADER_STORAGE_BUFFER 0x90D2
+#endif
+#if !defined(GL_PIXEL_PACK_BUFFER)
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#endif
+#if !defined(GL_PIXEL_UNPACK_BUFFER)
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#endif
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+// A UBO is created for each ShaderData Shader Pair
+// That means a UBO is unique to a shader/shaderdata
+
+namespace {
+
+GLenum glBufferTypes[] = {
+ GL_ARRAY_BUFFER,
+ GL_UNIFORM_BUFFER,
+ GL_ELEMENT_ARRAY_BUFFER,
+ GL_SHADER_STORAGE_BUFFER,
+ GL_PIXEL_PACK_BUFFER,
+ GL_PIXEL_UNPACK_BUFFER
+};
+
+} // anonymous
+
+GLBuffer::GLBuffer()
+ : m_bufferId(~0)
+ , m_isCreated(false)
+ , m_bound(false)
+ , m_lastTarget(GL_ARRAY_BUFFER)
+{
+}
+
+bool GLBuffer::bind(GraphicsContext *ctx, Type t)
+{
+ if (m_bufferId == 0)
+ return false;
+ m_lastTarget = glBufferTypes[t];
+ ctx->openGLContext()->functions()->glBindBuffer(m_lastTarget, m_bufferId);
+ m_bound = true;
+ return true;
+}
+
+bool GLBuffer::release(GraphicsContext *ctx)
+{
+ m_bound = false;
+ ctx->openGLContext()->functions()->glBindBuffer(m_lastTarget, 0);
+ return true;
+}
+
+bool GLBuffer::create(GraphicsContext *ctx)
+{
+ ctx->openGLContext()->functions()->glGenBuffers(1, &m_bufferId);
+ m_isCreated = true;
+ return m_bufferId != 0;
+}
+
+void GLBuffer::destroy(GraphicsContext *ctx)
+{
+ ctx->openGLContext()->functions()->glDeleteBuffers(1, &m_bufferId);
+ m_isCreated = false;
+}
+
+void GLBuffer::allocate(GraphicsContext *ctx, uint size, bool dynamic)
+{
+ // Either GL_STATIC_DRAW OR GL_DYNAMIC_DRAW depending on the use case
+ // TO DO: find a way to know how a buffer/QShaderData will be used to use the right usage
+ ctx->openGLContext()->functions()->glBufferData(m_lastTarget, size, NULL, dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+}
+
+void GLBuffer::allocate(GraphicsContext *ctx, const void *data, uint size, bool dynamic)
+{
+ ctx->openGLContext()->functions()->glBufferData(m_lastTarget, size, data, dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
+}
+
+void GLBuffer::update(GraphicsContext *ctx, const void *data, uint size, int offset)
+{
+ ctx->openGLContext()->functions()->glBufferSubData(m_lastTarget, offset, size, data);
+}
+
+void GLBuffer::bindBufferBase(GraphicsContext *ctx, int bindingPoint, GLBuffer::Type t)
+{
+ ctx->bindBufferBase(glBufferTypes[t], bindingPoint, m_bufferId);
+}
+
+void GLBuffer::bindBufferBase(GraphicsContext *ctx, int bindingPoint)
+{
+ ctx->bindBufferBase(m_lastTarget, bindingPoint, m_bufferId);
+}
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/io/glbuffer_p.h b/src/render/io/glbuffer_p.h
new file mode 100644
index 000000000..7939f6a83
--- /dev/null
+++ b/src/render/io/glbuffer_p.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_GLBUFFER_P_H
+#define QT3DRENDER_RENDER_GLBUFFER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QOpenGLContext>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+class GraphicsContext;
+
+class GLBuffer
+{
+public:
+ GLBuffer();
+
+ enum Type
+ {
+ ArrayBuffer = 0,
+ UniformBuffer,
+ IndexBuffer,
+ ShaderStorageBuffer,
+ PixelPackBuffer,
+ PixelUnpackBuffer
+ };
+
+ bool bind(GraphicsContext *ctx, Type t);
+ bool release(GraphicsContext *ctx);
+ bool create(GraphicsContext *ctx);
+ void destroy(GraphicsContext *ctx);
+ void allocate(GraphicsContext *ctx, uint size, bool dynamic = true);
+ void allocate(GraphicsContext *ctx, const void *data, uint size, bool dynamic = true);
+ void update(GraphicsContext *ctx, const void *data, uint size, int offset = 0);
+ void bindBufferBase(GraphicsContext *ctx, int bindingPoint, Type t);
+ void bindBufferBase(GraphicsContext *ctx, int bindingPoint);
+
+ inline GLuint bufferId() const { return m_bufferId; }
+ inline bool isCreated() const { return m_isCreated; }
+ inline bool isBound() const { return m_bound; }
+
+private:
+ GLuint m_bufferId;
+ bool m_isCreated;
+ bool m_bound;
+ GLenum m_lastTarget;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_GLBUFFER_P_H
diff --git a/src/render/io/io.pri b/src/render/io/io.pri
index c2ce822f8..c8816cc3e 100644
--- a/src/render/io/io.pri
+++ b/src/render/io/io.pri
@@ -2,27 +2,25 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/objloader_p.h \
- $$PWD/qabstractsceneloader.h \
- $$PWD/qabstractsceneloader_p.h \
$$PWD/qaxisalignedboundingbox_p.h \
$$PWD/qsceneloader.h \
+ $$PWD/qsceneloader_p.h \
$$PWD/qurlhelper_p.h \
$$PWD/scene_p.h \
$$PWD/scenemanager_p.h \
- $$PWD/uniformbuffer_p.h \
- $$PWD/qsceneparserfactory_p.h \
- $$PWD/qabstractsceneparser.h \
- $$PWD/qsceneparserplugin.h
+ $$PWD/qsceneiohandler_p.h \
+ $$PWD/qsceneioplugin_p.h \
+ $$PWD/glbuffer_p.h \
+ $$PWD/qsceneiofactory_p.h
SOURCES += \
$$PWD/objloader.cpp \
- $$PWD/qabstractsceneloader.cpp \
$$PWD/qaxisalignedboundingbox.cpp \
$$PWD/qsceneloader.cpp \
$$PWD/qurlhelper.cpp \
$$PWD/scene.cpp \
$$PWD/scenemanager.cpp \
- $$PWD/uniformbuffer.cpp \
- $$PWD/qabstractsceneparser.cpp \
- $$PWD/qsceneparserplugin.cpp \
- $$PWD/qsceneparserfactory.cpp
+ $$PWD/qsceneiohandler.cpp \
+ $$PWD/qsceneioplugin.cpp \
+ $$PWD/glbuffer.cpp \
+ $$PWD/qsceneiofactory.cpp
diff --git a/src/render/io/objloader.cpp b/src/render/io/objloader.cpp
index da1af4003..b15e84de8 100644
--- a/src/render/io/objloader.cpp
+++ b/src/render/io/objloader.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,6 +42,8 @@
#include "qmesh.h"
#include "qbuffer.h"
#include "qattribute.h"
+
+#include <private/qlocale_tools_p.h>
#include <Qt3DRender/private/qaxisalignedboundingbox_p.h>
#include <Qt3DRender/private/renderlogging_p.h>
@@ -55,6 +60,76 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+/*
+ * A helper class to split a QByteArray and access its sections without
+ * additional memory allocations.
+ */
+class ByteArraySplitter
+{
+public:
+ explicit ByteArraySplitter(const char *begin, const char *end, char delimiter, QString::SplitBehavior splitBehavior)
+ : m_input(begin)
+ {
+ int position = 0;
+ int lastPosition = 0;
+ for (auto it = begin; it != end; ++it) {
+ if (*it == delimiter) {
+ if (position > lastPosition || splitBehavior == QString::KeepEmptyParts) { // skip multiple consecutive delimiters
+ const Entry entry = { lastPosition, position - lastPosition };
+ m_entries.append(entry);
+ }
+ lastPosition = position + 1;
+ }
+
+ ++position;
+ }
+
+ const Entry entry = { lastPosition, position - lastPosition };
+ m_entries.append(entry);
+ }
+
+ int size() const
+ {
+ return m_entries.size();
+ }
+
+ const char* charPtrAt(int index) const
+ {
+ return m_input + m_entries[index].start;
+ }
+
+ float floatAt(int index) const
+ {
+ return qstrntod(m_input + m_entries[index].start, m_entries[index].size, nullptr, nullptr);
+ }
+
+ int intAt(int index) const
+ {
+ return strtol(m_input + m_entries[index].start, nullptr, 10);
+ }
+
+ QString stringAt(int index) const
+ {
+ return QString::fromLatin1(m_input + m_entries[index].start, m_entries[index].size);
+ }
+
+ ByteArraySplitter splitterAt(int index, char delimiter, QString::SplitBehavior splitBehavior) const
+ {
+ return ByteArraySplitter(m_input + m_entries[index].start, m_input + m_entries[index].start + m_entries[index].size, delimiter, splitBehavior);
+ }
+
+ struct Entry
+ {
+ int start;
+ int size;
+ };
+
+private:
+ QVarLengthArray<Entry, 16> m_entries;
+ const char *m_input;
+};
+QT3D_DECLARE_TYPEINFO(Qt3DRender, ByteArraySplitter::Entry, Q_PRIMITIVE_TYPE)
+
inline uint qHash(const FaceIndices &faceIndices)
{
return faceIndices.positionIndex
@@ -120,38 +195,52 @@ bool ObjLoader::load(::QIODevice *ioDev, const QString &subMesh)
QRegExp subMeshMatch(subMesh);
if (!subMeshMatch.isValid())
- subMeshMatch.setPattern(QString(QStringLiteral("^(%1)$")).arg(subMesh));
+ subMeshMatch.setPattern(QLatin1String("^(") + subMesh + QLatin1String(")$"));
Q_ASSERT(subMeshMatch.isValid());
- QTextStream stream(ioDev);
- while (!stream.atEnd()) {
- QString line = stream.readLine();
- line = line.simplified();
+ char lineBuffer[1024];
+ const char *line;
+ QByteArray longLine;
+ while (!ioDev->atEnd()) {
+ // try to read into lineBuffer first, if the line fits (common case) we can do this without expensive allocations
+ // if not, fall back to dynamically allocated QByteArrays
+ auto lineSize = ioDev->readLine(lineBuffer, sizeof(lineBuffer));
+ if (lineSize == sizeof(lineBuffer) - 1 && lineBuffer[lineSize - 1] != '\n') {
+ longLine = QByteArray(lineBuffer, lineSize);
+ longLine += ioDev->readLine();
+ line = longLine.constData();
+ lineSize = longLine.size();
+ } else {
+ line = lineBuffer;
+ }
+
+ if (lineSize > 0 && line[0] != '#') {
+ if (line[lineSize - 1] == '\n')
+ --lineSize; // chop newline
- if (line.length() > 0 && line.at(0) != QChar::fromLatin1('#')) {
- const QVector<QStringRef> tokens = line.splitRef(QChar::fromLatin1(' '));
+ const ByteArraySplitter tokens(line, line + lineSize, ' ', QString::SkipEmptyParts);
- if (tokens.first() == QStringLiteral("v")) {
+ if (qstrncmp(tokens.charPtrAt(0), "v ", 2) == 0) {
if (tokens.size() < 4) {
qCWarning(Render::Io) << "Unsupported number of components in vertex";
} else {
if (!skipping) {
- float x = tokens.at(1).toFloat();
- float y = tokens.at(2).toFloat();
- float z = tokens.at(3).toFloat();
+ float x = tokens.floatAt(1);
+ float y = tokens.floatAt(2);
+ float z = tokens.floatAt(3);
positions.append(QVector3D( x, y, z ));
} else {
positionsOffset++;
}
}
- } else if (tokens.first() == QStringLiteral("vt") && m_loadTextureCoords) {
+ } else if (m_loadTextureCoords && qstrncmp(tokens.charPtrAt(0), "vt ", 3) == 0) {
if (tokens.size() < 3) {
qCWarning(Render::Io) << "Unsupported number of components in texture coordinate";
} else {
if (!skipping) {
// Process texture coordinate
- float s = tokens.at(1).toFloat();
- float t = tokens.at(2).toFloat();
+ float s = tokens.floatAt(1);
+ float t = tokens.floatAt(2);
//FlipUVs
t = 1.0f - t;
texCoords.append(QVector2D( s, t ));
@@ -159,38 +248,38 @@ bool ObjLoader::load(::QIODevice *ioDev, const QString &subMesh)
texCoordsOffset++;
}
}
- } else if (tokens.first() == QStringLiteral("vn")) {
+ } else if (qstrncmp(tokens.charPtrAt(0), "vn ", 3) == 0) {
if (tokens.size() < 4) {
qCWarning(Render::Io) << "Unsupported number of components in vertex normal";
} else {
if (!skipping) {
- float x = tokens.at(1).toFloat();
- float y = tokens.at(2).toFloat();
- float z = tokens.at(3).toFloat();
+ float x = tokens.floatAt(1);
+ float y = tokens.floatAt(2);
+ float z = tokens.floatAt(3);
normals.append(QVector3D( x, y, z ));
} else {
normalsOffset++;
}
}
- } else if (!skipping && tokens.first() == QStringLiteral("f")) {
+ } else if (!skipping && qstrncmp(tokens.charPtrAt(0), "f ", 2) == 0) {
// Process face
++faceCount;
int faceVertices = tokens.size() - 1;
- QVector<FaceIndices> face;
+ QVarLengthArray<FaceIndices, 4> face; // try to avoid allocations in the common case of triangulated data
face.reserve(faceVertices);
for (int i = 0; i < faceVertices; i++) {
FaceIndices faceIndices;
- const QVector<QStringRef> indices = tokens.at(i + 1).split(QChar::fromLatin1('/'));
+ const ByteArraySplitter indices = tokens.splitterAt(i + 1, '/', QString::KeepEmptyParts);
switch (indices.size()) {
case 3:
- faceIndices.normalIndex = indices.at(2).toInt() - 1 - normalsOffset; // fall through
+ faceIndices.normalIndex = indices.intAt(2) - 1 - normalsOffset; // fall through
case 2:
- faceIndices.texCoordIndex = indices.at(1).toInt() - 1 - texCoordsOffset; // fall through
+ faceIndices.texCoordIndex = indices.intAt(1) - 1 - texCoordsOffset; // fall through
case 1:
- faceIndices.positionIndex = indices.at(0).toInt() - 1 - positionsOffset;
+ faceIndices.positionIndex = indices.intAt(0) - 1 - positionsOffset;
break;
default:
qCWarning(Render::Io) << "Unsupported number of indices in face element";
@@ -219,18 +308,18 @@ bool ObjLoader::load(::QIODevice *ioDev, const QString &subMesh)
}
// end of face
- } else if (tokens.first() == QStringLiteral("o")) {
+ } else if (qstrncmp(tokens.charPtrAt(0), "o ", 2) == 0) {
if (tokens.size() < 2) {
qCWarning(Render::Io) << "Missing submesh name";
} else {
if (!subMesh.isEmpty() ) {
- QString objName = tokens.at(1).toString();
+ const QString objName = tokens.stringAt(1);
skipping = subMeshMatch.indexIn(objName) < 0;
}
}
}
- } // end of input line
- } // while (!stream.atEnd())
+ } // empty input line
+ } // while (!ioDev->atEnd())
updateIndices(positions, normals, texCoords, faceIndexMap, faceIndexVector);
@@ -316,7 +405,7 @@ QGeometry *ObjLoader::geometry() const
}
QByteArray indexBytes;
- QAttribute::DataType ty;
+ QAttribute::VertexBaseType ty;
if (m_indices.size() < 65536) {
// we can use USHORT
ty = QAttribute::UnsignedShort;
@@ -373,7 +462,7 @@ void ObjLoader::updateIndices(const QVector<QVector3D> &positions,
const int indexCount = faceIndexVector.size();
m_indices.clear();
m_indices.reserve(indexCount);
- foreach (const FaceIndices &faceIndices, faceIndexVector) {
+ for (const FaceIndices faceIndices : faceIndexVector) {
const unsigned int i = faceIndexMap.value(faceIndices);
m_indices.append(i);
}
@@ -415,12 +504,9 @@ void ObjLoader::generateTangents( const QVector<QVector3D>& points,
QVector<QVector3D> tan1Accum;
QVector<QVector3D> tan2Accum;
- for ( int i = 0; i < points.size(); i++ )
- {
- tan1Accum.append( QVector3D() );
- tan2Accum.append( QVector3D() );
- tangents.append( QVector4D() );
- }
+ tan1Accum.resize(points.size());
+ tan2Accum.resize(points.size());
+ tangents.resize(points.size());
// Compute the tangent vector
for ( int i = 0; i < faces.size(); i += 3 )
@@ -455,8 +541,8 @@ void ObjLoader::generateTangents( const QVector<QVector3D>& points,
for ( int i = 0; i < points.size(); ++i )
{
const QVector3D& n = normals[i];
- QVector3D& t1 = tan1Accum[i];
- QVector3D& t2 = tan2Accum[i];
+ const QVector3D& t1 = tan1Accum[i];
+ const QVector3D& t2 = tan2Accum[i];
// Gram-Schmidt orthogonalize
tangents[i] = QVector4D( QVector3D( t1 - QVector3D::dotProduct( n, t1 ) * n ).normalized(), 0.0f );
diff --git a/src/render/io/objloader_p.h b/src/render/io/objloader_p.h
index a4b46a1cc..10979240b 100644
--- a/src/render/io/objloader_p.h
+++ b/src/render/io/objloader_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,6 +51,8 @@
// We mean it.
//
+#include <Qt3DCore/qt3dcore_global.h>
+
#include <QVector>
#include <QVector2D>
#include <QVector3D>
@@ -89,8 +94,9 @@ struct FaceIndices
unsigned int texCoordIndex;
unsigned int normalIndex;
};
+QT3D_DECLARE_TYPEINFO(Qt3DRender, FaceIndices, Q_PRIMITIVE_TYPE)
-class ObjLoader
+class Q_AUTOTEST_EXPORT ObjLoader
{
public:
ObjLoader();
diff --git a/src/render/io/qabstractsceneloader.cpp b/src/render/io/qabstractsceneloader.cpp
deleted file mode 100644
index d179e833b..000000000
--- a/src/render/io/qabstractsceneloader.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractsceneloader.h"
-#include "qabstractsceneloader_p.h"
-#include "qabstractsceneparser.h"
-#include <Qt3DRender/private/renderlogging_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QAbstractSceneLoaderPrivate::QAbstractSceneLoaderPrivate()
- : QComponentPrivate()
- , m_status(QAbstractSceneLoader::Loading)
-{
- m_shareable = false;
-}
-
-/*! \internal */
-QAbstractSceneLoader::QAbstractSceneLoader(QAbstractSceneLoaderPrivate &dd, QNode *parent)
- : QComponent(dd, parent)
-{
-}
-
-QAbstractSceneLoader::QAbstractSceneLoader(QNode *parent)
- : QComponent(*new QAbstractSceneLoaderPrivate, parent)
-{
-}
-
-QAbstractSceneLoader::~QAbstractSceneLoader()
-{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QAbstractSceneLoader subclass didn't call QNode::cleanup in its destructor");
-}
-
-void QAbstractSceneLoader::copy(const QNode *ref)
-{
- const QAbstractSceneLoader *s = static_cast<const QAbstractSceneLoader*>(ref);
- d_func()->m_source = s->d_func()->m_source;
-}
-
-QUrl QAbstractSceneLoader::source() const
-{
- Q_D(const QAbstractSceneLoader);
- return d->m_source;
-}
-
-void QAbstractSceneLoader::setSource(const QUrl &arg)
-{
- Q_D(QAbstractSceneLoader);
- if (d->m_source != arg) {
- d->m_source = arg;
- emit sourceChanged(arg);
- }
-}
-
-QAbstractSceneLoader::Status QAbstractSceneLoader::status() const
-{
- Q_D(const QAbstractSceneLoader);
- return d->m_status;
-}
-
-void QAbstractSceneLoader::setStatus(QAbstractSceneLoader::Status status)
-{
- Q_D(QAbstractSceneLoader);
- if (d->m_status != status) {
- d->m_status = status;
- emit statusChanged(status);
- }
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/io/qabstractsceneloader.h b/src/render/io/qabstractsceneloader.h
deleted file mode 100644
index 3bea49f08..000000000
--- a/src/render/io/qabstractsceneloader.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QABSTRACTSCENELOADER_H
-#define QT3DRENDER_QABSTRACTSCENELOADER_H
-
-#include <Qt3DCore/qcomponent.h>
-#include <Qt3DCore/qscenechange.h>
-#include <Qt3DRender/qt3drender_global.h>
-#include <QUrl>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractSceneLoader;
-class QAbstractSceneLoaderPrivate;
-
-class QT3DRENDERSHARED_EXPORT QAbstractSceneLoader : public Qt3DCore::QComponent
-{
- Q_OBJECT
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(Status status READ status NOTIFY statusChanged)
-public:
- explicit QAbstractSceneLoader(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QAbstractSceneLoader();
-
- enum Status {
- Loading = 0,
- Loaded,
- Error
- };
- Q_ENUM(Status)
-
- QUrl source() const;
- Status status() const;
-
-public Q_SLOTS:
- void setSource(const QUrl &arg);
- void setStatus(Status status);
-
-Q_SIGNALS:
- void sourceChanged(const QUrl &source);
- void statusChanged(Status status);
-
-protected:
- QAbstractSceneLoader(QAbstractSceneLoaderPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QAbstractSceneLoader)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QABSTRACTSCENELOADER_H
diff --git a/src/render/io/qabstractsceneloader_p.h b/src/render/io/qabstractsceneloader_p.h
deleted file mode 100644
index 80e1429a2..000000000
--- a/src/render/io/qabstractsceneloader_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QABSTRACTSCENELOADER_P_H
-#define QT3DRENDER_QABSTRACTSCENELOADER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qcomponent_p.h>
-#include <Qt3DRender/qabstractsceneloader.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractSceneParser;
-
-class QAbstractSceneLoaderPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QAbstractSceneLoaderPrivate();
-
- Q_DECLARE_PUBLIC(QAbstractSceneLoader)
-
- QUrl m_source;
- QAbstractSceneLoader::Status m_status;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QABSTRACTSCENE_P_H
diff --git a/src/render/io/qabstractsceneparser.cpp b/src/render/io/qabstractsceneparser.cpp
deleted file mode 100644
index d26e99a13..000000000
--- a/src/render/io/qabstractsceneparser.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractsceneparser.h"
-#include <Qt3DRender/private/renderlogging_p.h>
-#include <QStringList>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QAbstractSceneParser::QAbstractSceneParser() : QObject(),
- m_parserStatus(Empty)
-{
-}
-
-QAbstractSceneParser::~QAbstractSceneParser()
-{
-}
-
-QAbstractSceneParser::ParserStatus QAbstractSceneParser::parserStatus() const
-{
- return m_parserStatus;
-}
-
-QStringList QAbstractSceneParser::errors() const
-{
- return m_errors;
-}
-
-void QAbstractSceneParser::setParserStatus(ParserStatus parserStatus)
-{
- if (parserStatus != m_parserStatus) {
- m_parserStatus = parserStatus;
- emit parserStatusChanged(parserStatus);
- }
-}
-
-void QAbstractSceneParser::logError(const QString &error)
-{
- m_errors.append(error);
- emit errorsChanged(m_errors);
-}
-
-void QAbstractSceneParser::logInfo(const QString &info)
-{
- qCDebug(Render::Io) << info;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/io/qabstractsceneparser.h b/src/render/io/qabstractsceneparser.h
deleted file mode 100644
index a91d392e9..000000000
--- a/src/render/io/qabstractsceneparser.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef ABSTRACTSCENEPARSER_H
-#define ABSTRACTSCENEPARSER_H
-
-#include <QObject>
-#include <QStringList>
-#include <QLoggingCategory>
-#include <QUrl>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-class QEntity;
-}
-
-namespace Qt3DRender {
-
-Q_DECLARE_LOGGING_CATEGORY(SceneParsers)
-
-class QT3DRENDERSHARED_EXPORT QAbstractSceneParser : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(ParserStatus parserStatus READ parserStatus NOTIFY parserStatusChanged)
- Q_PROPERTY(QStringList errors READ errors NOTIFY errorsChanged)
-
-public:
- enum ParserStatus {
- Empty,
- Loading,
- Loaded,
- Error
- };
- Q_ENUM(ParserStatus)
-
- QAbstractSceneParser();
- virtual ~QAbstractSceneParser();
-
- virtual void setSource(const QUrl &source) = 0;
- virtual bool isExtensionSupported(const QUrl &source) const = 0;
- virtual Qt3DCore::QEntity *scene(const QString &id = QString()) = 0;
- virtual Qt3DCore::QEntity *node(const QString &id) = 0;
-
- ParserStatus parserStatus() const;
- QStringList errors() const;
-
-Q_SIGNALS:
- void parserStatusChanged(ParserStatus parserStatus);
- void errorsChanged(const QStringList &errors);
-
-protected:
- void setParserStatus(ParserStatus parserStatus);
- void logError(const QString &error);
- void logInfo(const QString &info);
-
-private:
- ParserStatus m_parserStatus;
- QStringList m_errors;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // ABSTRACTSCENEPARSER_H
diff --git a/src/render/io/qaxisalignedboundingbox.cpp b/src/render/io/qaxisalignedboundingbox.cpp
index 8e7aac191..937016c5c 100644
--- a/src/render/io/qaxisalignedboundingbox.cpp
+++ b/src/render/io/qaxisalignedboundingbox.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/io/qaxisalignedboundingbox_p.h b/src/render/io/qaxisalignedboundingbox_p.h
index e462b9ee4..c7a4d3767 100644
--- a/src/render/io/qaxisalignedboundingbox_p.h
+++ b/src/render/io/qaxisalignedboundingbox_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/io/qsceneiofactory.cpp b/src/render/io/qsceneiofactory.cpp
new file mode 100644
index 000000000..5044d3bd2
--- /dev/null
+++ b/src/render/io/qsceneiofactory.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsceneiofactory_p.h"
+#include "qsceneioplugin_p.h"
+#include "qsceneiohandler_p.h"
+
+#include <QtCore/private/qfactoryloader_p.h>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDir>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+#ifndef QT_NO_LIBRARY
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QSceneIOFactoryInterface_iid, QLatin1String("/sceneparsers"), Qt::CaseInsensitive))
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QSceneIOFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
+#endif
+
+QStringList QSceneIOFactory::keys(const QString &pluginPath)
+{
+#ifndef QT_NO_LIBRARY
+ QStringList list;
+ if (!pluginPath.isEmpty()) {
+ QCoreApplication::addLibraryPath(pluginPath);
+ list = directLoader()->keyMap().values();
+ if (!list.isEmpty()) {
+ const QString postFix = QLatin1String(" (from ")
+ + QDir::toNativeSeparators(pluginPath)
+ + QLatin1Char(')');
+ const QStringList::iterator end = list.end();
+ for (QStringList::iterator it = list.begin(); it != end; ++it)
+ (*it).append(postFix);
+ }
+ }
+ list.append(loader()->keyMap().values());
+ return list;
+#else
+ return QStringList();
+#endif
+}
+
+QSceneIOHandler *QSceneIOFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
+{
+#ifndef QT_NO_LIBRARY
+ if (!pluginPath.isEmpty()) {
+ QCoreApplication::addLibraryPath(pluginPath);
+ if (QSceneIOHandler *ret = qLoadPlugin<QSceneIOHandler, QSceneIOPlugin>(directLoader(), name, args))
+ return ret;
+ }
+ if (QSceneIOHandler *ret = qLoadPlugin<QSceneIOHandler, QSceneIOPlugin>(loader(), name, args))
+ return ret;
+#endif
+ return nullptr;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/io/qsceneiofactory_p.h b/src/render/io/qsceneiofactory_p.h
new file mode 100644
index 000000000..6ce4ceb08
--- /dev/null
+++ b/src/render/io/qsceneiofactory_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCENEIOFACTORY_H
+#define QSCENEIOFACTORY_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qt3drender_global_p.h>
+#include <QtCore/QStringList>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSceneIOHandler;
+
+class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneIOFactory
+{
+public:
+ static QStringList keys(const QString &pluginPath = QString());
+ static QSceneIOHandler *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QSCENEIOFACTORY_H
diff --git a/src/render/io/qsceneiohandler.cpp b/src/render/io/qsceneiohandler.cpp
new file mode 100644
index 000000000..fdcf5e44d
--- /dev/null
+++ b/src/render/io/qsceneiohandler.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsceneiohandler_p.h"
+#include <Qt3DRender/private/renderlogging_p.h>
+#include <QStringList>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QSceneIOHandler::QSceneIOHandler() : QObject(),
+ m_status(Empty)
+{
+}
+
+QSceneIOHandler::~QSceneIOHandler()
+{
+}
+
+QSceneIOHandler::ParserStatus QSceneIOHandler::status() const
+{
+ return m_status;
+}
+
+QStringList QSceneIOHandler::errors() const
+{
+ return m_errors;
+}
+
+void QSceneIOHandler::setStatus(ParserStatus status)
+{
+ if (status != m_status) {
+ m_status = status;
+ emit statusChanged(status);
+ }
+}
+
+void QSceneIOHandler::logError(const QString &error)
+{
+ m_errors.append(error);
+ emit errorsChanged(m_errors);
+}
+
+void QSceneIOHandler::logInfo(const QString &info)
+{
+ qCDebug(Render::Io) << info;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/io/qsceneiohandler_p.h b/src/render/io/qsceneiohandler_p.h
new file mode 100644
index 000000000..c6f65ea82
--- /dev/null
+++ b/src/render/io/qsceneiohandler_p.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSCENE_IOHANDLER_H
+#define QT3DRENDER_QSCENE_IOHANDLER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QStringList>
+#include <QLoggingCategory>
+#include <QUrl>
+#include <private/qt3drender_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QEntity;
+}
+
+namespace Qt3DRender {
+
+Q_DECLARE_LOGGING_CATEGORY(SceneParsers)
+
+class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneIOHandler : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(ParserStatus status READ status NOTIFY statusChanged)
+ Q_PROPERTY(QStringList errors READ errors NOTIFY errorsChanged)
+
+public:
+ enum ParserStatus {
+ Empty,
+ Loading,
+ Loaded,
+ Error
+ };
+ Q_ENUM(ParserStatus)
+
+ QSceneIOHandler();
+ virtual ~QSceneIOHandler();
+
+ virtual void setSource(const QUrl &source) = 0;
+ virtual bool isFileTypeSupported(const QUrl &source) const = 0;
+ virtual Qt3DCore::QEntity *scene(const QString &id = QString()) = 0;
+ virtual Qt3DCore::QEntity *node(const QString &id) = 0;
+
+ ParserStatus status() const;
+ QStringList errors() const;
+
+Q_SIGNALS:
+ void statusChanged(ParserStatus status);
+ void errorsChanged(const QStringList &errors);
+
+protected:
+ void setStatus(ParserStatus status);
+ void logError(const QString &error);
+ void logInfo(const QString &info);
+
+private:
+ ParserStatus m_status;
+ QStringList m_errors;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSCENE_IOHANDLER_H
diff --git a/src/render/io/qsceneioplugin.cpp b/src/render/io/qsceneioplugin.cpp
new file mode 100644
index 000000000..e8494ae09
--- /dev/null
+++ b/src/render/io/qsceneioplugin.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsceneioplugin_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QSceneIOPlugin::QSceneIOPlugin(QObject *parent) : QObject(parent)
+{
+
+}
+
+QSceneIOPlugin::~QSceneIOPlugin()
+{
+
+}
+
+QSceneIOHandler *QSceneIOPlugin::create(const QString &key, const QStringList &paramList)
+{
+ Q_UNUSED(key)
+ Q_UNUSED(paramList)
+ return nullptr;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
diff --git a/src/render/io/qsceneioplugin_p.h b/src/render/io/qsceneioplugin_p.h
new file mode 100644
index 000000000..4607f1330
--- /dev/null
+++ b/src/render/io/qsceneioplugin_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCENEIOPLUGIN_P_H
+#define QSCENEIOPLUGIN_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QObject>
+#include <QtCore/QtPlugin>
+#include <QtCore/QFactoryInterface>
+
+#include <Qt3DRender/private/qt3drender_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+#define QSceneIOFactoryInterface_iid "org.qt-project.Qt3DRender.QSceneIOFactoryInterface 5.6"
+
+class QSceneIOHandler;
+
+class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneIOPlugin : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QSceneIOPlugin(QObject *parent = nullptr);
+ ~QSceneIOPlugin();
+
+ virtual QSceneIOHandler *create(const QString &key, const QStringList &paramList);
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QSCENEIOPLUGIN_P_H
diff --git a/src/render/io/qsceneloader.cpp b/src/render/io/qsceneloader.cpp
index a2f739e13..5ae0a4343 100644
--- a/src/render/io/qsceneloader.cpp
+++ b/src/render/io/qsceneloader.cpp
@@ -1,43 +1,46 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qsceneloader.h"
-#include "qabstractsceneloader_p.h"
+#include "qsceneloader_p.h"
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/qentity.h>
#include <Qt3DRender/private/renderlogging_p.h>
#include <QThread>
@@ -48,45 +51,99 @@ using namespace Qt3DCore;
namespace Qt3DRender {
+QSceneLoaderPrivate::QSceneLoaderPrivate()
+ : QComponentPrivate()
+ , m_status(QSceneLoader::Loading)
+ , m_subTreeRoot(nullptr)
+{
+ m_shareable = false;
+}
+
+
QSceneLoader::QSceneLoader(QNode *parent)
- : QAbstractSceneLoader(parent)
+ : Qt3DCore::QComponent(*new QSceneLoaderPrivate, parent)
{
}
+/*! \internal */
QSceneLoader::~QSceneLoader()
{
- QNode::cleanup();
+}
+
+QSceneLoader::QSceneLoader(QSceneLoaderPrivate &dd, QNode *parent)
+ : Qt3DCore::QComponent(dd, parent)
+{
}
// Called in main thread
void QSceneLoader::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
- QAbstractSceneLoaderPrivate *d = static_cast<QAbstractSceneLoaderPrivate*>(QNodePrivate::get(this));
- QScenePropertyChangePtr e = qSharedPointerCast<QScenePropertyChange>(change);
- if (e->type() == NodeUpdated) {
+ Q_D(QSceneLoader);
+ QPropertyUpdatedChangePtr e = qSharedPointerCast<QPropertyUpdatedChange>(change);
+ if (e->type() == PropertyUpdated) {
if (e->propertyName() == QByteArrayLiteral("scene")) {
- // We receive a QNodePtr so that it is released automatically
- QNodePtr nodePtr = e->value().value<QNodePtr>();
- QEntity *scene = static_cast<QEntity *>(nodePtr.data());
- if (scene != Q_NULLPTR && d->m_scene != Q_NULLPTR) {
- QList<QNodeId> entities = d->m_scene->entitiesForComponent(d->m_id);
- if (entities.size() > 1) // TO DO: QComponent shareable property
- qCWarning(Render::Frontend) << "It is strongly discouraged to share SceneLoader component between entities";
- Q_FOREACH (const QNodeId &id, entities) {
- QEntity *parentEntity = qobject_cast<QEntity *>(d->m_scene->lookupNode(id));
- if (parentEntity != Q_NULLPTR) {
- QEntity *cloneScene = qobject_cast<QEntity *>(QNode::clone(scene));
- QNodePrivate::get(parentEntity)->insertTree(cloneScene);
- }
- }
+ // If we already have a scene sub tree, delete it
+ if (d->m_subTreeRoot) {
+ delete d->m_subTreeRoot;
+ d->m_subTreeRoot = nullptr;
}
+
+ // If we have successfully loaded a scene, graft it in
+ auto *subTreeRoot = e->value().value<Qt3DCore::QEntity *>();
+ if (subTreeRoot) {
+ // Get the entity to which this component is attached
+ const Qt3DCore::QNodeIdVector entities = d->m_scene->entitiesForComponent(d->m_id);
+ Q_ASSERT(entities.size() == 1);
+ Qt3DCore::QNodeId parentEntityId = entities.first();
+ QEntity *parentEntity = qobject_cast<QEntity *>(d->m_scene->lookupNode(parentEntityId));
+ subTreeRoot->setParent(parentEntity);
+ d->m_subTreeRoot = subTreeRoot;
+ }
+
+ // Update status property
+ setStatus(subTreeRoot ? QSceneLoader::Ready : QSceneLoader::Error);
}
- else if (e->propertyName() == QByteArrayLiteral("status")) {
- QAbstractSceneLoader::setStatus(static_cast<QAbstractSceneLoader::Status>(e->value().toInt()));
- }
}
}
+QUrl QSceneLoader::source() const
+{
+ Q_D(const QSceneLoader);
+ return d->m_source;
+}
+
+void QSceneLoader::setSource(const QUrl &arg)
+{
+ Q_D(QSceneLoader);
+ if (d->m_source != arg) {
+ d->m_source = arg;
+ emit sourceChanged(arg);
+ }
+}
+
+QSceneLoader::Status QSceneLoader::status() const
+{
+ Q_D(const QSceneLoader);
+ return d->m_status;
+}
+
+void QSceneLoader::setStatus(QSceneLoader::Status status)
+{
+ Q_D(QSceneLoader);
+ if (d->m_status != status) {
+ d->m_status = status;
+ emit statusChanged(status);
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QSceneLoader::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QSceneLoaderData>::create(this);
+ auto &data = creationChange->data;
+ data.source = d_func()->m_source;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/io/qsceneloader.h b/src/render/io/qsceneloader.h
index 851bcb8f6..2b39ebeb4 100644
--- a/src/render/io/qsceneloader.h
+++ b/src/render/io/qsceneloader.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,22 +40,52 @@
#ifndef QT3DRENDER_QSCENELOADER_H
#define QT3DRENDER_QSCENELOADER_H
-#include <Qt3DRender/qabstractsceneloader.h>
+#include <Qt3DCore/qcomponent.h>
+#include <Qt3DCore/qscenechange.h>
+#include <Qt3DRender/qt3drender_global.h>
+#include <QUrl>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QT3DRENDERSHARED_EXPORT QSceneLoader : public QAbstractSceneLoader
+class QSceneLoaderPrivate;
+
+class QT3DRENDERSHARED_EXPORT QSceneLoader : public Qt3DCore::QComponent
{
Q_OBJECT
+ Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
public:
- explicit QSceneLoader(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QSceneLoader(Qt3DCore::QNode *parent = nullptr);
~QSceneLoader();
+
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
+ enum Status {
+ None = 0,
+ Loading,
+ Ready,
+ Error
+ };
+ Q_ENUM(Status)
+
+ QUrl source() const;
+ Status status() const;
+
+public Q_SLOTS:
+ void setSource(const QUrl &arg);
+ void setStatus(Status status);
+
+Q_SIGNALS:
+ void sourceChanged(const QUrl &source);
+ void statusChanged(Status status);
protected:
- QT3D_CLONEABLE(QSceneLoader)
+ explicit QSceneLoader(QSceneLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QSceneLoader)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/io/qsceneloader_p.h b/src/render/io/qsceneloader_p.h
new file mode 100644
index 000000000..740e9dce8
--- /dev/null
+++ b/src/render/io/qsceneloader_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSCENELOADER_P_H
+#define QT3DRENDER_QSCENELOADER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qcomponent_p.h>
+#include <Qt3DRender/qsceneloader.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSceneIOHandler;
+
+class QSceneLoaderPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QSceneLoaderPrivate();
+
+ Q_DECLARE_PUBLIC(QSceneLoader)
+
+ QUrl m_source;
+ QSceneLoader::Status m_status;
+ Qt3DCore::QEntity *m_subTreeRoot;
+};
+
+struct QSceneLoaderData
+{
+ QUrl source;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSCENELOADER_P_H
diff --git a/src/render/io/qsceneparserfactory.cpp b/src/render/io/qsceneparserfactory.cpp
deleted file mode 100644
index 8fba44db9..000000000
--- a/src/render/io/qsceneparserfactory.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsceneparserfactory_p.h"
-#include "qsceneparserplugin.h"
-#include "qabstractsceneparser.h"
-
-#include <QtCore/private/qfactoryloader_p.h>
-#include <QtCore/QCoreApplication>
-#include <QtCore/QDir>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-#ifndef QT_NO_LIBRARY
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QSceneParserFactoryInterface_iid, QLatin1String("/sceneparsers"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, (QSceneParserFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
-#endif
-
-QStringList QSceneParserFactory::keys(const QString &pluginPath)
-{
-#ifndef QT_NO_LIBRARY
- QStringList list;
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- list = directLoader()->keyMap().values();
- if (!list.isEmpty()) {
- const QString postFix = QStringLiteral(" (from ")
- + QDir::toNativeSeparators(pluginPath)
- + QLatin1Char(')');
- const QStringList::iterator end = list.end();
- for (QStringList::iterator it = list.begin(); it != end; ++it)
- (*it).append(postFix);
- }
- }
- list.append(loader()->keyMap().values());
- return list;
-#else
- return QStringList();
-#endif
-}
-
-QAbstractSceneParser *QSceneParserFactory::create(const QString &name, const QStringList &args, const QString &pluginPath)
-{
-#ifndef QT_NO_LIBRARY
- if (!pluginPath.isEmpty()) {
- QCoreApplication::addLibraryPath(pluginPath);
- if (QAbstractSceneParser *ret = qLoadPlugin1<QAbstractSceneParser, QSceneParserPlugin>(directLoader(), name, args))
- return ret;
- }
- if (QAbstractSceneParser *ret = qLoadPlugin1<QAbstractSceneParser, QSceneParserPlugin>(loader(), name, args))
- return ret;
-#endif
- return Q_NULLPTR;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/io/qsceneparserfactory_p.h b/src/render/io/qsceneparserfactory_p.h
deleted file mode 100644
index b511b9169..000000000
--- a/src/render/io/qsceneparserfactory_p.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCENEPARSERFACTORY_H
-#define QSCENEPARSERFACTORY_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qt3drender_global_p.h>
-#include <QtCore/QStringList>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractSceneParser;
-
-class QT3DRENDERSHARED_PRIVATE_EXPORT QSceneParserFactory
-{
-public:
- static QStringList keys(const QString &pluginPath = QString());
- static QAbstractSceneParser *create(const QString &name, const QStringList &args, const QString &pluginPath = QString());
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QSCENEPARSERFACTORY_H
diff --git a/src/render/io/qsceneparserplugin.cpp b/src/render/io/qsceneparserplugin.cpp
deleted file mode 100644
index 5581162e0..000000000
--- a/src/render/io/qsceneparserplugin.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsceneparserplugin.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QSceneParserPlugin::QSceneParserPlugin(QObject *parent) : QObject(parent)
-{
-
-}
-
-QSceneParserPlugin::~QSceneParserPlugin()
-{
-
-}
-
-QAbstractSceneParser *QSceneParserPlugin::create(const QString &key, const QStringList &paramList)
-{
- Q_UNUSED(key)
- Q_UNUSED(paramList)
- return Q_NULLPTR;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
diff --git a/src/render/io/qsceneparserplugin.h b/src/render/io/qsceneparserplugin.h
deleted file mode 100644
index 5d1334b35..000000000
--- a/src/render/io/qsceneparserplugin.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSCENEPARSERPLUGIN_H
-#define QSCENEPARSERPLUGIN_H
-
-#include <QtCore/QObject>
-#include <QtCore/QtPlugin>
-#include <QtCore/QFactoryInterface>
-
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-#define QSceneParserFactoryInterface_iid "org.qt-project.Qt3DRender.QSceneParserFactoryInterface 5.6"
-
-class QAbstractSceneParser;
-
-class QT3DRENDERSHARED_EXPORT QSceneParserPlugin : public QObject
-{
- Q_OBJECT
-public:
- explicit QSceneParserPlugin(QObject *parent = Q_NULLPTR);
- ~QSceneParserPlugin();
-
- virtual QAbstractSceneParser *create(const QString &key, const QStringList &paramList);
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QSCENEPARSERPLUGIN_H
diff --git a/src/render/io/qurlhelper.cpp b/src/render/io/qurlhelper.cpp
index 5663689fe..f55a547fb 100644
--- a/src/render/io/qurlhelper.cpp
+++ b/src/render/io/qurlhelper.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/io/qurlhelper_p.h b/src/render/io/qurlhelper_p.h
index 9c4f21384..c9c4cfd9b 100644
--- a/src/render/io/qurlhelper_p.h
+++ b/src/render/io/qurlhelper_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/io/scene.cpp b/src/render/io/scene.cpp
index 8564f6c74..f7094e67c 100644
--- a/src/render/io/scene.cpp
+++ b/src/render/io/scene.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,12 +39,13 @@
#include "scene_p.h"
#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-#include <Qt3DRender/qabstractsceneloader.h>
+#include <Qt3DRender/qsceneloader.h>
+#include <Qt3DRender/private/qsceneloader_p.h>
#include <Qt3DRender/private/scenemanager_p.h>
+#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
@@ -51,26 +55,30 @@ namespace Qt3DRender {
namespace Render {
Scene::Scene()
- : QBackendNode(QBackendNode::ReadWrite)
- , m_sceneManager(Q_NULLPTR)
+ : BackendNode(QBackendNode::ReadWrite)
+ , m_sceneManager(nullptr)
{
}
-void Scene::updateFromPeer(Qt3DCore::QNode *peer)
+void Scene::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QAbstractSceneLoader *loader = static_cast<QAbstractSceneLoader *>(peer);
-
- m_source = loader->source();
- m_sceneManager->addSceneData(m_source, peerUuid());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QSceneLoaderData>>(change);
+ const auto &data = typedChange->data;
+ m_source = data.source;
+ Q_ASSERT(m_sceneManager);
+ m_sceneManager->addSceneData(m_source, peerId());
}
void Scene::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("source")) {
- m_source = propertyChange->value().toUrl();
- m_sceneManager->addSceneData(m_source, peerUuid());
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("source")) {
+ m_source = propertyChange->value().toUrl();
+ m_sceneManager->addSceneData(m_source, peerId());
+ }
}
+ markDirty(AbstractRenderer::AllDirty);
}
QUrl Scene::source() const
@@ -80,18 +88,16 @@ QUrl Scene::source() const
void Scene::setSceneSubtree(Qt3DCore::QEntity *subTree)
{
- QBackendScenePropertyChangePtr e(new QBackendScenePropertyChange(NodeUpdated, peerUuid()));
+ // Move scene sub tree to the application thread so that it can be grafted in.
+ const auto appThread = QCoreApplication::instance()->thread();
+ subTree->moveToThread(appThread);
+
+ // Send the new subtree to the frontend
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("scene");
- // The Frontend element has to perform the clone
- // So that the objects are created in the main thread
- e->setValue(QVariant::fromValue(QNodePtr(subTree, &QNodePrivate::nodePtrDeleter)));
- e->setTargetNode(peerUuid());
+ e->setValue(QVariant::fromValue(subTree));
notifyObservers(e);
- QBackendScenePropertyChangePtr e2(new QBackendScenePropertyChange(NodeUpdated, peerUuid()));
- e2->setPropertyName("status");
- e2->setValue(subTree != Q_NULLPTR ? QAbstractSceneLoader::Loaded : QAbstractSceneLoader::Error);
- e2->setTargetNode(peerUuid());
- notifyObservers(e2);
}
void Scene::setSceneManager(SceneManager *manager)
@@ -100,26 +106,26 @@ void Scene::setSceneManager(SceneManager *manager)
m_sceneManager = manager;
}
-RenderSceneFunctor::RenderSceneFunctor(SceneManager *sceneManager)
+RenderSceneFunctor::RenderSceneFunctor(AbstractRenderer *renderer, SceneManager *sceneManager)
: m_sceneManager(sceneManager)
+ , m_renderer(renderer)
{
}
-Qt3DCore::QBackendNode *RenderSceneFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *RenderSceneFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- Scene *scene = m_sceneManager->getOrCreateResource(frontend->id());
- scene->setFactory(factory);
+ Scene *scene = m_sceneManager->getOrCreateResource(change->subjectId());
scene->setSceneManager(m_sceneManager);
- scene->setPeer(frontend);
+ scene->setRenderer(m_renderer);
return scene;
}
-Qt3DCore::QBackendNode *RenderSceneFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *RenderSceneFunctor::get(Qt3DCore::QNodeId id) const
{
return m_sceneManager->lookupResource(id);
}
-void RenderSceneFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void RenderSceneFunctor::destroy(Qt3DCore::QNodeId id) const
{
m_sceneManager->releaseResource(id);
}
diff --git a/src/render/io/scene_p.h b/src/render/io/scene_p.h
index cd9e5d50e..f9513095b 100644
--- a/src/render/io/scene_p.h
+++ b/src/render/io/scene_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,8 +51,8 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
#include <QtGlobal>
-#include <Qt3DCore/qbackendnode.h>
#include <QUrl>
QT_BEGIN_NAMESPACE
@@ -63,34 +66,34 @@ namespace Render {
class SceneManager;
-class Scene : public Qt3DCore::QBackendNode
+class Scene : public BackendNode
{
public:
Scene();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
- // QObserverInterface interface
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
QUrl source() const;
void setSceneSubtree(Qt3DCore::QEntity *subTree);
void setSceneManager(SceneManager *manager);
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
SceneManager *m_sceneManager;
QUrl m_source;
};
-class RenderSceneFunctor : public Qt3DCore::QBackendNodeFunctor
+class RenderSceneFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit RenderSceneFunctor(SceneManager *sceneManager);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_OVERRIDE;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_OVERRIDE;
+ explicit RenderSceneFunctor(AbstractRenderer *renderer, SceneManager *sceneManager);
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_OVERRIDE;
private:
SceneManager *m_sceneManager;
+ AbstractRenderer *m_renderer;
};
} // namespace Render
diff --git a/src/render/io/scenemanager.cpp b/src/render/io/scenemanager.cpp
index c6eb285c7..b46616689 100644
--- a/src/render/io/scenemanager.cpp
+++ b/src/render/io/scenemanager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,7 +52,7 @@ SceneManager::SceneManager() : Qt3DCore::QResourceManager<Scene,
{
}
-void SceneManager::addSceneData(const QUrl &source, const Qt3DCore::QNodeId &sceneUuid)
+void SceneManager::addSceneData(const QUrl &source, Qt3DCore::QNodeId sceneUuid)
{
LoadSceneJobPtr newJob(new LoadSceneJob(source, sceneUuid));
@@ -68,18 +71,6 @@ QVector<LoadSceneJobPtr> SceneManager::pendingSceneLoaderJobs()
return copy;
}
-void SceneManager::addLoadedSceneTree(const QUrl &source, Qt3DCore::QEntity *tree)
-{
- SceneManager::Locker lock(this);
- m_loadedSceneTrees.insert(source, tree);
-}
-
-Qt3DCore::QEntity *SceneManager::sceneTreeFromSource(const QUrl &source)
-{
- SceneManager::Locker lock(this);
- return m_loadedSceneTrees.value(source);
-}
-
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/io/scenemanager_p.h b/src/render/io/scenemanager_p.h
index b6489da1d..35656730f 100644
--- a/src/render/io/scenemanager_p.h
+++ b/src/render/io/scenemanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -71,14 +74,10 @@ class SceneManager : public Qt3DCore::QResourceManager<Scene,
public:
SceneManager();
- void addSceneData(const QUrl &source, const Qt3DCore::QNodeId &sceneUuid);
+ void addSceneData(const QUrl &source, Qt3DCore::QNodeId sceneUuid);
QVector<LoadSceneJobPtr> pendingSceneLoaderJobs();
- void addLoadedSceneTree(const QUrl &source, Qt3DCore::QEntity *tree);
- Qt3DCore::QEntity *sceneTreeFromSource(const QUrl &source);
-
private:
- QHash<QUrl, Qt3DCore::QEntity *> m_loadedSceneTrees;
QVector<LoadSceneJobPtr> m_pendingJobs;
};
diff --git a/src/render/io/uniformbuffer.cpp b/src/render/io/uniformbuffer.cpp
deleted file mode 100644
index 881d557df..000000000
--- a/src/render/io/uniformbuffer.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "uniformbuffer_p.h"
-#include <private/graphicscontext_p.h>
-
-#if !defined(GL_UNIFORM_BUFFER)
-#define GL_UNIFORM_BUFFER 0x8A11
-#endif
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-// A UBO is created for each ShaderData Shader Pair
-// That means a UBO is unique to a shader/shaderdata
-
-UniformBuffer::UniformBuffer()
- : m_bufferId(~0)
- , m_isCreated(false)
- , m_bound(false)
-{
-}
-
-void UniformBuffer::bind(GraphicsContext *ctx)
-{
- ctx->openGLContext()->functions()->glBindBuffer(GL_UNIFORM_BUFFER, m_bufferId);
- m_bound = true;
-}
-
-void UniformBuffer::release(GraphicsContext *ctx)
-{
- m_bound = false;
- ctx->openGLContext()->functions()->glBindBuffer(GL_UNIFORM_BUFFER, 0);
-}
-
-void UniformBuffer::create(GraphicsContext *ctx)
-{
- ctx->openGLContext()->functions()->glGenBuffers(1, &m_bufferId);
- m_isCreated = true;
-}
-
-void UniformBuffer::destroy(GraphicsContext *ctx)
-{
- ctx->openGLContext()->functions()->glDeleteBuffers(1, &m_bufferId);
- m_isCreated = false;
-}
-
-void UniformBuffer::allocate(GraphicsContext *ctx, uint size, bool dynamic)
-{
- // Either GL_STATIC_DRAW OR GL_DYNAMIC_DRAW depending on the use case
- // TO DO: find a way to know how a buffer/QShaderData will be used to use the right usage
- ctx->openGLContext()->functions()->glBufferData(GL_UNIFORM_BUFFER, size, NULL, dynamic ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
-}
-
-void UniformBuffer::update(GraphicsContext *ctx, const void *data, uint size, int offset)
-{
- ctx->openGLContext()->functions()->glBufferSubData(GL_UNIFORM_BUFFER, offset, size, data);
-}
-
-void UniformBuffer::bindToUniformBlock(GraphicsContext *ctx, int bindingPoint)
-{
- ctx->bindBufferBase(GL_UNIFORM_BUFFER, bindingPoint, m_bufferId);
-}
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/io/uniformbuffer_p.h b/src/render/io/uniformbuffer_p.h
deleted file mode 100644
index e60d30054..000000000
--- a/src/render/io/uniformbuffer_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_UNIFORMBUFFER_P_H
-#define QT3DRENDER_RENDER_UNIFORMBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QOpenGLContext>
-#include <Qt3DCore/qnodeid.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-class GraphicsContext;
-
-typedef QPair<Qt3DCore::QNodeId, Qt3DCore::QNodeId> ShaderDataShaderUboKey;
-
-class UniformBuffer
-{
-public:
- UniformBuffer();
-
- void bind(GraphicsContext *ctx);
- void release(GraphicsContext *ctx);
- void create(GraphicsContext *ctx);
- void destroy(GraphicsContext *ctx);
- void allocate(GraphicsContext *ctx, uint size, bool dynamic = true);
- void update(GraphicsContext *ctx, const void *data, uint size, int offset = 0);
- void bindToUniformBlock(GraphicsContext *ctx, int bindingPoint);
-
- inline GLuint bufferId() const { return m_bufferId; }
- inline bool isCreated() const { return m_isCreated; }
- inline bool isBound() const { return m_bound; }
-
-private:
- GLuint m_bufferId;
- bool m_isCreated;
- bool m_bound;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_UNIFORMBUFFER_P_H
diff --git a/src/render/jobs/calcboundingvolumejob.cpp b/src/render/jobs/calcboundingvolumejob.cpp
index feeb7c422..5c57eb432 100644
--- a/src/render/jobs/calcboundingvolumejob.cpp
+++ b/src/render/jobs/calcboundingvolumejob.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,6 +53,7 @@
#include <QtCore/qmath.h>
#include <QtConcurrent/QtConcurrent>
+#include <Qt3DRender/private/job_common_p.h>
QT_BEGIN_NAMESPACE
@@ -83,7 +87,8 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
// Use the default position attribute if attribute is null
if (!pickVolumeAttribute) {
- Q_FOREACH (const Qt3DCore::QNodeId attrId, geom->attributes()) {
+ const auto attrIds = geom->attributes();
+ for (const Qt3DCore::QNodeId attrId : attrIds) {
pickVolumeAttribute = manager->lookupResource<Attribute, AttributeManager>(attrId);
if (pickVolumeAttribute &&
pickVolumeAttribute->name() == QAttribute::defaultPositionAttributeName())
@@ -93,10 +98,10 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
if (pickVolumeAttribute) {
if (!pickVolumeAttribute
- || pickVolumeAttribute->attributeType() != QAbstractAttribute::VertexAttribute
- || pickVolumeAttribute->dataType() != QAbstractAttribute::Float
- || pickVolumeAttribute->dataSize() < 3) {
- qWarning() << "QBoundingVolumeSpecifier pickVolume Attribute not suited for bounding volume computation";
+ || pickVolumeAttribute->attributeType() != QAttribute::VertexAttribute
+ || pickVolumeAttribute->vertexBaseType() != QAttribute::Float
+ || pickVolumeAttribute->vertexSize() < 3) {
+ qWarning() << "QGeometry::boundingVolumePositionAttribute pickVolume Attribute not suited for bounding volume computation";
return;
}
@@ -120,13 +125,15 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
const QByteArray buffer = buf->data();
const char *rawBuffer = buffer.constData();
rawBuffer += pickVolumeAttribute->byteOffset();
- const int stride = pickVolumeAttribute->byteStride() ? pickVolumeAttribute->byteStride() : sizeof(float) * pickVolumeAttribute->dataSize();
+ const int stride = pickVolumeAttribute->byteStride() ? pickVolumeAttribute->byteStride() : sizeof(float) * pickVolumeAttribute->vertexSize();
QVector<QVector3D> vertices(pickVolumeAttribute->count());
+ // TODO avoid copying the vertices
for (int c = 0, vC = vertices.size(); c < vC; ++c) {
QVector3D v;
const float *fptr = reinterpret_cast<const float*>(rawBuffer);
- for (uint i = 0, m = qMin(pickVolumeAttribute->dataSize(), 3U); i < m; ++i)
+ // TODO unwrap loop (switch?)
+ for (uint i = 0, m = qMin(pickVolumeAttribute->vertexSize(), 3U); i < m; ++i)
v[i] = fptr[i];
vertices[c] = v;
rawBuffer += stride;
@@ -145,7 +152,8 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
functor.manager = manager;
QtConcurrent::blockingMap(children, functor);
} else {
- Q_FOREACH (Entity *child, node->children())
+ const auto children = node->children();
+ for (Entity *child : children)
calculateLocalBoundingVolume(manager, child);
}
}
@@ -154,8 +162,9 @@ void calculateLocalBoundingVolume(NodeManagers *manager, Entity *node)
CalculateBoundingVolumeJob::CalculateBoundingVolumeJob(NodeManagers *manager)
: m_manager(manager),
- m_node(Q_NULLPTR)
+ m_node(nullptr)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::CalcBoundingVolume, 0);
}
void CalculateBoundingVolumeJob::run()
diff --git a/src/render/jobs/calcboundingvolumejob_p.h b/src/render/jobs/calcboundingvolumejob_p.h
index 03adc1569..9a51bf5cf 100644
--- a/src/render/jobs/calcboundingvolumejob_p.h
+++ b/src/render/jobs/calcboundingvolumejob_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/jobs/calcgeometrytrianglevolumes.cpp b/src/render/jobs/calcgeometrytrianglevolumes.cpp
index 77b3c362a..d2b12e09c 100644
--- a/src/render/jobs/calcgeometrytrianglevolumes.cpp
+++ b/src/render/jobs/calcgeometrytrianglevolumes.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,6 +41,7 @@
#include <Qt3DRender/private/trianglesextractor_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/geometryrenderermanager_p.h>
+#include <Qt3DRender/private/job_common_p.h>
QT_BEGIN_NAMESPACE
@@ -49,12 +53,13 @@ CalcGeometryTriangleVolumes::CalcGeometryTriangleVolumes(const Qt3DCore::QNodeId
, m_geometryRendererId(geometryRendererId)
, m_manager(manager)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::CalcTriangleVolume, 0);
}
void CalcGeometryTriangleVolumes::run()
{
GeometryRenderer *renderer = m_manager->geometryRendererManager()->lookupResource(m_geometryRendererId);
- if (renderer != Q_NULLPTR) {
+ if (renderer != nullptr) {
TrianglesExtractor extractor(renderer, m_manager);
renderer->setTriangleVolumes(extractor.extract(m_geometryRendererId));
}
diff --git a/src/render/jobs/calcgeometrytrianglevolumes_p.h b/src/render/jobs/calcgeometrytrianglevolumes_p.h
index 9db7db11c..96c9854d9 100644
--- a/src/render/jobs/calcgeometrytrianglevolumes_p.h
+++ b/src/render/jobs/calcgeometrytrianglevolumes_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/jobs/framecleanupjob.cpp b/src/render/jobs/framecleanupjob.cpp
index f4a7756bc..7022660c4 100644
--- a/src/render/jobs/framecleanupjob.cpp
+++ b/src/render/jobs/framecleanupjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,6 +45,7 @@
#include <private/managers_p.h>
#include <private/texturedatamanager_p.h>
#include <private/sphere_p.h>
+#include <Qt3DRender/private/job_common_p.h>
QT_BEGIN_NAMESPACE
@@ -50,8 +54,9 @@ namespace Render {
FrameCleanupJob::FrameCleanupJob(NodeManagers *managers)
: m_managers(managers)
- , m_root(Q_NULLPTR)
+ , m_root(nullptr)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::FrameCleanup, 0);
}
FrameCleanupJob::~FrameCleanupJob()
@@ -78,6 +83,7 @@ void FrameCleanupJob::run()
void FrameCleanupJob::updateBoundingVolumesDebug(Entity *node)
{
+#if 0
BoundingVolumeDebug *debugBV = node->renderComponent<BoundingVolumeDebug>();
if (debugBV) {
Qt3DRender::Render::Sphere s;
@@ -89,8 +95,10 @@ void FrameCleanupJob::updateBoundingVolumesDebug(Entity *node)
debugBV->setRadius(s.radius());
debugBV->setCenter(s.center());
}
+#endif
- Q_FOREACH (Entity *c, node->children())
+ const auto children = node->children();
+ for (Entity *c : children)
updateBoundingVolumesDebug(c);
}
diff --git a/src/render/jobs/framecleanupjob_p.h b/src/render/jobs/framecleanupjob_p.h
index d21718fd5..d1a4d19f3 100644
--- a/src/render/jobs/framecleanupjob_p.h
+++ b/src/render/jobs/framecleanupjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/jobs/framepreparationjob.cpp b/src/render/jobs/framepreparationjob.cpp
index 87eba1b3c..90fa7eb13 100644
--- a/src/render/jobs/framepreparationjob.cpp
+++ b/src/render/jobs/framepreparationjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,6 +51,7 @@
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/buffermanager_p.h>
#include <Qt3DRender/private/geometryrenderermanager_p.h>
+#include <Qt3DRender/private/job_common_p.h>
QT_BEGIN_NAMESPACE
@@ -55,9 +59,10 @@ namespace Qt3DRender {
namespace Render {
FramePreparationJob::FramePreparationJob(NodeManagers *manager)
- : m_root(Q_NULLPTR)
+ : m_root(nullptr)
, m_manager(manager)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::FramePreparation, 0);
}
FramePreparationJob::~FramePreparationJob()
@@ -77,31 +82,28 @@ void FramePreparationJob::run()
void FramePreparationJob::parseNodeTree(Entity *node)
{
// Update transform properties in ShaderDatas and Lights
- QList<ShaderData *> shaderDatas = node->renderComponents<ShaderData>();
- Q_FOREACH (ShaderData *r, shaderDatas)
+ const QList<ShaderData *> shaderDatas = node->renderComponents<ShaderData>();
+ for (ShaderData *r : shaderDatas)
r->updateWorldTransform(*node->worldTransform());
- QList<Light *> lights = node->renderComponents<Light>();
- Q_FOREACH (Light *light, lights)
- light->updateWorldTransform(*node->worldTransform());
-
// Look if for the GeometryRender/Geometry the attributes and or buffers are dirty
// in which case we need to recompute the triangle list
GeometryRenderer *geomRenderer = node->renderComponent<GeometryRenderer>();
const Qt3DCore::QNodeId geomRendererId = node->componentUuid<GeometryRenderer>();
- Geometry *geom = Q_NULLPTR;
+ Geometry *geom = nullptr;
if (geomRenderer &&
- (geom = m_manager->lookupResource<Geometry, GeometryManager>(geomRenderer->geometryId())) != Q_NULLPTR) {
+ (geom = m_manager->lookupResource<Geometry, GeometryManager>(geomRenderer->geometryId())) != nullptr) {
if (!m_manager->geometryRendererManager()->isGeometryRendererScheduledForTriangleDataRefresh(geomRendererId)) {
// Check if the attributes or buffers are dirty
bool dirty = geomRenderer->isDirty();
- Attribute *attr = Q_NULLPTR;
- Q_FOREACH (const Qt3DCore::QNodeId attrId, geom->attributes()) {
- if ((attr = m_manager->attributeManager()->lookupResource(attrId)) != Q_NULLPTR) {
+ Attribute *attr = nullptr;
+ const auto attrIds = geom->attributes();
+ for (const Qt3DCore::QNodeId attrId : attrIds) {
+ if ((attr = m_manager->attributeManager()->lookupResource(attrId)) != nullptr) {
dirty |= attr->isDirty();
if (!dirty) {
- Buffer *buffer = Q_NULLPTR;
- if ((buffer = m_manager->bufferManager()->lookupResource(attr->bufferId())) != Q_NULLPTR)
+ Buffer *buffer = nullptr;
+ if ((buffer = m_manager->bufferManager()->lookupResource(attr->bufferId())) != nullptr)
dirty = buffer->isDirty();
}
if (dirty)
@@ -114,7 +116,7 @@ void FramePreparationJob::parseNodeTree(Entity *node)
}
const QVector<Entity *> children = node->children();
- Q_FOREACH (Entity *c, children)
+ for (Entity *c : children)
parseNodeTree(c);
}
diff --git a/src/render/jobs/framepreparationjob_p.h b/src/render/jobs/framepreparationjob_p.h
index 133a1e8d3..e9eab6a52 100644
--- a/src/render/jobs/framepreparationjob_p.h
+++ b/src/render/jobs/framepreparationjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/jobs/job_common_p.h b/src/render/jobs/job_common_p.h
new file mode 100644
index 000000000..d7e555d43
--- /dev/null
+++ b/src/render/jobs/job_common_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_JOB_COMMON_P_H
+#define QT3DRENDER_RENDER_JOB_COMMON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qaspectjob_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace Render {
+
+namespace JobTypes {
+
+ enum JobType {
+ LoadBuffer = 0,
+ FrameCleanup,
+ FramePreparation,
+ CalcBoundingVolume,
+ CalcTriangleVolume,
+ LoadGeometry,
+ LoadScene,
+ LoadTextureData,
+ PickBoundingVolume,
+ RenderView,
+ UpdateTransform,
+ UpdateBoundingVolume,
+ FrameSubmission
+ };
+
+} // JobTypes
+
+} // Render
+
+} // Qt3DRender
+
+#ifdef QT3D_JOBS_RUN_STATS
+
+#include <Qt3DCore/private/qaspectjob_p.h>
+
+#define SET_JOB_RUN_STAT_TYPE(job, type, instance) \
+ Qt3DCore::QAspectJobPrivate::get(job)->m_stats.jobId.typeAndInstance[0] = type; \
+ Qt3DCore::QAspectJobPrivate::get(job)->m_stats.jobId.typeAndInstance[1] = instance;
+
+#else
+
+#define SET_JOB_RUN_STAT_TYPE(job, type, instance)
+
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_JOB_COMMON_P_H
diff --git a/src/render/jobs/jobs.pri b/src/render/jobs/jobs.pri
index f79cd64e3..d449cab1b 100644
--- a/src/render/jobs/jobs.pri
+++ b/src/render/jobs/jobs.pri
@@ -13,7 +13,8 @@ HEADERS += \
$$PWD/loadgeometryjob_p.h \
$$PWD/calcboundingvolumejob_p.h \
$$PWD/pickboundingvolumejob_p.h \
- $$PWD/calcgeometrytrianglevolumes_p.h
+ $$PWD/calcgeometrytrianglevolumes_p.h \
+ $$PWD/job_common_p.h
SOURCES += \
$$PWD/updateworldtransformjob.cpp \
diff --git a/src/render/jobs/loadbufferjob.cpp b/src/render/jobs/loadbufferjob.cpp
index 06e91a9c2..49f271df5 100644
--- a/src/render/jobs/loadbufferjob.cpp
+++ b/src/render/jobs/loadbufferjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,6 +41,7 @@
#include <Qt3DRender/private/buffer_p.h>
#include <Qt3DRender/private/buffermanager_p.h>
#include <Qt3DRender/private/renderer_p.h>
+#include <Qt3DRender/private/job_common_p.h>
QT_BEGIN_NAMESPACE
@@ -49,8 +53,9 @@ namespace Render {
LoadBufferJob::LoadBufferJob(const HBuffer &handle)
: QAspectJob()
, m_handle(handle)
- , m_nodeManagers(Q_NULLPTR)
+ , m_nodeManagers(nullptr)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadBuffer, 0);
}
LoadBufferJob::~LoadBufferJob()
diff --git a/src/render/jobs/loadbufferjob_p.h b/src/render/jobs/loadbufferjob_p.h
index 34ee5f552..c7b744310 100644
--- a/src/render/jobs/loadbufferjob_p.h
+++ b/src/render/jobs/loadbufferjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/jobs/loadgeometryjob.cpp b/src/render/jobs/loadgeometryjob.cpp
index 2a11b08e0..106ccbd86 100644
--- a/src/render/jobs/loadgeometryjob.cpp
+++ b/src/render/jobs/loadgeometryjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,6 +40,7 @@
#include "loadgeometryjob_p.h"
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/geometryrenderermanager_p.h>
+#include <Qt3DRender/private/job_common_p.h>
QT_BEGIN_NAMESPACE
@@ -48,6 +52,7 @@ LoadGeometryJob::LoadGeometryJob(const HGeometryRenderer &handle)
: QAspectJob()
, m_handle(handle)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadGeometry, 0);
}
LoadGeometryJob::~LoadGeometryJob()
@@ -57,7 +62,7 @@ LoadGeometryJob::~LoadGeometryJob()
void LoadGeometryJob::run()
{
GeometryRenderer *geometryRenderer = m_nodeManagers->geometryRendererManager()->data(m_handle);
- if (geometryRenderer != Q_NULLPTR)
+ if (geometryRenderer != nullptr)
geometryRenderer->executeFunctor();
}
diff --git a/src/render/jobs/loadgeometryjob_p.h b/src/render/jobs/loadgeometryjob_p.h
index f94ae7284..bc9358ad8 100644
--- a/src/render/jobs/loadgeometryjob_p.h
+++ b/src/render/jobs/loadgeometryjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/jobs/loadscenejob.cpp b/src/render/jobs/loadscenejob.cpp
index cb39f70df..ac697f1db 100644
--- a/src/render/jobs/loadscenejob.cpp
+++ b/src/render/jobs/loadscenejob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,36 +42,42 @@
#include <private/nodemanagers_p.h>
#include <private/scenemanager_p.h>
#include <Qt3DCore/qentity.h>
-#include <Qt3DRender/qabstractsceneparser.h>
+#include <Qt3DRender/private/job_common_p.h>
+#include <Qt3DRender/private/qsceneiohandler_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-LoadSceneJob::LoadSceneJob(const QUrl &source, const Qt3DCore::QNodeId &m_sceneComponent)
+LoadSceneJob::LoadSceneJob(const QUrl &source, Qt3DCore::QNodeId m_sceneComponent)
: QAspectJob()
, m_source(source)
, m_sceneComponent(m_sceneComponent)
- , m_managers(Q_NULLPTR)
+ , m_managers(nullptr)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadScene, 0);
}
void LoadSceneJob::run()
{
- Qt3DCore::QEntity *sceneTree = m_managers->sceneManager()->sceneTreeFromSource(m_source);
- if (sceneTree == Q_NULLPTR) {
- Q_FOREACH (QAbstractSceneParser *parser, m_parsers) {
- if (parser->isExtensionSupported(m_source)) {
- parser->setSource(m_source);
- sceneTree = parser->scene();
- m_managers->sceneManager()->addLoadedSceneTree(m_source, sceneTree);
- }
- }
+ // Iterate scene IO handlers until we find one that can handle this file type
+ Qt3DCore::QEntity *sceneSubTree = nullptr;
+ for (QSceneIOHandler *sceneIOHandler : qAsConst(m_sceneIOHandlers)) {
+ if (!sceneIOHandler->isFileTypeSupported(m_source))
+ continue;
+
+ // File type is supported
+ sceneIOHandler->setSource(m_source);
+ sceneSubTree = sceneIOHandler->scene();
+ break;
}
- // set clone of sceneTree in sceneComponent
+
+ // Set clone of sceneTree in sceneComponent. This will move the sceneSubTree
+ // to the QCoreApplication thread which is where the frontend object tree lives.
Scene *scene = m_managers->sceneManager()->lookupResource(m_sceneComponent);
- scene->setSceneSubtree(sceneTree);
+ if (scene && sceneSubTree)
+ scene->setSceneSubtree(sceneSubTree);
}
} // namespace Render
diff --git a/src/render/jobs/loadscenejob_p.h b/src/render/jobs/loadscenejob_p.h
index a716e8092..bc122d705 100644
--- a/src/render/jobs/loadscenejob_p.h
+++ b/src/render/jobs/loadscenejob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,7 +60,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAbstractSceneParser;
+class QSceneIOHandler;
namespace Render {
@@ -66,9 +69,9 @@ class NodeManagers;
class LoadSceneJob : public Qt3DCore::QAspectJob
{
public:
- explicit LoadSceneJob(const QUrl &source, const Qt3DCore::QNodeId &sceneComponent);
+ explicit LoadSceneJob(const QUrl &source, Qt3DCore::QNodeId sceneComponent);
void setNodeManagers(NodeManagers *managers) { m_managers = managers; }
- void setSceneParsers(const QList<QAbstractSceneParser *> sceneParsers) { m_parsers = sceneParsers; }
+ void setSceneIOHandlers(const QList<QSceneIOHandler *> sceneIOHandlers) { m_sceneIOHandlers = sceneIOHandlers; }
protected:
void run() Q_DECL_OVERRIDE;
@@ -77,7 +80,7 @@ private:
QUrl m_source;
Qt3DCore::QNodeId m_sceneComponent;
NodeManagers *m_managers;
- QList<QAbstractSceneParser *> m_parsers;
+ QList<QSceneIOHandler *> m_sceneIOHandlers;
};
typedef QSharedPointer<LoadSceneJob> LoadSceneJobPtr;
diff --git a/src/render/jobs/loadtexturedatajob.cpp b/src/render/jobs/loadtexturedatajob.cpp
index 5f4a9801b..2d61bfded 100644
--- a/src/render/jobs/loadtexturedatajob.cpp
+++ b/src/render/jobs/loadtexturedatajob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,72 +41,116 @@
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/texturedatamanager_p.h>
-#include <Qt3DRender/qtexturedata.h>
+#include <Qt3DRender/private/qtextureimage_p.h>
+#include <Qt3DRender/qtextureimagedata.h>
#include <QThread>
+#include <Qt3DRender/private/job_common_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-LoadTextureDataJob::LoadTextureDataJob(const Qt3DCore::QNodeId &textureId)
+LoadTextureDataJob::LoadTextureDataJob(Qt3DCore::QNodeId textureId)
: m_textureId(textureId)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::LoadTextureData, 0);
}
LoadTextureDataJob::~LoadTextureDataJob()
{
}
+static QPair<HTextureData, QTextureImageData *> textureDataFromGenerator(TextureDataManager *textureDataManager,
+ QTextureImageDataGeneratorPtr generator)
+{
+ HTextureData textureDataHandle;
+ QTextureImageData *data = nullptr;
+
+ QMutexLocker locker(textureDataManager->mutex());
+ // We don't want to take the chance of having two jobs uploading the same functor
+ // because of sync issues
+
+ textureDataHandle = textureDataManager->textureDataFromFunctor(generator);
+
+ // Texture data handle isn't null == there's already a matching TextureData
+ if (!textureDataHandle.isNull()) {
+ data = textureDataManager->data(textureDataHandle);
+ } else {
+ QTextureImageDataPtr dataPtr = generator->operator ()();
+ if (dataPtr.isNull()) {
+ qCDebug(Jobs) << Q_FUNC_INFO << "Texture has no raw data";
+ } else {
+ // Save the QTextureImageDataPtr with it's functor as a key
+ textureDataHandle = textureDataManager->acquire();
+ data = textureDataManager->data(textureDataHandle);
+ *data = *(dataPtr.data());
+ textureDataManager->addTextureDataForFunctor(textureDataHandle, generator);
+ }
+ }
+
+ return qMakePair(textureDataHandle, data);
+}
+
void LoadTextureDataJob::run()
{
qCDebug(Jobs) << "Entering" << Q_FUNC_INFO << QThread::currentThread();
Texture *txt = m_manager->textureManager()->lookupResource(m_textureId);
- TextureDataManager *textureDataManager = m_manager->manager<QTexImageData, TextureDataManager>();
+ TextureDataManager *textureDataManager = m_manager->manager<QTextureImageData, TextureDataManager>();
+
+ if (txt != nullptr) {
+ if (txt->dataGenerator()) {
+ QTextureImageDataGeneratorPtr generator = txt->dataGenerator();
+
+ QPair<HTextureData, QTextureImageData *> handleData = textureDataFromGenerator(textureDataManager, generator);
+
+ HTextureData textureDataHandle = handleData.first;
+ QTextureImageData *data = handleData.second;
+ if (!data)
+ return;
+
+ if (txt->target() == QAbstractTexture::TargetAutomatic)
+ txt->setTarget(static_cast<QAbstractTexture::Target>(data->target()));
+
+ if (!txt->isAutoMipMapGenerationEnabled())
+ txt->setMipLevels(data->mipLevels());
+
+ txt->setSize(data->width(), data->height(), data->depth());
+ txt->setLayers(data->layers());
+ txt->setFormat(static_cast<QAbstractTexture::TextureFormat>(data->format()));
+ txt->setTextureDataHandle(textureDataHandle);
+ }
- if (txt != Q_NULLPTR) {
// Load update each TextureImage
- Q_FOREACH (HTextureImage texImgHandle, txt->textureImages()) {
+ const auto texImgHandles = txt->textureImages();
+ for (HTextureImage texImgHandle : texImgHandles) {
TextureImage *texImg = m_manager->textureImageManager()->data(texImgHandle);
- if (texImg != Q_NULLPTR && texImg->isDirty() && !texImg->dataFunctor().isNull()) {
- QTextureDataFunctorPtr functor = texImg->dataFunctor();
- HTextureData textureDataHandle;
- QTexImageData *data = Q_NULLPTR;
-
- // scoped for locker
- {
- QMutexLocker locker(textureDataManager->mutex());
- // We don't want to take the chance of having two jobs uploading the same functor
- // because of sync issues
- textureDataHandle = textureDataManager->textureDataFromFunctor(functor);
-
- // Texture data handle isn't null == there's already a matching TextureData
- if (!textureDataHandle.isNull()) {
- data = textureDataManager->data(textureDataHandle);
- } else {
- QTexImageDataPtr dataPtr = functor->operator ()();
- if (dataPtr.isNull()) {
- qCDebug(Jobs) << Q_FUNC_INFO << "Texture has no raw data";
- } else {
- // Save the QTexImageDataPtr with it's functor as a key
- textureDataHandle = textureDataManager->acquire();
- data = textureDataManager->data(textureDataHandle);
- *data = *(dataPtr.data());
- textureDataManager->addTextureDataForFunctor(textureDataHandle, functor);
- }
- }
+ if (texImg != nullptr && texImg->isDirty() && !texImg->dataGenerator().isNull()) {
+ QTextureImageDataGeneratorPtr generator = texImg->dataGenerator();
- // Update HTextureImage Functor to release TextureData when needed
- textureDataManager->assignFunctorToTextureImage(functor, texImgHandle);
- }
+ QPair<HTextureData, QTextureImageData *> handleData = textureDataFromGenerator(textureDataManager, generator);
+
+ // If using QTextureImage, notify the frontend of the change in status
+ const QImageTextureDataFunctor *imageGenerator = functor_cast<QImageTextureDataFunctor>(generator.data());
+ if (imageGenerator)
+ texImg->setStatus(imageGenerator->status());
+
+ HTextureData textureDataHandle = handleData.first;
+ QTextureImageData *data = handleData.second;
+
+ // XXX released textureDataManager mutex, do we have a race here?
+
+ // Update HTextureImage Functor to release TextureData when needed
+ TextureDataManager *textureDataManager = m_manager->manager<QTextureImageData, TextureDataManager>();
+ textureDataManager->assignFunctorToTextureImage(generator, texImgHandle);
// Set texture size of texture if the first layer / level / face has a valid size
// otherwise assume the size was set on the texture itself
- if (texImg->layer() == 0 && texImg->mipmapLevel() == 0 &&
- texImg->face() == QAbstractTextureProvider::CubeMapPositiveX) {
+ if (texImg->layer() == 0 && texImg->mipLevel() == 0 &&
+ texImg->face() == QAbstractTexture::CubeMapPositiveX) {
- if (data == Q_NULLPTR) {
+ if (data == nullptr) {
qWarning() << "Texture data is null, texture data failed to load";
} else {
// Set the size of the texture based on the layer 0 / level 0
@@ -113,8 +160,8 @@ void LoadTextureDataJob::run()
txt->setSize(data->width(), data->height(), data->depth());
}
// Set the format of the texture if the texture format is set to Automatic
- if (txt->format() == QAbstractTextureProvider::Automatic) {
- txt->setFormat(static_cast<QAbstractTextureProvider::TextureFormat>(data->format()));
+ if (txt->format() == QAbstractTexture::Automatic) {
+ txt->setFormat(static_cast<QAbstractTexture::TextureFormat>(data->format()));
}
}
}
diff --git a/src/render/jobs/loadtexturedatajob_p.h b/src/render/jobs/loadtexturedatajob_p.h
index 0c1061390..2f2851239 100644
--- a/src/render/jobs/loadtexturedatajob_p.h
+++ b/src/render/jobs/loadtexturedatajob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -63,7 +66,7 @@ class NodeManagers;
class LoadTextureDataJob : public Qt3DCore::QAspectJob
{
public:
- LoadTextureDataJob(const Qt3DCore::QNodeId &textureId);
+ LoadTextureDataJob(Qt3DCore::QNodeId textureId);
~LoadTextureDataJob();
inline void setNodeManagers(NodeManagers *manager) { m_manager = manager; }
diff --git a/src/render/jobs/pickboundingvolumejob.cpp b/src/render/jobs/pickboundingvolumejob.cpp
index 9f4af60ed..b095fd4d4 100644
--- a/src/render/jobs/pickboundingvolumejob.cpp
+++ b/src/render/jobs/pickboundingvolumejob.cpp
@@ -1,40 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "pickboundingvolumejob_p.h"
+#include "qpickevent.h"
+#include "qpicktriangleevent.h"
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/framegraphnode_p.h>
@@ -46,13 +51,17 @@
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/geometryrenderer_p.h>
-#include <Qt3DRender/private/trianglesextractor_p.h>
+#include <Qt3DRender/private/trianglesvisitor_p.h>
#include <Qt3DRender/private/triangleboundingvolume_p.h>
#include <Qt3DRender/private/qraycastingservice_p.h>
+#include <Qt3DRender/private/rendersurfaceselector_p.h>
+#include <Qt3DRender/private/rendersettings_p.h>
+#include <Qt3DRender/private/rendersurfaceselector_p.h>
+#include <Qt3DRender/private/qray3d_p.h>
#include <Qt3DRender/qgeometryrenderer.h>
#include <Qt3DCore/private/qservicelocator_p.h>
-#include <Qt3DCore/qray3d.h>
#include <QSurface>
+#include <Qt3DRender/private/job_common_p.h>
QT_BEGIN_NAMESPACE
@@ -60,40 +69,46 @@ namespace Qt3DRender {
namespace Render {
-namespace {
-
-struct ViewportCameraPair
+struct ViewportCameraAreaTriplet
{
Qt3DCore::QNodeId cameraId;
QRectF viewport;
+ QSize area;
};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ViewportCameraAreaTriplet, Q_PRIMITIVE_TYPE)
-class ViewportCameraGatherer
+namespace {
+
+class ViewportCameraAreaGatherer
{
private:
QVector<FrameGraphNode *> m_leaves;
void visit(FrameGraphNode *node)
{
- Q_FOREACH (Render::FrameGraphNode *n, node->children())
+ const auto children = node->children();
+ for (Render::FrameGraphNode *n : children)
visit(n);
- if (node->childrenHandles().empty())
+ if (node->childrenIds().empty())
m_leaves.push_back(node);
}
- ViewportCameraPair gatherUpViewportCameras(Render::FrameGraphNode *node) const
+ ViewportCameraAreaTriplet gatherUpViewportCameraAreas(Render::FrameGraphNode *node) const
{
- ViewportCameraPair vc;
- vc.viewport = QRectF(0.0f, 0.0f, 1.0f, 1.0f);
+ ViewportCameraAreaTriplet vca;
+ vca.viewport = QRectF(0.0f, 0.0f, 1.0f, 1.0f);
while (node) {
if (node->isEnabled()) {
switch (node->nodeType()) {
case FrameGraphNode::CameraSelector:
- vc.cameraId = static_cast<const CameraSelector *>(node)->cameraUuid();
+ vca.cameraId = static_cast<const CameraSelector *>(node)->cameraUuid();
break;
case FrameGraphNode::Viewport:
- vc.viewport = computeViewport(vc.viewport, static_cast<const ViewportNode *>(node));
+ vca.viewport = computeViewport(vca.viewport, static_cast<const ViewportNode *>(node));
+ break;
+ case FrameGraphNode::Surface:
+ vca.area = static_cast<const RenderSurfaceSelector *>(node)->renderTargetSize();
break;
default:
break;
@@ -101,119 +116,218 @@ private:
}
node = node->parent();
}
- return vc;
+ return vca;
}
public:
- QVector<ViewportCameraPair> gather(FrameGraphNode *root)
+ QVector<ViewportCameraAreaTriplet> gather(FrameGraphNode *root)
{
// Retrieve all leaves
visit(root);
- QVector<ViewportCameraPair> vcPairs;
- vcPairs.reserve(m_leaves.count());
+ QVector<ViewportCameraAreaTriplet> vcaTriplets;
+ vcaTriplets.reserve(m_leaves.count());
// Find all viewport/camera pairs by traversing from leaf to root
- Q_FOREACH (Render::FrameGraphNode *leaf, m_leaves) {
- ViewportCameraPair vcPair = gatherUpViewportCameras(leaf);
- if (!vcPair.cameraId.isNull())
- vcPairs.push_back(vcPair);
+ for (Render::FrameGraphNode *leaf : qAsConst(m_leaves)) {
+ ViewportCameraAreaTriplet vcaTriplet = gatherUpViewportCameraAreas(leaf);
+ if (!vcaTriplet.cameraId.isNull())
+ vcaTriplets.push_back(vcaTriplet);
}
- return vcPairs;
+ return vcaTriplets;
}
};
-QVector<QBoundingVolume *> gatherBoundingVolumes(Entity *entity)
+static QVector<Entity *> gatherEntities(Entity *entity, QVector<Entity *> entities)
{
- QVector<QBoundingVolume *> volumes;
-
- if (entity != Q_NULLPTR) {
- volumes.push_back(entity->worldBoundingVolume());
+ if (entity != nullptr) {
+ entities.push_back(entity);
// Traverse children
- Q_FOREACH (Entity *child, entity->children())
- volumes += gatherBoundingVolumes(child);
+ const auto children = entity->children();
+ for (Entity *child : children)
+ entities = gatherEntities(child, std::move(entities));
}
- return volumes;
+ return entities;
}
-class SphereBoundingVolumesGatherer : public QBoundingVolumeProvider
+class EntityGatherer
{
public:
- explicit SphereBoundingVolumesGatherer(Entity *root)
- : QBoundingVolumeProvider()
- , m_root(root)
+ explicit EntityGatherer(Entity *root)
+ : m_root(root)
, m_needsRefresh(true)
{
}
- QVector<QBoundingVolume *> boundingVolumes() const Q_DECL_FINAL
+ QVector<Entity *> entities() const
{
if (m_needsRefresh) {
- m_volumes = gatherBoundingVolumes(m_root);
+ m_entities.clear();
+ m_entities = gatherEntities(m_root, std::move(m_entities));
m_needsRefresh = false;
}
- return m_volumes;
+ return m_entities;
}
private:
Entity *m_root;
- mutable QVector<QBoundingVolume *> m_volumes;
+ mutable QVector<Entity *> m_entities;
mutable bool m_needsRefresh;
};
-
-class TriangleVolumeGatherer : public QBoundingVolumeProvider
+class CollisionVisitor : public TrianglesVisitor
{
public:
- explicit TriangleVolumeGatherer(Entity *root, NodeManagers *manager)
- : QBoundingVolumeProvider()
- , m_root(root)
- , m_manager(manager)
+ typedef QVector<QCollisionQueryResult::Hit> HitList;
+ HitList hits;
+
+ CollisionVisitor(NodeManagers* manager, const Entity *root, const QRay3D& ray) : TrianglesVisitor(manager), m_root(root), m_ray(ray), m_triangleIndex(0) { }
+private:
+ const Entity *m_root;
+ QRay3D m_ray;
+ Qt3DRender::QRayCastingService rayCasting;
+ uint m_triangleIndex;
+
+ void visit(uint andx, const QVector3D &a,
+ uint bndx, const QVector3D &b,
+ uint cndx, const QVector3D &c)
{
- m_volumes = buildTriangleBoundingVolumes();
+ TriangleBoundingVolume volume(m_root->peerId(), a, b, c);
+ volume = volume.transform(*m_root->worldTransform());
+
+ QCollisionQueryResult::Hit queryResult = rayCasting.query(m_ray, &volume);
+ if (queryResult.m_distance > 0.) {
+ queryResult.m_triangleIndex = m_triangleIndex;
+ queryResult.m_vertexIndex[0] = andx;
+ queryResult.m_vertexIndex[1] = bndx;
+ queryResult.m_vertexIndex[2] = cndx;
+ hits.push_back(queryResult);
+ }
+
+ m_triangleIndex++;
}
+};
+
+struct AbstractCollisionGathererFunctor
+{
+ AbstractCollisionGathererFunctor() : m_renderer(0) { }
+ virtual ~AbstractCollisionGathererFunctor() { }
+
+ Renderer *m_renderer;
+ QRay3D m_ray;
- ~TriangleVolumeGatherer()
+ typedef CollisionVisitor::HitList result_type;
+
+ result_type operator ()(const Entity *entity) const
{
- qDeleteAll(m_volumes);
+ result_type result;
+
+ HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+
+ // If the Entity which actually received the hit doesn't have
+ // an object picker component, we need to check the parent if it has one ...
+ while (objectPickerHandle.isNull() && entity != nullptr) {
+ entity = entity->parent();
+ if (entity != nullptr)
+ objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+ }
+
+ ObjectPicker *objectPicker = m_renderer->nodeManagers()->objectPickerManager()->data(objectPickerHandle);
+ if (objectPicker == nullptr)
+ return result_type(); // don't bother picking entities that don't have an object picker
+
+ Qt3DRender::QRayCastingService rayCasting;
+
+ return pick(&rayCasting, entity);
}
- QVector<QBoundingVolume *> boundingVolumes() const Q_DECL_FINAL
+ virtual result_type pick(QAbstractCollisionQueryService *rayCasting, const Entity *entity) const = 0;
+};
+
+struct EntityCollisionGathererFunctor : public AbstractCollisionGathererFunctor
+{
+ result_type pick(QAbstractCollisionQueryService *rayCasting, const Entity *entity) const Q_DECL_OVERRIDE
{
- return m_volumes;
+ result_type result;
+
+ const QCollisionQueryResult::Hit queryResult = rayCasting->query(m_ray, entity->worldBoundingVolume());
+ if (queryResult.m_distance >= 0.f)
+ result.push_back(queryResult);
+
+ return result;
}
+};
-private:
- QVector<QBoundingVolume *> buildTriangleBoundingVolumes()
+struct TriangleCollisionGathererFunctor : public AbstractCollisionGathererFunctor
+{
+ result_type pick(QAbstractCollisionQueryService *rayCasting, const Entity *entity) const Q_DECL_OVERRIDE
{
- QVector<QBoundingVolume *> volumes;
- if (m_root) {
- GeometryRenderer *gRenderer = m_root->renderComponent<GeometryRenderer>();
- if (gRenderer) {
- const QVector<QBoundingVolume *> localVolumes = gRenderer->triangleData();
- volumes.reserve(localVolumes.size());
- Q_FOREACH (const QBoundingVolume *v, localVolumes) {
- TriangleBoundingVolume *worldVolume = new TriangleBoundingVolume();
- *worldVolume = static_cast<const TriangleBoundingVolume *>(v)->transformed(*m_root->worldTransform());
- volumes.push_back(worldVolume);
+ result_type result;
+
+ GeometryRenderer *gRenderer = entity->renderComponent<GeometryRenderer>();
+ if (!gRenderer)
+ return result;
+
+ if (rayHitsEntity(rayCasting, entity)) {
+ CollisionVisitor visitor(m_renderer->nodeManagers(), entity, m_ray);
+ visitor.apply(gRenderer, entity->peerId());
+ result = visitor.hits;
+
+ struct
+ {
+ bool operator()(const result_type::value_type &a, const result_type::value_type &b)
+ {
+ return a.m_distance < b.m_distance;
}
- }
+ } compareHitsDistance;
+ std::sort(result.begin(), result.end(), compareHitsDistance);
}
- return volumes;
+
+ return result;
}
- Entity *m_root;
- NodeManagers *m_manager;
- QVector<QBoundingVolume *> m_volumes;
+ bool rayHitsEntity(QAbstractCollisionQueryService *rayCasting, const Entity *entity) const
+ {
+ const QCollisionQueryResult::Hit queryResult = rayCasting->query(m_ray, entity->worldBoundingVolume());
+ return queryResult.m_distance >= 0.f;
+ }
};
+CollisionVisitor::HitList reduceToFirstHit(CollisionVisitor::HitList &result, const CollisionVisitor::HitList &intermediate)
+{
+ if (!intermediate.empty()) {
+ if (result.empty())
+ result.push_back(intermediate.front());
+ float closest = result.front().m_distance;
+ for (const auto &v : intermediate) {
+ if (v.m_distance < closest) {
+ result.push_front(v);
+ closest = v.m_distance;
+ }
+ }
+
+ while (result.size() > 1)
+ result.pop_back();
+ }
+ return result;
+}
+
+// Unordered
+CollisionVisitor::HitList reduceToAllHits(CollisionVisitor::HitList &results, const CollisionVisitor::HitList &intermediate)
+{
+ if (!intermediate.empty())
+ results << intermediate;
+ return results;
+}
+
} // anonymous
PickBoundingVolumeJob::PickBoundingVolumeJob(Renderer *renderer)
: m_renderer(renderer)
, m_manager(renderer->nodeManagers())
- , m_node(Q_NULLPTR)
+ , m_node(nullptr)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::PickBoundingVolume, 0);
}
void PickBoundingVolumeJob::setRoot(Entity *root)
@@ -221,245 +335,214 @@ void PickBoundingVolumeJob::setRoot(Entity *root)
m_node = root;
}
-Qt3DCore::QRay3D PickBoundingVolumeJob::intersectionRay(const QPoint &pos, const QMatrix4x4 &viewMatrix, const QMatrix4x4 &projectionMatrix, const QRect &viewport)
+QRay3D PickBoundingVolumeJob::intersectionRay(const QPoint &pos, const QMatrix4x4 &viewMatrix, const QMatrix4x4 &projectionMatrix, const QRect &viewport)
{
QVector3D nearPos = QVector3D(pos.x(), pos.y(), 0.0f);
nearPos = nearPos.unproject(viewMatrix, projectionMatrix, viewport);
QVector3D farPos = QVector3D(pos.x(), pos.y(), 1.0f);
farPos = farPos.unproject(viewMatrix, projectionMatrix, viewport);
- return Qt3DCore::QRay3D(nearPos,
- (farPos - nearPos).normalized(),
- (farPos - nearPos).length());
+ return QRay3D(nearPos,
+ (farPos - nearPos).normalized(),
+ (farPos - nearPos).length());
}
void PickBoundingVolumeJob::run()
{
- m_mouseEvents = m_renderer->pendingPickingEvents();
- if (m_mouseEvents.empty())
+ const auto mouseEvents = m_renderer->pendingPickingEvents();
+ if (mouseEvents.empty())
return;
- Qt3DCore::QServiceLocator *services = m_renderer->services();
- QAbstractCollisionQueryService *rayCasting = services->service<QAbstractCollisionQueryService>
- (Qt3DCore::QServiceLocator::CollisionService);
-
- if (rayCasting == Q_NULLPTR) {
- Qt3DRender::QRayCastingService *rayCastingService = new QRayCastingService();
- services->registerServiceProvider(Qt3DCore::QServiceLocator::CollisionService, rayCastingService);
- rayCasting = rayCastingService;
- }
+ ViewportCameraAreaGatherer vcaGatherer;
+ const QVector<ViewportCameraAreaTriplet> vcaTriplets = vcaGatherer.gather(m_renderer->frameGraphRoot());
+
+ EntityGatherer entitiesGatherer(m_node);
+
+ if (!vcaTriplets.empty()) {
+ for (const QMouseEvent &event : mouseEvents) {
+ m_hoveredPickersToClear = m_hoveredPickers;
+ ObjectPicker *lastCurrentPicker = m_manager->objectPickerManager()->data(m_currentPicker);
+
+ for (const ViewportCameraAreaTriplet &vca : vcaTriplets) {
+ typedef AbstractCollisionGathererFunctor::result_type HitList;
+ HitList sphereHits;
+ QRay3D ray = rayForViewportAndCamera(vca.area, event.pos(), vca.viewport, vca.cameraId);
+ auto reducerOp = m_renderer->settings() && m_renderer->settings()->pickResultMode() == QPickingSettings::AllPicks ? reduceToAllHits : reduceToFirstHit;
+ if (m_renderer->settings() && m_renderer->settings()->pickMethod() == QPickingSettings::TrianglePicking) {
+ TriangleCollisionGathererFunctor gathererFunctor;
+ gathererFunctor.m_renderer = m_renderer;
+ gathererFunctor.m_ray = ray;
+ sphereHits = QtConcurrent::blockingMappedReduced<HitList>(entitiesGatherer.entities(), gathererFunctor, reducerOp);
+ } else {
+ EntityCollisionGathererFunctor gathererFunctor;
+ gathererFunctor.m_renderer = m_renderer;
+ gathererFunctor.m_ray = ray;
+ sphereHits = QtConcurrent::blockingMappedReduced<HitList>(entitiesGatherer.entities(), gathererFunctor, reducerOp);
+ }
- if (rayCasting != Q_NULLPTR) {
- ViewportCameraGatherer vcGatherer;
- const QVector<ViewportCameraPair> vcPairs = vcGatherer.gather(m_renderer->frameGraphRoot());
-
- SphereBoundingVolumesGatherer sphereGatherer(m_node);
-
- if (!vcPairs.empty()) {
- Q_FOREACH (const QMouseEvent &event, m_mouseEvents) {
- m_hoveredPickersToClear = m_hoveredPickers;
- ObjectPicker *lastCurrentPicker = m_manager->objectPickerManager()->data(m_currentPicker);
- Q_FOREACH (const ViewportCameraPair &vc, vcPairs) {
- QVector<Qt3DCore::QNodeId> sphereHits = sphereHitsForViewportAndCamera(event.pos(),
- vc.viewport,
- vc.cameraId,
- rayCasting,
- &sphereGatherer);
-#if 0
- Q_FOREACH (const Qt3DCore::QNodeId sphereEntityId, sphereHits) {
- if (triangleHitsForViewportAndCamera(event.pos(),
- vc.viewport,
- vc.cameraId,
- sphereEntityId,
- rayCasting).isEmpty())
- sphereHits.removeAll(sphereEntityId);
- }
-#endif
+ // If we have hits
+ if (!sphereHits.isEmpty()) {
+ // Note: how can we control that we want the first/last/all elements along the ray to be picked
- // If we have hits
- if (!sphereHits.isEmpty()) {
- // Note: how can we control that we want the first/last/all elements along the ray to be picked
+ // How do we differentiate betwnee an Entity with no GeometryRenderer and one with one, both having
+ // an ObjectPicker component when it comes
- // How do we differentiate betwnee an Entity with no GeometryRenderer and one with one, both having
- // an ObjectPicker component when it comes
+ // We want to gather hits against triangles
+ // build a triangle based bounding volume
- // We want to gather hits against triangles
- // build a triangle based bounding volume
+ for (const QCollisionQueryResult::Hit &hit : qAsConst(sphereHits)) {
+ Entity *entity = m_manager->renderNodesManager()->lookupResource(hit.m_entityId);
+ HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
- Q_FOREACH (const Qt3DCore::QNodeId &entityId, sphereHits) {
- Entity *entity = m_manager->renderNodesManager()->lookupResource(entityId);
- HObjectPicker objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+ // If the Entity which actually received the hit doesn't have
+ // an object picker component, we need to check the parent if it has one ...
+ while (objectPickerHandle.isNull() && entity != nullptr) {
+ entity = entity->parent();
+ if (entity != nullptr)
+ objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+ }
- // If the Entity which actually received the hit doesn't have
- // an object picker component, we need to check the parent if it has one ...
- while (objectPickerHandle.isNull() && entity != Q_NULLPTR) {
- entity = entity->parent();
- if (entity != Q_NULLPTR)
- objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+ ObjectPicker *objectPicker = m_manager->objectPickerManager()->data(objectPickerHandle);
+
+ if (objectPicker != nullptr) {
+ // Send the corresponding event
+ QVector3D localIntersection = hit.m_intersection;
+ if (entity && entity->worldTransform())
+ localIntersection = hit.m_intersection * entity->worldTransform()->inverted();
+ QPickEventPtr pickEvent;
+ if (m_renderer->settings() && m_renderer->settings()->pickMethod() == QPickingSettings::TrianglePicking) {
+ pickEvent.reset(new QPickTriangleEvent(event.localPos(), hit.m_intersection, localIntersection, hit.m_distance,
+ hit.m_triangleIndex, hit.m_vertexIndex[0], hit.m_vertexIndex[1], hit.m_vertexIndex[2]));
+ } else {
+ pickEvent.reset(new QPickEvent(event.localPos(), hit.m_intersection, localIntersection, hit.m_distance));
}
- ObjectPicker *objectPicker = m_manager->objectPickerManager()->data(objectPickerHandle);
+ switch (event.type()) {
+ case QEvent::MouseButtonPress: {
+ // Store pressed object handle
+ m_currentPicker = objectPickerHandle;
+ // Send pressed event to m_currentPicker
+ objectPicker->onPressed(pickEvent);
+ break;
+ }
- if (objectPicker != Q_NULLPTR) {
- // Send the corresponding event
- switch (event.type()) {
- case QEvent::MouseButtonPress: {
- // Store pressed object handle
- m_currentPicker = objectPickerHandle;
- // Send pressed event to m_currentPicker
- objectPicker->onPressed();
+ case QEvent::MouseButtonRelease: {
+ // Send release event to m_currentPicker
+ if (lastCurrentPicker != nullptr) {
+ m_currentPicker = HObjectPicker();
+ lastCurrentPicker->onClicked(pickEvent);
+ lastCurrentPicker->onReleased(pickEvent);
}
- break;
+ break;
+ }
- case QEvent::MouseButtonRelease: {
- // Send release event to m_currentPicker
- if (lastCurrentPicker != Q_NULLPTR) {
- lastCurrentPicker->onClicked();
- lastCurrentPicker->onReleased();
- }
- break;
- }
+ case Qt::TapGesture: {
+ objectPicker->onClicked(pickEvent);
+ break;
+ }
- case Qt::TapGesture: {
- objectPicker->onClicked();
- break;
+ case QEvent::MouseMove: {
+ if (objectPicker->isPressed() && objectPicker->isDragEnabled()) {
+ objectPicker->onMoved(pickEvent);
}
-
- case QEvent::HoverMove:
- case QEvent::MouseMove: {
- if (!m_hoveredPickers.contains(objectPickerHandle)) {
- if (objectPicker->hoverEnabled()) {
- // Send entered event to objectPicker
- objectPicker->onEntered();
- // and save it in the hoveredPickers
- m_hoveredPickers.push_back(objectPickerHandle);
- }
+ // fallthrough
+ }
+ case QEvent::HoverMove: {
+ if (!m_hoveredPickers.contains(objectPickerHandle)) {
+ if (objectPicker->isHoverEnabled()) {
+ // Send entered event to objectPicker
+ objectPicker->onEntered();
+ // and save it in the hoveredPickers
+ m_hoveredPickers.push_back(objectPickerHandle);
}
- break;
}
+ break;
+ }
- default:
- break;
- }
+ default:
+ break;
}
+ }
- // The ObjectPicker was hit -> it is still being hovered
- m_hoveredPickersToClear.removeAll(objectPickerHandle);
+ // The ObjectPicker was hit -> it is still being hovered
+ m_hoveredPickersToClear.removeAll(objectPickerHandle);
- lastCurrentPicker = m_manager->objectPickerManager()->data(m_currentPicker);
- }
+ lastCurrentPicker = m_manager->objectPickerManager()->data(m_currentPicker);
+ }
- // Otherwise no hits
- } else {
- switch (event.type()) {
- case QEvent::MouseButtonRelease: {
- // Send release event to m_currentPicker
- if (lastCurrentPicker != Q_NULLPTR)
- lastCurrentPicker->onReleased();
- break;
- }
- default:
- break;
+ // Otherwise no hits
+ } else {
+ switch (event.type()) {
+ case QEvent::MouseButtonRelease: {
+ // Send release event to m_currentPicker
+ if (lastCurrentPicker != nullptr) {
+ m_currentPicker = HObjectPicker();
+ QPickEventPtr pickEvent(new QPickEvent);
+ lastCurrentPicker->onReleased(pickEvent);
}
+ break;
+ }
+ default:
+ break;
}
}
}
-
- // Clear Hovered elements that needs to be cleared
- // Send exit event to object pickers on which we
- // had set the hovered flag for a previous frame
- // and that aren't being hovered any longer
- clearPreviouslyHoveredPickers();
-
}
- }
- // Clear mouse events so that they aren't processed again for the next frame
- m_mouseEvents.clear();
+ // Clear Hovered elements that needs to be cleared
+ // Send exit event to object pickers on which we
+ // had set the hovered flag for a previous frame
+ // and that aren't being hovered any longer
+ clearPreviouslyHoveredPickers();
+ }
}
-void PickBoundingVolumeJob::viewMatrixForCamera(const Qt3DCore::QNodeId &cameraId,
+void PickBoundingVolumeJob::viewMatrixForCamera(Qt3DCore::QNodeId cameraId,
QMatrix4x4 &viewMatrix,
QMatrix4x4 &projectionMatrix) const
{
- Render::CameraLens *lens = Q_NULLPTR;
+ Render::CameraLens *lens = nullptr;
Entity *camNode = m_manager->renderNodesManager()->lookupResource(cameraId);
- if (camNode != Q_NULLPTR &&
- (lens = camNode->renderComponent<CameraLens>()) != Q_NULLPTR &&
+ if (camNode != nullptr &&
+ (lens = camNode->renderComponent<CameraLens>()) != nullptr &&
lens->isEnabled()) {
viewMatrix = *camNode->worldTransform();
projectionMatrix = lens->projection();
}
}
-QRect PickBoundingVolumeJob::windowViewport(const QRectF &relativeViewport) const
+QRect PickBoundingVolumeJob::windowViewport(const QSize &area, const QRectF &relativeViewport) const
{
- // TO DO: find another way to retrieve the size since this won't work with Scene3D
- const QSurface *s = m_renderer->surface();
- if (s) {
- const int surfaceWidth = s->size().width();
- const int surfaceHeight = s->size().height();
- return QRect(relativeViewport.x() * surfaceWidth,
- (1.0 - relativeViewport.y() - relativeViewport.height()) * surfaceHeight,
- relativeViewport.width() * surfaceWidth,
- relativeViewport.height() * surfaceHeight);
+ if (area.isValid()) {
+ const int areaWidth = area.width();
+ const int areaHeight = area.height();
+ return QRect(relativeViewport.x() * areaWidth,
+ (1.0 - relativeViewport.y() - relativeViewport.height()) * areaHeight,
+ relativeViewport.width() * areaWidth,
+ relativeViewport.height() * areaHeight);
}
return relativeViewport.toRect();
}
-
-QVector<Qt3DCore::QNodeId> PickBoundingVolumeJob::sphereHitsForViewportAndCamera(const QPoint &pos,
- const QRectF &relativeViewport,
- const Qt3DCore::QNodeId &cameraId,
- QAbstractCollisionQueryService *rayCasting,
- QBoundingVolumeProvider *volumeProvider) const
+QRay3D PickBoundingVolumeJob::rayForViewportAndCamera(const QSize &area,
+ const QPoint &pos,
+ const QRectF &relativeViewport,
+ Qt3DCore::QNodeId cameraId) const
{
QMatrix4x4 viewMatrix;
QMatrix4x4 projectionMatrix;
viewMatrixForCamera(cameraId, viewMatrix, projectionMatrix);
- const QRect viewport = windowViewport(relativeViewport);
+ const QRect viewport = windowViewport(area, relativeViewport);
- const QSurface *s = m_renderer->surface();
- // TO DO: find another way to retrieve the size since this won't work with Scene3D
// In GL the y is inverted compared to Qt
- const QPoint glCorrectPos = s ? QPoint(pos.x(), s->size().height() - pos.y()) : pos;
- const Qt3DCore::QRay3D ray = intersectionRay(glCorrectPos, viewMatrix, projectionMatrix, viewport);
- const QQueryHandle rayCastingHandle = rayCasting->query(ray, QAbstractCollisionQueryService::AllHits, volumeProvider);
- const QCollisionQueryResult queryResult = rayCasting->fetchResult(rayCastingHandle);
- return queryResult.entitiesHit();
-}
-
-QVector<Qt3DCore::QNodeId> PickBoundingVolumeJob::triangleHitsForViewportAndCamera(const QPoint &pos,
- const QRectF &relativeViewport,
- const Qt3DCore::QNodeId &cameraId,
- const Qt3DCore::QNodeId &entityId,
- QAbstractCollisionQueryService *rayCasting) const
-{
- QMatrix4x4 viewMatrix;
- QMatrix4x4 projectionMatrix;
- viewMatrixForCamera(cameraId, viewMatrix, projectionMatrix);
- const QRect viewport = windowViewport(relativeViewport);
-
- const QSurface *s = m_renderer->surface();
- // TO DO: find another way to retrieve the size since this won't work with Scene3D
- // In GL the y is inverted compared to Qt
- const QPoint glCorrectPos = s ? QPoint(pos.x(), s->size().height() - pos.y()) : pos;
- const Qt3DCore::QRay3D ray = intersectionRay(glCorrectPos, viewMatrix, projectionMatrix, viewport);
-
- // Note: improve this further to only compute this once and not every time
- TriangleVolumeGatherer boundingVolumeProvider(m_manager->lookupResource<Entity, EntityManager>(entityId),
- m_manager);
-
- const QQueryHandle rayCastingHandle = rayCasting->query(ray,
- QAbstractCollisionQueryService::AllHits,
- &boundingVolumeProvider);
- const QCollisionQueryResult queryResult = rayCasting->fetchResult(rayCastingHandle);
- return queryResult.entitiesHit();
+ const QPoint glCorrectPos = QPoint(pos.x(), area.isValid() ? area.height() - pos.y() : pos.y());
+ const QRay3D ray = intersectionRay(glCorrectPos, viewMatrix, projectionMatrix, viewport);
+ return ray;
}
void PickBoundingVolumeJob::clearPreviouslyHoveredPickers()
{
- Q_FOREACH (const HObjectPicker &pickHandle, m_hoveredPickersToClear) {
+ for (const HObjectPicker pickHandle : qAsConst(m_hoveredPickersToClear)) {
ObjectPicker *pick = m_manager->objectPickerManager()->data(pickHandle);
if (pick)
pick->onExited();
@@ -473,4 +556,3 @@ void PickBoundingVolumeJob::clearPreviouslyHoveredPickers()
} // namespace Qt3DRender
QT_END_NAMESPACE
-
diff --git a/src/render/jobs/pickboundingvolumejob_p.h b/src/render/jobs/pickboundingvolumejob_p.h
index 11a7a1596..9071b44c7 100644
--- a/src/render/jobs/pickboundingvolumejob_p.h
+++ b/src/render/jobs/pickboundingvolumejob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,11 +52,12 @@
//
#include <Qt3DCore/qaspectjob.h>
-#include <Qt3DRender/private/qboundingvolumeprovider_p.h>
+#include <Qt3DRender/private/qray3d_p.h>
#include <Qt3DRender/private/handle_types_p.h>
-#include <Qt3DCore/qray3d.h>
-#include <QSharedPointer>
+#include <Qt3DRender/private/qboundingvolumeprovider_p.h>
+#include <Qt3DRender/private/qcollisionqueryresult_p.h>
#include <QMouseEvent>
+#include <QSharedPointer>
QT_BEGIN_NAMESPACE
@@ -78,10 +82,10 @@ public:
void setRoot(Entity *root);
- static Qt3DCore::QRay3D intersectionRay(const QPoint &pos,
- const QMatrix4x4 &viewMatrix,
- const QMatrix4x4 &projectionMatrix,
- const QRect &viewport);
+ static QRay3D intersectionRay(const QPoint &pos,
+ const QMatrix4x4 &viewMatrix,
+ const QMatrix4x4 &projectionMatrix,
+ const QRect &viewport);
protected:
void run() Q_DECL_FINAL;
@@ -89,22 +93,15 @@ private:
Renderer *m_renderer;
NodeManagers *m_manager;
Entity *m_node;
- QList<QMouseEvent> m_mouseEvents;
- void viewMatrixForCamera(const Qt3DCore::QNodeId &cameraId,
+ void viewMatrixForCamera(Qt3DCore::QNodeId cameraId,
QMatrix4x4 &viewMatrix,
QMatrix4x4 &projectionMatrix) const;
- QRect windowViewport(const QRectF &relativeViewport) const;
- QVector<Qt3DCore::QNodeId> sphereHitsForViewportAndCamera(const QPoint &pos,
- const QRectF &relativeViewport,
- const Qt3DCore::QNodeId &cameraId,
- Qt3DRender::QAbstractCollisionQueryService *rayCasting,
- Qt3DRender::QBoundingVolumeProvider *volumeProvider) const;
- QVector<Qt3DCore::QNodeId> triangleHitsForViewportAndCamera(const QPoint &pos,
- const QRectF &relativeViewport,
- const Qt3DCore::QNodeId &cameraId,
- const Qt3DCore::QNodeId &entityId,
- Qt3DRender::QAbstractCollisionQueryService *rayCasting) const;
+ QRect windowViewport(const QSize &area, const QRectF &relativeViewport) const;
+ QRay3D rayForViewportAndCamera(const QSize &area,
+ const QPoint &pos,
+ const QRectF &relativeViewport,
+ Qt3DCore::QNodeId cameraId) const;
void clearPreviouslyHoveredPickers();
HObjectPicker m_currentPicker;
QVector<HObjectPicker> m_hoveredPickers;
diff --git a/src/render/jobs/renderviewjob.cpp b/src/render/jobs/renderviewjob.cpp
index 8482c672b..3f5784c12 100644
--- a/src/render/jobs/renderviewjob.cpp
+++ b/src/render/jobs/renderviewjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,15 +43,44 @@
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/renderviewjobutils_p.h>
#include <Qt3DRender/private/renderlogging_p.h>
+#include <Qt3DRender/private/job_common_p.h>
+
+#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
+namespace {
+// only accessed in ctor and dtor of RenderViewJob
+// which are always being called in a non concurrent manner
+int renderViewInstanceCounter = 0;
+} // anonymous
+
+RenderViewJob::RenderViewJob()
+ : m_renderer(0)
+ , m_devicePixelRatio(1.)
+ , m_fgLeaf(0)
+ , m_index(0)
+{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::RenderView, renderViewInstanceCounter++);
+}
+
+RenderViewJob::~RenderViewJob()
+{
+ renderViewInstanceCounter--;
+}
+
void RenderViewJob::run()
{
qCDebug(Jobs) << Q_FUNC_INFO << m_index;
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ QElapsedTimer timer;
+ timer.start();
+ qint64 gatherLightsTime;
+ qint64 buildCommandsTime;
+#endif
// Create a RenderView object
// The RenderView are created from a QFrameAllocator stored in the current Thread local storage
@@ -60,9 +92,14 @@ void RenderViewJob::run()
renderView->setAllocator(currentFrameAllocator);
renderView->setRenderer(m_renderer);
renderView->setSurfaceSize(m_surfaceSize);
+ renderView->setDevicePixelRatio(m_devicePixelRatio);
// Populate the renderview's configuration from the framegraph
setRenderViewConfigFromFrameGraphLeafNode(renderView, m_fgLeaf);
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ qint64 gatherStateTime = timer.nsecsElapsed();
+ timer.restart();
+#endif
// Build RenderCommand should perform the culling as we have no way to determine
// if a child has a mesh in the view frustum while its parent isn't contained in it.
@@ -79,11 +116,36 @@ void RenderViewJob::run()
};
renderView->gatherLights(m_renderer->sceneRoot());
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ gatherLightsTime = timer.nsecsElapsed();
+ timer.restart();
+#endif
+
renderView->buildRenderCommands(m_renderer->sceneRoot(), planes);
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ buildCommandsTime = timer.nsecsElapsed();
+ timer.restart();
+#endif
}
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ qint64 creationTime = timer.nsecsElapsed();
+ timer.restart();
+#endif
+
// Sorts RenderCommand
renderView->sort();
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ qint64 sortTime = timer.nsecsElapsed();
+#endif
+
+#if defined(QT3D_RENDER_VIEW_JOB_TIMINGS)
+ qDebug() << m_index
+ << "state:" << gatherStateTime / 1.0e6
+ << "lights:" << gatherLightsTime / 1.0e6
+ << "build commands:" << buildCommandsTime / 1.0e6
+ << "sort:" << sortTime / 1.0e6;
+#endif
// Enqueue our fully populated RenderView with the RenderThread
m_renderer->enqueueRenderView(renderView, m_index);
diff --git a/src/render/jobs/renderviewjob_p.h b/src/render/jobs/renderviewjob_p.h
index e26cce700..e7b23137d 100644
--- a/src/render/jobs/renderviewjob_p.h
+++ b/src/render/jobs/renderviewjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,14 +68,12 @@ class FrameGraphNode;
class Q_AUTOTEST_EXPORT RenderViewJob : public Qt3DCore::QAspectJob
{
public:
- RenderViewJob()
- : m_renderer(0)
- , m_fgLeaf(0)
- , m_index(0)
- {}
+ RenderViewJob();
+ ~RenderViewJob();
inline void setRenderer(Renderer *renderer) { m_renderer = renderer; }
inline void setSurfaceSize(const QSize &size) { m_surfaceSize = size; }
+ inline void setDevicePixelRatio(qreal r) { m_devicePixelRatio = r; }
inline void setFrameGraphLeafNode(FrameGraphNode *fgLeaf)
{
@@ -92,6 +93,7 @@ protected:
private:
Renderer *m_renderer;
QSize m_surfaceSize;
+ qreal m_devicePixelRatio;
FrameGraphNode *m_fgLeaf;
int m_index;
};
diff --git a/src/render/jobs/renderviewjobutils.cpp b/src/render/jobs/renderviewjobutils.cpp
index 65728e649..28d6e457e 100644
--- a/src/render/jobs/renderviewjobutils.cpp
+++ b/src/render/jobs/renderviewjobutils.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,7 +45,7 @@
#include <Qt3DRender/qshaderdata.h>
#include <Qt3DRender/private/cameraselectornode_p.h>
-#include <Qt3DRender/private/clearbuffer_p.h>
+#include <Qt3DRender/private/clearbuffers_p.h>
#include <Qt3DRender/private/layerfilternode_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/effect_p.h>
@@ -50,13 +53,16 @@
#include <Qt3DRender/private/renderstateset_p.h>
#include <Qt3DRender/private/rendertargetselectornode_p.h>
#include <Qt3DRender/private/renderview_p.h>
-#include <Qt3DRender/private/sortmethod_p.h>
+#include <Qt3DRender/private/sortpolicy_p.h>
#include <Qt3DRender/private/techniquefilternode_p.h>
#include <Qt3DRender/private/viewportnode_p.h>
#include <Qt3DRender/private/shadervariables_p.h>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/shaderdata_p.h>
#include <Qt3DRender/private/statesetnode_p.h>
+#include <Qt3DRender/private/dispatchcompute_p.h>
+#include <Qt3DRender/private/rendersurfaceselector_p.h>
+#include <Qt3DRender/private/stringtoint_p.h>
QT_BEGIN_NAMESPACE
@@ -108,7 +114,8 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN
}
case FrameGraphNode::LayerFilter: // Can be set multiple times in the tree
- rv->appendLayerFilter(static_cast<const LayerFilterNode *>(node)->layers());
+ rv->setHasLayerFilter(true);
+ rv->appendLayerFilter(static_cast<const LayerFilterNode *>(node)->layerIds());
break;
case FrameGraphNode::RenderPassFilter:
@@ -123,36 +130,28 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN
const RenderTargetSelector *targetSelector = static_cast<const RenderTargetSelector *>(node);
QNodeId renderTargetUid = targetSelector->renderTargetUuid();
HTarget renderTargetHandle = manager->renderTargetManager()->lookupHandle(renderTargetUid);
+
+ // Add renderTarget Handle and build renderCommand AttachmentPack
if (rv->renderTargetHandle().isNull()) {
rv->setRenderTargetHandle(renderTargetHandle);
RenderTarget *renderTarget = manager->renderTargetManager()->data(renderTargetHandle);
- if (renderTarget) {
- // Add renderTarget Handle and build renderCommand AttachmentPack
-
- // Copy draw buffers list
- rv->setDrawBuffers(targetSelector->drawBuffers());
-
- // Copy attachments
- Q_FOREACH (const QNodeId &attachmentId, renderTarget->renderAttachments()) {
- RenderAttachment *attachment = manager->attachmentManager()->lookupResource(attachmentId);
- if (attachment)
- rv->addRenderAttachment(attachment->attachment());
- }
-
- }
+ if (renderTarget)
+ rv->setAttachmentPack(AttachmentPack(targetSelector, renderTarget, manager->attachmentManager()));
}
break;
}
- case FrameGraphNode::ClearBuffer:
- rv->setClearBuffer(static_cast<const ClearBuffer *>(node)->type());
+ case FrameGraphNode::ClearBuffers: {
+ const ClearBuffers* cbNode = static_cast<const ClearBuffers *>(node);
+ rv->addClearBuffers(cbNode);
break;
+ }
case FrameGraphNode::TechniqueFilter:
// Can be set once
// TODO Amalgamate all technique filters from leaf to root
- if (rv->techniqueFilter())
+ if (!rv->techniqueFilter())
rv->setTechniqueFilter(static_cast<const TechniqueFilter *>(node));
break;
@@ -162,16 +161,12 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN
// a subregion relative to that of the parent viewport
const ViewportNode *vpNode = static_cast<const ViewportNode *>(node);
rv->setViewport(computeViewport(rv->viewport(), vpNode));
-
- // We take the clear color from the viewport node nearest the leaf
- if (!rv->clearColor().isValid())
- rv->setClearColor(vpNode->clearColor());
break;
}
case FrameGraphNode::SortMethod: {
- const Render::SortMethod *sortMethod = static_cast<const Render::SortMethod *>(node);
- rv->addSortCriteria(sortMethod->criteria());
+ const Render::SortPolicy *sortPolicy = static_cast<const Render::SortPolicy *>(node);
+ rv->addSortType(sortPolicy->sortTypes());
break;
}
@@ -184,16 +179,12 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN
const Render::StateSetNode *rStateSet = static_cast<const Render::StateSetNode *>(node);
// Create global RenderStateSet for renderView if no stateSet was set before
RenderStateSet *stateSet = rv->stateSet();
- if (stateSet == Q_NULLPTR) {
+ if (stateSet == nullptr) {
stateSet = rv->allocator()->allocate<RenderStateSet>();
rv->setStateSet(stateSet);
}
- // Add renderstates to stateset
- const QList<RenderState *> &states = rStateSet->renderStates();
- Q_FOREACH (RenderState *renderState, states)
- stateSet->addState(renderState);
-
+ addToRenderStateSet(stateSet, rStateSet, manager->renderStateManager());
break;
}
@@ -207,11 +198,31 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN
break;
}
+ case FrameGraphNode::ComputeDispatch: {
+ const Render::DispatchCompute *dispatchCompute = static_cast<const Render::DispatchCompute *>(node);
+ rv->setCompute(true);
+ rv->setComputeWorkgroups(dispatchCompute->x(),
+ dispatchCompute->y(),
+ dispatchCompute->z());
+ break;
+ }
+
case FrameGraphNode::Lighting: {
// TODO
break;
}
+ case FrameGraphNode::Surface: {
+ // Use the surface closest to leaf node
+ if (rv->surface() == nullptr) {
+ const Render::RenderSurfaceSelector *surfaceSelector
+ = static_cast<const Render::RenderSurfaceSelector *>(node);
+ rv->setSurface(surfaceSelector->surface());
+ rv->setSurfaceSize(surfaceSelector->renderTargetSize());
+ }
+ break;
+ }
+
default:
// Should never get here
qCWarning(Backend) << "Unhandled FrameGraphNode type";
@@ -231,12 +242,13 @@ Technique *findTechniqueForEffect(Renderer *renderer,
Effect *effect)
{
if (!effect)
- return Q_NULLPTR;
+ return nullptr;
NodeManagers *manager = renderer->nodeManagers();
// Iterate through the techniques in the effect
- Q_FOREACH (const QNodeId &techniqueId, effect->techniques()) {
+ const auto techniqueIds = effect->techniques();
+ for (const QNodeId techniqueId : techniqueIds) {
Technique *technique = manager->techniqueManager()->lookupResource(techniqueId);
if (!technique)
@@ -247,25 +259,27 @@ Technique *findTechniqueForEffect(Renderer *renderer,
// If no techniqueFilter is present, we return the technique as it satisfies OpenGL version
const TechniqueFilter *techniqueFilter = renderView->techniqueFilter();
- bool foundMatch = (techniqueFilter == Q_NULLPTR || techniqueFilter->filters().isEmpty());
+ bool foundMatch = (techniqueFilter == nullptr || techniqueFilter->filters().isEmpty());
if (foundMatch)
return technique;
// There is a technique filter so we need to check for a technique with suitable criteria.
// Check for early bail out if the technique doesn't have sufficient number of criteria and
// can therefore never satisfy the filter
- if (technique->annotations().size() < techniqueFilter->filters().size())
+ if (technique->filterKeys().size() < techniqueFilter->filters().size())
continue;
// Iterate through the filter criteria and for each one search for a criteria on the
// technique that satisfies it
- Q_FOREACH (const QNodeId &filterAnnotationId, techniqueFilter->filters()) {
+ const auto filterKeyIds = techniqueFilter->filters();
+ for (const QNodeId filterKeyId : filterKeyIds) {
foundMatch = false;
- Annotation *filterAnnotation = manager->criterionManager()->lookupResource(filterAnnotationId);
+ FilterKey *filterKey = manager->filterKeyManager()->lookupResource(filterKeyId);
- Q_FOREACH (const QNodeId &techniqueAnnotationId, technique->annotations()) {
- Annotation *techniqueAnnotation = manager->criterionManager()->lookupResource(techniqueAnnotationId);
- if ((foundMatch = (*techniqueAnnotation == *filterAnnotation)))
+ const auto techniqueFilterKeyIds = technique->filterKeys();
+ for (const QNodeId techniqueFilterKeyId : techniqueFilterKeyIds) {
+ FilterKey *techniqueFilterKey = manager->filterKeyManager()->lookupResource(techniqueFilterKeyId);
+ if ((foundMatch = (*techniqueFilterKey == *filterKey)))
break;
}
@@ -282,7 +296,7 @@ Technique *findTechniqueForEffect(Renderer *renderer,
}
// We failed to find a suitable technique to use :(
- return Q_NULLPTR;
+ return nullptr;
}
@@ -294,24 +308,27 @@ RenderRenderPassList findRenderPassesForTechnique(NodeManagers *manager,
Q_ASSERT(technique);
RenderRenderPassList passes;
- Q_FOREACH (const QNodeId &passId, technique->renderPasses()) {
+ const auto passIds = technique->renderPasses();
+ for (const QNodeId passId : passIds) {
RenderPass *renderPass = manager->renderPassManager()->lookupResource(passId);
- if (renderPass) {
+ if (renderPass && renderPass->isEnabled()) {
const RenderPassFilter *passFilter = renderView->renderPassFilter();
bool foundMatch = (!passFilter || passFilter->filters().size() == 0);
// A pass filter is present so we need to check for matching criteria
- if (!foundMatch && renderPass->annotations().size() >= passFilter->filters().size()) {
+ if (!foundMatch && renderPass->filterKeys().size() >= passFilter->filters().size()) {
// Iterate through the filter criteria and look for render passes with criteria that satisfy them
- Q_FOREACH (const QNodeId &filterAnnotationId, passFilter->filters()) {
+ const auto filterKeyIds = passFilter->filters();
+ for (const QNodeId filterKeyId : filterKeyIds) {
foundMatch = false;
- Annotation *filterAnnotation = manager->criterionManager()->lookupResource(filterAnnotationId);
+ FilterKey *filterFilterKey = manager->filterKeyManager()->lookupResource(filterKeyId);
- Q_FOREACH (const QNodeId &passAnnotationId, renderPass->annotations()) {
- Annotation *passAnnotation = manager->criterionManager()->lookupResource(passAnnotationId);
- if ((foundMatch = (*passAnnotation == *filterAnnotation)))
+ const auto passFilterKeyIds = renderPass->filterKeys();
+ for (const QNodeId passFilterKeyId : passFilterKeyIds) {
+ FilterKey *passFilterKey = manager->filterKeyManager()->lookupResource(passFilterKeyId);
+ if ((foundMatch = (*passFilterKey == *filterFilterKey)))
break;
}
@@ -333,24 +350,25 @@ RenderRenderPassList findRenderPassesForTechnique(NodeManagers *manager,
}
-ParameterInfoList::iterator findParamInfo(ParameterInfoList *params, const QString &name)
+ParameterInfoList::const_iterator findParamInfo(ParameterInfoList *params, const int nameId)
{
- ParameterInfoList::iterator it = std::lower_bound(params->begin(), params->end(), name);
- if (it != params->end() && it->name != name)
- return params->end();
+ const ParameterInfoList::const_iterator end = params->cend();
+ ParameterInfoList::const_iterator it = std::lower_bound(params->cbegin(), end, nameId);
+ if (it != end && it->nameId != nameId)
+ return end;
return it;
}
void addParametersForIds(ParameterInfoList *params, ParameterManager *manager,
- const QList<Qt3DCore::QNodeId> &parameterIds)
+ const QVector<Qt3DCore::QNodeId> &parameterIds)
{
- Q_FOREACH (const QNodeId &paramId, parameterIds) {
+ for (const QNodeId paramId : parameterIds) {
Parameter *param = manager->lookupResource(paramId);
- if (param != Q_NULLPTR) {
- ParameterInfoList::iterator it = std::lower_bound(params->begin(), params->end(), param->name());
- if (it == params->end() || it->name != param->name())
- params->insert(it, ParameterInfo(param->name(), param->value()));
- }
+ if (Q_UNLIKELY(!param))
+ continue;
+ ParameterInfoList::iterator it = std::lower_bound(params->begin(), params->end(), param->nameId());
+ if (it == params->end() || it->nameId != param->nameId())
+ params->insert(it, ParameterInfo(param->nameId(), param->value()));
}
}
@@ -373,15 +391,13 @@ void parametersFromMaterialEffectTechnique(ParameterInfoList *infoList,
parametersFromParametersProvider(infoList, manager, effect);
}
-RenderStateSet *buildRenderStateSet(const QList<RenderState*> &states, QFrameAllocator *allocator)
+void addToRenderStateSet(RenderStateSet *stateSet,
+ const RenderStateCollection *collection,
+ RenderStateManager *manager)
{
- RenderStateSet *stateSet = allocator->allocate<RenderStateSet>();
-
- Q_FOREACH (RenderState *renderState, states) {
- stateSet->addState(renderState);
- }
-
- return stateSet;
+ const auto rstates = collection->renderStates(manager);
+ for (RenderStateNode *rstate : rstates)
+ stateSet->addState(rstate->impl());
}
namespace {
@@ -392,7 +408,7 @@ const int qNodeIdTypeId = qMetaTypeId<QNodeId>();
}
UniformBlockValueBuilder::UniformBlockValueBuilder()
- : shaderDataManager(Q_NULLPTR)
+ : shaderDataManager(nullptr)
{
}
@@ -412,15 +428,15 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QStrin
ShaderData *subShaderData = shaderDataManager->lookupResource(list.at(i).value<QNodeId>());
if (subShaderData)
buildActiveUniformNameValueMapStructHelper(subShaderData,
- blockName + QStringLiteral(".") + qmlPropertyName + blockArray.arg(i),
- QStringLiteral(""));
+ blockName + QLatin1Char('.') + qmlPropertyName + blockArray.arg(i),
+ QLatin1String(""));
}
}
} else { // Array of scalar/vec qmlPropertyName[0]
- QString varName = blockName + QStringLiteral(".") + qmlPropertyName + QStringLiteral("[0]");
+ QString varName = blockName + QLatin1String(".") + qmlPropertyName + QLatin1String("[0]");
if (uniforms.contains(varName)) {
qCDebug(Shaders) << "UBO array member " << varName << " set for update";
- activeUniformNamesToValue.insert(varName, value);
+ activeUniformNamesToValue.insert(StringToInt::lookupId(varName), value);
}
}
} else if (value.userType() == qNodeIdTypeId) { // Struct qmlPropertyName.structMember
@@ -430,10 +446,10 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QStrin
blockName,
qmlPropertyName);
} else { // Scalar / Vec
- QString varName = blockName + QStringLiteral(".") + qmlPropertyName;
+ QString varName = blockName + QLatin1Char('.') + qmlPropertyName;
if (uniforms.contains(varName)) {
qCDebug(Shaders) << "UBO scalar member " << varName << " set for update";
- activeUniformNamesToValue.insert(varName, value);
+ activeUniformNamesToValue.insert(StringToInt::lookupId(varName), value);
}
}
}
@@ -445,7 +461,7 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapStructHelper(Shader
const QHash<QString, QVariant>::const_iterator end = properties.end();
while (it != end) {
- QString prefix = qmlPropertyName.isEmpty() ? QStringLiteral("") : QStringLiteral(".");
+ const auto prefix = qmlPropertyName.isEmpty() ? QLatin1String("") : QLatin1String(".");
buildActiveUniformNameValueMapHelper(blockName + prefix + qmlPropertyName,
it.key(),
it.value());
diff --git a/src/render/jobs/renderviewjobutils_p.h b/src/render/jobs/renderviewjobutils_p.h
index dd3756254..e1f07252f 100644
--- a/src/render/jobs/renderviewjobutils_p.h
+++ b/src/render/jobs/renderviewjobutils_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -76,7 +79,8 @@ class NodeManagers;
class ShaderDataManager;
struct ShaderUniform;
class ShaderData;
-class RenderState;
+class RenderStateManager;
+class RenderStateCollection;
Q_AUTOTEST_EXPORT void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv,
const FrameGraphNode *fgLeaf);
@@ -90,31 +94,37 @@ Q_AUTOTEST_EXPORT RenderRenderPassList findRenderPassesForTechnique(NodeManagers
RenderView *renderView,
Technique *technique);
+// Extracts the type T from a QVariant v without using QVariant::value which is slow
+// Note: Assumes you are 100% sure about the type you requested
+template<typename T>
+Q_AUTOTEST_EXPORT inline T variant_value(const QVariant &v)
+{
+ return *reinterpret_cast<const T *>(v.data());
+}
+
struct ParameterInfo
{
- ParameterInfo(const QString &name = QString(), const QVariant &value = QVariant())
- : name(name)
+ ParameterInfo(const int nameId = -1, const QVariant &value = QVariant())
+ : nameId(nameId)
, value(value)
{}
- QString name;
+ int nameId;
QVariant value;
- bool operator<(const QString &otherName) const
+ bool operator<(const int otherNameId) const
{
- return name < otherName;
+ return nameId < otherNameId;
}
bool operator<(const ParameterInfo &other) const
{
- return name < other.name;
+ return nameId < other.nameId;
}
};
+QT3D_DECLARE_TYPEINFO_2(Qt3DRender, Render, ParameterInfo, Q_MOVABLE_TYPE)
+
-inline bool operator<(const QString &otherName, const ParameterInfo &pi)
-{
- return otherName < pi.name;
-}
typedef QVarLengthArray<ParameterInfo, 16> ParameterInfoList;
@@ -125,7 +135,7 @@ Q_AUTOTEST_EXPORT void parametersFromMaterialEffectTechnique(ParameterInfoList *
Technique *technique);
Q_AUTOTEST_EXPORT void addParametersForIds(ParameterInfoList *params, ParameterManager *manager,
- const QList<Qt3DCore::QNodeId> &parameterIds);
+ const QVector<Qt3DCore::QNodeId> &parameterIds);
template<class T>
void parametersFromParametersProvider(ParameterInfoList *infoList,
@@ -136,12 +146,14 @@ void parametersFromParametersProvider(ParameterInfoList *infoList,
addParametersForIds(infoList, manager, pass->parameters());
}
-Q_AUTOTEST_EXPORT ParameterInfoList::iterator findParamInfo(ParameterInfoList *infoList,
- const QString &name);
+Q_AUTOTEST_EXPORT ParameterInfoList::const_iterator findParamInfo(ParameterInfoList *infoList,
+ const int nameId);
-Q_AUTOTEST_EXPORT RenderStateSet *buildRenderStateSet(const QList<RenderState*> &states,
- Qt3DCore::QFrameAllocator *allocator);
+Q_AUTOTEST_EXPORT void addToRenderStateSet(RenderStateSet *stateSet,
+ const RenderStateCollection *collection,
+ RenderStateManager *manager);
+typedef QHash<int, QVariant> UniformBlockValueBuilderHash;
struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder
{
@@ -157,15 +169,13 @@ struct Q_AUTOTEST_EXPORT UniformBlockValueBuilder
bool updatedPropertiesOnly;
QHash<QString, ShaderUniform> uniforms;
- QHash<QString, QVariant> activeUniformNamesToValue;
+ UniformBlockValueBuilderHash activeUniformNamesToValue;
ShaderDataManager *shaderDataManager;
};
} // namespace Render
} // namespace Qt3DRender
-Q_DECLARE_TYPEINFO(Qt3DRender::Render::ParameterInfo, Q_MOVABLE_TYPE);
-
QT_END_NAMESPACE
#endif // QT3DRENDER_RENDERVIEWJOBUTILS_P_H
diff --git a/src/render/jobs/updateboundingvolumejob.cpp b/src/render/jobs/updateboundingvolumejob.cpp
index 1a46ee2bc..9a4a9f27e 100644
--- a/src/render/jobs/updateboundingvolumejob.cpp
+++ b/src/render/jobs/updateboundingvolumejob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,6 +43,7 @@
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DRender/private/sphere_p.h>
+#include <Qt3DRender/private/job_common_p.h>
#include <QThread>
@@ -53,14 +57,15 @@ namespace {
void expandWorldBoundingVolume(Qt3DRender::Render::Entity *node)
{
// Go to the nodes that have the most depth
- Q_FOREACH (Entity *c, node->children())
+ const auto children = node->children();
+ for (Entity *c : children)
expandWorldBoundingVolume(c);
// Then traverse back from leaf to root
// Initialize parent bounding volume to be equal to that of the first child
- if (node->hasChildren()) {
+ if (!children.empty()) {
Qt3DRender::Render::Sphere *parentBoundingVolume = node->worldBoundingVolumeWithChildren();
- Q_FOREACH (Entity *c, node->children())
+ for (Entity *c : children)
parentBoundingVolume->expandToContain(*c->worldBoundingVolumeWithChildren());
}
}
@@ -68,8 +73,9 @@ void expandWorldBoundingVolume(Qt3DRender::Render::Entity *node)
}
UpdateBoundingVolumeJob::UpdateBoundingVolumeJob()
- : m_node(Q_NULLPTR)
+ : m_node(nullptr)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateBoundingVolume, 0);
}
void UpdateBoundingVolumeJob::setRoot(Entity *root)
diff --git a/src/render/jobs/updateboundingvolumejob_p.h b/src/render/jobs/updateboundingvolumejob_p.h
index b4abeea7f..ee140f807 100644
--- a/src/render/jobs/updateboundingvolumejob_p.h
+++ b/src/render/jobs/updateboundingvolumejob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/jobs/updateworldtransformjob.cpp b/src/render/jobs/updateworldtransformjob.cpp
index dc8552a75..3c621dbd0 100644
--- a/src/render/jobs/updateworldtransformjob.cpp
+++ b/src/render/jobs/updateworldtransformjob.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -41,6 +44,8 @@
#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/transform_p.h>
#include <Qt3DRender/private/renderlogging_p.h>
+#include <Qt3DRender/private/job_common_p.h>
+
#include <QThread>
QT_BEGIN_NAMESPACE
@@ -54,14 +59,15 @@ void updateWorldTransformAndBounds(Qt3DRender::Render::Entity *node, const QMatr
{
QMatrix4x4 worldTransform(parentTransform);
Transform *nodeTransform = node->renderComponent<Transform>();
- if (nodeTransform != Q_NULLPTR && nodeTransform->isEnabled())
+ if (nodeTransform != nullptr && nodeTransform->isEnabled())
worldTransform = worldTransform * nodeTransform->transformMatrix();
*(node->worldTransform()) = worldTransform;
*(node->worldBoundingVolume()) = node->localBoundingVolume()->transformed(worldTransform);
*(node->worldBoundingVolumeWithChildren()) = *(node->worldBoundingVolume()); // expanded in UpdateBoundingVolumeJob
- Q_FOREACH (Qt3DRender::Render::Entity *child, node->children())
+ const auto children = node->children();
+ for (Qt3DRender::Render::Entity *child : children)
updateWorldTransformAndBounds(child, worldTransform);
}
@@ -69,8 +75,9 @@ void updateWorldTransformAndBounds(Qt3DRender::Render::Entity *node, const QMatr
UpdateWorldTransformJob::UpdateWorldTransformJob()
: Qt3DCore::QAspectJob()
- , m_node(Q_NULLPTR)
+ , m_node(nullptr)
{
+ SET_JOB_RUN_STAT_TYPE(this, JobTypes::UpdateTransform, 0);
}
void UpdateWorldTransformJob::setRoot(Entity *root)
@@ -91,7 +98,7 @@ void UpdateWorldTransformJob::run()
QMatrix4x4 parentTransform;
Entity *parent = m_node->parent();
- if (parent != Q_NULLPTR)
+ if (parent != nullptr)
parentTransform = *(parent->worldTransform());
updateWorldTransformAndBounds(m_node, parentTransform);
diff --git a/src/render/jobs/updateworldtransformjob_p.h b/src/render/jobs/updateworldtransformjob_p.h
index 510bbab2a..11c2dce21 100644
--- a/src/render/jobs/updateworldtransformjob_p.h
+++ b/src/render/jobs/updateworldtransformjob_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/lights/light.cpp b/src/render/lights/light.cpp
index de28349e6..1e1855349 100644
--- a/src/render/lights/light.cpp
+++ b/src/render/lights/light.cpp
@@ -1,42 +1,46 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "light_p.h"
-#include "qlight.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qabstractlight.h"
+#include "qabstractlight_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <private/abstractrenderer_p.h>
#include <private/nodemanagers_p.h>
#include <private/qbackendnode_p.h>
@@ -49,26 +53,37 @@ using namespace Qt3DCore;
namespace Qt3DRender {
namespace Render {
-RenderLightFunctor::RenderLightFunctor(NodeManagers *managers)
+QNodeId Light::shaderData() const
+{
+ return m_shaderDataId;
+}
+
+void Light::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAbstractLightData>>(change);
+ const auto &data = typedChange->data;
+ m_shaderDataId = data.shaderDataId;
+}
+
+RenderLightFunctor::RenderLightFunctor(AbstractRenderer *renderer, NodeManagers *managers)
: m_managers(managers)
+ , m_renderer(renderer)
{
}
-Qt3DCore::QBackendNode *RenderLightFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *RenderLightFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- Light *backend = m_managers->lightManager()->getOrCreateResource(frontend->id());
- backend->setFactory(factory);
- backend->setManagers(m_managers);
- backend->setPeer(frontend);
+ Light *backend = m_managers->lightManager()->getOrCreateResource(change->subjectId());
+ backend->setRenderer(m_renderer);
return backend;
}
-Qt3DCore::QBackendNode *RenderLightFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *RenderLightFunctor::get(Qt3DCore::QNodeId id) const
{
return m_managers->lightManager()->lookupResource(id);
}
-void RenderLightFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void RenderLightFunctor::destroy(Qt3DCore::QNodeId id) const
{
m_managers->lightManager()->releaseResource(id);
}
diff --git a/src/render/lights/light_p.h b/src/render/lights/light_p.h
index 3059a6917..31901bf11 100644
--- a/src/render/lights/light_p.h
+++ b/src/render/lights/light_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <private/shaderdata_p.h>
+#include <Qt3DRender/private/backendnode_p.h>
QT_BEGIN_NAMESPACE
@@ -58,23 +61,29 @@ namespace Render {
class NodeManagers;
-class Q_AUTOTEST_EXPORT Light : public ShaderData
+class Q_AUTOTEST_EXPORT Light : public BackendNode
{
public:
+ Qt3DCore::QNodeId shaderData() const;
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ Qt3DCore::QNodeId m_shaderDataId;
};
-class RenderLightFunctor : public Qt3DCore::QBackendNodeFunctor
+class RenderLightFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit RenderLightFunctor(NodeManagers *managers);
+ explicit RenderLightFunctor(AbstractRenderer *renderer, NodeManagers *managers);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_OVERRIDE;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
private:
NodeManagers *m_managers;
+ AbstractRenderer *m_renderer;
};
} // namespace Render
diff --git a/src/render/lights/lights.pri b/src/render/lights/lights.pri
index ade6d29d7..1a7e8295c 100644
--- a/src/render/lights/lights.pri
+++ b/src/render/lights/lights.pri
@@ -1,8 +1,8 @@
INCLUDEPATH += $$PWD
HEADERS += \
- $$PWD/qlight.h \
- $$PWD/qlight_p.h \
+ $$PWD/qabstractlight.h \
+ $$PWD/qabstractlight_p.h \
$$PWD/qdirectionallight.h \
$$PWD/qdirectionallight_p.h \
$$PWD/qpointlight.h \
@@ -12,7 +12,7 @@ HEADERS += \
$$PWD/light_p.h
SOURCES += \
- $$PWD/qlight.cpp \
+ $$PWD/qabstractlight.cpp \
$$PWD/qdirectionallight.cpp \
$$PWD/qpointlight.cpp \
$$PWD/qspotlight.cpp \
diff --git a/src/render/lights/qabstractlight.cpp b/src/render/lights/qabstractlight.cpp
new file mode 100644
index 000000000..0f8e5c19f
--- /dev/null
+++ b/src/render/lights/qabstractlight.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstractlight.h"
+#include "qabstractlight_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender
+{
+
+/*!
+ * \qmltype Light
+ * \inqmlmodule Qt3D.Render
+ * \instantiates Qt3DRender::QAbstractLight
+ * \brief Encapsulate a QAbstractLight object in a Qt 3D scene.
+ * \since 5.6
+ */
+
+
+QAbstractLightPrivate::QAbstractLightPrivate(QAbstractLight::Type type)
+ : m_type(type)
+ , m_shaderData(new QShaderData)
+{
+ m_shaderData->setProperty("type", type);
+}
+
+QAbstractLightPrivate::~QAbstractLightPrivate()
+{
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QAbstractLight::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAbstractLightData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QAbstractLight);
+ data.shaderDataId = qIdForNode(d->m_shaderData);
+ return creationChange;
+}
+
+/*!
+ \class Qt3DRender::QAbstractLight
+ \inmodule Qt3DRender
+*/
+
+/*! \internal */
+QAbstractLight::QAbstractLight(QAbstractLightPrivate &dd, QNode *parent)
+ : QComponent(dd, parent)
+{
+ Q_D(QAbstractLight);
+ d->m_shaderData->setParent(this);
+}
+
+QAbstractLight::~QAbstractLight()
+{
+}
+
+QAbstractLight::Type QAbstractLight::type() const
+{
+ Q_D(const QAbstractLight);
+ return d->m_type;
+}
+
+/*!
+ * \property Qt3DRender::QAbstractLight::color
+ *
+ * Holds the current QAbstractLight color.
+ */
+QColor QAbstractLight::color() const
+{
+ Q_D(const QAbstractLight);
+ return d->m_shaderData->property("color").value<QColor>();
+}
+
+void QAbstractLight::setColor(const QColor &c)
+{
+ Q_D(QAbstractLight);
+ if (color() != c) {
+ d->m_shaderData->setProperty("color", c);
+ emit colorChanged(c);
+ }
+}
+
+/*!
+ \property Qt3DRender::QAbstractLight::intensity
+
+ Holds the current QAbstractLight intensity.
+*/
+float QAbstractLight::intensity() const
+{
+ Q_D(const QAbstractLight);
+ return d->m_shaderData->property("intensity").toFloat();
+}
+
+void QAbstractLight::setIntensity(float value)
+{
+ Q_D(QAbstractLight);
+ if (intensity() != value) {
+ d->m_shaderData->setProperty("intensity", value);
+ emit intensityChanged(value);
+ }
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/lights/qabstractlight.h b/src/render/lights/qabstractlight.h
new file mode 100644
index 000000000..7cc98b57b
--- /dev/null
+++ b/src/render/lights/qabstractlight.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QABSTRACTLIGHT_H
+#define QT3DRENDER_QABSTRACTLIGHT_H
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DCore/qcomponent.h>
+
+#include <QVector3D>
+#include <QColor>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractLightPrivate;
+
+class QT3DRENDERSHARED_EXPORT QAbstractLight : public Qt3DCore::QComponent
+{
+ Q_OBJECT
+ Q_PROPERTY(Type type READ type)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(float intensity READ intensity WRITE setIntensity NOTIFY intensityChanged)
+
+public:
+ ~QAbstractLight();
+
+ enum Type {
+ PointLight = 0,
+ DirectionalLight,
+ SpotLight
+ };
+ Q_ENUM(Type)
+
+ Type type() const;
+ QColor color() const;
+ float intensity() const;
+
+public Q_SLOTS:
+ void setColor(const QColor &color);
+ void setIntensity(float intensity);
+
+protected:
+ explicit QAbstractLight(QAbstractLightPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+Q_SIGNALS:
+ void colorChanged(const QColor &color);
+ void intensityChanged(float intensity);
+
+private:
+ Q_DECLARE_PRIVATE(QAbstractLight)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QABSTRACTLIGHT_H
diff --git a/src/render/lights/qabstractlight_p.h b/src/render/lights/qabstractlight_p.h
new file mode 100644
index 000000000..bfab787a3
--- /dev/null
+++ b/src/render/lights/qabstractlight_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QABSTRACTLIGHT_P_H
+#define QT3DRENDER_QABSTRACTLIGHT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qcomponent_p.h>
+#include <qshaderdata.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractLight;
+
+class Q_AUTOTEST_EXPORT QAbstractLightPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ explicit QAbstractLightPrivate(QAbstractLight::Type type);
+ ~QAbstractLightPrivate();
+
+ Q_DECLARE_PUBLIC(QAbstractLight)
+ QAbstractLight::Type m_type;
+ QShaderData *m_shaderData;
+};
+
+struct QAbstractLightData
+{
+ Qt3DCore::QNodeId shaderDataId;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QABSTRACTLIGHT_P_H
diff --git a/src/render/lights/qdirectionallight.cpp b/src/render/lights/qdirectionallight.cpp
index 0e7d7caf7..57b5c85cd 100644
--- a/src/render/lights/qdirectionallight.cpp
+++ b/src/render/lights/qdirectionallight.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "qdirectionallight.h"
#include "qdirectionallight_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -51,7 +54,7 @@ namespace Qt3DRender {
* struct DirectionalLight
* {
* vec3 position;
- * vec3 direction;
+ * vec3 worldDirection;
* vec4 color;
* float intensity;
* };
@@ -62,44 +65,40 @@ namespace Qt3DRender {
*/
QDirectionalLightPrivate::QDirectionalLightPrivate()
- : QLightPrivate(QLight::DirectionalLight)
- , m_direction(0.0f, -1.0f, 0.0f)
+ : QAbstractLightPrivate(QAbstractLight::DirectionalLight)
{
+ m_shaderData->setProperty("direction", QVector3D(0.0f, -1.0f, 0.0f));
}
-void QDirectionalLight::copy(const QNode *ref)
+QDirectionalLight::QDirectionalLight(QNode *parent)
+ : QAbstractLight(*new QDirectionalLightPrivate, parent)
{
- const QDirectionalLight *light = static_cast<const QDirectionalLight*>(ref);
- d_func()->m_direction = light->d_func()->m_direction;
- // This needs to be last otherwise, properties value won't be copied
- // as we use shader introspection in QShaderData::copy
- QLight::copy(ref);
}
-QDirectionalLight::QDirectionalLight(QNode *parent)
- : QLight(*new QDirectionalLightPrivate, parent)
+/*! \internal */
+QDirectionalLight::~QDirectionalLight()
{
}
/*! \internal */
QDirectionalLight::QDirectionalLight(QDirectionalLightPrivate &dd, QNode *parent)
- : QLight(dd, parent)
+ : QAbstractLight(dd, parent)
{
}
-void QDirectionalLight::setDirection(const QVector3D &direction)
+void QDirectionalLight::setWorldDirection(const QVector3D &direction)
{
Q_D(QDirectionalLight);
- if (direction != d->m_direction) {
- d->m_direction = direction;
- emit directionChanged(direction);
+ if (worldDirection() != direction) {
+ d->m_shaderData->setProperty("direction", direction);
+ emit worldDirectionChanged(direction);
}
}
-QVector3D QDirectionalLight::direction() const
+QVector3D QDirectionalLight::worldDirection() const
{
Q_D(const QDirectionalLight);
- return d->m_direction;
+ return d->m_shaderData->property("direction").value<QVector3D>();
}
} // namespace Qt3DRender
diff --git a/src/render/lights/qdirectionallight.h b/src/render/lights/qdirectionallight.h
index 874c09dfa..6be1585db 100644
--- a/src/render/lights/qdirectionallight.h
+++ b/src/render/lights/qdirectionallight.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DRENDER_QDIRECTIONALLIGHT_H
#define QT3DRENDER_QDIRECTIONALLIGHT_H
-#include <Qt3DRender/qlight.h>
+#include <Qt3DRender/qabstractlight.h>
QT_BEGIN_NAMESPACE
@@ -45,29 +48,28 @@ namespace Qt3DRender {
class QDirectionalLightPrivate;
-class QT3DRENDERSHARED_EXPORT QDirectionalLight : public QLight
+class QT3DRENDERSHARED_EXPORT QDirectionalLight : public QAbstractLight
{
Q_OBJECT
- Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
+ Q_PROPERTY(QVector3D worldDirection READ worldDirection WRITE setWorldDirection NOTIFY worldDirectionChanged)
public:
- explicit QDirectionalLight(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QDirectionalLight(Qt3DCore::QNode *parent = nullptr);
+ ~QDirectionalLight();
- QVector3D direction() const;
+ QVector3D worldDirection() const;
public Q_SLOTS:
- void setDirection(const QVector3D &direction);
+ void setWorldDirection(const QVector3D &worldDirection);
Q_SIGNALS:
- void directionChanged(const QVector3D &direction);
+ void worldDirectionChanged(const QVector3D &worldDirection);
protected:
- QDirectionalLight(QDirectionalLightPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QDirectionalLight(QDirectionalLightPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QDirectionalLight)
- QT3D_CLONEABLE(QDirectionalLight)
};
} // namespace Qt3DRender
diff --git a/src/render/lights/qdirectionallight_p.h b/src/render/lights/qdirectionallight_p.h
index c197c527d..bc815ce30 100644
--- a/src/render/lights/qdirectionallight_p.h
+++ b/src/render/lights/qdirectionallight_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <private/qlight_p.h>
+#include <private/qabstractlight_p.h>
QT_BEGIN_NAMESPACE
@@ -56,13 +59,12 @@ namespace Qt3DRender {
class QDirectionalLight;
-class QDirectionalLightPrivate : QLightPrivate
+class QDirectionalLightPrivate : QAbstractLightPrivate
{
public:
QDirectionalLightPrivate();
Q_DECLARE_PUBLIC(QDirectionalLight)
- QVector3D m_direction;
};
} // namespace Qt3DRender
diff --git a/src/render/lights/qlight.cpp b/src/render/lights/qlight.cpp
deleted file mode 100644
index 0a3026431..000000000
--- a/src/render/lights/qlight.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlight.h"
-#include "qlight_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender
-{
-
-/*!
- * \qmltype Light
- * \inqmlmodule Qt3D.Render
- * \instantiates Qt3DRender::QLight
- * \brief Encapsulate a QLight object in a Qt 3D scene.
- * \since 5.6
- */
-
-
-QLightPrivate::QLightPrivate(QLight::Type type)
- : m_type(type)
- , m_color(QColor(255, 255, 255))
- , m_intensity(1.0f)
-{
-}
-
-void QLight::copy(const QNode *ref)
-{
- const QLight *light = static_cast<const QLight*>(ref);
- d_func()->m_type = light->d_func()->m_type;
- d_func()->m_color = light->d_func()->m_color;
- d_func()->m_intensity = light->d_func()->m_intensity;
- QShaderData::copy(ref);
-}
-
-/*!
- \class Qt3DRender::QLight
- \inmodule Qt3DRender
-*/
-
-/*!
- * Constructs a new QLight with the given \a parent.
- */
-QLight::QLight(Qt3DCore::QNode *parent) :
- QShaderData(*new QLightPrivate(PointLight), parent)
-{
-}
-
-/*! \internal */
-QLight::QLight(QLightPrivate &dd, QNode *parent)
- : QShaderData(dd, parent)
-{
-}
-
-QLight::~QLight()
-{
- cleanup();
-}
-
-QLight::Type QLight::type() const
-{
- Q_D(const QLight);
- return d->m_type;
-}
-
-void QLight::setType(Type type)
-{
- Q_D(QLight);
- if (d->m_type != type) {
- d->m_type = type;
- emit typeChanged(type);
- }
-}
-
-/*!
- * \property Qt3DRender::QLight::color
- *
- * Holds the current QLight color.
- */
-QColor QLight::color() const
-{
- Q_D(const QLight);
- return d->m_color;
-}
-
-void QLight::setColor(const QColor &color)
-{
- Q_D(QLight);
- if (d->m_color != color) {
- d->m_color = color;
- emit colorChanged(color);
- }
-}
-
-/*!
- \property Qt3DRender::QLight::intensity
-
- Holds the current QLight intensity.
-*/
-float QLight::intensity() const
-{
- Q_D(const QLight);
- return d->m_intensity;
-}
-
-void QLight::setIntensity(float intensity)
-{
- Q_D(QLight);
- if (d->m_intensity != intensity) {
- d->m_intensity = intensity;
- emit intensityChanged(intensity);
- }
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/lights/qlight.h b/src/render/lights/qlight.h
deleted file mode 100644
index ffec5d12b..000000000
--- a/src/render/lights/qlight.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QLIGHT_H
-#define QT3DRENDER_QLIGHT_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/qshaderdata.h>
-
-#include <QVector3D>
-#include <QColor>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QLightPrivate;
-
-class QT3DRENDERSHARED_EXPORT QLight : public QShaderData
-{
- Q_OBJECT
- Q_PROPERTY(Type type READ type WRITE setType NOTIFY typeChanged)
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
- Q_PROPERTY(float intensity READ intensity WRITE setIntensity NOTIFY intensityChanged)
-
-public :
- enum Type {
- PointLight = 0,
- DirectionalLight,
- SpotLight
- };
- Q_ENUM(Type)
-
- explicit QLight(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QLight();
-
- Type type() const;
- QColor color() const;
- float intensity() const;
-
-public Q_SLOTS:
- void setType(Type type);
- void setColor(const QColor &color);
- void setIntensity(float intensity);
-
-protected :
- QLight(QLightPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-Q_SIGNALS:
- void typeChanged(Type type);
- void colorChanged(const QColor &color);
- void intensityChanged(float intensity);
-
-private:
- Q_DECLARE_PRIVATE(QLight)
- QT3D_CLONEABLE(QLight)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QLIGHT_H
diff --git a/src/render/lights/qlight_p.h b/src/render/lights/qlight_p.h
deleted file mode 100644
index a66d0fc57..000000000
--- a/src/render/lights/qlight_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QLIGHT_P_H
-#define QT3DRENDER_QLIGHT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qshaderdata_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QLight;
-
-class QLightPrivate : public QShaderDataPrivate
-{
-public:
- QLightPrivate(QLight::Type type);
-
- Q_DECLARE_PUBLIC(QLight)
- QLight::Type m_type;
- QColor m_color;
- float m_intensity;
-};
-
-}
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QLIGHT_P_H
diff --git a/src/render/lights/qpointlight.cpp b/src/render/lights/qpointlight.cpp
index 314167284..1936ef4f4 100644
--- a/src/render/lights/qpointlight.cpp
+++ b/src/render/lights/qpointlight.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,10 +61,12 @@ namespace Qt3DRender {
\endcode
*/
-QPointLightPrivate::QPointLightPrivate(QLight::Type type)
- : QLightPrivate(type)
- , m_attenuation(0.0f, 0.0f, 0.002f)
+QPointLightPrivate::QPointLightPrivate()
+ : QAbstractLightPrivate(QAbstractLight::PointLight)
{
+ m_shaderData->setProperty("constantAttenuation", 0.0f);
+ m_shaderData->setProperty("linearAttenuation", 0.0f);
+ m_shaderData->setProperty("quadraticAttenuation", 0.0f);
}
/*!
@@ -85,73 +90,63 @@ QPointLightPrivate::QPointLightPrivate(QLight::Type type)
Constructs a new QPointLight with the specified \a parent.
*/
QPointLight::QPointLight(QNode *parent)
- : QLight(*new QPointLightPrivate, parent)
+ : QAbstractLight(*new QPointLightPrivate, parent)
{
}
/*! \internal */
-QPointLight::QPointLight(QPointLightPrivate &dd, QNode *parent)
- : QLight(dd, parent)
+QPointLight::~QPointLight()
{
}
-QVector3D QPointLight::attenuation() const
-{
- Q_D(const QPointLight);
- return d->m_attenuation;
-}
-
-void QPointLight::setAttenuation(const QVector3D &value)
+/*! \internal */
+QPointLight::QPointLight(QPointLightPrivate &dd, QNode *parent)
+ : QAbstractLight(dd, parent)
{
- Q_D(QPointLight);
- if (d->m_attenuation != value) {
- d->m_attenuation = value;
- emit attenuationChanged(value);
- }
}
float QPointLight::constantAttenuation() const
{
Q_D(const QPointLight);
- return d->m_attenuation.x();
+ return d->m_shaderData->property("constantAttenuation").toFloat();
}
void QPointLight::setConstantAttenuation(float value)
{
Q_D(QPointLight);
- if (d->m_attenuation.x() != value) {
- d->m_attenuation.setX(value);
- emit attenuationChanged(d->m_attenuation);
+ if (constantAttenuation() != value) {
+ d->m_shaderData->setProperty("constantAttenuation", value);
+ emit constantAttenuationChanged(value);
}
}
float QPointLight::linearAttenuation() const
{
Q_D(const QPointLight);
- return d->m_attenuation.y();
+ return d->m_shaderData->property("linearAttenuation").toFloat();
}
void QPointLight::setLinearAttenuation(float value)
{
Q_D(QPointLight);
- if (d->m_attenuation.y() != value) {
- d->m_attenuation.setY(value);
- emit attenuationChanged(d->m_attenuation);
+ if (linearAttenuation() != value) {
+ d->m_shaderData->setProperty("linearAttenuation", value);
+ emit linearAttenuationChanged(value);
}
}
float QPointLight::quadraticAttenuation() const
{
Q_D(const QPointLight);
- return d->m_attenuation.z();
+ return d->m_shaderData->property("quadraticAttenuation").toFloat();
}
void QPointLight::setQuadraticAttenuation(float value)
{
Q_D(QPointLight);
- if (d->m_attenuation.z() != value) {
- d->m_attenuation.setZ(value);
- emit attenuationChanged(d->m_attenuation);
+ if (quadraticAttenuation() != value) {
+ d->m_shaderData->setProperty("quadraticAttenuation", value);
+ emit quadraticAttenuationChanged(value);
}
}
diff --git a/src/render/lights/qpointlight.h b/src/render/lights/qpointlight.h
index 4ef082082..16e048560 100644
--- a/src/render/lights/qpointlight.h
+++ b/src/render/lights/qpointlight.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DRENDER_QPOINTLIGHT_H
#define QT3DRENDER_QPOINTLIGHT_H
-#include <Qt3DRender/qlight.h>
+#include <Qt3DRender/qabstractlight.h>
QT_BEGIN_NAMESPACE
@@ -45,35 +48,34 @@ namespace Qt3DRender {
class QPointLightPrivate;
-class QT3DRENDERSHARED_EXPORT QPointLight : public QLight
+class QT3DRENDERSHARED_EXPORT QPointLight : public QAbstractLight
{
Q_OBJECT
- Q_PROPERTY(QVector3D attenuation READ attenuation WRITE setAttenuation NOTIFY attenuationChanged)
+ Q_PROPERTY(float constantAttenuation READ constantAttenuation WRITE setConstantAttenuation NOTIFY constantAttenuationChanged)
+ Q_PROPERTY(float linearAttenuation READ linearAttenuation WRITE setLinearAttenuation NOTIFY linearAttenuationChanged)
+ Q_PROPERTY(float quadraticAttenuation READ quadraticAttenuation WRITE setQuadraticAttenuation NOTIFY quadraticAttenuationChanged)
public:
- explicit QPointLight(Qt3DCore::QNode *parent = Q_NULLPTR);
-
- QVector3D attenuation() const;
+ explicit QPointLight(Qt3DCore::QNode *parent = nullptr);
+ ~QPointLight();
float constantAttenuation() const;
- void setConstantAttenuation(float value);
-
float linearAttenuation() const;
- void setLinearAttenuation(float value);
-
float quadraticAttenuation() const;
- void setQuadraticAttenuation(float value);
public Q_SLOTS:
- void setAttenuation(const QVector3D &value);
+ void setConstantAttenuation(float value);
+ void setLinearAttenuation(float value);
+ void setQuadraticAttenuation(float value);
Q_SIGNALS:
- void attenuationChanged(const QVector3D &attenuation);
+ void constantAttenuationChanged(float constantAttenuation);
+ void linearAttenuationChanged(float linearAttenuation);
+ void quadraticAttenuationChanged(float quadraticAttenuation);
protected:
Q_DECLARE_PRIVATE(QPointLight)
QPointLight(QPointLightPrivate &dd, Qt3DCore::QNode *parent);
- QT3D_CLONEABLE(QPointLight)
};
} // namespace Qt3DRender
diff --git a/src/render/lights/qpointlight_p.h b/src/render/lights/qpointlight_p.h
index b7fb561ce..978627fb7 100644
--- a/src/render/lights/qpointlight_p.h
+++ b/src/render/lights/qpointlight_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <private/qlight_p.h>
+#include <private/qabstractlight_p.h>
QT_BEGIN_NAMESPACE
@@ -56,12 +59,10 @@ namespace Qt3DRender {
class QPointLight;
-class QPointLightPrivate : public QLightPrivate
+class QPointLightPrivate : public QAbstractLightPrivate
{
public:
- QPointLightPrivate(QLight::Type type = QLight::PointLight);
-
- QVector3D m_attenuation;
+ QPointLightPrivate();
Q_DECLARE_PUBLIC(QPointLight)
};
diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp
index 8e115edd6..aa2c8c201 100644
--- a/src/render/lights/qspotlight.cpp
+++ b/src/render/lights/qspotlight.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "qspotlight.h"
#include "qspotlight_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -51,7 +54,7 @@ namespace Qt3DRender {
struct SpotLight
{
vec3 position;
- vec3 direction;
+ vec3 localDirection;
vec4 color;
float intensity;
float cutOffAngle;
@@ -63,10 +66,13 @@ namespace Qt3DRender {
*/
QSpotLightPrivate::QSpotLightPrivate()
- : QPointLightPrivate(QLight::SpotLight)
- , m_cutOffAngle(45.0f)
- , m_direction(0.0f, -1.0f, 0.0f)
+ : QAbstractLightPrivate(QAbstractLight::SpotLight)
{
+ m_shaderData->setProperty("constantAttenuation", 0.0f);
+ m_shaderData->setProperty("linearAttenuation", 0.0f);
+ m_shaderData->setProperty("quadraticAttenuation", 0.0f);
+ m_shaderData->setProperty("direction", QVector3D(0.0f, -1.0f, 0.0f));
+ m_shaderData->setProperty("cutOffAngle", 45.0f);
}
/*!
@@ -85,48 +91,85 @@ QSpotLightPrivate::QSpotLightPrivate()
\brief For OpenGL ...
*/
-/*! \fn void Qt3DRender::QSpotLight::copy(const Qt3DCore::QNode *ref)
- Copies the \a ref instance into this one.
- */
-
-void QSpotLight::copy(const QNode *ref)
-{
- const QSpotLight *light = static_cast<const QSpotLight*>(ref);
- d_func()->m_direction = light->d_func()->m_direction;
- d_func()->m_cutOffAngle = light->d_func()->m_cutOffAngle;
- QLight::copy(ref);
-}
-
-
/*!
\fn Qt3DRender::QSpotLight::QSpotLight(Qt3DCore::QNode *parent)
Constructs a new QSpotLight with the specified \a parent.
*/
QSpotLight::QSpotLight(QNode *parent)
- : QPointLight(*new QSpotLightPrivate, parent)
+ : QAbstractLight(*new QSpotLightPrivate, parent)
+{
+}
+
+/*! \internal */
+QSpotLight::~QSpotLight()
{
}
/*! \internal */
QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent)
- : QPointLight(dd, parent)
+ : QAbstractLight(dd, parent)
{
}
/*!
- \qmlproperty vector3d Qt3D.Render::SpotLight::direction
+ \qmlproperty vector3d Qt3D.Render::SpotLight::localDirection
*/
/*!
- \property Qt3DRender::QSpotLight::direction
+ \property Qt3DRender::QSpotLight::localDirection
*/
- QVector3D QSpotLight::direction() const
+float QSpotLight::constantAttenuation() const
+{
+ Q_D(const QSpotLight);
+ return d->m_shaderData->property("constantAttenuation").toFloat();
+}
+
+void QSpotLight::setConstantAttenuation(float value)
+{
+ Q_D(QSpotLight);
+ if (constantAttenuation() != value) {
+ d->m_shaderData->setProperty("constantAttenuation", value);
+ emit constantAttenuationChanged(value);
+ }
+}
+
+float QSpotLight::linearAttenuation() const
+{
+ Q_D(const QSpotLight);
+ return d->m_shaderData->property("linearAttenuation").toFloat();
+}
+
+void QSpotLight::setLinearAttenuation(float value)
+{
+ Q_D(QSpotLight);
+ if (linearAttenuation() != value) {
+ d->m_shaderData->setProperty("linearAttenuation", value);
+ emit linearAttenuationChanged(value);
+ }
+}
+
+float QSpotLight::quadraticAttenuation() const
+{
+ Q_D(const QSpotLight);
+ return d->m_shaderData->property("quadraticAttenuation").toFloat();
+}
+
+void QSpotLight::setQuadraticAttenuation(float value)
+{
+ Q_D(QSpotLight);
+ if (quadraticAttenuation() != value) {
+ d->m_shaderData->setProperty("quadraticAttenuation", value);
+ emit quadraticAttenuationChanged(value);
+ }
+}
+
+QVector3D QSpotLight::localDirection() const
{
Q_D(const QSpotLight);
- return d->m_direction;
+ return d->m_shaderData->property("direction").value<QVector3D>();
}
@@ -142,24 +185,24 @@ QSpotLight::QSpotLight(QSpotLightPrivate &dd, QNode *parent)
float QSpotLight::cutOffAngle() const
{
Q_D(const QSpotLight);
- return d->m_cutOffAngle;
+ return d->m_shaderData->property("cutOffAngle").toFloat();
}
-void QSpotLight::setDirection(const QVector3D &direction)
+void QSpotLight::setLocalDirection(const QVector3D &direction)
{
Q_D(QSpotLight);
- if (direction != d->m_direction) {
- d->m_direction = direction;
- emit directionChanged(direction);
+ if (localDirection() != direction) {
+ d->m_shaderData->setProperty("direction", direction);
+ emit localDirectionChanged(direction);
}
}
-void QSpotLight::setCutOffAngle(float cutOffAngle)
+void QSpotLight::setCutOffAngle(float value)
{
Q_D(QSpotLight);
- if (d->m_cutOffAngle != cutOffAngle) {
- d->m_cutOffAngle = cutOffAngle;
- emit cutOffAngleChanged(cutOffAngle);
+ if (cutOffAngle() != value) {
+ d->m_shaderData->setProperty("cutOffAngle", value);
+ emit cutOffAngleChanged(value);
}
}
diff --git a/src/render/lights/qspotlight.h b/src/render/lights/qspotlight.h
index dd19bc61c..8497740db 100644
--- a/src/render/lights/qspotlight.h
+++ b/src/render/lights/qspotlight.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DRENDER_QSPOTLIGHT_H
#define QT3DRENDER_QSPOTLIGHT_H
-#include <Qt3DRender/qpointlight.h>
+#include <Qt3DRender/qabstractlight.h>
QT_BEGIN_NAMESPACE
@@ -45,33 +48,46 @@ namespace Qt3DRender {
class QSpotLightPrivate;
-class QT3DRENDERSHARED_EXPORT QSpotLight : public QPointLight
+class QT3DRENDERSHARED_EXPORT QSpotLight : public QAbstractLight
{
Q_OBJECT
- Q_PROPERTY(QVector3D direction READ direction WRITE setDirection NOTIFY directionChanged)
+ Q_PROPERTY(float constantAttenuation READ constantAttenuation WRITE setConstantAttenuation NOTIFY constantAttenuationChanged)
+ Q_PROPERTY(float linearAttenuation READ linearAttenuation WRITE setLinearAttenuation NOTIFY linearAttenuationChanged)
+ Q_PROPERTY(float quadraticAttenuation READ quadraticAttenuation WRITE setQuadraticAttenuation NOTIFY quadraticAttenuationChanged)
+ Q_PROPERTY(QVector3D localDirection READ localDirection WRITE setLocalDirection NOTIFY localDirectionChanged)
Q_PROPERTY(float cutOffAngle READ cutOffAngle WRITE setCutOffAngle NOTIFY cutOffAngleChanged)
public:
- explicit QSpotLight(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QSpotLight(Qt3DCore::QNode *parent = nullptr);
+ ~QSpotLight();
- QVector3D direction() const;
+ QVector3D attenuation() const;
+ QVector3D localDirection() const;
float cutOffAngle() const;
+ float constantAttenuation() const;
+ float linearAttenuation() const;
+ float quadraticAttenuation() const;
+
public Q_SLOTS:
- void setDirection(const QVector3D &direction);
+ void setConstantAttenuation(float value);
+ void setLinearAttenuation(float value);
+ void setQuadraticAttenuation(float value);
+ void setLocalDirection(const QVector3D &localDirection);
void setCutOffAngle(float cutOffAngle);
Q_SIGNALS:
- void directionChanged(const QVector3D &direction);
+ void constantAttenuationChanged(float constantAttenuation);
+ void linearAttenuationChanged(float linearAttenuation);
+ void quadraticAttenuationChanged(float quadraticAttenuation);
+ void localDirectionChanged(const QVector3D &localDirection);
void cutOffAngleChanged(float cutOffAngle);
protected:
- QSpotLight(QSpotLightPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QSpotLight(QSpotLightPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QSpotLight)
- QT3D_CLONEABLE(QSpotLight)
};
} // namespace Qt3DRender
diff --git a/src/render/lights/qspotlight_p.h b/src/render/lights/qspotlight_p.h
index 38adcdc51..0bb0cb80f 100644
--- a/src/render/lights/qspotlight_p.h
+++ b/src/render/lights/qspotlight_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,20 +51,20 @@
// We mean it.
//
-#include <private/qpointlight_p.h>
+#include <private/qabstractlight_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QSpotLightPrivate : public QPointLightPrivate
+class QSpotLight;
+
+class QSpotLightPrivate : public QAbstractLightPrivate
{
public:
QSpotLightPrivate();
Q_DECLARE_PUBLIC(QSpotLight)
- float m_cutOffAngle;
- QVector3D m_direction;
};
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/annotation.cpp b/src/render/materialsystem/annotation.cpp
deleted file mode 100644
index ed0c6cea2..000000000
--- a/src/render/materialsystem/annotation.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "annotation_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-namespace Render {
-
-Annotation::Annotation()
- : QBackendNode()
-{
-}
-
-Annotation::~Annotation()
-{
- cleanup();
-}
-
-void Annotation::cleanup()
-{
-}
-
-void Annotation::updateFromPeer(Qt3DCore::QNode *peer)
-{
- QAnnotation *criterion = static_cast<QAnnotation *>(peer);
-
- m_value = criterion->value();
- m_name = criterion->name();
-}
-
-QVariant Annotation::criterionValue() const
-{
- return m_value;
-}
-
-QString Annotation::criterionName() const
-{
- return m_name;
-}
-
-void Annotation::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- if (propertyChange->propertyName() == QByteArrayLiteral("value"))
- m_value = propertyChange->value();
- else if (propertyChange->propertyName() == QByteArrayLiteral("name"))
- m_name = propertyChange->value().toString();
-}
-
-bool Annotation::operator ==(const Annotation &other)
-{
- if (&other == this)
- return true;
- return ((other.criterionName() == criterionName()) &&
- (other.criterionValue() == criterionValue()));
-}
-
-bool Annotation::operator !=(const Annotation &other)
-{
- return !operator ==(other);
-}
-
-} // namespace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/materialsystem/annotation_p.h b/src/render/materialsystem/annotation_p.h
deleted file mode 100644
index 4cb549d0c..000000000
--- a/src/render/materialsystem/annotation_p.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_RENDERANNOTATION_P_H
-#define QT3DRENDER_RENDER_RENDERANNOTATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/qannotation.h>
-#include <Qt3DCore/qbackendnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAnnotation;
-
-namespace Render {
-
-class CriterionManager;
-
-class Annotation : public Qt3DCore::QBackendNode
-{
-public:
- Annotation();
- ~Annotation();
- void cleanup();
- void updateFromPeer(Qt3DCore::QNode *criterion) Q_DECL_OVERRIDE;
-
- QVariant criterionValue() const;
- QString criterionName() const;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- bool operator ==(const Annotation &other);
- bool operator !=(const Annotation &other);
-
-private:
- QVariant m_value;
- QString m_name;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_RENDERANNOTATION_P_H
diff --git a/src/render/materialsystem/effect.cpp b/src/render/materialsystem/effect.cpp
index bc88f3c16..8e25e74fc 100644
--- a/src/render/materialsystem/effect.cpp
+++ b/src/render/materialsystem/effect.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,8 +41,11 @@
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/qeffect.h>
#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/private/qeffect_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <QVariant>
@@ -51,7 +57,7 @@ namespace Qt3DRender {
namespace Render {
Effect::Effect()
- : QBackendNode()
+ : BackendNode()
{
}
@@ -62,59 +68,58 @@ Effect::~Effect()
void Effect::cleanup()
{
+ QBackendNode::setEnabled(false);
}
-void Effect::updateFromPeer(Qt3DCore::QNode *peer)
+void Effect::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QEffect *effect = static_cast<QEffect *>(peer);
-
- m_techniques.clear();
- m_parameterPack.clear();
-
- Q_FOREACH (QTechnique *t, effect->techniques())
- appendRenderTechnique(t->id());
-
- Q_FOREACH (QParameter *p, effect->parameters())
- m_parameterPack.appendParameter(p->id());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QEffectData>>(change);
+ const auto &data = typedChange->data;
+ m_techniques = data.techniqueIds;
+ m_parameterPack.setParameters(data.parameterIds);
}
void Effect::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- QVariant propertyValue = propertyChange->value();
switch (e->type()) {
-
- case NodeAdded:
- if (propertyChange->propertyName() == QByteArrayLiteral("technique"))
- appendRenderTechnique(propertyValue.value<QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
- m_parameterPack.appendParameter(propertyValue.value<QNodeId>());
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("technique"))
+ appendRenderTechnique(change->addedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.appendParameter(change->addedNodeId());
break;
+ }
- case NodeRemoved:
- if (propertyChange->propertyName() == QByteArrayLiteral("technique"))
- m_techniques.removeOne(propertyValue.value<QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
- m_parameterPack.removeParameter(propertyValue.value<QNodeId>());
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("technique"))
+ m_techniques.removeOne(change->removedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.removeParameter(change->removedNodeId());
break;
+ }
- default :
+ default:
break;
}
+
+ markDirty(AbstractRenderer::AllDirty);
+ BackendNode::sceneChangeEvent(e);
}
-void Effect::appendRenderTechnique(const Qt3DCore::QNodeId &technique)
+void Effect::appendRenderTechnique(Qt3DCore::QNodeId technique)
{
if (!m_techniques.contains(technique))
m_techniques.append(technique);
}
-QList<Qt3DCore::QNodeId> Effect::techniques() const
+QVector<Qt3DCore::QNodeId> Effect::techniques() const
{
return m_techniques;
}
-QList<Qt3DCore::QNodeId> Effect::parameters() const
+QVector<Qt3DCore::QNodeId> Effect::parameters() const
{
return m_parameterPack.parameters();
}
diff --git a/src/render/materialsystem/effect_p.h b/src/render/materialsystem/effect_p.h
index 17214497f..50d470d8e 100644
--- a/src/render/materialsystem/effect_p.h
+++ b/src/render/materialsystem/effect_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,11 +51,9 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/qt3drender_global.h>
#include <Qt3DRender/private/parameterpack_p.h>
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
-#include <QList>
QT_BEGIN_NAMESPACE
@@ -62,22 +63,23 @@ class QTechnique;
namespace Render {
-class Effect : public Qt3DCore::QBackendNode
+class Effect : public BackendNode
{
public:
Effect();
~Effect();
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- void appendRenderTechnique(const Qt3DCore::QNodeId &t);
+ void appendRenderTechnique(Qt3DCore::QNodeId t);
- QList<Qt3DCore::QNodeId> techniques() const;
- QList<Qt3DCore::QNodeId> parameters() const;
+ QVector<Qt3DCore::QNodeId> techniques() const;
+ QVector<Qt3DCore::QNodeId> parameters() const;
private:
- QList<Qt3DCore::QNodeId> m_techniques;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVector<Qt3DCore::QNodeId> m_techniques;
ParameterPack m_parameterPack;
};
diff --git a/src/render/materialsystem/filterkey.cpp b/src/render/materialsystem/filterkey.cpp
new file mode 100644
index 000000000..db139f1fe
--- /dev/null
+++ b/src/render/materialsystem/filterkey.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "filterkey_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DRender/private/qfilterkey_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+namespace Render {
+
+FilterKey::FilterKey()
+ : BackendNode()
+{
+}
+
+FilterKey::~FilterKey()
+{
+ cleanup();
+}
+
+void FilterKey::cleanup()
+{
+}
+
+void FilterKey::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QFilterKeyData>>(change);
+ const auto &data = typedChange->data;
+ m_name = data.name;
+ m_value = data.value;
+}
+
+QVariant FilterKey::criterionValue() const
+{
+ return m_value;
+}
+
+QString FilterKey::criterionName() const
+{
+ return m_name;
+}
+
+void FilterKey::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ switch (e->type()) {
+ case PropertyUpdated: {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (propertyChange->propertyName() == QByteArrayLiteral("value"))
+ m_value = propertyChange->value();
+ else if (propertyChange->propertyName() == QByteArrayLiteral("name"))
+ m_name = propertyChange->value().toString();
+
+ markDirty(AbstractRenderer::AllDirty);
+ }
+
+ default:
+ break;
+ }
+ BackendNode::sceneChangeEvent(e);
+}
+
+bool FilterKey::operator ==(const FilterKey &other)
+{
+ if (&other == this)
+ return true;
+ return ((other.criterionName() == criterionName()) &&
+ (other.criterionValue() == criterionValue()));
+}
+
+bool FilterKey::operator !=(const FilterKey &other)
+{
+ return !operator ==(other);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/materialsystem/filterkey_p.h b/src/render/materialsystem/filterkey_p.h
new file mode 100644
index 000000000..8291e32f0
--- /dev/null
+++ b/src/render/materialsystem/filterkey_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_RENDERFILTERKEY_P_H
+#define QT3DRENDER_RENDER_RENDERFILTERKEY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/qfilterkey.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKey;
+
+namespace Render {
+
+class FilterKey : public BackendNode
+{
+public:
+ FilterKey();
+ ~FilterKey();
+ void cleanup();
+
+ QVariant criterionValue() const;
+ QString criterionName() const;
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+ bool operator ==(const FilterKey &other);
+ bool operator !=(const FilterKey &other);
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ QVariant m_value;
+ QString m_name;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERFILTERKEY_P_H
diff --git a/src/render/materialsystem/material.cpp b/src/render/materialsystem/material.cpp
index e3613f59f..f2abfb9ad 100644
--- a/src/render/materialsystem/material.cpp
+++ b/src/render/materialsystem/material.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,8 +45,11 @@
#include "qtechnique.h"
#include "qmaterial.h"
#include "qeffect.h"
+#include <Qt3DRender/private/qmaterial_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
using namespace Qt3DCore;
@@ -53,8 +59,7 @@ namespace Qt3DRender {
namespace Render {
Material::Material()
- : QBackendNode()
- , m_enabled(true)
+ : BackendNode()
{
}
@@ -65,54 +70,52 @@ Material::~Material()
void Material::cleanup()
{
+ QBackendNode::setEnabled(false);
m_parameterPack.clear();
}
-void Material::updateFromPeer(Qt3DCore::QNode *node)
+void Material::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QMaterial *mat = static_cast<QMaterial *>(node);
- m_parameterPack.clear();
- m_enabled = mat->isEnabled();
- if (mat->effect() != Q_NULLPTR)
- m_effectUuid = mat->effect()->id();
- Q_FOREACH (QParameter *p, mat->parameters())
- m_parameterPack.appendParameter(p->id());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QMaterialData>>(change);
+ const auto &data = typedChange->data;
+ m_effectUuid = data.effectId;
+ m_parameterPack.setParameters(data.parameterIds);
}
void Material::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
switch (e->type()) {
- case NodeUpdated: {
- if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- m_enabled = propertyChange->value().toBool();
- else if (propertyChange->propertyName() == QByteArrayLiteral("effect"))
- m_effectUuid = propertyChange->value().value<QNodeId>();
+ case PropertyUpdated: {
+ const auto change = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("effect"))
+ m_effectUuid = change->value().value<QNodeId>();
break;
}
- // Check for shader parameter
- case NodeAdded: {
- if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
- m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("effect"))
- m_effectUuid = propertyChange->value().value<QNodeId>();
+
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.appendParameter(change->addedNodeId());
break;
}
- case NodeRemoved: {
- if (propertyChange->propertyName() == QByteArrayLiteral("parameter"))
- m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>());
- else if (propertyChange->propertyName() == QByteArrayLiteral("effect"))
- m_effectUuid = QNodeId();
+
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.removeParameter(change->removedNodeId());
break;
}
default:
break;
}
+ markDirty(AbstractRenderer::AllDirty);
+
+ BackendNode::sceneChangeEvent(e);
}
-QList<Qt3DCore::QNodeId> Material::parameters() const
+QVector<Qt3DCore::QNodeId> Material::parameters() const
{
return m_parameterPack.parameters();
}
diff --git a/src/render/materialsystem/material_p.h b/src/render/materialsystem/material_p.h
index c9f54512c..b415e2975 100644
--- a/src/render/materialsystem/material_p.h
+++ b/src/render/materialsystem/material_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,9 +53,9 @@
#include <QVariant>
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/private/quniformvalue_p.h>
#include <Qt3DRender/private/parameterpack_p.h>
-#include <Qt3DCore/qbackendnode.h>
QT_BEGIN_NAMESPACE
@@ -69,24 +72,23 @@ class Technique;
class Effect;
class MaterialManager;
-class Q_AUTOTEST_EXPORT Material : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT Material : public BackendNode
{
public:
Material();
~Material();
void cleanup();
- void updateFromPeer(Qt3DCore::QNode* mat) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- inline bool isEnabled() const { return m_enabled; }
- QList<Qt3DCore::QNodeId> parameters() const;
+ QVector<Qt3DCore::QNodeId> parameters() const;
Qt3DCore::QNodeId effect() const;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
ParameterPack m_parameterPack;
Qt3DCore::QNodeId m_effectUuid;
- bool m_enabled;
};
} // namespace Render
diff --git a/src/render/materialsystem/materialsystem.pri b/src/render/materialsystem/materialsystem.pri
index 53f7e94f7..d24706161 100644
--- a/src/render/materialsystem/materialsystem.pri
+++ b/src/render/materialsystem/materialsystem.pri
@@ -1,21 +1,18 @@
INCLUDEPATH += $$PWD
HEADERS += \
- $$PWD/annotation_p.h \
+ $$PWD/filterkey_p.h \
$$PWD/effect_p.h \
$$PWD/material_p.h \
$$PWD/parameter_p.h \
- $$PWD/parametermapping_p.h \
- $$PWD/qannotation.h \
- $$PWD/qannotation_p.h \
+ $$PWD/qfilterkey.h \
+ $$PWD/qfilterkey_p.h \
$$PWD/qeffect.h \
$$PWD/qeffect_p.h \
$$PWD/qmaterial.h \
$$PWD/qmaterial_p.h \
$$PWD/qparameter.h \
$$PWD/qparameter_p.h \
- $$PWD/qparametermapping.h \
- $$PWD/qparametermapping_p.h \
$$PWD/qrenderpass_p.h \
$$PWD/qrenderpass.h \
$$PWD/qshaderdata.h \
@@ -28,19 +25,18 @@ HEADERS += \
$$PWD/shader_p.h \
$$PWD/shaderdata_p.h \
$$PWD/technique_p.h \
- $$PWD/qgraphicsapifilter.h
+ $$PWD/qgraphicsapifilter.h \
+ $$PWD/qgraphicsapifilter_p.h
SOURCES += \
- $$PWD/annotation.cpp \
+ $$PWD/filterkey.cpp \
$$PWD/effect.cpp \
$$PWD/material.cpp \
$$PWD/parameter.cpp \
- $$PWD/parametermapping.cpp \
- $$PWD/qannotation.cpp \
+ $$PWD/qfilterkey.cpp \
$$PWD/qeffect.cpp \
$$PWD/qmaterial.cpp \
$$PWD/qparameter.cpp \
- $$PWD/qparametermapping.cpp \
$$PWD/qrenderpass.cpp \
$$PWD/qshaderdata.cpp \
$$PWD/qshaderprogram.cpp \
diff --git a/src/render/materialsystem/parameter.cpp b/src/render/materialsystem/parameter.cpp
index fea400e0b..0f0a747ce 100644
--- a/src/render/materialsystem/parameter.cpp
+++ b/src/render/materialsystem/parameter.cpp
@@ -1,46 +1,53 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "parameter_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/private/qparameter_p.h>
#include <Qt3DRender/qtexture.h>
#include <Qt3DRender/qshaderdata.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/private/buffer_p.h>
#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/stringtoint_p.h>
QT_BEGIN_NAMESPACE
@@ -50,29 +57,35 @@ namespace Qt3DRender {
namespace Render {
Parameter::Parameter()
- : QBackendNode()
- , m_shaderDataManager(Q_NULLPTR)
- , m_textureManager(Q_NULLPTR)
+ : BackendNode()
+ , m_nameId(-1)
{
}
-void Parameter::updateFromPeer(Qt3DCore::QNode *mat)
+void Parameter::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QParameter *param = static_cast<QParameter *>(mat);
- m_name = param->name();
- m_value = toBackendValue(param->value());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QParameterData>>(change);
+ const auto &data = typedChange->data;
+ m_name = data.name;
+ m_nameId = StringToInt::lookupId(m_name);
+ m_value = data.backendValue;
}
void Parameter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
- if (e->type() == NodeUpdated) {
- if (propertyChange->propertyName() == QByteArrayLiteral("name"))
+ if (e->type() == PropertyUpdated) {
+ if (propertyChange->propertyName() == QByteArrayLiteral("name")) {
m_name = propertyChange->value().toString();
- else if (propertyChange->propertyName() == QByteArrayLiteral("value"))
- m_value = toBackendValue(propertyChange->value());
+ m_nameId = StringToInt::lookupId(m_name);
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("value")) {
+ m_value = propertyChange->value();
+ }
+ markDirty(AbstractRenderer::AllDirty);
}
+
+ BackendNode::sceneChangeEvent(e);
}
QString Parameter::name() const
@@ -85,30 +98,9 @@ QVariant Parameter::value() const
return m_value;
}
-void Parameter::setShaderDataManager(ShaderDataManager *shaderDataManager)
+int Parameter::nameId() const Q_DECL_NOEXCEPT
{
- m_shaderDataManager = shaderDataManager;
-}
-
-void Parameter::setTextureManager(TextureManager *textureManager)
-{
- m_textureManager = textureManager;
-}
-
-QVariant Parameter::toBackendValue(const QVariant &value)
-{
- QNode *node = value.value<QNode *>();
-
- if (node == Q_NULLPTR) {
- return value;
- } else if (qobject_cast<QAbstractTextureProvider*>(node)) {
- return QVariant::fromValue(static_cast<Texture*>(createBackendNode(node)));
- } else if (qobject_cast<QShaderData*>(node)) {
- return QVariant::fromValue(static_cast<ShaderData*>(createBackendNode(node)));
- } else {
- qFatal("Texture and ShaderData are the only types of Node allowed as parameters");
- return QVariant();
- }
+ return m_nameId;
}
} // namespace Render
diff --git a/src/render/materialsystem/parameter_p.h b/src/render/materialsystem/parameter_p.h
index a40af65ee..0f4f83a52 100644
--- a/src/render/materialsystem/parameter_p.h
+++ b/src/render/materialsystem/parameter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRender/private/backendnode_p.h>
#include <QVariant>
QT_BEGIN_NAMESPACE
@@ -61,28 +64,23 @@ class ParameterManager;
class ShaderDataManager;
class TextureManager;
-class Parameter : public Qt3DCore::QBackendNode
+class Parameter : public BackendNode
{
public:
Parameter();
- void updateFromPeer(Qt3DCore::QNode* mat) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
QString name() const;
QVariant value() const;
-
- void setShaderDataManager(ShaderDataManager *shaderDataManager);
- void setTextureManager(TextureManager *textureManager);
+ int nameId() const Q_DECL_NOEXCEPT;
private:
- QVariant toBackendValue(const QVariant &value);
-
- ShaderDataManager *m_shaderDataManager;
- TextureManager *m_textureManager;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
QString m_name;
QVariant m_value;
+ int m_nameId;
};
} // namespace Render
diff --git a/src/render/materialsystem/parametermapping.cpp b/src/render/materialsystem/parametermapping.cpp
deleted file mode 100644
index bc6ea8baf..000000000
--- a/src/render/materialsystem/parametermapping.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "parametermapping_p.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-namespace Render {
-
-ParameterMapping::ParameterMapping()
- : m_bindingType(QParameterMapping::Uniform)
-{
-}
-
-ParameterMapping::ParameterMapping(QParameterMapping *mapping)
- : m_id(mapping ? mapping->id() : Qt3DCore::QNodeId())
- , m_parameterName(mapping ? mapping->parameterName() : QString())
- , m_shaderVariableName(mapping ? mapping->shaderVariableName() : QString())
- , m_bindingType(mapping ? mapping->bindingType() : QParameterMapping::Uniform)
-{
-}
-
-bool ParameterMapping::isValid() const
-{
- return !m_id.isNull();
-}
-
-Qt3DCore::QNodeId ParameterMapping::id() const
-{
- return m_id;
-}
-
-QString ParameterMapping::parameterName() const
-{
- return m_parameterName;
-}
-
-QString ParameterMapping::shaderVariableName() const
-{
- return m_shaderVariableName;
-}
-
-QParameterMapping::Binding ParameterMapping::bindingType() const
-{
- return m_bindingType;
-}
-
-} // namespace Render
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/materialsystem/parametermapping_p.h b/src/render/materialsystem/parametermapping_p.h
deleted file mode 100644
index 4043c8dd1..000000000
--- a/src/render/materialsystem/parametermapping_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_RENDER_PARAMETERMAPPING_P_H
-#define QT3DRENDER_RENDER_PARAMETERMAPPING_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/qparametermapping.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-namespace Render {
-
-class Q_AUTOTEST_EXPORT ParameterMapping
-{
-public:
- ParameterMapping();
- ParameterMapping(QParameterMapping *mapping);
-
- bool isValid() const;
-
- Qt3DCore::QNodeId id() const;
- QString parameterName() const;
- QString shaderVariableName() const;
- QParameterMapping::Binding bindingType() const;
-
-private:
- Qt3DCore::QNodeId m_id;
- QString m_parameterName;
- QString m_shaderVariableName;
- QParameterMapping::Binding m_bindingType;
-};
-
-} // namespace Render
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_RENDER_PARAMETERMAPPING_P_H
diff --git a/src/render/materialsystem/qannotation.cpp b/src/render/materialsystem/qannotation.cpp
deleted file mode 100644
index c594c9392..000000000
--- a/src/render/materialsystem/qannotation.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qannotation.h"
-#include "qannotation_p.h"
-#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-
-QAnnotationPrivate::QAnnotationPrivate()
- : QNodePrivate()
-{
-}
-
-/*!
- \class Qt3DRender::QAnnotation
- \inmodule Qt3DRender
- \since 5.5
- \brief The QAnnotation class provides ...
-*/
-
-/*!
- \qmltype Annotation
- \instantiates Qt3DRender::QAnnotation
- \inherits Node
- \inqmlmodule Qt3D.Render
- \since 5.5
- \brief For annotating ...
-*/
-
-/*!
- Copies the annotation in \a ref into this annotation.
- */
-void QAnnotation::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QAnnotation *criterion = static_cast<const QAnnotation*>(ref);
- d_func()->m_name = criterion->d_func()->m_name;
- d_func()->m_value = criterion->d_func()->m_value;
-}
-
-/*!
- The constructor creats a new annotation under \a parent.
- */
-QAnnotation::QAnnotation(QNode *parent)
- : QNode(*new QAnnotationPrivate, parent)
-{
-}
-
-QAnnotation::~QAnnotation()
-{
- QNode::cleanup();
-}
-
-void QAnnotation::setValue(const QVariant &value)
-{
- Q_D(QAnnotation);
- if (value != d->m_value) {
- d->m_value = value;
- emit valueChanged(value);
- }
-}
-
-void QAnnotation::setName(const QString &name)
-{
- Q_D(QAnnotation);
- if (name != d->m_name) {
- d->m_name = name;
- emit nameChanged(name);
- }
-}
-
-/*!
- \property QAnnotation::value
-
-*/
-
-/*!
- \qmlproperty variant Qt3D.Render::Annotation::value
-*/
-
-QVariant QAnnotation::value() const
-{
- Q_D(const QAnnotation);
- return d->m_value;
-}
-
-/*!
- \property QAnnotation::name
-
- */
-
-/*!
- \qmlproperty string Qt3D.Render::Annotation::name
- */
-
-QString QAnnotation::name() const
-{
- Q_D(const QAnnotation);
- return d->m_name;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qannotation.h b/src/render/materialsystem/qannotation.h
deleted file mode 100644
index 2b16d26cd..000000000
--- a/src/render/materialsystem/qannotation.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QANNOTATION_H
-#define QT3DRENDER_QANNOTATION_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DCore/qnode.h>
-#include <QVariant>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAnnotationPrivate;
-
-class QT3DRENDERSHARED_EXPORT QAnnotation : public Qt3DCore::QNode
-{
- Q_OBJECT
- Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
- Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
-public:
- explicit QAnnotation(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QAnnotation();
-
- QVariant value() const;
- QString name() const;
-
-public Q_SLOTS:
- void setValue(const QVariant &value);
- void setName(const QString &customType);
-
-Q_SIGNALS:
- void nameChanged(const QString &name);
- void valueChanged(const QVariant &value);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QAnnotation)
- QT3D_CLONEABLE(QAnnotation)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QANNOTATION_H
diff --git a/src/render/materialsystem/qannotation_p.h b/src/render/materialsystem/qannotation_p.h
deleted file mode 100644
index c91a4df87..000000000
--- a/src/render/materialsystem/qannotation_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QANNOTATION_P_H
-#define QT3DRENDER_QANNOTATION_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DRender/qannotation.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAnnotationPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QAnnotationPrivate();
-
- Q_DECLARE_PUBLIC(QAnnotation)
- QString m_name;
- QVariant m_value;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QANNOTATION_P_H
diff --git a/src/render/materialsystem/qeffect.cpp b/src/render/materialsystem/qeffect.cpp
index c2832a011..b82875dd1 100644
--- a/src/render/materialsystem/qeffect.cpp
+++ b/src/render/materialsystem/qeffect.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,7 +42,9 @@
#include "qtechnique.h"
#include "qparameter.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -57,20 +62,9 @@ QEffect::QEffect(QNode *parent)
{
}
+/*! \internal */
QEffect::~QEffect()
{
- QNode::cleanup();
-}
-
-void QEffect::copy(const QNode* ref)
-{
- QNode::copy(ref);
- const QEffect *effect = static_cast<const QEffect*>(ref);
- Q_FOREACH (QParameter *p, effect->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-
- Q_FOREACH (QTechnique *t, effect->d_func()->m_techniques)
- addTechnique(qobject_cast<QTechnique *>(QNode::clone(t)));
}
/*! \internal */
@@ -82,7 +76,7 @@ QEffect::QEffect(QEffectPrivate &dd, QNode *parent)
void QEffect::addParameter(QParameter *parameter)
{
Q_D(QEffect);
- if (!d->m_parameters.contains(parameter)) {
+ if (parameter && !d->m_parameters.contains(parameter)) {
d->m_parameters.append(parameter);
// We need to add it as a child of the current node if it has been declared inline
@@ -92,10 +86,9 @@ void QEffect::addParameter(QParameter *parameter)
if (!parameter->parent())
parameter->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
}
@@ -105,16 +98,15 @@ void QEffect::removeParameter(QParameter *parameter)
{
Q_D(QEffect);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ if (parameter && d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
d->m_parameters.removeOne(parameter);
}
-QList<QParameter *> QEffect::parameters() const
+QVector<QParameter *> QEffect::parameters() const
{
Q_D(const QEffect);
return d->m_parameters;
@@ -129,7 +121,7 @@ void QEffect::addTechnique(QTechnique *t)
{
Q_ASSERT(t);
Q_D(QEffect);
- if (!d->m_techniques.contains(t)) {
+ if (t && !d->m_techniques.contains(t)) {
d->m_techniques.append(t);
// We need to add it as a child of the current node if it has been declared inline
@@ -139,11 +131,10 @@ void QEffect::addTechnique(QTechnique *t)
if (!t->parent())
t->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- e->setPropertyName("technique");
- e->setValue(QVariant::fromValue(t->id()));
- d->notifyObservers(e);
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), t);
+ change->setPropertyName("technique");
+ d->notifyObservers(change);
}
}
}
@@ -156,11 +147,10 @@ void QEffect::addTechnique(QTechnique *t)
void QEffect::removeTechnique(QTechnique *t)
{
Q_D(QEffect);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- e->setPropertyName("technique");
- e->setValue(QVariant::fromValue(t->id()));
- d->notifyObservers(e);
+ if (t && d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), t);
+ change->setPropertyName("technique");
+ d->notifyObservers(change);
}
d->m_techniques.removeOne(t);
}
@@ -168,12 +158,21 @@ void QEffect::removeTechnique(QTechnique *t)
/*!
* Returns the list of techniques used by the effect.
*/
-QList<QTechnique *> QEffect::techniques() const
+QVector<QTechnique *> QEffect::techniques() const
{
Q_D(const QEffect);
return d->m_techniques;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QEffect::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QEffectData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QEffect);
+ data.parameterIds = qIdsForNodes(d->m_parameters);
+ data.techniqueIds = qIdsForNodes(d->m_techniques);
+ return creationChange;
+}
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/qeffect.h b/src/render/materialsystem/qeffect.h
index 2a921b6fc..549003608 100644
--- a/src/render/materialsystem/qeffect.h
+++ b/src/render/materialsystem/qeffect.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,29 +51,27 @@ class QParameter;
class QTechnique;
class QEffectPrivate;
-class QT3DRENDERSHARED_EXPORT QEffect
- : public Qt3DCore::QNode
+class QT3DRENDERSHARED_EXPORT QEffect : public Qt3DCore::QNode
{
Q_OBJECT
public:
- explicit QEffect(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QEffect(Qt3DCore::QNode *parent = nullptr);
~QEffect();
void addParameter(QParameter *parameter);
void removeParameter(QParameter *parameter);
- QList<QParameter *> parameters() const;
+ QVector<QParameter *> parameters() const;
- virtual void addTechnique(QTechnique *t);
- virtual void removeTechnique(QTechnique *t);
- QList<QTechnique *> techniques() const;
+ void addTechnique(QTechnique *t);
+ void removeTechnique(QTechnique *t);
+ QVector<QTechnique *> techniques() const;
protected:
- QEffect(QEffectPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QEffect(QEffectPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QEffect)
- QT3D_CLONEABLE(QEffect)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/qeffect_p.h b/src/render/materialsystem/qeffect_p.h
index 49297767e..716bb76de 100644
--- a/src/render/materialsystem/qeffect_p.h
+++ b/src/render/materialsystem/qeffect_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,8 +68,14 @@ public :
QEffectPrivate();
Q_DECLARE_PUBLIC(QEffect)
- QList<QParameter *> m_parameters;
- QList<QTechnique *> m_techniques;
+ QVector<QParameter *> m_parameters;
+ QVector<QTechnique *> m_techniques;
+};
+
+struct QEffectData
+{
+ Qt3DCore::QNodeIdVector parameterIds;
+ Qt3DCore::QNodeIdVector techniqueIds;
};
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/qfilterkey.cpp b/src/render/materialsystem/qfilterkey.cpp
new file mode 100644
index 000000000..edf96314c
--- /dev/null
+++ b/src/render/materialsystem/qfilterkey.cpp
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qfilterkey.h"
+#include "qfilterkey_p.h"
+#include <private/qnode_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+
+QFilterKeyPrivate::QFilterKeyPrivate()
+ : QNodePrivate()
+{
+}
+
+/*!
+ \class Qt3DRender::QFilterKey
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief The QFilterKey class provides ...
+*/
+
+/*!
+ \qmltype Annotation
+ \instantiates Qt3DRender::QFilterKey
+ \inherits Node
+ \inqmlmodule Qt3D.Render
+ \since 5.5
+ \brief For annotating ...
+*/
+
+/*!
+ The constructor creats a new annotation under \a parent.
+ */
+QFilterKey::QFilterKey(QNode *parent)
+ : QNode(*new QFilterKeyPrivate, parent)
+{
+}
+
+/*! \internal */
+QFilterKey::~QFilterKey()
+{
+}
+
+void QFilterKey::setValue(const QVariant &value)
+{
+ Q_D(QFilterKey);
+ if (value != d->m_value) {
+ d->m_value = value;
+ emit valueChanged(value);
+ }
+}
+
+void QFilterKey::setName(const QString &name)
+{
+ Q_D(QFilterKey);
+ if (name != d->m_name) {
+ d->m_name = name;
+ emit nameChanged(name);
+ }
+}
+
+/*!
+ \property QFilterKey::value
+
+*/
+
+/*!
+ \qmlproperty variant Qt3D.Render::Annotation::value
+*/
+
+QVariant QFilterKey::value() const
+{
+ Q_D(const QFilterKey);
+ return d->m_value;
+}
+
+/*!
+ \property QFilterKey::name
+
+ */
+
+/*!
+ \qmlproperty string Qt3D.Render::Annotation::name
+ */
+
+QString QFilterKey::name() const
+{
+ Q_D(const QFilterKey);
+ return d->m_name;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QFilterKey::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QFilterKeyData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QFilterKey);
+ data.name = d->m_name;
+ data.value = d->m_value;
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qfilterkey.h b/src/render/materialsystem/qfilterkey.h
new file mode 100644
index 000000000..16db2a9e8
--- /dev/null
+++ b/src/render/materialsystem/qfilterkey.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QFILTERKEY_H
+#define QT3DRENDER_QFILTERKEY_H
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DCore/qnode.h>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKeyPrivate;
+
+class QT3DRENDERSHARED_EXPORT QFilterKey : public Qt3DCore::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+public:
+ explicit QFilterKey(Qt3DCore::QNode *parent = nullptr);
+ ~QFilterKey();
+
+ QVariant value() const;
+ QString name() const;
+
+public Q_SLOTS:
+ void setValue(const QVariant &value);
+ void setName(const QString &customType);
+
+Q_SIGNALS:
+ void nameChanged(const QString &name);
+ void valueChanged(const QVariant &value);
+
+private:
+ Q_DECLARE_PRIVATE(QFilterKey)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QFILTERKEY_H
diff --git a/src/render/materialsystem/qfilterkey_p.h b/src/render/materialsystem/qfilterkey_p.h
new file mode 100644
index 000000000..3a9855f08
--- /dev/null
+++ b/src/render/materialsystem/qfilterkey_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QFILTERKEY_P_H
+#define QT3DRENDER_QFILTERKEY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DRender/qfilterkey.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFilterKeyPrivate : public Qt3DCore::QNodePrivate
+{
+public:
+ QFilterKeyPrivate();
+
+ Q_DECLARE_PUBLIC(QFilterKey)
+ QString m_name;
+ QVariant m_value;
+};
+
+struct QFilterKeyData
+{
+ QString name;
+ QVariant value;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QFILTERKEY_P_H
diff --git a/src/render/materialsystem/qgraphicsapifilter.cpp b/src/render/materialsystem/qgraphicsapifilter.cpp
index 8a8155ca4..7248b252f 100644
--- a/src/render/materialsystem/qgraphicsapifilter.cpp
+++ b/src/render/materialsystem/qgraphicsapifilter.cpp
@@ -1,40 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qgraphicsapifilter.h"
+#include "qgraphicsapifilter_p.h"
#include "private/qobject_p.h"
#include <QOpenGLContext>
@@ -42,26 +46,40 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QGraphicsApiFilterPrivate : public QObjectPrivate
+GraphicsApiFilterData::GraphicsApiFilterData()
+ : m_api(QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL ? QGraphicsApiFilter::OpenGL : QGraphicsApiFilter::OpenGLES)
+ , m_profile(QGraphicsApiFilter::NoProfile) // matches all (no profile, core, compat)
+ , m_minor(0)
+ , m_major(0)
+{}
+
+bool GraphicsApiFilterData::operator ==(const GraphicsApiFilterData &other) const
{
-public:
- QGraphicsApiFilterPrivate()
- : QObjectPrivate()
- , m_api(QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL ? QGraphicsApiFilter::OpenGL : QGraphicsApiFilter::OpenGLES)
- , m_profile(QGraphicsApiFilter::NoProfile) // matches all (no profile, core, compat)
- , m_minor(0)
- , m_major(0)
- {
+ if (other.m_api == m_api
+ && other.m_profile <= m_profile
+ && (other.m_major < m_major
+ || (other.m_major == m_major && other.m_minor <= m_minor))) {
+ for (const QString &neededExt : other.m_extensions)
+ if (!m_extensions.contains(neededExt))
+ return false;
+ // If a vendor name was specified in sample, we perform comparison,
+ // otherwise we assume the vendor name doesn't matter
+ if (!other.m_vendor.isEmpty())
+ return (other.m_vendor == m_vendor);
+ return true;
}
+ return false;
+}
+
+bool GraphicsApiFilterData::operator !=(const GraphicsApiFilterData &other) const
+{
+ return !(*this == other);
+}
- Q_DECLARE_PUBLIC(QGraphicsApiFilter)
- QGraphicsApiFilter::Api m_api;
- QGraphicsApiFilter::Profile m_profile;
- int m_minor;
- int m_major;
- QStringList m_extensions;
- QString m_vendor;
-};
+QGraphicsApiFilterPrivate *QGraphicsApiFilterPrivate::get(QGraphicsApiFilter *q)
+{
+ return q->d_func();
+}
/*!
\class Qt3DRender::QGraphicsApiFilter
@@ -87,18 +105,9 @@ QGraphicsApiFilter::QGraphicsApiFilter(QObject *parent)
{
}
-/*! \fn void Qt3DRender::QGraphicsApiFilter::copy(const QGraphicsApiFilter &ref)
- Copies the \a ref instance into this one.
- */
-void QGraphicsApiFilter::copy(const QGraphicsApiFilter &ref)
+/*! \internal */
+QGraphicsApiFilter::~QGraphicsApiFilter()
{
- Q_D(QGraphicsApiFilter);
- d->m_api = ref.api();
- d->m_profile = ref.profile();
- d->m_major = ref.majorVersion();
- d->m_minor = ref.minorVersion();
- d->m_extensions = ref.extensions();
- d->m_vendor = ref.vendor();
}
/*!
@@ -134,7 +143,7 @@ void QGraphicsApiFilter::copy(const QGraphicsApiFilter &ref)
QGraphicsApiFilter::Api QGraphicsApiFilter::api() const
{
Q_D(const QGraphicsApiFilter);
- return d->m_api;
+ return d->m_data.m_api;
}
/*!
@@ -150,10 +159,10 @@ QGraphicsApiFilter::Api QGraphicsApiFilter::api() const
\value CompatibilityProfile QSurfaceFormat::CompatibilityProfile
*/
-QGraphicsApiFilter::Profile QGraphicsApiFilter::profile() const
+QGraphicsApiFilter::OpenGLProfile QGraphicsApiFilter::profile() const
{
Q_D(const QGraphicsApiFilter);
- return d->m_profile;
+ return d->m_data.m_profile;
}
/*!
@@ -169,7 +178,7 @@ QGraphicsApiFilter::Profile QGraphicsApiFilter::profile() const
int QGraphicsApiFilter::minorVersion() const
{
Q_D(const QGraphicsApiFilter);
- return d->m_minor;
+ return d->m_data.m_minor;
}
/*!
@@ -185,7 +194,7 @@ int QGraphicsApiFilter::minorVersion() const
int QGraphicsApiFilter::majorVersion() const
{
Q_D(const QGraphicsApiFilter);
- return d->m_major;
+ return d->m_data.m_major;
}
/*!
@@ -201,7 +210,7 @@ int QGraphicsApiFilter::majorVersion() const
QStringList QGraphicsApiFilter::extensions() const
{
Q_D(const QGraphicsApiFilter);
- return d->m_extensions;
+ return d->m_data.m_extensions;
}
/*!
@@ -217,24 +226,24 @@ QStringList QGraphicsApiFilter::extensions() const
QString QGraphicsApiFilter::vendor() const
{
Q_D(const QGraphicsApiFilter);
- return d->m_vendor;
+ return d->m_data.m_vendor;
}
void QGraphicsApiFilter::setApi(QGraphicsApiFilter::Api api)
{
Q_D(QGraphicsApiFilter);
- if (d->m_api != api) {
- d->m_api = api;
+ if (d->m_data.m_api != api) {
+ d->m_data.m_api = api;
emit apiChanged(api);
emit graphicsApiFilterChanged();
}
}
-void QGraphicsApiFilter::setProfile(QGraphicsApiFilter::Profile profile)
+void QGraphicsApiFilter::setProfile(QGraphicsApiFilter::OpenGLProfile profile)
{
Q_D(QGraphicsApiFilter);
- if (d->m_profile != profile) {
- d->m_profile = profile;
+ if (d->m_data.m_profile != profile) {
+ d->m_data.m_profile = profile;
emit profileChanged(profile);
emit graphicsApiFilterChanged();
}
@@ -243,8 +252,8 @@ void QGraphicsApiFilter::setProfile(QGraphicsApiFilter::Profile profile)
void QGraphicsApiFilter::setMinorVersion(int minorVersion)
{
Q_D(QGraphicsApiFilter);
- if (minorVersion != d->m_minor) {
- d->m_minor = minorVersion;
+ if (minorVersion != d->m_data.m_minor) {
+ d->m_data.m_minor = minorVersion;
emit minorVersionChanged(minorVersion);
emit graphicsApiFilterChanged();
}
@@ -253,8 +262,8 @@ void QGraphicsApiFilter::setMinorVersion(int minorVersion)
void QGraphicsApiFilter::setMajorVersion(int majorVersion)
{
Q_D(QGraphicsApiFilter);
- if (d->m_major != majorVersion) {
- d->m_major = majorVersion;
+ if (d->m_data.m_major != majorVersion) {
+ d->m_data.m_major = majorVersion;
emit majorVersionChanged(majorVersion);
emit graphicsApiFilterChanged();
}
@@ -263,8 +272,8 @@ void QGraphicsApiFilter::setMajorVersion(int majorVersion)
void QGraphicsApiFilter::setExtensions(const QStringList &extensions)
{
Q_D(QGraphicsApiFilter);
- if (d->m_extensions != extensions) {
- d->m_extensions = extensions;
+ if (d->m_data.m_extensions != extensions) {
+ d->m_data.m_extensions = extensions;
emit extensionsChanged(extensions);
emit graphicsApiFilterChanged();
}
@@ -273,8 +282,8 @@ void QGraphicsApiFilter::setExtensions(const QStringList &extensions)
void QGraphicsApiFilter::setVendor(const QString &vendor)
{
Q_D(QGraphicsApiFilter);
- if (d->m_vendor != vendor) {
- d->m_vendor = vendor;
+ if (d->m_data.m_vendor != vendor) {
+ d->m_data.m_vendor = vendor;
emit vendorChanged(vendor);
emit graphicsApiFilterChanged();
}
@@ -287,20 +296,8 @@ void QGraphicsApiFilter::setVendor(const QString &vendor)
*/
bool operator ==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
{
- if (sample.api() == reference.api()
- && sample.profile() <= reference.profile()
- && (sample.majorVersion() < reference.majorVersion()
- || (sample.majorVersion() == reference.majorVersion() && sample.minorVersion() <= reference.minorVersion()))) {
- Q_FOREACH (const QString &neededExt, sample.extensions())
- if (!reference.extensions().contains(neededExt))
- return false;
- // If a vendor name was specified in sample, we perform comparison,
- // otherwise we assume the vendor name doesn't matter
- if (!sample.vendor().isEmpty())
- return (sample.vendor() == reference.vendor());
- return true;
- }
- return false;
+ return QGraphicsApiFilterPrivate::get(const_cast<QGraphicsApiFilter *>(&reference))->m_data ==
+ QGraphicsApiFilterPrivate::get(const_cast<QGraphicsApiFilter *>(&sample))->m_data;
}
/*! \fn bool Qt3DRender::operator !=(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
diff --git a/src/render/materialsystem/qgraphicsapifilter.h b/src/render/materialsystem/qgraphicsapifilter.h
index 93981a79f..d09c2f753 100644
--- a/src/render/materialsystem/qgraphicsapifilter.h
+++ b/src/render/materialsystem/qgraphicsapifilter.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,7 +55,7 @@ class QT3DRENDERSHARED_EXPORT QGraphicsApiFilter : public QObject
{
Q_OBJECT
Q_PROPERTY(Qt3DRender::QGraphicsApiFilter::Api api READ api WRITE setApi NOTIFY apiChanged)
- Q_PROPERTY(Qt3DRender::QGraphicsApiFilter::Profile profile READ profile WRITE setProfile NOTIFY profileChanged)
+ Q_PROPERTY(Qt3DRender::QGraphicsApiFilter::OpenGLProfile profile READ profile WRITE setProfile NOTIFY profileChanged)
Q_PROPERTY(int minorVersion READ minorVersion WRITE setMinorVersion NOTIFY minorVersionChanged)
Q_PROPERTY(int majorVersion READ majorVersion WRITE setMajorVersion NOTIFY majorVersionChanged)
Q_PROPERTY(QStringList extensions READ extensions WRITE setExtensions NOTIFY extensionsChanged)
@@ -60,27 +63,24 @@ class QT3DRENDERSHARED_EXPORT QGraphicsApiFilter : public QObject
public:
- enum Api
- {
+ enum Api {
OpenGLES = QSurfaceFormat::OpenGLES,
OpenGL = QSurfaceFormat::OpenGL
};
Q_ENUM(Api)
- enum Profile
- {
+ enum OpenGLProfile {
NoProfile = QSurfaceFormat::NoProfile,
CoreProfile = QSurfaceFormat::CoreProfile,
CompatibilityProfile = QSurfaceFormat::CompatibilityProfile
};
- Q_ENUM(Profile)
+ Q_ENUM(OpenGLProfile)
- explicit QGraphicsApiFilter(QObject *parent = Q_NULLPTR);
-
- void copy(const QGraphicsApiFilter &ref);
+ explicit QGraphicsApiFilter(QObject *parent = nullptr);
+ ~QGraphicsApiFilter();
Api api() const;
- Profile profile() const;
+ OpenGLProfile profile() const;
int minorVersion() const;
int majorVersion() const;
QStringList extensions() const;
@@ -88,7 +88,7 @@ public:
public Q_SLOTS:
void setApi(Api api);
- void setProfile(Profile profile);
+ void setProfile(OpenGLProfile profile);
void setMinorVersion(int minorVersion);
void setMajorVersion(int majorVersion);
void setExtensions(const QStringList &extensions);
@@ -96,7 +96,7 @@ public Q_SLOTS:
Q_SIGNALS:
void apiChanged(Api api);
- void profileChanged(Profile profile);
+ void profileChanged(OpenGLProfile profile);
void minorVersionChanged(int minorVersion);
void majorVersionChanged(int majorVersion);
void extensionsChanged(const QStringList &extensions);
diff --git a/src/render/materialsystem/qgraphicsapifilter_p.h b/src/render/materialsystem/qgraphicsapifilter_p.h
new file mode 100644
index 000000000..928f97b8e
--- /dev/null
+++ b/src/render/materialsystem/qgraphicsapifilter_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QGRAPHICSAPIFILTER_P_H
+#define QT3DRENDER_QGRAPHICSAPIFILTER_P_H
+
+#include <private/qobject_p.h>
+#include <Qt3DRender/qgraphicsapifilter.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+struct GraphicsApiFilterData
+{
+ GraphicsApiFilterData();
+
+ QGraphicsApiFilter::Api m_api;
+ QGraphicsApiFilter::OpenGLProfile m_profile;
+ int m_minor;
+ int m_major;
+ QStringList m_extensions;
+ QString m_vendor;
+
+ bool operator ==(const GraphicsApiFilterData &other) const;
+ bool operator !=(const GraphicsApiFilterData &other) const;
+};
+
+class QGraphicsApiFilterPrivate : public QObjectPrivate
+{
+public:
+ QGraphicsApiFilterPrivate()
+ : QObjectPrivate()
+ {
+ }
+
+ static QGraphicsApiFilterPrivate *get(QGraphicsApiFilter *q);
+
+ Q_DECLARE_PUBLIC(QGraphicsApiFilter)
+ GraphicsApiFilterData m_data;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::GraphicsApiFilterData);
+
+#endif // QT3DRENDER_QGRAPHICSAPIFILTER_P_H
diff --git a/src/render/materialsystem/qmaterial.cpp b/src/render/materialsystem/qmaterial.cpp
index cce898616..644c11b4d 100644
--- a/src/render/materialsystem/qmaterial.cpp
+++ b/src/render/materialsystem/qmaterial.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,7 +43,9 @@
#include "qeffect.h"
#include <Qt3DRender/private/renderlogging_p.h>
#include "qparameter.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
/*!
* \qmltype Material
@@ -75,21 +80,12 @@ namespace Qt3DRender {
QMaterialPrivate::QMaterialPrivate()
: QComponentPrivate()
- , m_effect(Q_NULLPTR)
+ , m_effect(nullptr)
{
}
-void QMaterial::copy(const QNode *ref)
+QMaterialPrivate::~QMaterialPrivate()
{
- QComponent::copy(ref);
- const QMaterial *material = static_cast<const QMaterial*>(ref);
- Q_FOREACH (QParameter *p, material->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-
- // TO DO: We may want to copy the node id of the effect and only send a clone
- // when we are the parent of the effect
- if (material->d_func()->m_effect && material->d_func()->m_effect->parent() == ref)
- setEffect(qobject_cast<QEffect *>(QNode::clone(material->d_func()->m_effect)));
}
QMaterial::QMaterial(QNode *parent)
@@ -97,9 +93,9 @@ QMaterial::QMaterial(QNode *parent)
{
}
+/*! \internal */
QMaterial::~QMaterial()
{
- QNode::cleanup();
}
/*! \internal */
@@ -138,6 +134,7 @@ QEffect *QMaterial::effect() const
void QMaterial::addParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QMaterial);
if (!d->m_parameters.contains(parameter)) {
d->m_parameters.append(parameter);
@@ -149,10 +146,9 @@ void QMaterial::addParameter(QParameter *parameter)
if (!parameter->parent())
parameter->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
}
@@ -160,33 +156,30 @@ void QMaterial::addParameter(QParameter *parameter)
void QMaterial::removeParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QMaterial);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
d->m_parameters.removeOne(parameter);
}
-QList<QParameter *> QMaterial::parameters() const
+QVector<QParameter *> QMaterial::parameters() const
{
Q_D(const QMaterial);
return d->m_parameters;
}
-TextureDict QMaterial::textureValues() const
+Qt3DCore::QNodeCreatedChangeBasePtr QMaterial::createNodeCreationChange() const
{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QMaterialData>::create(this);
+ auto &data = creationChange->data;
Q_D(const QMaterial);
- return d->m_textures;
-}
-
-// TO DO: Check if this is really needed
-void QMaterial::setTextureParameter(QString name, QAbstractTextureProvider *tex)
-{
- Q_D(QMaterial);
- d->m_textures[name] = tex;
+ data.parameterIds = qIdsForNodes(d->m_parameters);
+ data.effectId = qIdForNode(d->m_effect);
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/qmaterial.h b/src/render/materialsystem/qmaterial.h
index 381e72ad1..e11d30e5c 100644
--- a/src/render/materialsystem/qmaterial.h
+++ b/src/render/materialsystem/qmaterial.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -46,11 +49,10 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAbstractTextureProvider;
+class QAbstractTexture;
class QParameter;
class QMaterialPrivate;
class QEffect;
-typedef QMap<QString, QAbstractTextureProvider*> TextureDict;
class QT3DRENDERSHARED_EXPORT QMaterial : public Qt3DCore::QComponent
{
@@ -58,18 +60,14 @@ class QT3DRENDERSHARED_EXPORT QMaterial : public Qt3DCore::QComponent
Q_PROPERTY(Qt3DRender::QEffect *effect READ effect WRITE setEffect NOTIFY effectChanged)
public:
- explicit QMaterial(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QMaterial(Qt3DCore::QNode *parent = nullptr);
~QMaterial();
QEffect *effect() const;
void addParameter(QParameter *parameter);
void removeParameter(QParameter *parameter);
- QList<QParameter *> parameters() const;
-
- TextureDict textureValues() const;
-
- void setTextureParameter(QString name, QAbstractTextureProvider* tex);
+ QVector<QParameter *> parameters() const;
public Q_SLOTS:
void setEffect(QEffect *effect);
@@ -78,12 +76,11 @@ Q_SIGNALS:
void effectChanged(QEffect *effect);
protected:
- QMaterial(QMaterialPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QMaterial(QMaterialPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QMaterial)
- QT3D_CLONEABLE(QMaterial)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
}
diff --git a/src/render/materialsystem/qmaterial_p.h b/src/render/materialsystem/qmaterial_p.h
index 02bfd2b6d..9fb8d5de9 100644
--- a/src/render/materialsystem/qmaterial_p.h
+++ b/src/render/materialsystem/qmaterial_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,6 +51,7 @@
// We mean it.
//
+#include <Qt3DRender/private/qt3drender_global_p.h>
#include <private/qcomponent_p.h>
QT_BEGIN_NAMESPACE
@@ -57,17 +61,23 @@ namespace Qt3DRender {
class QParameter;
class QEffect;
-class QMaterialPrivate : public Qt3DCore::QComponentPrivate
+class QT3DRENDERSHARED_PRIVATE_EXPORT QMaterialPrivate : public Qt3DCore::QComponentPrivate
{
public:
QMaterialPrivate();
+ ~QMaterialPrivate();
Q_DECLARE_PUBLIC(QMaterial)
- QList<QParameter *> m_parameters;
- TextureDict m_textures;
+ QVector<QParameter *> m_parameters;
QEffect *m_effect;
};
+struct QMaterialData
+{
+ Qt3DCore::QNodeIdVector parameterIds;
+ Qt3DCore::QNodeId effectId;
+};
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qparameter.cpp b/src/render/materialsystem/qparameter.cpp
index 321432006..ae5981f5e 100644
--- a/src/render/materialsystem/qparameter.cpp
+++ b/src/render/materialsystem/qparameter.cpp
@@ -1,43 +1,46 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qparameter.h"
+#include "qparameter_p.h"
#include <Qt3DRender/private/renderlogging_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <private/qparameter_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qtexture.h>
QT_BEGIN_NAMESPACE
@@ -53,17 +56,14 @@ QParameterPrivate::QParameterPrivate()
void QParameterPrivate::setValue(const QVariant &v)
{
+ Qt3DCore::QNode *nodeValue = v.value<Qt3DCore::QNode *>();
+ if (nodeValue != nullptr)
+ m_backendValue = QVariant::fromValue(nodeValue->id());
+ else
+ m_backendValue = v;
m_value = v;
}
-void QParameter::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QParameter *param = static_cast<const QParameter*>(ref);
- d_func()->m_name = param->d_func()->m_name;
- d_func()->m_value = param->d_func()->m_value;
-}
-
/*! \internal */
QParameter::QParameter(QParameterPrivate &dd, QNode *parent)
: QNode(dd, parent)
@@ -75,11 +75,6 @@ QParameter::QParameter(QNode *parent)
{
}
-QParameter::~QParameter()
-{
- QNode::cleanup();
-}
-
QParameter::QParameter(const QString &name, const QVariant &value, QNode *parent)
: QNode(*new QParameterPrivate, parent)
{
@@ -88,7 +83,7 @@ QParameter::QParameter(const QString &name, const QVariant &value, QNode *parent
setValue(value);
}
-QParameter::QParameter(const QString &name, QAbstractTextureProvider *texture, QNode *parent)
+QParameter::QParameter(const QString &name, QAbstractTexture *texture, QNode *parent)
: QNode(*new QParameterPrivate, parent)
{
Q_D(QParameter);
@@ -96,6 +91,10 @@ QParameter::QParameter(const QString &name, QAbstractTextureProvider *texture, Q
setValue(QVariant::fromValue(texture));
}
+/*! \internal */
+QParameter::~QParameter()
+{
+}
void QParameter::setName(const QString &name)
{
@@ -116,22 +115,14 @@ void QParameter::setValue(const QVariant &dv)
{
Q_D(QParameter);
if (d->m_value != dv) {
- d->setValue(dv);
- emit valueChanged(dv);
- // In case texture are declared inline
- QNode *txt = dv.value<QNode *>();
- if (txt != Q_NULLPTR && !txt->parent())
- txt->setParent(this);
+ // In case node values are declared inline
+ QNode *nodeValue = dv.value<QNode *>();
+ if (nodeValue != nullptr && !nodeValue->parent())
+ nodeValue->setParent(this);
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
- change->setPropertyName(d->m_name.toUtf8().data());
- if (txt != Q_NULLPTR)
- change->setValue(QVariant::fromValue(QNode::clone(txt)));
- else
- change->setValue(d->m_value);
-
- d->notifyObservers(change);
+ d->setValue(dv);
+ emit valueChanged(dv);
}
}
@@ -141,6 +132,16 @@ QVariant QParameter::value() const
return d->m_value;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QParameter::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QParameterData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QParameter);
+ data.name = d->m_name;
+ data.backendValue = d->m_backendValue;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qparameter.h b/src/render/materialsystem/qparameter.h
index 579452cab..c742b5e22 100644
--- a/src/render/materialsystem/qparameter.h
+++ b/src/render/materialsystem/qparameter.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -46,7 +49,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QParameterPrivate;
-class QAbstractTextureProvider;
+class QAbstractTexture;
class QT3DRENDERSHARED_EXPORT QParameter : public Qt3DCore::QNode
{
@@ -55,17 +58,12 @@ class QT3DRENDERSHARED_EXPORT QParameter : public Qt3DCore::QNode
Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
public:
- explicit QParameter(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QParameter(Qt3DCore::QNode *parent = nullptr);
+ explicit QParameter(const QString &name, const QVariant& value, Qt3DCore::QNode *parent = nullptr);
+ explicit QParameter(const QString &name, QAbstractTexture *texture, Qt3DCore::QNode *parent = nullptr);
~QParameter();
- QParameter(const QString &name, const QVariant& value, Qt3DCore::QNode *parent = Q_NULLPTR);
- QParameter(const QString &name, QAbstractTextureProvider *texture, Qt3DCore::QNode *parent = Q_NULLPTR);
QString name() const;
-
- /**
- * @brief setDefaultValue - for non-texture uniform parameters
- * @param dv
- */
QVariant value() const;
public Q_SLOTS:
@@ -77,12 +75,11 @@ Q_SIGNALS:
void nameChanged(const QString &name);
protected:
- QParameter(QParameterPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ QParameter(QParameterPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QParameter)
- QT3D_CLONEABLE(QParameter)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/qparameter_p.h b/src/render/materialsystem/qparameter_p.h
index 96db66b7a..a56a63af4 100644
--- a/src/render/materialsystem/qparameter_p.h
+++ b/src/render/materialsystem/qparameter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -68,7 +71,13 @@ public:
QString m_name;
QVariant m_value;
- QString m_meshName;
+ QVariant m_backendValue;
+};
+
+struct QParameterData
+{
+ QString name;
+ QVariant backendValue;
};
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/qparametermapping.cpp b/src/render/materialsystem/qparametermapping.cpp
deleted file mode 100644
index 0d755dffc..000000000
--- a/src/render/materialsystem/qparametermapping.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qparametermapping.h"
-#include <private/qparametermapping_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QParameterMappingPrivate::QParameterMappingPrivate()
- : QNodePrivate()
- , m_bindingType(QParameterMapping::Uniform)
-{
-}
-/*!
- \class Qt3DRender::QParameterMapping
- \inmodule Qt3DRender
- \since 5.5
- \brief The QParameterMapping class provides ...
-*/
-
-/*!
- \qmltype ParameterMapping
- \instantiates Qt3DRender::QParameterMapping
- \inherits Node
- \inqmlmodule Qt3D.Render
- \since 5.5
- \brief For ...
-*/
-
-/*! \fn void Qt3DRender::QParameterMapping::copy(const Qt3DCore::QNode *ref)
- Copies the \a ref instance into this one.
- */
-void QParameterMapping::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QParameterMapping *mapper = static_cast<const QParameterMapping*>(ref);
- d_func()->m_parameterName = mapper->d_func()->m_parameterName;
- d_func()->m_shaderVariableName = mapper->d_func()->m_shaderVariableName;
- d_func()->m_bindingType = mapper->d_func()->m_bindingType;
-}
-
-/*! \fn Qt3DRender::QParameterMapping::QParameterMapping(Qt3DCore::QNode *parent)
- Constructs a new QParameterMapping with the specified \a parent.
- */
-QParameterMapping::QParameterMapping(QNode *parent)
- : QNode(*new QParameterMappingPrivate, parent)
-{
-}
-
-/*!
- \enum Qt3DRender::QParameterMapping::Binding
-
- \value Uniform
- \value Attribute
- \value StandardUniform
- \value FragmentOutput
- \value UniformBufferObject
- \value ShaderStorageBufferObject
-*/
-
-/*! \internal */
-QParameterMapping::QParameterMapping(QParameterMappingPrivate &dd, QNode *parent)
- : QNode(dd, parent)
-{
-}
-
-/*!
- This constructor takes a \a parameterName, a \a shaderParameterName,
- a \a bindingType, and a \a parent.
- */
-QParameterMapping::QParameterMapping(const QString &parameterName, const QString &shaderParameterName, QParameterMapping::Binding bindingType, QNode *parent)
- : QNode(*new QParameterMappingPrivate, parent)
-{
- Q_D(QParameterMapping);
- d->m_parameterName = parameterName;
- d->m_shaderVariableName = shaderParameterName;
- d->m_bindingType = bindingType;
-}
-
-QParameterMapping::~QParameterMapping()
-{
- QNode::cleanup();
-}
-
-/*!
- \property Qt3DRender::QParameterMapping::parameterName
-
-*/
-
-/*!
- \qmlproperty string Qt3D.Render::ParameterMapping::parameterName
-
-*/
-
-void QParameterMapping::setParameterName(const QString &name)
-{
- Q_D(QParameterMapping);
- if (d->m_parameterName != name) {
- d->m_parameterName = name;
- emit parameterNameChanged(name);
- }
-}
-
-/*!
- \property Qt3DRender::QParameterMapping::shaderVariableName
-
-*/
-
-/*!
- \qmlproperty string Qt3D.Render::ParameterMapping::shaderVariableName
-
-*/
-
-void QParameterMapping::setShaderVariableName(const QString &name)
-{
- Q_D(QParameterMapping);
- if (d->m_shaderVariableName != name) {
- d->m_shaderVariableName = name;
- emit shaderVariableNameChanged(name);
- }
-}
-
-/*!
- \property Qt3DRender::QParameterMapping::bindingType
-
-*/
-
-/*!
- \qmlproperty BindingType Qt3D.Render::ParameterMapping::bindingType
-
- \value Uniform
- \value Attribute
- \value StandardUniform
- \value FragmentOutput
-*/
-void QParameterMapping::setBindingType(QParameterMapping::Binding type)
-{
- Q_D(QParameterMapping);
- if (d->m_bindingType != type) {
- d->m_bindingType = type;
- emit bindingTypeChanged(type);
- }
-}
-
-QString QParameterMapping::parameterName() const
-{
- Q_D(const QParameterMapping);
- return d->m_parameterName;
-}
-
-QString QParameterMapping::shaderVariableName() const
-{
- Q_D(const QParameterMapping);
- return d->m_shaderVariableName;
-}
-
-QParameterMapping::Binding QParameterMapping::bindingType() const
-{
- Q_D(const QParameterMapping);
- return d->m_bindingType;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qparametermapping.h b/src/render/materialsystem/qparametermapping.h
deleted file mode 100644
index cffe2d848..000000000
--- a/src/render/materialsystem/qparametermapping.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QPARAMETERMAPPING_H
-#define QT3DRENDER_QPARAMETERMAPPING_H
-
-#include <Qt3DCore/qnode.h>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QParameterMappingPrivate;
-
-class QT3DRENDERSHARED_EXPORT QParameterMapping : public Qt3DCore::QNode
-{
- Q_OBJECT
- Q_PROPERTY(QString parameterName READ parameterName WRITE setParameterName NOTIFY parameterNameChanged)
- Q_PROPERTY(QString shaderVariableName READ shaderVariableName WRITE setShaderVariableName NOTIFY shaderVariableNameChanged)
- Q_PROPERTY(Binding bindingType READ bindingType WRITE setBindingType NOTIFY bindingTypeChanged)
-public:
- enum Binding
- {
- Uniform = 0,
- Attribute,
- StandardUniform,
- FragmentOutput,
- UniformBufferObject,
- ShaderStorageBufferObject
- };
- Q_ENUM(Binding)
-
- explicit QParameterMapping(Qt3DCore::QNode *parent = Q_NULLPTR);
- QParameterMapping(const QString &parameterName, const QString &shaderParameterName, QParameterMapping::Binding bindingType, Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QParameterMapping();
-
- QString parameterName() const;
- QString shaderVariableName() const;
- Binding bindingType() const;
-
-public Q_SLOTS:
- void setParameterName(const QString &name);
- void setShaderVariableName(const QString &name);
- void setBindingType(Binding type);
-
-Q_SIGNALS:
- void parameterNameChanged(const QString &parameterName);
- void shaderVariableNameChanged(const QString &shaderVariableName);
- void bindingTypeChanged(Binding bindingType);
-
-protected:
- QParameterMapping(QParameterMappingPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QParameterMapping)
- QT3D_CLONEABLE(QParameterMapping)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QPARAMETERBINDER_H
diff --git a/src/render/materialsystem/qparametermapping_p.h b/src/render/materialsystem/qparametermapping_p.h
deleted file mode 100644
index a53627703..000000000
--- a/src/render/materialsystem/qparametermapping_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QPARAMETERMAPPING_P_H
-#define QT3DRENDER_QPARAMETERMAPPING_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qnode_p.h>
-#include <Qt3DRender/QParameterMapping>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QParameterMappingPrivate : public Qt3DCore::QNodePrivate
-{
-public:
- QParameterMappingPrivate();
-
- Q_DECLARE_PUBLIC(QParameterMapping)
-
- QString m_parameterName;
- QString m_shaderVariableName;
- QParameterMapping::Binding m_bindingType;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QPARAMETERMAPPING_P_H
diff --git a/src/render/materialsystem/qrenderpass.cpp b/src/render/materialsystem/qrenderpass.cpp
index 6d5d2970d..69098f9ec 100644
--- a/src/render/materialsystem/qrenderpass.cpp
+++ b/src/render/materialsystem/qrenderpass.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,11 +41,12 @@
#include "qrenderpass.h"
#include "qrenderpass_p.h"
#include "qparameter.h"
-#include "qannotation.h"
-#include "qparametermapping.h"
-#include "qscenepropertychange.h"
+#include "qfilterkey.h"
#include "qrenderstate.h"
-#include "private/qnode_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/private/qnode_p.h>
QT_BEGIN_NAMESPACE
@@ -52,32 +56,18 @@ namespace Qt3DRender {
QRenderPassPrivate::QRenderPassPrivate()
: QNodePrivate()
- , m_shader(Q_NULLPTR)
+ , m_shader(nullptr)
{
}
-void QRenderPass::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QRenderPass *other = static_cast<const QRenderPass*>(ref);
- d_func()->m_shader = qobject_cast<QShaderProgram *>(QNode::clone(other->d_func()->m_shader));
-
- Q_FOREACH (QAnnotation *crit, other->d_func()->m_annotationList)
- addAnnotation(qobject_cast<QAnnotation *>(QNode::clone(crit)));
- Q_FOREACH (QParameterMapping *binding, other->d_func()->m_bindings)
- addBinding(qobject_cast<QParameterMapping *>(QNode::clone(binding)));
- Q_FOREACH (QRenderState *renderState, other->d_func()->m_renderStates)
- addRenderState(qobject_cast<QRenderState *>(QNode::clone(renderState)));
-}
-
QRenderPass::QRenderPass(QNode *parent)
: QNode(*new QRenderPassPrivate, parent)
{
}
+/*! \internal */
QRenderPass::~QRenderPass()
{
- QNode::cleanup();
}
/*! \internal */
@@ -86,18 +76,6 @@ QRenderPass::QRenderPass(QRenderPassPrivate &dd, QNode *parent)
{
}
-ParameterList QRenderPass::attributes() const
-{
- Q_D(const QRenderPass);
- return d->m_attributes;
-}
-
-ParameterList QRenderPass::uniforms() const
-{
- Q_D(const QRenderPass);
- return d->m_uniforms;
-}
-
/*!
* Sets the pass's \a shaderProgram. This posts a ComponentUpdated
* QScenePropertyChange to the QChangeArbiter. The value is set to
@@ -108,11 +86,10 @@ void QRenderPass::setShaderProgram(QShaderProgram *shaderProgram)
Q_D(QRenderPass);
if (d->m_shader != shaderProgram) {
- if (d->m_shader != Q_NULLPTR && d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- e->setPropertyName("shaderProgram");
- e->setValue(QVariant::fromValue(d->m_shader->id()));
- d->notifyObservers(e);
+ if (d->m_shader != nullptr && d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), d->m_shader);
+ change->setPropertyName("shaderProgram");
+ d->notifyObservers(change);
}
d->m_shader = shaderProgram;
@@ -125,11 +102,10 @@ void QRenderPass::setShaderProgram(QShaderProgram *shaderProgram)
if (!shaderProgram->parent())
shaderProgram->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- e->setPropertyName("shaderProgram");
- e->setValue(QVariant::fromValue(shaderProgram->id()));
- d->notifyObservers(e);
+ if (d->m_shader && d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), d->m_shader);
+ change->setPropertyName("shaderProgram");
+ d->notifyObservers(change);
}
}
}
@@ -140,80 +116,44 @@ QShaderProgram *QRenderPass::shaderProgram() const
return d->m_shader;
}
-void QRenderPass::addAnnotation(QAnnotation *annotation)
+void QRenderPass::addFilterKey(QFilterKey *filterKey)
{
+ Q_ASSERT(filterKey);
Q_D(QRenderPass);
- if (!d->m_annotationList.contains(annotation)) {
- d->m_annotationList.append(annotation);
+ if (!d->m_filterKeyList.contains(filterKey)) {
+ d->m_filterKeyList.append(filterKey);
// We need to add it as a child of the current node if it has been declared inline
// Or not previously added as a child of the current node so that
// 1) The backend gets notified about it's creation
// 2) When the current node is destroyed, it gets destroyed as well
- if (!annotation->parent())
- annotation->setParent(this);
+ if (!filterKey->parent())
+ filterKey->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- change->setPropertyName("annotation");
- change->setValue(QVariant::fromValue(annotation->id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), filterKey);
+ change->setPropertyName("filterKeys");
d->notifyObservers(change);
}
}
}
-void QRenderPass::removeAnnotation(QAnnotation *annotation)
+void QRenderPass::removeFilterKey(QFilterKey *filterKey)
{
+ Q_ASSERT(filterKey);
Q_D(QRenderPass);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- change->setPropertyName("annotation");
- change->setValue(QVariant::fromValue(annotation->id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), filterKey);
+ change->setPropertyName("filterKeys");
d->notifyObservers(change);
}
- d->m_annotationList.removeOne(annotation);
+ d->m_filterKeyList.removeOne(filterKey);
}
-QList<QAnnotation *> QRenderPass::annotations() const
+QVector<QFilterKey *> QRenderPass::filterKeys() const
{
Q_D(const QRenderPass);
- return d->m_annotationList;
-}
-
-void QRenderPass::addBinding(QParameterMapping *binding)
-{
- Q_D(QRenderPass);
- if (!d->m_bindings.contains(binding)) {
- d->m_bindings.append(binding);
-
- if (!binding->parent())
- binding->setParent(this);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- change->setPropertyName("binding");
- change->setValue(QVariant::fromValue(QNode::clone(binding)));
- d->notifyObservers(change);
- }
- }
-}
-
-void QRenderPass::removeBinding(QParameterMapping *binding)
-{
- Q_D(QRenderPass);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- change->setPropertyName("binding");
- change->setValue(QVariant::fromValue(binding->id()));
- d->notifyObservers(change);
- }
- d->m_bindings.removeOne(binding);
-}
-
-QList<QParameterMapping *> QRenderPass::bindings() const
-{
- Q_D(const QRenderPass);
- return d->m_bindings;
+ return d->m_filterKeyList;
}
/*!
@@ -226,18 +166,17 @@ QList<QParameterMapping *> QRenderPass::bindings() const
*/
void QRenderPass::addRenderState(QRenderState *state)
{
+ Q_ASSERT(state);
Q_D(QRenderPass);
-
if (!d->m_renderStates.contains(state)) {
d->m_renderStates.append(state);
if (!state->parent())
state->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), state);
change->setPropertyName("renderState");
- change->setValue(QVariant::fromValue(QNodePtr(QNode::clone(state))));
d->notifyObservers(change);
}
}
@@ -248,11 +187,11 @@ void QRenderPass::addRenderState(QRenderState *state)
*/
void QRenderPass::removeRenderState(QRenderState *state)
{
+ Q_ASSERT(state);
Q_D(QRenderPass);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), state);
change->setPropertyName("renderState");
- change->setValue(QVariant::fromValue(state->id()));
d->notifyObservers(change);
}
d->m_renderStates.removeOne(state);
@@ -262,7 +201,7 @@ void QRenderPass::removeRenderState(QRenderState *state)
* Returns the list of Qt3DCore::QRenderState state objects making up the render
* state of the Qt3DRender::QRenderPass.
*/
-QList<QRenderState *> QRenderPass::renderStates() const
+QVector<QRenderState *> QRenderPass::renderStates() const
{
Q_D(const QRenderPass);
return d->m_renderStates;
@@ -270,6 +209,7 @@ QList<QRenderState *> QRenderPass::renderStates() const
void QRenderPass::addParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QRenderPass);
if (!d->m_parameters.contains(parameter)) {
d->m_parameters.append(parameter);
@@ -281,10 +221,9 @@ void QRenderPass::addParameter(QParameter *parameter)
if (!parameter->parent())
parameter->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
}
@@ -292,24 +231,35 @@ void QRenderPass::addParameter(QParameter *parameter)
void QRenderPass::removeParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QRenderPass);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
d->m_parameters.removeOne(parameter);
}
-QList<QParameter *> QRenderPass::parameters() const
+QVector<QParameter *> QRenderPass::parameters() const
{
Q_D(const QRenderPass);
return d->m_parameters;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderPass::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderPassData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QRenderPass);
+ data.filterKeyIds = qIdsForNodes(d->m_filterKeyList);
+ data.parameterIds = qIdsForNodes(d->m_parameters);
+ data.renderStateIds = qIdsForNodes(d->m_renderStates);
+ data.shaderId = qIdForNode(d->m_shader);
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qrenderpass.h b/src/render/materialsystem/qrenderpass.h
index 7421c0f95..e2eb96a9a 100644
--- a/src/render/materialsystem/qrenderpass.h
+++ b/src/render/materialsystem/qrenderpass.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,10 +45,9 @@
#include <Qt3DRender/qshaderprogram.h>
#include <Qt3DRender/qrenderstate.h>
-#include <Qt3DRender/qannotation.h>
+#include <Qt3DRender/qfilterkey.h>
#include <QHash>
-#include <QList>
QT_BEGIN_NAMESPACE
@@ -53,8 +55,7 @@ namespace Qt3DRender {
class QParameter;
class QRenderState;
-class QParameterMapping;
-typedef QList<QParameter*> ParameterList;
+typedef QVector<QParameter*> ParameterList;
class QRenderPassPrivate;
@@ -64,31 +65,22 @@ class QT3DRENDERSHARED_EXPORT QRenderPass : public Qt3DCore::QNode
Q_PROPERTY(Qt3DRender::QShaderProgram *shaderProgram READ shaderProgram WRITE setShaderProgram NOTIFY shaderProgramChanged)
public:
- explicit QRenderPass(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QRenderPass(Qt3DCore::QNode *parent = nullptr);
~QRenderPass();
- QString glslNameForParameter(QString paramName) const;
-
- ParameterList attributes() const;
- ParameterList uniforms() const;
-
QShaderProgram *shaderProgram() const;
- void addAnnotation(QAnnotation *criterion);
- void removeAnnotation(QAnnotation *criterion);
- QList<QAnnotation *> annotations() const;
-
- void addBinding(QParameterMapping *binding);
- void removeBinding(QParameterMapping *binding);
- QList<QParameterMapping *> bindings() const;
+ void addFilterKey(QFilterKey*filterKey);
+ void removeFilterKey(QFilterKey*filterKey);
+ QVector<QFilterKey*> filterKeys() const;
void addRenderState(QRenderState *state);
void removeRenderState(QRenderState *state);
- QList<QRenderState *> renderStates() const;
+ QVector<QRenderState *> renderStates() const;
void addParameter(QParameter *p);
void removeParameter(QParameter *p);
- QList<QParameter *> parameters() const;
+ QVector<QParameter *> parameters() const;
public Q_SLOTS:
void setShaderProgram(QShaderProgram *shaderProgram);
@@ -97,12 +89,11 @@ Q_SIGNALS:
void shaderProgramChanged(QShaderProgram *shaderProgram);
protected:
- QRenderPass(QRenderPassPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QRenderPass(QRenderPassPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QRenderPass)
- QT3D_CLONEABLE(QRenderPass)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
}
diff --git a/src/render/materialsystem/qrenderpass_p.h b/src/render/materialsystem/qrenderpass_p.h
index e80b3e05b..79e0ae0c7 100644
--- a/src/render/materialsystem/qrenderpass_p.h
+++ b/src/render/materialsystem/qrenderpass_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,15 +60,8 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QParameter;
-class QParameterMapping;
class QRenderState;
-class QAnnotation;
-typedef QList<QParameter*> ParameterList;
-
-namespace Render
-{
-class RenderStateSet;
-}
+class QFilterKey;
class QRenderPassPrivate : public Qt3DCore::QNodePrivate
{
@@ -73,18 +69,21 @@ public:
QRenderPassPrivate();
Q_DECLARE_PUBLIC(QRenderPass)
- ParameterList m_attributes;
- ParameterList m_uniforms;
- // map Parameter names to GLSL names
- QHash<QString, QString> m_parameterNameDict;
- QList<QAnnotation *> m_annotationList;
- QList<QParameterMapping *> m_bindings;
- QList<QRenderState *> m_renderStates;
- QList<QParameter *> m_parameters;
+ QVector<QFilterKey *> m_filterKeyList;
+ QVector<QRenderState *> m_renderStates;
+ QVector<QParameter *> m_parameters;
QShaderProgram *m_shader;
};
+struct QRenderPassData
+{
+ Qt3DCore::QNodeIdVector filterKeyIds;
+ Qt3DCore::QNodeIdVector parameterIds;
+ Qt3DCore::QNodeIdVector renderStateIds;
+ Qt3DCore::QNodeId shaderId;
+};
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qshaderdata.cpp b/src/render/materialsystem/qshaderdata.cpp
index cddb0cd8f..6dfb182d1 100644
--- a/src/render/materialsystem/qshaderdata.cpp
+++ b/src/render/materialsystem/qshaderdata.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -41,6 +44,10 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+PropertyReaderInterface::~PropertyReaderInterface()
+{
+}
+
QShaderDataPrivate::QShaderDataPrivate()
: QComponentPrivate()
, m_propertyReader(PropertyReaderInterfacePtr(new QShaderDataPropertyReader()))
@@ -73,9 +80,9 @@ QShaderData::QShaderData(QNode *parent)
{
}
+/*! \internal */
QShaderData::~QShaderData()
{
- QNode::cleanup();
}
PropertyReaderInterfacePtr QShaderData::propertyReader() const
@@ -90,23 +97,57 @@ QShaderData::QShaderData(QShaderDataPrivate &dd, QNode *parent)
{
}
-void QShaderData::copy(const QNode *ref)
+bool QShaderData::event(QEvent *event)
+{
+ Q_D(QShaderData);
+
+ if (event->type() == QEvent::DynamicPropertyChange) {
+ auto e = static_cast<QDynamicPropertyChangeEvent*>(event);
+ const auto propertyName = e->propertyName();
+
+ const QVariant data = property(propertyName);
+ if (data.canConvert<Qt3DCore::QNode*>()) {
+ const auto node = data.value<Qt3DCore::QNode*>();
+ const auto id = node ? node->id() : Qt3DCore::QNodeId();
+ d->notifyDynamicPropertyChange(propertyName, QVariant::fromValue(id));
+ } else {
+ d->notifyDynamicPropertyChange(propertyName, data);
+ }
+ }
+
+ return QComponent::event(event);
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QShaderData::createNodeCreationChange() const
{
- QNode::copy(ref);
- const QShaderData *shaderData = static_cast<const QShaderData *>(ref);
- // We need to copy the properties
- // At the moment we assume that the properties are copyable
- // this may change in a later refactoring
+ Q_D(const QShaderData);
+
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QShaderDataData>::create(this);
+ QShaderDataData &data = creationChange->data;
+
+ data.propertyReader = d->m_propertyReader;
- const QMetaObject *metaObject = shaderData->metaObject();
+ const QMetaObject *metaObj = metaObject();
const int propertyOffset = QShaderData::staticMetaObject.propertyOffset();
- const int propertyCount = metaObject->propertyCount();
+ const int propertyCount = metaObj->propertyCount();
+
+ const auto propertyNames = dynamicPropertyNames();
+ data.properties.reserve(propertyCount - propertyOffset + propertyNames.size());
- // Copy properties of shaderData
for (int i = propertyOffset; i < propertyCount; ++i) {
- const QMetaProperty property = metaObject->property(i);
- setProperty(property.name(), propertyReader()->readProperty(shaderData->property(property.name())));
+ const QMetaProperty pro = metaObj->property(i);
+ if (pro.isWritable()) {
+ data.properties.push_back(qMakePair(pro.name(),
+ propertyReader()->readProperty(property(pro.name()))));
+ }
+ }
+
+ for (const QByteArray &propertyName : propertyNames) {
+ data.properties.push_back(qMakePair(propertyName,
+ propertyReader()->readProperty(property(propertyName))));
}
+
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/qshaderdata.h b/src/render/materialsystem/qshaderdata.h
index 002d43915..767f4043f 100644
--- a/src/render/materialsystem/qshaderdata.h
+++ b/src/render/materialsystem/qshaderdata.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,6 +42,7 @@
#include <Qt3DCore/qcomponent.h>
#include <Qt3DRender/qt3drender_global.h>
+#include <QVector>
QT_BEGIN_NAMESPACE
@@ -49,7 +53,7 @@ class QShaderDataPrivate;
class QT3DRENDERSHARED_EXPORT PropertyReaderInterface
{
public:
- virtual ~PropertyReaderInterface() {}
+ virtual ~PropertyReaderInterface();
virtual QVariant readProperty(const QVariant &v) = 0;
};
@@ -59,25 +63,19 @@ class QT3DRENDERSHARED_EXPORT QShaderData : public Qt3DCore::QComponent
{
Q_OBJECT
public:
- explicit QShaderData(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QShaderData(Qt3DCore::QNode *parent = nullptr);
~QShaderData();
- enum TransformType {
- ModelToEye = 0,
- ModelToWorld
- };
- Q_ENUM(TransformType)
-
PropertyReaderInterfacePtr propertyReader() const;
-protected:
- QShaderData(QShaderDataPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) Q_DECL_OVERRIDE;
+protected:
+ explicit QShaderData(QShaderDataPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QShaderData)
- QT3D_CLONEABLE(QShaderData)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
@@ -85,6 +83,6 @@ private:
QT_END_NAMESPACE
Q_DECLARE_METATYPE(Qt3DRender::QShaderData*)
-Q_DECLARE_METATYPE(QList<Qt3DRender::QShaderData*>)
+Q_DECLARE_METATYPE(QVector<Qt3DRender::QShaderData*>)
#endif // QT3DRENDER_QSHADERDATA_H
diff --git a/src/render/materialsystem/qshaderdata_p.h b/src/render/materialsystem/qshaderdata_p.h
index add621b5e..bfa139890 100644
--- a/src/render/materialsystem/qshaderdata_p.h
+++ b/src/render/materialsystem/qshaderdata_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,7 +61,7 @@ namespace Qt3DRender {
namespace {
-const int qListShaderDataTypeId = qMetaTypeId<QList<QShaderData*> >();
+const int qVectorShaderDataTypeId = qMetaTypeId<QVector<QShaderData*> >();
const int qShaderDataTypeId = qMetaTypeId<QShaderData*>();
}
@@ -67,13 +70,14 @@ class QShaderDataPropertyReader: public PropertyReaderInterface
{
QVariant readProperty(const QVariant &v) Q_DECL_OVERRIDE
{
- QShaderData *shaderData = Q_NULLPTR;
+ QShaderData *shaderData = nullptr;
- if (v.userType() == qShaderDataTypeId && (shaderData = v.value<QShaderData *>()) != Q_NULLPTR) {
+ if (v.userType() == qShaderDataTypeId && (shaderData = v.value<QShaderData *>()) != nullptr) {
return QVariant::fromValue(shaderData->id());
- } else if (v.userType() == qListShaderDataTypeId) {
+ } else if (v.userType() == qVectorShaderDataTypeId) {
QVariantList vlist;
- Q_FOREACH (QShaderData *data, v.value<QList<QShaderData *> >()) {
+ const auto data_ = v.value<QVector<QShaderData *> >();
+ for (QShaderData *data : data_) {
if (data)
vlist.append(QVariant::fromValue(data->id()));
}
@@ -93,6 +97,12 @@ public:
Q_DECLARE_PUBLIC(QShaderData)
};
+struct QShaderDataData
+{
+ QVector<QPair<QByteArray, QVariant>> properties;
+ PropertyReaderInterfacePtr propertyReader;
+};
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp
index 76124bb64..ae722f7ec 100644
--- a/src/render/materialsystem/qshaderprogram.cpp
+++ b/src/render/materialsystem/qshaderprogram.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "qshaderprogram.h"
#include "qshaderprogram_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/private/qurlhelper_p.h>
#include <QDebug>
#include <QFile>
@@ -52,27 +55,14 @@ QShaderProgramPrivate::QShaderProgramPrivate()
{
}
-void QShaderProgram::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QShaderProgram *prog = static_cast<const QShaderProgram*>(ref);
-
- d_func()->m_vertexShaderCode = prog->d_func()->m_vertexShaderCode;
- d_func()->m_tessControlShaderCode = prog->d_func()->m_tessControlShaderCode;
- d_func()->m_tessEvalShaderCode = prog->d_func()->m_tessEvalShaderCode;
- d_func()->m_geometryShaderCode = prog->d_func()->m_geometryShaderCode;
- d_func()->m_fragmentShaderCode = prog->d_func()->m_fragmentShaderCode;
- d_func()->m_computeShaderCode = prog->d_func()->m_computeShaderCode;
-}
-
QShaderProgram::QShaderProgram(QNode *parent)
: QNode(*new QShaderProgramPrivate, parent)
{
}
+/*! \internal */
QShaderProgram::~QShaderProgram()
{
- QNode::cleanup();
}
/*! \internal */
@@ -238,10 +228,10 @@ static QByteArray deincludify(const QString &filePath)
for (int i = 0; i < lines.count(); ++i) {
if (lines[i].startsWith(includeDirective)) {
QString includeFileName = QFileInfo(filePath).absolutePath()
- + QStringLiteral("/")
+ + QLatin1Char('/')
+ QString::fromUtf8(lines[i].mid(includeDirective.count() + 1));
if (qEnvironmentVariableIsSet("QT3D_GLSL100_WORKAROUND")) {
- QString candidate = includeFileName + QStringLiteral("100");
+ QString candidate = includeFileName + QLatin1String("100");
if (QFile::exists(candidate))
includeFileName = candidate;
}
@@ -262,6 +252,20 @@ QByteArray QShaderProgram::loadSource(const QUrl &sourceUrl)
return deincludify(Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(sourceUrl));
}
+Qt3DCore::QNodeCreatedChangeBasePtr QShaderProgram::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QShaderProgramData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QShaderProgram);
+ data.vertexShaderCode = d->m_vertexShaderCode;
+ data.tessellationControlShaderCode = d->m_tessControlShaderCode;
+ data.tessellationEvaluationShaderCode = d->m_tessEvalShaderCode;
+ data.geometryShaderCode = d->m_geometryShaderCode;
+ data.fragmentShaderCode = d->m_fragmentShaderCode;
+ data.computeShaderCode = d->m_computeShaderCode;
+ return creationChange;
+}
+
} // of namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qshaderprogram.h b/src/render/materialsystem/qshaderprogram.h
index 87a841653..f5a577de5 100644
--- a/src/render/materialsystem/qshaderprogram.h
+++ b/src/render/materialsystem/qshaderprogram.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,7 +60,7 @@ class QT3DRENDERSHARED_EXPORT QShaderProgram : public Qt3DCore::QNode
Q_PROPERTY(QByteArray computeShaderCode READ computeShaderCode WRITE setComputeShaderCode NOTIFY computeShaderCodeChanged)
public:
- explicit QShaderProgram(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QShaderProgram(Qt3DCore::QNode *parent = nullptr);
~QShaderProgram();
enum ShaderType {
@@ -100,12 +103,11 @@ Q_SIGNALS:
void computeShaderCodeChanged(const QByteArray &computeShaderCode);
protected:
- QShaderProgram(QShaderProgramPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QShaderProgram(QShaderProgramPrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QShaderProgram)
- QT3D_CLONEABLE(QShaderProgram)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
}
diff --git a/src/render/materialsystem/qshaderprogram_p.h b/src/render/materialsystem/qshaderprogram_p.h
index 078091b35..5f695a279 100644
--- a/src/render/materialsystem/qshaderprogram_p.h
+++ b/src/render/materialsystem/qshaderprogram_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -76,6 +79,16 @@ public:
QByteArray m_computeShaderCode;
};
+struct QShaderProgramData
+{
+ QByteArray vertexShaderCode;
+ QByteArray tessellationControlShaderCode;
+ QByteArray tessellationEvaluationShaderCode;
+ QByteArray geometryShaderCode;
+ QByteArray fragmentShaderCode;
+ QByteArray computeShaderCode;
+};
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qtechnique.cpp b/src/render/materialsystem/qtechnique.cpp
index 52f131091..f2d146202 100644
--- a/src/render/materialsystem/qtechnique.cpp
+++ b/src/render/materialsystem/qtechnique.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,8 +41,9 @@
#include "qtechnique_p.h"
#include "qparameter.h"
#include "qgraphicsapifilter.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <QDebug>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -63,9 +67,9 @@ QTechnique::QTechnique(QNode *parent)
QObject::connect(&d->m_graphicsApiFilter, SIGNAL(graphicsApiFilterChanged()), this, SLOT(_q_graphicsApiFilterChanged()));
}
+/*! \internal */
QTechnique::~QTechnique()
{
- QNode::cleanup();
}
/*! \internal */
@@ -76,74 +80,59 @@ QTechnique::QTechnique(QTechniquePrivate &dd, QNode *parent)
QObject::connect(&d->m_graphicsApiFilter, SIGNAL(graphicsApiFilterChanged()), this, SLOT(_q_graphicsApiFilterChanged()));
}
-void QTechnique::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QTechnique *tech = static_cast<const QTechnique*>(ref);
- d_func()->m_graphicsApiFilter.copy(tech->d_func()->m_graphicsApiFilter);
-
- Q_FOREACH (QAnnotation *annotation, tech->d_func()->m_annotationList)
- addAnnotation(qobject_cast<QAnnotation *>(QNode::clone(annotation)));
- Q_FOREACH (QRenderPass *pass, tech->d_func()->m_renderPasses)
- addPass(qobject_cast<QRenderPass *>(QNode::clone(pass)));
- Q_FOREACH (QParameter *p, tech->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-}
-
void QTechniquePrivate::_q_graphicsApiFilterChanged()
{
- if (m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, m_id));
- change->setPropertyName("graphicsApiFilter");
- QGraphicsApiFilter *clone = new QGraphicsApiFilter();
- clone->copy(m_graphicsApiFilter);
- change->setValue(QVariant::fromValue(clone));
+ if (m_changeArbiter != nullptr) {
+ auto change = QPropertyUpdatedChangePtr::create(m_id);
+ change->setPropertyName("graphicsApiFilterData");
+ change->setValue(QVariant::fromValue(QGraphicsApiFilterPrivate::get(const_cast<QGraphicsApiFilter *>(&m_graphicsApiFilter))->m_data));
notifyObservers(change);
}
}
-void QTechnique::addAnnotation(QAnnotation *criterion)
+void QTechnique::addFilterKey(QFilterKey *filterKey)
{
+ Q_ASSERT(filterKey);
Q_D(QTechnique);
- if (!d->m_annotationList.contains(criterion)) {
- d->m_annotationList.append(criterion);
+ if (!d->m_filterKeys.contains(filterKey)) {
+ d->m_filterKeys.append(filterKey);
// We need to add it as a child of the current node if it has been declared inline
// Or not previously added as a child of the current node so that
// 1) The backend gets notified about it's creation
// 2) When the current node is destroyed, it gets destroyed as well
- if (!criterion->parent())
- criterion->setParent(this);
+ if (!filterKey->parent())
+ filterKey->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- change->setPropertyName("annotation");
- change->setValue(QVariant::fromValue(criterion->id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), filterKey);
+ change->setPropertyName("filterKeys");
d->notifyObservers(change);
}
}
}
-void QTechnique::removeAnnotation(QAnnotation *criterion)
+void QTechnique::removeFilterKey(QFilterKey *filterKey)
{
+ Q_ASSERT(filterKey);
Q_D(QTechnique);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- change->setPropertyName("annotation");
- change->setValue(QVariant::fromValue(criterion->id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), filterKey);
+ change->setPropertyName("filterKeys");
d->notifyObservers(change);
}
- d->m_annotationList.removeOne(criterion);
+ d->m_filterKeys.removeOne(filterKey);
}
-QList<QAnnotation *> QTechnique::annotations() const
+QVector<QFilterKey *> QTechnique::filterKeys() const
{
Q_D(const QTechnique);
- return d->m_annotationList;
+ return d->m_filterKeys;
}
void QTechnique::addParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QTechnique);
if (!d->m_parameters.contains(parameter)) {
d->m_parameters.append(parameter);
@@ -155,10 +144,9 @@ void QTechnique::addParameter(QParameter *parameter)
if (!parameter->parent())
parameter->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
}
@@ -166,12 +154,11 @@ void QTechnique::addParameter(QParameter *parameter)
void QTechnique::removeParameter(QParameter *parameter)
{
+ Q_ASSERT(parameter);
Q_D(QTechnique);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), parameter);
change->setPropertyName("parameter");
- change->setValue(QVariant::fromValue(parameter->id()));
d->notifyObservers(change);
}
d->m_parameters.removeOne(parameter);
@@ -182,8 +169,9 @@ void QTechnique::removeParameter(QParameter *parameter)
* QScenePropertyChange notification to the QChangeArbiter with the
* value being the \a pass and the property name being "pass".
*/
-void QTechnique::addPass(QRenderPass *pass)
+void QTechnique::addRenderPass(QRenderPass *pass)
{
+ Q_ASSERT(pass);
Q_D(QTechnique);
if (!d->m_renderPasses.contains(pass)) {
d->m_renderPasses.append(pass);
@@ -195,11 +183,10 @@ void QTechnique::addPass(QRenderPass *pass)
if (!pass->parent())
pass->setParent(this);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- e->setPropertyName("pass");
- e->setValue(QVariant::fromValue(pass->id()));
- d->notifyObservers(e);
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), pass);
+ change->setPropertyName("pass");
+ d->notifyObservers(change);
}
}
}
@@ -209,14 +196,14 @@ void QTechnique::addPass(QRenderPass *pass)
* QScenePropertyChange notification to the QChangeArbiter with the value
* being the id of \a pass and the property name being "pass".
*/
-void QTechnique::removePass(QRenderPass *pass)
+void QTechnique::removeRenderPass(QRenderPass *pass)
{
+ Q_ASSERT(pass);
Q_D(QTechnique);
if (d->m_changeArbiter) {
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- e->setPropertyName("pass");
- e->setValue(QVariant::fromValue(pass->id()));
- d->notifyObservers(e);
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), pass);
+ change->setPropertyName("pass");
+ d->notifyObservers(change);
}
d->m_renderPasses.removeOne(pass);
}
@@ -224,13 +211,13 @@ void QTechnique::removePass(QRenderPass *pass)
/*!
* Returns the list of render passes contained in the technique.
*/
-QList<QRenderPass *> QTechnique::renderPasses() const
+QVector<QRenderPass *> QTechnique::renderPasses() const
{
Q_D(const QTechnique);
return d->m_renderPasses;
}
-QList<QParameter *> QTechnique::parameters() const
+QVector<QParameter *> QTechnique::parameters() const
{
Q_D(const QTechnique);
return d->m_parameters;
@@ -242,6 +229,20 @@ QGraphicsApiFilter *QTechnique::graphicsApiFilter()
return &d->m_graphicsApiFilter;
}
+Qt3DCore::QNodeCreatedChangeBasePtr QTechnique::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QTechniqueData>::create(this);
+ QTechniqueData &data = creationChange->data;
+
+ Q_D(const QTechnique);
+ data.graphicsApiFilterData = QGraphicsApiFilterPrivate::get(const_cast<QGraphicsApiFilter *>(&d->m_graphicsApiFilter))->m_data;
+ data.filterKeyIds = qIdsForNodes(d->m_filterKeys);
+ data.parameterIds = qIdsForNodes(d->m_parameters);
+ data.renderPassIds = qIdsForNodes(d->m_renderPasses);
+
+ return creationChange;
+}
+
} // of namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/qtechnique.h b/src/render/materialsystem/qtechnique.h
index 8c5c34da0..cf5c034e8 100644
--- a/src/render/materialsystem/qtechnique.h
+++ b/src/render/materialsystem/qtechnique.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -40,8 +43,8 @@
#include <Qt3DRender/qt3drender_global.h>
#include <Qt3DCore/qnode.h>
#include <Qt3DRender/qrenderpass.h>
-#include <Qt3DRender/qannotation.h>
-#include <QList>
+#include <Qt3DRender/qfilterkey.h>
+#include <QVector>
#include <QSharedPointer>
QT_BEGIN_NAMESPACE
@@ -58,31 +61,30 @@ class QT3DRENDERSHARED_EXPORT QTechnique : public Qt3DCore::QNode
Q_PROPERTY(Qt3DRender::QGraphicsApiFilter *graphicsApiFilter READ graphicsApiFilter CONSTANT)
public:
- explicit QTechnique(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QTechnique(Qt3DCore::QNode *parent = nullptr);
~QTechnique();
- void addAnnotation(QAnnotation *criterion);
- void removeAnnotation(QAnnotation *criterion);
- QList<QAnnotation *> annotations() const;
+ void addFilterKey(QFilterKey *filterKey);
+ void removeFilterKey(QFilterKey *filterKey);
+ QVector<QFilterKey*> filterKeys() const;
void addParameter(QParameter *p);
void removeParameter(QParameter *p);
- QList<QParameter *> parameters() const;
+ QVector<QParameter *> parameters() const;
- void addPass(QRenderPass *pass);
- void removePass(QRenderPass *pass);
- QList<QRenderPass *> renderPasses() const;
+ void addRenderPass(QRenderPass *pass);
+ void removeRenderPass(QRenderPass *pass);
+ QVector<QRenderPass *> renderPasses() const;
QGraphicsApiFilter *graphicsApiFilter();
protected:
- QTechnique(QTechniquePrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ explicit QTechnique(QTechniquePrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QTechnique)
- QT3D_CLONEABLE(QTechnique)
Q_PRIVATE_SLOT(d_func(), void _q_graphicsApiFilterChanged())
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
}
diff --git a/src/render/materialsystem/qtechnique_p.h b/src/render/materialsystem/qtechnique_p.h
index 25080bacb..48891c95b 100644
--- a/src/render/materialsystem/qtechnique_p.h
+++ b/src/render/materialsystem/qtechnique_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,13 +53,14 @@
#include <private/qnode_p.h>
#include <Qt3DRender/qgraphicsapifilter.h>
+#include <private/qgraphicsapifilter_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QTechnique;
-class QAnnotation;
+class QFilterKey;
class QParameter;
class QRenderPass;
@@ -67,15 +71,24 @@ public:
~QTechniquePrivate();
Q_DECLARE_PUBLIC(QTechnique)
- QList<QAnnotation *> m_annotationList;
- QList<QParameter *> m_parameters;
- QList<QRenderPass*> m_renderPasses;
+ QVector<QFilterKey *> m_filterKeys;
+ QVector<QParameter *> m_parameters;
+ QVector<QRenderPass*> m_renderPasses;
QGraphicsApiFilter m_graphicsApiFilter;
private:
void _q_graphicsApiFilterChanged();
};
+struct QTechniqueData
+{
+ GraphicsApiFilterData graphicsApiFilterData;
+
+ Qt3DCore::QNodeIdVector filterKeyIds;
+ Qt3DCore::QNodeIdVector parameterIds;
+ Qt3DCore::QNodeIdVector renderPassIds;
+};
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/materialsystem/renderpass.cpp b/src/render/materialsystem/renderpass.cpp
index e499a85ba..0f6a917a6 100644
--- a/src/render/materialsystem/renderpass.cpp
+++ b/src/render/materialsystem/renderpass.cpp
@@ -1,51 +1,56 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "renderpass_p.h"
-#include <Qt3DRender/private/annotation_p.h>
-#include <Qt3DRender/qparametermapping.h>
+#include <Qt3DRender/private/filterkey_p.h>
#include <Qt3DRender/qrenderstate.h>
#include <Qt3DRender/qrenderpass.h>
#include <Qt3DRender/qparameter.h>
+#include <Qt3DRender/private/qrenderpass_p.h>
#include <Qt3DRender/private/renderstates_p.h>
#include <Qt3DRender/private/renderstateset_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -55,79 +60,64 @@ namespace Qt3DRender {
namespace Render {
RenderPass::RenderPass()
- : QBackendNode()
+ : BackendNode()
{
}
RenderPass::~RenderPass()
{
- cleanup();
}
void RenderPass::cleanup()
{
}
-void RenderPass::updateFromPeer(Qt3DCore::QNode *peer)
+void RenderPass::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QRenderPass *pass = static_cast<QRenderPass *>(peer);
-
- m_parameterPack.clear();
-
- if (pass->shaderProgram() != Q_NULLPTR)
- m_shaderUuid = pass->shaderProgram()->id();
- // The RenderPass clones frontend bindings in case the frontend ever removes them
- // TO DO: We probably need a QParameterMapper manager
- Q_FOREACH (QParameterMapping *binding, pass->bindings())
- appendBinding(ParameterMapping(binding));
- Q_FOREACH (QAnnotation *c, pass->annotations())
- appendAnnotation(c->id());
- Q_FOREACH (QRenderState *renderState, pass->renderStates())
- appendRenderState(renderState->id(), RenderState::getOrCreateBackendState(renderState));
- Q_FOREACH (QParameter *p, pass->parameters())
- m_parameterPack.appendParameter(p->id());
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QRenderPassData>>(change);
+ const auto &data = typedChange->data;
+ m_filterKeyList = data.filterKeyIds;
+ m_parameterPack.setParameters(data.parameterIds);
+ for (const auto &renderStateId : qAsConst(data.renderStateIds))
+ appendRenderState(renderStateId);
+ m_shaderUuid = data.shaderId;
}
void RenderPass::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
switch (e->type()) {
-
- case NodeAdded: {
- if (propertyChange->propertyName() == QByteArrayLiteral("annotation")) {
- appendAnnotation(propertyChange->value().value<QNodeId>());
- } else if (propertyChange->propertyName() == QByteArrayLiteral("shaderProgram")) {
- m_shaderUuid = propertyChange->value().value<QNodeId>();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("binding")) {
- appendBinding(ParameterMapping(propertyChange->value().value<QParameterMapping *>()));
- } else if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) {
- QNodePtr nodePtr = propertyChange->value().value<QNodePtr>();
- QRenderState *renderState = static_cast<QRenderState *>(nodePtr.data());
- appendRenderState(renderState->id(), RenderState::getOrCreateBackendState(renderState));
- } else if (propertyChange->propertyName() == QByteArrayLiteral("parameter")) {
- m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
- }
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("filterKeys"))
+ appendFilterKey(change->addedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("shaderProgram"))
+ m_shaderUuid = change->addedNodeId();
+ else if (change->propertyName() == QByteArrayLiteral("renderState"))
+ appendRenderState(change->addedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.appendParameter(change->addedNodeId());
break;
}
- case NodeRemoved: {
- if (propertyChange->propertyName() == QByteArrayLiteral("annotation")) {
- removeAnnotation(propertyChange->value().value<QNodeId>());
- } else if (propertyChange->propertyName() == QByteArrayLiteral("shaderProgram")) {
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("filterKeys"))
+ removeFilterKey(change->removedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("shaderProgram"))
m_shaderUuid = QNodeId();
- } else if (propertyChange->propertyName() == QByteArrayLiteral("binding")) {
- removeBinding(propertyChange->value().value<QNodeId>());
- } else if (propertyChange->propertyName() == QByteArrayLiteral("renderState")) {
- removeRenderState(propertyChange->value().value<QNodeId>());
- } else if (propertyChange->propertyName() == QByteArrayLiteral("parameter")) {
- m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>());
- }
+ else if (change->propertyName() == QByteArrayLiteral("renderState"))
+ removeRenderState(change->removedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.removeParameter(change->removedNodeId());
break;
}
default:
break;
}
+
+ BackendNode::sceneChangeEvent(e);
+ markDirty(AbstractRenderer::AllDirty);
}
Qt3DCore::QNodeId RenderPass::shaderProgram() const
@@ -135,57 +125,25 @@ Qt3DCore::QNodeId RenderPass::shaderProgram() const
return m_shaderUuid;
}
-QList<ParameterMapping> RenderPass::bindings() const
-{
- return m_bindings.values();
-}
-
-QList<Qt3DCore::QNodeId> RenderPass::annotations() const
+QVector<Qt3DCore::QNodeId> RenderPass::filterKeys() const
{
- return m_annotationList;
+ return m_filterKeyList;
}
-QList<RenderState *> RenderPass::renderStates() const
-{
- return m_renderStates.values();
-}
-
-QList<Qt3DCore::QNodeId> RenderPass::parameters() const
+QVector<Qt3DCore::QNodeId> RenderPass::parameters() const
{
return m_parameterPack.parameters();
}
-void RenderPass::appendAnnotation(const Qt3DCore::QNodeId &annotationId)
-{
- if (!m_annotationList.contains(annotationId))
- m_annotationList.append(annotationId);
-}
-
-void RenderPass::removeAnnotation(const Qt3DCore::QNodeId &annotationId)
-{
- m_annotationList.removeOne(annotationId);
-}
-
-void RenderPass::appendBinding(const ParameterMapping &binding)
-{
- if (!m_bindings.contains(binding.id()))
- m_bindings[binding.id()] = binding;
-}
-
-void RenderPass::removeBinding(const Qt3DCore::QNodeId &bindingId)
-{
- m_bindings.remove(bindingId);
-}
-
-void RenderPass::appendRenderState(const Qt3DCore::QNodeId &id, RenderState *renderState)
+void RenderPass::appendFilterKey(Qt3DCore::QNodeId filterKeyId)
{
- if (!m_renderStates.contains(id))
- m_renderStates[id] = renderState;
+ if (!m_filterKeyList.contains(filterKeyId))
+ m_filterKeyList.append(filterKeyId);
}
-void RenderPass::removeRenderState(const Qt3DCore::QNodeId &renderStateId)
+void RenderPass::removeFilterKey(Qt3DCore::QNodeId filterKeyId)
{
- m_renderStates.remove(renderStateId);
+ m_filterKeyList.removeOne(filterKeyId);
}
} // namespace Render
diff --git a/src/render/materialsystem/renderpass_p.h b/src/render/materialsystem/renderpass_p.h
index ad1c329f4..ce2b851b9 100644
--- a/src/render/materialsystem/renderpass_p.h
+++ b/src/render/materialsystem/renderpass_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,12 +52,11 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DRender/private/parametermapping_p.h>
#include <Qt3DRender/private/parameterpack_p.h>
+#include <Qt3DRender/private/renderstatecollection_p.h>
#include <Qt3DCore/private/qabstractaspect_p.h>
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DCore/qnodeid.h>
QT_BEGIN_NAMESPACE
@@ -62,8 +64,7 @@ namespace Qt3DRender {
class QRenderPass;
class QAbstractShader;
-class QParameterMapping;
-class QAnnotation;
+class QFilterKey;
class QRenderState;
namespace Render {
@@ -71,7 +72,7 @@ namespace Render {
class RenderPassManager;
class RenderState;
-class Q_AUTOTEST_EXPORT RenderPass : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT RenderPass : public BackendNode, public RenderStateCollection
{
public:
RenderPass();
@@ -79,29 +80,20 @@ public:
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
Qt3DCore::QNodeId shaderProgram() const;
- QList<ParameterMapping> bindings() const;
- QList<Qt3DCore::QNodeId> annotations() const;
- QList<RenderState *> renderStates() const;
- QList<Qt3DCore::QNodeId> parameters() const;
+ QVector<Qt3DCore::QNodeId> filterKeys() const;
+ QVector<Qt3DCore::QNodeId> parameters() const;
private:
- void appendAnnotation(const Qt3DCore::QNodeId &criterionId);
- void removeAnnotation(const Qt3DCore::QNodeId &criterionId);
+ void appendFilterKey(Qt3DCore::QNodeId filterKeyId);
+ void removeFilterKey(Qt3DCore::QNodeId filterKeyId);
- void appendBinding(const ParameterMapping &binding);
- void removeBinding(const Qt3DCore::QNodeId &bindingId);
-
- void appendRenderState(const Qt3DCore::QNodeId &id, RenderState *renderState);
- void removeRenderState(const Qt3DCore::QNodeId &renderStateId);
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
Qt3DCore::QNodeId m_shaderUuid;
- QHash<Qt3DCore::QNodeId, ParameterMapping> m_bindings;
- QHash<Qt3DCore::QNodeId, RenderState *> m_renderStates;
- QList<Qt3DCore::QNodeId> m_annotationList;
+ QVector<Qt3DCore::QNodeId> m_filterKeyList;
ParameterPack m_parameterPack;
};
diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp
index d15147ef9..b048909f1 100644
--- a/src/render/materialsystem/shader.cpp
+++ b/src/render/materialsystem/shader.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,9 +45,11 @@
#include <QOpenGLShaderProgram>
#include <QMutexLocker>
#include <qshaderprogram.h>
-#include <Qt3DRender/private/graphicscontext_p.h>
#include <Qt3DRender/private/attachmentpack_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/private/graphicscontext_p.h>
+#include <Qt3DRender/private/qshaderprogram_p.h>
+#include <Qt3DRender/private/stringtoint_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -54,10 +59,11 @@ namespace Qt3DRender {
namespace Render {
Shader::Shader()
- : QBackendNode()
- , m_program(Q_NULLPTR)
+ : BackendNode()
+ , m_program(nullptr)
, m_isLoaded(false)
, m_dna(0)
+ , m_graphicsContext(nullptr)
{
m_shaderCode.resize(static_cast<int>(QShaderProgram::Compute) + 1);
}
@@ -70,11 +76,17 @@ Shader::~Shader()
void Shader::cleanup()
{
+ // Remove this shader from the hash in the graphics context so
+ // nothing tries to use it after it has been recycled
+ if (m_graphicsContext)
+ m_graphicsContext->removeProgram(dna(), peerId());
+
+ QBackendNode::setEnabled(false);
m_isLoaded = false;
m_dna = 0;
// TO DO: ShaderProgram is leaked as of now
// Fix that taking care that they may be shared given a same dna
- m_program = Q_NULLPTR;
+ m_program = nullptr;
m_uniformsNames.clear();
m_attributesNames.clear();
m_uniformBlockNames.clear();
@@ -83,20 +95,21 @@ void Shader::cleanup()
m_uniformBlocks.clear();
}
-void Shader::updateFromPeer(Qt3DCore::QNode *peer)
+void Shader::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QShaderProgram *shader = static_cast<QShaderProgram *>(peer);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QShaderProgramData>>(change);
+ const auto &data = typedChange->data;
- for (int i = QShaderProgram::Vertex; i <= QShaderProgram::Compute; ++i) {
+ for (int i = QShaderProgram::Vertex; i <= QShaderProgram::Compute; ++i)
m_shaderCode[i].clear();
- }
+ m_shaderCode[QShaderProgram::Vertex] = data.vertexShaderCode;
+ m_shaderCode[QShaderProgram::TessellationControl] = data.tessellationControlShaderCode;
+ m_shaderCode[QShaderProgram::TessellationEvaluation] = data.tessellationEvaluationShaderCode;
+ m_shaderCode[QShaderProgram::Geometry] = data.geometryShaderCode;
+ m_shaderCode[QShaderProgram::Fragment] = data.fragmentShaderCode;
+ m_shaderCode[QShaderProgram::Compute] = data.computeShaderCode;
m_isLoaded = false;
-
- for (int i = QShaderProgram::Vertex; i <= QShaderProgram::Compute; ++i) {
- QShaderProgram::ShaderType type = static_cast<const QShaderProgram::ShaderType>(i);
- m_shaderCode[i] = shader->shaderCode(type);
- }
updateDNA();
}
@@ -115,6 +128,11 @@ QVector<QString> Shader::uniformBlockNames() const
return m_uniformBlockNames;
}
+QVector<QString> Shader::storageBlockNames() const
+{
+ return m_shaderStorageBlockNames;
+}
+
QVector<QByteArray> Shader::shaderCode() const
{
return m_shaderCode;
@@ -122,8 +140,8 @@ QVector<QByteArray> Shader::shaderCode() const
void Shader::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- if (e->type() == NodeUpdated) {
- QScenePropertyChangePtr propertyChange = e.staticCast<QScenePropertyChange>();
+ if (e->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr propertyChange = e.staticCast<QPropertyUpdatedChange>();
QVariant propertyValue = propertyChange->value();
if (propertyChange->propertyName() == QByteArrayLiteral("vertexSourceCode")) {
@@ -147,57 +165,72 @@ void Shader::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
}
if (!m_isLoaded)
updateDNA();
+ markDirty(AbstractRenderer::AllDirty);
}
-}
-bool Shader::isLoaded() const
-{
- return m_isLoaded;
+ BackendNode::sceneChangeEvent(e);
}
-ProgramDNA Shader::dna() const
+QHash<QString, ShaderUniform> Shader::activeUniformsForUniformBlock(int blockIndex) const
{
- return m_dna;
+ return m_uniformBlockIndexToShaderUniforms.value(blockIndex);
}
-QVector<ShaderUniform> Shader::uniforms() const
+ShaderUniformBlock Shader::uniformBlockForBlockIndex(int blockIndex)
{
- return m_uniforms;
+ for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ if (m_uniformBlocks[i].m_index == blockIndex) {
+ return m_uniformBlocks[i];
+ }
+ }
+ return ShaderUniformBlock();
}
-QVector<ShaderAttribute> Shader::attributes() const
+ShaderUniformBlock Shader::uniformBlockForBlockNameId(int blockNameId)
{
- return m_attributes;
+ for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ if (m_uniformBlocks[i].m_nameId == blockNameId) {
+ return m_uniformBlocks[i];
+ }
+ }
+ return ShaderUniformBlock();
}
-QVector<ShaderUniformBlock> Shader::uniformBlocks() const
+ShaderUniformBlock Shader::uniformBlockForBlockName(const QString &blockName)
{
- return m_uniformBlocks;
+ for (int i = 0, m = m_uniformBlocks.size(); i < m; ++i) {
+ if (m_uniformBlocks[i].m_name == blockName) {
+ return m_uniformBlocks[i];
+ }
+ }
+ return ShaderUniformBlock();
}
-QHash<QString, ShaderUniform> Shader::activeUniformsForBlock(int blockIndex) const
+ShaderStorageBlock Shader::storageBlockForBlockIndex(int blockIndex)
{
- return m_blockIndexToShaderUniforms.value(blockIndex);
+ for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ if (m_shaderStorageBlocks[i].m_index == blockIndex)
+ return m_shaderStorageBlocks[i];
+ }
+ return ShaderStorageBlock();
}
-ShaderUniformBlock Shader::uniformBlock(int blockIndex)
+ShaderStorageBlock Shader::storageBlockForBlockNameId(int blockNameId)
{
- for (int i = 0; i < m_uniformBlocks.size(); ++i) {
- if (m_uniformBlocks[i].m_index == blockIndex) {
- return m_uniformBlocks[i];
- }
+ for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ if (m_shaderStorageBlocks[i].m_nameId == blockNameId)
+ return m_shaderStorageBlocks[i];
}
- return ShaderUniformBlock();
+ return ShaderStorageBlock();
}
-ShaderUniformBlock Shader::uniformBlock(const QString &blockName)
+ShaderStorageBlock Shader::storageBlockForBlockName(const QString &blockName)
{
- for (int i = 0; i < m_uniformBlocks.size(); ++i) {
- if (m_uniformBlocks[i].m_name == blockName) {
- return m_uniformBlocks[i];
- }
+ for (int i = 0, m = m_shaderStorageBlockNames.size(); i < m; ++i) {
+ if (m_shaderStorageBlocks[i].m_name == blockName)
+ return m_shaderStorageBlocks[i];
}
- return ShaderUniformBlock();
+ return ShaderStorageBlock();
}
/*!
@@ -207,6 +240,7 @@ QOpenGLShaderProgram *Shader::getOrCreateProgram(GraphicsContext *ctx)
{
if (!m_isLoaded) {
delete m_program;
+ m_graphicsContext = ctx;
m_program = createProgram(ctx);
if (!m_program)
m_program = createDefaultProgram();
@@ -215,15 +249,15 @@ QOpenGLShaderProgram *Shader::getOrCreateProgram(GraphicsContext *ctx)
return m_program;
}
-void Shader::updateUniforms(GraphicsContext *ctx, const QUniformPack &pack)
+void Shader::updateUniforms(GraphicsContext *ctx, const ShaderParameterPack &pack)
{
- const QHash<QString, const QUniformValue* > &values = pack.uniforms();
- const QHash<QString, const QUniformValue* >::const_iterator valueEnd = values.constEnd();
+ const PackUniformHash values = pack.uniforms();
+ const PackUniformHash::const_iterator valueEnd = values.constEnd();
- Q_FOREACH (const ShaderUniform &uniform, m_uniforms) {
- QHash<QString, const QUniformValue* >::const_iterator valueIt = values.constFind(uniform.m_name);
+ for (const ShaderUniform &uniform : qAsConst(m_uniforms)) {
+ PackUniformHash::const_iterator valueIt = values.constFind(uniform.m_nameId);
if (valueIt != valueEnd)
- valueIt.value()->apply(ctx, uniform);
+ valueIt.value().apply(ctx, uniform);
}
}
@@ -267,7 +301,7 @@ QOpenGLShaderProgram *Shader::createProgram(GraphicsContext *context)
// Compile shaders
QShaderProgram::ShaderType type = static_cast<const QShaderProgram::ShaderType>(i);
if (!m_shaderCode[type].isEmpty() && !p->addShaderFromSourceCode(shaderType(type), m_shaderCode[type]))
- qWarning() << "Failed to compile shader:" << p->log();
+ qWarning().noquote() << "Failed to compile shader:" << p->log();
}
// Call glBindFragDataLocation and link the program
@@ -275,8 +309,8 @@ QOpenGLShaderProgram *Shader::createProgram(GraphicsContext *context)
// fragOutputs, they should all be the same for a given shader
context->bindFragOutputs(p->programId(), m_fragOutputs);
if (!p->link()) {
- qWarning() << "Failed to link shader program:" << p->log();
- return Q_NULLPTR;
+ qWarning().noquote() << "Failed to link shader program:" << p->log();
+ return nullptr;
}
// take from scoped-pointer so it doesn't get deleted
@@ -321,24 +355,31 @@ void Shader::initializeUniforms(const QVector<ShaderUniform> &uniformsDescriptio
{
m_uniforms = uniformsDescription;
m_uniformsNames.resize(uniformsDescription.size());
+ m_uniformsNamesIds.resize(uniformsDescription.size());
QHash<QString, ShaderUniform> activeUniformsInDefaultBlock;
- for (int i = 0; i < uniformsDescription.size(); i++) {
- m_uniformsNames[i] = uniformsDescription[i].m_name;
+ for (int i = 0, m = uniformsDescription.size(); i < m; i++) {
+ m_uniformsNames[i] = m_uniforms[i].m_name;
+ m_uniforms[i].m_nameId = StringToInt::lookupId(m_uniformsNames[i]);
+ m_uniformsNamesIds[i] = m_uniforms[i].m_nameId;
if (uniformsDescription[i].m_blockIndex == -1) { // Uniform is in default block
qCDebug(Shaders) << "Active Uniform in Default Block " << uniformsDescription[i].m_name << uniformsDescription[i].m_blockIndex;
activeUniformsInDefaultBlock.insert(uniformsDescription[i].m_name, uniformsDescription[i]);
}
}
- m_blockIndexToShaderUniforms.insert(-1, activeUniformsInDefaultBlock);
+ m_uniformBlockIndexToShaderUniforms.insert(-1, activeUniformsInDefaultBlock);
}
void Shader::initializeAttributes(const QVector<ShaderAttribute> &attributesDescription)
{
m_attributes = attributesDescription;
m_attributesNames.resize(attributesDescription.size());
- for (int i = 0; i < attributesDescription.size(); i++) {
+ m_attributeNamesIds.resize(attributesDescription.size());
+ for (int i = 0, m = attributesDescription.size(); i < m; i++) {
m_attributesNames[i] = attributesDescription[i].m_name;
+ m_attributes[i].m_nameId = StringToInt::lookupId(m_attributesNames[i]);
+ m_attributeNamesIds[i] = m_attributes[i].m_nameId;
+ qDebug() << m_attributes[i].m_nameId << m_attributeNamesIds[i] << m_attributesNames[i];
qCDebug(Shaders) << "Active Attribute " << attributesDescription[i].m_name;
}
}
@@ -347,8 +388,11 @@ void Shader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &uniformB
{
m_uniformBlocks = uniformBlockDescription;
m_uniformBlockNames.resize(uniformBlockDescription.size());
- for (int i = 0; i < uniformBlockDescription.size(); ++i) {
- m_uniformBlockNames[i] = uniformBlockDescription[i].m_name;
+ m_uniformBlockNamesIds.resize(uniformBlockDescription.size());
+ for (int i = 0, m = uniformBlockDescription.size(); i < m; ++i) {
+ m_uniformBlockNames[i] = m_uniformBlocks[i].m_name;
+ m_uniformBlockNamesIds[i] = StringToInt::lookupId(m_uniformBlockNames[i]);
+ m_uniformBlocks[i].m_nameId = m_uniformBlockNamesIds[i];
qCDebug(Shaders) << "Initializing Uniform Block {" << m_uniformBlockNames[i] << "}";
// Find all active uniforms for the shader block
@@ -364,14 +408,28 @@ void Shader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &uniformB
if (uniformsIt->m_blockIndex == uniformBlockDescription[i].m_index) {
QString uniformName = *uniformNamesIt;
if (!m_uniformBlockNames[i].isEmpty() && !uniformName.startsWith(m_uniformBlockNames[i]))
- uniformName = m_uniformBlockNames[i] + QStringLiteral(".") + *uniformNamesIt;
+ uniformName = m_uniformBlockNames[i] + QLatin1Char('.') + *uniformNamesIt;
activeUniformsInBlock.insert(uniformName, *uniformsIt);
qCDebug(Shaders) << "Active Uniform Block " << uniformName << " in block " << m_uniformBlockNames[i] << " at index " << uniformsIt->m_blockIndex;
}
++uniformsIt;
++uniformNamesIt;
}
- m_blockIndexToShaderUniforms.insert(uniformBlockDescription[i].m_index, activeUniformsInBlock);
+ m_uniformBlockIndexToShaderUniforms.insert(uniformBlockDescription[i].m_index, activeUniformsInBlock);
+ }
+}
+
+void Shader::initializeShaderStorageBlocks(const QVector<ShaderStorageBlock> &shaderStorageBlockDescription)
+{
+ m_shaderStorageBlocks = shaderStorageBlockDescription;
+ m_shaderStorageBlockNames.resize(shaderStorageBlockDescription.size());
+ m_shaderStorageBlockNamesIds.resize(shaderStorageBlockDescription.size());
+
+ for (int i = 0, m = shaderStorageBlockDescription.size(); i < m; ++i) {
+ m_shaderStorageBlockNames[i] = m_shaderStorageBlocks[i].m_name;
+ m_shaderStorageBlockNamesIds[i] = StringToInt::lookupId(m_shaderStorageBlockNames[i]);
+ m_shaderStorageBlocks[i].m_nameId =m_shaderStorageBlockNamesIds[i];
+ qCDebug(Shaders) << "Initializing Shader Storage Block {" << m_shaderStorageBlockNames[i] << "}";
}
}
@@ -384,14 +442,20 @@ void Shader::initialize(const Shader &other)
{
Q_ASSERT(m_dna == other.m_dna);
m_program = other.m_program;
+ m_uniformsNamesIds = other.m_uniformsNamesIds;
m_uniformsNames = other.m_uniformsNames;
m_uniforms = other.m_uniforms;
m_attributesNames = other.m_attributesNames;
+ m_attributeNamesIds = other.m_attributeNamesIds;
m_attributes = other.m_attributes;
+ m_uniformBlockNamesIds = other.m_uniformBlockNamesIds;
m_uniformBlockNames = other.m_uniformBlockNames;
m_uniformBlocks = other.m_uniformBlocks;
- m_blockIndexToShaderUniforms = other.m_blockIndexToShaderUniforms;
+ m_uniformBlockIndexToShaderUniforms = other.m_uniformBlockIndexToShaderUniforms;
m_fragOutputs = other.m_fragOutputs;
+ m_shaderStorageBlockNamesIds = other.m_shaderStorageBlockNamesIds;
+ m_shaderStorageBlockNames = other.m_shaderStorageBlockNames;
+ m_shaderStorageBlocks = other.m_shaderStorageBlocks;
m_isLoaded = other.m_isLoaded;
}
diff --git a/src/render/materialsystem/shader_p.h b/src/render/materialsystem/shader_p.h
index 8bf53bbfe..0bf0c528f 100644
--- a/src/render/materialsystem/shader_p.h
+++ b/src/render/materialsystem/shader_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,11 +51,11 @@
// We mean it.
//
-#include <QMutex>
-#include <QVector>
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/private/quniformvalue_p.h>
#include <Qt3DRender/private/shadervariables_p.h>
-#include <Qt3DCore/qbackendnode.h>
+#include <QMutex>
+#include <QVector>
QT_BEGIN_NAMESPACE
@@ -69,7 +72,7 @@ class AttachmentPack;
typedef uint ProgramDNA;
-class Q_AUTOTEST_EXPORT Shader : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT Shader : public BackendNode
{
public:
Shader();
@@ -77,42 +80,63 @@ public:
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
- void updateUniforms(GraphicsContext *ctx, const QUniformPack &pack);
+ void updateUniforms(GraphicsContext *ctx, const ShaderParameterPack &pack);
void setFragOutputs(const QHash<QString, int> &fragOutputs);
+ inline QVector<int> uniformsNamesIds() const Q_DECL_NOEXCEPT { return m_uniformsNamesIds; }
+ inline QVector<int> uniformBlockNamesIds() const Q_DECL_NOEXCEPT { return m_uniformBlockNamesIds; }
+ inline QVector<int> storageBlockNamesIds() const Q_DECL_NOEXCEPT { return m_shaderStorageBlockNamesIds; }
+ inline QVector<int> attributeNamesIds() const Q_DECL_NOEXCEPT { return m_attributeNamesIds; }
+
QVector<QString> uniformsNames() const;
QVector<QString> attributesNames() const;
QVector<QString> uniformBlockNames() const;
+ QVector<QString> storageBlockNames() const;
QVector<QByteArray> shaderCode() const;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- bool isLoaded() const;
- ProgramDNA dna() const;
+ bool isLoaded() const Q_DECL_NOEXCEPT { return m_isLoaded; }
+ ProgramDNA dna() const Q_DECL_NOEXCEPT { return m_dna; }
+
+ inline QVector<ShaderUniform> uniforms() const Q_DECL_NOEXCEPT { return m_uniforms; }
+ inline QVector<ShaderAttribute> attributes() const Q_DECL_NOEXCEPT { return m_attributes; }
+ inline QVector<ShaderUniformBlock> uniformBlocks() const Q_DECL_NOEXCEPT { return m_uniformBlocks; }
+ inline QVector<ShaderStorageBlock> storageBlocks() const Q_DECL_NOEXCEPT { return m_shaderStorageBlocks; }
- QVector<ShaderUniform> uniforms() const;
- QVector<ShaderAttribute> attributes() const;
- QVector<ShaderUniformBlock> uniformBlocks() const;
+ QHash<QString, ShaderUniform> activeUniformsForUniformBlock(int blockIndex) const;
- QHash<QString, ShaderUniform> activeUniformsForBlock(int blockIndex) const;
- ShaderUniformBlock uniformBlock(int blockIndex);
- ShaderUniformBlock uniformBlock(const QString &blockName);
+ ShaderUniformBlock uniformBlockForBlockIndex(int blockNameId);
+ ShaderUniformBlock uniformBlockForBlockNameId(int blockIndex);
+ ShaderUniformBlock uniformBlockForBlockName(const QString &blockName);
+
+ ShaderStorageBlock storageBlockForBlockIndex(int blockIndex);
+ ShaderStorageBlock storageBlockForBlockNameId(int blockNameId);
+ ShaderStorageBlock storageBlockForBlockName(const QString &blockName);
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QOpenGLShaderProgram *m_program;
QOpenGLShaderProgram *createProgram(GraphicsContext *context);
QOpenGLShaderProgram *createDefaultProgram();
QVector<QString> m_uniformsNames;
+ QVector<int> m_uniformsNamesIds;
QVector<ShaderUniform> m_uniforms;
QVector<QString> m_attributesNames;
+ QVector<int> m_attributeNamesIds;
QVector<ShaderAttribute> m_attributes;
QVector<QString> m_uniformBlockNames;
+ QVector<int> m_uniformBlockNamesIds;
QVector<ShaderUniformBlock> m_uniformBlocks;
- QHash<int, QHash<QString, ShaderUniform> > m_blockIndexToShaderUniforms;
+ QHash<int, QHash<QString, ShaderUniform> > m_uniformBlockIndexToShaderUniforms;
+
+ QVector<QString> m_shaderStorageBlockNames;
+ QVector<int> m_shaderStorageBlockNamesIds;
+ QVector<ShaderStorageBlock> m_shaderStorageBlocks;
QHash<QString, int> m_fragOutputs;
@@ -121,6 +145,7 @@ private:
bool m_isLoaded;
ProgramDNA m_dna;
QMutex m_mutex;
+ GraphicsContext *m_graphicsContext;
void updateDNA();
@@ -128,6 +153,7 @@ private:
void initializeUniforms(const QVector<ShaderUniform> &uniformsDescription);
void initializeAttributes(const QVector<ShaderAttribute> &attributesDescription);
void initializeUniformBlocks(const QVector<ShaderUniformBlock> &uniformBlockDescription);
+ void initializeShaderStorageBlocks(const QVector<ShaderStorageBlock> &shaderStorageBlockDescription);
void initialize(const Shader &other);
@@ -135,6 +161,15 @@ private:
friend class GraphicsContext;
};
+#ifndef QT_NO_DEBUG_STREAM
+inline QDebug operator<<(QDebug dbg, const Shader &shader)
+{
+ QDebugStateSaver saver(dbg);
+ dbg << "QNodeId =" << shader.peerId() << "dna =" << shader.dna() << endl;
+ return dbg;
+}
+#endif
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp
index 22548498b..0ac462e8d 100644
--- a/src/render/materialsystem/shaderdata.cpp
+++ b/src/render/materialsystem/shaderdata.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,12 +42,14 @@
#include "qshaderdata_p.h"
#include <QMetaProperty>
#include <QMetaObject>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qdynamicpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <private/graphicscontext_p.h>
#include <private/qbackendnode_p.h>
-#include <private/uniformbuffer_p.h>
+#include <private/glbuffer_p.h>
#include <private/managers_p.h>
#include <private/nodemanagers_p.h>
+#include <private/renderviewjobutils_p.h>
QT_BEGIN_NAMESPACE
@@ -53,10 +58,16 @@ using namespace Qt3DCore;
namespace Qt3DRender {
namespace Render {
-QList<Qt3DCore::QNodeId> ShaderData::m_updatedShaderData;
+namespace {
+
+const int qNodeIdTypeId = qMetaTypeId<Qt3DCore::QNodeId>();
+
+}
+
+QVector<Qt3DCore::QNodeId> ShaderData::m_updatedShaderData;
ShaderData::ShaderData()
- : m_managers(Q_NULLPTR)
+ : m_managers(nullptr)
{
}
@@ -69,27 +80,45 @@ void ShaderData::setManagers(NodeManagers *managers)
m_managers = managers;
}
-ShaderData *ShaderData::lookupResource(NodeManagers *managers, const QNodeId &id)
+void ShaderData::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
{
- ShaderData *shaderData = managers->shaderDataManager()->lookupResource(id);
- if (!shaderData)
- shaderData = managers->lightManager()->lookupResource(id);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QShaderDataData>>(change);
+ const QShaderDataData &data = typedChange->data;
+
+ m_propertyReader = data.propertyReader;
+
+ for (const QPair<QByteArray, QVariant> &entry : data.properties) {
+ if (entry.first == QByteArrayLiteral("data") ||
+ entry.first == QByteArrayLiteral("childNodes")) // We don't handle default Node properties
+ continue;
+ const QVariant &propertyValue = entry.second;
+ const QString propertyName = QString::fromLatin1(entry.first);
+
+ m_properties.insert(propertyName, propertyValue);
+ m_originalProperties.insert(propertyName, propertyValue);
- return shaderData;
+ // We check if the property is a QNodeId or QVector<QNodeId> so that we can
+ // check nested QShaderData for update
+ if (propertyValue.userType() == qNodeIdTypeId) {
+ m_nestedShaderDataProperties.insert(propertyName, propertyValue);
+ } else if (propertyValue.userType() == QMetaType::QVariantList) {
+ QVariantList list = propertyValue.value<QVariantList>();
+ if (list.count() > 0 && list.at(0).userType() == qNodeIdTypeId)
+ m_nestedShaderDataProperties.insert(propertyName, propertyValue);
+ }
+ }
+ // Note: we ignore transformed properties for now until we figure out how to best handle them
}
-ShaderData *ShaderData::lookupResource(const QNodeId &id)
+
+ShaderData *ShaderData::lookupResource(NodeManagers *managers, QNodeId id)
{
- return ShaderData::lookupResource(m_managers, id);
+ return managers->shaderDataManager()->lookupResource(id);
}
-void ShaderData::updateFromPeer(Qt3DCore::QNode *peer)
+ShaderData *ShaderData::lookupResource(QNodeId id)
{
- m_properties.clear();
- const QShaderData *shaderData = static_cast<const QShaderData *>(peer);
- m_propertyReader = shaderData->propertyReader();
- if (!m_propertyReader.isNull())
- readPeerProperties(const_cast<QShaderData *>(shaderData));
+ return ShaderData::lookupResource(m_managers, id);
}
// Call by cleanup job (single thread)
@@ -101,14 +130,15 @@ void ShaderData::clearUpdatedProperties()
while (it != end) {
if (it.value().userType() == QMetaType::QVariantList) {
- Q_FOREACH (const QVariant &v, it.value().value<QVariantList>()) {
+ const auto values = it.value().value<QVariantList>();
+ for (const QVariant &v : values) {
ShaderData *nested = lookupResource(v.value<QNodeId>());
- if (nested != Q_NULLPTR)
+ if (nested != nullptr)
nested->clearUpdatedProperties();
}
} else {
ShaderData *nested = lookupResource(it.value().value<QNodeId>());
- if (nested != Q_NULLPTR)
+ if (nested != nullptr)
nested->clearUpdatedProperties();
}
++it;
@@ -117,7 +147,7 @@ void ShaderData::clearUpdatedProperties()
void ShaderData::cleanup(NodeManagers *managers)
{
- Q_FOREACH (const Qt3DCore::QNodeId &id, m_updatedShaderData) {
+ for (Qt3DCore::QNodeId id : qAsConst(m_updatedShaderData)) {
ShaderData *shaderData = ShaderData::lookupResource(managers, id);
if (shaderData)
shaderData->clearUpdatedProperties();
@@ -145,11 +175,11 @@ bool ShaderData::updateViewTransform(const QMatrix4x4 &viewMatrix)
// We check the matrices and decide if the transform has changed since the previous call to needsUpdate
if (m_viewMatrix != viewMatrix) {
m_viewMatrix = viewMatrix;
- const QHash<QString, QShaderData::TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
- QHash<QString, QShaderData::TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
+ const QHash<QString, TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
+ QHash<QString, TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
while (transformedIt != transformedEnd) {
- if (transformedIt.value() == QShaderData::ModelToEye) {
+ if (transformedIt.value() == ModelToEye) {
m_updatedProperties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
m_properties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
}
@@ -160,12 +190,19 @@ bool ShaderData::updateViewTransform(const QMatrix4x4 &viewMatrix)
QHash<QString, QVariant>::const_iterator it = m_nestedShaderDataProperties.begin();
while (it != end) {
- if (it.value().userType() == QMetaType::QVariantList) {
+ const int userType = it.value().userType();
+
+ if (userType == QMetaType::QVariantList) {
QVariantList updatedNodes;
bool nestedNeedsUpdate = false;
- Q_FOREACH (const QVariant &v, it.value().value<QVariantList>()) {
- ShaderData *nested = lookupResource(v.value<QNodeId>());
- if (nested != Q_NULLPTR) {
+ const QVariantList values = variant_value<QVariantList>(it.value());
+ for (const QVariant &v : values) {
+ if (v.userType() != qNodeIdTypeId)
+ continue;
+
+ const Qt3DCore::QNodeId nestedId = variant_value<Qt3DCore::QNodeId>(v);
+ ShaderData *nested = lookupResource(nestedId);
+ if (nested != nullptr) {
// We need to add the nested nodes to the updated property list
// as we need to maintain order
// if node[0] doesn't need update but node[1] does,
@@ -177,9 +214,10 @@ bool ShaderData::updateViewTransform(const QMatrix4x4 &viewMatrix)
// Of course we only add all the nodes if at least one of the nested nodes required and update
if (nestedNeedsUpdate && !updatedNodes.empty())
m_updatedProperties.insert(it.key(), updatedNodes);
- } else {
- ShaderData *nested = lookupResource(it.value().value<QNodeId>());
- if (nested != Q_NULLPTR && nested->updateViewTransform(viewMatrix))
+ } else if (userType == qNodeIdTypeId) {
+ const Qt3DCore::QNodeId nestedId = variant_value<Qt3DCore::QNodeId>(it.value());
+ ShaderData *nested = lookupResource(nestedId);
+ if (nested != nullptr && nested->updateViewTransform(viewMatrix))
m_updatedProperties.insert(it.key(), it.value());
}
++it;
@@ -192,11 +230,11 @@ bool ShaderData::updateWorldTransform(const QMatrix4x4 &worldMatrix)
if (m_worldMatrix != worldMatrix) {
m_worldMatrix = worldMatrix;
- const QHash<QString, QShaderData::TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
- QHash<QString, QShaderData::TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
+ const QHash<QString, TransformType>::const_iterator transformedEnd = m_transformedProperties.end();
+ QHash<QString, TransformType>::const_iterator transformedIt = m_transformedProperties.begin();
while (transformedIt != transformedEnd) {
- if (transformedIt.value() == QShaderData::ModelToEye) {
+ if (transformedIt.value() == ModelToEye) {
m_updatedProperties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
m_properties.insert(transformedIt.key(), m_viewMatrix * m_worldMatrix * m_originalProperties.value(transformedIt.key()).value<QVector3D>());
} else {
@@ -215,12 +253,10 @@ bool ShaderData::updateWorldTransform(const QMatrix4x4 &worldMatrix)
void ShaderData::markDirty()
{
QMutexLocker lock(&m_mutex);
- if (!ShaderData::m_updatedShaderData.contains(peerUuid()))
- ShaderData::m_updatedShaderData.append(peerUuid());
+ if (!ShaderData::m_updatedShaderData.contains(peerId()))
+ ShaderData::m_updatedShaderData.append(peerId());
}
-const int qNodeIdTypeId = qMetaTypeId<Qt3DCore::QNodeId>();
-
void ShaderData::readPeerProperties(QShaderData *shaderData)
{
const QMetaObject *metaObject = shaderData->metaObject();
@@ -237,7 +273,7 @@ void ShaderData::readPeerProperties(QShaderData *shaderData)
m_properties.insert(propertyName, propertyValue);
m_originalProperties.insert(propertyName, propertyValue);
- // We check if the property is a QNodeId or QList<QNodeId> so that we can
+ // We check if the property is a QNodeId or QVector<QNodeId> so that we can
// check nested QShaderData for update
if (propertyValue.userType() == qNodeIdTypeId) {
m_nestedShaderDataProperties.insert(propertyName, propertyValue);
@@ -248,6 +284,20 @@ void ShaderData::readPeerProperties(QShaderData *shaderData)
}
}
+ // Also check the dynamic properties
+ const auto propertyNames = shaderData->dynamicPropertyNames();
+ for (const QByteArray &propertyName : propertyNames) {
+ if (propertyName == "data" || propertyName == "childNodes") // We don't handle default Node properties
+ continue;
+
+ QVariant value = m_propertyReader->readProperty(shaderData->property(propertyName));
+ QString key = QString::fromLatin1(propertyName);
+
+ m_properties.insert(key, value);
+ m_originalProperties.insert(key, value);
+ }
+
+
// We look for transformed properties
QHash<QString, QVariant>::iterator it = m_properties.begin();
const QHash<QString, QVariant>::iterator end = m_properties.end();
@@ -255,10 +305,10 @@ void ShaderData::readPeerProperties(QShaderData *shaderData)
while (it != end) {
if (static_cast<QMetaType::Type>(it.value().type()) == QMetaType::QVector3D) {
// if there is a matching QShaderData::TransformType propertyTransformed
- QVariant value = m_properties.value(it.key() + QStringLiteral("Transformed"));
+ QVariant value = m_properties.value(it.key() + QLatin1String("Transformed"));
// if that's the case, we apply a space transformation to the property
if (value.isValid() && value.type() == QVariant::Int)
- m_transformedProperties.insert(it.key(), static_cast<QShaderData::TransformType>(value.toInt()));
+ m_transformedProperties.insert(it.key(), static_cast<TransformType>(value.toInt()));
}
++it;
}
@@ -266,69 +316,61 @@ void ShaderData::readPeerProperties(QShaderData *shaderData)
void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- if (!m_propertyReader.isNull()) {
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
- QString propertyName = QString::fromLatin1(propertyChange->propertyName());
- switch (e->type()) {
- case NodeUpdated: {
- // Note we aren't notified about nested QShaderData in this call
- // only scalar / vec properties
- if (m_properties.contains(propertyName)) {
- QVariant val = m_propertyReader->readProperty(propertyChange->value());
- // If this is a Transformed property, we need to multiply against the correct
- // matrices
- m_originalProperties.insert(propertyName, val);
- if (m_transformedProperties.contains(propertyName)) {
- if (m_transformedProperties[propertyName] == QShaderData::ModelToEye)
- val = m_viewMatrix * m_worldMatrix * val.value<QVector3D>();
- else
- val = m_worldMatrix * val.value<QVector3D>();
- }
- m_properties.insert(propertyName, val);
- m_updatedProperties.insert(propertyName, val);
- }
- break;
- }
- case NodeAdded: {
- m_properties.insert(propertyName, m_propertyReader->readProperty(propertyChange->value()));
- m_originalProperties.insert(propertyName, m_propertyReader->readProperty(propertyChange->value()));
- m_nestedShaderDataProperties.insert(propertyName, propertyChange->value());
- break;
+ if (!m_propertyReader.isNull() && e->type() == PropertyUpdated) {
+ QString propertyName;
+ QVariant propertyValue;
+
+ if (auto propertyChange = qSharedPointerDynamicCast<QPropertyUpdatedChange>(e)) {
+ propertyName = QString::fromLatin1(propertyChange->propertyName());
+ propertyValue = m_propertyReader->readProperty(propertyChange->value());
+ } else if (auto propertyChange = qSharedPointerDynamicCast<QDynamicPropertyUpdatedChange>(e)) {
+ propertyName = QString::fromLatin1(propertyChange->propertyName());
+ propertyValue = m_propertyReader->readProperty(propertyChange->value());
+ } else {
+ Q_UNREACHABLE();
}
- case NodeRemoved: {
- if (m_properties.contains(propertyName)) {
- m_originalProperties.remove(propertyName);
- m_properties.remove(propertyName);
- m_nestedShaderDataProperties.remove(propertyName);
+
+ // Note we aren't notified about nested QShaderData in this call
+ // only scalar / vec properties
+ if (m_properties.contains(propertyName)) {
+ // If this is a Transformed property, we need to multiply against the correct
+ // matrices
+ m_originalProperties.insert(propertyName, propertyValue);
+ if (m_transformedProperties.contains(propertyName)) {
+ if (m_transformedProperties[propertyName] == ModelToEye)
+ propertyValue = m_viewMatrix * m_worldMatrix * propertyValue.value<QVector3D>();
+ else
+ propertyValue = m_worldMatrix * propertyValue.value<QVector3D>();
}
- break;
- }
- default:
- break;
+ m_properties.insert(propertyName, propertyValue);
+ m_updatedProperties.insert(propertyName, propertyValue);
}
+ BackendNode::markDirty(AbstractRenderer::AllDirty);
}
+
+ BackendNode::sceneChangeEvent(e);
}
-RenderShaderDataFunctor::RenderShaderDataFunctor(NodeManagers *managers)
+RenderShaderDataFunctor::RenderShaderDataFunctor(AbstractRenderer *renderer, NodeManagers *managers)
: m_managers(managers)
+ , m_renderer(renderer)
{
}
-Qt3DCore::QBackendNode *RenderShaderDataFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *RenderShaderDataFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- ShaderData *backend = m_managers->shaderDataManager()->getOrCreateResource(frontend->id());
- backend->setFactory(factory);
+ ShaderData *backend = m_managers->shaderDataManager()->getOrCreateResource(change->subjectId());
backend->setManagers(m_managers);
- backend->setPeer(frontend);
+ backend->setRenderer(m_renderer);
return backend;
}
-Qt3DCore::QBackendNode *RenderShaderDataFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *RenderShaderDataFunctor::get(Qt3DCore::QNodeId id) const
{
return m_managers->shaderDataManager()->lookupResource(id);
}
-void RenderShaderDataFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void RenderShaderDataFunctor::destroy(Qt3DCore::QNodeId id) const
{
m_managers->shaderDataManager()->releaseResource(id);
}
diff --git a/src/render/materialsystem/shaderdata_p.h b/src/render/materialsystem/shaderdata_p.h
index 6aa75b5b7..27339cedd 100644
--- a/src/render/materialsystem/shaderdata_p.h
+++ b/src/render/materialsystem/shaderdata_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,8 +51,8 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
-#include <private/shadervariables_p.h>
+#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/private/shadervariables_p.h>
#include <Qt3DRender/qshaderdata.h>
#include <QMutex>
#include <QMatrix4x4>
@@ -61,12 +64,17 @@ namespace Qt3DRender {
namespace Render {
class GraphicsContext;
-class UniformBuffer;
+class GLBuffer;
class NodeManagers;
-class Q_AUTOTEST_EXPORT ShaderData : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT ShaderData : public BackendNode
{
public:
+ enum TransformType {
+ ModelToEye = 0,
+ ModelToWorld
+ };
+
ShaderData();
~ShaderData();
@@ -83,10 +91,10 @@ public:
// Called by FrameCleanupJob
static void cleanup(NodeManagers *managers);
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void setManagers(NodeManagers *managers);
protected:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
// 1 to 1 match with frontend properties, modified only by sceneChangeEvent
@@ -99,32 +107,33 @@ protected:
QHash<QString, QVariant> m_updatedProperties;
PropertyReaderInterfacePtr m_propertyReader;
QHash<QString, QVariant> m_nestedShaderDataProperties;
- QHash<QString, QShaderData::TransformType> m_transformedProperties;
+ QHash<QString, TransformType> m_transformedProperties;
QMutex m_mutex;
- static QList<Qt3DCore::QNodeId> m_updatedShaderData;
+ static QVector<Qt3DCore::QNodeId> m_updatedShaderData;
QMatrix4x4 m_worldMatrix;
QMatrix4x4 m_viewMatrix;
NodeManagers *m_managers;
void readPeerProperties(QShaderData *peer);
void clearUpdatedProperties();
- static ShaderData *lookupResource(NodeManagers *managers, const Qt3DCore::QNodeId &id);
- ShaderData *lookupResource(const Qt3DCore::QNodeId &id);
+ static ShaderData *lookupResource(NodeManagers *managers, Qt3DCore::QNodeId id);
+ ShaderData *lookupResource(Qt3DCore::QNodeId id);
friend class RenderShaderDataFunctor;
};
-class RenderShaderDataFunctor : public Qt3DCore::QBackendNodeFunctor
+class RenderShaderDataFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit RenderShaderDataFunctor(NodeManagers *managers);
+ explicit RenderShaderDataFunctor(AbstractRenderer *renderer, NodeManagers *managers);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
private:
NodeManagers *m_managers;
+ AbstractRenderer *m_renderer;
};
} // namespace Render
diff --git a/src/render/materialsystem/technique.cpp b/src/render/materialsystem/technique.cpp
index a89107b4a..a3a650f7a 100644
--- a/src/render/materialsystem/technique.cpp
+++ b/src/render/materialsystem/technique.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -41,10 +44,13 @@
#include <Qt3DRender/qtechnique.h>
#include <Qt3DRender/qgraphicsapifilter.h>
#include <Qt3DRender/private/renderer_p.h>
-#include <Qt3DRender/private/annotation_p.h>
+#include <Qt3DRender/private/filterkey_p.h>
+#include <Qt3DRender/private/qtechnique_p.h>
#include <Qt3DRender/private/shader_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <QDebug>
@@ -56,8 +62,7 @@ namespace Qt3DRender {
namespace Render {
Technique::Technique()
- : QBackendNode()
- , m_graphicsApiFilter(Q_NULLPTR)
+ : BackendNode()
{
}
@@ -68,123 +73,104 @@ Technique::~Technique()
void Technique::cleanup()
{
- if (m_graphicsApiFilter)
- delete m_graphicsApiFilter;
- m_graphicsApiFilter = Q_NULLPTR;
-}
-
-void Technique::updateFromPeer(Qt3DCore::QNode *peer)
-{
+ QBackendNode::setEnabled(false);
m_parameterPack.clear();
m_renderPasses.clear();
- m_annotationList.clear();
-
- if (m_graphicsApiFilter == Q_NULLPTR)
- m_graphicsApiFilter = new QGraphicsApiFilter();
-
- QTechnique *technique = static_cast<QTechnique *>(peer);
+ m_filterKeyList.clear();
+}
- if (technique != Q_NULLPTR) {
- Q_FOREACH (QParameter *p, technique->parameters())
- m_parameterPack.appendParameter(p->id());
- Q_FOREACH (QRenderPass *rPass, technique->renderPasses())
- appendRenderPass(rPass->id());
- Q_FOREACH (QAnnotation *annotation, technique->annotations())
- appendAnnotation(annotation->id());
+void Technique::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QTechniqueData>>(change);
+ const QTechniqueData &data = typedChange->data;
- // Copy GraphicsApiFilter info from frontend GraphicsApiFilter
- QGraphicsApiFilter *peerFilter = technique->graphicsApiFilter();
- m_graphicsApiFilter->copy(*peerFilter);
- }
+ m_graphicsApiFilterData = data.graphicsApiFilterData;
+ m_filterKeyList = data.filterKeyIds;
+ m_parameterPack.setParameters(data.parameterIds);
+ m_renderPasses = data.renderPassIds;
}
void Technique::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
switch (e->type()) {
-
- case NodeUpdated: {
- if (propertyChange->propertyName() == QByteArrayLiteral("graphicsApiFilter")) {
- QGraphicsApiFilter *filter = propertyChange->value().value<QGraphicsApiFilter *>();
- if (filter != Q_NULLPTR) {
- m_graphicsApiFilter->copy(*filter);
- delete filter;
- }
+ case PropertyUpdated: {
+ const auto change = qSharedPointerCast<QPropertyUpdatedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("graphicsApiFilterData")) {
+ GraphicsApiFilterData filterData = change->value().value<GraphicsApiFilterData>();
+ m_graphicsApiFilterData = filterData;
}
break;
}
- case NodeAdded: {
- if (propertyChange->propertyName() == QByteArrayLiteral("pass")) {
- appendRenderPass(propertyChange->value().value<QNodeId>());
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("parameter")) {
- m_parameterPack.appendParameter(propertyChange->value().value<QNodeId>());
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("annotation")) {
- appendAnnotation(propertyChange->value().value<QNodeId>());
- }
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("pass"))
+ appendRenderPass(change->addedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.appendParameter(change->addedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("filterKeys"))
+ appendFilterKey(change->addedNodeId());
break;
}
- case NodeRemoved: {
- if (propertyChange->propertyName() == QByteArrayLiteral("pass")) {
- removeRenderPass(propertyChange->value().value<QNodeId>());
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("parameter")) {
- m_parameterPack.removeParameter(propertyChange->value().value<QNodeId>());
- }
- else if (propertyChange->propertyName() == QByteArrayLiteral("annotation")) {
- removeAnnotation(propertyChange->value().value<QNodeId>());
- }
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("pass"))
+ removeRenderPass(change->removedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("parameter"))
+ m_parameterPack.removeParameter(change->removedNodeId());
+ else if (change->propertyName() == QByteArrayLiteral("filterKeys"))
+ removeFilterKey(change->removedNodeId());
break;
}
default:
break;
}
+ markDirty(AbstractRenderer::AllDirty);
+ BackendNode::sceneChangeEvent(e);
}
-QList<Qt3DCore::QNodeId> Technique::parameters() const
+QVector<Qt3DCore::QNodeId> Technique::parameters() const
{
return m_parameterPack.parameters();
}
-void Technique::appendRenderPass(const Qt3DCore::QNodeId &renderPassId)
+void Technique::appendRenderPass(Qt3DCore::QNodeId renderPassId)
{
if (!m_renderPasses.contains(renderPassId))
m_renderPasses.append(renderPassId);
}
-void Technique::removeRenderPass(const Qt3DCore::QNodeId &renderPassId)
+void Technique::removeRenderPass(Qt3DCore::QNodeId renderPassId)
{
m_renderPasses.removeOne(renderPassId);
}
-QList<Qt3DCore::QNodeId> Technique::annotations() const
+QVector<Qt3DCore::QNodeId> Technique::filterKeys() const
{
- return m_annotationList;
+ return m_filterKeyList;
}
-QList<Qt3DCore::QNodeId> Technique::renderPasses() const
+QVector<Qt3DCore::QNodeId> Technique::renderPasses() const
{
return m_renderPasses;
}
-QGraphicsApiFilter *Technique::graphicsApiFilter() const
+const GraphicsApiFilterData *Technique::graphicsApiFilter() const
{
- return m_graphicsApiFilter;
+ return &m_graphicsApiFilterData;
}
-void Technique::appendAnnotation(const Qt3DCore::QNodeId &criterionId)
+void Technique::appendFilterKey(Qt3DCore::QNodeId criterionId)
{
- if (!m_annotationList.contains(criterionId))
- m_annotationList.append(criterionId);
+ if (!m_filterKeyList.contains(criterionId))
+ m_filterKeyList.append(criterionId);
}
-void Technique::removeAnnotation(const Qt3DCore::QNodeId &criterionId)
+void Technique::removeFilterKey(Qt3DCore::QNodeId criterionId)
{
- m_annotationList.removeOne(criterionId);
+ m_filterKeyList.removeOne(criterionId);
}
} // namespace Render
diff --git a/src/render/materialsystem/technique_p.h b/src/render/materialsystem/technique_p.h
index ffeea4c8f..541076a0b 100644
--- a/src/render/materialsystem/technique_p.h
+++ b/src/render/materialsystem/technique_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,11 +52,12 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/private/parameterpack_p.h>
+#include <Qt3DRender/private/qgraphicsapifilter_p.h>
+#include <Qt3DRender/qfilterkey.h>
#include <QVector>
#include <QStringList>
-#include <Qt3DRender/private/parameterpack_p.h>
-#include <Qt3DRender/qannotation.h>
-#include <Qt3DCore/qbackendnode.h>
QT_BEGIN_NAMESPACE
@@ -62,41 +66,40 @@ namespace Qt3DRender {
class QTechnique;
class QParameter;
class QGraphicsApiFilter;
-class QAnnotation;
+class QFilterKey;
class QRenderPass;
namespace Render {
class TechniqueManager;
-class Technique : public Qt3DCore::QBackendNode
+class Technique : public BackendNode
{
public:
Technique();
~Technique();
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
- QList<Qt3DCore::QNodeId> parameters() const;
+ QVector<Qt3DCore::QNodeId> parameters() const;
- void appendRenderPass(const Qt3DCore::QNodeId &renderPassId);
- void removeRenderPass(const Qt3DCore::QNodeId &renderPassId);
+ void appendRenderPass(Qt3DCore::QNodeId renderPassId);
+ void removeRenderPass(Qt3DCore::QNodeId renderPassId);
- void appendAnnotation(const Qt3DCore::QNodeId &criterionId);
- void removeAnnotation(const Qt3DCore::QNodeId &criterionId);
+ void appendFilterKey(Qt3DCore::QNodeId criterionId);
+ void removeFilterKey(Qt3DCore::QNodeId criterionId);
- QList<Qt3DCore::QNodeId> annotations() const;
- QList<Qt3DCore::QNodeId> renderPasses() const;
- QGraphicsApiFilter *graphicsApiFilter() const;
+ QVector<Qt3DCore::QNodeId> filterKeys() const;
+ QVector<Qt3DCore::QNodeId> renderPasses() const;
+ const GraphicsApiFilterData *graphicsApiFilter() const;
private:
- QGraphicsApiFilter *m_graphicsApiFilter;
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+ GraphicsApiFilterData m_graphicsApiFilterData;
ParameterPack m_parameterPack;
- QList<Qt3DCore::QNodeId> m_annotationList;
- QList<Qt3DCore::QNodeId> m_renderPasses;
+ QVector<Qt3DCore::QNodeId> m_filterKeyList;
+ QVector<Qt3DCore::QNodeId> m_renderPasses;
};
} // namespace Render
diff --git a/src/render/picking/objectpicker.cpp b/src/render/picking/objectpicker.cpp
index c2f8a354f..eff6e3b3c 100644
--- a/src/render/picking/objectpicker.cpp
+++ b/src/render/picking/objectpicker.cpp
@@ -1,44 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "objectpicker_p.h"
+#include "qpickevent.h"
#include <Qt3DRender/qobjectpicker.h>
+#include <Qt3DRender/private/qobjectpicker_p.h>
#include <Qt3DRender/qattribute.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -47,9 +51,11 @@ namespace Qt3DRender {
namespace Render {
ObjectPicker::ObjectPicker()
- : QBackendNode(QBackendNode::ReadWrite)
+ : BackendNode(QBackendNode::ReadWrite)
, m_isDirty(false)
+ , m_isPressed(false)
, m_hoverEnabled(false)
+ , m_dragEnabled(false)
{
}
@@ -59,30 +65,38 @@ ObjectPicker::~ObjectPicker()
void ObjectPicker::cleanup()
{
+ BackendNode::setEnabled(false);
m_isDirty = false;
+ m_isPressed = false;
m_hoverEnabled = false;
+ m_dragEnabled = false;
}
-void ObjectPicker::updateFromPeer(Qt3DCore::QNode *peer)
+void ObjectPicker::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QObjectPicker *picker = static_cast<QObjectPicker *>(peer);
- if (picker) {
- m_hoverEnabled = picker->hoverEnabled();
- m_isDirty = true;
- }
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QObjectPickerData>>(change);
+ const auto &data = typedChange->data;
+ m_hoverEnabled = data.hoverEnabled;
+ m_dragEnabled = data.dragEnabled;
+ m_isDirty = true;
}
void ObjectPicker::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- const Qt3DCore::QScenePropertyChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QScenePropertyChange>(e);
- const QByteArray propertyName = propertyChange->propertyName();
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ const Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
- if (propertyChange->type() == Qt3DCore::NodeUpdated) {
- if (propertyName == QByteArrayLiteral("hoverEnabled")) {
+ if (propertyChange->propertyName() == QByteArrayLiteral("hoverEnabled")) {
m_hoverEnabled = propertyChange->value().toBool();
m_isDirty = true;
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("dragEnabled")) {
+ m_dragEnabled = propertyChange->value().toBool();
+ m_isDirty = true;
}
+ markDirty(AbstractRenderer::AllDirty);
}
+
+ BackendNode::sceneChangeEvent(e);
}
bool ObjectPicker::isDirty() const
@@ -90,6 +104,11 @@ bool ObjectPicker::isDirty() const
return m_isDirty;
}
+bool ObjectPicker::isPressed() const
+{
+ return m_isPressed;
+}
+
void ObjectPicker::unsetDirty()
{
m_isDirty = false;
@@ -100,48 +119,67 @@ void ObjectPicker::makeDirty()
m_isDirty = true;
}
-bool ObjectPicker::hoverEnabled() const
+bool ObjectPicker::isHoverEnabled() const
{
return m_hoverEnabled;
}
-void ObjectPicker::onClicked()
+bool ObjectPicker::isDragEnabled() const
{
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ return m_dragEnabled;
+}
+
+void ObjectPicker::onClicked(QPickEventPtr event)
+{
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("clicked");
- e->setTargetNode(peerUuid());
+ e->setValue(QVariant::fromValue(event));
+ notifyObservers(e);
+}
+
+void ObjectPicker::onMoved(QPickEventPtr event)
+{
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("moved");
+ e->setValue(QVariant::fromValue(event));
notifyObservers(e);
}
-void ObjectPicker::onPressed()
+void ObjectPicker::onPressed(QPickEventPtr event)
{
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("pressed");
- e->setTargetNode(peerUuid());
+ e->setValue(QVariant::fromValue(event));
+ m_isPressed = true;
notifyObservers(e);
}
-void ObjectPicker::onReleased()
+void ObjectPicker::onReleased(QPickEventPtr event)
{
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("released");
- e->setTargetNode(peerUuid());
+ e->setValue(QVariant::fromValue(event));
+ m_isPressed = false;
notifyObservers(e);
}
void ObjectPicker::onEntered()
{
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("entered");
- e->setTargetNode(peerUuid());
notifyObservers(e);
}
void ObjectPicker::onExited()
{
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, peerUuid()));
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("exited");
- e->setTargetNode(peerUuid());
notifyObservers(e);
}
diff --git a/src/render/picking/objectpicker_p.h b/src/render/picking/objectpicker_p.h
index 545c7ff95..f116aa332 100644
--- a/src/render/picking/objectpicker_p.h
+++ b/src/render/picking/objectpicker_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,37 +51,46 @@
// We mean it.
//
-#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DRender/private/backendnode_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+class QPickEvent;
+typedef QSharedPointer<QPickEvent> QPickEventPtr;
+
namespace Render {
-class Q_AUTOTEST_EXPORT ObjectPicker : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT ObjectPicker : public BackendNode
{
public:
ObjectPicker();
~ObjectPicker();
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_FINAL;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_FINAL;
bool isDirty() const;
+ bool isPressed() const;
void unsetDirty();
void makeDirty();
- bool hoverEnabled() const;
+ bool isHoverEnabled() const;
+ bool isDragEnabled() const;
- void onClicked();
- void onPressed();
- void onReleased();
+ void onClicked(QPickEventPtr event);
+ void onMoved(QPickEventPtr event);
+ void onPressed(QPickEventPtr event);
+ void onReleased(QPickEventPtr event);
void onEntered();
void onExited();
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
bool m_isDirty;
+ bool m_isPressed;
bool m_hoverEnabled;
+ bool m_dragEnabled;
};
} // Render
diff --git a/src/render/picking/pickeventfilter.cpp b/src/render/picking/pickeventfilter.cpp
index 54d021c55..a1ae52068 100644
--- a/src/render/picking/pickeventfilter.cpp
+++ b/src/render/picking/pickeventfilter.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -77,8 +80,7 @@ bool PickEventFilter::eventFilter(QObject *obj, QEvent *e)
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseMove:
- case QEvent::HoverMove:
- case Qt::TapGesture: {
+ case QEvent::HoverMove: {
QMutexLocker locker(&m_mutex);
m_pendingEvents.push_back(QMouseEvent(*static_cast<QMouseEvent *>(e)));
}
diff --git a/src/render/picking/pickeventfilter_p.h b/src/render/picking/pickeventfilter_p.h
index d34172e69..df94a3085 100644
--- a/src/render/picking/pickeventfilter_p.h
+++ b/src/render/picking/pickeventfilter_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -62,7 +65,7 @@ class PickEventFilter : public QObject
{
Q_OBJECT
public:
- explicit PickEventFilter(QObject *parent = Q_NULLPTR);
+ explicit PickEventFilter(QObject *parent = nullptr);
~PickEventFilter();
QList<QMouseEvent> pendingEvents();
diff --git a/src/render/picking/picking.pri b/src/render/picking/picking.pri
index 72ec6498c..c4c188a82 100644
--- a/src/render/picking/picking.pri
+++ b/src/render/picking/picking.pri
@@ -3,11 +3,15 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qobjectpicker.h \
$$PWD/qpickevent.h \
+ $$PWD/qpickevent_p.h \
+ $$PWD/qpicktriangleevent.h \
$$PWD/objectpicker_p.h \
- $$PWD/pickeventfilter_p.h
+ $$PWD/pickeventfilter_p.h \
+ $$PWD/qobjectpicker_p.h
SOURCES += \
$$PWD/qobjectpicker.cpp \
$$PWD/qpickevent.cpp \
+ $$PWD/qpicktriangleevent.cpp \
$$PWD/objectpicker.cpp \
$$PWD/pickeventfilter.cpp
diff --git a/src/render/picking/qobjectpicker.cpp b/src/render/picking/qobjectpicker.cpp
index 87dfd50f3..2eb981d69 100644
--- a/src/render/picking/qobjectpicker.cpp
+++ b/src/render/picking/qobjectpicker.cpp
@@ -1,43 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qobjectpicker.h"
+#include "qobjectpicker_p.h"
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/private/qcomponent_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qpickevent.h>
QT_BEGIN_NAMESPACE
@@ -51,7 +55,7 @@ namespace Qt3DRender {
\brief The QObjectPicker class instantiates a component that can
be used to interact with a QEntity by a process known as picking.
- The signals pressed(), released(), clicked(), entered(), and exited() are
+ The signals pressed(), released(), clicked(), moved(), entered(), and exited() are
emitted when the bounding volume defined by the pickAttribute property intersects
with a ray.
@@ -74,6 +78,10 @@ namespace Qt3DRender {
*/
/*!
+ \qmlsignal Qt3D.Render::ObjectPicker::moved()
+*/
+
+/*!
\qmlsignal Qt3D.Render::ObjectPicker::entered()
*/
@@ -81,46 +89,14 @@ namespace Qt3DRender {
\qmlsignal Qt3D.Render::ObjectPicker::exited()
*/
-class QObjectPickerPrivate : public Qt3DCore::QComponentPrivate
-{
-public:
- QObjectPickerPrivate()
- : QComponentPrivate()
- , m_hoverEnabled(false)
- , m_pressed(false)
- , m_containsMouse(false)
- , m_acceptedLastPressedEvent(true)
- {
- m_shareable = false;
- }
-
- Q_DECLARE_PUBLIC(QObjectPicker)
- bool m_hoverEnabled;
- bool m_pressed;
- bool m_containsMouse;
- bool m_acceptedLastPressedEvent;
-
- enum EventType {
- Pressed,
- Released,
- Clicked
- };
-
- void propagateEvent(QPickEvent *event, EventType type);
-
- void pressedEvent(QPickEvent *event);
- void clickedEvent(QPickEvent *event);
- void releasedEvent(QPickEvent *event);
-};
-
QObjectPicker::QObjectPicker(Qt3DCore::QNode *parent)
: Qt3DCore::QComponent(*new QObjectPickerPrivate(), parent)
{
}
+/*! \internal */
QObjectPicker::~QObjectPicker()
{
- QComponent::cleanup();
}
void QObjectPicker::setHoverEnabled(bool hoverEnabled)
@@ -135,12 +111,30 @@ void QObjectPicker::setHoverEnabled(bool hoverEnabled)
/*!
\qmlproperty bool Qt3D.Render::ObjectPicker::hoverEnabled
*/
-bool QObjectPicker::hoverEnabled() const
+bool QObjectPicker::isHoverEnabled() const
{
Q_D(const QObjectPicker);
return d->m_hoverEnabled;
}
+void QObjectPicker::setDragEnabled(bool dragEnabled)
+{
+ Q_D(QObjectPicker);
+ if (dragEnabled != d->m_dragEnabled) {
+ d->m_dragEnabled = dragEnabled;
+ emit dragEnabledChanged(dragEnabled);
+ }
+}
+
+/*!
+ \qmlproperty bool Qt3D.Render::ObjectPicker::dragEnabled
+*/
+bool QObjectPicker::isDragEnabled() const
+{
+ Q_D(const QObjectPicker);
+ return d->m_dragEnabled;
+}
+
/*!
\qmlproperty bool Qt3D.Render::ObjectPicker::containsMouse
*/
@@ -159,75 +153,74 @@ bool QObjectPicker::isPressed() const
return d->m_pressed;
}
-void QObjectPicker::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QObjectPicker *picker = static_cast<const QObjectPicker *>(ref);
- d_func()->m_hoverEnabled = picker->d_func()->m_hoverEnabled;
-}
-
void QObjectPicker::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_D(QObjectPicker);
- Qt3DCore::QBackendScenePropertyChangePtr e = qSharedPointerCast<Qt3DCore::QBackendScenePropertyChange>(change);
- if (e->type() == Qt3DCore::NodeUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
+ if (e->type() == Qt3DCore::PropertyUpdated) {
// TO DO: Complete this part
// to emit the correct signals
const QByteArray propertyName = e->propertyName();
if (propertyName == QByteArrayLiteral("pressed")) {
- QPickEvent e;
- d->pressedEvent(&e);
+ QPickEventPtr ev = e->value().value<QPickEventPtr>();
+ d->pressedEvent(ev.data());
} else if (propertyName == QByteArrayLiteral("released")) {
- QPickEvent e;
- d->releasedEvent(&e);
+ QPickEventPtr ev = e->value().value<QPickEventPtr>();
+ d->releasedEvent(ev.data());
} else if (propertyName == QByteArrayLiteral("clicked")) {
- QPickEvent e;
- d->clickedEvent(&e);
+ QPickEventPtr ev = e->value().value<QPickEventPtr>();
+ d->clickedEvent(ev.data());
+ } else if (propertyName == QByteArrayLiteral("moved")) {
+ QPickEventPtr ev = e->value().value<QPickEventPtr>();
+ d->movedEvent(ev.data());
} else if (propertyName == QByteArrayLiteral("entered")) {
emit entered();
- setContainsMouse(true);
+ d->setContainsMouse(true);
} else if (propertyName == QByteArrayLiteral("exited")) {
- setContainsMouse(false);
+ d->setContainsMouse(false);
emit exited();
}
}
}
-void QObjectPicker::setPressed(bool pressed)
+/*!
+ \internal
+ */
+void QObjectPickerPrivate::setPressed(bool pressed)
{
- Q_D(QObjectPicker);
- if (d->m_pressed != pressed) {
- const bool blocked = blockNotifications(true);
- d->m_pressed = pressed;
- emit pressedChanged(pressed);
- blockNotifications(blocked);
+ Q_Q(QObjectPicker);
+ if (m_pressed != pressed) {
+ const bool blocked = q->blockNotifications(true);
+ m_pressed = pressed;
+ emit q->pressedChanged(pressed);
+ q->blockNotifications(blocked);
}
}
-void QObjectPicker::setContainsMouse(bool containsMouse)
+/*!
+ \internal
+*/
+void QObjectPickerPrivate::setContainsMouse(bool containsMouse)
{
- Q_D(QObjectPicker);
- if (d->m_containsMouse != containsMouse) {
- const bool blocked = blockNotifications(true);
- d->m_containsMouse = containsMouse;
- emit containsMouseChanged(containsMouse);
- blockNotifications(blocked);
+ Q_Q(QObjectPicker);
+ if (m_containsMouse != containsMouse) {
+ const bool blocked = q->blockNotifications(true);
+ m_containsMouse = containsMouse;
+ emit q->containsMouseChanged(containsMouse);
+ q->blockNotifications(blocked);
}
}
-/*!
- \internal
- */
void QObjectPickerPrivate::propagateEvent(QPickEvent *event, EventType type)
{
if (!m_entities.isEmpty()) {
Qt3DCore::QEntity *entity = m_entities.first();
- Qt3DCore::QEntity *parentEntity = Q_NULLPTR;
- Qt3DRender::QObjectPicker *objectPicker = Q_NULLPTR;
- while (entity != Q_NULLPTR && entity->parent() != Q_NULLPTR && !event->isAccepted()) {
+ Qt3DCore::QEntity *parentEntity = nullptr;
+ while (entity != nullptr && entity->parent() != nullptr && !event->isAccepted()) {
parentEntity = entity->parentEntity();
- Q_FOREACH (Qt3DCore::QComponent *c, parentEntity->components()) {
- if ((objectPicker = qobject_cast<Qt3DRender::QObjectPicker *>(c)) != Q_NULLPTR) {
+ const auto components = parentEntity->components();
+ for (Qt3DCore::QComponent *c : components) {
+ if (auto objectPicker = qobject_cast<Qt3DRender::QObjectPicker *>(c)) {
QObjectPickerPrivate *objectPickerPrivate = static_cast<QObjectPickerPrivate *>(QObjectPickerPrivate::get(objectPicker));
switch (type) {
case Pressed:
@@ -239,6 +232,9 @@ void QObjectPickerPrivate::propagateEvent(QPickEvent *event, EventType type)
case Clicked:
objectPickerPrivate->clickedEvent(event);
break;
+ case EventType::Moved:
+ objectPickerPrivate->movedEvent(event);
+ break;
}
break;
}
@@ -261,7 +257,7 @@ void QObjectPickerPrivate::pressedEvent(QPickEvent *event)
// Travel parents to transmit the event
propagateEvent(event, Pressed);
} else {
- q->setPressed(true);
+ setPressed(true);
}
}
@@ -279,18 +275,39 @@ void QObjectPickerPrivate::clickedEvent(QPickEvent *event)
/*!
\internal
*/
+void QObjectPickerPrivate::movedEvent(QPickEvent *event)
+{
+ Q_Q(QObjectPicker);
+ emit q->moved(event);
+ if (!event->isAccepted())
+ propagateEvent(event, EventType::Moved);
+}
+
+/*!
+ \internal
+ */
void QObjectPickerPrivate::releasedEvent(QPickEvent *event)
{
Q_Q(QObjectPicker);
if (m_acceptedLastPressedEvent) {
emit q->released(event);
- q->setPressed(false);
+ setPressed(false);
} else {
event->setAccepted(false);
propagateEvent(event, Released);
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QObjectPicker::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QObjectPickerData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QObjectPicker);
+ data.hoverEnabled = d->m_hoverEnabled;
+ data.dragEnabled = d->m_dragEnabled;
+ return creationChange;
+}
+
} // Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/picking/qobjectpicker.h b/src/render/picking/qobjectpicker.h
index b64fb2694..950fff2cc 100644
--- a/src/render/picking/qobjectpicker.h
+++ b/src/render/picking/qobjectpicker.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -51,42 +54,43 @@ class QPickEvent;
class QT3DRENDERSHARED_EXPORT QObjectPicker : public Qt3DCore::QComponent
{
Q_OBJECT
- Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
+ Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
+ Q_PROPERTY(bool dragEnabled READ isDragEnabled WRITE setDragEnabled NOTIFY dragEnabledChanged)
Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged)
Q_PROPERTY(bool containsMouse READ containsMouse NOTIFY containsMouseChanged)
public:
- explicit QObjectPicker(QNode *parent = Q_NULLPTR);
+ explicit QObjectPicker(QNode *parent = nullptr);
~QObjectPicker();
- bool hoverEnabled() const;
+ bool isHoverEnabled() const;
+ bool isDragEnabled() const;
bool containsMouse() const;
bool isPressed() const;
public Q_SLOTS:
void setHoverEnabled(bool hoverEnabled);
+ void setDragEnabled(bool dragEnabled);
Q_SIGNALS:
- void pressed(Qt3DRender::QPickEvent *event);
- void released(Qt3DRender::QPickEvent *event);
- void clicked(Qt3DRender::QPickEvent *event);
+ void pressed(Qt3DRender::QPickEvent *pick);
+ void released(Qt3DRender::QPickEvent *pick);
+ void clicked(Qt3DRender::QPickEvent *pick);
+ void moved(Qt3DRender::QPickEvent *pick);
void entered();
void exited();
void hoverEnabledChanged(bool hoverEnabled);
+ void dragEnabledChanged(bool dragEnabled);
void pressedChanged(bool pressed);
void containsMouseChanged(bool containsMouse);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
- void setPressed(bool pressed);
- void setContainsMouse(bool containsMouse);
-
- QT3D_CLONEABLE(QObjectPicker)
Q_DECLARE_PRIVATE(QObjectPicker)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // Qt3D
diff --git a/src/render/picking/qobjectpicker_p.h b/src/render/picking/qobjectpicker_p.h
new file mode 100644
index 000000000..884e5673b
--- /dev/null
+++ b/src/render/picking/qobjectpicker_p.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QOBJECTPICKER_P_H
+#define QT3DRENDER_QOBJECTPICKER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/private/qcomponent_p.h>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \internal
+*/
+class QObjectPickerPrivate : public Qt3DCore::QComponentPrivate
+{
+public:
+ QObjectPickerPrivate()
+ : QComponentPrivate()
+ , m_hoverEnabled(false)
+ , m_dragEnabled(false)
+ , m_pressed(false)
+ , m_containsMouse(false)
+ , m_acceptedLastPressedEvent(true)
+ {
+ m_shareable = false;
+ }
+
+ Q_DECLARE_PUBLIC(QObjectPicker)
+ bool m_hoverEnabled;
+ bool m_dragEnabled;
+ bool m_pressed;
+ bool m_containsMouse;
+ bool m_acceptedLastPressedEvent;
+
+ enum EventType {
+ Pressed,
+ Released,
+ Clicked,
+ Moved
+ };
+
+ void propagateEvent(QPickEvent *event, EventType type);
+
+ void pressedEvent(QPickEvent *event);
+ void clickedEvent(QPickEvent *event);
+ void movedEvent(QPickEvent *event);
+ void releasedEvent(QPickEvent *event);
+
+ void setPressed(bool pressed);
+ void setContainsMouse(bool containsMouse);
+};
+
+struct QObjectPickerData
+{
+ bool hoverEnabled;
+ bool dragEnabled;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QOBJECTPICKER_P_H
diff --git a/src/render/picking/qpickevent.cpp b/src/render/picking/qpickevent.cpp
index e90bc24c0..3e2ffe5a5 100644
--- a/src/render/picking/qpickevent.cpp
+++ b/src/render/picking/qpickevent.cpp
@@ -1,61 +1,69 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qpickevent.h"
+#include "qpickevent_p.h"
#include <private/qobject_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QPickEventPrivate : public QObjectPrivate
+QPickEvent::QPickEvent()
+ : QObject(*new QPickEventPrivate())
{
-public:
- QPickEventPrivate()
- : QObjectPrivate()
- , m_accepted(true)
- {
- }
-
- bool m_accepted;
-};
+}
-QPickEvent::QPickEvent()
+QPickEvent::QPickEvent(const QPointF &position, const QVector3D &intersection, const QVector3D &localIntersection, float distance)
: QObject(*new QPickEventPrivate())
{
+ Q_D(QPickEvent);
+ d->m_position = position;
+ d->m_distance = distance;
+ d->m_worldIntersection = intersection;
+ d->m_localIntersection = localIntersection;
+}
+
+QPickEvent::QPickEvent(QObjectPrivate &dd, QObject *parent)
+ : QObject(dd, parent)
+{
+
}
QPickEvent::~QPickEvent()
@@ -77,6 +85,30 @@ void QPickEvent::setAccepted(bool accepted)
}
}
+QPointF QPickEvent::position() const
+{
+ Q_D(const QPickEvent);
+ return d->m_position;
+}
+
+float QPickEvent::distance() const
+{
+ Q_D(const QPickEvent);
+ return d->m_distance;
+}
+
+QVector3D QPickEvent::worldIntersection() const
+{
+ Q_D(const QPickEvent);
+ return d->m_worldIntersection;
+}
+
+QVector3D QPickEvent::localIntersection() const
+{
+ Q_D(const QPickEvent);
+ return d->m_localIntersection;
+}
+
} // Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/picking/qpickevent.h b/src/render/picking/qpickevent.h
index 793377ad8..431fe1927 100644
--- a/src/render/picking/qpickevent.h
+++ b/src/render/picking/qpickevent.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,6 +41,8 @@
#define QT3DRENDER_QPICKEVENT_H
#include <QObject>
+#include <QVector3D>
+#include <QPointF>
#include <Qt3DRender/qt3drender_global.h>
QT_BEGIN_NAMESPACE
@@ -46,12 +51,20 @@ namespace Qt3DRender {
class QPickEventPrivate;
+class QPickEvent;
+typedef QSharedPointer<QPickEvent> QPickEventPtr;
+
class QT3DRENDERSHARED_EXPORT QPickEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted NOTIFY acceptedChanged)
+ Q_PROPERTY(QPointF position READ position CONSTANT)
+ Q_PROPERTY(float distance READ distance CONSTANT)
+ Q_PROPERTY(QVector3D localIntersection READ localIntersection CONSTANT)
+ Q_PROPERTY(QVector3D worldIntersection READ worldIntersection CONSTANT)
public:
QPickEvent();
+ QPickEvent(const QPointF &position, const QVector3D& worldIntersection, const QVector3D& localIntersection, float distance);
~QPickEvent();
bool isAccepted() const;
@@ -59,9 +72,18 @@ public:
public Q_SLOTS:
void setAccepted(bool accepted);
+public:
+ QPointF position() const;
+ float distance() const;
+ QVector3D worldIntersection() const;
+ QVector3D localIntersection() const;
+
Q_SIGNALS:
void acceptedChanged(bool accepted);
+protected:
+ explicit QPickEvent(QObjectPrivate &dd, QObject *parent = nullptr);
+
private:
Q_DECLARE_PRIVATE(QPickEvent)
};
@@ -70,4 +92,6 @@ private:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(Qt3DRender::QPickEvent*)
+
#endif // QT3DRENDER_QPICKEVENT_H
diff --git a/src/render/picking/qpickevent_p.h b/src/render/picking/qpickevent_p.h
new file mode 100644
index 000000000..fd9ed36a2
--- /dev/null
+++ b/src/render/picking/qpickevent_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QPickEventPrivate : public QObjectPrivate
+{
+public:
+ QPickEventPrivate()
+ : QObjectPrivate()
+ , m_accepted(true)
+ , m_distance(-1.f)
+ {
+ }
+
+ bool m_accepted;
+ QPointF m_position;
+ QVector3D m_worldIntersection;
+ QVector3D m_localIntersection;
+ float m_distance;
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
diff --git a/src/render/picking/qpicktriangleevent.cpp b/src/render/picking/qpicktriangleevent.cpp
new file mode 100644
index 000000000..e3fbd2fdf
--- /dev/null
+++ b/src/render/picking/qpicktriangleevent.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpicktriangleevent.h"
+#include "qpickevent_p.h"
+#include <private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QPickTriangleEventPrivate : public QPickEventPrivate
+{
+public:
+ QPickTriangleEventPrivate()
+ : QPickEventPrivate()
+ , m_triangleIndex(0)
+ , m_vertex1Index(0)
+ , m_vertex2Index(0)
+ , m_vertex3Index(0)
+ {
+ }
+
+ uint m_triangleIndex;
+ uint m_vertex1Index;
+ uint m_vertex2Index;
+ uint m_vertex3Index;
+};
+
+QPickTriangleEvent::QPickTriangleEvent()
+ : QPickEvent(*new QPickTriangleEventPrivate())
+{
+}
+
+QPickTriangleEvent::QPickTriangleEvent(const QPointF &position, const QVector3D &intersection, const QVector3D &localIntersection, float distance,
+ uint triangleIndex, uint vertex1Index, uint vertex2Index, uint vertex3Index)
+ : QPickEvent(*new QPickTriangleEventPrivate())
+{
+ Q_D(QPickTriangleEvent);
+ d->m_position = position;
+ d->m_distance = distance;
+ d->m_worldIntersection = intersection;
+ d->m_localIntersection = localIntersection;
+ d->m_triangleIndex = triangleIndex;
+ d->m_vertex1Index = vertex1Index;
+ d->m_vertex2Index = vertex2Index;
+ d->m_vertex3Index = vertex3Index;
+}
+
+QPickTriangleEvent::~QPickTriangleEvent()
+{
+}
+
+uint QPickTriangleEvent::triangleIndex() const
+{
+ Q_D(const QPickTriangleEvent);
+ return d->m_triangleIndex;
+}
+
+uint QPickTriangleEvent::vertex1Index() const
+{
+ Q_D(const QPickTriangleEvent);
+ return d->m_vertex1Index;
+}
+
+uint QPickTriangleEvent::vertex2Index() const
+{
+ Q_D(const QPickTriangleEvent);
+ return d->m_vertex2Index;
+}
+
+uint QPickTriangleEvent::vertex3Index() const
+{
+ Q_D(const QPickTriangleEvent);
+ return d->m_vertex3Index;
+}
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
diff --git a/src/render/picking/qpicktriangleevent.h b/src/render/picking/qpicktriangleevent.h
new file mode 100644
index 000000000..e60a81dd6
--- /dev/null
+++ b/src/render/picking/qpicktriangleevent.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QPICKTRIANGLEEVENT_H
+#define QT3DRENDER_QPICKTRIANGLEEVENT_H
+
+#include <Qt3DRender/qpickevent.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+class QPickTriangleEventPrivate;
+
+class QT3DRENDERSHARED_EXPORT QPickTriangleEvent : public QPickEvent
+{
+ Q_OBJECT
+ Q_PROPERTY(uint triangleIndex READ triangleIndex CONSTANT)
+ Q_PROPERTY(uint vertex1Index READ vertex1Index CONSTANT)
+ Q_PROPERTY(uint vertex2Index READ vertex2Index CONSTANT)
+ Q_PROPERTY(uint vertex3Index READ vertex3Index CONSTANT)
+public:
+ QPickTriangleEvent();
+ QPickTriangleEvent(const QPointF &position, const QVector3D& worldIntersection, const QVector3D& localIntersection, float distance,
+ uint triangleIndex, uint vertex1Index, uint vertex2Index, uint vertex3Index);
+ ~QPickTriangleEvent();
+
+public:
+ uint triangleIndex() const;
+ uint vertex1Index() const;
+ uint vertex2Index() const;
+ uint vertex3Index() const;
+
+private:
+ Q_DECLARE_PRIVATE(QPickTriangleEvent)
+};
+
+} // Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QPICKTRIANGLEEVENT_H
diff --git a/src/render/qt3drender_global.h b/src/render/qt3drender_global.h
index 1da0d0dab..68e1cb639 100644
--- a/src/render/qt3drender_global.h
+++ b/src/render/qt3drender_global.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,7 +40,7 @@
#ifndef QT3DRENDER_GLOBAL_H
#define QT3DRENDER_GLOBAL_H
-#include <QtCore/qglobal.h>
+#include <Qt3DCore/qt3dcore_global.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/qt3drender_global_p.h b/src/render/qt3drender_global_p.h
index 99db6303f..4ec84555a 100644
--- a/src/render/qt3drender_global_p.h
+++ b/src/render/qt3drender_global_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/raycasting/qabstractcollisionqueryservice.cpp b/src/render/raycasting/qabstractcollisionqueryservice.cpp
index e28b3a7ea..4c59b6aab 100644
--- a/src/render/raycasting/qabstractcollisionqueryservice.cpp
+++ b/src/render/raycasting/qabstractcollisionqueryservice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -57,9 +60,9 @@ void QAbstractCollisionQueryService::setResultHandle(QCollisionQueryResult &resu
result.d_func()->setHandle(handle);
}
-void QAbstractCollisionQueryService::addEntityHit(QCollisionQueryResult &result, const Qt3DCore::QNodeId &entity)
+void QAbstractCollisionQueryService::addEntityHit(QCollisionQueryResult &result, Qt3DCore::QNodeId entity, const QVector3D& intersection, float distance)
{
- result.d_func()->addEntityHit(entity);
+ result.d_func()->addEntityHit(entity, intersection, distance);
}
} // Qt3DRender
diff --git a/src/render/raycasting/qabstractcollisionqueryservice_p.h b/src/render/raycasting/qabstractcollisionqueryservice_p.h
index 8a6042bf7..a2bb7873b 100644
--- a/src/render/raycasting/qabstractcollisionqueryservice_p.h
+++ b/src/render/raycasting/qabstractcollisionqueryservice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -58,12 +61,11 @@
QT_BEGIN_NAMESPACE
-namespace Qt3DCore {
-class QRay3D;
-}
-
+class QAbstractCollisionQueryServicePrivate;
namespace Qt3DRender {
+class QRay3D;
+class QBoundingVolume;
class QBoundingVolumeProvider;
class QAbstractCollisionQueryServicePrivate : public Qt3DCore::QAbstractServiceProviderPrivate
@@ -82,7 +84,8 @@ public:
AllHits
};
- virtual QQueryHandle query(const Qt3DCore::QRay3D &ray, QueryMode mode, QBoundingVolumeProvider *provider) = 0;
+ virtual QQueryHandle query(const QRay3D &ray, QueryMode mode, QBoundingVolumeProvider *provider) = 0;
+ virtual QCollisionQueryResult::Hit query(const QRay3D &ray, const QBoundingVolume* volume) = 0;
virtual QCollisionQueryResult fetchResult(const QQueryHandle &handle) = 0;
virtual QVector<QCollisionQueryResult> fetchAllResults() const = 0;
@@ -92,7 +95,7 @@ protected:
QAbstractCollisionQueryService(QAbstractCollisionQueryServicePrivate &dd);
void setResultHandle(QCollisionQueryResult &result, const QQueryHandle &handle);
- void addEntityHit(QCollisionQueryResult &result, const Qt3DCore::QNodeId &entity);
+ void addEntityHit(QCollisionQueryResult &result, Qt3DCore::QNodeId entity, const QVector3D &intersection, float distance);
private:
Q_DECLARE_PRIVATE(QAbstractCollisionQueryService)
diff --git a/src/render/raycasting/qboundingsphere.cpp b/src/render/raycasting/qboundingsphere.cpp
index 1c6915cf4..035f7914d 100644
--- a/src/render/raycasting/qboundingsphere.cpp
+++ b/src/render/raycasting/qboundingsphere.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/raycasting/qboundingsphere_p.h b/src/render/raycasting/qboundingsphere_p.h
index c05fb7613..c560bdb8e 100644
--- a/src/render/raycasting/qboundingsphere_p.h
+++ b/src/render/raycasting/qboundingsphere_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/raycasting/qboundingvolume.cpp b/src/render/raycasting/qboundingvolume.cpp
index 414f4f278..fa732d9a8 100644
--- a/src/render/raycasting/qboundingvolume.cpp
+++ b/src/render/raycasting/qboundingvolume.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/raycasting/qboundingvolume_p.h b/src/render/raycasting/qboundingvolume_p.h
index b426870a2..87f7e45f5 100644
--- a/src/render/raycasting/qboundingvolume_p.h
+++ b/src/render/raycasting/qboundingvolume_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -52,12 +55,8 @@
#include <Qt3DCore/qnodeid.h>
QT_BEGIN_NAMESPACE
-
-namespace Qt3DCore {
-class QRay3D;
-}
-
namespace Qt3DRender {
+class QRay3D;
class QT3DRENDERSHARED_EXPORT QBoundingVolume
{
@@ -71,7 +70,7 @@ public:
};
virtual Qt3DCore::QNodeId id() const = 0;
- virtual bool intersects(const Qt3DCore::QRay3D &ray, QVector3D *q = Q_NULLPTR) const = 0;
+ virtual bool intersects(const QRay3D &ray, QVector3D *q = nullptr) const = 0;
virtual Type type() const = 0;
};
diff --git a/src/render/raycasting/qboundingvolumeprovider.cpp b/src/render/raycasting/qboundingvolumeprovider.cpp
index cff36e906..4bc1f4996 100644
--- a/src/render/raycasting/qboundingvolumeprovider.cpp
+++ b/src/render/raycasting/qboundingvolumeprovider.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/raycasting/qboundingvolumeprovider_p.h b/src/render/raycasting/qboundingvolumeprovider_p.h
index 3f38a6f6c..f73e7327c 100644
--- a/src/render/raycasting/qboundingvolumeprovider_p.h
+++ b/src/render/raycasting/qboundingvolumeprovider_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/raycasting/qcollisionqueryresult.cpp b/src/render/raycasting/qcollisionqueryresult.cpp
index cf2ea0a9a..e4a6afa69 100644
--- a/src/render/raycasting/qcollisionqueryresult.cpp
+++ b/src/render/raycasting/qcollisionqueryresult.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,13 +51,13 @@ QCollisionQueryResultPrivate::QCollisionQueryResultPrivate()
QCollisionQueryResultPrivate::QCollisionQueryResultPrivate(const QCollisionQueryResultPrivate &copy)
: QSharedData(copy)
, m_handle(copy.m_handle)
- , m_entitiesHit(copy.m_entitiesHit)
+ , m_hits(copy.m_hits)
{
}
-void QCollisionQueryResultPrivate::addEntityHit(const Qt3DCore::QNodeId &entity)
+void QCollisionQueryResultPrivate::addEntityHit(Qt3DCore::QNodeId entity, const QVector3D& intersection, float distance)
{
- m_entitiesHit.append(entity);
+ m_hits.append(QCollisionQueryResult::Hit(entity, intersection, distance));
}
void QCollisionQueryResultPrivate::setHandle(const QQueryHandle &handle)
@@ -82,10 +85,19 @@ QCollisionQueryResult &QCollisionQueryResult::operator=(const QCollisionQueryRes
return *this;
}
+QVector<QCollisionQueryResult::Hit> QCollisionQueryResult::hits() const
+{
+ Q_D(const QCollisionQueryResult);
+ return d->m_hits;
+}
+
QVector<Qt3DCore::QNodeId> QCollisionQueryResult::entitiesHit() const
{
Q_D(const QCollisionQueryResult);
- return d->m_entitiesHit;
+ QVector<Qt3DCore::QNodeId> result;
+ for (const Hit& hit : d->m_hits)
+ result << hit.m_entityId;
+ return result;
}
/*!
diff --git a/src/render/raycasting/qcollisionqueryresult_p.h b/src/render/raycasting/qcollisionqueryresult_p.h
index c4eb164ff..81bca98b6 100644
--- a/src/render/raycasting/qcollisionqueryresult_p.h
+++ b/src/render/raycasting/qcollisionqueryresult_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -51,6 +54,7 @@
#include <Qt3DRender/qt3drender_global.h>
#include <Qt3DCore/qnodeid.h>
#include <QVector>
+#include <QVector3D>
#include <QSharedData>
QT_BEGIN_NAMESPACE
@@ -58,23 +62,21 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
typedef int QQueryHandle;
-
-class QCollisionQueryResultPrivate : public QSharedData
-{
-public:
- explicit QCollisionQueryResultPrivate();
- explicit QCollisionQueryResultPrivate(const QCollisionQueryResultPrivate &copy);
-
- void setHandle(const QQueryHandle &handle);
- void addEntityHit(const Qt3DCore::QNodeId &entity);
-
- QQueryHandle m_handle;
- QVector<Qt3DCore::QNodeId> m_entitiesHit;
-};
+class QCollisionQueryResultPrivate;
class QT3DRENDERSHARED_EXPORT QCollisionQueryResult
{
public:
+ struct Hit {
+ Hit() : m_distance(-1.f), m_triangleIndex(0) { m_vertexIndex[0] = m_vertexIndex[1] = m_vertexIndex[2] = 0; }
+ Hit(Qt3DCore::QNodeId entity, const QVector3D &intersection, float distance) : m_entityId(entity), m_intersection(intersection), m_distance(distance) { }
+ Qt3DCore::QNodeId m_entityId;
+ QVector3D m_intersection;
+ float m_distance;
+ uint m_triangleIndex;
+ uint m_vertexIndex[3];
+ };
+
QCollisionQueryResult();
QCollisionQueryResult(const QCollisionQueryResult &);
~QCollisionQueryResult();
@@ -94,6 +96,7 @@ public:
}
QQueryHandle handle() const;
+ QVector<Hit> hits() const;
QVector<Qt3DCore::QNodeId> entitiesHit() const;
private:
@@ -109,10 +112,28 @@ private:
return d_ptr.constData();
}
};
+QT3D_DECLARE_TYPEINFO(Qt3DRender, QCollisionQueryResult::Hit, Q_PRIMITIVE_TYPE)
+QT3D_DECLARE_SHARED(Qt3DRender, QCollisionQueryResult)
-} // Qt3DRender
+class QCollisionQueryResultPrivate : public QSharedData
+{
+public:
+ explicit QCollisionQueryResultPrivate();
+ explicit QCollisionQueryResultPrivate(const QCollisionQueryResultPrivate &copy);
+
+ void setHandle(const QQueryHandle &handle);
+ void addEntityHit(Qt3DCore::QNodeId entity, const QVector3D& intersection, float distance);
-Q_DECLARE_SHARED(Qt3DRender::QCollisionQueryResult)
+ QQueryHandle m_handle;
+ QVector<QCollisionQueryResult::Hit> m_hits;
+};
+
+inline bool operator==(const QCollisionQueryResult::Hit& left, const QCollisionQueryResult::Hit& right)
+{
+ return left.m_entityId == right.m_entityId;
+}
+
+} // Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/raycasting/qray3d.cpp b/src/render/raycasting/qray3d.cpp
new file mode 100644
index 000000000..f48ce903d
--- /dev/null
+++ b/src/render/raycasting/qray3d.cpp
@@ -0,0 +1,376 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DRender/private/qray3d_p.h>
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QRay3D
+ \inmodule Qt3DRender
+ \brief The QRay3D class defines a directional line in 3D space extending through an origin point.
+ \since 5.5
+ \ingroup qt3d
+ \ingroup qt3d::math
+
+ A ray is defined by the origin() point and the direction() vector.
+ Rays are infinite in length, extending out from origin() in
+ both directions. If the direction() is zero length, then the
+ behavior of the class is undefined.
+
+ A ray can be thought of as a one-dimensional co-ordinate system.
+ If the co-ordinate is \b t then the origin() point is at
+ \b t = 0, the point origin() + direction() is at \b t = 1,
+ and the point origin() - direction() is at \b t = -1.
+ The point() method can be used to obtain the position of a point
+ within this one-dimensional co-ordinate system. The projectedDistance()
+ method can be used to convert a point into a value in this
+ one-dimensional co-ordinate system.
+*/
+
+/*!
+ \fn Qt3DRender::QRay3D::QRay3D()
+
+ Construct a default ray with an origin() of (0, 0, 0), a
+ direction() of (0, 0, 1) and a distance of 1.
+*/
+QRay3D::QRay3D()
+ : m_direction(0.0f, 0.0f, 1.0f)
+ , m_distance(1.0f)
+{
+}
+
+/*!
+ \fn Qt3DRender::QRay3D::QRay3D(const QVector3D &origin, const QVector3D &direction, float distance)
+
+ Construct a ray given its defining \a origin, \a direction and \a distance.
+ The \a direction does not need to be normalized.
+
+ To construct a ray that passes through two points, use the following:
+
+ \code
+ QRay3D thruAB(pointA, pointB - pointA);
+ \endcode
+*/
+QRay3D::QRay3D(const QVector3D &origin, const QVector3D &direction, float distance)
+ : m_origin(origin)
+ , m_direction(direction)
+ , m_distance(distance)
+{}
+
+QRay3D::~QRay3D()
+{
+}
+
+/*!
+ \fn QVector3D Qt3DRender::QRay3D::origin() const
+
+ Returns the origin of this ray. The default value is (0, 0, 0).
+
+ \sa setOrigin(), direction()
+*/
+QVector3D QRay3D::origin() const
+{
+ return m_origin;
+}
+
+/*!
+ \fn void Qt3DRender::QRay3D::setOrigin(const QVector3D &value)
+
+ Sets the origin point of this ray to \a value.
+
+ \sa origin(), setDirection()
+ */
+void QRay3D::setOrigin(const QVector3D &value)
+{
+ m_origin = value;
+}
+
+/*!
+ \fn QVector3D Qt3DRender::QRay3D::direction() const
+
+ Returns the direction vector of this ray. The default value is (0, 0, 1).
+
+ \sa setDirection(), origin()
+*/
+QVector3D QRay3D::direction() const
+{
+ return m_direction;
+}
+
+/*!
+ \fn void Qt3DRender::QRay3D::setDirection(const QVector3D &direction)
+
+ Sets the direction vector of this ray to \a direction.
+
+ \sa direction(), setOrigin()
+*/
+void QRay3D::setDirection(const QVector3D &value)
+{
+ if (value.isNull())
+ return;
+
+ m_direction = value;
+}
+
+float QRay3D::distance() const
+{
+ return m_distance;
+}
+
+void QRay3D::setDistance(float distance)
+{
+ m_distance = distance;
+}
+
+QVector3D QRay3D::point(float t) const
+{
+ return m_origin + t * m_direction;
+}
+
+QRay3D &QRay3D::transform(const QMatrix4x4 &matrix)
+{
+ m_origin = matrix * m_origin;
+ m_direction = matrix.mapVector(m_direction);
+
+ return *this;
+}
+
+QRay3D QRay3D::transformed(const QMatrix4x4 &matrix) const
+{
+ return QRay3D(matrix * m_origin, matrix.mapVector(m_direction));
+}
+
+bool QRay3D::operator==(const QRay3D &other) const
+{
+ return m_origin == other.origin() && m_direction == other.direction();
+}
+
+bool QRay3D::operator!=(const QRay3D &other) const
+{
+ return !(*this == other);
+}
+
+/*!
+ Returns true if \a point lies on this ray; false otherwise.
+*/
+bool QRay3D::contains(const QVector3D &point) const
+{
+ QVector3D ppVec(point - m_origin);
+ if (ppVec.isNull()) // point coincides with origin
+ return true;
+ const float dot = QVector3D::dotProduct(ppVec, m_direction);
+ if (qFuzzyIsNull(dot))
+ return false;
+ return qFuzzyCompare(dot*dot, ppVec.lengthSquared() * m_direction.lengthSquared());
+}
+
+/*!
+ Returns true if \a ray lies on this ray; false otherwise. If true,
+ this implies that the two rays are actually the same, but with
+ different origin() points or an inverted direction().
+*/
+bool QRay3D::contains(const QRay3D &ray) const
+{
+ const float dot = QVector3D::dotProduct(m_direction, ray.direction());
+ if (!qFuzzyCompare(dot*dot, m_direction.lengthSquared() * ray.direction().lengthSquared()))
+ return false;
+ return contains(ray.origin());
+}
+
+/*!
+ \fn QVector3D Qt3DRender::QRay3D::point(float t) const
+
+ Returns the point on the ray defined by moving \a t units
+ along the ray in the direction of the direction() vector.
+ Note that \a t may be negative in which case the point returned
+ will lie behind the origin() point with respect to the
+ direction() vector.
+
+ The units for \a t are defined by direction(). The return value
+ is precisely origin() + t * direction().
+
+ \sa projectedDistance(), distance()
+*/
+
+/*!
+ Returns the number of direction() units along the ray from origin()
+ to \a point. Essentially, this function computes the value t, where
+ \a point = origin() + t * direction(). If \a point is not on the ray,
+ then the closest point that is on the ray will be used instead.
+
+ If the return value is positive, then \a point lies in front of
+ the origin() with respect to the direction() vector. If the return
+ value is negative, then \a point lies behind the origin() with
+ respect to the direction() vector.
+
+ \sa point(), project()
+*/
+float QRay3D::projectedDistance(const QVector3D &point) const
+{
+ Q_ASSERT(!m_direction.isNull());
+
+ return QVector3D::dotProduct(point - m_origin, m_direction) /
+ m_direction.lengthSquared();
+}
+
+/*!
+ Returns the projection of \a vector onto this ray. In the
+ following diagram, the dotted line is the ray, and V is the
+ \a vector. The return value will be the vector V':
+
+ \image qray3d-project.png
+
+ \sa projectedDistance()
+*/
+QVector3D QRay3D::project(const QVector3D &vector) const
+{
+ QVector3D norm = m_direction.normalized();
+ return QVector3D::dotProduct(vector, norm) * norm;
+}
+
+/*!
+ Returns the minimum distance from this ray to \a point, or equivalently
+ the length of a line perpendicular to this ray which passes through
+ \a point. If \a point is on the ray, then this function will return zero.
+
+ \sa point()
+*/
+float QRay3D::distance(const QVector3D &point) const
+{
+ float t = projectedDistance(point);
+ return (point - (m_origin + t * m_direction)).length();
+}
+
+/*!
+ \fn QRay3D &Qt3DRender::QRay3D::transform(const QMatrix4x4 &matrix)
+
+ Transforms this ray using \a matrix, replacing origin() and
+ direction() with the transformed versions.
+
+ \sa transformed()
+*/
+
+/*!
+ \fn QRay3D Qt3DRender::QRay3D::transformed(const QMatrix4x4 &matrix) const
+
+ Returns a new ray that is formed by transforming origin()
+ and direction() using \a matrix.
+
+ \sa transform()
+*/
+
+/*!
+ \fn bool Qt3DRender::QRay3D::operator==(const QRay3D &other) const
+
+ Returns \c true if this ray is the same as \a other; \c false otherwise.
+
+ \sa operator!=()
+*/
+
+/*!
+ \fn bool Qt3DRender::QRay3D::operator!=(const QRay3D &other) const
+
+ Returns \c true if this ray is not the same as \a other; \c false otherwise.
+
+ \sa operator==()
+*/
+
+/*!
+ \fn bool qFuzzyCompare(const Qt3DRender::QRay3D &ray1, const Qt3DRender::QRay3D &ray2)
+ \relates Qt3DRender::QRay3D
+
+ Returns \c true if \a ray1 and \a ray2 are almost equal; \c false
+ otherwise.
+*/
+
+#ifndef QT_NO_DEBUG_STREAM
+
+QDebug operator<<(QDebug dbg, const QRay3D &ray)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "QRay3D(origin("
+ << ray.origin().x() << ", " << ray.origin().y() << ", "
+ << ray.origin().z() << ") - direction("
+ << ray.direction().x() << ", " << ray.direction().y() << ", "
+ << ray.direction().z() << "))";
+ return dbg;
+}
+
+#endif
+
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \relates Qt3DRender::QRay3D
+
+ Writes the given \a ray to the given \a stream and returns a
+ reference to the stream.
+*/
+QDataStream &operator<<(QDataStream &stream, const QRay3D &ray)
+{
+ stream << ray.origin();
+ stream << ray.direction();
+ return stream;
+}
+
+/*!
+ \relates Qt3DRender::QRay3D
+
+ Reads a 3D ray from the given \a stream into the given \a ray
+ and returns a reference to the stream.
+*/
+QDataStream &operator>>(QDataStream &stream, QRay3D &ray)
+{
+ QVector3D origin, direction;
+ stream >> origin;
+ stream >> direction;
+ ray = QRay3D(origin, direction);
+ return stream;
+}
+
+#endif // QT_NO_DATASTREAM
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/raycasting/qray3d_p.h b/src/render/raycasting/qray3d_p.h
new file mode 100644
index 000000000..3e454e7c8
--- /dev/null
+++ b/src/render/raycasting/qray3d_p.h
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRAY3D_H
+#define QT3DRENDER_QRAY3D_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <QtGui/qvector3d.h>
+#include <QtGui/qmatrix4x4.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QT3DRENDERSHARED_EXPORT QRay3D
+{
+public:
+ QRay3D();
+ explicit QRay3D(const QVector3D &origin, const QVector3D &direction = QVector3D(0.0f, 0.0f, 1.0f), float distance = 1.0f);
+ ~QRay3D();
+
+ QVector3D origin() const;
+ void setOrigin(const QVector3D &value);
+
+ QVector3D direction() const;
+ void setDirection(const QVector3D &value);
+
+ float distance() const;
+ void setDistance(float distance);
+
+ bool contains(const QVector3D &point) const;
+ bool contains(const QRay3D &ray) const;
+
+ QVector3D point(float t) const;
+ float projectedDistance(const QVector3D &point) const;
+
+ QVector3D project(const QVector3D &vector) const;
+
+ float distance(const QVector3D &point) const;
+
+ QRay3D &transform(const QMatrix4x4 &matrix);
+ QRay3D transformed(const QMatrix4x4 &matrix) const;
+
+ bool operator==(const QRay3D &other) const;
+ bool operator!=(const QRay3D &other) const;
+
+private:
+ QVector3D m_origin;
+ QVector3D m_direction;
+ float m_distance;
+};
+QT3D_DECLARE_TYPEINFO(Qt3DRender, QRay3D, Q_MOVABLE_TYPE)
+
+
+#ifndef QT_NO_DEBUG_STREAM
+QT3DRENDERSHARED_EXPORT QDebug operator<<(QDebug dbg, const QRay3D &ray);
+#endif
+
+#ifndef QT_NO_DATASTREAM
+QT3DRENDERSHARED_EXPORT QDataStream &operator<<(QDataStream &stream, const QRay3D &ray);
+QT3DRENDERSHARED_EXPORT QDataStream &operator>>(QDataStream &stream, QRay3D &ray);
+#endif
+
+} // namespace Qt3DRender
+QT_END_NAMESPACE
+
+inline bool qFuzzyCompare(const Qt3DRender::QRay3D &ray1, const Qt3DRender::QRay3D &ray2)
+{
+ return qFuzzyCompare(ray1.origin(), ray2.origin()) &&
+ qFuzzyCompare(ray1.direction(), ray2.direction());
+}
+
+Q_DECLARE_METATYPE(Qt3DRender::QRay3D)
+
+#endif // QT3DRENDER_QRAY3D_H
diff --git a/src/render/raycasting/qraycastingservice.cpp b/src/render/raycasting/qraycastingservice.cpp
index 8e897ec14..6dfb1c57a 100644
--- a/src/render/raycasting/qraycastingservice.cpp
+++ b/src/render/raycasting/qraycastingservice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "qraycastingservice_p.h"
-#include <Qt3DCore/qray3d.h>
+#include <Qt3DRender/private/qray3d_p.h>
#include <Qt3DRender/private/sphere_p.h>
#include <Qt3DRender/private/qboundingvolumeprovider_p.h>
@@ -71,7 +74,7 @@ bool compareHitsDistance(const Hit &a, const Hit &b)
return a.distance < b.distance;
}
-Hit volumeRayIntersection(const QBoundingVolume *volume, const Qt3DCore::QRay3D &ray)
+Hit volumeRayIntersection(const QBoundingVolume *volume, const QRay3D &ray)
{
Hit hit;
if ((hit.intersects = volume->intersects(ray, &hit.intersection))) {
@@ -102,7 +105,7 @@ QVector<Hit> reduceToAllHits(QVector<Hit> &results, const Hit &intermediate)
struct CollisionGathererFunctor
{
- Qt3DCore::QRay3D ray;
+ QRay3D ray;
typedef Hit result_type;
@@ -115,7 +118,7 @@ struct CollisionGathererFunctor
} // anonymous
-QCollisionQueryResult QRayCastingServicePrivate::collides(const Qt3DCore::QRay3D &ray, QBoundingVolumeProvider *provider,
+QCollisionQueryResult QRayCastingServicePrivate::collides(const QRay3D &ray, QBoundingVolumeProvider *provider,
QAbstractCollisionQueryService::QueryMode mode, const QQueryHandle &handle)
{
Q_Q(QRayCastingService);
@@ -130,17 +133,30 @@ QCollisionQueryResult QRayCastingServicePrivate::collides(const Qt3DCore::QRay3D
if (mode == QAbstractCollisionQueryService::FirstHit) {
Hit firstHit = QtConcurrent::blockingMappedReduced<Hit>(volumes, gathererFunctor, reduceToFirstHit);
if (firstHit.intersects)
- q->addEntityHit(result, firstHit.id);
+ q->addEntityHit(result, firstHit.id, firstHit.intersection, firstHit.distance);
} else {
QVector<Hit> hits = QtConcurrent::blockingMappedReduced<QVector<Hit> >(volumes, gathererFunctor, reduceToAllHits);
std::sort(hits.begin(), hits.end(), compareHitsDistance);
- Q_FOREACH (const Hit &hit, hits)
- q->addEntityHit(result, hit.id);
+ for (const Hit &hit : qAsConst(hits))
+ q->addEntityHit(result, hit.id, hit.intersection, hit.distance);
}
return result;
}
+QCollisionQueryResult::Hit QRayCastingServicePrivate::collides(const QRay3D &ray, const Qt3DRender::QBoundingVolume *volume)
+{
+ QCollisionQueryResult::Hit result;
+ Hit hit = volumeRayIntersection(volume, ray);
+ if (hit.intersects)
+ {
+ result.m_distance = hit.distance;
+ result.m_entityId = hit.id;
+ result.m_intersection = hit.intersection;
+ }
+ return result;
+}
+
QRayCastingServicePrivate::QRayCastingServicePrivate(const QString &description)
: QAbstractCollisionQueryServicePrivate(description)
, m_handlesCount(0)
@@ -152,7 +168,7 @@ QRayCastingService::QRayCastingService()
{
}
-QQueryHandle QRayCastingService::query(const Qt3DCore::QRay3D &ray,
+QQueryHandle QRayCastingService::query(const QRay3D &ray,
QAbstractCollisionQueryService::QueryMode mode,
QBoundingVolumeProvider *provider)
{
@@ -170,6 +186,13 @@ QQueryHandle QRayCastingService::query(const Qt3DCore::QRay3D &ray,
return handle;
}
+QCollisionQueryResult::Hit QRayCastingService::query(const QRay3D &ray, const QBoundingVolume *volume)
+{
+ Q_D(QRayCastingService);
+
+ return d->collides(ray, volume);
+}
+
QCollisionQueryResult QRayCastingService::fetchResult(const QQueryHandle &handle)
{
Q_D(QRayCastingService);
@@ -181,11 +204,10 @@ QVector<QCollisionQueryResult> QRayCastingService::fetchAllResults() const
{
Q_D(const QRayCastingService);
- const QList<FutureQueryResult> futureResults = d->m_results.values();
QVector<QCollisionQueryResult> results;
- results.reserve(futureResults.size());
+ results.reserve(d->m_results.size());
- Q_FOREACH (const FutureQueryResult &future, futureResults)
+ for (const FutureQueryResult &future : d->m_results)
results.append(future.result());
return results;
diff --git a/src/render/raycasting/qraycastingservice_p.h b/src/render/raycasting/qraycastingservice_p.h
index b4fdc1549..c02104d7c 100644
--- a/src/render/raycasting/qraycastingservice_p.h
+++ b/src/render/raycasting/qraycastingservice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@
#include <Qt3DCore/qt3dcore_global.h>
#include <Qt3DRender/private/qabstractcollisionqueryservice_p.h>
-#include <Qt3DCore/qray3d.h>
+#include <Qt3DRender/private/qray3d_p.h>
#include <QHash>
#include <QtConcurrent>
@@ -60,7 +63,6 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QBoundingVolume;
class QBoundingVolumeProvider;
class QRayCastingServicePrivate;
@@ -71,7 +73,8 @@ class QT3DRENDERSHARED_EXPORT QRayCastingService : public QAbstractCollisionQuer
public:
QRayCastingService();
- QQueryHandle query(const Qt3DCore::QRay3D &ray, QueryMode mode, QBoundingVolumeProvider *provider) Q_DECL_OVERRIDE;
+ QQueryHandle query(const QRay3D &ray, QueryMode mode, QBoundingVolumeProvider *provider) Q_DECL_OVERRIDE;
+ QCollisionQueryResult::Hit query(const QRay3D &ray, const QBoundingVolume *volume) Q_DECL_OVERRIDE;
QCollisionQueryResult fetchResult(const QQueryHandle &handle) Q_DECL_OVERRIDE;
QVector<QCollisionQueryResult> fetchAllResults() const Q_DECL_OVERRIDE;
@@ -89,17 +92,19 @@ class QRayCastingServicePrivate : public QAbstractCollisionQueryServicePrivate
public:
QRayCastingServicePrivate(const QString &description);
- QCollisionQueryResult collides(const Qt3DCore::QRay3D &ray,
+ QCollisionQueryResult collides(const QRay3D &ray,
QBoundingVolumeProvider *provider,
QAbstractCollisionQueryService::QueryMode mode,
const QQueryHandle &handle);
+ QCollisionQueryResult::Hit collides(const QRay3D &ray,
+ const QBoundingVolume *volume);
Q_DECLARE_PUBLIC(QRayCastingService)
struct Query
{
QQueryHandle handle;
- Qt3DCore::QRay3D ray;
+ QRay3D ray;
QRayCastingService::QueryMode mode;
};
diff --git a/src/render/raycasting/raycasting.pri b/src/render/raycasting/raycasting.pri
index fdd4be17f..2aeb2a461 100644
--- a/src/render/raycasting/raycasting.pri
+++ b/src/render/raycasting/raycasting.pri
@@ -6,6 +6,7 @@ HEADERS += \
$$PWD/qboundingvolume_p.h \
$$PWD/qboundingvolumeprovider_p.h \
$$PWD/qcollisionqueryresult_p.h \
+ $$PWD/qray3d_p.h \
$$PWD/qraycastingservice_p.h
SOURCES += \
@@ -14,4 +15,5 @@ SOURCES += \
$$PWD/qboundingvolume.cpp \
$$PWD/qboundingvolumeprovider.cpp \
$$PWD/qcollisionqueryresult.cpp \
+ $$PWD/qray3d.cpp \
$$PWD/qraycastingservice.cpp
diff --git a/src/render/render.pro b/src/render/render.pro
index 54d9c08dd..e60afc950 100644
--- a/src/render/render.pro
+++ b/src/render/render.pro
@@ -15,7 +15,6 @@ include (lights/lights.pri)
include (materialsystem/materialsystem.pri)
include (renderstates/renderstates.pri)
include (io/io.pri)
-include (defaults/defaults.pri)
include (picking/picking.pri)
include (raycasting/raycasting.pri)
include (services/services.pri)
@@ -23,10 +22,8 @@ include (texture/texture.pri)
RESOURCES += $$PWD/render.qrc
-OTHER_FILES += \
- $$PWD/shaders/* \
- $$PWD/shaders/gl3/* \
- $$PWD/shaders/es2/*
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES += QT_NO_FOREACH
gcov {
CONFIG += static
diff --git a/src/render/render.qrc b/src/render/render.qrc
index e7b1c1d9a..8734971f7 100644
--- a/src/render/render.qrc
+++ b/src/render/render.qrc
@@ -1,43 +1,8 @@
<RCC>
<qresource prefix="/">
- <file>shaders/gl3/light.inc.frag</file>
- <file>shaders/es2/light.inc.frag</file>
- <file>shaders/es2/light.inc.frag100</file>
<file>shaders/gl3/phong.vert</file>
<file>shaders/gl3/phong.frag</file>
<file>shaders/es2/phong.vert</file>
<file>shaders/es2/phong.frag</file>
- <file>shaders/gl3/normaldiffusespecularmap.frag</file>
- <file>shaders/gl3/diffusemap.vert</file>
- <file>shaders/gl3/diffusemap.frag</file>
- <file>shaders/es2/normaldiffusespecularmap.frag</file>
- <file>shaders/es2/diffusemap.vert</file>
- <file>shaders/es2/diffusemap.frag</file>
- <file>shaders/es2/normaldiffusemap.vert</file>
- <file>shaders/es2/normaldiffusemap.frag</file>
- <file>shaders/es2/normaldiffusemapalpha.frag</file>
- <file>shaders/gl3/normaldiffusemap.frag</file>
- <file>shaders/gl3/normaldiffusemap.vert</file>
- <file>shaders/gl3/normaldiffusemapalpha.frag</file>
- <file>shaders/es2/diffusespecularmap.frag</file>
- <file>shaders/gl3/diffusespecularmap.frag</file>
- <file>shaders/gl3/pervertexcolor.frag</file>
- <file>shaders/gl3/pervertexcolor.vert</file>
- <file>shaders/es2/pervertexcolor.frag</file>
- <file>shaders/es2/pervertexcolor.vert</file>
- <file>shaders/es2/skybox.frag</file>
- <file>shaders/es2/skybox.vert</file>
- <file>shaders/gl3/skybox.frag</file>
- <file>shaders/gl3/skybox.vert</file>
- <file>shaders/gl3/gooch.vert</file>
- <file>shaders/gl3/gooch.frag</file>
- <file>shaders/es2/gooch.frag</file>
- <file>shaders/es2/gooch.vert</file>
- <file>shaders/gl3/phongalpha.frag</file>
- <file>shaders/es2/phongalpha.frag</file>
- <file>shaders/gl3/unlittexture.vert</file>
- <file>shaders/gl3/unlittexture.frag</file>
- <file>shaders/es2/unlittexture.frag</file>
- <file>shaders/es2/unlittexture.vert</file>
</qresource>
</RCC>
diff --git a/src/render/renderlogging.cpp b/src/render/renderlogging.cpp
index d002a3bb1..820392b68 100644
--- a/src/render/renderlogging.cpp
+++ b/src/render/renderlogging.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/renderlogging_p.h b/src/render/renderlogging_p.h
index eeb503c42..dfa761e46 100644
--- a/src/render/renderlogging_p.h
+++ b/src/render/renderlogging_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/renderstates/genericstate_p.h b/src/render/renderstates/genericstate_p.h
index 0b5c20433..8155288db 100644
--- a/src/render/renderstates/genericstate_p.h
+++ b/src/render/renderstates/genericstate_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,7 +52,12 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
+#include <Qt3DCore/private/qresourcemanager_p.h>
#include <QList>
+#include <QVector3D>
+#include <QOpenGLContext>
QT_BEGIN_NAMESPACE
@@ -78,113 +86,221 @@ enum StateMask
ColorStateMask = 1 << 12,
ClipPlaneMask = 1 << 13,
StencilOpMask = 1 << 14,
- PointSizeMask = 1 << 15
+ PointSizeMask = 1 << 15,
+ SeamlessCubemapMask = 1 << 16,
+ MSAAEnabledStateMask = 1 << 17
};
typedef quint64 StateMaskSet;
-class Q_AUTOTEST_EXPORT RenderState
+class RenderStateImpl
{
public:
- virtual ~RenderState() {}
+ virtual ~RenderStateImpl() {}
+
virtual void apply(GraphicsContext* gc) const = 0;
virtual StateMaskSet mask() const = 0;
-
- static RenderState *getOrCreateBackendState(QRenderState *renderState);
+ virtual bool equalTo(const RenderStateImpl &renderState) const = 0;
+
+ /*!
+ * \brief Stored statically?
+ *
+ * Should each unique RenderStateImpl be stored statically and thus shared
+ * between RenderStateNodes?
+ * This should be disabled for RenderStateImpls that may have a large
+ * number of values, e.g. when they are using arbitrary floats
+ * Default: true
+ */
+ virtual bool isPooledImpl() const Q_DECL_NOEXCEPT;
+
+ /*!
+ * \brief Return pointer to pooled object with given property change
+ *
+ * For pooled impls: apply property change, get pooled object reflecting
+ * new state
+ */
+ virtual RenderStateImpl *getOrCreateWithPropertyChange(const char *name, const QVariant &value) const = 0;
+
+ static RenderStateImpl *getOrCreateState(QRenderState *renderState);
+ static RenderStateImpl *getOrCreateState(const Qt3DRender::QRenderStateCreatedChangeBasePtr change);
+ virtual void updateProperty(const char *name, const QVariant &value);
};
-template <typename Derived, typename T>
-class GenericState1 : public RenderState
+
+template <class State>
+State *getOrCreateRenderStateEqualTo(const State &prototype)
+{
+ static Qt3DCore::QResourceManager<State, int, 16,
+ Qt3DCore::ArrayAllocatingPolicy,
+ Qt3DCore::ObjectLevelLockingPolicy> manager;
+ static int currIndex = 0;
+
+ // find existing state?
+ for (int idx = 0; idx < currIndex; ++idx) {
+ State *state = manager.lookupResource(idx);
+ if (state->equalTo(prototype))
+ return state;
+ }
+
+ // create new state
+ int thisIndex = currIndex++;
+ State *state = manager.getOrCreateResource(thisIndex);
+ *state = prototype;
+
+ return state;
+}
+
+/**
+ * CRTP base class, in order to simplify object template construction
+ */
+template <class StateSetImpl, StateMaskSet Mask>
+class MaskedRenderState : public RenderStateImpl
{
public:
+ StateMaskSet mask() const Q_DECL_OVERRIDE
+ {
+ return Mask;
+ }
+ // apply delta on temporary template, return instance of actual pooled RenderStateImpl
+ RenderStateImpl *getOrCreateWithPropertyChange(const char *name, const QVariant &value) const Q_DECL_OVERRIDE
+ {
+ Q_ASSERT(isPooledImpl());
+ StateSetImpl newState = *(static_cast<const StateSetImpl*>(this));
+ newState.updateProperty(name, value);
+ return getOrCreateRenderStateEqualTo(newState);
+ }
+ bool equalTo(const RenderStateImpl &renderState) const Q_DECL_OVERRIDE
+ {
+ return mask() == renderState.mask();
+ }
+};
- bool isEqual(const Derived& i) const
- { return (m_1 == i.m_1); }
+template <class StateSetImpl, StateMaskSet mask, typename T>
+class GenericState1 : public MaskedRenderState<StateSetImpl, mask>
+{
+public:
+ GenericState1 *set(const T& v1)
+ {
+ m_1 = v1;
+ return this;
+ }
+ bool equalTo(const RenderStateImpl &renderState) const Q_DECL_OVERRIDE
+ {
+ const GenericState1 *other = static_cast<const GenericState1*>(&renderState);
+ return (other != NULL
+ && other->m_1 == m_1);
+ }
protected:
- GenericState1(T t) :
- m_1(t)
- {}
-
T m_1;
-
};
-template <typename Derived, typename T, typename S>
-class GenericState2 : public RenderState
+template <class StateSetImpl, StateMaskSet mask, typename T, typename S>
+class GenericState2 : public MaskedRenderState<StateSetImpl, mask>
{
public:
- bool isEqual(const Derived& i) const
- { return (m_1 == i.m_1) && (m_2 == i.m_2); }
-protected:
- GenericState2(T t, S s) :
- m_1(t),
- m_2(s)
- {}
-
+ GenericState2 *set(const T& v1, const S& v2)
+ {
+ m_1 = v1;
+ m_2 = v2;
+ return this;
+ }
+ bool equalTo(const RenderStateImpl &renderState) const Q_DECL_OVERRIDE
+ {
+ const GenericState2 *other = static_cast<const GenericState2*>(&renderState);
+ return (other != NULL
+ && other->m_1 == m_1
+ && other->m_2 == m_2);
+ }
+protected:
T m_1;
S m_2;
};
-template <typename Derived, typename T, typename S, typename U>
-class GenericState3 : public RenderState
+template <class StateSetImpl, StateMaskSet mask, typename T, typename S, typename U>
+class GenericState3 : public MaskedRenderState<StateSetImpl, mask>
{
public:
- bool isEqual(const Derived& i) const
- { return (m_1 == i.m_1) && (m_2 == i.m_2) && (m_3 == i.m_3); }
+ GenericState3 *set(const T& v1, const S& v2, const U& v3)
+ {
+ m_1 = v1;
+ m_2 = v2;
+ m_3 = v3;
+ return this;
+ }
+ bool equalTo(const RenderStateImpl &renderState) const Q_DECL_OVERRIDE
+ {
+ const GenericState3 *other = static_cast<const GenericState3*>(&renderState);
+ return (other != NULL
+ && other->m_1 == m_1
+ && other->m_2 == m_2
+ && other->m_3 == m_3);
+ }
protected:
- GenericState3(T t, S s, U u) :
- m_1(t),
- m_2(s),
- m_3(u)
- {}
-
T m_1;
S m_2;
U m_3;
};
-template <typename Derived, typename T, typename S, typename U, typename Z>
-class GenericState4 : public RenderState
+template <class StateSetImpl, StateMaskSet mask, typename T, typename S, typename U, typename Z>
+class GenericState4 : public MaskedRenderState<StateSetImpl, mask>
{
public:
- bool isEqual(const Derived& i) const
- { return (m_1 == i.m_1) && (m_2 == i.m_2) && (m_3 == i.m_3) && (m_4 == i.m_4); }
+ GenericState4 *set(const T& v1, const S& v2, const U& v3, const Z& v4)
+ {
+ m_1 = v1;
+ m_2 = v2;
+ m_3 = v3;
+ m_4 = v4;
+ return this;
+ }
+ bool equalTo(const RenderStateImpl &renderState) const Q_DECL_OVERRIDE
+ {
+ const GenericState4 *other = static_cast<const GenericState4*>(&renderState);
+ return (other != NULL
+ && other->m_1 == m_1
+ && other->m_2 == m_2
+ && other->m_3 == m_3
+ && other->m_4 == m_4);
+ }
protected:
- GenericState4(T t, S s, U u, Z z) :
- m_1(t),
- m_2(s),
- m_3(u),
- m_4(z)
- {}
-
T m_1;
S m_2;
U m_3;
Z m_4;
};
-template <typename Derived, typename T, typename S, typename U, typename V, typename W, typename Z>
-class GenericState6 : public RenderState
+template <class StateSetImpl, StateMaskSet mask, typename T, typename S, typename U, typename V, typename W, typename Z>
+class GenericState6 : public MaskedRenderState<StateSetImpl, mask>
{
public:
- bool isEqual(const Derived& i) const
- { return (m_1 == i.m_1) && (m_2 == i.m_2) && (m_3 == i.m_3) && (m_4 == i.m_4) && (m_5 == i.m_5) && (m_6 == i.m_6); }
+ GenericState6 *set(const T& v1, const S& v2, const U& v3, const V& v4, const W& v5, const Z& v6)
+ {
+ m_1 = v1;
+ m_2 = v2;
+ m_3 = v3;
+ m_4 = v4;
+ m_5 = v5;
+ m_6 = v6;
+ return this;
+ }
+ bool equalTo(const RenderStateImpl &renderState) const Q_DECL_OVERRIDE
+ {
+ const GenericState6 *other = static_cast<const GenericState6*>(&renderState);
+ return (other != NULL
+ && other->m_1 == m_1
+ && other->m_2 == m_2
+ && other->m_3 == m_3
+ && other->m_4 == m_4
+ && other->m_5 == m_5
+ && other->m_6 == m_6);
+ }
protected:
- GenericState6(T t, S s, U u, V v, W w, Z z)
- : m_1(t)
- , m_2(s)
- , m_3(u)
- , m_4(v)
- , m_5(w)
- , m_6(z)
- {}
-
T m_1;
S m_2;
U m_3;
diff --git a/src/render/renderstates/qalphacoverage.cpp b/src/render/renderstates/qalphacoverage.cpp
index 7a8fea6bb..2707b1edc 100644
--- a/src/render/renderstates/qalphacoverage.cpp
+++ b/src/render/renderstates/qalphacoverage.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -46,7 +49,7 @@ class QAlphaCoveragePrivate : public QRenderStatePrivate
{
public :
QAlphaCoveragePrivate()
- : QRenderStatePrivate(QRenderState::AlphaCoverage)
+ : QRenderStatePrivate(QRenderStatePrivate::AlphaCoverage)
{}
Q_DECLARE_PUBLIC(QAlphaCoverage)
@@ -57,9 +60,9 @@ QAlphaCoverage::QAlphaCoverage(QNode *parent)
{
}
+/*! \internal */
QAlphaCoverage::~QAlphaCoverage()
{
- QNode::cleanup();
}
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qalphacoverage.h b/src/render/renderstates/qalphacoverage.h
index 2586bc531..53636d300 100644
--- a/src/render/renderstates/qalphacoverage.h
+++ b/src/render/renderstates/qalphacoverage.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,12 +53,11 @@ class QT3DRENDERSHARED_EXPORT QAlphaCoverage : public QRenderState
{
Q_OBJECT
public:
- explicit QAlphaCoverage(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QAlphaCoverage(Qt3DCore::QNode *parent = nullptr);
~QAlphaCoverage();
private:
Q_DECLARE_PRIVATE(QAlphaCoverage)
- QT3D_CLONEABLE(QAlphaCoverage)
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qalphatest.cpp b/src/render/renderstates/qalphatest.cpp
index def17affe..9f60ceac6 100644
--- a/src/render/renderstates/qalphatest.cpp
+++ b/src/render/renderstates/qalphatest.cpp
@@ -1,112 +1,101 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qalphatest.h"
-#include "qrenderstate_p.h"
-#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qalphatest_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QAlphaTestPrivate : public QRenderStatePrivate
-{
-public:
- QAlphaTestPrivate()
- : QRenderStatePrivate(QRenderState::AlphaTest)
- , m_func(QAlphaTest::Never)
- , m_clamp(0.0f)
- {
- }
-
- Q_DECLARE_PUBLIC(QAlphaTest)
- QAlphaTest::AlphaFunc m_func;
- float m_clamp;
-};
-
QAlphaTest::QAlphaTest(QNode *parent)
: QRenderState(*new QAlphaTestPrivate, parent)
{
}
+/*! \internal */
QAlphaTest::~QAlphaTest()
{
- QNode::cleanup();
}
-void QAlphaTest::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QAlphaTest *refState = static_cast<const QAlphaTest*>(ref);
- d_func()->m_func = refState->d_func()->m_func;
- d_func()->m_clamp = refState->d_func()->m_clamp;
-}
-
-QAlphaTest::AlphaFunc QAlphaTest::func() const
+QAlphaTest::AlphaFunction QAlphaTest::alphaFunction() const
{
Q_D(const QAlphaTest);
- return d->m_func;
+ return d->m_alphaFunction;
}
-void QAlphaTest::setFunc(QAlphaTest::AlphaFunc func)
+void QAlphaTest::setAlphaFunction(QAlphaTest::AlphaFunction alphaFunction)
{
Q_D(QAlphaTest);
- if (d->m_func != func) {
- d->m_func = func;
- emit funcChanged(func);
+ if (d->m_alphaFunction != alphaFunction) {
+ d->m_alphaFunction = alphaFunction;
+ emit alphaFunctionChanged(alphaFunction);
}
}
-float QAlphaTest::clamp() const
+float QAlphaTest::referenceValue() const
{
Q_D(const QAlphaTest);
- return d->m_clamp;
+ return d->m_referenceValue;
}
-void QAlphaTest::setClamp(float clamp)
+void QAlphaTest::setReferenceValue(float referenceValue)
{
Q_D(QAlphaTest);
- if (d->m_clamp != clamp) {
- d->m_clamp = clamp;
- emit clampChanged(clamp);
+ if (d->m_referenceValue != referenceValue) {
+ d->m_referenceValue = referenceValue;
+ emit referenceValueChanged(referenceValue);
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QAlphaTest::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QAlphaTestData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QAlphaTest);
+ data.alphaFunction = d->m_alphaFunction;
+ data.referenceValue = d->m_referenceValue;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qalphatest.h b/src/render/renderstates/qalphatest.h
index 59959138d..49a5fac43 100644
--- a/src/render/renderstates/qalphatest.h
+++ b/src/render/renderstates/qalphatest.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,11 +52,11 @@ class QAlphaTestPrivate;
class QT3DRENDERSHARED_EXPORT QAlphaTest : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(AlphaFunc func READ func WRITE setFunc NOTIFY funcChanged)
- Q_PROPERTY(float clamp READ clamp WRITE setClamp NOTIFY clampChanged)
+ Q_PROPERTY(AlphaFunction alphaFunction READ alphaFunction WRITE setAlphaFunction NOTIFY alphaFunctionChanged)
+ Q_PROPERTY(float referenceValue READ referenceValue WRITE setReferenceValue NOTIFY referenceValueChanged)
public:
- enum AlphaFunc {
+ enum AlphaFunction {
Never = 0x0200,
Always = 0x0207,
Less = 0x0201,
@@ -63,28 +66,25 @@ public:
Greater = 0x0204,
NotEqual = 0x0205
};
- Q_ENUM(AlphaFunc)
+ Q_ENUM(AlphaFunction)
- explicit QAlphaTest(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QAlphaTest(Qt3DCore::QNode *parent = nullptr);
~QAlphaTest();
- AlphaFunc func() const;
- float clamp() const;
+ AlphaFunction alphaFunction() const;
+ float referenceValue() const;
public Q_SLOTS:
- void setFunc(AlphaFunc func);
- void setClamp(float clamp);
+ void setAlphaFunction(AlphaFunction alphaFunction);
+ void setReferenceValue(float referenceValue);
Q_SIGNALS:
- void funcChanged(AlphaFunc func);
- void clampChanged(float clamp);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void alphaFunctionChanged(AlphaFunction alphaFunction);
+ void referenceValueChanged(float referenceValue);
private:
Q_DECLARE_PRIVATE(QAlphaTest)
- QT3D_CLONEABLE(QAlphaTest)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qalphatest_p.h b/src/render/renderstates/qalphatest_p.h
new file mode 100644
index 000000000..991da67ff
--- /dev/null
+++ b/src/render/renderstates/qalphatest_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QALPHATEST_P_H
+#define QT3DRENDER_QALPHATEST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qalphatest.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAlphaTestPrivate : public QRenderStatePrivate
+{
+public:
+ QAlphaTestPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::AlphaTest)
+ , m_alphaFunction(QAlphaTest::Never)
+ , m_referenceValue(0.0f)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QAlphaTest)
+ QAlphaTest::AlphaFunction m_alphaFunction;
+ float m_referenceValue;
+};
+
+struct QAlphaTestData
+{
+ QAlphaTest::AlphaFunction alphaFunction;
+ float referenceValue;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QALPHATEST_P_H
diff --git a/src/render/renderstates/qblendequation.cpp b/src/render/renderstates/qblendequation.cpp
index 02b3c682e..fef531f20 100644
--- a/src/render/renderstates/qblendequation.cpp
+++ b/src/render/renderstates/qblendequation.cpp
@@ -1,94 +1,84 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qrenderstate_p.h"
#include "qblendequation.h"
-#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qblendequation_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QBlendEquationPrivate : public QRenderStatePrivate
-{
-public:
- QBlendEquationPrivate()
- : QRenderStatePrivate(QRenderState::BlendEquation)
- , m_mode(QBlendEquation::FuncAdd)
- {
- }
-
- Q_DECLARE_PUBLIC(QBlendEquation)
- QBlendEquation::BlendMode m_mode;
-};
-
-void QBlendEquation::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QBlendEquation *refState = reinterpret_cast<const QBlendEquation*>(ref);
- d_func()->m_mode = refState->d_func()->m_mode;
-}
-
QBlendEquation::QBlendEquation(QNode *parent)
: QRenderState(*new QBlendEquationPrivate, parent)
{
}
+/*! \internal */
QBlendEquation::~QBlendEquation()
{
- QNode::cleanup();
}
-QBlendEquation::BlendMode QBlendEquation::mode() const
+QBlendEquation::BlendFunction QBlendEquation::blendFunction() const
{
Q_D(const QBlendEquation);
- return d->m_mode;
+ return d->m_blendFunction;
}
-void QBlendEquation::setMode(QBlendEquation::BlendMode mode)
+void QBlendEquation::setBlendFunction(QBlendEquation::BlendFunction blendFunction)
{
Q_D(QBlendEquation);
- if (d->m_mode != mode) {
- d->m_mode = mode;
- emit modeChanged(mode);
+ if (d->m_blendFunction != blendFunction) {
+ d->m_blendFunction = blendFunction;
+ emit blendFunctionChanged(blendFunction);
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QBlendEquation::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QBlendEquationData>::create(this);
+ auto &data = creationChange->data;
+ data.blendFunction = d_func()->m_blendFunction;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qblendequation.h b/src/render/renderstates/qblendequation.h
index 83bfce5b4..6810cf96e 100644
--- a/src/render/renderstates/qblendequation.h
+++ b/src/render/renderstates/qblendequation.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,36 +52,33 @@ class QBlendEquationPrivate;
class QT3DRENDERSHARED_EXPORT QBlendEquation : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(BlendMode mode READ mode WRITE setMode NOTIFY modeChanged)
+ Q_PROPERTY(BlendFunction blendFunction READ blendFunction WRITE setBlendFunction NOTIFY blendFunctionChanged)
public:
- enum BlendMode
+ enum BlendFunction
{
- FuncAdd = 0x8006,
- FuncSubstract = 0x800A,
- FuncReverseSubstract = 0x800B,
+ Add = 0x8006,
+ Subtract = 0x800A,
+ ReverseSubtract = 0x800B,
Min = 0x8007,
Max = 0x8008
};
- Q_ENUM(BlendMode)
+ Q_ENUM(BlendFunction)
- explicit QBlendEquation(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QBlendEquation(Qt3DCore::QNode *parent = nullptr);
~QBlendEquation();
- BlendMode mode() const;
+ BlendFunction blendFunction() const;
public Q_SLOTS:
- void setMode(BlendMode mode);
+ void setBlendFunction(BlendFunction blendFunction);
Q_SIGNALS:
- void modeChanged(BlendMode mode);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void blendFunctionChanged(BlendFunction blendFunction);
private:
Q_DECLARE_PRIVATE(QBlendEquation)
- QT3D_CLONEABLE(QBlendEquation)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qblendequation_p.h b/src/render/renderstates/qblendequation_p.h
new file mode 100644
index 000000000..d09a29c2f
--- /dev/null
+++ b/src/render/renderstates/qblendequation_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QBLENDEQUATION_P_H
+#define QT3DRENDER_QBLENDEQUATION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qblendequation.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QBlendEquationPrivate : public QRenderStatePrivate
+{
+public:
+ QBlendEquationPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::BlendEquation)
+ , m_blendFunction(QBlendEquation::Add)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QBlendEquation)
+ QBlendEquation::BlendFunction m_blendFunction;
+};
+
+struct QBlendEquationData
+{
+ QBlendEquation::BlendFunction blendFunction;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QBLENDEQUATION_P_H
diff --git a/src/render/renderstates/qblendequationarguments.cpp b/src/render/renderstates/qblendequationarguments.cpp
new file mode 100644
index 000000000..a57c19b76
--- /dev/null
+++ b/src/render/renderstates/qblendequationarguments.cpp
@@ -0,0 +1,288 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qblendequationarguments.h"
+#include "qblendequationarguments_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+/*!
+ \class Qt3DRender::QBlendEquationArguments
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief Encapsulates blending information.
+
+ OpenGL pre-3.0: Set the same blend state for all draw buffers
+ (one QBlendEquationArguments)
+ OpenGL 3.0-pre4.0: Set the same blend state for all draw buffers,
+ but can disable blending for particular buffers
+ (one QBlendEquationArguments for setting glBlendFunc, n QBlendEquationArgumentss
+ for enabling/disabling Draw Buffers)
+ OpenGL 4.0+: Can set blend state individually for each draw buffer.
+ */
+
+/*!
+ \qmltype BlendEquationArguments
+ \instantiates Qt3DRender::QBlendEquationArguments
+ \inherits RenderState
+ \inqmlmodule Qt3D.Render
+ \since 5.5
+ \brief Encapsulates blending information.
+
+ OpenGL pre-3.0: Set the same blend state for all draw buffers
+ OpenGL 3.0-pre4.0: Set the same blend state for all draw buffers,
+ but can disable blending for particular buffers
+ OpenGL 4.0+: Can set blend state individually for each draw buffer.
+*/
+
+/*!
+ The constructor creates a new blend state object with the specified \a parent.
+ */
+QBlendEquationArguments::QBlendEquationArguments(QNode *parent)
+ : QRenderState(*new QBlendEquationArgumentsPrivate, parent)
+{
+}
+
+/*!
+ \internal
+*/
+QBlendEquationArguments::~QBlendEquationArguments()
+{
+}
+
+/*!
+ \internal
+*/
+QBlendEquationArguments::QBlendEquationArguments(QBlendEquationArgumentsPrivate &dd, QNode *parent)
+ : QRenderState(dd, parent)
+{
+}
+
+/*!
+ \enum Qt3DRender::QBlendEquationArguments::Blending
+
+ \value Zero 0
+ \value One 1
+ \value SrcColor 0x0300
+ \value SourceAlpha 0x0302
+ \value Src1Alpha
+ \value Src1Color
+ \value DstColor 0x0306
+ \value destinationAlpha 0x0304
+ \value SourceAlphaSaturate 0x0308
+ \value ConstantColor 0x8001
+ \value ConstantAlpha 0x8003
+ \value OneMinusSrcColor 0x0301
+ \value OneMinusSourceAlpha 0x0303
+ \value OneMinusdestinationAlpha 0x0305
+ \value OneMinusDstColor 0x0307
+ \value OneMinusConstantColor 0x8002
+ \value OneMinusConstantAlpha 0x8004
+ \value OneMinusSrc1Alpha
+ \value OneMinusSrc1Color0
+*/
+
+/*!
+ \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::sourceRgb
+
+ */
+
+/*!
+ \property Qt3DRender::QBlendEquationArguments::sourceRgb
+
+ */
+QBlendEquationArguments::Blending QBlendEquationArguments::sourceRgb() const
+{
+ Q_D(const QBlendEquationArguments);
+ return d->m_sourceRgb;
+}
+
+void QBlendEquationArguments::setSourceRgb(QBlendEquationArguments::Blending sourceRgb)
+{
+ Q_D(QBlendEquationArguments);
+ if (d->m_sourceRgb != sourceRgb) {
+ d->m_sourceRgb = sourceRgb;
+ emit sourceRgbChanged(sourceRgb);
+
+ if (d->m_sourceAlpha == sourceRgb)
+ emit sourceRgbaChanged(sourceRgb);
+ }
+}
+
+/*!
+ \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::destinationRgb
+
+ */
+
+/*!
+ \property Qt3DRender::QBlendEquationArguments::destinationRgb
+
+ */
+QBlendEquationArguments::Blending QBlendEquationArguments::destinationRgb() const
+{
+ Q_D(const QBlendEquationArguments);
+ return d->m_destinationRgb;
+}
+
+void QBlendEquationArguments::setDestinationRgb(QBlendEquationArguments::Blending destinationRgb)
+{
+ Q_D(QBlendEquationArguments);
+ if (d->m_destinationRgb != destinationRgb) {
+ d->m_destinationRgb = destinationRgb;
+ emit destinationRgbChanged(destinationRgb);
+
+ if (d->m_destinationAlpha == destinationRgb)
+ emit destinationRgbaChanged(destinationRgb);
+ }
+}
+
+/*!
+ \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::sourceAlpha
+
+ */
+
+/*!
+ \property Qt3DRender::QBlendEquationArguments::sourceAlpha
+
+ */
+QBlendEquationArguments::Blending QBlendEquationArguments::sourceAlpha() const
+{
+ Q_D(const QBlendEquationArguments);
+ return d->m_sourceAlpha;
+}
+
+void QBlendEquationArguments::setSourceAlpha(QBlendEquationArguments::Blending sourceAlpha)
+{
+ Q_D(QBlendEquationArguments);
+ if (d->m_sourceAlpha != sourceAlpha) {
+ d->m_sourceAlpha = sourceAlpha;
+ emit sourceAlphaChanged(sourceAlpha);
+
+ if (d->m_sourceRgb == sourceAlpha)
+ emit sourceRgbaChanged(sourceAlpha);
+ }
+}
+
+/*!
+ \qmlproperty enumeration Qt3D.Render::BlendEquationArguments::DestinationAlpha
+
+ */
+
+/*!
+ \property Qt3DRender::QBlendEquationArguments::destinationAlpha
+
+ */
+QBlendEquationArguments::Blending QBlendEquationArguments::destinationAlpha() const
+{
+ Q_D(const QBlendEquationArguments);
+ return d->m_destinationAlpha;
+}
+
+void QBlendEquationArguments::setDestinationAlpha(QBlendEquationArguments::Blending destinationAlpha)
+{
+ Q_D(QBlendEquationArguments);
+ if (d->m_destinationAlpha != destinationAlpha) {
+ d->m_destinationAlpha = destinationAlpha;
+ emit destinationAlphaChanged(destinationAlpha);
+
+ if (d->m_destinationRgb == destinationAlpha)
+ emit destinationRgbaChanged(destinationAlpha);
+ }
+}
+
+void QBlendEquationArguments::setSourceRgba(Blending sourceRgba)
+{
+ setSourceRgb(sourceRgba);
+ setSourceAlpha(sourceRgba);
+}
+
+void QBlendEquationArguments::setDestinationRgba(Blending destinationRgba)
+{
+ setDestinationRgb(destinationRgba);
+ setDestinationAlpha(destinationRgba);
+}
+
+/*!
+ \qmlproperty int Qt3D.Render::BlendEquationArguments::bufferIndex
+
+ Specifies the index of the Draw Buffer that this BlendEquationArguments applies to.
+ If negative, this will apply to all Draw Buffers.
+ */
+
+/*!
+ \property Qt3DRender::QBlendEquationArguments::bufferIndex
+
+ Specifies the index of the Draw Buffer that this BlendEquationArguments applies to.
+ If negative, this will apply to all Draw Buffers.
+ */
+int QBlendEquationArguments::bufferIndex() const
+{
+ Q_D(const QBlendEquationArguments);
+ return d->m_bufferIndex;
+}
+
+void QBlendEquationArguments::setBufferIndex(int bufferIndex)
+{
+ Q_D(QBlendEquationArguments);
+ if (d->m_bufferIndex != bufferIndex) {
+ d->m_bufferIndex = bufferIndex;
+ emit bufferIndexChanged(bufferIndex);
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QBlendEquationArguments::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QBlendEquationArgumentsData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QBlendEquationArguments);
+ data.sourceRgb = d->m_sourceRgb;
+ data.sourceAlpha = d->m_sourceAlpha;
+ data.destinationRgb = d->m_destinationRgb;
+ data.destinationAlpha = d->m_destinationAlpha;
+ data.bufferIndex = d->m_bufferIndex;
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/renderstates/qblendequationarguments.h b/src/render/renderstates/qblendequationarguments.h
new file mode 100644
index 000000000..8e2f86f6c
--- /dev/null
+++ b/src/render/renderstates/qblendequationarguments.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QBLENDEQUATIONARGUMENTS_H
+#define QT3DRENDER_QBLENDEQUATIONARGUMENTS_H
+
+#include <Qt3DRender/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QBlendEquationArgumentsPrivate;
+
+class QT3DRENDERSHARED_EXPORT QBlendEquationArguments : public QRenderState
+{
+ Q_OBJECT
+ Q_PROPERTY(Blending sourceRgb READ sourceRgb WRITE setSourceRgb NOTIFY sourceRgbChanged)
+ Q_PROPERTY(Blending sourceAlpha READ sourceAlpha WRITE setSourceAlpha NOTIFY sourceAlphaChanged)
+ Q_PROPERTY(Blending destinationRgb READ destinationRgb WRITE setDestinationRgb NOTIFY destinationRgbChanged)
+ Q_PROPERTY(Blending destinationAlpha READ destinationAlpha WRITE setDestinationAlpha NOTIFY destinationAlphaChanged)
+ Q_PROPERTY(int bufferIndex READ bufferIndex WRITE setBufferIndex NOTIFY bufferIndexChanged)
+
+public:
+
+ enum Blending
+ {
+ Zero = 0,
+ One = 1,
+ SourceColor = 0x0300,
+ SourceAlpha = 0x0302,
+ Source1Alpha,
+ Source1Color,
+ DestinationColor = 0x0306,
+ DestinationAlpha = 0x0304,
+ SourceAlphaSaturate = 0x0308,
+ ConstantColor = 0x8001,
+ ConstantAlpha = 0x8003,
+ OneMinusSourceColor = 0x0301,
+ OneMinusSourceAlpha = 0x0303,
+ OneMinusDestinationAlpha = 0x0305,
+ OneMinusDestinationColor = 0x0307,
+ OneMinusConstantColor = 0x8002,
+ OneMinusConstantAlpha = 0x8004,
+ OneMinusSource1Alpha,
+ OneMinusSource1Color0
+ };
+ Q_ENUM(Blending)
+
+ explicit QBlendEquationArguments(Qt3DCore::QNode *parent = nullptr);
+ ~QBlendEquationArguments();
+
+ Blending sourceRgb() const;
+ Blending destinationRgb() const;
+ Blending sourceAlpha() const;
+ Blending destinationAlpha() const;
+ int bufferIndex() const;
+ bool specifiesAllDrawBuffers() const;
+
+public Q_SLOTS:
+ void setSourceRgb(Blending sourceRgb);
+ void setDestinationRgb(Blending destinationRgb);
+ void setSourceAlpha(Blending sourceAlpha);
+ void setDestinationAlpha(Blending destinationAlpha);
+ void setSourceRgba(Blending sourceRgba);
+ void setDestinationRgba(Blending destinationRgba);
+ void setBufferIndex(int index);
+
+Q_SIGNALS:
+ void sourceRgbChanged(Blending sourceRgb);
+ void sourceAlphaChanged(Blending sourceAlpha);
+ void destinationRgbChanged(Blending destinationRgb);
+ void destinationAlphaChanged(Blending destinationAlpha);
+ void sourceRgbaChanged(Blending sourceRgba);
+ void destinationRgbaChanged(Blending destinationRgba);
+ void bufferIndexChanged(int index);
+
+protected:
+ explicit QBlendEquationArguments(QBlendEquationArgumentsPrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+private:
+ Q_DECLARE_PRIVATE(QBlendEquationArguments)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QBLENDEQUATIONARGUMENTS_H
diff --git a/src/render/renderstates/qblendequationarguments_p.h b/src/render/renderstates/qblendequationarguments_p.h
new file mode 100644
index 000000000..f8bd1941a
--- /dev/null
+++ b/src/render/renderstates/qblendequationarguments_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QBLENDEQUATIONARGUMENTS_P_H
+#define QT3DRENDER_QBLENDEQUATIONARGUMENTS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qblendequationarguments.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QBlendEquationArgumentsPrivate : public QRenderStatePrivate
+{
+public:
+ QBlendEquationArgumentsPrivate(QRenderStatePrivate::Type type = QRenderStatePrivate::BlendEquationArguments)
+ : QRenderStatePrivate(type)
+ , m_sourceRgb(QBlendEquationArguments::Zero)
+ , m_sourceAlpha(QBlendEquationArguments::Zero)
+ , m_destinationRgb(QBlendEquationArguments::Zero)
+ , m_destinationAlpha(QBlendEquationArguments::Zero)
+ , m_bufferIndex(-1)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QBlendEquationArguments)
+
+ QBlendEquationArguments::Blending m_sourceRgb;
+ QBlendEquationArguments::Blending m_sourceAlpha;
+ QBlendEquationArguments::Blending m_destinationRgb;
+ QBlendEquationArguments::Blending m_destinationAlpha;
+ int m_bufferIndex;
+};
+
+struct QBlendEquationArgumentsData
+{
+ QBlendEquationArguments::Blending sourceRgb;
+ QBlendEquationArguments::Blending sourceAlpha;
+ QBlendEquationArguments::Blending destinationRgb;
+ QBlendEquationArguments::Blending destinationAlpha;
+ int bufferIndex;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QBLENDEQUATIONARGUMENTS_P_H
diff --git a/src/render/renderstates/qblendstate.cpp b/src/render/renderstates/qblendstate.cpp
deleted file mode 100644
index 0a27c5b35..000000000
--- a/src/render/renderstates/qblendstate.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qblendstate.h"
-#include "qrenderstate_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <private/qnode_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QBlendStatePrivate : public QRenderStatePrivate
-{
-public:
- QBlendStatePrivate(QRenderState::Type type = QRenderState::BlendState)
- : QRenderStatePrivate(type)
- , m_srcRGB(QBlendState::Zero)
- , m_srcAlpha(QBlendState::Zero)
- , m_dstRGB(QBlendState::Zero)
- , m_dstAlpha(QBlendState::Zero)
- {
- }
-
- Q_DECLARE_PUBLIC(QBlendState)
-
- QBlendState::Blending m_srcRGB;
- QBlendState::Blending m_srcAlpha;
- QBlendState::Blending m_dstRGB;
- QBlendState::Blending m_dstAlpha;
-};
-
-/*!
- \class Qt3DRender::QBlendState
- \inmodule Qt3DRender
- \since 5.5
- \brief Encapsulates blending information.
- */
-
-/*!
- \qmltype BlendState
- \instantiates Qt3DRender::QBlendState
- \inherits RenderState
- \inqmlmodule Qt3D.Render
- \since 5.5
- \brief Encapsulates blending information.
-*/
-
-/*!
- The constructor creates a new blend state object with the specified \a parent.
- */
-QBlendState::QBlendState(QNode *parent)
- : QRenderState(*new QBlendStatePrivate, parent)
-{
-}
-
-QBlendState::~QBlendState()
-{
- QNode::cleanup();
-}
-
-/*! \fn void QBlendState::copy(const Qt3DCore::QNode *ref)
- \internal
- Copies \a ref into this object.
- */
-void QBlendState::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QBlendState *refState = static_cast<const QBlendState*>(ref);
- d_func()->m_srcRGB = refState->d_func()->m_srcRGB;
- d_func()->m_srcAlpha = refState->d_func()->m_srcAlpha;
- d_func()->m_dstAlpha = refState->d_func()->m_dstAlpha;
- d_func()->m_dstRGB = refState->d_func()->m_dstRGB;
-}
-
-/*!
- \internal
-*/
-QBlendState::QBlendState(QRenderState::Type type, QNode *parent)
- : QRenderState(*new QBlendStatePrivate(type), parent)
-{
-}
-
-/*!
- \enum Qt3DRender::QBlendState::Blending
-
- \value Zero 0
- \value One 1
- \value SrcColor 0x0300
- \value SrcAlpha 0x0302
- \value Src1Alpha
- \value Src1Color
- \value DstColor 0x0306
- \value DstAlpha 0x0304
- \value SrcAlphaSaturate 0x0308
- \value ConstantColor 0x8001
- \value ConstantAlpha 0x8003
- \value OneMinusSrcColor 0x0301
- \value OneMinusSrcAlpha 0x0303
- \value OneMinusDstAlpha 0x0305
- \value OneMinusDstColor 0x0307
- \value OneMinusConstantColor 0x8002
- \value OneMinusConstantAlpha 0x8004
- \value OneMinusSrc1Alpha
- \value OneMinusSrc1Color0
-*/
-
-/*!
- \qmlproperty enumeration Qt3D.Render::BlendState::srcRGB
-
- */
-
-/*!
- \property Qt3DRender::QBlendState::srcRGB
-
- */
-QBlendState::Blending QBlendState::srcRGB() const
-{
- Q_D(const QBlendState);
- return d->m_srcRGB;
-}
-
-void QBlendState::setSrcRGB(QBlendState::Blending srcRGB)
-{
- Q_D(QBlendState);
- if (d->m_srcRGB != srcRGB) {
- d->m_srcRGB = srcRGB;
- emit srcRGBChanged(srcRGB);
- }
-}
-
-/*!
- \qmlproperty enumeration Qt3D.Render::BlendState::dstRGB
-
- */
-
-/*!
- \property Qt3DRender::QBlendState::dstRGB
-
- */
-QBlendState::Blending QBlendState::dstRGB() const
-{
- Q_D(const QBlendState);
- return d->m_dstRGB;
-}
-
-void QBlendState::setDstRGB(QBlendState::Blending dstRGB)
-{
- Q_D(QBlendState);
- if (d->m_dstRGB != dstRGB) {
- d->m_dstRGB = dstRGB;
- emit dstRGBChanged(dstRGB);
- }
-}
-
-/*!
- \qmlproperty enumeration Qt3D.Render::BlendState::srcAlpha
-
- */
-
-/*!
- \property Qt3DRender::QBlendState::srcAlpha
-
- */
-QBlendState::Blending QBlendState::srcAlpha() const
-{
- Q_D(const QBlendState);
- return d->m_srcAlpha;
-}
-
-void QBlendState::setSrcAlpha(QBlendState::Blending srcAlpha)
-{
- Q_D(QBlendState);
- if (d->m_srcAlpha != srcAlpha) {
- d->m_srcAlpha = srcAlpha;
- emit srcAlphaChanged(srcAlpha);
- }
-}
-
-/*!
- \qmlproperty enumeration Qt3D.Render::BlendState::dstAlpha
-
- */
-
-/*!
- \property Qt3DRender::QBlendState::dstAlpha
-
- */
-QBlendState::Blending QBlendState::dstAlpha() const
-{
- Q_D(const QBlendState);
- return d->m_dstAlpha;
-}
-
-void QBlendState::setDstAlpha(QBlendState::Blending dstAlpha)
-{
- Q_D(QBlendState);
- if (d->m_dstAlpha != dstAlpha) {
- d->m_dstAlpha = dstAlpha;
- emit dstAlphaChanged(dstAlpha);
- }
-}
-
-/*!
- \class Qt3DRender::QBlendStateSeparate
- \inmodule Qt3DRender
- \since 5.5
- \brief Encapsulates blending information.
- */
-
-/*!
- \qmltype BlendStateSeparate
- \instantiates Qt3DRender::QBlendStateSeparate
- \inherits RenderState
- \inqmlmodule Qt3D.Render
- \since 5.5
- \brief Encapsulates blending information.
-*/
-
-/*!
- The constructor creates a QBlendStateSeparate instance with the
- specified \a parent.
- */
-QBlendStateSeparate::QBlendStateSeparate(QNode *parent)
- : QBlendState(QRenderState::BlendStateSeparate, parent)
-{
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/renderstates/qblendstate.h b/src/render/renderstates/qblendstate.h
deleted file mode 100644
index 4413d4a28..000000000
--- a/src/render/renderstates/qblendstate.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QBLENDSTATE_H
-#define QT3DRENDER_QBLENDSTATE_H
-
-#include <Qt3DRender/qrenderstate.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QBlendStatePrivate;
-
-class QT3DRENDERSHARED_EXPORT QBlendState : public QRenderState
-{
- Q_OBJECT
- Q_PROPERTY(Blending srcRGB READ srcRGB WRITE setSrcRGB NOTIFY srcRGBChanged)
- Q_PROPERTY(Blending srcAlpha READ srcAlpha WRITE setSrcAlpha NOTIFY srcAlphaChanged)
- Q_PROPERTY(Blending dstRGB READ dstRGB WRITE setDstRGB NOTIFY dstRGBChanged)
- Q_PROPERTY(Blending dstAlpha READ dstAlpha WRITE setDstAlpha NOTIFY dstAlphaChanged)
-
-public:
-
- enum Blending
- {
- Zero = 0,
- One = 1,
- SrcColor = 0x0300,
- SrcAlpha = 0x0302,
- Src1Alpha,
- Src1Color,
- DstColor = 0x0306,
- DstAlpha = 0x0304,
- SrcAlphaSaturate = 0x0308,
- ConstantColor = 0x8001,
- ConstantAlpha = 0x8003,
- OneMinusSrcColor = 0x0301,
- OneMinusSrcAlpha = 0x0303,
- OneMinusDstAlpha = 0x0305,
- OneMinusDstColor = 0x0307,
- OneMinusConstantColor = 0x8002,
- OneMinusConstantAlpha = 0x8004,
- OneMinusSrc1Alpha,
- OneMinusSrc1Color0
- };
- Q_ENUM(Blending)
-
- explicit QBlendState(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QBlendState();
-
- Blending srcRGB() const;
- Blending dstRGB() const;
- Blending srcAlpha() const;
- Blending dstAlpha() const;
-
-public Q_SLOTS:
- void setSrcRGB(Blending srcRGB);
- void setDstRGB(Blending dstRGB);
- void setSrcAlpha(Blending srcAlpha);
- void setDstAlpha(Blending dstAlpha);
-
-Q_SIGNALS:
- void srcRGBChanged(Blending srcRGB);
- void srcAlphaChanged(Blending srcAlpha);
- void dstRGBChanged(Blending dstRGB);
- void dstAlphaChanged(Blending dstAlpha);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- QBlendState(QRenderState::Type type, Qt3DCore::QNode *parent = Q_NULLPTR);
-
-private:
- Q_DECLARE_PRIVATE(QBlendState)
- QT3D_CLONEABLE(QBlendState)
-};
-
-class QT3DRENDERSHARED_EXPORT QBlendStateSeparate : public QBlendState
-{
- Q_OBJECT
-public:
- explicit QBlendStateSeparate(Qt3DCore::QNode *parent = Q_NULLPTR);
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QBLENDSTATE_H
diff --git a/src/render/renderstates/qclipplane.cpp b/src/render/renderstates/qclipplane.cpp
index 999a249fe..f117d040a 100644
--- a/src/render/renderstates/qclipplane.cpp
+++ b/src/render/renderstates/qclipplane.cpp
@@ -1,57 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qclipplane.h"
-#include <Qt3DRender/private/qrenderstate_p.h>
+#include "qclipplane_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QClipPlanePrivate : public QRenderStatePrivate
-{
-public:
- QClipPlanePrivate()
- : QRenderStatePrivate(QRenderState::ClipPlane)
- , m_plane(0)
- {}
-
- int m_plane;
-};
-
/*!
\class Qt3DRender::QClipPlane
\inmodule Qt3DRender
@@ -85,39 +78,73 @@ QClipPlane::QClipPlane(QNode *parent)
{
}
+/*! \internal */
QClipPlane::~QClipPlane()
{
- QNode::cleanup();
}
/*!
* Returns the index of the clip plane.
* \note usually between 0-7
*/
-int QClipPlane::plane() const
+int QClipPlane::planeIndex() const
+{
+ Q_D(const QClipPlane);
+ return d->m_planeIndex;
+}
+
+QVector3D QClipPlane::normal() const
+{
+ Q_D(const QClipPlane);
+ return d->m_normal;
+}
+
+float QClipPlane::distance() const
{
Q_D(const QClipPlane);
- return d->m_plane;
+ return d->m_distance;
}
/*!
* Sets the index of the clip plane to \a plane.
* \note above 7, support is not garanteed
*/
-void QClipPlane::setPlane(int plane)
+void QClipPlane::setPlaneIndex(int planeIndex)
{
Q_D(QClipPlane);
- if (plane != d->m_plane) {
- d->m_plane = plane;
- Q_EMIT planeChanged(plane);
+ if (planeIndex != d->m_planeIndex) {
+ d->m_planeIndex = planeIndex;
+ Q_EMIT planeIndexChanged(planeIndex);
}
}
-void QClipPlane::copy(const QNode *ref)
+void QClipPlane::setNormal(QVector3D normal)
{
- QRenderState::copy(ref);
- const QClipPlane *refClip = static_cast<const QClipPlane *>(ref);
- d_func()->m_plane = refClip->plane();
+ Q_D(QClipPlane);
+ if (normal != d->m_normal) {
+ d->m_normal = normal;
+ Q_EMIT normalChanged(normal);
+ }
+}
+
+void QClipPlane::setDistance(float distance)
+{
+ Q_D(QClipPlane);
+ if (distance != d->m_distance) {
+ d->m_distance = distance;
+ Q_EMIT distanceChanged(distance);
+ }
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QClipPlane::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QClipPlaneData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QClipPlane);
+ data.normal = d->m_normal;
+ data.distance = d->m_distance;
+ data.planeIndex = d->m_planeIndex;
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qclipplane.h b/src/render/renderstates/qclipplane.h
index 98f97ec72..46c44ad44 100644
--- a/src/render/renderstates/qclipplane.h
+++ b/src/render/renderstates/qclipplane.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,6 +41,7 @@
#define QT3DRENDER_QCLIPPLANE_H
#include <Qt3DRender/qrenderstate.h>
+#include <QtGui/qvector3d.h>
QT_BEGIN_NAMESPACE
@@ -48,25 +52,30 @@ class QClipPlanePrivate;
class QT3DRENDERSHARED_EXPORT QClipPlane : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(int plane READ plane WRITE setPlane NOTIFY planeChanged)
+ Q_PROPERTY(int planeIndex READ planeIndex WRITE setPlaneIndex NOTIFY planeIndexChanged)
+ Q_PROPERTY(QVector3D normal READ normal WRITE setNormal NOTIFY normalChanged)
+ Q_PROPERTY(float distance READ distance WRITE setDistance NOTIFY distanceChanged)
public:
- explicit QClipPlane(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QClipPlane(Qt3DCore::QNode *parent = nullptr);
~QClipPlane();
- int plane() const;
+ int planeIndex() const;
+ QVector3D normal() const;
+ float distance() const;
public Q_SLOTS:
- void setPlane(int);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
+ void setPlaneIndex(int);
+ void setNormal(QVector3D);
+ void setDistance(float);
Q_SIGNALS:
- void planeChanged(int plane);
+ void planeIndexChanged(int planeIndex);
+ void normalChanged(QVector3D normal);
+ void distanceChanged(float distance);
private:
Q_DECLARE_PRIVATE(QClipPlane)
- QT3D_CLONEABLE(QClipPlane)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qclipplane_p.h b/src/render/renderstates/qclipplane_p.h
new file mode 100644
index 000000000..ff8bb7b98
--- /dev/null
+++ b/src/render/renderstates/qclipplane_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCLIPPLANE_P_H
+#define QT3DRENDER_QCLIPPLANE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qalphatest.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QClipPlanePrivate : public QRenderStatePrivate
+{
+public:
+ QClipPlanePrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::ClipPlane)
+ , m_planeIndex(0)
+ , m_normal()
+ , m_distance(0.0f)
+ {}
+
+ int m_planeIndex;
+ QVector3D m_normal;
+ float m_distance;
+};
+
+struct QClipPlaneData
+{
+ QVector3D normal;
+ float distance;
+ int planeIndex;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCLIPPLANE_P_H
diff --git a/src/render/renderstates/qcolormask.cpp b/src/render/renderstates/qcolormask.cpp
index e4b4e4db4..71819db94 100644
--- a/src/render/renderstates/qcolormask.cpp
+++ b/src/render/renderstates/qcolormask.cpp
@@ -1,65 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qcolormask.h"
-#include <Qt3DRender/private/qrenderstate_p.h>
+#include "qcolormask_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QColorMaskPrivate : public QRenderStatePrivate
-{
-public:
- QColorMaskPrivate()
- : QRenderStatePrivate(QRenderState::ColorMask)
- , m_red(true)
- , m_green(true)
- , m_blue(true)
- , m_alpha(true)
- {}
-
- bool m_red;
- bool m_green;
- bool m_blue;
- bool m_alpha;
-
- Q_DECLARE_PUBLIC(QColorMask)
-};
-
/*!
\class Qt3DRender::QColorMask
\inmodule Qt3DRender
@@ -82,45 +67,45 @@ QColorMask::QColorMask(QNode *parent)
{
}
+/*! \internal */
QColorMask::~QColorMask()
{
- QNode::cleanup();
}
-bool QColorMask::isRed() const
+bool QColorMask::isRedMasked() const
{
Q_D(const QColorMask);
- return d->m_red;
+ return d->m_redMasked;
}
-bool QColorMask::isGreen() const
+bool QColorMask::isGreenMasked() const
{
Q_D(const QColorMask);
- return d->m_green;
+ return d->m_greenMasked;
}
-bool QColorMask::isBlue() const
+bool QColorMask::isBlueMasked() const
{
Q_D(const QColorMask);
- return d->m_blue;
+ return d->m_blueMasked;
}
-bool QColorMask::isAlpha() const
+bool QColorMask::isAlphaMasked() const
{
Q_D(const QColorMask);
- return d->m_alpha;
+ return d->m_alphaMasked;
}
/*!
\property Qt3DRender::QColorMask::red
Holds whether the red color component should be written to the frame buffer.
*/
-void QColorMask::setRed(bool red)
+void QColorMask::setRedMasked(bool redMasked)
{
Q_D(QColorMask);
- if (red != d->m_red) {
- d->m_red = red;
- emit redChanged(red);
+ if (redMasked != d->m_redMasked) {
+ d->m_redMasked = redMasked;
+ emit redMaskedChanged(redMasked);
}
}
@@ -128,12 +113,12 @@ void QColorMask::setRed(bool red)
\property Qt3DRender::QColorMask::green
Holds whether the green color component should be written to the frame buffer.
*/
-void QColorMask::setGreen(bool green)
+void QColorMask::setGreenMasked(bool greenMasked)
{
Q_D(QColorMask);
- if (green != d->m_green) {
- d->m_green = green;
- emit greenChanged(green);
+ if (greenMasked != d->m_greenMasked) {
+ d->m_greenMasked = greenMasked;
+ emit greenMaskedChanged(greenMasked);
}
}
@@ -141,36 +126,38 @@ void QColorMask::setGreen(bool green)
\property Qt3DRender::QColorMask::blue
Holds whether the blue color component should be written to the frame buffer.
*/
-void QColorMask::setBlue(bool blue)
+void QColorMask::setBlueMasked(bool blueMasked)
{
Q_D(QColorMask);
- if (blue != d->m_blue) {
- d->m_blue = blue;
- emit blueChanged(blue);
+ if (blueMasked != d->m_blueMasked) {
+ d->m_blueMasked = blueMasked;
+ emit blueMaskedChanged(blueMasked);
}
}
/*!
- \property Qt3DRender::QColorMask::alpha
- Holds whether the alpha component should be written to the frame buffer.
+ \property Qt3DRender::QColorMask::alphaMasked
+ Holds whether the alphaMasked component should be written to the frame buffer.
*/
-void QColorMask::setAlpha(bool alpha)
+void QColorMask::setAlphaMasked(bool alphaMasked)
{
Q_D(QColorMask);
- if (alpha != d->m_alpha) {
- d->m_alpha = alpha;
- emit alphaChanged(alpha);
+ if (alphaMasked != d->m_alphaMasked) {
+ d->m_alphaMasked = alphaMasked;
+ emit alphaMaskedChanged(alphaMasked);
}
}
-void QColorMask::copy(const QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QColorMask::createNodeCreationChange() const
{
- QRenderState::copy(ref);
- const QColorMask *refState = static_cast<const QColorMask *>(ref);
- d_func()->m_red = refState->d_func()->m_red;
- d_func()->m_green = refState->d_func()->m_green;
- d_func()->m_blue = refState->d_func()->m_blue;
- d_func()->m_alpha = refState->d_func()->m_alpha;
+ auto creationChange = QRenderStateCreatedChangePtr<QColorMaskData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QColorMask);
+ data.redMasked = d->m_redMasked;
+ data.greenMasked = d->m_greenMasked;
+ data.blueMasked = d->m_blueMasked;
+ data.alphaMasked = d->m_alphaMasked;
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qcolormask.h b/src/render/renderstates/qcolormask.h
index 5677c8308..d42f87df0 100644
--- a/src/render/renderstates/qcolormask.h
+++ b/src/render/renderstates/qcolormask.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,38 +51,35 @@ class QColorMaskPrivate;
class QT3DRENDERSHARED_EXPORT QColorMask : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(bool red READ isRed WRITE setRed NOTIFY redChanged)
- Q_PROPERTY(bool green READ isGreen WRITE setGreen NOTIFY greenChanged)
- Q_PROPERTY(bool blue READ isBlue WRITE setBlue NOTIFY blueChanged)
- Q_PROPERTY(bool alpha READ isAlpha WRITE setAlpha NOTIFY alphaChanged)
+ Q_PROPERTY(bool redMasked READ isRedMasked WRITE setRedMasked NOTIFY redMaskedChanged)
+ Q_PROPERTY(bool greenMasked READ isGreenMasked WRITE setGreenMasked NOTIFY greenMaskedChanged)
+ Q_PROPERTY(bool blueMasked READ isBlueMasked WRITE setBlueMasked NOTIFY blueMaskedChanged)
+ Q_PROPERTY(bool alphaMasked READ isAlphaMasked WRITE setAlphaMasked NOTIFY alphaMaskedChanged)
public:
- explicit QColorMask(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QColorMask(Qt3DCore::QNode *parent = nullptr);
~QColorMask();
- bool isRed() const;
- bool isGreen() const;
- bool isBlue() const;
- bool isAlpha() const;
+ bool isRedMasked() const;
+ bool isGreenMasked() const;
+ bool isBlueMasked() const;
+ bool isAlphaMasked() const;
public Q_SLOTS:
- void setRed(bool red);
- void setGreen(bool green);
- void setBlue(bool blue);
- void setAlpha(bool alpha);
+ void setRedMasked(bool redMasked);
+ void setGreenMasked(bool greenMasked);
+ void setBlueMasked(bool blueMasked);
+ void setAlphaMasked(bool alphaMasked);
Q_SIGNALS:
- void redChanged(bool red);
- void greenChanged(bool green);
- void blueChanged(bool blue);
- void alphaChanged(bool alpha);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
+ void redMaskedChanged(bool redMasked);
+ void greenMaskedChanged(bool greenMasked);
+ void blueMaskedChanged(bool blueMasked);
+ void alphaMaskedChanged(bool alphaMasked);
private:
Q_DECLARE_PRIVATE(QColorMask)
- QT3D_CLONEABLE(QColorMask)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qcolormask_p.h b/src/render/renderstates/qcolormask_p.h
new file mode 100644
index 000000000..4459ec526
--- /dev/null
+++ b/src/render/renderstates/qcolormask_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCOLORMASK_P_H
+#define QT3DRENDER_QCOLORMASK_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QColorMaskPrivate : public QRenderStatePrivate
+{
+public:
+ QColorMaskPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::ColorMask)
+ , m_redMasked(true)
+ , m_greenMasked(true)
+ , m_blueMasked(true)
+ , m_alphaMasked(true)
+ {}
+
+ bool m_redMasked;
+ bool m_greenMasked;
+ bool m_blueMasked;
+ bool m_alphaMasked;
+
+ Q_DECLARE_PUBLIC(QColorMask)
+};
+
+struct QColorMaskData
+{
+ bool redMasked;
+ bool greenMasked;
+ bool blueMasked;
+ bool alphaMasked;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCOLORMASK_P_H
diff --git a/src/render/renderstates/qcullface.cpp b/src/render/renderstates/qcullface.cpp
index c255ce94a..6406da91c 100644
--- a/src/render/renderstates/qcullface.cpp
+++ b/src/render/renderstates/qcullface.cpp
@@ -1,77 +1,59 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qcullface.h"
-#include <private/qnode_p.h>
-#include "qrenderstate_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qcullface_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QCullFacePrivate : public QRenderStatePrivate
-{
-public:
- QCullFacePrivate()
- : QRenderStatePrivate(QRenderState::CullFace)
- , m_mode(QCullFace::Back)
- {
- }
-
- Q_DECLARE_PUBLIC(QCullFace)
- QCullFace::CullingMode m_mode;
-};
-
QCullFace::QCullFace(QNode *parent)
: QRenderState(*new QCullFacePrivate, parent)
{
}
+/*! \internal */
QCullFace::~QCullFace()
{
- QNode::cleanup();
-}
-
-void QCullFace::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QCullFace *refState = static_cast<const QCullFace*>(ref);
- d_func()->m_mode = refState->d_func()->m_mode;
}
QCullFace::CullingMode QCullFace::mode() const
@@ -89,6 +71,15 @@ void QCullFace::setMode(QCullFace::CullingMode mode)
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QCullFace::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QCullFaceData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QCullFace);
+ data.mode = d->m_mode;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qcullface.h b/src/render/renderstates/qcullface.h
index 35b43eb2c..3474fe009 100644
--- a/src/render/renderstates/qcullface.h
+++ b/src/render/renderstates/qcullface.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -56,13 +59,14 @@ public:
enum CullingMode
{
+ NoCulling = 0x0,
Front = 0x0404,
Back = 0x0405,
FrontAndBack = 0x0408
};
Q_ENUM(CullingMode)
- explicit QCullFace(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QCullFace(Qt3DCore::QNode *parent = nullptr);
~QCullFace();
CullingMode mode() const;
@@ -73,12 +77,9 @@ public Q_SLOTS:
Q_SIGNALS:
void modeChanged(CullingMode mode);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QCullFace)
- QT3D_CLONEABLE(QCullFace)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qcullface_p.h b/src/render/renderstates/qcullface_p.h
new file mode 100644
index 000000000..7bb1b85e8
--- /dev/null
+++ b/src/render/renderstates/qcullface_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QCULLFACE_P_H
+#define QT3DRENDER_QCULLFACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qcullface.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QCullFacePrivate : public QRenderStatePrivate
+{
+public:
+ QCullFacePrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::CullFace)
+ , m_mode(QCullFace::Back)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QCullFace)
+ QCullFace::CullingMode m_mode;
+};
+
+struct QCullFaceData
+{
+ QCullFace::CullingMode mode;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QCULLFACE_P_H
diff --git a/src/render/renderstates/qdepthmask.cpp b/src/render/renderstates/qdepthmask.cpp
deleted file mode 100644
index fbf6e4750..000000000
--- a/src/render/renderstates/qdepthmask.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdepthmask.h"
-#include "qrenderstate_p.h"
-#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QDepthMaskPrivate : public QRenderStatePrivate
-{
-public:
- QDepthMaskPrivate()
- : QRenderStatePrivate(QRenderState::DepthMask)
- , m_mask(false)
- {
- }
-
- Q_DECLARE_PUBLIC(QDepthMask)
- bool m_mask;
-};
-
-QDepthMask::QDepthMask(QNode *parent)
- : QRenderState(*new QDepthMaskPrivate, parent)
-{
-}
-
-QDepthMask::~QDepthMask()
-{
- QNode::cleanup();
-}
-
-void QDepthMask::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QDepthMask *refState = static_cast<const QDepthMask*>(ref);
- d_func()->m_mask = refState->d_func()->m_mask;
-}
-
-bool QDepthMask::mask() const
-{
- Q_D(const QDepthMask);
- return d->m_mask;
-}
-
-void QDepthMask::setMask(bool mask)
-{
- Q_D(QDepthMask);
- if (d->m_mask != mask) {
- d->m_mask = mask;
- emit maskChanged(mask);
- }
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/renderstates/qdepthmask.h b/src/render/renderstates/qdepthmask.h
deleted file mode 100644
index 2c58317bf..000000000
--- a/src/render/renderstates/qdepthmask.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QDEPTHMASK_H
-#define QT3DRENDER_QDEPTHMASK_H
-
-#include <Qt3DRender/qrenderstate.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QDepthMaskPrivate;
-
-class QT3DRENDERSHARED_EXPORT QDepthMask : public QRenderState
-{
- Q_OBJECT
- Q_PROPERTY (bool mask READ mask WRITE setMask NOTIFY maskChanged)
-public:
- explicit QDepthMask(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QDepthMask();
-
- bool mask() const;
-
-public Q_SLOTS:
- void setMask(bool mask);
-
-Q_SIGNALS:
- void maskChanged(bool mask);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QDepthMask)
- QT3D_CLONEABLE(QDepthMask)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QDEPTHMASK_H
diff --git a/src/render/renderstates/qdepthtest.cpp b/src/render/renderstates/qdepthtest.cpp
index 74287d2eb..5a4454d17 100644
--- a/src/render/renderstates/qdepthtest.cpp
+++ b/src/render/renderstates/qdepthtest.cpp
@@ -1,96 +1,85 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qdepthtest.h"
-#include "qrenderstate_p.h"
-#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qdepthtest_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QDepthTest;
-
-class QDepthTestPrivate : public QRenderStatePrivate
-{
-public :
- QDepthTestPrivate()
- : QRenderStatePrivate(QRenderState::DepthTest)
- , m_func(QDepthTest::Never)
- {
- }
-
- Q_DECLARE_PUBLIC(QDepthTest)
- QDepthTest::DepthFunc m_func;
-};
-
-void QDepthTest::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QDepthTest *refState = static_cast<const QDepthTest*>(ref);
- d_func()->m_func = refState->d_func()->m_func;
-}
-
QDepthTest::QDepthTest(QNode *parent)
: QRenderState(*new QDepthTestPrivate, parent)
{
}
+/*! \internal */
QDepthTest::~QDepthTest()
{
- QNode::cleanup();
}
-QDepthTest::DepthFunc QDepthTest::func() const
+QDepthTest::DepthFunction QDepthTest::depthFunction() const
{
Q_D(const QDepthTest);
- return d->m_func;
+ return d->m_depthFunction;
}
-void QDepthTest::setFunc(QDepthTest::DepthFunc func)
+void QDepthTest::setDepthFunction(QDepthTest::DepthFunction depthFunction)
{
Q_D(QDepthTest);
- if (d->m_func != func) {
- d->m_func = func;
- emit funcChanged(func);
+ if (d->m_depthFunction != depthFunction) {
+ d->m_depthFunction = depthFunction;
+ emit depthFunctionChanged(depthFunction);
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QDepthTest::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QDepthTestData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QDepthTest);
+ data.depthFunction = d->m_depthFunction;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qdepthtest.h b/src/render/renderstates/qdepthtest.h
index 35f2c5810..16b4a5b85 100644
--- a/src/render/renderstates/qdepthtest.h
+++ b/src/render/renderstates/qdepthtest.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,10 +52,10 @@ class QDepthTestPrivate;
class QT3DRENDERSHARED_EXPORT QDepthTest : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(DepthFunc func READ func WRITE setFunc NOTIFY funcChanged)
+ Q_PROPERTY(DepthFunction depthFunction READ depthFunction WRITE setDepthFunction NOTIFY depthFunctionChanged)
public:
- enum DepthFunc {
+ enum DepthFunction {
Never = 0x0200,
Always = 0x0207,
Less = 0x0201,
@@ -62,25 +65,22 @@ public:
Greater = 0x0204,
NotEqual = 0x0205
};
- Q_ENUM(DepthFunc)
+ Q_ENUM(DepthFunction)
- explicit QDepthTest(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QDepthTest(Qt3DCore::QNode *parent = nullptr);
~QDepthTest();
- DepthFunc func() const;
+ DepthFunction depthFunction() const;
public Q_SLOTS:
- void setFunc(DepthFunc func);
+ void setDepthFunction(DepthFunction depthFunction);
Q_SIGNALS:
- void funcChanged(DepthFunc func);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void depthFunctionChanged(DepthFunction depthFunction);
private:
Q_DECLARE_PRIVATE(QDepthTest)
- QT3D_CLONEABLE(QDepthTest)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qdepthtest_p.h b/src/render/renderstates/qdepthtest_p.h
new file mode 100644
index 000000000..c12e6b351
--- /dev/null
+++ b/src/render/renderstates/qdepthtest_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QDEPTHTEST_P_H
+#define QT3DRENDER_QDEPTHTEST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qdepthtest.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QDepthTestPrivate : public QRenderStatePrivate
+{
+public :
+ QDepthTestPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::DepthTest)
+ , m_depthFunction(QDepthTest::Never)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QDepthTest)
+ QDepthTest::DepthFunction m_depthFunction;
+};
+
+struct QDepthTestData
+{
+ QDepthTest::DepthFunction depthFunction;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QDEPTHTEST_P_H
diff --git a/src/render/renderstates/qdithering.cpp b/src/render/renderstates/qdithering.cpp
index fd8ce1c2f..4b1176330 100644
--- a/src/render/renderstates/qdithering.cpp
+++ b/src/render/renderstates/qdithering.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,7 +41,7 @@
#include "qdithering.h"
#include "qrenderstate_p.h"
#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -48,7 +51,7 @@ class QDitheringPrivate : public QRenderStatePrivate
{
public:
QDitheringPrivate()
- : QRenderStatePrivate(QRenderState::Dithering)
+ : QRenderStatePrivate(QRenderStatePrivate::Dithering)
{}
Q_DECLARE_PUBLIC(QDithering)
@@ -59,9 +62,9 @@ QDithering::QDithering(QNode *parent)
{
}
+/*! \internal */
QDithering::~QDithering()
{
- QNode::cleanup();
}
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qdithering.h b/src/render/renderstates/qdithering.h
index 7b863f8da..db6667f8a 100644
--- a/src/render/renderstates/qdithering.h
+++ b/src/render/renderstates/qdithering.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,12 +53,11 @@ class QT3DRENDERSHARED_EXPORT QDithering : public QRenderState
{
Q_OBJECT
public:
- explicit QDithering(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QDithering(Qt3DCore::QNode *parent = nullptr);
~QDithering();
private:
Q_DECLARE_PRIVATE(QDithering)
- QT3D_CLONEABLE(QDithering)
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qfrontface.cpp b/src/render/renderstates/qfrontface.cpp
index fc11fa167..49942ff0d 100644
--- a/src/render/renderstates/qfrontface.cpp
+++ b/src/render/renderstates/qfrontface.cpp
@@ -1,86 +1,68 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qfrontface.h"
-#include "qrenderstate_p.h"
-#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include "qfrontface_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QFrontFacePrivate : public QRenderStatePrivate
-{
-public:
- QFrontFacePrivate()
- : QRenderStatePrivate(QRenderState::FrontFace)
- , m_direction(QFrontFace::ClockWise)
- {
- }
-
- Q_DECLARE_PUBLIC(QFrontFace)
- QFrontFace::FaceDir m_direction;
-};
-
QFrontFace::QFrontFace(QNode *parent)
: QRenderState(*new QFrontFacePrivate, parent)
{
}
+/*! \internal */
QFrontFace::~QFrontFace()
{
- QNode::cleanup();
}
-void QFrontFace::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QFrontFace *refState = static_cast<const QFrontFace*>(ref);
- d_func()->m_direction = refState->d_func()->m_direction;
-}
-
-QFrontFace::FaceDir QFrontFace::direction() const
+QFrontFace::WindingDirection QFrontFace::direction() const
{
Q_D(const QFrontFace);
return d->m_direction;
}
-void QFrontFace::setDirection(QFrontFace::FaceDir direction)
+void QFrontFace::setDirection(QFrontFace::WindingDirection direction)
{
Q_D(QFrontFace);
if (d->m_direction != direction) {
@@ -89,6 +71,15 @@ void QFrontFace::setDirection(QFrontFace::FaceDir direction)
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QFrontFace::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QFrontFaceData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QFrontFace);
+ data.direction = d->m_direction;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qfrontface.h b/src/render/renderstates/qfrontface.h
index b075c5557..dd8a7f5fe 100644
--- a/src/render/renderstates/qfrontface.h
+++ b/src/render/renderstates/qfrontface.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,33 +52,30 @@ class QFrontFacePrivate;
class QT3DRENDERSHARED_EXPORT QFrontFace : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(FaceDir direction READ direction WRITE setDirection NOTIFY directionChanged)
+ Q_PROPERTY(WindingDirection direction READ direction WRITE setDirection NOTIFY directionChanged)
public:
- enum FaceDir
+ enum WindingDirection
{
ClockWise = 0x0900,
CounterClockWise = 0x0901
};
- Q_ENUM(FaceDir)
+ Q_ENUM(WindingDirection)
- explicit QFrontFace(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QFrontFace(Qt3DCore::QNode *parent = nullptr);
~QFrontFace();
- FaceDir direction() const;
+ WindingDirection direction() const;
public Q_SLOTS:
- void setDirection(FaceDir direction);
+ void setDirection(WindingDirection direction);
Q_SIGNALS:
- void directionChanged(FaceDir direction);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void directionChanged(WindingDirection direction);
private:
Q_DECLARE_PRIVATE(QFrontFace)
- QT3D_CLONEABLE(QFrontFace)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qfrontface_p.h b/src/render/renderstates/qfrontface_p.h
new file mode 100644
index 000000000..cecfa8b7d
--- /dev/null
+++ b/src/render/renderstates/qfrontface_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QFRONTFACE_P_H
+#define QT3DRENDER_QFRONTFACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qfrontface.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QFrontFacePrivate : public QRenderStatePrivate
+{
+public:
+ QFrontFacePrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::FrontFace)
+ , m_direction(QFrontFace::ClockWise)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QFrontFace)
+ QFrontFace::WindingDirection m_direction;
+};
+
+struct QFrontFaceData
+{
+ QFrontFace::WindingDirection direction;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QFRONTFACE_P_H
diff --git a/src/render/renderstates/qmultisampleantialiasing.cpp b/src/render/renderstates/qmultisampleantialiasing.cpp
new file mode 100644
index 000000000..6697bdbf5
--- /dev/null
+++ b/src/render/renderstates/qmultisampleantialiasing.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmultisampleantialiasing.h"
+#include "qrenderstate_p.h"
+#include <private/qnode_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QMultiSampleAntiAliasingPrivate : public QRenderStatePrivate
+{
+public:
+ QMultiSampleAntiAliasingPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::MSAAEnabled)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QMultiSampleAntiAliasing)
+};
+
+QMultiSampleAntiAliasing::QMultiSampleAntiAliasing(QNode *parent)
+ : QRenderState(*new QMultiSampleAntiAliasingPrivate, parent)
+{
+}
+
+/*! \internal */
+QMultiSampleAntiAliasing::~QMultiSampleAntiAliasing()
+{
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
diff --git a/src/render/renderstates/qmultisampleantialiasing.h b/src/render/renderstates/qmultisampleantialiasing.h
new file mode 100644
index 000000000..087f32ce2
--- /dev/null
+++ b/src/render/renderstates/qmultisampleantialiasing.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QMULTISAMPLEANTIALIASING_H
+#define QT3DRENDER_QMULTISAMPLEANTIALIASING_H
+
+#include <Qt3DRender/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QMultiSampleAntiAliasingPrivate;
+
+class QT3DRENDERSHARED_EXPORT QMultiSampleAntiAliasing : public QRenderState
+{
+ Q_OBJECT
+
+public:
+ explicit QMultiSampleAntiAliasing(Qt3DCore::QNode *parent = nullptr);
+ ~QMultiSampleAntiAliasing();
+
+private:
+ Q_DECLARE_PRIVATE(QMultiSampleAntiAliasing)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QMULTISAMPLEANTIALIASING_H
diff --git a/src/render/renderstates/qnodepthmask.cpp b/src/render/renderstates/qnodepthmask.cpp
new file mode 100644
index 000000000..4e0975310
--- /dev/null
+++ b/src/render/renderstates/qnodepthmask.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnodepthmask.h"
+#include "qrenderstate_p.h"
+#include <private/qnode_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QNoDepthMaskPrivate : public QRenderStatePrivate
+{
+public:
+ QNoDepthMaskPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::NoDepthMask)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QNoDepthMask)
+};
+
+QNoDepthMask::QNoDepthMask(QNode *parent)
+ : QRenderState(*new QNoDepthMaskPrivate, parent)
+{
+}
+
+/*! \internal */
+QNoDepthMask::~QNoDepthMask()
+{
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/renderstates/qnodepthmask.h b/src/render/renderstates/qnodepthmask.h
new file mode 100644
index 000000000..20171595e
--- /dev/null
+++ b/src/render/renderstates/qnodepthmask.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QNODEPTHMASK_H
+#define QT3DRENDER_QNODEPTHMASK_H
+
+#include <Qt3DRender/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QNoDepthMaskPrivate;
+
+class QT3DRENDERSHARED_EXPORT QNoDepthMask : public QRenderState
+{
+ Q_OBJECT
+public:
+ explicit QNoDepthMask(Qt3DCore::QNode *parent = nullptr);
+ ~QNoDepthMask();
+
+private:
+ Q_DECLARE_PRIVATE(QNoDepthMask)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QNODEPTHMASK_H
diff --git a/src/render/renderstates/qpointsize.cpp b/src/render/renderstates/qpointsize.cpp
index c9a3c1607..8aa2d7e0c 100644
--- a/src/render/renderstates/qpointsize.cpp
+++ b/src/render/renderstates/qpointsize.cpp
@@ -1,60 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "qpointsize.h"
-#include "qrenderstate_p.h"
+#include "qpointsize_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QPointSizePrivate : public QRenderStatePrivate
-{
-public:
- QPointSizePrivate(QPointSize::Specification spec, float value)
- : QRenderStatePrivate(QRenderState::PointSize)
- , m_specification(spec)
- , m_value(value)
- {}
-
- QPointSize::Specification m_specification;
- float m_value;
-
- Q_DECLARE_PUBLIC(QPointSize)
-};
-
/*!
\class Qt3DRender::QPointSize
\inmodule Qt3DRender
@@ -67,19 +57,19 @@ public:
*/
QPointSize::QPointSize(Qt3DCore::QNode *parent)
- : QRenderState(*new QPointSizePrivate(Programmable, 0.f), parent)
+ : QRenderState(*new QPointSizePrivate(SizeMode::Programmable, 0.f), parent)
{
}
+/*! \internal */
QPointSize::~QPointSize()
{
- QNode::cleanup();
}
-QPointSize::Specification QPointSize::specification() const
+QPointSize::SizeMode QPointSize::sizeMode() const
{
Q_D(const QPointSize);
- return d->m_specification;
+ return d->m_sizeMode;
}
float QPointSize::value() const
@@ -88,16 +78,11 @@ float QPointSize::value() const
return d->m_value;
}
-bool QPointSize::isProgrammable() const
-{
- return (specification() == QPointSize::Programmable);
-}
-
-void QPointSize::setSpecification(Specification spec)
+void QPointSize::setSizeMode(SizeMode sizeMode)
{
Q_D(QPointSize);
- d->m_specification = spec;
- emit specificationChanged(spec);
+ d->m_sizeMode = sizeMode;
+ emit sizeModeChanged(sizeMode);
}
void QPointSize::setValue(float size)
@@ -107,15 +92,14 @@ void QPointSize::setValue(float size)
emit valueChanged(size);
}
-void QPointSize::copy(const Qt3DCore::QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QPointSize::createNodeCreationChange() const
{
- const QPointSize *refState = static_cast<const QPointSize *>(ref);
-
- QRenderState::copy(ref);
-
- Q_D(QPointSize);
- d->m_value = refState->d_func()->m_value;
- d->m_specification = refState->d_func()->m_specification;
+ auto creationChange = QRenderStateCreatedChangePtr<QPointSizeData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QPointSize);
+ data.sizeMode = d->m_sizeMode;
+ data.value = d->m_value;
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qpointsize.h b/src/render/renderstates/qpointsize.h
index ffc8f2010..fdfa54a9c 100644
--- a/src/render/renderstates/qpointsize.h
+++ b/src/render/renderstates/qpointsize.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -47,37 +50,33 @@ class QPointSizePrivate;
class QT3DRENDERSHARED_EXPORT QPointSize : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(Specification specification READ specification WRITE setSpecification NOTIFY specificationChanged)
+ Q_PROPERTY(SizeMode sizeMode READ sizeMode WRITE setSizeMode NOTIFY sizeModeChanged)
Q_PROPERTY(float value READ value WRITE setValue NOTIFY valueChanged)
public:
- enum Specification {
- StaticValue = 0,
+ enum SizeMode {
+ Fixed = 0,
Programmable = 1
};
- Q_ENUM(Specification)
+ Q_ENUM(SizeMode)
- explicit QPointSize(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QPointSize(Qt3DCore::QNode *parent = nullptr);
~QPointSize();
- Specification specification() const;
+ SizeMode sizeMode() const;
float value() const;
- bool isProgrammable() const;
public Q_SLOTS:
- void setSpecification(Specification spec);
+ void setSizeMode(SizeMode sizeMode);
void setValue(float value);
Q_SIGNALS:
- void specificationChanged(Specification spec);
+ void sizeModeChanged(SizeMode sizeMode);
void valueChanged(float value);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
-
private:
Q_DECLARE_PRIVATE(QPointSize)
- QT3D_CLONEABLE(QPointSize)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qpointsize_p.h b/src/render/renderstates/qpointsize_p.h
new file mode 100644
index 000000000..d5a69b8a3
--- /dev/null
+++ b/src/render/renderstates/qpointsize_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QPOINTSIZE_P_H
+#define QT3DRENDER_QPOINTSIZE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qpointsize.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QPointSizePrivate : public QRenderStatePrivate
+{
+public:
+ QPointSizePrivate(QPointSize::SizeMode sizeMode, float value)
+ : QRenderStatePrivate(QRenderStatePrivate::PointSize)
+ , m_sizeMode(sizeMode)
+ , m_value(value)
+ {}
+
+ QPointSize::SizeMode m_sizeMode;
+ float m_value;
+
+ Q_DECLARE_PUBLIC(QPointSize)
+};
+
+struct QPointSizeData
+{
+ QPointSize::SizeMode sizeMode;
+ float value;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QPOINTSIZE_P_H
diff --git a/src/render/renderstates/qpolygonoffset.cpp b/src/render/renderstates/qpolygonoffset.cpp
index 27c9cde4f..b71e803fd 100644
--- a/src/render/renderstates/qpolygonoffset.cpp
+++ b/src/render/renderstates/qpolygonoffset.cpp
@@ -1,108 +1,98 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qpolygonoffset.h"
-#include <private/qrenderstate_p.h>
+#include "qpolygonoffset_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QPolygonOffsetPrivate : public QRenderStatePrivate
-{
-public:
- QPolygonOffsetPrivate()
- : QRenderStatePrivate(QRenderState::PolygonOffset)
- , m_factor(0)
- , m_units(0)
- {
- }
-
- float m_factor;
- float m_units;
-
- Q_DECLARE_PUBLIC(QPolygonOffset)
-};
-
QPolygonOffset::QPolygonOffset(QNode *parent)
: QRenderState(*new QPolygonOffsetPrivate, parent)
{
}
+/*! \internal */
QPolygonOffset::~QPolygonOffset()
{
- QNode::cleanup();
}
-float QPolygonOffset::factor() const
+float QPolygonOffset::scaleFactor() const
{
Q_D(const QPolygonOffset);
- return d->m_factor;
+ return d->m_scaleFactor;
}
-void QPolygonOffset::setFactor(float factor)
+void QPolygonOffset::setScaleFactor(float scaleFactor)
{
Q_D(QPolygonOffset);
- if (d->m_factor != factor) {
- d->m_factor = factor;
- emit factorChanged(d->m_factor);
+ if (d->m_scaleFactor != scaleFactor) {
+ d->m_scaleFactor = scaleFactor;
+ emit scaleFactorChanged(d->m_scaleFactor);
}
}
-float QPolygonOffset::units() const
+float QPolygonOffset::depthSteps() const
{
Q_D(const QPolygonOffset);
- return d->m_units;
+ return d->m_depthSteps;
}
-void QPolygonOffset::setUnits(float units)
+void QPolygonOffset::setDepthSteps(float depthSteps)
{
Q_D(QPolygonOffset);
- if (d->m_units != units) {
- d->m_units = units;
- emit unitsChanged(d->m_units);
+ if (d->m_depthSteps != depthSteps) {
+ d->m_depthSteps = depthSteps;
+ emit depthStepsChanged(d->m_depthSteps);
}
}
-void QPolygonOffset::copy(const QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QPolygonOffset::createNodeCreationChange() const
{
- QRenderState::copy(ref);
- const QPolygonOffset *refState = static_cast<const QPolygonOffset *>(ref);
- d_func()->m_factor = refState->d_func()->m_factor;
- d_func()->m_units = refState->d_func()->m_units;
+ auto creationChange = QRenderStateCreatedChangePtr<QPolygonOffsetData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QPolygonOffset);
+ data.scaleFactor = d->m_scaleFactor;
+ data.depthSteps = d->m_depthSteps;
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qpolygonoffset.h b/src/render/renderstates/qpolygonoffset.h
index 7065d2cfb..3be117fb3 100644
--- a/src/render/renderstates/qpolygonoffset.h
+++ b/src/render/renderstates/qpolygonoffset.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,29 +52,26 @@ class QT3DRENDERSHARED_EXPORT QPolygonOffset : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(float factor READ factor WRITE setFactor NOTIFY factorChanged)
- Q_PROPERTY(float units READ units WRITE setUnits NOTIFY unitsChanged)
+ Q_PROPERTY(float scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged)
+ Q_PROPERTY(float depthSteps READ depthSteps WRITE setDepthSteps NOTIFY depthStepsChanged)
public:
- explicit QPolygonOffset(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QPolygonOffset(Qt3DCore::QNode *parent = nullptr);
~QPolygonOffset();
- float factor() const;
- float units() const;
+ float scaleFactor() const;
+ float depthSteps() const;
public Q_SLOTS:
- void setFactor(float factor);
- void setUnits(float units);
+ void setScaleFactor(float scaleFactor);
+ void setDepthSteps(float depthSteps);
Q_SIGNALS:
- void factorChanged(float factor);
- void unitsChanged(float units);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void scaleFactorChanged(float scaleFactor);
+ void depthStepsChanged(float depthSteps);
private:
Q_DECLARE_PRIVATE(QPolygonOffset)
- QT3D_CLONEABLE(QPolygonOffset)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qpolygonoffset_p.h b/src/render/renderstates/qpolygonoffset_p.h
new file mode 100644
index 000000000..5f49121f3
--- /dev/null
+++ b/src/render/renderstates/qpolygonoffset_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QPOLYGONOFFSET_P_H
+#define QT3DRENDER_QPOLYGONOFFSET_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qpolygonoffset.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QPolygonOffsetPrivate : public QRenderStatePrivate
+{
+public:
+ QPolygonOffsetPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::PolygonOffset)
+ , m_scaleFactor(0)
+ , m_depthSteps(0)
+ {
+ }
+
+ float m_scaleFactor;
+ float m_depthSteps;
+
+ Q_DECLARE_PUBLIC(QPolygonOffset)
+};
+
+struct QPolygonOffsetData
+{
+ float scaleFactor;
+ float depthSteps;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QPOLYGONOFFSET_P_H
diff --git a/src/render/renderstates/qrenderstate.cpp b/src/render/renderstates/qrenderstate.cpp
index d65480f04..0367b6fc2 100644
--- a/src/render/renderstates/qrenderstate.cpp
+++ b/src/render/renderstates/qrenderstate.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,26 +40,35 @@
#include "qrenderstate.h"
#include "qrenderstate_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-QRenderStatePrivate::QRenderStatePrivate(QRenderState::Type type)
+QRenderStatePrivate::QRenderStatePrivate(Type type)
: QNodePrivate(),
m_type(type)
{
}
-QRenderState::~QRenderState()
+QRenderStatePrivate::~QRenderStatePrivate()
+{
+}
+
+QRenderStatePrivate *QRenderStatePrivate::get(QRenderState *state)
+{
+ return state->d_func();
+}
+
+const QRenderStatePrivate *QRenderStatePrivate::get(const QRenderState *state)
{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QRenderState subclass didn't call QNode::cleanup in its destructor");
+ return state->d_func();
}
-QRenderState::Type QRenderState::type() const
+/*! \internal */
+QRenderState::~QRenderState()
{
- Q_D(const QRenderState);
- return d->m_type;
}
/*! \internal */
@@ -65,6 +77,12 @@ QRenderState::QRenderState(QRenderStatePrivate &dd, QNode *parent)
{
}
+Qt3DCore::QNodeCreatedChangeBasePtr QRenderState::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangeBasePtr::create(this);
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qrenderstate.h b/src/render/renderstates/qrenderstate.h
index c40a11318..0ecc805e3 100644
--- a/src/render/renderstates/qrenderstate.h
+++ b/src/render/renderstates/qrenderstate.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,39 +53,15 @@ class QRenderStatePrivate;
class QT3DRENDERSHARED_EXPORT QRenderState : public Qt3DCore::QNode
{
Q_OBJECT
-
public:
- enum Type {
- AlphaCoverage,
- AlphaTest,
- BlendEquation,
- BlendState,
- BlendStateSeparate,
- ColorMask,
- CullFace,
- DepthMask,
- DepthTest,
- Dithering,
- FrontFace,
- PointSize,
- PolygonOffset,
- ScissorTest,
- StencilTest,
- StencilMask,
- StencilOp,
- ClipPlane
- };
- Q_ENUM(Type)
-
~QRenderState();
- Type type() const;
-
protected:
- QRenderState(QRenderStatePrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QRenderState(QRenderStatePrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QRenderState)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qrenderstate_p.h b/src/render/renderstates/qrenderstate_p.h
index 45418bb07..1ec672cac 100644
--- a/src/render/renderstates/qrenderstate_p.h
+++ b/src/render/renderstates/qrenderstate_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -60,10 +63,39 @@ namespace Qt3DRender {
class QT3DRENDERSHARED_PRIVATE_EXPORT QRenderStatePrivate : public Qt3DCore::QNodePrivate
{
public:
- QRenderStatePrivate(QRenderState::Type type);
+ enum Type {
+ AlphaCoverage,
+ AlphaTest,
+ BlendEquation,
+ BlendEquationArguments,
+ ColorMask,
+ CullFace,
+ MSAAEnabled,
+ NoDepthMask,
+ DepthTest,
+ Dithering,
+ FrontFace,
+ PointSize,
+ PolygonOffset,
+ ScissorTest,
+ StencilTest,
+ StencilMask,
+ StencilOp,
+ ClipPlane,
+ SeamlessCubemap
+ };
+
+ QRenderStatePrivate(Type type);
+ ~QRenderStatePrivate();
+
+
Q_DECLARE_PUBLIC(QRenderState)
- const QRenderState::Type m_type;
+
+ const Type m_type;
+
+ static QRenderStatePrivate *get(QRenderState *state);
+ static const QRenderStatePrivate *get(const QRenderState *state);
};
}
diff --git a/src/render/renderstates/qrenderstatecreatedchange.cpp b/src/render/renderstates/qrenderstatecreatedchange.cpp
new file mode 100644
index 000000000..414c6bc86
--- /dev/null
+++ b/src/render/renderstates/qrenderstatecreatedchange.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qrenderstatecreatedchange_p.h"
+#include <Qt3DCore/private/qnodecreatedchange_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderStateCreatedChangeBasePrivate : public Qt3DCore::QNodeCreatedChangeBasePrivate
+{
+public:
+ QRenderStateCreatedChangeBasePrivate(const QRenderState *renderState)
+ : Qt3DCore::QNodeCreatedChangeBasePrivate(renderState)
+ , m_type(QRenderStatePrivate::get(renderState)->m_type)
+ {
+ }
+
+ QRenderStatePrivate::Type m_type;
+};
+
+QRenderStateCreatedChangeBase::QRenderStateCreatedChangeBase(const QRenderState *renderState)
+ : QNodeCreatedChangeBase(*new QRenderStateCreatedChangeBasePrivate(renderState), renderState)
+{
+}
+
+QRenderStatePrivate::Type QRenderStateCreatedChangeBase::renderStateType() const
+{
+ Q_D(const QRenderStateCreatedChangeBase);
+ return d->m_type;
+}
+
+QT_END_NAMESPACE
+
+} // namespace Qt3DRender
diff --git a/src/render/renderstates/qrenderstatecreatedchange_p.h b/src/render/renderstates/qrenderstatecreatedchange_p.h
new file mode 100644
index 000000000..51675c5d2
--- /dev/null
+++ b/src/render/renderstates/qrenderstatecreatedchange_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QRENDERSTATECREATIONCHANGEBASE_H
+#define QT3DRENDER_QRENDERSTATECREATIONCHANGEBASE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DCore/qnodecreatedchange.h>
+#include <Qt3DRender/private/qrenderstate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderState;
+class QRenderStateCreatedChangeBasePrivate;
+
+class QRenderStateCreatedChangeBase : public Qt3DCore::QNodeCreatedChangeBase
+{
+public:
+ explicit QRenderStateCreatedChangeBase(const QRenderState *renderState);
+
+ QRenderStatePrivate::Type renderStateType() const;
+
+private:
+ Q_DECLARE_PRIVATE(QRenderStateCreatedChangeBase)
+};
+
+typedef QSharedPointer<QRenderStateCreatedChangeBase> QRenderStateCreatedChangeBasePtr;
+
+template<typename T>
+class QRenderStateCreatedChange : public QRenderStateCreatedChangeBase
+{
+public:
+ explicit QRenderStateCreatedChange(const QRenderState *_renderState)
+ : QRenderStateCreatedChangeBase(_renderState)
+ , data()
+ {
+ }
+
+ T data;
+};
+
+template<typename T>
+using QRenderStateCreatedChangePtr = QSharedPointer<QRenderStateCreatedChange<T>>;
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QRENDERSTATECREATIONCHANGEBASE_H
diff --git a/src/render/renderstates/qscissortest.cpp b/src/render/renderstates/qscissortest.cpp
index d74896501..0897a52c4 100644
--- a/src/render/renderstates/qscissortest.cpp
+++ b/src/render/renderstates/qscissortest.cpp
@@ -1,87 +1,59 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qscissortest.h"
-#include "qrenderstate_p.h"
-#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-
+#include "qscissortest_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QScissorTestPrivate : public QRenderStatePrivate
-{
-public:
- QScissorTestPrivate()
- : QRenderStatePrivate(QRenderState::ScissorTest)
- , m_left(0)
- , m_bottom(0)
- , m_width(0)
- , m_height(0)
- {
- }
-
- Q_DECLARE_PUBLIC(QScissorTest)
- int m_left;
- int m_bottom;
- int m_width;
- int m_height;
-};
-
QScissorTest::QScissorTest(QNode *parent)
: QRenderState(*new QScissorTestPrivate, parent)
{
}
+/*! \internal */
QScissorTest::~QScissorTest()
{
- QNode::cleanup();
-}
-
-void QScissorTest::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QScissorTest *refState = static_cast<const QScissorTest*>(ref);
- d_func()->m_left = refState->d_func()->m_left;
- d_func()->m_bottom = refState->d_func()->m_bottom;
- d_func()->m_width = refState->d_func()->m_width;
- d_func()->m_height = refState->d_func()->m_height;
}
int QScissorTest::left() const
@@ -144,6 +116,18 @@ void QScissorTest::setHeight(int height)
}
}
+Qt3DCore::QNodeCreatedChangeBasePtr QScissorTest::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QScissorTestData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QScissorTest);
+ data.left = d->m_left;
+ data.bottom = d->m_bottom;
+ data.width = d->m_width;
+ data.height = d->m_height;
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qscissortest.h b/src/render/renderstates/qscissortest.h
index 0178ff7c2..65327bd39 100644
--- a/src/render/renderstates/qscissortest.h
+++ b/src/render/renderstates/qscissortest.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,7 +58,7 @@ class QT3DRENDERSHARED_EXPORT QScissorTest : public QRenderState
Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
public:
- explicit QScissorTest(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QScissorTest(Qt3DCore::QNode *parent = nullptr);
~QScissorTest();
int left() const;
@@ -75,12 +78,9 @@ Q_SIGNALS:
void widthChanged(int width);
void heightChanged(int height);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QScissorTest)
- QT3D_CLONEABLE(QScissorTest)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qscissortest_p.h b/src/render/renderstates/qscissortest_p.h
new file mode 100644
index 000000000..101ca7b25
--- /dev/null
+++ b/src/render/renderstates/qscissortest_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSCISSORTEST_P_H
+#define QT3DRENDER_QSCISSORTEST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qscissortest.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QScissorTestPrivate : public QRenderStatePrivate
+{
+public:
+ QScissorTestPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::ScissorTest)
+ , m_left(0)
+ , m_bottom(0)
+ , m_width(0)
+ , m_height(0)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QScissorTest)
+ int m_left;
+ int m_bottom;
+ int m_width;
+ int m_height;
+};
+
+struct QScissorTestData
+{
+ int left;
+ int bottom;
+ int width;
+ int height;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSCISSORTEST_P_H
diff --git a/src/render/renderstates/qseamlesscubemap.cpp b/src/render/renderstates/qseamlesscubemap.cpp
new file mode 100644
index 000000000..a017228b0
--- /dev/null
+++ b/src/render/renderstates/qseamlesscubemap.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qseamlesscubemap.h"
+#include "qrenderstate_p.h"
+#include <private/qnode_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSeamlessCubemapPrivate : public QRenderStatePrivate
+{
+public:
+ QSeamlessCubemapPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::SeamlessCubemap)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QSeamlessCubemap)
+};
+
+QSeamlessCubemap::QSeamlessCubemap(QNode *parent)
+ : QRenderState(*new QSeamlessCubemapPrivate, parent)
+{
+}
+
+/*! \internal */
+QSeamlessCubemap::~QSeamlessCubemap()
+{
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
diff --git a/src/render/renderstates/qseamlesscubemap.h b/src/render/renderstates/qseamlesscubemap.h
new file mode 100644
index 000000000..40ae0a955
--- /dev/null
+++ b/src/render/renderstates/qseamlesscubemap.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSEAMLESSCUBEMAP_H
+#define QT3DRENDER_QSEAMLESSCUBEMAP_H
+
+#include <Qt3DRender/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QSeamlessCubemapPrivate;
+
+class QT3DRENDERSHARED_EXPORT QSeamlessCubemap : public QRenderState
+{
+ Q_OBJECT
+
+public:
+ explicit QSeamlessCubemap(Qt3DCore::QNode *parent = nullptr);
+ ~QSeamlessCubemap();
+
+private:
+ Q_DECLARE_PRIVATE(QSeamlessCubemap)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSEAMLESSCUBEMAP_H
diff --git a/src/render/renderstates/qstencilmask.cpp b/src/render/renderstates/qstencilmask.cpp
index 066bec2c3..445d25d1c 100644
--- a/src/render/renderstates/qstencilmask.cpp
+++ b/src/render/renderstates/qstencilmask.cpp
@@ -1,59 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qstencilmask.h"
-#include <Qt3DRender/private/qrenderstate_p.h>
+#include "qstencilmask_p.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QStencilMaskPrivate : public QRenderStatePrivate
-{
-public:
- QStencilMaskPrivate()
- : QRenderStatePrivate(QRenderState::StencilMask)
- , m_frontMask(0)
- , m_backMask(0)
- {}
-
- uint m_frontMask;
- uint m_backMask;
-};
-
/*!
* QStencilMask::QStencilMask
*/
@@ -63,47 +54,49 @@ QStencilMask::QStencilMask(QNode *parent)
{
}
+/*! \internal */
QStencilMask::~QStencilMask()
{
- QNode::cleanup();
}
-void QStencilMask::setFrontMask(uint mask)
+void QStencilMask::setFrontOutputMask(uint mask)
{
Q_D(QStencilMask);
- if (d->m_frontMask != mask) {
- d->m_frontMask = mask;
- Q_EMIT frontMaskChanged(mask);
+ if (d->m_frontOutputMask != mask) {
+ d->m_frontOutputMask = mask;
+ Q_EMIT frontOutputMaskChanged(mask);
}
}
-void QStencilMask::setBackMask(uint mask)
+void QStencilMask::setBackOutputMask(uint mask)
{
Q_D(QStencilMask);
- if (d->m_backMask != mask) {
- d->m_backMask = mask;
- Q_EMIT backMaskChanged(mask);
+ if (d->m_backOutputMask != mask) {
+ d->m_backOutputMask = mask;
+ Q_EMIT backOutputMaskChanged(mask);
}
}
-uint QStencilMask::frontMask() const
+uint QStencilMask::frontOutputMask() const
{
Q_D(const QStencilMask);
- return d->m_frontMask;
+ return d->m_frontOutputMask;
}
-uint QStencilMask::backMask() const
+uint QStencilMask::backOutputMask() const
{
Q_D(const QStencilMask);
- return d->m_backMask;
+ return d->m_backOutputMask;
}
-void QStencilMask::copy(const QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QStencilMask::createNodeCreationChange() const
{
- QRenderState::copy(ref);
- const QStencilMask *otherRef = static_cast<const QStencilMask *>(ref);
- d_func()->m_frontMask = otherRef->frontMask();
- d_func()->m_backMask = otherRef->backMask();
+ auto creationChange = QRenderStateCreatedChangePtr<QStencilMaskData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QStencilMask);
+ data.frontOutputMask = d->m_frontOutputMask;
+ data.backOutputMask = d->m_backOutputMask;
+ return creationChange;
}
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qstencilmask.h b/src/render/renderstates/qstencilmask.h
index c99d12973..e0487c4f3 100644
--- a/src/render/renderstates/qstencilmask.h
+++ b/src/render/renderstates/qstencilmask.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,29 +51,26 @@ class QStencilMaskPrivate;
class QT3DRENDERSHARED_EXPORT QStencilMask : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(uint frontMask READ frontMask WRITE setFrontMask NOTIFY frontMaskChanged)
- Q_PROPERTY(uint backMask READ backMask WRITE setBackMask NOTIFY backMaskChanged)
+ Q_PROPERTY(uint frontOutputMask READ frontOutputMask WRITE setFrontOutputMask NOTIFY frontOutputMaskChanged)
+ Q_PROPERTY(uint backOutputMask READ backOutputMask WRITE setBackOutputMask NOTIFY backOutputMaskChanged)
public:
- explicit QStencilMask(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QStencilMask(Qt3DCore::QNode *parent = nullptr);
~QStencilMask();
- uint frontMask() const;
- uint backMask() const;
+ uint frontOutputMask() const;
+ uint backOutputMask() const;
public Q_SLOTS:
- void setFrontMask(uint mask);
- void setBackMask(uint mask);
+ void setFrontOutputMask(uint frontOutputMask);
+ void setBackOutputMask(uint backOutputMask);
Q_SIGNALS:
- void frontMaskChanged(uint frontMask);
- void backMaskChanged(uint backMask);
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
+ void frontOutputMaskChanged(uint frontOutputMask);
+ void backOutputMaskChanged(uint backOutputMask);
private:
Q_DECLARE_PRIVATE(QStencilMask)
- QT3D_CLONEABLE(QStencilMask)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qstencilmask_p.h b/src/render/renderstates/qstencilmask_p.h
new file mode 100644
index 000000000..84d79385c
--- /dev/null
+++ b/src/render/renderstates/qstencilmask_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTENCILMASK_P_H
+#define QT3DRENDER_QSTENCILMASK_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qstencilmask.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilMaskPrivate : public QRenderStatePrivate
+{
+public:
+ QStencilMaskPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::StencilMask)
+ , m_frontOutputMask(0)
+ , m_backOutputMask(0)
+ {}
+
+ uint m_frontOutputMask;
+ uint m_backOutputMask;
+};
+
+struct QStencilMaskData
+{
+ uint frontOutputMask;
+ uint backOutputMask;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILMASK_P_H
diff --git a/src/render/renderstates/qstencilop.cpp b/src/render/renderstates/qstencilop.cpp
deleted file mode 100644
index 7dbbdc1ea..000000000
--- a/src/render/renderstates/qstencilop.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qstencilop.h"
-#include "qstencilopseparate.h"
-#include <Qt3DRender/private/qrenderstate_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QStencilOpPrivate : public QRenderStatePrivate
-{
-public:
- QStencilOpPrivate()
- : QRenderStatePrivate(QRenderState::StencilOp)
- , m_front(new QStencilOpSeparate(QStencilOpSeparate::Front, q_ptr))
- , m_back(new QStencilOpSeparate(QStencilOpSeparate::Back, q_ptr))
- {}
-
- QStencilOpSeparate *m_front;
- QStencilOpSeparate *m_back;
-};
-
-
-QStencilOp::QStencilOp(QNode *parent)
- : QRenderState(*new QStencilOpPrivate(), parent)
-{
-}
-
-QStencilOp::~QStencilOp()
-{
- QNode::cleanup();
-}
-
-QStencilOpSeparate *QStencilOp::front() const
-{
- Q_D(const QStencilOp);
- return d->m_front;
-}
-
-QStencilOpSeparate *QStencilOp::back() const
-{
- Q_D(const QStencilOp);
- return d->m_back;
-}
-
-void QStencilOp::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QStencilOp *refState = static_cast<const QStencilOp*>(ref);
- d_func()->m_back->setDepthFail(refState->d_func()->m_back->depthFail());
- d_func()->m_back->setStencilFail(refState->d_func()->m_back->stencilFail());
- d_func()->m_back->setStencilDepthPass(refState->d_func()->m_back->stencilDepthPass());
- d_func()->m_front->setDepthFail(refState->d_func()->m_front->depthFail());
- d_func()->m_front->setStencilFail(refState->d_func()->m_front->stencilFail());
- d_func()->m_front->setStencilDepthPass(refState->d_func()->m_front->stencilDepthPass());
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/renderstates/qstencilop.h b/src/render/renderstates/qstencilop.h
deleted file mode 100644
index 655658148..000000000
--- a/src/render/renderstates/qstencilop.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSTENCILOP_H
-#define QT3DRENDER_QSTENCILOP_H
-
-#include <Qt3DRender/qrenderstate.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QStencilOpPrivate;
-class QStencilOpSeparate;
-
-class QT3DRENDERSHARED_EXPORT QStencilOp : public QRenderState
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DRender::QStencilOpSeparate *front READ front CONSTANT)
- Q_PROPERTY(Qt3DRender::QStencilOpSeparate *back READ back CONSTANT)
-
-public:
- explicit QStencilOp(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QStencilOp();
-
- QStencilOpSeparate *front() const;
- QStencilOpSeparate *back() const;
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
-
-private:
- Q_DECLARE_PRIVATE(QStencilOp)
- QT3D_CLONEABLE(QStencilOp)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSTENCILOP_H
diff --git a/src/render/renderstates/qstenciloperation.cpp b/src/render/renderstates/qstenciloperation.cpp
new file mode 100644
index 000000000..cec14c041
--- /dev/null
+++ b/src/render/renderstates/qstenciloperation.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstenciloperation.h"
+#include "qstenciloperation_p.h"
+#include "qstenciloperationarguments.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QStencilOperation::QStencilOperation(QNode *parent)
+ : QRenderState(*new QStencilOperationPrivate(), parent)
+{
+}
+
+/*! \internal */
+QStencilOperation::~QStencilOperation()
+{
+}
+
+QStencilOperationArguments *QStencilOperation::front() const
+{
+ Q_D(const QStencilOperation);
+ return d->m_front;
+}
+
+QStencilOperationArguments *QStencilOperation::back() const
+{
+ Q_D(const QStencilOperation);
+ return d->m_back;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QStencilOperation::createNodeCreationChange() const
+{
+ auto creationChange = QRenderStateCreatedChangePtr<QStencilOperationData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QStencilOperation);
+ data.front.face = d->m_front->faceMode();
+ data.front.stencilTestFailureOperation = d->m_front->stencilTestFailureOperation();
+ data.front.depthTestFailureOperation = d->m_front->depthTestFailureOperation();
+ data.front.allTestsPassOperation = d->m_front->allTestsPassOperation();
+ data.back.face = d->m_back->faceMode();
+ data.back.stencilTestFailureOperation = d->m_back->stencilTestFailureOperation();
+ data.back.depthTestFailureOperation = d->m_back->depthTestFailureOperation();
+ data.back.allTestsPassOperation = d->m_back->allTestsPassOperation();
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/renderstates/qstenciloperation.h b/src/render/renderstates/qstenciloperation.h
new file mode 100644
index 000000000..8a8491f59
--- /dev/null
+++ b/src/render/renderstates/qstenciloperation.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTENCILOPERATION_H
+#define QT3DRENDER_QSTENCILOPERATION_H
+
+#include <Qt3DRender/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilOperationPrivate;
+class QStencilOperationArguments;
+
+class QT3DRENDERSHARED_EXPORT QStencilOperation : public QRenderState
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QStencilOperationArguments *front READ front CONSTANT)
+ Q_PROPERTY(Qt3DRender::QStencilOperationArguments *back READ back CONSTANT)
+
+public:
+ explicit QStencilOperation(Qt3DCore::QNode *parent = nullptr);
+ ~QStencilOperation();
+
+ QStencilOperationArguments *front() const;
+ QStencilOperationArguments *back() const;
+
+private:
+ Q_DECLARE_PRIVATE(QStencilOperation)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILOPERATION_H
diff --git a/src/render/renderstates/qstenciloperation_p.h b/src/render/renderstates/qstenciloperation_p.h
new file mode 100644
index 000000000..cf144e644
--- /dev/null
+++ b/src/render/renderstates/qstenciloperation_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTENCILOPERATION_P_H
+#define QT3DRENDER_QSTENCILOPERATION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qstenciloperation.h>
+#include <Qt3DRender/qstenciloperationarguments.h>
+#include <Qt3DRender/private/qstenciloperationarguments_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilOperationPrivate : public QRenderStatePrivate
+{
+public:
+ QStencilOperationPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::StencilOp)
+ , m_front(new QStencilOperationArguments(QStencilOperationArguments::Front, q_ptr))
+ , m_back(new QStencilOperationArguments(QStencilOperationArguments::Back, q_ptr))
+ {}
+
+ QStencilOperationArguments *m_front;
+ QStencilOperationArguments *m_back;
+};
+
+struct QStencilOperationData
+{
+ QStencilOperationArgumentsData front;
+ QStencilOperationArgumentsData back;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILOPERATION_P_H
diff --git a/src/render/renderstates/qstenciloperationarguments.cpp b/src/render/renderstates/qstenciloperationarguments.cpp
new file mode 100644
index 000000000..553dd4ca4
--- /dev/null
+++ b/src/render/renderstates/qstenciloperationarguments.cpp
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstenciloperationarguments.h"
+#include "qstenciloperationarguments_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QStencilOperationArguments::QStencilOperationArguments(FaceMode mode, QObject *parent)
+ : QObject(*new QStencilOperationArgumentsPrivate(mode), parent)
+{
+}
+
+QStencilOperationArguments::~QStencilOperationArguments()
+{
+}
+
+QStencilOperationArguments::FaceMode QStencilOperationArguments::faceMode() const
+{
+ Q_D(const QStencilOperationArguments);
+ return d->m_face;
+}
+
+void QStencilOperationArguments::setStencilTestFailureOperation(QStencilOperationArguments::Operation operation)
+{
+ Q_D(QStencilOperationArguments);
+ if (d->m_stencilTestFailureOperation != operation) {
+ d->m_stencilTestFailureOperation = operation;
+ Q_EMIT stencilTestFailureOperationChanged(operation);
+ }
+}
+
+QStencilOperationArguments::Operation QStencilOperationArguments::stencilTestFailureOperation() const
+{
+ Q_D(const QStencilOperationArguments);
+ return d->m_stencilTestFailureOperation;
+}
+
+void QStencilOperationArguments::setDepthTestFailureOperation(QStencilOperationArguments::Operation operation)
+{
+ Q_D(QStencilOperationArguments);
+ if (d->m_depthTestFailureOperation != operation) {
+ d->m_depthTestFailureOperation = operation;
+ Q_EMIT depthTestFailureOperationChanged(operation);
+ }
+}
+
+QStencilOperationArguments::Operation QStencilOperationArguments::depthTestFailureOperation() const
+{
+ Q_D(const QStencilOperationArguments);
+ return d->m_depthTestFailureOperation;
+}
+
+void QStencilOperationArguments::setAllTestsPassOperation(QStencilOperationArguments::Operation operation)
+{
+ Q_D(QStencilOperationArguments);
+ if (d->m_allTestsPassOperation != operation) {
+ d->m_allTestsPassOperation = operation;
+ Q_EMIT allTestsPassOperationChanged(operation);
+ }
+}
+
+QStencilOperationArguments::Operation QStencilOperationArguments::allTestsPassOperation() const
+{
+ Q_D(const QStencilOperationArguments);
+ return d->m_allTestsPassOperation;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/renderstates/qstenciloperationarguments.h b/src/render/renderstates/qstenciloperationarguments.h
new file mode 100644
index 000000000..31d32f4d5
--- /dev/null
+++ b/src/render/renderstates/qstenciloperationarguments.h
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTENCILOPERATIONARGUMENTS_H
+#define QT3DRENDER_QSTENCILOPERATIONARGUMENTS_H
+
+#include <QObject>
+#include <Qt3DRender/qt3drender_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilOperationPrivate;
+class QStencilOperationArgumentsPrivate;
+
+class QT3DRENDERSHARED_EXPORT QStencilOperationArguments : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(FaceMode faceMode READ faceMode NOTIFY faceModeChanged)
+ Q_PROPERTY(Operation stencilTestFailureOperation READ stencilTestFailureOperation WRITE setStencilTestFailureOperation NOTIFY stencilTestFailureOperationChanged)
+ Q_PROPERTY(Operation depthTestFailureOperation READ depthTestFailureOperation WRITE setDepthTestFailureOperation NOTIFY depthTestFailureOperationChanged)
+ Q_PROPERTY(Operation allTestsPassOperation READ allTestsPassOperation WRITE setAllTestsPassOperation NOTIFY allTestsPassOperationChanged)
+
+public:
+ enum FaceMode
+ {
+ Front = 0x0404,
+ Back = 0x0405,
+ FrontAndBack = 0x0408
+ };
+ Q_ENUM(FaceMode)
+
+ enum Operation
+ {
+ Zero = 0,
+ Keep = 0x1E00,
+ Replace = 0x1E01,
+ Increment = 0x1E02,
+ Decrement = 0x1E03,
+ IncrementWrap = 0x8507,
+ DecrementWrap = 0x8508,
+ Invert = 0x150A
+ };
+ Q_ENUM(Operation)
+
+ ~QStencilOperationArguments();
+
+ FaceMode faceMode() const;
+
+ Operation stencilTestFailureOperation() const;
+ Operation depthTestFailureOperation() const;
+ Operation allTestsPassOperation() const;
+
+public Q_SLOTS:
+ void setStencilTestFailureOperation(Operation operation);
+ void setDepthTestFailureOperation(Operation operation);
+ void setAllTestsPassOperation(Operation operation);
+
+Q_SIGNALS:
+ void stencilTestFailureOperationChanged(Operation stencilFail);
+ void depthTestFailureOperationChanged(Operation depthFail);
+ void allTestsPassOperationChanged(Operation stencilDepthPass);
+ void faceModeChanged(FaceMode faceMode);
+
+private:
+ explicit QStencilOperationArguments(FaceMode mode, QObject *parent = nullptr);
+ Q_DECLARE_PRIVATE(QStencilOperationArguments)
+
+ friend class QStencilOperationPrivate;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILOPERATIONARGUMENTS_H
diff --git a/src/render/renderstates/qstenciloperationarguments_p.h b/src/render/renderstates/qstenciloperationarguments_p.h
new file mode 100644
index 000000000..a0082c60b
--- /dev/null
+++ b/src/render/renderstates/qstenciloperationarguments_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTENCILOPERATIONARGUMENTS_P_H
+#define QT3DRENDER_QSTENCILOPERATIONARGUMENTS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qobject_p.h>
+#include <Qt3DRender/qstenciloperationarguments.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilOperationArgumentsPrivate : public QObjectPrivate
+{
+public:
+ QStencilOperationArgumentsPrivate(QStencilOperationArguments::FaceMode mode)
+ : QObjectPrivate()
+ , m_face(mode)
+ , m_stencilTestFailureOperation(QStencilOperationArguments::Keep)
+ , m_depthTestFailureOperation(QStencilOperationArguments::Keep)
+ , m_allTestsPassOperation(QStencilOperationArguments::Keep)
+ {
+
+ }
+
+ QStencilOperationArguments::FaceMode m_face;
+ QStencilOperationArguments::Operation m_stencilTestFailureOperation;
+ QStencilOperationArguments::Operation m_depthTestFailureOperation;
+ QStencilOperationArguments::Operation m_allTestsPassOperation;
+};
+
+struct QStencilOperationArgumentsData
+{
+ QStencilOperationArguments::FaceMode face;
+ QStencilOperationArguments::Operation stencilTestFailureOperation;
+ QStencilOperationArguments::Operation depthTestFailureOperation;
+ QStencilOperationArguments::Operation allTestsPassOperation;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILOPERATIONARGUMENTS_P_H
diff --git a/src/render/renderstates/qstencilopseparate.cpp b/src/render/renderstates/qstencilopseparate.cpp
deleted file mode 100644
index 3451476e6..000000000
--- a/src/render/renderstates/qstencilopseparate.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qstencilopseparate.h"
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QStencilOpSeparatePrivate : public QObjectPrivate
-{
-public:
- QStencilOpSeparatePrivate(QStencilOpSeparate::StencilFaceMode mode)
- : QObjectPrivate()
- , m_face(mode)
- , m_stencilFailOp(QStencilOpSeparate::Keep)
- , m_depthFailOp(QStencilOpSeparate::Keep)
- , m_stencilDepthPassOp(QStencilOpSeparate::Keep)
- {
-
- }
-
- QStencilOpSeparate::StencilFaceMode m_face;
- QStencilOpSeparate::StencilOp m_stencilFailOp;
- QStencilOpSeparate::StencilOp m_depthFailOp;
- QStencilOpSeparate::StencilOp m_stencilDepthPassOp;
-};
-
-QStencilOpSeparate::QStencilOpSeparate(StencilFaceMode mode, QObject *parent)
- : QObject(*new QStencilOpSeparatePrivate(mode), parent)
-{
-}
-
-QStencilOpSeparate::~QStencilOpSeparate()
-{
-}
-
-QStencilOpSeparate::StencilFaceMode QStencilOpSeparate::faceMode() const
-{
- Q_D(const QStencilOpSeparate);
- return d->m_face;
-}
-
-void QStencilOpSeparate::setStencilFail(QStencilOpSeparate::StencilOp op)
-{
- Q_D(QStencilOpSeparate);
- if (d->m_stencilFailOp != op) {
- d->m_stencilFailOp = op;
- Q_EMIT stencilFailChanged(op);
- }
-}
-
-QStencilOpSeparate::StencilOp QStencilOpSeparate::stencilFail() const
-{
- Q_D(const QStencilOpSeparate);
- return d->m_stencilFailOp;
-}
-
-void QStencilOpSeparate::setDepthFail(QStencilOpSeparate::StencilOp op)
-{
- Q_D(QStencilOpSeparate);
- if (d->m_depthFailOp != op) {
- d->m_depthFailOp = op;
- Q_EMIT depthFailChanged(op);
- }
-}
-
-QStencilOpSeparate::StencilOp QStencilOpSeparate::depthFail() const
-{
- Q_D(const QStencilOpSeparate);
- return d->m_depthFailOp;
-}
-
-void QStencilOpSeparate::setStencilDepthPass(QStencilOpSeparate::StencilOp op)
-{
- Q_D(QStencilOpSeparate);
- if (d->m_stencilDepthPassOp != op) {
- d->m_stencilDepthPassOp = op;
- Q_EMIT stencilDepthPassChanged(op);
- }
-}
-
-QStencilOpSeparate::StencilOp QStencilOpSeparate::stencilDepthPass() const
-{
- Q_D(const QStencilOpSeparate);
- return d->m_stencilDepthPassOp;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/renderstates/qstencilopseparate.h b/src/render/renderstates/qstencilopseparate.h
deleted file mode 100644
index 1da98a82c..000000000
--- a/src/render/renderstates/qstencilopseparate.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSTENCILOPSEPARATE_H
-#define QT3DRENDER_QSTENCILOPSEPARATE_H
-
-#include <QObject>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QStencilOpPrivate;
-class QStencilOpSeparatePrivate;
-
-class QT3DRENDERSHARED_EXPORT QStencilOpSeparate : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(StencilFaceMode faceMode READ faceMode NOTIFY faceModeChanged)
- Q_PROPERTY(StencilOp stencilFail READ stencilFail WRITE setStencilFail NOTIFY stencilFailChanged)
- Q_PROPERTY(StencilOp depthFail READ depthFail WRITE setDepthFail NOTIFY depthFailChanged)
- Q_PROPERTY(StencilOp stencilDepthPass READ stencilDepthPass WRITE setStencilDepthPass NOTIFY stencilDepthPassChanged)
-
-public:
- enum StencilFaceMode
- {
- Front = 0x0404,
- Back = 0x0405,
- FrontAndBack = 0x0408
- };
- Q_ENUM(StencilFaceMode)
-
- enum StencilOp
- {
- Zero = 0,
- Keep = 0x1E00,
- Replace = 0x1E01,
- Incr = 0x1E02,
- Decr = 0x1E03,
- IncrWrap = 0x8507,
- DecrWrap = 0x8508,
- Invert = 0x150A
- };
- Q_ENUM(StencilOp)
-
- ~QStencilOpSeparate();
-
- StencilFaceMode faceMode() const;
-
- StencilOp stencilFail() const;
- StencilOp depthFail() const;
- StencilOp stencilDepthPass() const;
-
-public Q_SLOTS:
- void setStencilFail(StencilOp op);
- void setDepthFail(StencilOp op);
- void setStencilDepthPass(StencilOp op);
-
-Q_SIGNALS:
- void stencilFailChanged(StencilOp stencilFail);
- void depthFailChanged(StencilOp depthFail);
- void stencilDepthPassChanged(StencilOp stencilDepthPass);
- void faceModeChanged(StencilFaceMode faceMode);
-
-private:
- explicit QStencilOpSeparate(StencilFaceMode mode, QObject *parent = Q_NULLPTR);
- Q_DECLARE_PRIVATE(QStencilOpSeparate)
-
- friend class QStencilOpPrivate;
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSTENCILOPSEPARATE_H
diff --git a/src/render/renderstates/qstenciltest.cpp b/src/render/renderstates/qstenciltest.cpp
index 2533d71a9..649a78066 100644
--- a/src/render/renderstates/qstenciltest.cpp
+++ b/src/render/renderstates/qstenciltest.cpp
@@ -1,101 +1,90 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qstenciltest.h"
-#include "qrenderstate_p.h"
-#include <private/qnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include "qstenciltestseparate.h"
-
+#include "qstenciltest_p.h"
+#include "qstenciltestarguments.h"
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QStencilTestPrivate : public QRenderStatePrivate
-{
-public:
- QStencilTestPrivate()
- : QRenderStatePrivate(QRenderState::StencilTest)
- , m_front(new QStencilTestSeparate(QStencilTestSeparate::Front))
- , m_back(new QStencilTestSeparate(QStencilTestSeparate::Back))
- {
- }
-
- Q_DECLARE_PUBLIC(QStencilTest)
- QStencilTestSeparate *m_front;
- QStencilTestSeparate *m_back;
-};
-
QStencilTest::QStencilTest(QNode *parent)
: QRenderState(*new QStencilTestPrivate, parent)
{
}
+/*! \internal */
QStencilTest::~QStencilTest()
{
- QNode::cleanup();
}
-QStencilTestSeparate *QStencilTest::front() const
+QStencilTestArguments *QStencilTest::front() const
{
Q_D(const QStencilTest);
return d->m_front;
}
-QStencilTestSeparate *QStencilTest::back() const
+QStencilTestArguments *QStencilTest::back() const
{
Q_D(const QStencilTest);
return d->m_back;
}
-void QStencilTest::copy(const QNode *ref)
+Qt3DCore::QNodeCreatedChangeBasePtr QStencilTest::createNodeCreationChange() const
{
- QRenderState::copy(ref);
- const QStencilTest *refState = static_cast<const QStencilTest*>(ref);
- d_func()->m_front->setMask(refState->d_func()->m_front->mask());
- d_func()->m_front->setRef(refState->d_func()->m_front->ref());
- d_func()->m_front->setFunc(refState->d_func()->m_front->func());
- d_func()->m_back->setMask(refState->d_func()->m_back->mask());
- d_func()->m_back->setRef(refState->d_func()->m_back->ref());
- d_func()->m_back->setFunc(refState->d_func()->m_back->func());
+ auto creationChange = QRenderStateCreatedChangePtr<QStencilTestData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QStencilTest);
+ data.front.face = d->m_front->faceMode();
+ data.front.comparisonMask = d->m_front->comparisonMask();
+ data.front.referenceValue = d->m_front->referenceValue();
+ data.front.stencilFunction = d->m_front->stencilFunction();
+ data.back.face = d->m_back->faceMode();
+ data.back.comparisonMask = d->m_back->comparisonMask();
+ data.back.referenceValue = d->m_back->referenceValue();
+ data.back.stencilFunction = d->m_back->stencilFunction();
+ return creationChange;
}
-
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/renderstates/qstenciltest.h b/src/render/renderstates/qstenciltest.h
index 80a5f077a..894a4f561 100644
--- a/src/render/renderstates/qstenciltest.h
+++ b/src/render/renderstates/qstenciltest.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -45,27 +48,23 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
class QStencilTestPrivate;
-class QStencilTestSeparate;
+class QStencilTestArguments;
class QT3DRENDERSHARED_EXPORT QStencilTest : public QRenderState
{
Q_OBJECT
- Q_PROPERTY(Qt3DRender::QStencilTestSeparate *front READ front CONSTANT)
- Q_PROPERTY(Qt3DRender::QStencilTestSeparate *back READ back CONSTANT)
+ Q_PROPERTY(Qt3DRender::QStencilTestArguments *front READ front CONSTANT)
+ Q_PROPERTY(Qt3DRender::QStencilTestArguments *back READ back CONSTANT)
public:
-
- explicit QStencilTest(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QStencilTest(Qt3DCore::QNode *parent = nullptr);
~QStencilTest();
- QStencilTestSeparate *front() const;
- QStencilTestSeparate *back() const;
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ QStencilTestArguments *front() const;
+ QStencilTestArguments *back() const;
private:
Q_DECLARE_PRIVATE(QStencilTest)
- QT3D_CLONEABLE(QStencilTest)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qstenciltest_p.h b/src/render/renderstates/qstenciltest_p.h
new file mode 100644
index 000000000..16fe85682
--- /dev/null
+++ b/src/render/renderstates/qstenciltest_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTENCILTEST_P_H
+#define QT3DRENDER_QSTENCILTEST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qstenciltest.h>
+#include <Qt3DRender/qstenciltestarguments.h>
+#include <Qt3DRender/private/qstenciltestarguments_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilTestPrivate : public QRenderStatePrivate
+{
+public:
+ QStencilTestPrivate()
+ : QRenderStatePrivate(QRenderStatePrivate::StencilTest)
+ , m_front(new QStencilTestArguments(QStencilTestArguments::Front))
+ , m_back(new QStencilTestArguments(QStencilTestArguments::Back))
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QStencilTest)
+ QStencilTestArguments *m_front;
+ QStencilTestArguments *m_back;
+};
+
+struct QStencilTestData
+{
+ QStencilTestArgumentsData front;
+ QStencilTestArgumentsData back;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILTEST_P_H
diff --git a/src/render/renderstates/qstenciltestarguments.cpp b/src/render/renderstates/qstenciltestarguments.cpp
new file mode 100644
index 000000000..28affeeb8
--- /dev/null
+++ b/src/render/renderstates/qstenciltestarguments.cpp
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstenciltestarguments.h"
+#include "qstenciltestarguments_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+QStencilTestArguments::QStencilTestArguments(QStencilTestArguments::StencilFaceMode face, QObject *parent)
+ : QObject(*new QStencilTestArgumentsPrivate(face), parent)
+{
+}
+
+QStencilTestArguments::~QStencilTestArguments()
+{
+}
+
+uint QStencilTestArguments::comparisonMask() const
+{
+ Q_D(const QStencilTestArguments);
+ return d->m_comparisonMask;
+}
+
+void QStencilTestArguments::setComparisonMask(uint comparisonMask)
+{
+ Q_D(QStencilTestArguments);
+ if (d->m_comparisonMask != comparisonMask) {
+ d->m_comparisonMask = comparisonMask;
+ emit comparisonMaskChanged(comparisonMask);
+ }
+}
+
+int QStencilTestArguments::referenceValue() const
+{
+ Q_D(const QStencilTestArguments);
+ return d->m_referenceValue;
+}
+
+void QStencilTestArguments::setReferenceValue(int referenceValue)
+{
+ Q_D(QStencilTestArguments);
+ if (d->m_referenceValue != referenceValue) {
+ d->m_referenceValue = referenceValue;
+ emit referenceValueChanged(referenceValue);
+ }
+}
+
+QStencilTestArguments::StencilFunction QStencilTestArguments::stencilFunction() const
+{
+ Q_D(const QStencilTestArguments);
+ return d->m_stencilFunction;
+}
+
+void QStencilTestArguments::setStencilFunction(QStencilTestArguments::StencilFunction stencilFunction)
+{
+ Q_D(QStencilTestArguments);
+ if (d->m_stencilFunction != stencilFunction) {
+ d->m_stencilFunction = stencilFunction;
+ emit stencilFunctionChanged(stencilFunction);
+ }
+}
+
+QStencilTestArguments::StencilFaceMode QStencilTestArguments::faceMode() const
+{
+ Q_D(const QStencilTestArguments);
+ return d->m_face;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/renderstates/qstenciltestarguments.h b/src/render/renderstates/qstenciltestarguments.h
new file mode 100644
index 000000000..17d9fa21e
--- /dev/null
+++ b/src/render/renderstates/qstenciltestarguments.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTENCILTESTARGUMENTS_H
+#define QT3DRENDER_QSTENCILTESTARGUMENTS_H
+
+#include <QObject>
+#include <Qt3DRender/qt3drender_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilTestPrivate;
+class QStencilTestArgumentsPrivate;
+
+class QT3DRENDERSHARED_EXPORT QStencilTestArguments : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(StencilFaceMode faceMode READ faceMode NOTIFY faceModeChanged)
+ Q_PROPERTY(uint comparisonMask READ comparisonMask WRITE setComparisonMask NOTIFY comparisonMaskChanged)
+ Q_PROPERTY(int referenceValue READ referenceValue WRITE setReferenceValue NOTIFY referenceValueChanged)
+ Q_PROPERTY(StencilFunction stencilFunction READ stencilFunction WRITE setStencilFunction NOTIFY stencilFunctionChanged)
+
+public:
+ enum StencilFaceMode
+ {
+ Front = 0x0404,
+ Back = 0x0405,
+ FrontAndBack = 0x0408
+ };
+ Q_ENUM(StencilFaceMode)
+
+ enum StencilFunction
+ {
+ Never = 0x0200,
+ Always = 0x0207,
+ Less = 0x0201,
+ LessOrEqual = 0x0203,
+ Equal = 0x0202,
+ GreaterOrEqual = 0x0206,
+ Greater = 0x0204,
+ NotEqual = 0x0205
+ };
+ Q_ENUM(StencilFunction)
+
+ ~QStencilTestArguments();
+
+ uint comparisonMask() const;
+ int referenceValue() const;
+ StencilFunction stencilFunction() const;
+
+ StencilFaceMode faceMode() const;
+
+public Q_SLOTS:
+ void setComparisonMask(uint comparisonMask);
+ void setReferenceValue(int referenceValue);
+ void setStencilFunction(StencilFunction stencilFunction);
+
+Q_SIGNALS:
+ void comparisonMaskChanged(uint comparisonMask);
+ void stencilFunctionChanged(StencilFunction stencilFunction);
+ void referenceValueChanged(int referenceValue);
+ void faceModeChanged(StencilFaceMode faceMode);
+
+private:
+ explicit QStencilTestArguments(StencilFaceMode face, QObject *parent = nullptr);
+
+ friend class QStencilTestPrivate;
+
+ Q_DECLARE_PRIVATE(QStencilTestArguments)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILTESTARGUMENTS_H
diff --git a/src/render/renderstates/qstenciltestarguments_p.h b/src/render/renderstates/qstenciltestarguments_p.h
new file mode 100644
index 000000000..06a5bb91a
--- /dev/null
+++ b/src/render/renderstates/qstenciltestarguments_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QSTENCILTESTARGUMENTS_P_H
+#define QT3DRENDER_QSTENCILTESTARGUMENTS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/private/qobject_p.h>
+#include <Qt3DRender/qstenciltestarguments.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QStencilTestArgumentsPrivate : public QObjectPrivate
+{
+public:
+ QStencilTestArgumentsPrivate(QStencilTestArguments::StencilFaceMode face)
+ : QObjectPrivate()
+ , m_face(face)
+ , m_comparisonMask(0)
+ , m_referenceValue(0)
+ , m_stencilFunction(QStencilTestArguments::Never)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QStencilTestArguments)
+ QStencilTestArguments::StencilFaceMode m_face;
+ uint m_comparisonMask;
+ int m_referenceValue;
+ QStencilTestArguments::StencilFunction m_stencilFunction;
+};
+
+struct QStencilTestArgumentsData
+{
+ QStencilTestArguments::StencilFaceMode face;
+ uint comparisonMask;
+ int referenceValue;
+ QStencilTestArguments::StencilFunction stencilFunction;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QSTENCILTESTARGUMENTS_P_H
diff --git a/src/render/renderstates/qstenciltestseparate.cpp b/src/render/renderstates/qstenciltestseparate.cpp
deleted file mode 100644
index a109d1338..000000000
--- a/src/render/renderstates/qstenciltestseparate.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qstenciltestseparate.h"
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QStencilTestSeparatePrivate : public QObjectPrivate
-{
-public:
- QStencilTestSeparatePrivate(QStencilTestSeparate::StencilFaceMode face)
- : QObjectPrivate()
- , m_face(face)
- , m_mask(0)
- , m_ref(0)
- , m_func(QStencilTestSeparate::Never)
- {
- }
-
- Q_DECLARE_PUBLIC(QStencilTestSeparate)
- QStencilTestSeparate::StencilFaceMode m_face;
- uint m_mask;
- int m_ref;
- QStencilTestSeparate::StencilFunc m_func;
-};
-
-
-QStencilTestSeparate::QStencilTestSeparate(QStencilTestSeparate::StencilFaceMode face, QObject *parent)
- : QObject(*new QStencilTestSeparatePrivate(face), parent)
-{
-}
-
-QStencilTestSeparate::~QStencilTestSeparate()
-{
-}
-
-uint QStencilTestSeparate::mask() const
-{
- Q_D(const QStencilTestSeparate);
- return d->m_mask;
-}
-
-void QStencilTestSeparate::setMask(uint mask)
-{
- Q_D(QStencilTestSeparate);
- if (d->m_mask != mask) {
- d->m_mask = mask;
- emit maskChanged(mask);
- }
-}
-
-int QStencilTestSeparate::ref() const
-{
- Q_D(const QStencilTestSeparate);
- return d->m_ref;
-}
-
-void QStencilTestSeparate::setRef(int ref)
-{
- Q_D(QStencilTestSeparate);
- if (d->m_ref != ref) {
- d->m_ref = ref;
- emit refChanged(ref);
- }
-}
-
-QStencilTestSeparate::StencilFunc QStencilTestSeparate::func() const
-{
- Q_D(const QStencilTestSeparate);
- return d->m_func;
-}
-
-void QStencilTestSeparate::setFunc(QStencilTestSeparate::StencilFunc func)
-{
- Q_D(QStencilTestSeparate);
- if (d->m_func != func) {
- d->m_func = func;
- emit funcChanged(func);
- }
-}
-
-QStencilTestSeparate::StencilFaceMode QStencilTestSeparate::faceMode() const
-{
- Q_D(const QStencilTestSeparate);
- return d->m_face;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/renderstates/qstenciltestseparate.h b/src/render/renderstates/qstenciltestseparate.h
deleted file mode 100644
index d89ca1c4f..000000000
--- a/src/render/renderstates/qstenciltestseparate.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QSTENCILTESTSEPARATE_H
-#define QT3DRENDER_QSTENCILTESTSEPARATE_H
-
-#include <QObject>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QStencilTestPrivate;
-class QStencilTestSeparatePrivate;
-
-class QT3DRENDERSHARED_EXPORT QStencilTestSeparate : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(StencilFaceMode faceMode READ faceMode NOTIFY faceModeChanged)
- Q_PROPERTY(uint mask READ mask WRITE setMask NOTIFY maskChanged)
- Q_PROPERTY(int ref READ ref WRITE setRef NOTIFY refChanged)
- Q_PROPERTY(StencilFunc func READ func WRITE setFunc NOTIFY funcChanged)
-
-public:
- enum StencilFaceMode
- {
- Front = 0x0404,
- Back = 0x0405,
- FrontAndBack = 0x0408
- };
- Q_ENUM(StencilFaceMode)
-
- enum StencilFunc
- {
- Never = 0x0200,
- Always = 0x0207,
- Less = 0x0201,
- LessOrEqual = 0x0203,
- Equal = 0x0202,
- GreaterOrEqual = 0x0206,
- Greater = 0x0204,
- NotEqual = 0x0205
- };
- Q_ENUM(StencilFunc)
-
- ~QStencilTestSeparate();
-
- uint mask() const;
- int ref() const;
- StencilFunc func() const;
-
- StencilFaceMode faceMode() const;
-
-public Q_SLOTS:
- void setMask(uint mask);
- void setRef(int ref);
- void setFunc(StencilFunc func);
-
-Q_SIGNALS:
- void maskChanged(uint mask);
- void funcChanged(StencilFunc func);
- void refChanged(int ref);
- void faceModeChanged(StencilFaceMode faceMode);
-
-private:
- explicit QStencilTestSeparate(StencilFaceMode face, QObject *parent = Q_NULLPTR);
-
- friend class QStencilTestPrivate;
-
- Q_DECLARE_PRIVATE(QStencilTestSeparate)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QSTENCILTESTSEPARATE_H
diff --git a/src/render/renderstates/renderstatecollection.cpp b/src/render/renderstates/renderstatecollection.cpp
new file mode 100644
index 000000000..beba83df4
--- /dev/null
+++ b/src/render/renderstates/renderstatecollection.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "Qt3DRender/private/renderstatecollection_p.h"
+#include <Qt3DRender/private/renderstates_p.h>
+#include <Qt3DRender/private/managers_p.h>
+
+#include <Qt3DRender/qrenderstate.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderStateCollection::RenderStateCollection()
+ : m_dirty(false)
+{
+}
+
+RenderStateCollection::~RenderStateCollection()
+{
+}
+
+QVector<RenderStateNode*> RenderStateCollection::renderStates(RenderStateManager *manager) const
+{
+ if (m_dirty) {
+ m_renderStateNodes.clear();
+
+ for (const Qt3DCore::QNodeId id : m_renderStateIds) {
+ RenderStateNode *node = manager->lookupResource(id);
+ m_renderStateNodes.append(node);
+ }
+
+ m_dirty = false;
+ }
+
+ return m_renderStateNodes;
+}
+
+bool RenderStateCollection::hasRenderStates() const
+{
+ return !m_renderStateIds.empty();
+}
+
+void RenderStateCollection::appendRenderState(Qt3DCore::QNodeId renderStateId)
+{
+ if (!m_renderStateIds.contains(renderStateId)) {
+ m_renderStateIds.append(renderStateId);
+ m_dirty = true;
+ }
+}
+
+void RenderStateCollection::removeRenderState(Qt3DCore::QNodeId renderStateId)
+{
+ if (m_renderStateIds.removeAll(renderStateId) > 0) {
+ m_dirty = true;
+ }
+
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/renderstates/renderstatecollection_p.h b/src/render/renderstates/renderstatecollection_p.h
new file mode 100644
index 000000000..c28a6a2b8
--- /dev/null
+++ b/src/render/renderstates/renderstatecollection_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_RENDERSTATECOLLECTION_H
+#define QT3DRENDER_RENDER_RENDERSTATECOLLECTION_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/renderstatenode_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QRenderState;
+
+namespace Render {
+
+class RenderStateManager;
+
+class Q_AUTOTEST_EXPORT RenderStateCollection
+{
+public:
+ RenderStateCollection();
+ ~RenderStateCollection();
+
+ QVector<RenderStateNode*> renderStates(RenderStateManager *manager) const;
+ bool hasRenderStates() const;
+
+protected:
+ void appendRenderState(Qt3DCore::QNodeId renderStateId);
+ void removeRenderState(Qt3DCore::QNodeId renderStateId);
+
+private:
+ QVector<Qt3DCore::QNodeId> m_renderStateIds;
+
+ // Cached RenderStateNodes corresponding to the stored node IDs
+ //
+ // we need these two to be mutable, because the RenderView accesses const
+ // instances of this class when we need to update the cached RenderStateNodes
+ mutable QVector<RenderStateNode*> m_renderStateNodes;
+ mutable bool m_dirty;
+};
+
+} // namespace Render
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERSTATECOLLECTION_H
+
diff --git a/src/render/renderstates/renderstatenode.cpp b/src/render/renderstates/renderstatenode.cpp
new file mode 100644
index 000000000..ce85a2f67
--- /dev/null
+++ b/src/render/renderstates/renderstatenode.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "renderstatenode_p.h"
+#include <Qt3DRender/qrenderstate.h>
+#include <Qt3DRender/private/qrenderstatecreatedchange_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+RenderStateNode::RenderStateNode()
+ : BackendNode()
+ , m_impl(NULL)
+{
+}
+
+RenderStateNode::~RenderStateNode()
+{
+ cleanup();
+}
+
+void RenderStateNode::cleanup()
+{
+ if (m_impl != nullptr) {
+ if (!m_impl->isPooledImpl())
+ delete m_impl;
+ m_impl = nullptr;
+ }
+}
+
+void RenderStateNode::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+{
+ cleanup();
+ const auto renderStateChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChangeBase>(change);
+ m_impl = RenderStateImpl::getOrCreateState(renderStateChange);
+}
+
+void RenderStateNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ if (e->type() == Qt3DCore::PropertyUpdated) {
+ Qt3DCore::QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
+
+ if (m_impl->isPooledImpl()) {
+ m_impl = m_impl->getOrCreateWithPropertyChange(propertyChange->propertyName(), propertyChange->value());
+ } else {
+ m_impl->updateProperty(propertyChange->propertyName(), propertyChange->value());
+ }
+ markDirty(AbstractRenderer::AllDirty);
+ }
+ BackendNode::sceneChangeEvent(e);
+}
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/renderstates/renderstatenode_p.h b/src/render/renderstates/renderstatenode_p.h
new file mode 100644
index 000000000..9bcb1d91a
--- /dev/null
+++ b/src/render/renderstates/renderstatenode_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_RENDER_RENDERSTATENODE_H
+#define QT3DRENDER_RENDER_RENDERSTATENODE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/private/genericstate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+namespace Render {
+
+class Q_AUTOTEST_EXPORT RenderStateNode : public BackendNode
+{
+public:
+ RenderStateNode();
+ virtual ~RenderStateNode();
+
+ virtual void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
+ void apply(GraphicsContext* gc) const { m_impl->apply(gc); }
+ StateMaskSet mask() const { return m_impl->mask(); }
+ RenderStateImpl *impl() const { return m_impl; }
+
+protected:
+ void cleanup();
+
+private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
+ RenderStateImpl *m_impl;
+};
+
+} // namespace Render
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_RENDER_RENDERSTATENODE_H
diff --git a/src/render/renderstates/renderstates.cpp b/src/render/renderstates/renderstates.cpp
index 204803dc6..a92072da6 100644
--- a/src/render/renderstates/renderstates.cpp
+++ b/src/render/renderstates/renderstates.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,6 +40,10 @@
#include "renderstates_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DRender/qrenderstate.h>
+#include <Qt3DRender/qcullface.h>
+
#include <Qt3DRender/private/graphicscontext_p.h>
QT_BEGIN_NAMESPACE
@@ -44,35 +51,53 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-template <class State>
-State* getOrCreateImpl(const State& data)
+void RenderStateImpl::updateProperty(const char *name, const QVariant &value)
{
- static QList<State*> static_instances;
- foreach (State* ext, static_instances) {
- if (ext->isEqual(data))
- return ext;
- }
-
- State* result = new State(data);
- static_instances.append(result);
- return result;
+ Q_UNUSED(name);
+ Q_UNUSED(value);
}
-void BlendState::apply(GraphicsContext* gc) const
+bool RenderStateImpl::isPooledImpl() const Q_DECL_NOEXCEPT
{
- gc->openGLContext()->functions()->glEnable(GL_BLEND);
- gc->openGLContext()->functions()->glBlendFunc( m_1, m_2 );
+ return true;
}
-BlendState *BlendState::getOrCreate(GLenum src, GLenum dst)
+void BlendEquationArguments::apply(GraphicsContext* gc) const
{
- BlendState bs(src, dst);
- return getOrCreateImpl(bs);
+ // Un-indexed BlendEquationArguments -> Use normal GL1.0 functions
+ if (m_6 < 0) {
+ if (m_5) {
+ gc->openGLContext()->functions()->glEnable(GL_BLEND);
+ gc->openGLContext()->functions()->glBlendFuncSeparate(m_1, m_2, m_3, m_4);
+ } else {
+ gc->openGLContext()->functions()->glDisable(GL_BLEND);
+ }
+ }
+ // BlendEquationArguments for a particular Draw Buffer. Different behaviours for
+ // (1) 3.0-3.3: only enablei/disablei supported.
+ // (2) 4.0+: all operations supported.
+ // We just ignore blend func parameter for (1), so no warnings get
+ // printed.
+ else {
+ if (m_5) {
+ gc->enablei(GL_BLEND, m_6);
+ if (gc->supportsDrawBuffersBlend()) {
+ gc->blendFuncSeparatei(m_6, m_1, m_2, m_3, m_4);
+ }
+ } else {
+ gc->disablei(GL_BLEND, m_6);
+ }
+ }
}
-BlendState::BlendState(GLenum src, GLenum dst) :
- GenericState2<BlendState, GLenum, GLenum>(src, dst)
+void BlendEquationArguments::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("sourceRgb")) m_1 = value.toInt();
+ else if (name == QByteArrayLiteral("destinationRgb")) m_2 = value.toInt();
+ else if (name == QByteArrayLiteral("sourceAlpha")) m_3 = value.toInt();
+ else if (name == QByteArrayLiteral("destinationAlpha")) m_4 = value.toInt();
+ else if (name == QByteArrayLiteral("enabled")) m_5 = value.toBool();
+ else if (name == QByteArrayLiteral("bufferIndex")) m_6 = value.toInt();
}
void BlendEquation::apply(GraphicsContext *gc) const
@@ -80,31 +105,25 @@ void BlendEquation::apply(GraphicsContext *gc) const
gc->blendEquation(m_1);
}
-BlendEquation *BlendEquation::getOrCreate(GLenum func)
+void BlendEquation::updateProperty(const char *name, const QVariant &value)
{
- return getOrCreateImpl(BlendEquation(func));
+ if (name == QByteArrayLiteral("mode")) m_1 = value.toInt();
}
-BlendEquation::BlendEquation(GLenum func) :
- GenericState1<BlendEquation, GLenum>(func)
-{
-}
-
-
void AlphaFunc::apply(GraphicsContext* gc) const
{
gc->alphaTest(m_1, m_2);
}
-AlphaFunc *AlphaFunc::getOrCreate(GLenum func, GLclampf value)
+void MSAAEnabled::apply(GraphicsContext *gc) const
{
- AlphaFunc af(func, value);
- return getOrCreateImpl(af);
+ gc->setMSAAEnabled(m_1);
}
-AlphaFunc::AlphaFunc(GLenum func, GLclampf value) :
- GenericState2<AlphaFunc, GLenum, GLclampf>(func, value)
+void MSAAEnabled::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("enabled"))
+ m_1 = value.toBool();
}
void DepthTest::apply(GraphicsContext *gc) const
@@ -112,30 +131,24 @@ void DepthTest::apply(GraphicsContext *gc) const
gc->depthTest(m_1);
}
-DepthTest *DepthTest::getOrCreate(GLenum func)
-{
- DepthTest dt(func);
- return getOrCreateImpl(dt);
-}
-
-DepthTest::DepthTest(GLenum func) :
- GenericState1<DepthTest, GLenum>(func)
+void DepthTest::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("func")) m_1 = value.toInt();
}
void CullFace::apply(GraphicsContext *gc) const
{
- gc->cullFace(m_1);
-}
-
-CullFace *CullFace::getOrCreate(GLenum func)
-{
- return getOrCreateImpl(CullFace(func));
+ if (m_1 == QCullFace::NoCulling) {
+ gc->openGLContext()->functions()->glDisable(GL_CULL_FACE);
+ } else {
+ gc->openGLContext()->functions()->glEnable(GL_CULL_FACE);
+ gc->openGLContext()->functions()->glCullFace(m_1);
+ }
}
-CullFace::CullFace(GLenum func) :
- GenericState1<CullFace, GLenum>(func)
+void CullFace::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("mode")) m_1 = value.toInt();
}
void FrontFace::apply(GraphicsContext *gc) const
@@ -143,34 +156,19 @@ void FrontFace::apply(GraphicsContext *gc) const
gc->frontFace(m_1);
}
-FrontFace *FrontFace::getOrCreate(GLenum func)
-{
- return getOrCreateImpl(FrontFace(func));
-}
-
-FrontFace::FrontFace(GLenum func) :
- GenericState1<FrontFace, GLenum>(func)
+void FrontFace::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("direction")) m_1 = value.toInt();
}
-void DepthMask::apply(GraphicsContext *gc) const
+void NoDepthMask::apply(GraphicsContext *gc) const
{
gc->depthMask(m_1);
}
-DepthMask *DepthMask::getOrCreate(GLboolean flag)
-{
- return getOrCreateImpl(DepthMask(flag));
-}
-
-DepthMask::DepthMask(GLboolean flag) :
- GenericState1<DepthMask, GLboolean>(flag)
-{
-}
-
-Dithering::Dithering()
- : RenderState()
+void NoDepthMask::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("mask")) m_1 = value.toBool();
}
void Dithering::apply(GraphicsContext *gc) const
@@ -178,37 +176,18 @@ void Dithering::apply(GraphicsContext *gc) const
gc->openGLContext()->functions()->glEnable(GL_DITHER);
}
-Dithering *Dithering::getOrCreate()
-{
- return getOrCreateImpl(Dithering());
-}
-
-ScissorTest::ScissorTest(int left, int bottom, int width, int height)
- : GenericState4<ScissorTest, int, int, int, int>(left, bottom, width, height)
-{
-}
-
void ScissorTest::apply(GraphicsContext *gc) const
{
gc->openGLContext()->functions()->glEnable(GL_SCISSOR_TEST);
gc->openGLContext()->functions()->glScissor(m_1, m_2, m_3, m_4);
}
-ScissorTest *ScissorTest::getOrCreate(int left, int bottom, int width, int height)
-{
- return getOrCreateImpl(ScissorTest(left, bottom, width, height));
-}
-
-StencilTest *StencilTest::getOrCreate(GLenum frontFunc, int frontRef, uint frontMask, GLenum backFunc, int backRef, uint backMask)
-{
- return getOrCreateImpl(StencilTest(frontFunc, frontRef, frontMask,
- backFunc, backRef, backMask));
-}
-
-StencilTest::StencilTest(GLenum frontFunc, int frontRef, uint frontMask, GLenum backFunc, int backRef, uint backMask)
- : GenericState6<StencilTest, GLenum, int, uint, GLenum, int, uint>(frontFunc, frontRef, frontMask,
- backFunc, backRef, backMask)
+void ScissorTest::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("left")) m_1 = value.toInt();
+ else if (name == QByteArrayLiteral("bottom")) m_2 = value.toInt();
+ else if (name == QByteArrayLiteral("width")) m_3 = value.toInt();
+ else if (name == QByteArrayLiteral("height")) m_4 = value.toInt();
}
void StencilTest::apply(GraphicsContext *gc) const
@@ -218,19 +197,15 @@ void StencilTest::apply(GraphicsContext *gc) const
gc->openGLContext()->functions()->glStencilFuncSeparate(GL_BACK, m_4, m_5, m_6);
}
-AlphaCoverage::AlphaCoverage()
- : RenderState()
-{
-}
-
void AlphaCoverage::apply(GraphicsContext *gc) const
{
- gc->enableAlphaCoverage();
+ gc->setAlphaCoverageEnabled(m_1);
}
-AlphaCoverage *AlphaCoverage::getOrCreate()
+void AlphaCoverage::updateProperty(const char *name, const QVariant &value)
{
- return getOrCreateImpl(AlphaCoverage());
+ if (name == QByteArrayLiteral("enabled"))
+ m_1 = value.toBool();
}
void PointSize::apply(GraphicsContext *gc) const
@@ -238,14 +213,10 @@ void PointSize::apply(GraphicsContext *gc) const
gc->pointSize(m_1, m_2);
}
-PointSize *PointSize::getOrCreate(bool programmable, GLfloat value)
-{
- return getOrCreateImpl(PointSize(programmable, value));
-}
-
-PointSize::PointSize(bool programmable, GLfloat value)
- : GenericState2<PointSize, bool, GLfloat>(programmable, value)
+void PointSize::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("specification")) m_1 = value.toBool();
+ else if (name == QByteArrayLiteral("value")) m_2 = value.toFloat();
}
void PolygonOffset::apply(GraphicsContext *gc) const
@@ -254,14 +225,10 @@ void PolygonOffset::apply(GraphicsContext *gc) const
gc->openGLContext()->functions()->glPolygonOffset(m_1, m_2);
}
-PolygonOffset *PolygonOffset::getOrCreate(GLfloat factor, GLfloat units)
-{
- return getOrCreateImpl(PolygonOffset(factor, units));
-}
-
-PolygonOffset::PolygonOffset(GLfloat factor, GLfloat units)
- : GenericState2<PolygonOffset, GLfloat, GLfloat>(factor, units)
+void PolygonOffset::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("factor")) m_1 = value.toFloat();
+ else if (name == QByteArrayLiteral("units")) m_2 = value.toFloat();
}
void ColorMask::apply(GraphicsContext *gc) const
@@ -269,45 +236,35 @@ void ColorMask::apply(GraphicsContext *gc) const
gc->openGLContext()->functions()->glColorMask(m_1, m_2, m_3, m_4);
}
-ColorMask::ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
- : GenericState4<ColorMask, GLboolean, GLboolean, GLboolean, GLboolean>(red, green, blue, alpha)
-{
-}
-
-ColorMask *ColorMask::getOrCreate(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- return getOrCreateImpl(ColorMask(red, green, blue, alpha));
-}
-
-void BlendStateSeparate::apply(GraphicsContext *gc) const
+void ColorMask::updateProperty(const char *name, const QVariant &value)
{
- gc->openGLContext()->functions()->glEnable(GL_BLEND);
- gc->openGLContext()->functions()->glBlendFuncSeparate(m_1, m_2, m_3, m_4);
+ if (name == QByteArrayLiteral("red")) m_1 = value.toBool();
+ else if (name == QByteArrayLiteral("green")) m_2 = value.toBool();
+ else if (name == QByteArrayLiteral("blue")) m_3 = value.toBool();
+ else if (name == QByteArrayLiteral("alpha")) m_4 = value.toBool();
}
-BlendStateSeparate *BlendStateSeparate::getOrCreate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- return getOrCreateImpl(BlendStateSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha));
-}
-
-BlendStateSeparate::BlendStateSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
- : GenericState4<BlendStateSeparate, GLenum, GLenum, GLenum, GLenum>(srcRGB, dstRGB, srcAlpha, dstAlpha)
+void ClipPlane::apply(GraphicsContext *gc) const
{
+ gc->enableClipPlane(m_1);
+ gc->setClipPlane(m_1, m_2, m_3);
}
-void ClipPlane::apply(GraphicsContext *gc) const
+void ClipPlane::updateProperty(const char *name, const QVariant &value)
{
- gc->enableClipPlane(m_1);
+ if (name == QByteArrayLiteral("planeIndex")) m_1 = value.toInt();
+ else if (name == QByteArrayLiteral("normal")) m_2 = value.value<QVector3D>();
+ else if (name == QByteArrayLiteral("distance")) m_3 = value.toFloat();
}
-ClipPlane::ClipPlane(int plane)
- : GenericState1<ClipPlane, int>(plane)
+void SeamlessCubemap::apply(GraphicsContext *gc) const
{
+ gc->setSeamlessCubemap(m_1);
}
-ClipPlane *ClipPlane::getOrCreate(int plane)
+void SeamlessCubemap::updateProperty(const char *name, const QVariant &value)
{
- return getOrCreateImpl(ClipPlane(plane));
+ if (name == QByteArrayLiteral("enabled")) m_1 = value.toBool();
}
void StencilOp::apply(GraphicsContext *gc) const
@@ -316,30 +273,16 @@ void StencilOp::apply(GraphicsContext *gc) const
gc->openGLContext()->functions()->glStencilOpSeparate(GL_BACK, m_4, m_5, m_6);
}
-StencilOp *StencilOp::getOrCreate(GLenum fsfail, GLenum fdfail, GLenum fdspass, GLenum bsfail, GLenum bdfail, GLenum bdspass)
-{
- return getOrCreateImpl(StencilOp(fsfail, fdfail, fdspass, bsfail, bdfail, bdspass));
-}
-
-StencilOp::StencilOp(GLenum fsfail, GLenum fdfail, GLenum fdspass, GLenum bsfail, GLenum bdfail, GLenum bdspass)
- : GenericState6<StencilOp, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum>(fsfail, fdfail, fdspass, bsfail, bdfail, bdspass)
-{
-}
-
void StencilMask::apply(GraphicsContext *gc) const
{
gc->openGLContext()->functions()->glStencilMaskSeparate(GL_FRONT, m_1);
gc->openGLContext()->functions()->glStencilMaskSeparate(GL_BACK, m_2);
}
-StencilMask *StencilMask::getOrCreate(uint frontMask, uint backMask)
-{
- return getOrCreateImpl(StencilMask(frontMask, backMask));
-}
-
-StencilMask::StencilMask(uint frontMask, uint backMask)
- : GenericState2<StencilMask, uint, uint>(frontMask, backMask)
+void StencilMask::updateProperty(const char *name, const QVariant &value)
{
+ if (name == QByteArrayLiteral("frontMask")) m_1 = value.toInt();
+ else if (name == QByteArrayLiteral("backMask")) m_2 = value.toInt();
}
} // namespace Render
diff --git a/src/render/renderstates/renderstates.pri b/src/render/renderstates/renderstates.pri
index 554a0e666..85c5952ff 100644
--- a/src/render/renderstates/renderstates.pri
+++ b/src/render/renderstates/renderstates.pri
@@ -5,12 +5,10 @@ HEADERS += \
$$PWD/qalphacoverage.h \
$$PWD/qalphatest.h \
$$PWD/qblendequation.h \
- $$PWD/qblendstate.h \
+ $$PWD/qblendequationarguments.h \
$$PWD/qclipplane.h \
$$PWD/qcolormask.h \
$$PWD/qcullface.h \
- $$PWD/qdepthmask.h \
- $$PWD/qdepthtest.h \
$$PWD/qdithering.h \
$$PWD/qfrontface.h \
$$PWD/qpolygonoffset.h \
@@ -18,24 +16,46 @@ HEADERS += \
$$PWD/qrenderstate_p.h \
$$PWD/qscissortest.h \
$$PWD/qstencilmask.h \
- $$PWD/qstencilop.h \
- $$PWD/qstencilopseparate.h \
+ $$PWD/qstenciloperation.h \
+ $$PWD/qstenciloperationarguments.h \
$$PWD/qstenciltest.h \
- $$PWD/qstenciltestseparate.h \
+ $$PWD/qstenciltestarguments.h \
+ $$PWD/qrenderstatecreatedchange_p.h \
$$PWD/renderstates_p.h \
$$PWD/renderstateset_p.h \
- $$PWD/qpointsize.h
+ $$PWD/qpointsize.h \
+ $$PWD/renderstatecollection_p.h \
+ $$PWD/qseamlesscubemap.h \
+ $$PWD/qdepthtest.h \
+ $$PWD/qnodepthmask.h \
+ $$PWD/qalphatest_p.h \
+ $$PWD/qblendequation_p.h \
+ $$PWD/qblendequationarguments_p.h \
+ $$PWD/qclipplane_p.h \
+ $$PWD/qcolormask_p.h \
+ $$PWD/qcullface_p.h \
+ $$PWD/qdepthtest_p.h \
+ $$PWD/qfrontface_p.h \
+ $$PWD/qpointsize_p.h \
+ $$PWD/qpolygonoffset_p.h \
+ $$PWD/qscissortest_p.h \
+ $$PWD/qstencilmask_p.h \
+ $$PWD/qstenciloperation_p.h \
+ $$PWD/qstenciloperationarguments_p.h \
+ $$PWD/qstenciltest_p.h \
+ $$PWD/qstenciltestarguments_p.h \
+ $$PWD/renderstatenode_p.h \
+ $$PWD/qmultisampleantialiasing.h
SOURCES += \
$$PWD/qalphacoverage.cpp \
$$PWD/qalphatest.cpp \
$$PWD/qblendequation.cpp \
- $$PWD/qblendstate.cpp \
+ $$PWD/qblendequationarguments.cpp \
$$PWD/qclipplane.cpp \
$$PWD/qcolormask.cpp \
$$PWD/qcullface.cpp \
- $$PWD/qdepthmask.cpp \
$$PWD/qdepthtest.cpp \
$$PWD/qdithering.cpp \
$$PWD/qfrontface.cpp \
@@ -43,10 +63,16 @@ SOURCES += \
$$PWD/qrenderstate.cpp \
$$PWD/qscissortest.cpp \
$$PWD/qstencilmask.cpp \
- $$PWD/qstencilop.cpp \
- $$PWD/qstencilopseparate.cpp \
+ $$PWD/qstenciloperation.cpp \
+ $$PWD/qstenciloperationarguments.cpp \
$$PWD/qstenciltest.cpp \
- $$PWD/qstenciltestseparate.cpp \
+ $$PWD/qstenciltestarguments.cpp \
$$PWD/renderstates.cpp \
$$PWD/renderstateset.cpp \
- $$PWD/qpointsize.cpp
+ $$PWD/qpointsize.cpp \
+ $$PWD/renderstatecollection.cpp \
+ $$PWD/qseamlesscubemap.cpp \
+ $$PWD/qnodepthmask.cpp \
+ $$PWD/qrenderstatecreatedchange.cpp \
+ $$PWD/renderstatenode.cpp \
+ $$PWD/qmultisampleantialiasing.cpp
diff --git a/src/render/renderstates/renderstates_p.h b/src/render/renderstates/renderstates_p.h
index e2fada4ea..ad6ef4ad1 100644
--- a/src/render/renderstates/renderstates_p.h
+++ b/src/render/renderstates/renderstates_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -51,251 +54,182 @@
#include <Qt3DRender/private/genericstate_p.h>
-#include <QOpenGLContext>
-
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
namespace Render {
-class Q_AUTOTEST_EXPORT BlendState : public GenericState2<BlendState, GLenum, GLenum>
+template <class State, class S>
+State* getOrCreateRenderStateImpl(const S& m1)
{
-public:
- virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return BlendStateMask; }
+ State state;
+ state.set(m1);
+ return getOrCreateRenderStateEqualTo<State>(state);
+}
- static BlendState *getOrCreate(GLenum src, GLenum dst);
-private:
- BlendState(GLenum src, GLenum dst);
-};
+template <class State, class S, class T>
+State* getOrCreateRenderStateImpl(const S& m1, const T& m2)
+{
+ State state;
+ state.set(m1, m2);
+ return getOrCreateRenderStateEqualTo<State>(state);
+}
+
+template <class State, class S, class T, class U>
+State* getOrCreateRenderStateImpl(const S& m1, const T& m2, const U& m3)
+{
+ State state;
+ state.set(m1, m2, m3);
+ return getOrCreateRenderStateEqualTo<State>(state);
+}
-class Q_AUTOTEST_EXPORT BlendStateSeparate : public GenericState4<BlendStateSeparate, GLenum, GLenum, GLenum, GLenum>
+template <class State, class S, class T, class U, class V>
+State* getOrCreateRenderStateImpl(const S& m1, const T& m2, const U& m3, const V& m4)
+{
+ State state;
+ state.set(m1, m2, m3, m4);
+ return getOrCreateRenderStateEqualTo<State>(state);
+}
+
+template <class State, class S, class T, class U, class V, class W, class Z>
+State* getOrCreateRenderStateImpl(const S& m1, const T& m2, const U& m3, const V& m4, const W& m5, const Z& m6)
+{
+ State state;
+ state.set(m1, m2, m3, m4, m5, m6);
+ return getOrCreateRenderStateEqualTo<State>(state);
+}
+
+class Q_AUTOTEST_EXPORT BlendEquationArguments : public GenericState6<BlendEquationArguments, BlendStateMask, GLenum, GLenum, GLenum, GLenum, bool, int>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return BlendStateMask; }
-
- static BlendStateSeparate *getOrCreate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-private:
- BlendStateSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT BlendEquation : public GenericState1<BlendEquation, GLenum>
+class Q_AUTOTEST_EXPORT BlendEquation : public GenericState1<BlendEquation, BlendStateMask, GLenum>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
-
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return BlendStateMask; }
-
- static BlendEquation *getOrCreate(GLenum func);
-
-private:
- BlendEquation(GLenum func);
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT AlphaFunc : public GenericState2<AlphaFunc, GLenum, GLclampf>
+class Q_AUTOTEST_EXPORT AlphaFunc : public GenericState2<AlphaFunc, AlphaTestMask, GLenum, GLclampf>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
-
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return AlphaTestMask; }
-
- static AlphaFunc *getOrCreate(GLenum func, GLclampf value);
-private:
- AlphaFunc(GLenum func, GLclampf value);
};
-class Q_AUTOTEST_EXPORT DepthTest : public GenericState1<DepthTest, GLenum>
+class Q_AUTOTEST_EXPORT MSAAEnabled : public GenericState1<MSAAEnabled, MSAAEnabledStateMask, GLboolean>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
-
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return DepthTestStateMask; }
-
- static DepthTest *getOrCreate(GLenum func);
-
-private:
- DepthTest(GLenum func);
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT DepthMask : public GenericState1<DepthMask, GLboolean>
+class Q_AUTOTEST_EXPORT DepthTest : public GenericState1<DepthTest, DepthTestStateMask, GLenum>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
-
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return DepthWriteStateMask; }
-
- static DepthMask *getOrCreate(GLboolean func);
-
-private:
- DepthMask(GLboolean func);
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT CullFace : public GenericState1<CullFace, GLenum>
+class Q_AUTOTEST_EXPORT NoDepthMask : public GenericState1<NoDepthMask, DepthWriteStateMask, GLboolean>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
-
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return CullFaceStateMask; }
-
- static CullFace *getOrCreate(GLenum func);
-
-private:
- CullFace(GLenum func);
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT FrontFace : public GenericState1<FrontFace, GLenum>
+class Q_AUTOTEST_EXPORT CullFace : public GenericState1<CullFace, CullFaceStateMask, GLenum>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
-
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return FrontFaceStateMask; }
- static FrontFace *getOrCreate(GLenum func);
-
-private:
- FrontFace(GLenum func);
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT Dithering : public RenderState
+class Q_AUTOTEST_EXPORT FrontFace : public GenericState1<FrontFace, FrontFaceStateMask, GLenum>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return DitheringStateMask; }
-
- bool isEqual(const Dithering &) { return true; }
-
- static Dithering *getOrCreate();
-private:
- Dithering();
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT ScissorTest : public GenericState4<ScissorTest, int, int, int, int>
+class Q_AUTOTEST_EXPORT Dithering : public MaskedRenderState<Dithering, DitheringStateMask>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return ScissorStateMask; }
-
- static ScissorTest *getOrCreate(int left, int bottom, int width, int height);
-
-private:
- ScissorTest(int left, int bottom, int width, int height);
};
-class Q_AUTOTEST_EXPORT StencilTest : public GenericState6<StencilTest, GLenum, int, uint, GLenum, int, uint>
+class Q_AUTOTEST_EXPORT ScissorTest : public GenericState4<ScissorTest, ScissorStateMask, int, int, int, int>
{
public:
virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
- virtual StateMaskSet mask() const Q_DECL_OVERRIDE
- { return StencilTestStateMask; }
- static StencilTest *getOrCreate(GLenum frontFunc, int frontRef, uint frontMask, GLenum backFunc, int backRef, uint backMask);
+ bool isPooledImpl() const Q_DECL_NOEXCEPT Q_DECL_OVERRIDE { return false; }
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
+};
-private:
- StencilTest(GLenum frontFunc, int frontRef, uint frontMask, GLenum backFunc, int backRef, uint backMask);
+class Q_AUTOTEST_EXPORT StencilTest : public GenericState6<StencilTest, StencilTestStateMask, GLenum, int, uint, GLenum, int, uint>
+{
+public:
+ virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT AlphaCoverage : public RenderState
+class Q_AUTOTEST_EXPORT AlphaCoverage : public GenericState1<AlphaCoverage, AlphaCoverageStateMask, GLboolean>
{
public:
void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
- StateMaskSet mask() const Q_DECL_OVERRIDE
- { return AlphaCoverageStateMask; }
-
- bool isEqual(const AlphaCoverage &) { return true; }
-
- static AlphaCoverage *getOrCreate();
-
-private:
- AlphaCoverage();
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT PointSize : public GenericState2<PointSize, bool, GLfloat>
+class Q_AUTOTEST_EXPORT PointSize : public GenericState2<PointSize, PointSizeMask, bool, GLfloat>
{
public:
void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
- StateMaskSet mask() const Q_DECL_OVERRIDE
- { return PointSizeMask; }
-
- static PointSize *getOrCreate(bool programmable, GLfloat value);
-
-private:
- PointSize(bool programmable, GLfloat value);
+ bool isPooledImpl() const Q_DECL_NOEXCEPT Q_DECL_OVERRIDE { return false; }
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT PolygonOffset : public GenericState2<PolygonOffset, GLfloat, GLfloat>
+class Q_AUTOTEST_EXPORT PolygonOffset : public GenericState2<PolygonOffset, PolygonOffsetStateMask, GLfloat, GLfloat>
{
public:
void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
- StateMaskSet mask() const Q_DECL_OVERRIDE
- { return PolygonOffsetStateMask; }
-
- static PolygonOffset *getOrCreate(GLfloat factor, GLfloat units);
-
-private:
- PolygonOffset(GLfloat factor, GLfloat units);
+ bool isPooledImpl() const Q_DECL_NOEXCEPT Q_DECL_OVERRIDE { return false; }
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT ColorMask : public GenericState4<ColorMask, GLboolean, GLboolean, GLboolean, GLboolean>
+class Q_AUTOTEST_EXPORT ColorMask : public GenericState4<ColorMask, ColorStateMask, GLboolean, GLboolean, GLboolean, GLboolean>
{
public:
void apply(GraphicsContext *gc) const Q_DECL_FINAL;
- StateMaskSet mask() const Q_DECL_FINAL { return ColorStateMask; }
-
- static ColorMask *getOrCreate(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-
-private:
- ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT ClipPlane : public GenericState1<ClipPlane, int>
+class Q_AUTOTEST_EXPORT ClipPlane : public GenericState3<ClipPlane, ClipPlaneMask, int, QVector3D, float>
{
public:
void apply(GraphicsContext *gc) const Q_DECL_FINAL;
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
+};
- StateMaskSet mask() const Q_DECL_FINAL
- { return ClipPlaneMask; }
- static ClipPlane *getOrCreate(int plane);
-
-private:
- ClipPlane(int plane);
+class Q_AUTOTEST_EXPORT SeamlessCubemap : public GenericState1<SeamlessCubemap, SeamlessCubemapMask, GLboolean>
+{
+public:
+ virtual void apply(GraphicsContext *gc) const Q_DECL_OVERRIDE;
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
-class Q_AUTOTEST_EXPORT StencilOp : public GenericState6<StencilOp, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum>
+class Q_AUTOTEST_EXPORT StencilOp : public GenericState6<StencilOp, StencilOpMask, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum>
{
public:
void apply(GraphicsContext *gc) const Q_DECL_FINAL;
-
- StateMaskSet mask() const Q_DECL_FINAL
- { return StencilOpMask; }
- static StencilOp *getOrCreate(GLenum fsfail, GLenum fdfail, GLenum fdspass,
- GLenum bsfail, GLenum bdfail, GLenum bdspass);
-
-private:
- StencilOp(GLenum fsfail, GLenum fdfail, GLenum fdspass,
- GLenum bsfail, GLenum bdfail, GLenum bdspass);
};
-class Q_AUTOTEST_EXPORT StencilMask : public GenericState2<StencilMask, uint, uint>
+class Q_AUTOTEST_EXPORT StencilMask : public GenericState2<StencilMask, StencilWriteStateMask, uint, uint>
{
public:
void apply(GraphicsContext *gc) const Q_DECL_FINAL;
-
- StateMaskSet mask() const Q_DECL_FINAL
- { return StencilWriteStateMask; }
- static StencilMask *getOrCreate(uint frontMask, uint backMask);
-
-private:
- StencilMask(uint frontMask, uint backMask);
+ void updateProperty(const char *name, const QVariant &value) Q_DECL_OVERRIDE;
};
} // namespace Render
diff --git a/src/render/renderstates/renderstateset.cpp b/src/render/renderstates/renderstateset.cpp
index 1d2520177..42a6f7941 100644
--- a/src/render/renderstates/renderstateset.cpp
+++ b/src/render/renderstates/renderstateset.cpp
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -44,26 +47,45 @@
#include <Qt3DRender/private/graphicscontext_p.h>
#include <Qt3DRender/private/renderstates_p.h>
+#include <Qt3DRender/private/qrenderstate_p.h>
#include <Qt3DRender/qalphacoverage.h>
#include <Qt3DRender/qalphatest.h>
+#include <Qt3DRender/private/qalphatest_p.h>
#include <Qt3DRender/qblendequation.h>
-#include <Qt3DRender/qblendstate.h>
+#include <Qt3DRender/private/qblendequation_p.h>
+#include <Qt3DRender/qblendequationarguments.h>
+#include <Qt3DRender/private/qblendequationarguments_p.h>
#include <Qt3DRender/qcolormask.h>
+#include <Qt3DRender/private/qcolormask_p.h>
#include <Qt3DRender/qcullface.h>
-#include <Qt3DRender/qdepthmask.h>
+#include <Qt3DRender/private/qcullface_p.h>
+#include <Qt3DRender/qnodepthmask.h>
#include <Qt3DRender/qdepthtest.h>
+#include <Qt3DRender/private/qdepthtest_p.h>
#include <Qt3DRender/qdithering.h>
#include <Qt3DRender/qfrontface.h>
+#include <Qt3DRender/private/qfrontface_p.h>
#include <Qt3DRender/qpointsize.h>
+#include <Qt3DRender/private/qpointsize_p.h>
#include <Qt3DRender/qpolygonoffset.h>
+#include <Qt3DRender/private/qpolygonoffset_p.h>
#include <Qt3DRender/qscissortest.h>
+#include <Qt3DRender/private/qscissortest_p.h>
#include <Qt3DRender/qstenciltest.h>
-#include <Qt3DRender/qstenciltestseparate.h>
+#include <Qt3DRender/private/qstenciltest_p.h>
+#include <Qt3DRender/qstenciltestarguments.h>
+#include <Qt3DRender/private/qstenciltestarguments_p.h>
#include <Qt3DRender/qclipplane.h>
-#include <Qt3DRender/qstencilop.h>
-#include <Qt3DRender/qstencilopseparate.h>
+#include <Qt3DRender/private/qclipplane_p.h>
+#include <Qt3DRender/qmultisampleantialiasing.h>
+#include <Qt3DRender/qseamlesscubemap.h>
+#include <Qt3DRender/qstenciloperation.h>
+#include <Qt3DRender/private/qstenciloperation_p.h>
+#include <Qt3DRender/qstenciloperationarguments.h>
+#include <Qt3DRender/private/qstenciloperationarguments_p.h>
#include <Qt3DRender/qstencilmask.h>
+#include <Qt3DRender/private/qstencilmask_p.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +102,7 @@ RenderStateSet::~RenderStateSet()
{
}
-void RenderStateSet::addState(RenderState *ds)
+void RenderStateSet::addState(RenderStateImpl *ds)
{
Q_ASSERT(ds);
m_states.append(ds);
@@ -102,7 +124,7 @@ int RenderStateSet::changeCost(RenderStateSet *previousState)
cost += int(bs.count());
// now, find out how many states we're changing
- Q_FOREACH (RenderState* ds, m_states) {
+ for (RenderStateImpl *ds : qAsConst(m_states)) {
// if the other state contains matching, then doesn't
// contribute to cost at all
if (previousState->contains(ds)) {
@@ -136,7 +158,7 @@ void RenderStateSet::apply(GraphicsContext *gc)
if (m_cachedPrevious && previousStates == m_cachedPrevious) {
// state-change cache hit
- foreach (RenderState* ds, m_cachedDeltaStates) {
+ for (RenderStateImpl *ds : qAsConst(m_cachedDeltaStates)) {
ds->apply(gc);
}
} else {
@@ -144,7 +166,7 @@ void RenderStateSet::apply(GraphicsContext *gc)
m_cachedDeltaStates.clear();
m_cachedPrevious = previousStates;
- Q_FOREACH (RenderState* ds, m_states) {
+ for (RenderStateImpl *ds : qAsConst(m_states)) {
if (previousStates && previousStates->contains(ds)) {
continue;
}
@@ -208,7 +230,7 @@ void RenderStateSet::resetMasked(StateMaskSet maskOfStatesToReset, GraphicsConte
}
if (maskOfStatesToReset & AlphaCoverageStateMask) {
- gc->disableAlphaCoverage();
+ gc->setAlphaCoverageEnabled(false);
}
if (maskOfStatesToReset & PointSizeMask) {
@@ -229,113 +251,260 @@ void RenderStateSet::resetMasked(StateMaskSet maskOfStatesToReset, GraphicsConte
gc->disableClipPlane(i);
}
+ if (maskOfStatesToReset & SeamlessCubemapMask) {
+ gc->setSeamlessCubemap(false);
+ }
+
if (maskOfStatesToReset & StencilOpMask) {
funcs->glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}
}
-bool RenderStateSet::contains(RenderState *ds) const
+bool RenderStateSet::contains(RenderStateImpl *ds) const
{
// trivial reject using the state mask bits
if (!(ds->mask() & stateMask()))
return false;
- return m_states.contains(ds);
+ for (RenderStateImpl* rs : m_states) {
+ if (ds->equalTo(*rs))
+ return true;
+ }
+
+ return false;
}
-RenderState *RenderState::getOrCreateBackendState(QRenderState *renderState)
+
+RenderStateImpl* RenderStateImpl::getOrCreateState(QRenderState *renderState)
{
- switch (renderState->type()) {
- case QRenderState::AlphaTest: {
+ switch (QRenderStatePrivate::get(renderState)->m_type) {
+ case QRenderStatePrivate::AlphaTest: {
QAlphaTest *alphaTest = static_cast<QAlphaTest *>(renderState);
- return AlphaFunc::getOrCreate(alphaTest->func(), alphaTest->clamp());
+ return getOrCreateRenderStateImpl<AlphaFunc>(alphaTest->alphaFunction(), alphaTest->referenceValue());
}
- case QRenderState::BlendEquation: {
+ case QRenderStatePrivate::BlendEquation: {
QBlendEquation *blendEquation = static_cast<QBlendEquation *>(renderState);
- return BlendEquation::getOrCreate(blendEquation->mode());
+ return getOrCreateRenderStateImpl<BlendEquation>(blendEquation->blendFunction());
}
- case QRenderState::BlendState: {
- QBlendState *blendState = static_cast<QBlendState *>(renderState);
- return BlendState::getOrCreate(blendState->srcRGB(), blendState->dstRGB());
+ case QRenderStatePrivate::BlendEquationArguments: {
+ QBlendEquationArguments *blendState = static_cast<QBlendEquationArguments *>(renderState);
+ return getOrCreateRenderStateImpl<BlendEquationArguments>(blendState->sourceRgb(), blendState->destinationRgb(),
+ blendState->sourceAlpha(), blendState->destinationAlpha(),
+ blendState->isEnabled(),
+ blendState->bufferIndex());
}
- case QRenderState::BlendStateSeparate: {
- QBlendState *blendState = static_cast<QBlendState *>(renderState);
- return BlendStateSeparate::getOrCreate(blendState->srcRGB(), blendState->dstRGB(), blendState->srcAlpha(), blendState->dstAlpha());
+ case QRenderStatePrivate::MSAAEnabled: {
+ QMultiSampleAntiAliasing *setMSAAEnabled = static_cast<QMultiSampleAntiAliasing *>(renderState);
+ return getOrCreateRenderStateImpl<MSAAEnabled>(setMSAAEnabled->isEnabled());
}
- case QRenderState::CullFace: {
+ case QRenderStatePrivate::CullFace: {
QCullFace *cullFace = static_cast<QCullFace *>(renderState);
- return CullFace::getOrCreate(cullFace->mode());
+ return getOrCreateRenderStateImpl<CullFace>(cullFace->mode());
}
- case QRenderState::DepthMask: {
- QDepthMask *depthMask = static_cast<QDepthMask *>(renderState);
- return DepthMask::getOrCreate(depthMask->mask());
+ case QRenderStatePrivate::NoDepthMask: {
+ return getOrCreateRenderStateImpl<NoDepthMask>(false);
}
- case QRenderState::DepthTest: {
+ case QRenderStatePrivate::DepthTest: {
QDepthTest *depthTest = static_cast<QDepthTest *>(renderState);
- return DepthTest::getOrCreate(depthTest->func());
- }
- case QRenderState::Dithering: {
- return Dithering::getOrCreate();
+ return getOrCreateRenderStateImpl<DepthTest>(depthTest->depthFunction());
}
- case QRenderState::FrontFace: {
+ case QRenderStatePrivate::AlphaCoverage:
+ case QRenderStatePrivate::Dithering:
+ case QRenderStatePrivate::FrontFace: {
QFrontFace *frontFace = static_cast<QFrontFace *>(renderState);
- return FrontFace::getOrCreate(frontFace->direction());
+ return getOrCreateRenderStateImpl<FrontFace>(frontFace->direction());
}
- case QRenderState::ScissorTest: {
+ case QRenderStatePrivate::ScissorTest: {
QScissorTest *scissorTest = static_cast<QScissorTest *>(renderState);
- return ScissorTest::getOrCreate(scissorTest->left(),
+ return getOrCreateRenderStateImpl<ScissorTest>(scissorTest->left(),
scissorTest->bottom(),
scissorTest->width(),
scissorTest->height());
}
- case QRenderState::StencilTest: {
+ case QRenderStatePrivate::StencilTest: {
QStencilTest *stencilTest = static_cast<QStencilTest *>(renderState);
- return StencilTest::getOrCreate(stencilTest->front()->func(),
- stencilTest->front()->ref(),
- stencilTest->front()->mask(),
- stencilTest->back()->func(),
- stencilTest->back()->ref(),
- stencilTest->back()->mask());
- }
- case QRenderState::AlphaCoverage: {
- return AlphaCoverage::getOrCreate();
- }
- case QRenderState::PointSize: {
+ return getOrCreateRenderStateImpl<StencilTest>(stencilTest->front()->stencilFunction(),
+ stencilTest->front()->referenceValue(),
+ stencilTest->front()->comparisonMask(),
+ stencilTest->back()->stencilFunction(),
+ stencilTest->back()->referenceValue(),
+ stencilTest->back()->comparisonMask());
+ }
+ case QRenderStatePrivate::PointSize: {
QPointSize *pointSize = static_cast<QPointSize *>(renderState);
- return PointSize::getOrCreate(pointSize->isProgrammable(), pointSize->value());
+ const bool isProgrammable = (pointSize->sizeMode() == QPointSize::Programmable);
+ return getOrCreateRenderStateImpl<PointSize>(isProgrammable, pointSize->value());
}
- case QRenderState::PolygonOffset: {
+ case QRenderStatePrivate::PolygonOffset: {
QPolygonOffset *polygonOffset = static_cast<QPolygonOffset *>(renderState);
- return PolygonOffset::getOrCreate(polygonOffset->factor(),
- polygonOffset->units());
+ return getOrCreateRenderStateImpl<PolygonOffset>(polygonOffset->scaleFactor(),
+ polygonOffset->depthSteps());
}
- case QRenderState::ColorMask: {
+ case QRenderStatePrivate::ColorMask: {
QColorMask *colorMask = static_cast<QColorMask *>(renderState);
- return ColorMask::getOrCreate(colorMask->isRed(),
- colorMask->isGreen(),
- colorMask->isBlue(),
- colorMask->isAlpha());
+ return getOrCreateRenderStateImpl<ColorMask>(colorMask->isRedMasked(),
+ colorMask->isGreenMasked(),
+ colorMask->isBlueMasked(),
+ colorMask->isAlphaMasked());
}
- case QRenderState::ClipPlane: {
+ case QRenderStatePrivate::ClipPlane: {
QClipPlane *clipPlane = static_cast<QClipPlane *>(renderState);
- return ClipPlane::getOrCreate(clipPlane->plane());
+ return getOrCreateRenderStateImpl<ClipPlane>(clipPlane->planeIndex(),
+ clipPlane->normal(),
+ clipPlane->distance());
+ }
+ case QRenderStatePrivate::SeamlessCubemap: {
+ QSeamlessCubemap *seamlessCubemap = static_cast<QSeamlessCubemap *>(renderState);
+ return getOrCreateRenderStateImpl<SeamlessCubemap>(seamlessCubemap->isEnabled());
+ }
+ case QRenderStatePrivate::StencilOp: {
+ QStencilOperation *stencilOp = static_cast<QStencilOperation *>(renderState);
+ const QStencilOperationArguments *front = stencilOp->front();
+ const QStencilOperationArguments *back = stencilOp->back();
+ return getOrCreateRenderStateImpl<StencilOp>(front->stencilTestFailureOperation(), front->depthTestFailureOperation(), front->allTestsPassOperation(),
+ back->stencilTestFailureOperation(), back->depthTestFailureOperation(), back->allTestsPassOperation());
+ }
+ case QRenderStatePrivate::StencilMask: {
+ QStencilMask *stencilMask = static_cast<QStencilMask *>(renderState);
+ return getOrCreateRenderStateImpl<StencilMask>(stencilMask->frontOutputMask(), stencilMask->backOutputMask());
+ }
+
+ default:
+ Q_UNREACHABLE();
+ qFatal("Should not happen");
+ return nullptr;
}
- case QRenderState::StencilOp: {
- QStencilOp *stencilOp = static_cast<QStencilOp *>(renderState);
- const QStencilOpSeparate *front = stencilOp->front();
- const QStencilOpSeparate *back = stencilOp->back();
- return StencilOp::getOrCreate(front->stencilFail(), front->depthFail(), front->stencilDepthPass(),
- back->stencilFail(), back->depthFail(), back->stencilDepthPass());
+}
+
+RenderStateImpl* RenderStateImpl::getOrCreateState(const Qt3DRender::QRenderStateCreatedChangeBasePtr change)
+{
+ switch (change->renderStateType()) {
+ case QRenderStatePrivate::AlphaCoverage: {
+ return getOrCreateRenderStateImpl<AlphaCoverage>(change->isNodeEnabled());
}
- case QRenderState::StencilMask: {
- QStencilMask *stencilMask = static_cast<QStencilMask *>(renderState);
- return StencilMask::getOrCreate(stencilMask->frontMask(), stencilMask->backMask());
+
+ case QRenderStatePrivate::AlphaTest: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QAlphaTestData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<AlphaFunc>(data.alphaFunction, data.referenceValue);
+ }
+
+ case QRenderStatePrivate::BlendEquation: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QBlendEquationData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<BlendEquation>(data.blendFunction);
+ }
+
+ case QRenderStatePrivate::BlendEquationArguments: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QBlendEquationArgumentsData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<BlendEquationArguments>(
+ data.sourceRgb, data.destinationRgb,
+ data.sourceAlpha, data.destinationAlpha,
+ change->isNodeEnabled(),
+ data.bufferIndex);
+ }
+
+ case QRenderStatePrivate::MSAAEnabled: {
+ return getOrCreateRenderStateImpl<MSAAEnabled>(change->isNodeEnabled());
+ }
+
+ case QRenderStatePrivate::CullFace: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QCullFaceData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<CullFace>(data.mode);
+ }
+
+ case QRenderStatePrivate::NoDepthMask: {
+ return getOrCreateRenderStateImpl<NoDepthMask>(false);
+ }
+
+ case QRenderStatePrivate::DepthTest: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QDepthTestData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<DepthTest>(data.depthFunction);
+ }
+
+ // TODO: Fix Dithering state
+ case QRenderStatePrivate::Dithering:
+ case QRenderStatePrivate::FrontFace: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QFrontFaceData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<FrontFace>(data.direction);
+ }
+
+ case QRenderStatePrivate::ScissorTest: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QScissorTestData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<ScissorTest>(data.left, data.bottom,
+ data.width, data.height);
+ }
+
+ case QRenderStatePrivate::StencilTest: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QStencilTestData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<StencilTest>(data.front.stencilFunction,
+ data.front.referenceValue,
+ data.front.comparisonMask,
+ data.back.stencilFunction,
+ data.back.referenceValue,
+ data.back.comparisonMask);
+ }
+
+ case QRenderStatePrivate::PointSize: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QPointSizeData>>(change);
+ const auto &data = typedChange->data;
+ const bool isProgrammable = (data.sizeMode == QPointSize::Programmable);
+ return getOrCreateRenderStateImpl<PointSize>(isProgrammable, data.value);
+ }
+
+ case QRenderStatePrivate::PolygonOffset: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QPolygonOffsetData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<PolygonOffset>(data.scaleFactor, data.depthSteps);
+ }
+
+ case QRenderStatePrivate::ColorMask: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QColorMaskData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<ColorMask>(data.redMasked, data.greenMasked,
+ data.blueMasked, data.alphaMasked);
+ }
+
+ case QRenderStatePrivate::ClipPlane: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QClipPlaneData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<ClipPlane>(data.planeIndex,
+ data.normal,
+ data.distance);
+ }
+
+ case QRenderStatePrivate::SeamlessCubemap: {
+ return getOrCreateRenderStateImpl<SeamlessCubemap>(change->isNodeEnabled());
+ }
+
+ case QRenderStatePrivate::StencilOp: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QStencilOperationData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<StencilOp>(data.front.stencilTestFailureOperation,
+ data.front.depthTestFailureOperation,
+ data.front.allTestsPassOperation,
+ data.back.stencilTestFailureOperation,
+ data.back.depthTestFailureOperation,
+ data.back.allTestsPassOperation);
+ }
+
+ case QRenderStatePrivate::StencilMask: {
+ const auto typedChange = qSharedPointerCast<Qt3DRender::QRenderStateCreatedChange<QStencilMaskData>>(change);
+ const auto &data = typedChange->data;
+ return getOrCreateRenderStateImpl<StencilMask>(data.frontOutputMask,
+ data.backOutputMask);
}
default:
Q_UNREACHABLE();
qFatal("Should not happen");
- return Q_NULLPTR;
+ return nullptr;
}
}
diff --git a/src/render/renderstates/renderstateset_p.h b/src/render/renderstates/renderstateset_p.h
index 33862db2b..a82cb20f0 100644
--- a/src/render/renderstates/renderstateset_p.h
+++ b/src/render/renderstates/renderstateset_p.h
@@ -1,35 +1,38 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -69,7 +72,7 @@ public:
RenderStateSet();
~RenderStateSet();
- void addState(RenderState* ds);
+ void addState(RenderStateImpl* ds);
/**
* @brief changeCost - metric of cost to change to this state-set from
@@ -91,14 +94,14 @@ private:
* @param ds
* @return
*/
- bool contains(RenderState* ds) const;
+ bool contains(RenderStateImpl* ds) const;
- QVector<RenderState*> m_states;
+ QVector<RenderStateImpl*> m_states;
StateMaskSet m_stateMask;
RenderStateSet* m_cachedPrevious;
- QVector<RenderState*> m_cachedDeltaStates;
+ QVector<RenderStateImpl*> m_cachedDeltaStates;
};
} // namespace Render
diff --git a/src/render/services/vsyncframeadvanceservice.cpp b/src/render/services/vsyncframeadvanceservice.cpp
index fc166d752..533b0fba1 100644
--- a/src/render/services/vsyncframeadvanceservice.cpp
+++ b/src/render/services/vsyncframeadvanceservice.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -97,8 +100,7 @@ void VSyncFrameAdvanceService::start()
void VSyncFrameAdvanceService::stop()
{
Q_D(VSyncFrameAdvanceService);
- if (d->m_semaphore.available() == 0)
- d->m_semaphore.release(1);
+ d->m_semaphore.release(1);
qCDebug(VSyncAdvanceService) << "Terminating VSyncFrameAdvanceService";
}
diff --git a/src/render/services/vsyncframeadvanceservice_p.h b/src/render/services/vsyncframeadvanceservice_p.h
index 2ff1d273a..98daebf81 100644
--- a/src/render/services/vsyncframeadvanceservice_p.h
+++ b/src/render/services/vsyncframeadvanceservice_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/render/shaders/es2/light.inc.frag b/src/render/shaders/es2/light.inc.frag
deleted file mode 100644
index 33714afc2..000000000
--- a/src/render/shaders/es2/light.inc.frag
+++ /dev/null
@@ -1,131 +0,0 @@
-const int MAX_LIGHTS = 8;
-const int TYPE_POINT = 0;
-const int TYPE_DIRECTIONAL = 1;
-const int TYPE_SPOT = 2;
-struct Light {
- int type;
- FP vec3 position;
- FP vec3 color;
- FP float intensity;
- FP vec3 direction;
- FP vec3 attenuation;
- FP float cutOffAngle;
-};
-uniform Light lights[MAX_LIGHTS];
-uniform int lightCount;
-
-void adsModelNormalMapped(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess,
- const in FP mat3 tangentMatrix,
- out FP vec3 diffuseColor, out FP vec3 specularColor)
-{
- diffuseColor = vec3(0.0);
- specularColor = vec3(0.0);
-
- FP vec3 n = normalize( vnormal );
-
- int i;
- FP vec3 s;
- for (i = 0; i < lightCount; ++i) {
- FP float att = 1.0;
- if ( lights[i].type != TYPE_DIRECTIONAL ) {
- s = tangentMatrix * ( lights[i].position - vpos );
- if (length( lights[i].attenuation ) != 0.0) {
- FP float dist = length(s);
- att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( lights[i].type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
- att = 0.0;
- }
- } else {
- s = normalize( tangentMatrix * -lights[i].direction );
- }
-
- FP float diffuse = max( dot( s, n ), 0.0 );
-
- FP float specular = 0.0;
- if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
- FP vec3 r = reflect( -s, n );
- FP vec3 v = normalize( tangentMatrix * ( eye - vpos ) );
- FP float normFactor = ( shininess + 2.0 ) / 2.0;
- specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
- }
-
- diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
- specularColor += att * specular;
- }
-}
-
-void adsModel(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess,
- out FP vec3 diffuseColor, out FP vec3 specularColor)
-{
- diffuseColor = vec3(0.0);
- specularColor = vec3(0.0);
-
- FP vec3 n = normalize( vnormal );
-
- int i;
- FP vec3 s;
- for (i = 0; i < lightCount; ++i) {
- FP float att = 1.0;
- if ( lights[i].type != TYPE_DIRECTIONAL ) {
- s = lights[i].position - vpos;
- if (length( lights[i].attenuation ) != 0.0) {
- FP float dist = length(s);
- att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( lights[i].type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
- att = 0.0;
- }
- } else {
- s = normalize( -lights[i].direction );
- }
-
- FP float diffuse = max( dot( s, n ), 0.0 );
-
- FP float specular = 0.0;
- if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
- FP vec3 r = reflect( -s, n );
- FP vec3 v = normalize( eye - vpos );
- FP float normFactor = ( shininess + 2.0 ) / 2.0;
- specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
- }
-
- diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
- specularColor += att * specular;
- }
-}
-
-void adModel(const in FP vec3 vpos, const in FP vec3 vnormal, out FP vec3 diffuseColor)
-{
- diffuseColor = vec3(0.0);
-
- FP vec3 n = normalize( vnormal );
-
- int i;
- FP vec3 s;
- for (i = 0; i < lightCount; ++i) {
- FP float att = 1.0;
- if ( lights[i].type != TYPE_DIRECTIONAL ) {
- s = lights[i].position - vpos;
- if (length( lights[i].attenuation ) != 0.0) {
- FP float dist = length(s);
- att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( lights[i].type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
- att = 0.0;
- }
- } else {
- s = normalize( -lights[i].direction );
- }
-
- FP float diffuse = max( dot( s, n ), 0.0 );
-
- diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
- }
-}
diff --git a/src/render/shaders/gl3/light.inc.frag b/src/render/shaders/gl3/light.inc.frag
deleted file mode 100644
index d3cce2edc..000000000
--- a/src/render/shaders/gl3/light.inc.frag
+++ /dev/null
@@ -1,131 +0,0 @@
-const int MAX_LIGHTS = 8;
-const int TYPE_POINT = 0;
-const int TYPE_DIRECTIONAL = 1;
-const int TYPE_SPOT = 2;
-struct Light {
- int type;
- vec3 position;
- vec3 color;
- float intensity;
- vec3 direction;
- vec3 attenuation;
- float cutOffAngle;
-};
-uniform Light lights[MAX_LIGHTS];
-uniform int lightCount;
-
-void adsModelNormalMapped(const in vec3 vpos, const in vec3 vnormal, const in vec3 eye, const in float shininess,
- const in mat3 tangentMatrix,
- out vec3 diffuseColor, out vec3 specularColor)
-{
- diffuseColor = vec3(0.0);
- specularColor = vec3(0.0);
-
- vec3 n = normalize( vnormal );
-
- int i;
- vec3 s;
- for (i = 0; i < lightCount; ++i) {
- float att = 1.0;
- if ( lights[i].type != TYPE_DIRECTIONAL ) {
- s = tangentMatrix * ( lights[i].position - vpos );
- if (length( lights[i].attenuation ) != 0.0) {
- float dist = length(s);
- att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( lights[i].type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
- att = 0.0;
- }
- } else {
- s = normalize( tangentMatrix * -lights[i].direction );
- }
-
- float diffuse = max( dot( s, n ), 0.0 );
-
- float specular = 0.0;
- if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
- vec3 r = reflect( -s, n );
- vec3 v = normalize( tangentMatrix * ( eye - vpos ) );
- float normFactor = ( shininess + 2.0 ) / 2.0;
- specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
- }
-
- diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
- specularColor += att * specular;
- }
-}
-
-void adsModel(const in vec3 vpos, const in vec3 vnormal, const in vec3 eye, const in float shininess,
- out vec3 diffuseColor, out vec3 specularColor)
-{
- diffuseColor = vec3(0.0);
- specularColor = vec3(0.0);
-
- vec3 n = normalize( vnormal );
-
- int i;
- vec3 s;
- for (i = 0; i < lightCount; ++i) {
- float att = 1.0;
- if ( lights[i].type != TYPE_DIRECTIONAL ) {
- s = lights[i].position - vpos;
- if (length( lights[i].attenuation ) != 0.0) {
- float dist = length(s);
- att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( lights[i].type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
- att = 0.0;
- }
- } else {
- s = normalize( -lights[i].direction );
- }
-
- float diffuse = max( dot( s, n ), 0.0 );
-
- float specular = 0.0;
- if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
- vec3 r = reflect( -s, n );
- vec3 v = normalize( eye - vpos );
- float normFactor = ( shininess + 2.0 ) / 2.0;
- specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
- }
-
- diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
- specularColor += att * specular;
- }
-}
-
-void adModel(const in vec3 vpos, const in vec3 vnormal, out vec3 diffuseColor)
-{
- diffuseColor = vec3(0.0);
-
- vec3 n = normalize( vnormal );
-
- int i;
- vec3 s;
- for (i = 0; i < lightCount; ++i) {
- float att = 1.0;
- if ( lights[i].type != TYPE_DIRECTIONAL ) {
- s = lights[i].position - vpos;
- if (length( lights[i].attenuation ) != 0.0) {
- float dist = length(s);
- att = 1.0 / (lights[i].attenuation.x + lights[i].attenuation.y * dist + lights[i].attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( lights[i].type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(lights[i].direction))) ) > lights[i].cutOffAngle)
- att = 0.0;
- }
- } else {
- s = normalize( -lights[i].direction );
- }
-
- float diffuse = max( dot( s, n ), 0.0 );
-
- diffuseColor += att * lights[i].intensity * diffuse * lights[i].color;
- }
-}
diff --git a/src/render/texture/qabstracttexture.cpp b/src/render/texture/qabstracttexture.cpp
new file mode 100644
index 000000000..557498b5c
--- /dev/null
+++ b/src/render/texture/qabstracttexture.cpp
@@ -0,0 +1,509 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qabstracttexture.h"
+#include "qabstracttexture_p.h"
+#include <Qt3DRender/qabstracttextureimage.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace Qt3DCore;
+
+namespace Qt3DRender {
+
+QAbstractTexturePrivate::QAbstractTexturePrivate()
+ : QNodePrivate()
+ , m_target(QAbstractTexture::Target2D)
+ , m_format(QAbstractTexture::Automatic)
+ , m_width(1)
+ , m_height(1)
+ , m_depth(1)
+ , m_autoMipMap(false)
+ , m_minFilter(QAbstractTexture::Nearest)
+ , m_magFilter(QAbstractTexture::Nearest)
+ , m_status(QAbstractTexture::None)
+ , m_maximumAnisotropy(1.0f)
+ , m_comparisonFunction(QAbstractTexture::CompareLessEqual)
+ , m_comparisonMode(QAbstractTexture::CompareNone)
+ , m_layers(1)
+{
+}
+
+/*!
+ \class Qt3DRender::QAbstractTexture
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A base class to be used to provide textures.
+
+ The QAbstractTexture class shouldn't be used directly but rather
+ through one of its subclasses. Each subclass implements a given texture
+ target (2D, 2DArray, 3D, CubeMap ...) Each subclass provides a set of
+ functors for each layer, cube map face and mipmap level. In turn the
+ backend uses those functor to properly fill a corresponding OpenGL texture
+ with data.
+ */
+
+QAbstractTexture::QAbstractTexture(QNode *parent)
+ : QNode(*new QAbstractTexturePrivate, parent)
+{
+}
+
+QAbstractTexture::QAbstractTexture(Target target, QNode *parent)
+ : QNode(*new QAbstractTexturePrivate, parent)
+{
+ d_func()->m_target = target;
+}
+
+/*! \internal */
+QAbstractTexture::~QAbstractTexture()
+{
+}
+
+/*! \internal */
+QAbstractTexture::QAbstractTexture(QAbstractTexturePrivate &dd, QNode *parent)
+ : QNode(dd, parent)
+{
+}
+
+/*!
+ Sets the size of the texture provider to width \a w, height \a h and depth \a d.
+ */
+void QAbstractTexture::setSize(int w, int h, int d)
+{
+ setWidth(w);
+ setHeight(h);
+ setDepth(d);
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::width
+
+ Holds the width of the texture provider.
+ */
+void QAbstractTexture::setWidth(int width)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_width != width) {
+ d->m_width = width;
+ emit widthChanged(width);
+ }
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::height
+
+ Holds the height of the texture provider.
+ */
+void QAbstractTexture::setHeight(int height)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_height != height) {
+ d->m_height = height;
+ emit heightChanged(height);
+ }
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::depth
+
+ Holds the depth of the texture provider.
+ */
+void QAbstractTexture::setDepth(int depth)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_depth != depth) {
+ d->m_depth = depth;
+ emit depthChanged(depth);
+ }
+}
+
+int QAbstractTexture::width() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_width;
+}
+
+int QAbstractTexture::height() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_height;
+}
+
+int QAbstractTexture::depth() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_depth;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::layers
+
+ Holds the maximum layer count of the texture provider. By default, the
+ maximum layer count is 1.
+
+ \note this has a meaning only for texture providers that have 3D or
+ array target formats.
+ */
+void QAbstractTexture::setLayers(int layers)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_layers != layers) {
+ d->m_layers = layers;
+ emit layersChanged(layers);
+ }
+}
+
+/*!
+ Returns the maximum number of layers for the texture provider.
+
+ \note this has a meaning only for texture providers that have 3D or
+ array target formats.
+ */
+int QAbstractTexture::layers() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_layers;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::format
+
+ Holds the format of the texture provider.
+ */
+void QAbstractTexture::setFormat(TextureFormat format)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_format != format) {
+ d->m_format = format;
+ emit formatChanged(format);
+ }
+}
+
+/*!
+ Return the texture provider's format.
+ */
+QAbstractTexture::TextureFormat QAbstractTexture::format() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_format;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::status readonly
+
+ Holds the current status of the texture provider.
+ */
+void QAbstractTexture::setStatus(Status status)
+{
+ Q_D(QAbstractTexture);
+ if (status != d->m_status) {
+ d->m_status = status;
+ emit statusChanged(status);
+ }
+}
+
+QAbstractTexture::Status QAbstractTexture::status() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_status;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::target readonly
+
+ Holds the target format of the texture provider.
+
+ \note The target format can only be set once.
+ */
+QAbstractTexture::Target QAbstractTexture::target() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_target;
+}
+
+/*!
+ Adds a new Qt3DCore::QAbstractTextureImage \a textureImage to the texture provider.
+
+ \note Qt3DRender::QAbstractTextureImage should never be shared between multiple
+ Qt3DRender::QAbstractTexture instances.
+ */
+void QAbstractTexture::addTextureImage(QAbstractTextureImage *textureImage)
+{
+ Q_ASSERT(textureImage);
+ Q_D(QAbstractTexture);
+ if (!d->m_textureImages.contains(textureImage)) {
+ d->m_textureImages.append(textureImage);
+
+
+ if (textureImage->parent() && textureImage->parent() != this)
+ qWarning() << "A QAbstractTextureImage was shared, expect a crash, undefined behavior at best";
+ // We need to add it as a child of the current node if it has been declared inline
+ // Or not previously added as a child of the current node so that
+ // 1) The backend gets notified about it's creation
+ // 2) When the current node is destroyed, it gets destroyed as well
+ if (!textureImage->parent())
+ textureImage->setParent(this);
+
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeAddedChangePtr::create(id(), textureImage);
+ change->setPropertyName("textureImage");
+ d->notifyObservers(change);
+ }
+ }
+}
+
+/*!
+ Removes a Qt3DCore::QAbstractTextureImage \a textureImage from the texture provider.
+ */
+void QAbstractTexture::removeTextureImage(QAbstractTextureImage *textureImage)
+{
+ Q_ASSERT(textureImage);
+ Q_D(QAbstractTexture);
+ if (d->m_changeArbiter != nullptr) {
+ const auto change = QPropertyNodeRemovedChangePtr::create(id(), textureImage);
+ change->setPropertyName("textureImage");
+ d->notifyObservers(change);
+ }
+ d->m_textureImages.removeOne(textureImage);
+}
+
+/*!
+ Returns a list of pointers to QAbstractTextureImage objects contained in
+ the texture provider.
+ */
+QVector<QAbstractTextureImage *> QAbstractTexture::textureImages() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_textureImages;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::generateMipMaps
+
+ Holds whether the texture provider should auto generate mipmaps.
+ */
+void QAbstractTexture::setGenerateMipMaps(bool gen)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_autoMipMap != gen) {
+ d->m_autoMipMap = gen;
+ emit generateMipMapsChanged(gen);
+ }
+}
+
+bool QAbstractTexture::generateMipMaps() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_autoMipMap;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::minificationFilter
+
+ Holds the minification filter of the texture provider.
+ */
+void QAbstractTexture::setMinificationFilter(Filter f)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_minFilter != f) {
+ d->m_minFilter = f;
+ emit minificationFilterChanged(f);
+ }
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::magnificationFilter
+
+ Holds the magnification filter of the texture provider.
+ */
+void QAbstractTexture::setMagnificationFilter(Filter f)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_magFilter != f) {
+ d->m_magFilter = f;
+ emit magnificationFilterChanged(f);
+ }
+}
+
+QAbstractTexture::Filter QAbstractTexture::minificationFilter() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_minFilter;
+}
+
+QAbstractTexture::Filter QAbstractTexture::magnificationFilter() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_magFilter;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::wrapMode
+
+ Holds the wrap mode of the texture provider.
+ */
+void QAbstractTexture::setWrapMode(const QTextureWrapMode &wrapMode)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_wrapMode.x() != wrapMode.x()) {
+ d->m_wrapMode.setX(wrapMode.x());
+ auto e = QPropertyUpdatedChangePtr::create(d->m_id);
+ e->setPropertyName("wrapModeX");
+ e->setValue(static_cast<int>(d->m_wrapMode.x()));
+ d->notifyObservers(e);
+ }
+ if (d->m_wrapMode.y() != wrapMode.y()) {
+ d->m_wrapMode.setY(wrapMode.y());
+ auto e = QPropertyUpdatedChangePtr::create(d->m_id);
+ e->setPropertyName("wrapModeY");
+ e->setValue(static_cast<int>(d->m_wrapMode.y()));
+ d->notifyObservers(e);
+ }
+ if (d->m_wrapMode.z() != wrapMode.z()) {
+ d->m_wrapMode.setZ(wrapMode.z());
+ auto e = QPropertyUpdatedChangePtr::create(d->m_id);
+ e->setPropertyName("wrapModeZ");
+ e->setValue(static_cast<int>(d->m_wrapMode.z()));
+ d->notifyObservers(e);
+ }
+}
+
+QTextureWrapMode *QAbstractTexture::wrapMode()
+{
+ Q_D(QAbstractTexture);
+ return &d->m_wrapMode;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::maximumAnisotropy
+
+ Holds the maximum anisotropy of the texture provider.
+ */
+void QAbstractTexture::setMaximumAnisotropy(float anisotropy)
+{
+ Q_D(QAbstractTexture);
+ if (!qFuzzyCompare(d->m_maximumAnisotropy, anisotropy)) {
+ d->m_maximumAnisotropy = anisotropy;
+ emit maximumAnisotropyChanged(anisotropy);
+ }
+}
+
+float QAbstractTexture::maximumAnisotropy() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_maximumAnisotropy;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::comparisonFunction
+
+ Holds the comparison function of the texture provider.
+ */
+void QAbstractTexture::setComparisonFunction(QAbstractTexture::ComparisonFunction function)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_comparisonFunction != function) {
+ d->m_comparisonFunction = function;
+ emit comparisonFunctionChanged(function);
+ }
+}
+
+QAbstractTexture::ComparisonFunction QAbstractTexture::comparisonFunction() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_comparisonFunction;
+}
+
+/*!
+ \property Qt3DRender::QAbstractTexture::comparisonMode
+
+ Holds the comparison mode of the texture provider.
+ */
+void QAbstractTexture::setComparisonMode(QAbstractTexture::ComparisonMode mode)
+{
+ Q_D(QAbstractTexture);
+ if (d->m_comparisonMode != mode) {
+ d->m_comparisonMode = mode;
+ emit comparisonModeChanged(mode);
+ }
+}
+
+QAbstractTexture::ComparisonMode QAbstractTexture::comparisonMode() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_comparisonMode;
+}
+
+QTextureImageDataGeneratorPtr QAbstractTexture::dataGenerator() const
+{
+ Q_D(const QAbstractTexture);
+ return d->m_dataFunctor;
+}
+
+Qt3DCore::QNodeCreatedChangeBasePtr QAbstractTexture::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAbstractTextureData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QAbstractTexture);
+ data.target = d->m_target;
+ data.format = d->m_format;
+ data.width = d->m_width;
+ data.height = d->m_height;
+ data.depth = d->m_depth;
+ data.autoMipMap = d->m_autoMipMap;
+ data.minFilter = d->m_minFilter;
+ data.magFilter = d->m_magFilter;
+ data.wrapModeX = d->m_wrapMode.x();
+ data.wrapModeY = d->m_wrapMode.y();
+ data.wrapModeZ = d->m_wrapMode.z();
+ data.maximumAnisotropy = d->m_maximumAnisotropy;
+ data.comparisonFunction = d->m_comparisonFunction;
+ data.comparisonMode = d->m_comparisonMode;
+ data.textureImageIds = qIdsForNodes(d->m_textureImages);
+ data.layers = d->m_layers;
+ data.dataFunctor = d->m_dataFunctor;
+ return creationChange;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/texture/qabstracttexture.h b/src/render/texture/qabstracttexture.h
new file mode 100644
index 000000000..854c19b75
--- /dev/null
+++ b/src/render/texture/qabstracttexture.h
@@ -0,0 +1,344 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QABSTRACTTEXTURE_H
+#define QT3DRENDER_QABSTRACTTEXTURE_H
+
+#include <Qt3DRender/qtextureimagedata.h>
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractTexturePrivate;
+class QTextureWrapMode;
+class QAbstractTextureImage;
+class QTextureImageDataGenerator;
+
+typedef QSharedPointer<QTextureImageDataGenerator> QTextureImageDataGeneratorPtr;
+
+class QT3DRENDERSHARED_EXPORT QAbstractTexture : public Qt3DCore::QNode
+{
+ Q_OBJECT
+ Q_PROPERTY(Target target READ target CONSTANT)
+ Q_PROPERTY(TextureFormat format READ format WRITE setFormat NOTIFY formatChanged)
+ Q_PROPERTY(bool generateMipMaps READ generateMipMaps WRITE setGenerateMipMaps NOTIFY generateMipMapsChanged)
+ Q_PROPERTY(Qt3DRender::QTextureWrapMode *wrapMode READ wrapMode CONSTANT)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
+ Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
+ Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
+ Q_PROPERTY(int depth READ depth WRITE setDepth NOTIFY depthChanged)
+ Q_PROPERTY(Filter magnificationFilter READ magnificationFilter WRITE setMagnificationFilter NOTIFY magnificationFilterChanged)
+ Q_PROPERTY(Filter minificationFilter READ minificationFilter WRITE setMinificationFilter NOTIFY minificationFilterChanged)
+ Q_PROPERTY(float maximumAnisotropy READ maximumAnisotropy WRITE setMaximumAnisotropy NOTIFY maximumAnisotropyChanged)
+ Q_PROPERTY(ComparisonFunction comparisonFunction READ comparisonFunction WRITE setComparisonFunction NOTIFY comparisonFunctionChanged)
+ Q_PROPERTY(ComparisonMode comparisonMode READ comparisonMode WRITE setComparisonMode NOTIFY comparisonModeChanged)
+ Q_PROPERTY(int layers READ layers WRITE setLayers NOTIFY layersChanged)
+
+public:
+
+ enum Status {
+ None = 0,
+ Loading,
+ Ready,
+ Error
+ };
+ Q_ENUM(Status)
+
+ enum Target {
+ TargetAutomatic = 0, // Target will be determined by the Qt3D engine
+ Target1D = 0x0DE0, // GL_TEXTURE_1D
+ Target1DArray = 0x8C18, // GL_TEXTURE_1D_ARRAY
+ Target2D = 0x0DE1, // GL_TEXTURE_2D
+ Target2DArray = 0x8C1A, // GL_TEXTURE_2D_ARRAY
+ Target3D = 0x806F, // GL_TEXTURE_3D
+ TargetCubeMap = 0x8513, // GL_TEXTURE_CUBE_MAP
+ TargetCubeMapArray = 0x9009, // GL_TEXTURE_CUBE_MAP_ARRAY
+ Target2DMultisample = 0x9100, // GL_TEXTURE_2D_MULTISAMPLE
+ Target2DMultisampleArray = 0x9102, // GL_TEXTURE_2D_MULTISAMPLE_ARRAY
+ TargetRectangle = 0x84F5, // GL_TEXTURE_RECTANGLE
+ TargetBuffer = 0x8C2A // GL_TEXTURE_BUFFER
+ };
+ Q_ENUM(Target)
+
+ enum TextureFormat {
+ NoFormat = 0, // GL_NONE
+ Automatic = 1, // The Qt3D engine automatically determines the best format
+
+ // Unsigned normalized formats
+ R8_UNorm = 0x8229, // GL_R8
+ RG8_UNorm = 0x822B, // GL_RG8
+ RGB8_UNorm = 0x8051, // GL_RGB8
+ RGBA8_UNorm = 0x8058, // GL_RGBA8
+
+ R16_UNorm = 0x822A, // GL_R16
+ RG16_UNorm = 0x822C, // GL_RG16
+ RGB16_UNorm = 0x8054, // GL_RGB16
+ RGBA16_UNorm = 0x805B, // GL_RGBA16
+
+ // Signed normalized formats
+ R8_SNorm = 0x8F94, // GL_R8_SNORM
+ RG8_SNorm = 0x8F95, // GL_RG8_SNORM
+ RGB8_SNorm = 0x8F96, // GL_RGB8_SNORM
+ RGBA8_SNorm = 0x8F97, // GL_RGBA8_SNORM
+
+ R16_SNorm = 0x8F98, // GL_R16_SNORM
+ RG16_SNorm = 0x8F99, // GL_RG16_SNORM
+ RGB16_SNorm = 0x8F9A, // GL_RGB16_SNORM
+ RGBA16_SNorm = 0x8F9B, // GL_RGBA16_SNORM
+
+ // Unsigned integer formats
+ R8U = 0x8232, // GL_R8UI
+ RG8U = 0x8238, // GL_RG8UI
+ RGB8U = 0x8D7D, // GL_RGB8UI
+ RGBA8U = 0x8D7C, // GL_RGBA8UI
+
+ R16U = 0x8234, // GL_R16UI
+ RG16U = 0x823A, // GL_RG16UI
+ RGB16U = 0x8D77, // GL_RGB16UI
+ RGBA16U = 0x8D76, // GL_RGBA16UI
+
+ R32U = 0x8236, // GL_R32UI
+ RG32U = 0x823C, // GL_RG32UI
+ RGB32U = 0x8D71, // GL_RGB32UI
+ RGBA32U = 0x8D70, // GL_RGBA32UI
+
+ // Signed integer formats
+ R8I = 0x8231, // GL_R8I
+ RG8I = 0x8237, // GL_RG8I
+ RGB8I = 0x8D8F, // GL_RGB8I
+ RGBA8I = 0x8D8E, // GL_RGBA8I
+
+ R16I = 0x8233, // GL_R16I
+ RG16I = 0x8239, // GL_RG16I
+ RGB16I = 0x8D89, // GL_RGB16I
+ RGBA16I = 0x8D88, // GL_RGBA16I
+
+ R32I = 0x8235, // GL_R32I
+ RG32I = 0x823B, // GL_RG32I
+ RGB32I = 0x8D83, // GL_RGB32I
+ RGBA32I = 0x8D82, // GL_RGBA32I
+
+ // Floating point formats
+ R16F = 0x822D, // GL_R16F
+ RG16F = 0x822F, // GL_RG16F
+ RGB16F = 0x881B, // GL_RGB16F
+ RGBA16F = 0x881A, // GL_RGBA16F
+
+ R32F = 0x822E, // GL_R32F
+ RG32F = 0x8230, // GL_RG32F
+ RGB32F = 0x8815, // GL_RGB32F
+ RGBA32F = 0x8814, // GL_RGBA32F
+
+ // Packed formats
+ RGB9E5 = 0x8C3D, // GL_RGB9_E5
+ RG11B10F = 0x8C3A, // GL_R11F_G11F_B10F
+ RG3B2 = 0x2A10, // GL_R3_G3_B2
+ R5G6B5 = 0x8D62, // GL_RGB565
+ RGB5A1 = 0x8057, // GL_RGB5_A1
+ RGBA4 = 0x8056, // GL_RGBA4
+ RGB10A2 = 0x906F, // GL_RGB10_A2UI
+
+ // Depth formats
+ D16 = 0x81A5, // GL_DEPTH_COMPONENT16
+ D24 = 0x81A6, // GL_DEPTH_COMPONENT24
+ D24S8 = 0x88F0, // GL_DEPTH24_STENCIL8
+ D32 = 0x81A7, // GL_DEPTH_COMPONENT32
+ D32F = 0x8CAC, // GL_DEPTH_COMPONENT32F
+ D32FS8X24 = 0x8CAD, // GL_DEPTH32F_STENCIL8
+
+ // Compressed formats
+ RGB_DXT1 = 0x83F0, // GL_COMPRESSED_RGB_S3TC_DXT1_EXT
+ RGBA_DXT1 = 0x83F1, // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
+ RGBA_DXT3 = 0x83F2, // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
+ RGBA_DXT5 = 0x83F3, // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
+ R_ATI1N_UNorm = 0x8DBB, // GL_COMPRESSED_RED_RGTC1
+ R_ATI1N_SNorm = 0x8DBC, // GL_COMPRESSED_SIGNED_RED_RGTC1
+ RG_ATI2N_UNorm = 0x8DBD, // GL_COMPRESSED_RG_RGTC2
+ RG_ATI2N_SNorm = 0x8DBE, // GL_COMPRESSED_SIGNED_RG_RGTC2
+ RGB_BP_UNSIGNED_FLOAT = 0x8E8F, // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
+ RGB_BP_SIGNED_FLOAT = 0x8E8E, // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
+ RGB_BP_UNorm = 0x8E8C, // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
+ R11_EAC_UNorm = 0x9270, // GL_COMPRESSED_R11_EAC
+ R11_EAC_SNorm = 0x9271, // GL_COMPRESSED_SIGNED_R11_EAC
+ RG11_EAC_UNorm = 0x9272, // GL_COMPRESSED_RG11_EAC
+ RG11_EAC_SNorm = 0x9273, // GL_COMPRESSED_SIGNED_RG11_EAC
+ RGB8_ETC2 = 0x9274, // GL_COMPRESSED_RGB8_ETC2
+ SRGB8_ETC2 = 0x9275, // GL_COMPRESSED_SRGB8_ETC2
+ RGB8_PunchThrough_Alpha1_ETC2 = 0x9276, // GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
+ SRGB8_PunchThrough_Alpha1_ETC2 = 0x9277, // GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
+ RGBA8_ETC2_EAC = 0x9278, // GL_COMPRESSED_RGBA8_ETC2_EAC
+ SRGB8_Alpha8_ETC2_EAC = 0x9279, // GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
+ RGB8_ETC1 = 0x8D64, // GL_ETC1_RGB8_OES
+
+ // sRGB formats
+ SRGB8 = 0x8C41, // GL_SRGB8
+ SRGB8_Alpha8 = 0x8C43, // GL_SRGB8_ALPHA8
+ SRGB_DXT1 = 0x8C4C, // GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
+ SRGB_Alpha_DXT1 = 0x8C4D, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
+ SRGB_Alpha_DXT3 = 0x8C4E, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
+ SRGB_Alpha_DXT5 = 0x8C4F, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
+ SRGB_BP_UNorm = 0x8E8D, // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
+
+ // ES 2 formats
+ DepthFormat = 0x1902, // GL_DEPTH_COMPONENT
+ AlphaFormat = 0x1906, // GL_ALPHA
+ RGBFormat = 0x1907, // GL_RGB
+ RGBAFormat = 0x1908, // GL_RGBA
+ LuminanceFormat = 0x1909, // GL_LUMINANCE
+ LuminanceAlphaFormat = 0x190A
+ };
+ Q_ENUM(TextureFormat)
+
+ enum Filter {
+ Nearest = 0x2600, // GL_NEAREST
+ Linear = 0x2601, // GL_LINEAR
+ NearestMipMapNearest = 0x2700, // GL_NEAREST_MIPMAP_NEAREST
+ NearestMipMapLinear = 0x2702, // GL_NEAREST_MIPMAP_LINEAR
+ LinearMipMapNearest = 0x2701, // GL_LINEAR_MIPMAP_NEAREST
+ LinearMipMapLinear = 0x2703 // GL_LINEAR_MIPMAP_LINEAR
+ };
+ Q_ENUM(Filter)
+
+ enum CubeMapFace {
+ CubeMapPositiveX = 0x8515, // GL_TEXTURE_CUBE_MAP_POSITIVE_X
+ CubeMapNegativeX = 0x8516, // GL_TEXTURE_CUBE_MAP_NEGATIVE_X
+ CubeMapPositiveY = 0x8517, // GL_TEXTURE_CUBE_MAP_POSITIVE_Y
+ CubeMapNegativeY = 0x8518, // GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
+ CubeMapPositiveZ = 0x8519, // GL_TEXTURE_CUBE_MAP_POSITIVE_Z
+ CubeMapNegativeZ = 0x851A // GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
+ };
+ Q_ENUM(CubeMapFace)
+
+ enum ComparisonFunction {
+ CompareLessEqual = 0x0203, // GL_LEQUAL
+ CompareGreaterEqual = 0x0206, // GL_GEQUAL
+ CompareLess = 0x0201, // GL_LESS
+ CompareGreater = 0x0204, // GL_GREATER
+ CompareEqual = 0x0202, // GL_EQUAL
+ CommpareNotEqual = 0x0205, // GL_NOTEQUAL
+ CompareAlways = 0x0207, // GL_ALWAYS
+ CompareNever = 0x0200 // GL_NEVER
+ };
+ Q_ENUM(ComparisonFunction)
+
+ enum ComparisonMode {
+ CompareRefToTexture = 0x884E, // GL_COMPARE_REF_TO_TEXTURE
+ CompareNone = 0x0000 // GL_NONE
+ };
+ Q_ENUM(ComparisonMode)
+
+ ~QAbstractTexture();
+
+ Target target() const;
+
+ TextureFormat format() const;
+ bool generateMipMaps() const;
+
+ Status status() const;
+
+ void addTextureImage(QAbstractTextureImage *textureImage);
+ void removeTextureImage(QAbstractTextureImage *textureImage);
+ QVector<QAbstractTextureImage *> textureImages() const;
+
+ // sampler data - in the future proxy to a Sampler helper
+ void setWrapMode(const QTextureWrapMode &wrapMode);
+ QTextureWrapMode *wrapMode();
+
+ void setSize(int width, int height=1, int depth=1);
+
+ Filter minificationFilter() const;
+ Filter magnificationFilter() const;
+ float maximumAnisotropy() const;
+ ComparisonFunction comparisonFunction() const;
+ ComparisonMode comparisonMode() const;
+ int width() const;
+ int height() const;
+ int depth() const;
+ int layers() const;
+ QTextureImageDataGeneratorPtr dataGenerator() const;
+
+public Q_SLOTS:
+ void setFormat(TextureFormat format);
+ void setGenerateMipMaps(bool gen);
+ void setWidth(int width);
+ void setHeight(int height);
+ void setDepth(int depth);
+ void setMinificationFilter(Filter f);
+ void setMagnificationFilter(Filter f);
+ void setMaximumAnisotropy(float anisotropy);
+ void setComparisonFunction(ComparisonFunction function);
+ void setComparisonMode(ComparisonMode mode);
+ void setLayers(int layers);
+
+Q_SIGNALS:
+ void formatChanged(TextureFormat format);
+ void statusChanged(Status status);
+ void generateMipMapsChanged(bool generateMipMaps);
+ void widthChanged(int width);
+ void heightChanged(int height);
+ void depthChanged(int depth);
+ void magnificationFilterChanged(Filter magnificationFilter);
+ void minificationFilterChanged(Filter minificationFilter);
+ void maximumAnisotropyChanged(float maximumAnisotropy);
+ void comparisonFunctionChanged(ComparisonFunction comparisonFunction);
+ void comparisonModeChanged(ComparisonMode comparisonMode);
+ void layersChanged(int layers);
+
+protected:
+ explicit QAbstractTexture(Qt3DCore::QNode *parent = nullptr);
+ explicit QAbstractTexture(Target target, Qt3DCore::QNode *parent = nullptr);
+ explicit QAbstractTexture(QAbstractTexturePrivate &dd, Qt3DCore::QNode *parent = nullptr);
+
+ void setStatus(Status status);
+
+private:
+ Q_DECLARE_PRIVATE(QAbstractTexture)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(Qt3DRender::QAbstractTexture *)
+
+#endif // QT3DRENDER_QABSTRACTTEXTURE_H
diff --git a/src/render/texture/qabstracttexture_p.h b/src/render/texture/qabstracttexture_p.h
new file mode 100644
index 000000000..3bc895e57
--- /dev/null
+++ b/src/render/texture/qabstracttexture_p.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QABSTRACTTEXTURE_P_H
+#define QT3DRENDER_QABSTRACTTEXTURE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DRender/qabstracttexture.h>
+#include <Qt3DRender/qtexturewrapmode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QAbstractTexturePrivate : public Qt3DCore::QNodePrivate
+{
+public :
+ QAbstractTexturePrivate();
+
+ Q_DECLARE_PUBLIC(QAbstractTexture)
+
+ QAbstractTexture::Target m_target;
+ QAbstractTexture::TextureFormat m_format;
+ int m_width, m_height, m_depth;
+ bool m_autoMipMap;
+
+ QVector<QTextureImageDataPtr> m_data;
+
+ QAbstractTexture::Filter m_minFilter, m_magFilter;
+ // FIXME, store per direction
+ QTextureWrapMode m_wrapMode;
+ QAbstractTexture::Status m_status;
+ float m_maximumAnisotropy;
+ QAbstractTexture::ComparisonFunction m_comparisonFunction;
+ QAbstractTexture::ComparisonMode m_comparisonMode;
+ QVector<QAbstractTextureImage *> m_textureImages;
+ int m_layers;
+
+ QTextureImageDataGeneratorPtr m_dataFunctor;
+};
+
+struct QAbstractTextureData
+{
+ QAbstractTexture::Target target;
+ QAbstractTexture::TextureFormat format;
+ int width;
+ int height;
+ int depth;
+ bool autoMipMap;
+ QAbstractTexture::Filter minFilter;
+ QAbstractTexture::Filter magFilter;
+ QTextureWrapMode::WrapMode wrapModeX;
+ QTextureWrapMode::WrapMode wrapModeY;
+ QTextureWrapMode::WrapMode wrapModeZ;
+ float maximumAnisotropy;
+ QAbstractTexture::ComparisonFunction comparisonFunction;
+ QAbstractTexture::ComparisonMode comparisonMode;
+ Qt3DCore::QNodeIdVector textureImageIds;
+ int layers;
+ QTextureImageDataGeneratorPtr dataFunctor;
+};
+
+} // QT3D
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QABSTRACTTEXTURE_P_H
+
diff --git a/src/render/texture/qabstracttextureimage.cpp b/src/render/texture/qabstracttextureimage.cpp
index 3b60b4d65..d8cc89f87 100644
--- a/src/render/texture/qabstracttextureimage.cpp
+++ b/src/render/texture/qabstracttextureimage.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +39,7 @@
#include "qabstracttextureimage.h"
#include "qabstracttextureimage_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -44,6 +47,17 @@ using namespace Qt3DCore;
namespace Qt3DRender {
+QAbstractTextureImagePrivate::QAbstractTextureImagePrivate()
+ : QNodePrivate(),
+ m_mipLevel(0),
+ m_layer(0),
+ m_face(QAbstractTexture::CubeMapPositiveX)
+{
+}
+
+QAbstractTextureImagePrivate::~QAbstractTextureImagePrivate()
+{
+}
/*!
\qmltype AbstractTextureImage
@@ -62,10 +76,10 @@ namespace Qt3DRender {
\brief Encapsulates the necessary information to create an OpenGL texture image.
QAbstractTextureImage should be used as the means of providing image data to a
- QAbstractTextureProvider. It contains the necessary information: mipmap
+ QAbstractTexture. It contains the necessary information: mipmap
level, layer, cube face load at the proper place data into an OpenGL texture.
- The actual data is provided through a QTextureDataFunctor that will be
+ The actual data is provided through a QTextureImageDataGenerator that will be
executed by Aspect jobs in the backend. QAbstractTextureImage should be
subclassed to provide a functor and eventual additional properties needed by
the functor to load actual data.
@@ -87,25 +101,24 @@ QAbstractTextureImage::QAbstractTextureImage(QNode *parent)
*/
QAbstractTextureImage::~QAbstractTextureImage()
{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QAbstractTextureImage subclass didn't call QNode::cleanup in its destructor");
}
/*!
- \qmlproperty int Qt3D.Render::AbstractTextureImage::mipmapLevel
+ \qmlproperty int Qt3D.Render::AbstractTextureImage::mipLevel
Holds the mipmap level of the texture image.
*/
/*!
- \property Qt3DRender::QAbstractTextureImage::mipmapLevel
+ \property Qt3DRender::QAbstractTextureImage::mipLevel
Holds the mipmap level of the texture image.
*/
-int QAbstractTextureImage::mipmapLevel() const
+int QAbstractTextureImage::mipLevel() const
{
Q_D(const QAbstractTextureImage);
- return d->m_mipmapLevel;
+ return d->m_mipLevel;
}
/*!
@@ -126,7 +139,7 @@ int QAbstractTextureImage::layer() const
}
/*!
- \qmlproperty enumeration Qt3D.Render::AbstractTextureImage::cubeMapFace
+ \qmlproperty enumeration Qt3D.Render::AbstractTextureImage::face
Holds the cube map face of the texture image.
@@ -138,31 +151,31 @@ int QAbstractTextureImage::layer() const
\value CubeMapNegativeZ 0x851A GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
\note The cube map face has a meaning only for
- \l [CPP] {Qt3DRender::QAbstractTextureProvider::}{TargetCubeMap} and
- \l [CPP] {Qt3DRender::QAbstractTextureProvider::}{TargetCubeMapArray}.
+ \l [CPP] {Qt3DRender::QAbstractTexture::}{TargetCubeMap} and
+ \l [CPP] {Qt3DRender::QAbstractTexture::}{TargetCubeMapArray}.
*/
/*!
- \property Qt3DRender::QAbstractTextureImage::cubeMapFace
+ \property Qt3DRender::QAbstractTextureImage::face
Holds the cube map face of the texture image.
\note The cube map face has a meaning only for
- \l {QAbstractTextureProvider::}{TargetCubeMap} and
- \l {QAbstractTextureProvider::}{TargetCubeMapArray}.
+ \l {QAbstractTexture::}{TargetCubeMap} and
+ \l {QAbstractTexture::}{TargetCubeMapArray}.
*/
-QAbstractTextureProvider::CubeMapFace QAbstractTextureImage::cubeMapFace() const
+QAbstractTexture::CubeMapFace QAbstractTextureImage::face() const
{
Q_D(const QAbstractTextureImage);
return d->m_face;
}
-void QAbstractTextureImage::setMipmapLevel(int level)
+void QAbstractTextureImage::setMipLevel(int level)
{
Q_D(QAbstractTextureImage);
- if (level != d->m_mipmapLevel) {
- d->m_mipmapLevel = level;
- emit mipmapLevelChanged(level);
+ if (level != d->m_mipLevel) {
+ d->m_mipLevel = level;
+ emit mipLevelChanged(level);
}
}
@@ -175,46 +188,47 @@ void QAbstractTextureImage::setLayer(int layer)
}
}
-void QAbstractTextureImage::setCubeMapFace(QAbstractTextureProvider::CubeMapFace face)
+void QAbstractTextureImage::setFace(QAbstractTexture::CubeMapFace face)
{
Q_D(QAbstractTextureImage);
if (face != d->m_face) {
d->m_face = face;
- emit cubeMapFaceChanged(face);
+ emit faceChanged(face);
}
}
/*!
- Triggers an update of the data functor that is sent to the backend.
+ Triggers an update of the data generator that is sent to the backend.
*/
-void QAbstractTextureImage::update()
+void QAbstractTextureImage::notifyDataGeneratorChanged()
{
Q_D(QAbstractTextureImage);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
- change->setPropertyName("dataFunctor");
- change->setValue(QVariant::fromValue(dataFunctor()));
+ if (d->m_changeArbiter != nullptr) {
+ auto change = QPropertyUpdatedChangePtr::create(d->m_id);
+ change->setPropertyName("dataGenerator");
+ change->setValue(QVariant::fromValue(dataGenerator()));
d->notifyObservers(change);
}
}
-/*!
- Copies \a ref into this object.
- */
-void QAbstractTextureImage::copy(const QNode *ref)
-{
- const QAbstractTextureImage *imageRef = static_cast<const QAbstractTextureImage *>(ref);
- d_func()->m_face = imageRef->cubeMapFace();
- d_func()->m_layer = imageRef->layer();
- d_func()->m_mipmapLevel = imageRef->mipmapLevel();
-}
-
/*! \internal */
QAbstractTextureImage::QAbstractTextureImage(QAbstractTextureImagePrivate &dd, QNode *parent)
: QNode(dd, parent)
{
}
+Qt3DCore::QNodeCreatedChangeBasePtr QAbstractTextureImage::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAbstractTextureImageData>::create(this);
+ auto &data = creationChange->data;
+ Q_D(const QAbstractTextureImage);
+ data.mipLevel = d->m_mipLevel;
+ data.layer = d->m_layer;
+ data.face = d->m_face;
+ data.generator = dataGenerator();
+ return creationChange;
+}
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/texture/qabstracttextureimage.h b/src/render/texture/qabstracttextureimage.h
index 8fecb29ec..a63ba0bba 100644
--- a/src/render/texture/qabstracttextureimage.h
+++ b/src/render/texture/qabstracttextureimage.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,67 +41,71 @@
#define QT3DRENDER_QABSTRACTTEXTUREIMAGE_H
#include <Qt3DRender/qabstractfunctor.h>
-#include <Qt3DRender/qabstracttextureprovider.h>
+#include <Qt3DRender/qabstracttexture.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+namespace Render {
+class TextureImage;
+}
+
// TO DO TexImageDataPtr -> QImageDataPtr + d_ptr
// We might also get rid of the layer, face, mipmap level from
// TexImageDataPtr and store that in the functor directly
// or use the QTextureImage instead
-class QT3DRENDERSHARED_EXPORT QTextureDataFunctor : public QAbstractFunctor
+class QT3DRENDERSHARED_EXPORT QTextureImageDataGenerator : public QAbstractFunctor
{
public:
- virtual ~QTextureDataFunctor() {}
- virtual QTexImageDataPtr operator()() = 0;
- virtual bool operator ==(const QTextureDataFunctor &other) const = 0;
+ virtual ~QTextureImageDataGenerator() {}
+ virtual QTextureImageDataPtr operator()() = 0;
+ virtual bool operator ==(const QTextureImageDataGenerator &other) const = 0;
};
-typedef QSharedPointer<QTextureDataFunctor> QTextureDataFunctorPtr;
+typedef QSharedPointer<QTextureImageDataGenerator> QTextureImageDataGeneratorPtr;
class QAbstractTextureImagePrivate;
class QT3DRENDERSHARED_EXPORT QAbstractTextureImage : public Qt3DCore::QNode
{
Q_OBJECT
- Q_PROPERTY(int mipmapLevel READ mipmapLevel WRITE setMipmapLevel NOTIFY mipmapLevelChanged)
+ Q_PROPERTY(int mipLevel READ mipLevel WRITE setMipLevel NOTIFY mipLevelChanged)
Q_PROPERTY(int layer READ layer WRITE setLayer NOTIFY layerChanged)
- Q_PROPERTY(Qt3DRender::QAbstractTextureProvider::CubeMapFace cubeMapFace READ cubeMapFace WRITE setCubeMapFace NOTIFY cubeMapFaceChanged)
+ Q_PROPERTY(Qt3DRender::QAbstractTexture::CubeMapFace face READ face WRITE setFace NOTIFY faceChanged)
public:
- explicit QAbstractTextureImage(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QAbstractTextureImage(Qt3DCore::QNode *parent = nullptr);
virtual ~QAbstractTextureImage();
- int mipmapLevel() const;
+ int mipLevel() const;
int layer() const;
- QAbstractTextureProvider::CubeMapFace cubeMapFace() const;
-
- void update();
- virtual QTextureDataFunctorPtr dataFunctor() const = 0;
+ QAbstractTexture::CubeMapFace face() const;
public Q_SLOTS:
- void setMipmapLevel(int level);
+ void setMipLevel(int level);
void setLayer(int layer);
- void setCubeMapFace(QAbstractTextureProvider::CubeMapFace face);
+ void setFace(QAbstractTexture::CubeMapFace face);
Q_SIGNALS:
- void mipmapLevelChanged(int mipmapLevel);
+ void mipLevelChanged(int mipLevel);
void layerChanged(int layer);
- void cubeMapFaceChanged(QAbstractTextureProvider::CubeMapFace cubeMapFace);
+ void faceChanged(QAbstractTexture::CubeMapFace face);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- QAbstractTextureImage(QAbstractTextureImagePrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
+ void notifyDataGeneratorChanged();
+ virtual QTextureImageDataGeneratorPtr dataGenerator() const = 0;
+ explicit QAbstractTextureImage(QAbstractTextureImagePrivate &dd, Qt3DCore::QNode *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QAbstractTextureImage)
+ friend class Render::TextureImage;
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
QT_END_NAMESPACE
-Q_DECLARE_METATYPE(Qt3DRender::QTextureDataFunctorPtr)
+Q_DECLARE_METATYPE(Qt3DRender::QTextureImageDataGeneratorPtr)
#endif // QT3DRENDER_QABSTRACTTEXTUREIMAGE_H
diff --git a/src/render/texture/qabstracttextureimage_p.h b/src/render/texture/qabstracttextureimage_p.h
index e3529c428..f0d836055 100644
--- a/src/render/texture/qabstracttextureimage_p.h
+++ b/src/render/texture/qabstracttextureimage_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DRender/private/qt3drender_global_p.h>
-#include <Qt3DRender/qabstracttextureprovider.h>
+#include <Qt3DRender/qabstracttexture.h>
QT_BEGIN_NAMESPACE
@@ -61,19 +64,22 @@ class QAbstractTextureImage;
class QT3DRENDERSHARED_PRIVATE_EXPORT QAbstractTextureImagePrivate : public Qt3DCore::QNodePrivate
{
public:
- QAbstractTextureImagePrivate()
- : QNodePrivate()
- , m_mipmapLevel(0)
- , m_layer(0)
- , m_face(QAbstractTextureProvider::CubeMapPositiveX)
- {
- }
+ QAbstractTextureImagePrivate();
+ ~QAbstractTextureImagePrivate();
Q_DECLARE_PUBLIC(QAbstractTextureImage)
- int m_mipmapLevel;
+ int m_mipLevel;
int m_layer;
- QAbstractTextureProvider::CubeMapFace m_face;
+ QAbstractTexture::CubeMapFace m_face;
+};
+
+struct QAbstractTextureImageData
+{
+ int mipLevel;
+ int layer;
+ QAbstractTexture::CubeMapFace face;
+ QTextureImageDataGeneratorPtr generator;
};
} // namespace Qt3DRender
diff --git a/src/render/texture/qabstracttextureprovider.cpp b/src/render/texture/qabstracttextureprovider.cpp
deleted file mode 100644
index 544158d4a..000000000
--- a/src/render/texture/qabstracttextureprovider.cpp
+++ /dev/null
@@ -1,530 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstracttextureprovider.h"
-#include "qabstracttextureprovider_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qabstracttextureimage.h>
-
-QT_BEGIN_NAMESPACE
-
-using namespace Qt3DCore;
-
-namespace Qt3DRender {
-
-QAbstractTextureProviderPrivate::QAbstractTextureProviderPrivate()
- : QNodePrivate()
- , m_target(QAbstractTextureProvider::Target2D)
- , m_format(QAbstractTextureProvider::Automatic)
- , m_width(1)
- , m_height(1)
- , m_depth(1)
- , m_autoMipMap(false)
- , m_minFilter(QAbstractTextureProvider::Nearest)
- , m_magFilter(QAbstractTextureProvider::Nearest)
- , m_status(QAbstractTextureProvider::Loading)
- , m_maximumAnisotropy(1.0f)
- , m_comparisonFunction(QAbstractTextureProvider::CompareLessEqual)
- , m_comparisonMode(QAbstractTextureProvider::CompareNone)
- , m_maximumLayers(1)
- , m_unique(false)
-{
-}
-
-void QAbstractTextureProvider::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QAbstractTextureProvider *t = static_cast<const QAbstractTextureProvider*>(ref);
- d_func()->m_target = t->d_func()->m_target;
- d_func()->m_width = t->d_func()->m_width;
- d_func()->m_height = t->d_func()->m_height;
- d_func()->m_depth = t->d_func()->m_depth;
- d_func()->m_format = t->d_func()->m_format;
- d_func()->m_wrapMode.setX(t->d_func()->m_wrapMode.x());
- d_func()->m_wrapMode.setY(t->d_func()->m_wrapMode.y());
- d_func()->m_wrapMode.setZ(t->d_func()->m_wrapMode.z());
- d_func()->m_minFilter = t->d_func()->m_minFilter;
- d_func()->m_magFilter = t->d_func()->m_magFilter;
- d_func()->m_autoMipMap = t->d_func()->m_autoMipMap;
- d_func()->m_maximumAnisotropy = t->d_func()->m_maximumAnisotropy;
- d_func()->m_comparisonFunction = t->d_func()->m_comparisonFunction;
- d_func()->m_comparisonMode = t->d_func()->m_comparisonMode;
- d_func()->m_maximumLayers = t->d_func()->m_maximumLayers;
-}
-
-/*!
- \class Qt3DRender::QAbstractTextureProvider
- \inmodule Qt3DRender
- \since 5.5
- \brief A base class to be used to provide textures.
-
- The QAbstractTextureProvider class shouldn't be used directly but rather
- through one of its subclasses. Each subclass implements a given texture
- target (2D, 2DArray, 3D, CubeMap ...) Each subclass provides a set of
- functors for each layer, cube map face and mipmap level. In turn the
- backend uses those functor to properly fill a corresponding OpenGL texture
- with data.
- */
-
-QAbstractTextureProvider::QAbstractTextureProvider(QNode *parent)
- : QNode(*new QAbstractTextureProviderPrivate, parent)
-{
-}
-
-QAbstractTextureProvider::QAbstractTextureProvider(Target target, QNode *parent)
- : QNode(*new QAbstractTextureProviderPrivate, parent)
-{
- d_func()->m_target = target;
-}
-
-/*! \internal */
-QAbstractTextureProvider::QAbstractTextureProvider(QAbstractTextureProviderPrivate &dd, QNode *parent)
- : QNode(dd, parent)
-{
-}
-
-QAbstractTextureProvider::~QAbstractTextureProvider()
-{
- // The subclasses of QAbstractTextureProvider are only there to set the type on a QTextureProvider
- // QNode::cleanup needs to be handled here and not in the subclasses.
- QNode::cleanup();
-}
-
-/*!
- Sets the size of the texture provider to width \a w, height \a h and depth \a d.
- */
-void QAbstractTextureProvider::setSize(int w, int h, int d)
-{
- setWidth(w);
- setHeight(h);
- setDepth(d);
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::width
-
- Holds the width of the texture provider.
- */
-void QAbstractTextureProvider::setWidth(int width)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_width != width) {
- d->m_width = width;
- emit widthChanged(width);
- }
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::height
-
- Holds the height of the texture provider.
- */
-void QAbstractTextureProvider::setHeight(int height)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_height != height) {
- d->m_height = height;
- emit heightChanged(height);
- }
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::depth
-
- Holds the depth of the texture provider.
- */
-void QAbstractTextureProvider::setDepth(int depth)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_depth != depth) {
- d->m_depth = depth;
- emit depthChanged(depth);
- }
-}
-
-int QAbstractTextureProvider::width() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_width;
-}
-
-int QAbstractTextureProvider::height() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_height;
-}
-
-int QAbstractTextureProvider::depth() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_depth;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::maximumLayers
-
- Holds the maximum layer count of the texture provider. By default, the
- maximum layer count is 1.
-
- \note this has a meaning only for texture providers that have 3D or
- array target formats.
- */
-void QAbstractTextureProvider::setMaximumLayers(int maximumLayers)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_maximumLayers != maximumLayers) {
- d->m_maximumLayers = maximumLayers;
- emit maximumLayersChanged(maximumLayers);
- }
-}
-
-/*!
- Returns the maximum number of layers for the texture provider.
-
- \note this has a meaning only for texture providers that have 3D or
- array target formats.
- */
-int QAbstractTextureProvider::maximumLayers() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_maximumLayers;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::unique
-
- Sets whether this texture provider should be unique by reading \a unique.
- By default this is false.
-
- By default the renderer based on the attributes of texture providers is
- able to compare them and detect duplicates (same size, format and image
- sources) and smartly avoid unnecessary computations. In some cases however
- (texture providers used as Qt3DCore::RenderTarget attachments) you don't want
- the renderer to perform these comparison, in which case you can set is
- unique to true.
- */
-void QAbstractTextureProvider::setUnique(bool unique)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_unique != unique) {
- d->m_unique = unique;
- emit uniqueChanged(unique);
- }
-}
-
-/*!
- Returns whether the texture should be shared with other textures in the
- renderer or not. Defaults to false as this allow in most cases the renderer
- to be faster.
- */
-bool QAbstractTextureProvider::isUnique() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_unique;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::format
-
- Holds the format of the texture provider.
- */
-void QAbstractTextureProvider::setFormat(TextureFormat format)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_format != format) {
- d->m_format = format;
- emit formatChanged(format);
- }
-}
-
-/*!
- Return the texture provider's format.
- */
-QAbstractTextureProvider::TextureFormat QAbstractTextureProvider::format() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_format;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::status readonly
-
- Holds the current status of the texture provider.
- */
-void QAbstractTextureProvider::setStatus(Status status)
-{
- Q_D(QAbstractTextureProvider);
- if (status != d->m_status) {
- d->m_status = status;
- emit statusChanged(status);
- }
-}
-
-QAbstractTextureProvider::Status QAbstractTextureProvider::status() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_status;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::target readonly
-
- Holds the target format of the texture provider.
-
- \note The target format can only be set once.
- */
-QAbstractTextureProvider::Target QAbstractTextureProvider::target() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_target;
-}
-
-/*!
- Adds a new Qt3DCore::QAbstractTextureImage \a textureImage to the texture provider.
-
- \note Qt3DRender::QAbstractTextureImage should never be shared between multiple
- Qt3DRender::QAbstractTextureProvider instances.
- */
-void QAbstractTextureProvider::addTextureImage(QAbstractTextureImage *textureImage)
-{
- Q_D(QAbstractTextureProvider);
- if (!d->m_textureImages.contains(textureImage)) {
- d->m_textureImages.append(textureImage);
-
-
- if (textureImage->parent() && textureImage->parent() != this)
- qWarning() << "A QAbstractTextureImage was shared, expect a crash, undefined behavior at best";
- // We need to add it as a child of the current node if it has been declared inline
- // Or not previously added as a child of the current node so that
- // 1) The backend gets notified about it's creation
- // 2) When the current node is destroyed, it gets destroyed as well
- if (!textureImage->parent())
- textureImage->setParent(this);
-
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeAdded, QSceneChange::Node, id()));
- change->setPropertyName("textureImage");
- change->setValue(QVariant::fromValue(textureImage->id()));
- d->notifyObservers(change);
- }
- }
-}
-
-/*!
- Removes a Qt3DCore::QAbstractTextureImage \a textureImage from the texture provider.
- */
-void QAbstractTextureProvider::removeTextureImage(QAbstractTextureImage *textureImage)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_changeArbiter != Q_NULLPTR) {
- QScenePropertyChangePtr change(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, id()));
- change->setPropertyName("textureImage");
- change->setValue(QVariant::fromValue(textureImage->id()));
- d->notifyObservers(change);
- }
- d->m_textureImages.removeOne(textureImage);
-}
-
-/*!
- Returns a list of pointers to QAbstractTextureImage objects contained in
- the texture provider.
- */
-QList<QAbstractTextureImage *> QAbstractTextureProvider::textureImages() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_textureImages;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::generateMipMaps
-
- Holds whether the texture provider should auto generate mipmaps.
- */
-void QAbstractTextureProvider::setGenerateMipMaps(bool gen)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_autoMipMap != gen) {
- d->m_autoMipMap = gen;
- emit generateMipMapsChanged(gen);
- }
-}
-
-bool QAbstractTextureProvider::generateMipMaps() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_autoMipMap;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::minificationFilter
-
- Holds the minification filter of the texture provider.
- */
-void QAbstractTextureProvider::setMinificationFilter(Filter f)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_minFilter != f) {
- d->m_minFilter = f;
- emit minificationFilterChanged(f);
- }
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::magnificationFilter
-
- Holds the magnification filter of the texture provider.
- */
-void QAbstractTextureProvider::setMagnificationFilter(Filter f)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_magFilter != f) {
- d->m_magFilter = f;
- emit magnificationFilterChanged(f);
- }
-}
-
-QAbstractTextureProvider::Filter QAbstractTextureProvider::minificationFilter() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_minFilter;
-}
-
-QAbstractTextureProvider::Filter QAbstractTextureProvider::magnificationFilter() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_magFilter;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::wrapMode
-
- Holds the wrap mode of the texture provider.
- */
-void QAbstractTextureProvider::setWrapMode(const QTextureWrapMode &wrapMode)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_wrapMode.x() != wrapMode.x()) {
- d->m_wrapMode.setX(wrapMode.x());
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
- e->setPropertyName("wrapModeX");
- e->setValue(static_cast<int>(d->m_wrapMode.x()));
- d->notifyObservers(e);
- }
- if (d->m_wrapMode.y() != wrapMode.y()) {
- d->m_wrapMode.setY(wrapMode.y());
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
- e->setPropertyName("wrapModeY");
- e->setValue(static_cast<int>(d->m_wrapMode.y()));
- d->notifyObservers(e);
- }
- if (d->m_wrapMode.z() != wrapMode.z()) {
- d->m_wrapMode.setZ(wrapMode.z());
- QScenePropertyChangePtr e(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, id()));
- e->setPropertyName("wrapModeZ");
- e->setValue(static_cast<int>(d->m_wrapMode.z()));
- d->notifyObservers(e);
- }
-}
-
-QTextureWrapMode *QAbstractTextureProvider::wrapMode()
-{
- Q_D(QAbstractTextureProvider);
- return &d->m_wrapMode;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::maximumAnisotropy
-
- Holds the maximum anisotropy of the texture provider.
- */
-void QAbstractTextureProvider::setMaximumAnisotropy(float anisotropy)
-{
- Q_D(QAbstractTextureProvider);
- if (!qFuzzyCompare(d->m_maximumAnisotropy, anisotropy)) {
- d->m_maximumAnisotropy = anisotropy;
- emit maximumAnisotropyChanged(anisotropy);
- }
-}
-
-float QAbstractTextureProvider::maximumAnisotropy() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_maximumAnisotropy;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::comparisonFunction
-
- Holds the comparison function of the texture provider.
- */
-void QAbstractTextureProvider::setComparisonFunction(QAbstractTextureProvider::ComparisonFunction function)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_comparisonFunction != function) {
- d->m_comparisonFunction = function;
- emit comparisonFunctionChanged(function);
- }
-}
-
-QAbstractTextureProvider::ComparisonFunction QAbstractTextureProvider::comparisonFunction() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_comparisonFunction;
-}
-
-/*!
- \property Qt3DRender::QAbstractTextureProvider::comparisonMode
-
- Holds the comparison mode of the texture provider.
- */
-void QAbstractTextureProvider::setComparisonMode(QAbstractTextureProvider::ComparisonMode mode)
-{
- Q_D(QAbstractTextureProvider);
- if (d->m_comparisonMode != mode) {
- d->m_comparisonMode = mode;
- emit comparisonModeChanged(mode);
- }
-}
-
-QAbstractTextureProvider::ComparisonMode QAbstractTextureProvider::comparisonMode() const
-{
- Q_D(const QAbstractTextureProvider);
- return d->m_comparisonMode;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/texture/qabstracttextureprovider.h b/src/render/texture/qabstracttextureprovider.h
deleted file mode 100644
index f4aa6eca7..000000000
--- a/src/render/texture/qabstracttextureprovider.h
+++ /dev/null
@@ -1,339 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QABSTRACTTEXTUREPROVIDER_H
-#define QT3DRENDER_QABSTRACTTEXTUREPROVIDER_H
-
-#include <Qt3DRender/qtexturedata.h>
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DCore/qnode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractTextureProviderPrivate;
-class QTextureWrapMode;
-class QAbstractTextureImage;
-
-class QT3DRENDERSHARED_EXPORT QAbstractTextureProvider : public Qt3DCore::QNode
-{
- Q_OBJECT
- Q_PROPERTY(Target target READ target CONSTANT)
- Q_PROPERTY(TextureFormat format READ format WRITE setFormat NOTIFY formatChanged)
- Q_PROPERTY(bool generateMipMaps READ generateMipMaps WRITE setGenerateMipMaps NOTIFY generateMipMapsChanged)
- Q_PROPERTY(Qt3DRender::QTextureWrapMode *wrapMode READ wrapMode CONSTANT)
- Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
- Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
- Q_PROPERTY(int depth READ depth WRITE setDepth NOTIFY depthChanged)
- Q_PROPERTY(Filter magnificationFilter READ magnificationFilter WRITE setMagnificationFilter NOTIFY magnificationFilterChanged)
- Q_PROPERTY(Filter minificationFilter READ minificationFilter WRITE setMinificationFilter NOTIFY minificationFilterChanged)
- Q_PROPERTY(float maximumAnisotropy READ maximumAnisotropy WRITE setMaximumAnisotropy NOTIFY maximumAnisotropyChanged)
- Q_PROPERTY(ComparisonFunction comparisonFunction READ comparisonFunction WRITE setComparisonFunction NOTIFY comparisonFunctionChanged)
- Q_PROPERTY(ComparisonMode comparisonMode READ comparisonMode WRITE setComparisonMode NOTIFY comparisonModeChanged)
- Q_PROPERTY(int maximumLayers READ maximumLayers WRITE setMaximumLayers NOTIFY maximumLayersChanged)
- Q_PROPERTY(bool unique READ isUnique WRITE setUnique NOTIFY uniqueChanged)
-
-public:
-
- enum Status {
- Loading = 0,
- Loaded,
- Error
- };
- Q_ENUM(Status)
-
- enum Target {
- Target1D = 0x0DE0, // GL_TEXTURE_1D
- Target1DArray = 0x8C18, // GL_TEXTURE_1D_ARRAY
- Target2D = 0x0DE1, // GL_TEXTURE_2D
- Target2DArray = 0x8C1A, // GL_TEXTURE_2D_ARRAY
- Target3D = 0x806F, // GL_TEXTURE_3D
- TargetCubeMap = 0x8513, // GL_TEXTURE_CUBE_MAP
- TargetCubeMapArray = 0x9009, // GL_TEXTURE_CUBE_MAP_ARRAY
- Target2DMultisample = 0x9100, // GL_TEXTURE_2D_MULTISAMPLE
- Target2DMultisampleArray = 0x9102, // GL_TEXTURE_2D_MULTISAMPLE_ARRAY
- TargetRectangle = 0x84F5, // GL_TEXTURE_RECTANGLE
- TargetBuffer = 0x8C2A // GL_TEXTURE_BUFFER
- };
- Q_ENUM(Target)
-
- enum TextureFormat {
- NoFormat = 0, // GL_NONE
- Automatic = 1, // The Qt3D engine automatically determines the best format
-
- // Unsigned normalized formats
- R8_UNorm = 0x8229, // GL_R8
- RG8_UNorm = 0x822B, // GL_RG8
- RGB8_UNorm = 0x8051, // GL_RGB8
- RGBA8_UNorm = 0x8058, // GL_RGBA8
-
- R16_UNorm = 0x822A, // GL_R16
- RG16_UNorm = 0x822C, // GL_RG16
- RGB16_UNorm = 0x8054, // GL_RGB16
- RGBA16_UNorm = 0x805B, // GL_RGBA16
-
- // Signed normalized formats
- R8_SNorm = 0x8F94, // GL_R8_SNORM
- RG8_SNorm = 0x8F95, // GL_RG8_SNORM
- RGB8_SNorm = 0x8F96, // GL_RGB8_SNORM
- RGBA8_SNorm = 0x8F97, // GL_RGBA8_SNORM
-
- R16_SNorm = 0x8F98, // GL_R16_SNORM
- RG16_SNorm = 0x8F99, // GL_RG16_SNORM
- RGB16_SNorm = 0x8F9A, // GL_RGB16_SNORM
- RGBA16_SNorm = 0x8F9B, // GL_RGBA16_SNORM
-
- // Unsigned integer formats
- R8U = 0x8232, // GL_R8UI
- RG8U = 0x8238, // GL_RG8UI
- RGB8U = 0x8D7D, // GL_RGB8UI
- RGBA8U = 0x8D7C, // GL_RGBA8UI
-
- R16U = 0x8234, // GL_R16UI
- RG16U = 0x823A, // GL_RG16UI
- RGB16U = 0x8D77, // GL_RGB16UI
- RGBA16U = 0x8D76, // GL_RGBA16UI
-
- R32U = 0x8236, // GL_R32UI
- RG32U = 0x823C, // GL_RG32UI
- RGB32U = 0x8D71, // GL_RGB32UI
- RGBA32U = 0x8D70, // GL_RGBA32UI
-
- // Signed integer formats
- R8I = 0x8231, // GL_R8I
- RG8I = 0x8237, // GL_RG8I
- RGB8I = 0x8D8F, // GL_RGB8I
- RGBA8I = 0x8D8E, // GL_RGBA8I
-
- R16I = 0x8233, // GL_R16I
- RG16I = 0x8239, // GL_RG16I
- RGB16I = 0x8D89, // GL_RGB16I
- RGBA16I = 0x8D88, // GL_RGBA16I
-
- R32I = 0x8235, // GL_R32I
- RG32I = 0x823B, // GL_RG32I
- RGB32I = 0x8D83, // GL_RGB32I
- RGBA32I = 0x8D82, // GL_RGBA32I
-
- // Floating point formats
- R16F = 0x822D, // GL_R16F
- RG16F = 0x822F, // GL_RG16F
- RGB16F = 0x881B, // GL_RGB16F
- RGBA16F = 0x881A, // GL_RGBA16F
-
- R32F = 0x822E, // GL_R32F
- RG32F = 0x8230, // GL_RG32F
- RGB32F = 0x8815, // GL_RGB32F
- RGBA32F = 0x8814, // GL_RGBA32F
-
- // Packed formats
- RGB9E5 = 0x8C3D, // GL_RGB9_E5
- RG11B10F = 0x8C3A, // GL_R11F_G11F_B10F
- RG3B2 = 0x2A10, // GL_R3_G3_B2
- R5G6B5 = 0x8D62, // GL_RGB565
- RGB5A1 = 0x8057, // GL_RGB5_A1
- RGBA4 = 0x8056, // GL_RGBA4
- RGB10A2 = 0x906F, // GL_RGB10_A2UI
-
- // Depth formats
- D16 = 0x81A5, // GL_DEPTH_COMPONENT16
- D24 = 0x81A6, // GL_DEPTH_COMPONENT24
- D24S8 = 0x88F0, // GL_DEPTH24_STENCIL8
- D32 = 0x81A7, // GL_DEPTH_COMPONENT32
- D32F = 0x8CAC, // GL_DEPTH_COMPONENT32F
- D32FS8X24 = 0x8CAD, // GL_DEPTH32F_STENCIL8
-
- // Compressed formats
- RGB_DXT1 = 0x83F0, // GL_COMPRESSED_RGB_S3TC_DXT1_EXT
- RGBA_DXT1 = 0x83F1, // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
- RGBA_DXT3 = 0x83F2, // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
- RGBA_DXT5 = 0x83F3, // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
- R_ATI1N_UNorm = 0x8DBB, // GL_COMPRESSED_RED_RGTC1
- R_ATI1N_SNorm = 0x8DBC, // GL_COMPRESSED_SIGNED_RED_RGTC1
- RG_ATI2N_UNorm = 0x8DBD, // GL_COMPRESSED_RG_RGTC2
- RG_ATI2N_SNorm = 0x8DBE, // GL_COMPRESSED_SIGNED_RG_RGTC2
- RGB_BP_UNSIGNED_FLOAT = 0x8E8F, // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
- RGB_BP_SIGNED_FLOAT = 0x8E8E, // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
- RGB_BP_UNorm = 0x8E8C, // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
- R11_EAC_UNorm = 0x9270, // GL_COMPRESSED_R11_EAC
- R11_EAC_SNorm = 0x9271, // GL_COMPRESSED_SIGNED_R11_EAC
- RG11_EAC_UNorm = 0x9272, // GL_COMPRESSED_RG11_EAC
- RG11_EAC_SNorm = 0x9273, // GL_COMPRESSED_SIGNED_RG11_EAC
- RGB8_ETC2 = 0x9274, // GL_COMPRESSED_RGB8_ETC2
- SRGB8_ETC2 = 0x9275, // GL_COMPRESSED_SRGB8_ETC2
- RGB8_PunchThrough_Alpha1_ETC2 = 0x9276, // GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
- SRGB8_PunchThrough_Alpha1_ETC2 = 0x9277, // GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
- RGBA8_ETC2_EAC = 0x9278, // GL_COMPRESSED_RGBA8_ETC2_EAC
- SRGB8_Alpha8_ETC2_EAC = 0x9279, // GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
- RGB8_ETC1 = 0x8D64, // GL_ETC1_RGB8_OES
-
- // sRGB formats
- SRGB8 = 0x8C41, // GL_SRGB8
- SRGB8_Alpha8 = 0x8C43, // GL_SRGB8_ALPHA8
- SRGB_DXT1 = 0x8C4C, // GL_COMPRESSED_SRGB_S3TC_DXT1_EXT
- SRGB_Alpha_DXT1 = 0x8C4D, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT
- SRGB_Alpha_DXT3 = 0x8C4E, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT
- SRGB_Alpha_DXT5 = 0x8C4F, // GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
- SRGB_BP_UNorm = 0x8E8D, // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
-
- // ES 2 formats
- DepthFormat = 0x1902, // GL_DEPTH_COMPONENT
- AlphaFormat = 0x1906, // GL_ALPHA
- RGBFormat = 0x1907, // GL_RGB
- RGBAFormat = 0x1908, // GL_RGBA
- LuminanceFormat = 0x1909, // GL_LUMINANCE
- LuminanceAlphaFormat = 0x190A
- };
- Q_ENUM(TextureFormat)
-
- enum Filter {
- Nearest = 0x2600, // GL_NEAREST
- Linear = 0x2601, // GL_LINEAR
- NearestMipMapNearest = 0x2700, // GL_NEAREST_MIPMAP_NEAREST
- NearestMipMapLinear = 0x2702, // GL_NEAREST_MIPMAP_LINEAR
- LinearMipMapNearest = 0x2701, // GL_LINEAR_MIPMAP_NEAREST
- LinearMipMapLinear = 0x2703 // GL_LINEAR_MIPMAP_LINEAR
- };
- Q_ENUM(Filter)
-
- enum CubeMapFace {
- CubeMapPositiveX = 0x8515, // GL_TEXTURE_CUBE_MAP_POSITIVE_X
- CubeMapNegativeX = 0x8516, // GL_TEXTURE_CUBE_MAP_NEGATIVE_X
- CubeMapPositiveY = 0x8517, // GL_TEXTURE_CUBE_MAP_POSITIVE_Y
- CubeMapNegativeY = 0x8518, // GL_TEXTURE_CUBE_MAP_NEGATIVE_Y
- CubeMapPositiveZ = 0x8519, // GL_TEXTURE_CUBE_MAP_POSITIVE_Z
- CubeMapNegativeZ = 0x851A // GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
- };
- Q_ENUM(CubeMapFace)
-
- enum ComparisonFunction {
- CompareLessEqual = 0x0203, // GL_LEQUAL
- CompareGreaterEqual = 0x0206, // GL_GEQUAL
- CompareLess = 0x0201, // GL_LESS
- CompareGreater = 0x0204, // GL_GREATER
- CompareEqual = 0x0202, // GL_EQUAL
- CommpareNotEqual = 0x0205, // GL_NOTEQUAL
- CompareAlways = 0x0207, // GL_ALWAYS
- CompareNever = 0x0200 // GL_NEVER
- };
- Q_ENUM(ComparisonFunction)
-
- enum ComparisonMode {
- CompareRefToTexture = 0x884E, // GL_COMPARE_REF_TO_TEXTURE
- CompareNone = 0x0000 // GL_NONE
- };
- Q_ENUM(ComparisonMode)
-
- ~QAbstractTextureProvider();
-
- Target target() const;
-
- TextureFormat format() const;
- bool generateMipMaps() const;
-
- Status status() const;
-
- void addTextureImage(QAbstractTextureImage *textureImage);
- void removeTextureImage(QAbstractTextureImage *textureImage);
- QList<QAbstractTextureImage *> textureImages() const;
-
- // sampler data - in the future proxy to a Sampler helper
- void setWrapMode(const QTextureWrapMode &wrapMode);
- QTextureWrapMode *wrapMode();
-
- void setSize(int width, int height=1, int depth=1);
-
- Filter minificationFilter() const;
- Filter magnificationFilter() const;
- float maximumAnisotropy() const;
- ComparisonFunction comparisonFunction() const;
- ComparisonMode comparisonMode() const;
- int width() const;
- int height() const;
- int depth() const;
- int maximumLayers() const;
- bool isUnique() const;
-
-public Q_SLOTS:
- void setFormat(TextureFormat format);
- void setGenerateMipMaps(bool gen);
- void setWidth(int width);
- void setHeight(int height);
- void setDepth(int depth);
- void setMinificationFilter(Filter f);
- void setMagnificationFilter(Filter f);
- void setMaximumAnisotropy(float anisotropy);
- void setComparisonFunction(ComparisonFunction function);
- void setComparisonMode(ComparisonMode mode);
- void setMaximumLayers(int maximumLayers);
- void setUnique(bool unique);
-
-Q_SIGNALS:
- void formatChanged(TextureFormat format);
- void statusChanged(Status status);
- void generateMipMapsChanged(bool generateMipMaps);
- void widthChanged(int width);
- void heightChanged(int height);
- void depthChanged(int depth);
- void magnificationFilterChanged(Filter magnificationFilter);
- void minificationFilterChanged(Filter minificationFilter);
- void maximumAnisotropyChanged(float maximumAnisotropy);
- void comparisonFunctionChanged(ComparisonFunction comparisonFunction);
- void comparisonModeChanged(ComparisonMode comparisonMode);
- void maximumLayersChanged(int maximumLayers);
- void uniqueChanged(bool unique);
-
-protected:
- explicit QAbstractTextureProvider(Qt3DCore::QNode *parent = Q_NULLPTR);
- explicit QAbstractTextureProvider(Target target, Qt3DCore::QNode *parent = Q_NULLPTR);
- QAbstractTextureProvider(QAbstractTextureProviderPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
- void setStatus(Status status);
-
-private:
- Q_DECLARE_PRIVATE(QAbstractTextureProvider)
- QT3D_CLONEABLE(QAbstractTextureProvider)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(Qt3DRender::QAbstractTextureProvider *)
-
-#endif // QT3DRENDER_QABSTRACTTEXTUREPROVIDER_H
diff --git a/src/render/texture/qabstracttextureprovider_p.h b/src/render/texture/qabstracttextureprovider_p.h
deleted file mode 100644
index 47577bb87..000000000
--- a/src/render/texture/qabstracttextureprovider_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QABSTRACTTEXTUREPROVIDER_P_H
-#define QT3DRENDER_QABSTRACTTEXTUREPROVIDER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DRender/qabstracttextureprovider.h>
-#include <Qt3DRender/qwrapmode.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QAbstractTextureProviderPrivate : public Qt3DCore::QNodePrivate
-{
-public :
- QAbstractTextureProviderPrivate();
-
- Q_DECLARE_PUBLIC(QAbstractTextureProvider)
-
- QAbstractTextureProvider::Target m_target;
- QAbstractTextureProvider::TextureFormat m_format;
- int m_width, m_height, m_depth;
- bool m_autoMipMap;
-
- QList<QTexImageDataPtr> m_data;
-
- QAbstractTextureProvider::Filter m_minFilter, m_magFilter;
- // FIXME, store per direction
- QTextureWrapMode m_wrapMode;
- QAbstractTextureProvider::Status m_status;
- float m_maximumAnisotropy;
- QAbstractTextureProvider::ComparisonFunction m_comparisonFunction;
- QAbstractTextureProvider::ComparisonMode m_comparisonMode;
- QList<QAbstractTextureImage *> m_textureImages;
- int m_maximumLayers;
- bool m_unique;
-};
-
-} // QT3D
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QABSTRACTTEXTUREPROVIDER_P_H
-
diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp
new file mode 100644
index 000000000..45aacae73
--- /dev/null
+++ b/src/render/texture/qtexture.cpp
@@ -0,0 +1,312 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtextureimage.h"
+#include "qabstracttextureimage.h"
+#include "qtextureimage_p.h"
+#include "qtexture.h"
+#include "qabstracttexture_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QTextureLoaderPrivate : public QAbstractTexturePrivate
+{
+public:
+ QTextureLoaderPrivate()
+ : QAbstractTexturePrivate()
+ {
+ }
+
+ QUrl m_source;
+};
+
+/*!
+ \class Qt3DRender::QTexture1D
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a Target1D target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTexture1D instance with \a parent as parent.
+ */
+QTexture1D::QTexture1D(QNode *parent)
+ : QAbstractTexture(Target1D, parent)
+{
+}
+
+/*! \internal */
+QTexture1D::~QTexture1D()
+{
+}
+
+/*!
+ \class Qt3DRender::QTexture1DArray
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a Target1DArray target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTexture1DArray instance with \a parent as parent.
+ */
+QTexture1DArray::QTexture1DArray(QNode *parent)
+ : QAbstractTexture(Target1DArray, parent)
+{
+}
+
+/*! \internal */
+QTexture1DArray::~QTexture1DArray()
+{
+}
+
+/*!
+ \class Qt3DRender::QTexture2D
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a Target2D target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTexture2D instance with \a parent as parent.
+ */
+QTexture2D::QTexture2D(QNode *parent)
+ : QAbstractTexture(Target2D, parent)
+{
+}
+
+/*! \internal */
+QTexture2D::~QTexture2D()
+{
+}
+
+/*!
+ \class Qt3DRender::QTexture2DArray
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a Target2DArray target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTexture2DArray instance with \a parent as parent.
+ */
+QTexture2DArray::QTexture2DArray(QNode *parent)
+ : QAbstractTexture(Target2DArray, parent)
+{
+}
+
+/*! \internal */
+QTexture2DArray::~QTexture2DArray()
+{
+}
+
+/*!
+ \class Qt3DRender::QTexture3D
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a Target3D target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTexture3D instance with \a parent as parent.
+ */
+QTexture3D::QTexture3D(QNode *parent)
+ : QAbstractTexture(Target3D, parent)
+{
+}
+
+/*! \internal */
+QTexture3D::~QTexture3D()
+{
+}
+
+/*!
+ \class Qt3DRender::QTextureCubeMap
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a TargetCubeMap target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTextureCubeMap instance with \a parent as parent.
+ */
+QTextureCubeMap::QTextureCubeMap(QNode *parent)
+ : QAbstractTexture(TargetCubeMap, parent)
+{
+}
+
+/*! \internal */
+QTextureCubeMap::~QTextureCubeMap()
+{
+}
+
+/*!
+ \class Qt3DRender::QTextureCubeMapArray
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a TargetCubeMapArray target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTextureCubeMapArray instance with \a parent as parent.
+ */
+QTextureCubeMapArray::QTextureCubeMapArray(QNode *parent)
+ : QAbstractTexture(TargetCubeMapArray, parent)
+{
+}
+
+/*! \internal */
+QTextureCubeMapArray::~QTextureCubeMapArray()
+{
+}
+
+/*!
+ \class Qt3DRender::QTexture2DMultisample
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a Target2DMultisample target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTexture2DMultisample instance with \a parent as parent.
+ */
+QTexture2DMultisample::QTexture2DMultisample(QNode *parent)
+ : QAbstractTexture(Target2DMultisample, parent)
+{
+}
+
+/*! \internal */
+QTexture2DMultisample::~QTexture2DMultisample()
+{
+}
+
+/*!
+ \class Qt3DRender::QTexture2DMultisampleArray
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a Target2DMultisampleArray target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTexture2DMultisampleArray instance with \a parent as parent.
+ */
+QTexture2DMultisampleArray::QTexture2DMultisampleArray(QNode *parent)
+ : QAbstractTexture(Target2DMultisampleArray, parent)
+{
+}
+
+/*! \internal */
+QTexture2DMultisampleArray::~QTexture2DMultisampleArray()
+{
+}
+
+/*!
+ \class Qt3DRender::QTextureRectangle
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a TargetRectangle target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTextureRectangle instance with \a parent as parent.
+ */
+QTextureRectangle::QTextureRectangle(QNode *parent)
+ : QAbstractTexture(TargetRectangle, parent)
+{
+}
+
+/*! \internal */
+QTextureRectangle::~QTextureRectangle()
+{
+}
+
+/*!
+ \class Qt3DRender::QTextureBuffer
+ \inmodule Qt3DRender
+ \since 5.5
+ \brief A QAbstractTexture with a TargetBuffer target format.
+ */
+
+/*!
+ Constructs a new Qt3DRender::QTextureBuffer instance with \a parent as parent.
+ */
+QTextureBuffer::QTextureBuffer(QNode *parent)
+ : QAbstractTexture(TargetBuffer, parent)
+{
+}
+
+/*! \internal */
+QTextureBuffer::~QTextureBuffer()
+{
+}
+
+QTextureLoader::QTextureLoader(QNode *parent)
+ : QAbstractTexture(*new QTextureLoaderPrivate, parent)
+{
+ d_func()->m_target = TargetAutomatic;
+}
+
+/*! \internal */
+QTextureLoader::~QTextureLoader()
+{
+}
+
+QUrl QTextureLoader::source() const
+{
+ Q_D(const QTextureLoader);
+ return d->m_source;
+}
+
+void QTextureLoader::setSource(const QUrl& source)
+{
+ Q_D(QTextureLoader);
+ if (source != d->m_source) {
+ d->m_source = source;
+ d->m_dataFunctor.reset(new QImageTextureDataFunctor(source));
+ emit sourceChanged(source);
+ }
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+
diff --git a/src/render/texture/qtexture.h b/src/render/texture/qtexture.h
index 368bf9e3e..4d687dc6d 100644
--- a/src/render/texture/qtexture.h
+++ b/src/render/texture/qtexture.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,10 +40,10 @@
#ifndef QT3DRENDER_QTEXTURE_H
#define QT3DRENDER_QTEXTURE_H
-#include <Qt3DRender/qtexturedata.h>
-#include <Qt3DRender/qwrapmode.h>
-#include <Qt3DRender/qtextureproviders.h>
+#include <Qt3DRender/qtextureimagedata.h>
+#include <Qt3DRender/qtexturewrapmode.h>
#include <Qt3DRender/qtextureimage.h>
+#include <Qt3DRender/qabstracttexture.h>
QT_BEGIN_NAMESPACE
@@ -50,6 +53,121 @@ QT_BEGIN_NAMESPACE
#pragma qt_sync_stop_processing
#endif
+namespace Qt3DRender {
+
+class QT3DRENDERSHARED_EXPORT QTexture1D : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTexture1D(Qt3DCore::QNode *parent = nullptr);
+ ~QTexture1D();
+};
+
+class QT3DRENDERSHARED_EXPORT QTexture1DArray : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTexture1DArray(Qt3DCore::QNode *parent = nullptr);
+ ~QTexture1DArray();
+};
+
+class QT3DRENDERSHARED_EXPORT QTexture2D : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTexture2D(Qt3DCore::QNode *parent = nullptr);
+ ~QTexture2D();
+};
+
+class QT3DRENDERSHARED_EXPORT QTexture2DArray : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTexture2DArray(Qt3DCore::QNode *parent = nullptr);
+ ~QTexture2DArray();
+};
+
+class QT3DRENDERSHARED_EXPORT QTexture3D : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTexture3D(Qt3DCore::QNode *parent = nullptr);
+ ~QTexture3D();
+};
+
+class QT3DRENDERSHARED_EXPORT QTextureCubeMap : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTextureCubeMap(Qt3DCore::QNode *parent = nullptr);
+ ~QTextureCubeMap();
+};
+
+class QT3DRENDERSHARED_EXPORT QTextureCubeMapArray : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTextureCubeMapArray(Qt3DCore::QNode *parent = nullptr);
+ ~QTextureCubeMapArray();
+};
+
+class QT3DRENDERSHARED_EXPORT QTexture2DMultisample : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTexture2DMultisample(Qt3DCore::QNode *parent = nullptr);
+ ~QTexture2DMultisample();
+};
+
+class QT3DRENDERSHARED_EXPORT QTexture2DMultisampleArray : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTexture2DMultisampleArray(Qt3DCore::QNode *parent = nullptr);
+ ~QTexture2DMultisampleArray();
+};
+
+class QT3DRENDERSHARED_EXPORT QTextureRectangle : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTextureRectangle(Qt3DCore::QNode *parent = nullptr);
+ ~QTextureRectangle();
+};
+
+class QT3DRENDERSHARED_EXPORT QTextureBuffer : public QAbstractTexture
+{
+ Q_OBJECT
+public:
+ explicit QTextureBuffer(Qt3DCore::QNode *parent = nullptr);
+ ~QTextureBuffer();
+};
+
+class QTextureLoaderPrivate;
+
+class QT3DRENDERSHARED_EXPORT QTextureLoader : public QAbstractTexture
+{
+ Q_OBJECT
+ Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
+
+public:
+ explicit QTextureLoader(Qt3DCore::QNode *parent = nullptr);
+ ~QTextureLoader();
+
+ QUrl source() const;
+
+public Q_SLOTS:
+ void setSource(const QUrl &source);
+
+Q_SIGNALS:
+ void sourceChanged(const QUrl &source);
+
+private:
+ Q_DECLARE_PRIVATE(QTextureLoader)
+};
+
+} // namespace Qt3DRender
+
QT_END_NAMESPACE
#endif // QT3DRENDER_QTEXTURE_H
diff --git a/src/render/texture/qtexturedata.cpp b/src/render/texture/qtexturedata.cpp
deleted file mode 100644
index d6663a479..000000000
--- a/src/render/texture/qtexturedata.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtexturedata_p.h"
-
-#include <QDebug>
-#include <QFileInfo>
-#include <QFile>
-#include <qendian.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-QTexImageDataPrivate::QTexImageDataPrivate()
- : m_width(-1)
- , m_height(-1)
- , m_depth(-1)
- , m_isCompressed(false)
- , m_format(QOpenGLTexture::RGBA8_UNorm)
-{
-}
-
-QTexImageData::QTexImageData()
- : d_ptr(new QTexImageDataPrivate())
-{
-}
-
-QTexImageData::QTexImageData(QTexImageDataPrivate &dd)
- : d_ptr(&dd)
-{
-}
-
-QTexImageData::~QTexImageData()
-{
- cleanup();
- delete d_ptr;
-}
-
-QTexImageData &QTexImageData::operator=(const QTexImageData &other)
-{
- Q_D(QTexImageData);
- d->m_width = other.d_ptr->m_width;
- d->m_height = other.d_ptr->m_height;
- d->m_depth = other.d_ptr->m_depth;
- d->m_isCompressed = other.d_ptr->m_isCompressed;
- d->m_pixelFormat = other.d_ptr->m_pixelFormat;
- d->m_pixelType = other.d_ptr->m_pixelType;
- d->m_data = other.d_ptr->m_data;
-
- return *this;
-}
-
-void QTexImageData::cleanup()
-{
- Q_D(QTexImageData);
- d->m_width = -1;
- d->m_height = -1;
- d->m_depth = -1;
- d->m_isCompressed = false;
- d->m_data.clear();
-}
-
-bool QTexImageData::isCompressed() const
-{
- Q_D(const QTexImageData);
- return d->m_isCompressed;
-}
-
-int QTexImageData::width() const
-{
- Q_D(const QTexImageData);
- return d->m_width;
-}
-
-int QTexImageData::height() const
-{
- Q_D(const QTexImageData);
- return d->m_height;
-}
-
-int QTexImageData::depth() const
-{
- Q_D(const QTexImageData);
- return d->m_depth;
-}
-
-QOpenGLTexture::TextureFormat QTexImageData::format() const
-{
- Q_D(const QTexImageData);
- return d->m_format;
-}
-
-void QTexImageData::setImage(const QImage &image)
-{
- Q_D(QTexImageData);
- d->m_width = image.width();
- d->m_height = image.height();
- d->m_depth = 1;
-
- QImage glImage = image.convertToFormat(QImage::Format_RGBA8888);
- Q_ASSERT_X(glImage.bytesPerLine() == (glImage.width() * glImage.depth() + 7) / 8,
- "QTexImageData::setImage", "glImage is not packed"); // QTBUG-48330
- QByteArray imageBytes((const char*) glImage.constBits(), glImage.byteCount());
- setData(imageBytes, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
- d->m_format = QOpenGLTexture::RGBA8_UNorm;
-}
-
-void QTexImageData::setData(const QByteArray &data, QOpenGLTexture::PixelFormat fmt,
- QOpenGLTexture::PixelType ptype)
-{
- Q_D(QTexImageData);
- d->m_isCompressed = false;
- d->m_data = data;
- d->m_pixelFormat = fmt;
- d->m_pixelType = ptype;
-}
-
-bool QTexImageData::setCompressedFile(const QString &source)
-{
- Q_D(QTexImageData);
- const bool isPkm = QFileInfo(source).suffix() == QStringLiteral("pkm");
- if (!isPkm)
- return false;
-
- QFile f(source);
- if (!f.open(QIODevice::ReadOnly)) {
- qWarning() << "Failed to open" << source;
- return false;
- }
-
- // ETC1 in PKM, as generated by f.ex. Android's etc1tool
- static const char pkmMagic[] = { 'P', 'K', 'M', ' ', '1', '0' };
- const int pkmHeaderSize = 6 + 2 + 4 * 2;
- QByteArray header = f.read(pkmHeaderSize);
- if (header.size() >= pkmHeaderSize && !qstrncmp(header.constData(), pkmMagic, 6)) {
- d->m_format = QOpenGLTexture::RGB8_ETC1; // may get changed to RGB8_ETC2 later on
- // get the extended (multiple of 4) width and height
- d->m_width = qFromBigEndian(*(reinterpret_cast<const quint16 *>(header.constData() + 6 + 2)));
- d->m_height = qFromBigEndian(*(reinterpret_cast<const quint16 *>(header.constData() + 6 + 2 + 2)));
- d->m_depth = 1;
- QByteArray data = f.readAll();
- if (data.size() < (d->m_width / 4) * (d->m_height / 4) * 8)
- qWarning() << "Unexpected end of ETC1 data in" << source;
- setData(data, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
- d->m_isCompressed = true;
- return true;
- }
-
- return false;
-}
-
-QByteArray QTexImageData::data() const
-{
- Q_D(const QTexImageData);
- return d->m_data;
-}
-
-QOpenGLTexture::PixelFormat QTexImageData::pixelFormat() const
-{
- Q_D(const QTexImageData);
- return d->m_pixelFormat;
-}
-
-QOpenGLTexture::PixelType QTexImageData::pixelType() const
-{
- Q_D(const QTexImageData);
- return d->m_pixelType;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/texture/qtexturedata.h b/src/render/texture/qtexturedata.h
deleted file mode 100644
index f87109743..000000000
--- a/src/render/texture/qtexturedata.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_TEXTUREDATA_H
-#define QT3DRENDER_TEXTUREDATA_H
-
-#include <QtGui/QOpenGLTexture>
-#include <QtGui/QImage>
-#include <QtCore/QSharedPointer>
-#include <Qt3DRender/qt3drender_global.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QTexImageDataPrivate;
-
-class QT3DRENDERSHARED_EXPORT QTexImageData
-{
-public:
- QTexImageData();
- virtual ~QTexImageData();
-
- QTexImageData &operator=(const QTexImageData &other);
-
- void cleanup();
-
- bool isCompressed() const;
-
- int width() const;
- int height() const;
- int depth() const;
- QOpenGLTexture::TextureFormat format() const;
-
- void setImage(const QImage &);
-
- void setData(const QByteArray &data,
- QOpenGLTexture::PixelFormat fmt,
- QOpenGLTexture::PixelType ptype);
-
- bool setCompressedFile(const QString &source);
-
- QByteArray data() const;
-
- QOpenGLTexture::PixelFormat pixelFormat() const;
-
- QOpenGLTexture::PixelType pixelType() const;
-
-protected:
- QTexImageData(QTexImageDataPrivate &dd);
-
-private:
- Q_DECLARE_PRIVATE(QTexImageData)
- QTexImageDataPrivate *d_ptr;
-
-// int m_width, m_height, m_depth;
-// QOpenGLTexture::PixelFormat m_pixelFormat;
-// QOpenGLTexture::PixelType m_pixelType;
-
-// bool m_isCompressed;
-// QByteArray m_data;
-// QOpenGLTexture::TextureFormat m_format;
-
-};
-
-typedef QSharedPointer<QTexImageData> QTexImageDataPtr;
-
-} // namespace Qt3DRender
-
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_TEXTUREDATA_H
diff --git a/src/render/texture/qtexturedata_p.h b/src/render/texture/qtexturedata_p.h
deleted file mode 100644
index 6bad6f036..000000000
--- a/src/render/texture/qtexturedata_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_TEXTUREDATA_P_H
-#define QT3DRENDER_TEXTUREDATA_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qtexturedata.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QTexImageDataPrivate
-{
-public:
- QTexImageDataPrivate();
-
- int m_width;
- int m_height;
- int m_depth;
- QOpenGLTexture::PixelFormat m_pixelFormat;
- QOpenGLTexture::PixelType m_pixelType;
-
- bool m_isCompressed;
- QByteArray m_data;
- QOpenGLTexture::TextureFormat m_format;
-};
-
-} // namespace Qt3DRender
-
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_TEXTUREDATA_P_H
diff --git a/src/render/texture/qtextureimage.cpp b/src/render/texture/qtextureimage.cpp
index 6b4684742..717a80100 100644
--- a/src/render/texture/qtextureimage.cpp
+++ b/src/render/texture/qtextureimage.cpp
@@ -1,105 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qtextureimage.h"
+#include "qtextureimage_p.h"
#include "qabstracttextureimage_p.h"
-#include <Qt3DRender/private/qurlhelper_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-class QTextureImagePrivate: public QAbstractTextureImagePrivate
-{
-public:
- QTextureImagePrivate()
- : QAbstractTextureImagePrivate()
- {
- }
-
- Q_DECLARE_PUBLIC(QTextureImage)
- QUrl m_source;
-};
-
-class QImageTextureDataFunctor : public QTextureDataFunctor
-{
-public:
- QImageTextureDataFunctor(const QUrl &url)
- : QTextureDataFunctor()
- , m_url(url)
- {}
-
- // Will be executed from within a QAspectJob
- QTexImageDataPtr operator ()() Q_DECL_FINAL
- {
- QTexImageDataPtr dataPtr;
- if (m_url.isLocalFile() || m_url.scheme() == QStringLiteral("qrc")
-#ifdef Q_OS_ANDROID
- || m_url.scheme() == QStringLiteral("assets")
-#endif
- ) {
- QString source = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_url);
- dataPtr.reset(new QTexImageData());
- if (dataPtr->setCompressedFile(source))
- return dataPtr;
- QImage img;
- if (img.load(source)) {
- dataPtr->setImage(img);
- return dataPtr;
- }
- dataPtr.reset();
- qWarning() << "Failed to load image : " << source;
- } else {
- qWarning() << "implement loading from remote URLs";
- }
- return dataPtr;
- }
-
- bool operator ==(const QTextureDataFunctor &other) const Q_DECL_FINAL
- {
- const QImageTextureDataFunctor *otherFunctor = functor_cast<QImageTextureDataFunctor>(&other);
- return (otherFunctor != Q_NULLPTR && otherFunctor->m_url == m_url);
- }
-
- QT3D_FUNCTOR(QImageTextureDataFunctor)
-
-private:
- QUrl m_url;
-};
-
/*!
\class Qt3DRender::QTextureImage
\inmodule Qt3DRender
@@ -129,12 +75,9 @@ QTextureImage::QTextureImage(QNode *parent)
{
}
-/*!
- The destructor.
- */
+/*! \internal */
QTextureImage::~QTextureImage()
{
- QNode::cleanup();
}
/*!
@@ -146,17 +89,23 @@ QUrl QTextureImage::source() const
return d->m_source;
}
+QTextureImage::Status QTextureImage::status() const
+{
+ Q_D(const QTextureImage);
+ return d->m_status;
+}
+
/*!
\property Qt3DRender::QTextureImage::source
- This property holdsthe source url from which data for the texture
+ This property holds the source url from which data for the texture
image will be loaded.
*/
/*!
\qmlproperty url Qt3D.Render::TextureImage::source
- This property holdsthe source url from which data for the texture
+ This property holds the source url from which data for the texture
image will be loaded.
*/
@@ -170,27 +119,34 @@ void QTextureImage::setSource(const QUrl &source)
if (source != d->m_source) {
d->m_source = source;
emit sourceChanged(source);
- update();
+ notifyDataGeneratorChanged();
+ }
+}
+
+void QTextureImage::setStatus(Status status)
+{
+ Q_D(QTextureImage);
+ if (status != d->m_status) {
+ d->m_status = status;
+ emit statusChanged(status);
}
}
/*!
- Returns the Qt3DRender::QTextureDataFunctorPtr functor to be used by the
+ Returns the Qt3DRender::QTextureImageDataGeneratorPtr functor to be used by the
backend to load the texture image data into an OpenGL texture object.
*/
-QTextureDataFunctorPtr QTextureImage::dataFunctor() const
+QTextureImageDataGeneratorPtr QTextureImage::dataGenerator() const
{
- return QTextureDataFunctorPtr(new QImageTextureDataFunctor(source()));
+ return QTextureImageDataGeneratorPtr(new QImageTextureDataFunctor(source()));
}
-/*!
- Copies \a ref into this texture image.
- */
-void QTextureImage::copy(const QNode *ref)
+void QTextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
- QAbstractTextureImage::copy(ref);
- const QTextureImage *img = static_cast<const QTextureImage *>(ref);
- d_func()->m_source = img->source();
+ Qt3DCore::QPropertyUpdatedChangePtr e = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(change);
+
+ if (e->propertyName() == QByteArrayLiteral("status"))
+ setStatus(static_cast<QTextureImage::Status>(e->value().toInt()));
}
} // namespace Qt3DRender
diff --git a/src/render/texture/qtextureimage.h b/src/render/texture/qtextureimage.h
index 0159b7fd7..f614ebdab 100644
--- a/src/render/texture/qtextureimage.h
+++ b/src/render/texture/qtextureimage.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,27 +53,37 @@ class QT3DRENDERSHARED_EXPORT QTextureImage : public QAbstractTextureImage
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
public:
- explicit QTextureImage(Qt3DCore::QNode *parent = Q_NULLPTR);
+ explicit QTextureImage(Qt3DCore::QNode *parent = nullptr);
~QTextureImage();
- QUrl source() const;
+ enum Status {
+ None = 0,
+ Loading,
+ Ready,
+ Error
+ };
+ Q_ENUM(Status)
- QTextureDataFunctorPtr dataFunctor() const Q_DECL_OVERRIDE;
+ QUrl source() const;
+ Status status() const;
public Q_SLOTS:
void setSource(const QUrl &source);
Q_SIGNALS:
void sourceChanged(const QUrl &source);
+ void statusChanged(Status status);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
+ void setStatus(Status status);
private:
+ QTextureImageDataGeneratorPtr dataGenerator() const Q_DECL_OVERRIDE;
Q_DECLARE_PRIVATE(QTextureImage)
- QT3D_CLONEABLE(QTextureImage)
};
} // namespace Qt3DRender
diff --git a/src/render/texture/qtextureimage_p.h b/src/render/texture/qtextureimage_p.h
new file mode 100644
index 000000000..15b402525
--- /dev/null
+++ b/src/render/texture/qtextureimage_p.h
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QTEXTUREIMAGE_P_H
+#define QT3DRENDER_QTEXTUREIMAGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <Qt3DRender/private/qabstracttextureimage_p.h>
+#include <Qt3DRender/qtextureimage.h>
+#include <Qt3DRender/private/qurlhelper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QTextureImagePrivate : public QAbstractTextureImagePrivate
+{
+public:
+ QTextureImagePrivate()
+ : QAbstractTextureImagePrivate()
+ , m_status(QTextureImage::Loading)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QTextureImage)
+
+ QUrl m_source;
+ QTextureImage::Status m_status;
+};
+
+class QImageTextureDataFunctor : public QTextureImageDataGenerator
+{
+public:
+ QImageTextureDataFunctor(const QUrl &url)
+ : QTextureImageDataGenerator()
+ , m_url(url)
+ {}
+
+ // Will be executed from within a QAspectJob
+ QTextureImageDataPtr operator ()() Q_DECL_FINAL
+ {
+ QTextureImageDataPtr dataPtr;
+ if (m_url.isLocalFile() || m_url.scheme() == QLatin1String("qrc")) {
+ QString source = Qt3DRender::QUrlHelper::urlToLocalFileOrQrc(m_url);
+ dataPtr.reset(new QTextureImageData());
+ if (dataPtr->setCompressedFile(source))
+ return dataPtr;
+ QImage img;
+ if (img.load(source)) {
+ dataPtr->setImage(img);
+ return dataPtr;
+ }
+ dataPtr.reset();
+ qWarning() << "Failed to load image : " << source;
+ } else if (!m_url.isEmpty()) {
+ qWarning() << "implement loading from remote URLs";
+ }
+ return dataPtr;
+ }
+
+ bool operator ==(const QTextureImageDataGenerator &other) const Q_DECL_FINAL
+ {
+ const QImageTextureDataFunctor *otherFunctor = functor_cast<QImageTextureDataFunctor>(&other);
+ return (otherFunctor != Q_NULLPTR && otherFunctor->m_url == m_url);
+ }
+
+ QTextureImage::Status status() const
+ {
+ return m_status;
+ }
+
+ QT3D_FUNCTOR(QImageTextureDataFunctor)
+
+private:
+ QUrl m_url;
+ QTextureImage::Status m_status;
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QTEXTUREIMAGE_P_H
diff --git a/src/render/texture/qtextureimagedata.cpp b/src/render/texture/qtextureimagedata.cpp
new file mode 100644
index 000000000..80e6f5575
--- /dev/null
+++ b/src/render/texture/qtextureimagedata.cpp
@@ -0,0 +1,802 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtextureimagedata_p.h"
+#include <QDebug>
+#include <QFileInfo>
+#include <QFile>
+#include <qendian.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+namespace {
+
+struct DdsPixelFormat {
+ quint32 size;
+ quint32 flags;
+ quint32 fourCC;
+ quint32 rgbBitCount;
+ quint32 redMask;
+ quint32 greenMask;
+ quint32 blueMask;
+ quint32 alphaMask;
+};
+
+struct DdsHeader {
+ char magic[4];
+ quint32 size;
+ quint32 flags;
+ quint32 height;
+ quint32 width;
+ quint32 pitchOrLinearSize;
+ quint32 depth;
+ quint32 mipmapCount;
+ quint32 reserved[11];
+ DdsPixelFormat pixelFormat;
+ quint32 caps;
+ quint32 caps2;
+ quint32 caps3;
+ quint32 caps4;
+ quint32 reserved2;
+};
+
+struct DdsDX10Header {
+ quint32 format;
+ quint32 dimension;
+ quint32 miscFlag;
+ quint32 arraySize;
+ quint32 miscFlags2;
+};
+
+enum DdsFlags {
+ MipmapCountFlag = 0x20000,
+};
+
+enum PixelFormatFlag {
+ AlphaFlag = 0x1,
+ FourCCFlag = 0x4,
+ RGBFlag = 0x40,
+ RGBAFlag = RGBFlag | AlphaFlag,
+ YUVFlag = 0x200,
+ LuminanceFlag = 0x20000
+};
+
+enum Caps2Flags {
+ CubemapFlag = 0x200,
+ CubemapPositiveXFlag = 0x400,
+ CubemapNegativeXFlag = 0x800,
+ CubemapPositiveYFlag = 0x1000,
+ CubemapNegativeYFlag = 0x2000,
+ CubemapPositiveZFlag = 0x4000,
+ CubemapNegativeZFlag = 0x8000,
+ AllCubemapFaceFlags = CubemapPositiveXFlag |
+ CubemapNegativeXFlag |
+ CubemapPositiveYFlag |
+ CubemapNegativeYFlag |
+ CubemapPositiveZFlag |
+ CubemapNegativeZFlag,
+ VolumeFlag = 0x200000
+};
+
+enum DXGIFormat {
+ DXGI_FORMAT_UNKNOWN = 0,
+ DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
+ DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
+ DXGI_FORMAT_R32G32B32A32_UINT = 3,
+ DXGI_FORMAT_R32G32B32A32_SINT = 4,
+ DXGI_FORMAT_R32G32B32_TYPELESS = 5,
+ DXGI_FORMAT_R32G32B32_FLOAT = 6,
+ DXGI_FORMAT_R32G32B32_UINT = 7,
+ DXGI_FORMAT_R32G32B32_SINT = 8,
+ DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
+ DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
+ DXGI_FORMAT_R16G16B16A16_UNORM = 11,
+ DXGI_FORMAT_R16G16B16A16_UINT = 12,
+ DXGI_FORMAT_R16G16B16A16_SNORM = 13,
+ DXGI_FORMAT_R16G16B16A16_SINT = 14,
+ DXGI_FORMAT_R32G32_TYPELESS = 15,
+ DXGI_FORMAT_R32G32_FLOAT = 16,
+ DXGI_FORMAT_R32G32_UINT = 17,
+ DXGI_FORMAT_R32G32_SINT = 18,
+ DXGI_FORMAT_R32G8X24_TYPELESS = 19,
+ DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
+ DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
+ DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
+ DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
+ DXGI_FORMAT_R10G10B10A2_UNORM = 24,
+ DXGI_FORMAT_R10G10B10A2_UINT = 25,
+ DXGI_FORMAT_R11G11B10_FLOAT = 26,
+ DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
+ DXGI_FORMAT_R8G8B8A8_UNORM = 28,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
+ DXGI_FORMAT_R8G8B8A8_UINT = 30,
+ DXGI_FORMAT_R8G8B8A8_SNORM = 31,
+ DXGI_FORMAT_R8G8B8A8_SINT = 32,
+ DXGI_FORMAT_R16G16_TYPELESS = 33,
+ DXGI_FORMAT_R16G16_FLOAT = 34,
+ DXGI_FORMAT_R16G16_UNORM = 35,
+ DXGI_FORMAT_R16G16_UINT = 36,
+ DXGI_FORMAT_R16G16_SNORM = 37,
+ DXGI_FORMAT_R16G16_SINT = 38,
+ DXGI_FORMAT_R32_TYPELESS = 39,
+ DXGI_FORMAT_D32_FLOAT = 40,
+ DXGI_FORMAT_R32_FLOAT = 41,
+ DXGI_FORMAT_R32_UINT = 42,
+ DXGI_FORMAT_R32_SINT = 43,
+ DXGI_FORMAT_R24G8_TYPELESS = 44,
+ DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
+ DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
+ DXGI_FORMAT_R8G8_TYPELESS = 48,
+ DXGI_FORMAT_R8G8_UNORM = 49,
+ DXGI_FORMAT_R8G8_UINT = 50,
+ DXGI_FORMAT_R8G8_SNORM = 51,
+ DXGI_FORMAT_R8G8_SINT = 52,
+ DXGI_FORMAT_R16_TYPELESS = 53,
+ DXGI_FORMAT_R16_FLOAT = 54,
+ DXGI_FORMAT_D16_UNORM = 55,
+ DXGI_FORMAT_R16_UNORM = 56,
+ DXGI_FORMAT_R16_UINT = 57,
+ DXGI_FORMAT_R16_SNORM = 58,
+ DXGI_FORMAT_R16_SINT = 59,
+ DXGI_FORMAT_R8_TYPELESS = 60,
+ DXGI_FORMAT_R8_UNORM = 61,
+ DXGI_FORMAT_R8_UINT = 62,
+ DXGI_FORMAT_R8_SNORM = 63,
+ DXGI_FORMAT_R8_SINT = 64,
+ DXGI_FORMAT_A8_UNORM = 65,
+ DXGI_FORMAT_R1_UNORM = 66,
+ DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
+ DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
+ DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
+ DXGI_FORMAT_BC1_TYPELESS = 70,
+ DXGI_FORMAT_BC1_UNORM = 71,
+ DXGI_FORMAT_BC1_UNORM_SRGB = 72,
+ DXGI_FORMAT_BC2_TYPELESS = 73,
+ DXGI_FORMAT_BC2_UNORM = 74,
+ DXGI_FORMAT_BC2_UNORM_SRGB = 75,
+ DXGI_FORMAT_BC3_TYPELESS = 76,
+ DXGI_FORMAT_BC3_UNORM = 77,
+ DXGI_FORMAT_BC3_UNORM_SRGB = 78,
+ DXGI_FORMAT_BC4_TYPELESS = 79,
+ DXGI_FORMAT_BC4_UNORM = 80,
+ DXGI_FORMAT_BC4_SNORM = 81,
+ DXGI_FORMAT_BC5_TYPELESS = 82,
+ DXGI_FORMAT_BC5_UNORM = 83,
+ DXGI_FORMAT_BC5_SNORM = 84,
+ DXGI_FORMAT_B5G6R5_UNORM = 85,
+ DXGI_FORMAT_B5G5R5A1_UNORM = 86,
+ DXGI_FORMAT_B8G8R8A8_UNORM = 87,
+ DXGI_FORMAT_B8G8R8X8_UNORM = 88,
+ DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
+ DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
+ DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
+ DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
+ DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
+ DXGI_FORMAT_BC6H_TYPELESS = 94,
+ DXGI_FORMAT_BC6H_UF16 = 95,
+ DXGI_FORMAT_BC6H_SF16 = 96,
+ DXGI_FORMAT_BC7_TYPELESS = 97,
+ DXGI_FORMAT_BC7_UNORM = 98,
+ DXGI_FORMAT_BC7_UNORM_SRGB = 99,
+ DXGI_FORMAT_AYUV = 100,
+ DXGI_FORMAT_Y410 = 101,
+ DXGI_FORMAT_Y416 = 102,
+ DXGI_FORMAT_NV12 = 103,
+ DXGI_FORMAT_P010 = 104,
+ DXGI_FORMAT_P016 = 105,
+ DXGI_FORMAT_420_OPAQUE = 106,
+ DXGI_FORMAT_YUY2 = 107,
+ DXGI_FORMAT_Y210 = 108,
+ DXGI_FORMAT_Y216 = 109,
+ DXGI_FORMAT_NV11 = 110,
+ DXGI_FORMAT_AI44 = 111,
+ DXGI_FORMAT_IA44 = 112,
+ DXGI_FORMAT_P8 = 113,
+ DXGI_FORMAT_A8P8 = 114,
+ DXGI_FORMAT_B4G4R4A4_UNORM = 115,
+ DXGI_FORMAT_P208 = 130,
+ DXGI_FORMAT_V208 = 131,
+ DXGI_FORMAT_V408 = 132,
+};
+
+template <int a, int b, int c, int d>
+struct DdsFourCC
+{
+ static const quint32 value = a | (b << 8) | (c << 16) | (d << 24);
+};
+
+struct FormatInfo {
+ QOpenGLTexture::PixelFormat pixelFormat;
+ QOpenGLTexture::TextureFormat textureFormat;
+ QOpenGLTexture::PixelType pixelType;
+ int components;
+ bool compressed;
+};
+
+const struct RGBAFormat {
+ quint32 redMask;
+ quint32 greenMask;
+ quint32 blueMask;
+ quint32 alphaMask;
+ FormatInfo formatInfo;
+} rgbaFormats[] = {
+ // unorm formats
+ { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA8_UNorm, QOpenGLTexture::UInt8, 4, false } },
+ { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, { QOpenGLTexture::BGRA, QOpenGLTexture::RGBA8_UNorm, QOpenGLTexture::UInt8, 4, false } },
+ { 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA8_UNorm, QOpenGLTexture::UInt8, 4, false } },
+ { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, { QOpenGLTexture::BGRA, QOpenGLTexture::RGBA8_UNorm, QOpenGLTexture::UInt8, 4, false } },
+ { 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000, { QOpenGLTexture::RGB, QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, 3, false } },
+ { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000, { QOpenGLTexture::BGR, QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, 3, false } },
+
+ // packed formats
+ { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000, { QOpenGLTexture::RGB, QOpenGLTexture::R5G6B5, QOpenGLTexture::UInt16_R5G6B5, 2, false } },
+ { 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000, { QOpenGLTexture::RGBA, QOpenGLTexture::RGB5A1, QOpenGLTexture::UInt16_RGB5A1, 2, false } },
+ { 0x00000f00, 0x000000f0, 0x0000000f, 0x0000f000, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA4, QOpenGLTexture::UInt16_RGBA4, 2, false } },
+ { 0x000000e0, 0x0000001c, 0x00000003, 0x00000000, { QOpenGLTexture::RGB, QOpenGLTexture::RG3B2, QOpenGLTexture::UInt8_RG3B2, 1, false } },
+ { 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000, { QOpenGLTexture::RGBA, QOpenGLTexture::RGB10A2, QOpenGLTexture::UInt32_RGB10A2, 4, false } },
+
+ // luminance alpha
+ { 0x000000ff, 0x000000ff, 0x000000ff, 0x00000000, { QOpenGLTexture::Red, QOpenGLTexture::R8_UNorm, QOpenGLTexture::UInt8, 1, false } },
+ { 0x000000ff, 0x00000000, 0x00000000, 0x00000000, { QOpenGLTexture::Red, QOpenGLTexture::R8_UNorm, QOpenGLTexture::UInt8, 1, false } },
+ { 0x000000ff, 0x000000ff, 0x000000ff, 0x0000ff00, { QOpenGLTexture::RG, QOpenGLTexture::RG8_UNorm, QOpenGLTexture::UInt8, 2, false } },
+ { 0x000000ff, 0x00000000, 0x00000000, 0x0000ff00, { QOpenGLTexture::RG, QOpenGLTexture::RG8_UNorm, QOpenGLTexture::UInt8, 2, false } },
+};
+
+const struct FourCCFormat {
+ quint32 fourCC;
+ FormatInfo formatInfo;
+} fourCCFormats[] = {
+ { DdsFourCC<'D','X','T','1'>::value, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGBA_DXT1, QOpenGLTexture::NoPixelType, 8, true } },
+ { DdsFourCC<'D','X','T','3'>::value, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGBA_DXT3, QOpenGLTexture::NoPixelType, 16, true } },
+ { DdsFourCC<'D','X','T','5'>::value, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGBA_DXT5, QOpenGLTexture::NoPixelType, 16, true } },
+ { DdsFourCC<'A','T','I','1'>::value, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::R_ATI1N_UNorm, QOpenGLTexture::NoPixelType, 8, true } },
+ { DdsFourCC<'A','T','I','2'>::value, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RG_ATI2N_UNorm, QOpenGLTexture::NoPixelType, 16, true } },
+};
+
+const struct DX10Format {
+ DXGIFormat dxgiFormat;
+ FormatInfo formatInfo;
+} dx10Formats[] = {
+ // unorm formats
+ { DXGI_FORMAT_R8_UNORM, { QOpenGLTexture::Red, QOpenGLTexture::R8_UNorm, QOpenGLTexture::UInt8, 1, false } },
+ { DXGI_FORMAT_R8G8_UNORM, { QOpenGLTexture::RG, QOpenGLTexture::RG8_UNorm, QOpenGLTexture::UInt8, 2, false } },
+ { DXGI_FORMAT_R8G8B8A8_UNORM, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA8_UNorm, QOpenGLTexture::UInt8, 4, false } },
+
+ { DXGI_FORMAT_R16_UNORM, { QOpenGLTexture::Red, QOpenGLTexture::R16_UNorm, QOpenGLTexture::UInt16, 2, false } },
+ { DXGI_FORMAT_R16G16_UNORM, { QOpenGLTexture::RG, QOpenGLTexture::RG16_UNorm, QOpenGLTexture::UInt16, 4, false } },
+ { DXGI_FORMAT_R16G16B16A16_UNORM, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA16_UNorm, QOpenGLTexture::UInt16, 8, false } },
+
+ // snorm formats
+ { DXGI_FORMAT_R8_SNORM, { QOpenGLTexture::Red, QOpenGLTexture::R8_SNorm, QOpenGLTexture::Int8, 1, false } },
+ { DXGI_FORMAT_R8G8_SNORM, { QOpenGLTexture::RG, QOpenGLTexture::RG8_SNorm, QOpenGLTexture::Int8, 2, false } },
+ { DXGI_FORMAT_R8G8B8A8_SNORM, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA8_SNorm, QOpenGLTexture::Int8, 4, false } },
+
+ { DXGI_FORMAT_R16_SNORM, { QOpenGLTexture::Red, QOpenGLTexture::R16_SNorm, QOpenGLTexture::Int16, 2, false } },
+ { DXGI_FORMAT_R16G16_SNORM, { QOpenGLTexture::RG, QOpenGLTexture::RG16_SNorm, QOpenGLTexture::Int16, 4, false } },
+ { DXGI_FORMAT_R16G16B16A16_SNORM, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA16_SNorm, QOpenGLTexture::Int16, 8, false } },
+
+ // unsigned integer formats
+ { DXGI_FORMAT_R8_UINT, { QOpenGLTexture::Red_Integer, QOpenGLTexture::R8U, QOpenGLTexture::UInt8, 1, false } },
+ { DXGI_FORMAT_R8G8_UINT, { QOpenGLTexture::RG_Integer, QOpenGLTexture::RG8U, QOpenGLTexture::UInt8, 2, false } },
+ { DXGI_FORMAT_R8G8B8A8_UINT, { QOpenGLTexture::RGBA_Integer, QOpenGLTexture::RGBA8U, QOpenGLTexture::UInt8, 4, false } },
+
+ { DXGI_FORMAT_R16_UINT, { QOpenGLTexture::Red_Integer, QOpenGLTexture::R16U, QOpenGLTexture::UInt16, 2, false } },
+ { DXGI_FORMAT_R16G16_UINT, { QOpenGLTexture::RG_Integer, QOpenGLTexture::RG16U, QOpenGLTexture::UInt16, 4, false } },
+ { DXGI_FORMAT_R16G16B16A16_UINT, { QOpenGLTexture::RGBA_Integer, QOpenGLTexture::RGBA16U, QOpenGLTexture::UInt16, 8, false } },
+
+ { DXGI_FORMAT_R32_UINT, { QOpenGLTexture::Red_Integer, QOpenGLTexture::R32U, QOpenGLTexture::UInt32, 4, false } },
+ { DXGI_FORMAT_R32G32_UINT, { QOpenGLTexture::RG_Integer, QOpenGLTexture::RG32U, QOpenGLTexture::UInt32, 8, false } },
+ { DXGI_FORMAT_R32G32B32_UINT, { QOpenGLTexture::RGB_Integer, QOpenGLTexture::RGB32U, QOpenGLTexture::UInt32, 12, false } },
+ { DXGI_FORMAT_R32G32B32A32_UINT, { QOpenGLTexture::RGBA_Integer, QOpenGLTexture::RGBA32U, QOpenGLTexture::UInt32, 16, false } },
+
+ // signed integer formats
+ { DXGI_FORMAT_R8_SINT, { QOpenGLTexture::Red_Integer, QOpenGLTexture::R8I, QOpenGLTexture::Int8, 1, false } },
+ { DXGI_FORMAT_R8G8_SINT, { QOpenGLTexture::RG_Integer, QOpenGLTexture::RG8I, QOpenGLTexture::Int8, 2, false } },
+ { DXGI_FORMAT_R8G8B8A8_SINT, { QOpenGLTexture::RGBA_Integer, QOpenGLTexture::RGBA8I, QOpenGLTexture::Int8, 4, false } },
+
+ { DXGI_FORMAT_R16_SINT, { QOpenGLTexture::Red_Integer, QOpenGLTexture::R16I, QOpenGLTexture::Int16, 2, false } },
+ { DXGI_FORMAT_R16G16_SINT, { QOpenGLTexture::RG_Integer, QOpenGLTexture::RG16I, QOpenGLTexture::Int16, 4, false } },
+ { DXGI_FORMAT_R16G16B16A16_SINT, { QOpenGLTexture::RGBA_Integer, QOpenGLTexture::RGBA16I, QOpenGLTexture::Int16, 8, false } },
+
+ { DXGI_FORMAT_R32_SINT, { QOpenGLTexture::Red_Integer, QOpenGLTexture::R32I, QOpenGLTexture::Int32, 4, false } },
+ { DXGI_FORMAT_R32G32_SINT, { QOpenGLTexture::RG_Integer, QOpenGLTexture::RG32I, QOpenGLTexture::Int32, 8, false } },
+ { DXGI_FORMAT_R32G32B32_SINT, { QOpenGLTexture::RGB_Integer, QOpenGLTexture::RGB32I, QOpenGLTexture::Int32, 12, false } },
+ { DXGI_FORMAT_R32G32B32A32_SINT, { QOpenGLTexture::RGBA_Integer, QOpenGLTexture::RGBA32I, QOpenGLTexture::Int32, 16, false } },
+
+ // floating formats
+ { DXGI_FORMAT_R16_FLOAT, { QOpenGLTexture::Red, QOpenGLTexture::R16F, QOpenGLTexture::Float16, 2, false } },
+ { DXGI_FORMAT_R16G16_FLOAT, { QOpenGLTexture::RG, QOpenGLTexture::RG16F, QOpenGLTexture::Float16, 4, false } },
+ { DXGI_FORMAT_R16G16B16A16_FLOAT, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA16F, QOpenGLTexture::Float16, 8, false } },
+
+ { DXGI_FORMAT_R32_FLOAT, { QOpenGLTexture::Red, QOpenGLTexture::R32F, QOpenGLTexture::Float32, 4, false } },
+ { DXGI_FORMAT_R32G32_FLOAT, { QOpenGLTexture::RG, QOpenGLTexture::RG32F, QOpenGLTexture::Float32, 8, false } },
+ { DXGI_FORMAT_R32G32B32_FLOAT, { QOpenGLTexture::RGB, QOpenGLTexture::RGB32F, QOpenGLTexture::Float32, 12, false } },
+ { DXGI_FORMAT_R32G32B32A32_FLOAT, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA32F, QOpenGLTexture::Float32, 16, false } },
+
+ // sRGB formats
+ { DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, { QOpenGLTexture::RGB, QOpenGLTexture::SRGB8, QOpenGLTexture::UInt8, 4, false } },
+ { DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, { QOpenGLTexture::RGBA, QOpenGLTexture::SRGB8_Alpha8, QOpenGLTexture::UInt8, 4, false } },
+
+ // packed formats
+ // { DXGI_FORMAT_R10G10B10A2_UNORM, { QOpenGLTexture::RGB10A2_UNORM, QOpenGLTexture::RGBA, QOpenGLTexture::UInt32_RGB10A2, 4, false } },
+ { DXGI_FORMAT_R10G10B10A2_UINT, { QOpenGLTexture::RGBA_Integer, QOpenGLTexture::RGB10A2, QOpenGLTexture::UInt32_RGB10A2, 4, false } },
+ { DXGI_FORMAT_R9G9B9E5_SHAREDEXP, { QOpenGLTexture::RGB, QOpenGLTexture::RGB9E5, QOpenGLTexture::UInt32_RGB9_E5, 4, false } },
+ { DXGI_FORMAT_R11G11B10_FLOAT, { QOpenGLTexture::RGB, QOpenGLTexture::RG11B10F, QOpenGLTexture::UInt32_RG11B10F, 4, false } },
+ { DXGI_FORMAT_B5G6R5_UNORM, { QOpenGLTexture::RGB, QOpenGLTexture::R5G6B5, QOpenGLTexture::UInt16_R5G6B5, 2, false } },
+ { DXGI_FORMAT_B5G5R5A1_UNORM, { QOpenGLTexture::RGBA, QOpenGLTexture::RGB5A1, QOpenGLTexture::UInt16_RGB5A1, 2, false } },
+ { DXGI_FORMAT_B4G4R4A4_UNORM, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA4, QOpenGLTexture::UInt16_RGBA4, 2, false } },
+
+ // swizzle formats
+ { DXGI_FORMAT_B8G8R8X8_UNORM, { QOpenGLTexture::BGRA, QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, 4, false } },
+ { DXGI_FORMAT_B8G8R8A8_UNORM, { QOpenGLTexture::BGRA, QOpenGLTexture::RGBA8_UNorm, QOpenGLTexture::UInt8, 4, false } },
+ { DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, { QOpenGLTexture::BGRA, QOpenGLTexture::SRGB8, QOpenGLTexture::UInt8, 4, false } },
+ { DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, { QOpenGLTexture::BGRA, QOpenGLTexture::SRGB8_Alpha8, QOpenGLTexture::UInt8, 4, false } },
+
+ // luminance alpha formats
+ { DXGI_FORMAT_R8_UNORM, { QOpenGLTexture::Red, QOpenGLTexture::R8_UNorm, QOpenGLTexture::UInt8, 1, false } },
+ { DXGI_FORMAT_R8G8_UNORM, { QOpenGLTexture::RG, QOpenGLTexture::RG8_UNorm, QOpenGLTexture::UInt8, 2, false } },
+ { DXGI_FORMAT_R16_UNORM, { QOpenGLTexture::Red, QOpenGLTexture::R16_UNorm, QOpenGLTexture::UInt16, 2, false } },
+ { DXGI_FORMAT_R16_UNORM, { QOpenGLTexture::RG, QOpenGLTexture::RG16_UNorm, QOpenGLTexture::UInt16, 4, false } },
+
+ // depth formats
+ { DXGI_FORMAT_D16_UNORM, { QOpenGLTexture::Depth, QOpenGLTexture::D16, QOpenGLTexture::NoPixelType, 2, false } },
+ { DXGI_FORMAT_D24_UNORM_S8_UINT, { QOpenGLTexture::DepthStencil, QOpenGLTexture::D24S8, QOpenGLTexture::NoPixelType, 4, false } },
+ { DXGI_FORMAT_D32_FLOAT, { QOpenGLTexture::Depth, QOpenGLTexture::D32F, QOpenGLTexture::NoPixelType, 4, false } },
+ { DXGI_FORMAT_D32_FLOAT_S8X24_UINT, { QOpenGLTexture::DepthStencil, QOpenGLTexture::D32FS8X24, QOpenGLTexture::NoPixelType, 8, false } },
+
+ // compressed formats
+ { DXGI_FORMAT_BC1_UNORM, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGBA_DXT1, QOpenGLTexture::NoPixelType, 8, true } },
+ { DXGI_FORMAT_BC2_UNORM, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGBA_DXT3, QOpenGLTexture::NoPixelType, 16, true } },
+ { DXGI_FORMAT_BC3_UNORM, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGBA_DXT5, QOpenGLTexture::NoPixelType, 16, true } },
+ { DXGI_FORMAT_BC4_UNORM, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::R_ATI1N_UNorm, QOpenGLTexture::NoPixelType, 8, true } },
+ { DXGI_FORMAT_BC4_SNORM, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::R_ATI1N_SNorm, QOpenGLTexture::NoPixelType, 8, true } },
+ { DXGI_FORMAT_BC5_UNORM, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RG_ATI2N_UNorm, QOpenGLTexture::NoPixelType, 16, true } },
+ { DXGI_FORMAT_BC5_SNORM, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RG_ATI2N_SNorm, QOpenGLTexture::NoPixelType, 16, true } },
+ { DXGI_FORMAT_BC6H_UF16, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGB_BP_UNSIGNED_FLOAT, QOpenGLTexture::NoPixelType, 16, true } },
+ { DXGI_FORMAT_BC6H_SF16, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGB_BP_SIGNED_FLOAT, QOpenGLTexture::NoPixelType, 16, true } },
+ { DXGI_FORMAT_BC7_UNORM, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGB_BP_UNorm, QOpenGLTexture::NoPixelType, 16, true } },
+
+ // compressed sRGB formats
+ { DXGI_FORMAT_BC1_UNORM_SRGB, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::SRGB_DXT1, QOpenGLTexture::NoPixelType, 8, true } },
+ { DXGI_FORMAT_BC1_UNORM_SRGB, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::SRGB_Alpha_DXT1, QOpenGLTexture::NoPixelType, 8, true } },
+ { DXGI_FORMAT_BC2_UNORM_SRGB, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::SRGB_Alpha_DXT3, QOpenGLTexture::NoPixelType, 16, true } },
+ { DXGI_FORMAT_BC3_UNORM_SRGB, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::SRGB_Alpha_DXT5, QOpenGLTexture::NoPixelType, 16, true } },
+ { DXGI_FORMAT_BC7_UNORM_SRGB, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::SRGB_BP_UNorm, QOpenGLTexture::NoPixelType, 16, true } },
+};
+
+} // namespace
+
+QTextureImageDataPrivate::QTextureImageDataPrivate()
+ : m_width(-1)
+ , m_height(-1)
+ , m_depth(-1)
+ , m_layers(-1)
+ , m_faces(-1)
+ , m_mipLevels(-1)
+ , m_blockSize(-1)
+ , m_target(QOpenGLTexture::Target2D)
+ , m_format(QOpenGLTexture::RGBA8_UNorm)
+ , m_pixelFormat(QOpenGLTexture::RGBA)
+ , m_pixelType(QOpenGLTexture::UInt8)
+ , m_isCompressed(false)
+{
+}
+
+QByteArray QTextureImageDataPrivate::data(int layer, int face, int mipmapLevel) const
+{
+ if (layer < 0 || layer >= m_layers ||
+ face < 0 || face >= m_faces ||
+ mipmapLevel < 0 || mipmapLevel >= m_mipLevels)
+ return QByteArray();
+
+ int offset = layer*layerSize() + face*faceSize();
+
+ for (int i = 0; i < mipmapLevel; i++)
+ offset += mipmapLevelSize(i);
+
+ return QByteArray::fromRawData(m_data.constData() + offset, mipmapLevelSize(mipmapLevel));
+}
+
+void QTextureImageDataPrivate::setData(const QByteArray &data, QOpenGLTexture::PixelFormat fmt,
+ QOpenGLTexture::PixelType ptype)
+{
+ m_isCompressed = false;
+ m_data = data;
+ m_layers = 1;
+ m_faces = 1;
+ m_mipLevels = 1;
+ m_target = QOpenGLTexture::Target2D;
+ m_pixelFormat = fmt;
+ m_pixelType = ptype;
+}
+
+bool QTextureImageDataPrivate::setCompressedFile(const QString &source)
+{
+ QString suffix = QFileInfo(source).suffix();
+
+ if (suffix == QLatin1String("pkm"))
+ return setPkmFile(source);
+ else if (suffix == QLatin1String("dds"))
+ return setDdsFile(source);
+ else
+ return false;
+}
+
+bool QTextureImageDataPrivate::setPkmFile(const QString &source)
+{
+ QFile f(source);
+ if (!f.open(QIODevice::ReadOnly)) {
+ qWarning() << "Failed to open" << source;
+ return false;
+ }
+
+ // ETC1 in PKM, as generated by f.ex. Android's etc1tool
+ static const char pkmMagic[] = { 'P', 'K', 'M', ' ', '1', '0' };
+ const int pkmHeaderSize = 6 + 2 + 4 * 2;
+ QByteArray header = f.read(pkmHeaderSize);
+ if (header.size() >= pkmHeaderSize && !qstrncmp(header.constData(), pkmMagic, 6)) {
+ m_format = QOpenGLTexture::RGB8_ETC1; // may get changed to RGB8_ETC2 later on
+ // get the extended (multiple of 4) width and height
+ m_width = qFromBigEndian(*(reinterpret_cast<const quint16 *>(header.constData() + 6 + 2)));
+ m_height = qFromBigEndian(*(reinterpret_cast<const quint16 *>(header.constData() + 6 + 2 + 2)));
+ m_depth = 1;
+ QByteArray data = f.readAll();
+ if (data.size() < (m_width / 4) * (m_height / 4) * 8)
+ qWarning() << "Unexpected end of ETC1 data in" << source;
+ setData(data, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
+ m_blockSize = 8;
+ m_isCompressed = true;
+ return true;
+ }
+
+ return false;
+}
+
+static int bitCount(quint32 n)
+{
+ int r = 0;
+
+ for (; n; n >>= 1)
+ r += (n & 1);
+
+ return r;
+}
+
+bool QTextureImageDataPrivate::setDdsFile(const QString &source)
+{
+ QFile f(source);
+ if (!f.open(QIODevice::ReadOnly)) {
+ qWarning() << "Failed to open" << source;
+ return false;
+ }
+
+ DdsHeader header;
+ if (f.read(reinterpret_cast<char *>(&header), sizeof header) != sizeof header)
+ return false;
+
+ if (qstrncmp(header.magic, "DDS ", 4) != 0)
+ return false;
+
+ // dimensions
+
+ m_width = qFromLittleEndian(header.width);
+ m_height = qFromLittleEndian(header.height);
+
+ // mip levels
+
+ if ((qFromLittleEndian(header.flags) & MipmapCountFlag) == MipmapCountFlag)
+ m_mipLevels = qFromLittleEndian(header.mipmapCount);
+ else
+ m_mipLevels = 1;
+
+ // texture format
+
+ m_layers = 1;
+
+ const quint32 pixelFlags = qFromLittleEndian(header.pixelFormat.flags);
+ const quint32 fourCC = qFromLittleEndian(header.pixelFormat.fourCC);
+
+ const FormatInfo *formatInfo = nullptr;
+
+ if ((pixelFlags & FourCCFlag) == FourCCFlag) {
+ if (fourCC == DdsFourCC<'D', 'X', '1', '0'>::value) {
+ // DX10 texture
+
+ DdsDX10Header dx10Header;
+ if (f.read(reinterpret_cast<char *>(&dx10Header), sizeof dx10Header) != sizeof dx10Header)
+ return false;
+
+ m_layers = qFromLittleEndian(dx10Header.arraySize);
+
+ DXGIFormat format = static_cast<DXGIFormat>(qFromLittleEndian(dx10Header.format));
+
+ for (unsigned i = 0; i < sizeof dx10Formats/sizeof *dx10Formats; i++) {
+ if (dx10Formats[i].dxgiFormat == format) {
+ formatInfo = &dx10Formats[i].formatInfo;
+ break;
+ }
+ }
+ } else {
+ // compressed, FourCC texture
+
+ for (unsigned i = 0; i < sizeof fourCCFormats/sizeof *fourCCFormats; i++) {
+ if (fourCCFormats[i].fourCC == fourCC) {
+ formatInfo = &fourCCFormats[i].formatInfo;
+ break;
+ }
+ }
+ }
+ } else {
+ // uncompressed texture
+
+ m_pixelFormat = QOpenGLTexture::NoSourceFormat;
+
+ const quint32 rgbBitCount = qFromLittleEndian(header.pixelFormat.rgbBitCount);
+ const quint32 redMask = qFromLittleEndian(header.pixelFormat.redMask);
+ const quint32 greenMask = qFromLittleEndian(header.pixelFormat.greenMask);
+ const quint32 blueMask = qFromLittleEndian(header.pixelFormat.blueMask);
+ const quint32 alphaMask = qFromLittleEndian(header.pixelFormat.alphaMask);
+
+ for (unsigned i = 0; i < sizeof rgbaFormats/sizeof *rgbaFormats; i++) {
+ const RGBAFormat *info = &rgbaFormats[i];
+
+ if (info->formatInfo.components*8u == rgbBitCount &&
+ info->redMask == redMask && info->greenMask == greenMask &&
+ info->blueMask == blueMask && info->alphaMask == alphaMask) {
+ formatInfo = &info->formatInfo;
+ break;
+ }
+ }
+ }
+
+ if (formatInfo == nullptr) {
+ qWarning() << "Unrecognized pixel format in" << source;
+ return false;
+ }
+
+ m_pixelFormat = formatInfo->pixelFormat;
+ m_format = formatInfo->textureFormat;
+ m_pixelType = formatInfo->pixelType;
+ m_blockSize = formatInfo->components;
+ m_isCompressed = formatInfo->compressed;
+
+ // target
+
+ // XXX should worry about Target1D?
+
+ const quint32 caps2Flags = qFromLittleEndian(header.caps2);
+
+ if ((caps2Flags & VolumeFlag) == VolumeFlag) {
+ m_target = QOpenGLTexture::Target3D;
+ m_depth = qFromLittleEndian(header.depth);
+ m_faces = 1;
+ } else if ((caps2Flags & CubemapFlag) == CubemapFlag) {
+ m_target = m_layers > 1 ? QOpenGLTexture::TargetCubeMapArray : QOpenGLTexture::TargetCubeMap;
+ m_depth = 1;
+ m_faces = bitCount(caps2Flags & AllCubemapFaceFlags);
+ } else {
+ m_target = m_layers > 1 ? QOpenGLTexture::Target2DArray : QOpenGLTexture::Target2D;
+ m_depth = 1;
+ m_faces = 1;
+ }
+
+ // data
+
+ m_data = f.readAll();
+
+ if (m_data.size() != m_layers*layerSize()) {
+ qWarning() << "Unexpected data size (got " << m_data.size() << ", expecting" << m_layers*layerSize() << ")";
+ return false;
+ }
+
+ return true;
+}
+
+int QTextureImageDataPrivate::layerSize() const
+{
+ return m_faces*faceSize();
+}
+
+int QTextureImageDataPrivate::faceSize() const
+{
+ int size = 0;
+
+ for (int i = 0; i < m_mipLevels; i++)
+ size += mipmapLevelSize(i);
+
+ return size;
+}
+
+// XXX check if this works for ETC1 compression
+int QTextureImageDataPrivate::mipmapLevelSize(int level) const
+{
+ int w = qMax(m_width >> level, 1);
+ int h = qMax(m_height >> level, 1);
+ int d = qMax(m_depth >> level, 1);
+
+ if (m_isCompressed)
+ return ((w + 3) / 4) * ((h + 3) / 4) * m_blockSize * d;
+ else
+ return w * h * m_blockSize * d;
+}
+
+QTextureImageData::QTextureImageData()
+ : d_ptr(new QTextureImageDataPrivate())
+{
+}
+
+QTextureImageData::QTextureImageData(QTextureImageDataPrivate &dd)
+ : d_ptr(&dd)
+{
+}
+
+QTextureImageData::~QTextureImageData()
+{
+ cleanup();
+ delete d_ptr;
+}
+
+QTextureImageData &QTextureImageData::operator=(const QTextureImageData &other)
+{
+ Q_D(QTextureImageData);
+ *d = *other.d_ptr;
+ return *this;
+}
+
+void QTextureImageData::cleanup() Q_DECL_NOTHROW
+{
+ Q_D(QTextureImageData);
+ d->m_width = -1;
+ d->m_height = -1;
+ d->m_depth = -1;
+ d->m_layers = -1;
+ d->m_faces = -1;
+ d->m_mipLevels = -1;
+ d->m_blockSize = 0;
+ d->m_isCompressed = false;
+ d->m_data.clear();
+}
+
+bool QTextureImageData::isCompressed() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_isCompressed;
+}
+
+int QTextureImageData::width() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_width;
+}
+
+int QTextureImageData::height() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_height;
+}
+
+int QTextureImageData::depth() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_depth;
+}
+
+int QTextureImageData::layers() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_layers;
+}
+
+int QTextureImageData::mipLevels() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_mipLevels;
+}
+
+int QTextureImageData::faces() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_faces;;
+}
+
+QOpenGLTexture::Target QTextureImageData::target() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_target;
+}
+
+QOpenGLTexture::TextureFormat QTextureImageData::format() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_format;
+}
+
+void QTextureImageData::setImage(const QImage &image)
+{
+ Q_D(QTextureImageData);
+ d->m_width = image.width();
+ d->m_height = image.height();
+ d->m_depth = 1;
+
+ QImage glImage = image.convertToFormat(QImage::Format_RGBA8888);
+ Q_ASSERT_X(glImage.bytesPerLine() == (glImage.width() * glImage.depth() + 7) / 8,
+ "QTextureImageData::setImage", "glImage is not packed"); // QTBUG-48330
+ QByteArray imageBytes((const char*) glImage.constBits(), glImage.byteCount());
+ setData(imageBytes, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8);
+ d->m_format = QOpenGLTexture::RGBA8_UNorm;
+ d->m_blockSize = 4;
+}
+
+void QTextureImageData::setData(const QByteArray &data, QOpenGLTexture::PixelFormat fmt,
+ QOpenGLTexture::PixelType ptype)
+{
+ Q_D(QTextureImageData);
+ d->setData(data, fmt, ptype);
+}
+
+bool QTextureImageData::setCompressedFile(const QString &source)
+{
+ Q_D(QTextureImageData);
+ return d->setCompressedFile(source);
+}
+
+QByteArray QTextureImageData::data(int layer, int face, int mipmapLevel) const
+{
+ Q_D(const QTextureImageData);
+ return d->data(layer, face, mipmapLevel);
+}
+
+QOpenGLTexture::PixelFormat QTextureImageData::pixelFormat() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_pixelFormat;
+}
+
+QOpenGLTexture::PixelType QTextureImageData::pixelType() const Q_DECL_NOTHROW
+{
+ Q_D(const QTextureImageData);
+ return d->m_pixelType;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/texture/qtextureimagedata.h b/src/render/texture/qtextureimagedata.h
new file mode 100644
index 000000000..c1cc40593
--- /dev/null
+++ b/src/render/texture/qtextureimagedata.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_TEXTUREIMAGEDATA_H
+#define QT3DRENDER_TEXTUREIMAGEDATA_H
+
+#include <QtGui/QOpenGLTexture>
+#include <QtGui/QImage>
+#include <QtCore/QSharedPointer>
+#include <Qt3DRender/qt3drender_global.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QTextureImageDataPrivate;
+
+class QT3DRENDERSHARED_EXPORT QTextureImageData
+{
+public:
+ QTextureImageData();
+ ~QTextureImageData();
+
+ QTextureImageData &operator=(const QTextureImageData &other);
+
+ void cleanup() Q_DECL_NOTHROW;
+
+ bool isCompressed() const Q_DECL_NOTHROW;
+
+ int width() const Q_DECL_NOTHROW;
+ int height() const Q_DECL_NOTHROW;
+ int depth() const Q_DECL_NOTHROW;
+
+ int layers() const Q_DECL_NOTHROW;
+ int mipLevels() const Q_DECL_NOTHROW;
+ int faces() const Q_DECL_NOTHROW;
+
+ QOpenGLTexture::Target target() const Q_DECL_NOTHROW;
+
+ QOpenGLTexture::TextureFormat format() const Q_DECL_NOTHROW;
+
+ void setImage(const QImage &);
+
+ void setData(const QByteArray &data,
+ QOpenGLTexture::PixelFormat fmt,
+ QOpenGLTexture::PixelType ptype);
+
+ bool setCompressedFile(const QString &source);
+
+ QByteArray data(int layer = 0, int face = 0, int mipmapLevel = 0) const;
+
+ QOpenGLTexture::PixelFormat pixelFormat() const Q_DECL_NOTHROW;
+
+ QOpenGLTexture::PixelType pixelType() const Q_DECL_NOTHROW;
+
+protected:
+ QTextureImageData(QTextureImageDataPrivate &dd);
+
+private:
+ Q_DECLARE_PRIVATE(QTextureImageData)
+ QTextureImageDataPrivate *d_ptr;
+};
+
+typedef QSharedPointer<QTextureImageData> QTextureImageDataPtr;
+
+} // namespace Qt3DRender
+
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_TEXTUREIMAGEDATA_H
diff --git a/src/render/texture/qtextureimagedata_p.h b/src/render/texture/qtextureimagedata_p.h
new file mode 100644
index 000000000..6d46ae1b7
--- /dev/null
+++ b/src/render/texture/qtextureimagedata_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_TEXTUREDATA_P_H
+#define QT3DRENDER_TEXTUREDATA_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qtextureimagedata.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QTextureImageDataPrivate
+{
+public:
+ QTextureImageDataPrivate();
+
+ void setData(const QByteArray &data, QOpenGLTexture::PixelFormat fmt,
+ QOpenGLTexture::PixelType ptype);
+
+ bool setCompressedFile(const QString &source);
+
+ QByteArray data(int layer, int face, int mipmapLevel) const;
+
+ int m_width;
+ int m_height;
+ int m_depth;
+ int m_layers;
+ int m_faces;
+ int m_mipLevels;
+ int m_blockSize;
+
+ QOpenGLTexture::Target m_target;
+ QOpenGLTexture::TextureFormat m_format;
+ QOpenGLTexture::PixelFormat m_pixelFormat;
+ QOpenGLTexture::PixelType m_pixelType;
+
+ bool m_isCompressed;
+ QByteArray m_data;
+
+private:
+ int layerSize() const;
+ int faceSize() const;
+ int mipmapLevelSize(int level) const;
+
+ bool setPkmFile(const QString &source);
+ bool setDdsFile(const QString &source);
+};
+
+} // namespace Qt3DRender
+
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_TEXTUREDATA_P_H
diff --git a/src/render/texture/qtextureproviders.cpp b/src/render/texture/qtextureproviders.cpp
deleted file mode 100644
index ec5133138..000000000
--- a/src/render/texture/qtextureproviders.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qtextureproviders.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-/*!
- \class Qt3DRender::QTexture1D
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a Target1D target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTexture1D instance with \a parent as parent.
- */
-QTexture1D::QTexture1D(QNode *parent)
- : QAbstractTextureProvider(Target1D, parent)
-{
-}
-
-QTexture1D::~QTexture1D()
-{
-}
-
-/*!
- \class Qt3DRender::QTexture1DArray
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a Target1DArray target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTexture1DArray instance with \a parent as parent.
- */
-QTexture1DArray::QTexture1DArray(QNode *parent)
- : QAbstractTextureProvider(Target1DArray, parent)
-{
-}
-
-QTexture1DArray::~QTexture1DArray()
-{
-}
-
-/*!
- \class Qt3DRender::QTexture2D
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a Target2D target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTexture2D instance with \a parent as parent.
- */
-QTexture2D::QTexture2D(QNode *parent)
- : QAbstractTextureProvider(Target2D, parent)
-{
-}
-
-QTexture2D::~QTexture2D()
-{
-}
-
-/*!
- \class Qt3DRender::QTexture2DArray
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a Target2DArray target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTexture2DArray instance with \a parent as parent.
- */
-QTexture2DArray::QTexture2DArray(QNode *parent)
- : QAbstractTextureProvider(Target2DArray, parent)
-{
-}
-
-QTexture2DArray::~QTexture2DArray()
-{
-}
-
-
-/*!
- \class Qt3DRender::QTexture3D
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a Target3D target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTexture3D instance with \a parent as parent.
- */
-QTexture3D::QTexture3D(QNode *parent)
- : QAbstractTextureProvider(Target3D, parent)
-{
-}
-
-QTexture3D::~QTexture3D()
-{
-}
-
-/*!
- \class Qt3DRender::QTextureCubeMap
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a TargetCubeMap target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTextureCubeMap instance with \a parent as parent.
- */
-QTextureCubeMap::QTextureCubeMap(QNode *parent)
- : QAbstractTextureProvider(TargetCubeMap, parent)
-{
-}
-
-QTextureCubeMap::~QTextureCubeMap()
-{
-}
-
-/*!
- \class Qt3DRender::QTextureCubeMapArray
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a TargetCubeMapArray target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTextureCubeMapArray instance with \a parent as parent.
- */
-QTextureCubeMapArray::QTextureCubeMapArray(QNode *parent)
- : QAbstractTextureProvider(TargetCubeMapArray, parent)
-{
-}
-
-QTextureCubeMapArray::~QTextureCubeMapArray()
-{
- QNode::cleanup();
-}
-
-/*!
- \class Qt3DRender::QTexture2DMultisample
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a Target2DMultisample target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTexture2DMultisample instance with \a parent as parent.
- */
-QTexture2DMultisample::QTexture2DMultisample(QNode *parent)
- : QAbstractTextureProvider(Target2DMultisample, parent)
-{
-}
-
-QTexture2DMultisample::~QTexture2DMultisample()
-{
-}
-
-/*!
- \class Qt3DRender::QTexture2DMultisampleArray
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a Target2DMultisampleArray target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTexture2DMultisampleArray instance with \a parent as parent.
- */
-QTexture2DMultisampleArray::QTexture2DMultisampleArray(QNode *parent)
- : QAbstractTextureProvider(Target2DMultisampleArray, parent)
-{
-}
-
-QTexture2DMultisampleArray::~QTexture2DMultisampleArray()
-{
-}
-
-/*!
- \class Qt3DRender::QTextureRectangle
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a TargetRectangle target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTextureRectangle instance with \a parent as parent.
- */
-QTextureRectangle::QTextureRectangle(QNode *parent)
- : QAbstractTextureProvider(TargetRectangle, parent)
-{
-}
-
-QTextureRectangle::~QTextureRectangle()
-{
-}
-
-/*!
- \class Qt3DRender::QTextureBuffer
- \inmodule Qt3DRender
- \since 5.5
- \brief A QAbstractTextureProvider with a TargetBuffer target format.
- */
-
-/*!
- Constructs a new Qt3DRender::QTextureBuffer instance with \a parent as parent.
- */
-QTextureBuffer::QTextureBuffer(QNode *parent)
- : QAbstractTextureProvider(TargetBuffer, parent)
-{
-}
-
-QTextureBuffer::~QTextureBuffer()
-{
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-
diff --git a/src/render/texture/qtextureproviders.h b/src/render/texture/qtextureproviders.h
deleted file mode 100644
index 00a432917..000000000
--- a/src/render/texture/qtextureproviders.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QTEXTUREPROVIDERS_H
-#define QT3DRENDER_QTEXTUREPROVIDERS_H
-
-#include <Qt3DRender/qabstracttextureprovider.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QT3DRENDERSHARED_EXPORT QTexture1D : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTexture1D(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTexture1D();
-};
-
-class QT3DRENDERSHARED_EXPORT QTexture1DArray : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTexture1DArray(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTexture1DArray();
-};
-
-class QT3DRENDERSHARED_EXPORT QTexture2D : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTexture2D(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTexture2D();
-};
-
-class QT3DRENDERSHARED_EXPORT QTexture2DArray : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTexture2DArray(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTexture2DArray();
-};
-
-class QT3DRENDERSHARED_EXPORT QTexture3D : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTexture3D(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTexture3D();
-};
-
-class QT3DRENDERSHARED_EXPORT QTextureCubeMap : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTextureCubeMap(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTextureCubeMap();
-};
-
-class QT3DRENDERSHARED_EXPORT QTextureCubeMapArray : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTextureCubeMapArray(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTextureCubeMapArray();
-};
-
-class QT3DRENDERSHARED_EXPORT QTexture2DMultisample : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTexture2DMultisample(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTexture2DMultisample();
-};
-
-class QT3DRENDERSHARED_EXPORT QTexture2DMultisampleArray : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTexture2DMultisampleArray(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTexture2DMultisampleArray();
-};
-
-class QT3DRENDERSHARED_EXPORT QTextureRectangle : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTextureRectangle(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTextureRectangle();
-};
-
-class QT3DRENDERSHARED_EXPORT QTextureBuffer : public QAbstractTextureProvider
-{
- Q_OBJECT
-public:
- explicit QTextureBuffer(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QTextureBuffer();
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QTEXTUREPROVIDERS_H
diff --git a/src/render/texture/qtexturewrapmode.cpp b/src/render/texture/qtexturewrapmode.cpp
new file mode 100644
index 000000000..ee831f409
--- /dev/null
+++ b/src/render/texture/qtexturewrapmode.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtexturewrapmode.h"
+#include <private/qobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QTextureWrapModePrivate : public QObjectPrivate
+{
+public:
+ QTextureWrapModePrivate()
+ : QObjectPrivate()
+ , m_x(QTextureWrapMode::ClampToEdge)
+ , m_y(QTextureWrapMode::ClampToEdge)
+ , m_z(QTextureWrapMode::ClampToEdge)
+ {
+ }
+
+ Q_DECLARE_PUBLIC(QTextureWrapMode)
+ QTextureWrapMode::WrapMode m_x;
+ QTextureWrapMode::WrapMode m_y;
+ QTextureWrapMode::WrapMode m_z;
+};
+
+/*!
+ \class Qt3DRender::QTextureWrapMode
+ \inmodule Qt3DRender
+ \since 5.5
+
+ \brief Defines the wrap mode a Qt3DRender::QAbstractTexture
+ should apply to a texture.
+ */
+
+QTextureWrapMode::QTextureWrapMode(WrapMode wrapMode, QObject *parent)
+ : QObject(*new QTextureWrapModePrivate, parent)
+{
+ d_func()->m_x = wrapMode;
+ d_func()->m_y = wrapMode;
+ d_func()->m_z = wrapMode;
+}
+
+/*!
+ Contrusts a new Qt3DRender::QTextureWrapMode instance with the wrap mode to apply to
+ each dimension \a x, \a y \a z of the texture and \a parent as parent.
+ */
+QTextureWrapMode::QTextureWrapMode(WrapMode x,WrapMode y, WrapMode z, QObject *parent)
+ : QObject(*new QTextureWrapModePrivate, parent)
+{
+ d_func()->m_x = x;
+ d_func()->m_y = y;
+ d_func()->m_z = z;
+}
+
+/*! \internal */
+QTextureWrapMode::~QTextureWrapMode()
+{
+}
+
+/*!
+ Sets the wrap mode of the x dimension to \a x.
+ */
+void QTextureWrapMode::setX(WrapMode x)
+{
+ Q_D(QTextureWrapMode);
+ if (d->m_x != x) {
+ d->m_x = x;
+ emit xChanged(x);
+ }
+}
+
+/*!
+ Returns the wrap mode of the x dimension.
+ */
+QTextureWrapMode::WrapMode QTextureWrapMode::x() const
+{
+ Q_D(const QTextureWrapMode);
+ return d->m_x;
+}
+
+/*!
+ Sets the wrap mode of the y dimension to \a y.
+ \note this is not available on 1D textures.
+ */
+void QTextureWrapMode::setY(WrapMode y)
+{
+ Q_D(QTextureWrapMode);
+ if (d->m_y != y) {
+ d->m_y = y;
+ emit yChanged(y);
+ }
+}
+
+/*!
+ Returns the wrap mode of the y dimension.
+ */
+QTextureWrapMode::WrapMode QTextureWrapMode::y() const
+{
+ Q_D(const QTextureWrapMode);
+ return d->m_y;
+}
+
+/*!
+ Sets the wrap mode of the z dimension to \a z.
+ \note this is only available on 3D textures.
+ */
+void QTextureWrapMode::setZ(WrapMode z)
+{
+ Q_D(QTextureWrapMode);
+ if (d->m_z != z) {
+ d->m_z = z;
+ emit zChanged(z);
+ }
+}
+
+/*!
+ Returns the wrap mode of the z dimension.
+ */
+QTextureWrapMode::WrapMode QTextureWrapMode::z() const
+{
+ Q_D(const QTextureWrapMode);
+ return d->m_z;
+}
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
diff --git a/src/render/texture/qtexturewrapmode.h b/src/render/texture/qtexturewrapmode.h
new file mode 100644
index 000000000..bb27acf4a
--- /dev/null
+++ b/src/render/texture/qtexturewrapmode.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DRENDER_QTEXTUREWRAPMODE_H
+#define QT3DRENDER_QTEXTUREWRAPMODE_H
+
+#include <Qt3DRender/qt3drender_global.h>
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DRender {
+
+class QTextureWrapModePrivate;
+
+class QT3DRENDERSHARED_EXPORT QTextureWrapMode : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(WrapMode x READ x WRITE setX NOTIFY xChanged)
+ Q_PROPERTY(WrapMode y READ y WRITE setY NOTIFY yChanged)
+ Q_PROPERTY(WrapMode z READ z WRITE setZ NOTIFY zChanged)
+
+public:
+ enum WrapMode {
+ Repeat = 0x2901, // GL_REPEAT
+ MirroredRepeat = 0x8370, // GL_MIRRORED_REPEAT
+ ClampToEdge = 0x812F, // GL_CLAMP_TO_EDGE
+ ClampToBorder = 0x812D // GL_CLAMP_TO_BORDER
+ };
+ Q_ENUM(WrapMode)
+
+ explicit QTextureWrapMode(WrapMode wrapMode = ClampToEdge, QObject *parent = nullptr);
+ explicit QTextureWrapMode(WrapMode x, WrapMode y, WrapMode z, QObject *parent = nullptr);
+ ~QTextureWrapMode();
+
+ WrapMode x() const;
+ WrapMode y() const;
+ WrapMode z() const;
+
+public Q_SLOTS:
+ void setX(WrapMode x);
+ void setY(WrapMode y);
+ void setZ(WrapMode z);
+
+Q_SIGNALS:
+ void xChanged(WrapMode x);
+ void yChanged(WrapMode y);
+ void zChanged(WrapMode z);
+
+private:
+ Q_DECLARE_PRIVATE(QTextureWrapMode)
+};
+
+} // namespace Qt3DRender
+
+QT_END_NAMESPACE
+
+#endif // QT3DRENDER_QWRAPMODE_H
diff --git a/src/render/texture/qwrapmode.cpp b/src/render/texture/qwrapmode.cpp
deleted file mode 100644
index abbd63261..000000000
--- a/src/render/texture/qwrapmode.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwrapmode.h"
-#include <private/qobject_p.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QTextureWrapModePrivate : public QObjectPrivate
-{
-public:
- QTextureWrapModePrivate()
- : QObjectPrivate()
- , m_x(QTextureWrapMode::ClampToEdge)
- , m_y(QTextureWrapMode::ClampToEdge)
- , m_z(QTextureWrapMode::ClampToEdge)
- {
- }
-
- Q_DECLARE_PUBLIC(QTextureWrapMode)
- QTextureWrapMode::WrapMode m_x;
- QTextureWrapMode::WrapMode m_y;
- QTextureWrapMode::WrapMode m_z;
-};
-
-/*!
- \class Qt3DRender::QTextureWrapMode
- \inmodule Qt3DRender
- \since 5.5
-
- \brief Defines the wrap mode a Qt3DRender::QAbstractTextureProvider
- should apply to a texture.
- */
-
-QTextureWrapMode::QTextureWrapMode(WrapMode wrapMode, QObject *parent)
- : QObject(*new QTextureWrapModePrivate, parent)
-{
- d_func()->m_x = wrapMode;
- d_func()->m_y = wrapMode;
- d_func()->m_z = wrapMode;
-}
-
-/*!
- Contrusts a new Qt3DRender::QTextureWrapMode instance with the wrap mode to apply to
- each dimension \a x, \a y \a z of the texture and \a parent as parent.
- */
-QTextureWrapMode::QTextureWrapMode(WrapMode x,WrapMode y, WrapMode z, QObject *parent)
- : QObject(*new QTextureWrapModePrivate, parent)
-{
- d_func()->m_x = x;
- d_func()->m_y = y;
- d_func()->m_z = z;
-}
-
-/*!
- Sets the wrap mode of the x dimension to \a x.
- */
-void QTextureWrapMode::setX(WrapMode x)
-{
- Q_D(QTextureWrapMode);
- if (d->m_x != x) {
- d->m_x = x;
- emit xChanged(x);
- }
-}
-
-/*!
- Returns the wrap mode of the x dimension.
- */
-QTextureWrapMode::WrapMode QTextureWrapMode::x() const
-{
- Q_D(const QTextureWrapMode);
- return d->m_x;
-}
-
-/*!
- Sets the wrap mode of the y dimension to \a y.
- \note this is not available on 1D textures.
- */
-void QTextureWrapMode::setY(WrapMode y)
-{
- Q_D(QTextureWrapMode);
- if (d->m_y != y) {
- d->m_y = y;
- emit yChanged(y);
- }
-}
-
-/*!
- Returns the wrap mode of the y dimension.
- */
-QTextureWrapMode::WrapMode QTextureWrapMode::y() const
-{
- Q_D(const QTextureWrapMode);
- return d->m_y;
-}
-
-/*!
- Sets the wrap mode of the z dimension to \a z.
- \note this is only available on 3D textures.
- */
-void QTextureWrapMode::setZ(WrapMode z)
-{
- Q_D(QTextureWrapMode);
- if (d->m_z != z) {
- d->m_z = z;
- emit zChanged(z);
- }
-}
-
-/*!
- Returns the wrap mode of the y dimension.
- */
-QTextureWrapMode::WrapMode QTextureWrapMode::z() const
-{
- Q_D(const QTextureWrapMode);
- return d->m_z;
-}
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
diff --git a/src/render/texture/qwrapmode.h b/src/render/texture/qwrapmode.h
deleted file mode 100644
index ebc54464a..000000000
--- a/src/render/texture/qwrapmode.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DRENDER_QWRAPMODE_H
-#define QT3DRENDER_QWRAPMODE_H
-
-#include <Qt3DRender/qt3drender_global.h>
-#include <QObject>
-
-QT_BEGIN_NAMESPACE
-
-namespace Qt3DRender {
-
-class QTextureWrapModePrivate;
-
-class QT3DRENDERSHARED_EXPORT QTextureWrapMode : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(WrapMode x READ x WRITE setX NOTIFY xChanged)
- Q_PROPERTY(WrapMode y READ y WRITE setY NOTIFY yChanged)
- Q_PROPERTY(WrapMode z READ z WRITE setZ NOTIFY zChanged)
-
-public:
- enum WrapMode {
- Repeat = 0x2901, // GL_REPEAT
- MirroredRepeat = 0x8370, // GL_MIRRORED_REPEAT
- ClampToEdge = 0x812F, // GL_CLAMP_TO_EDGE
- ClampToBorder = 0x812D // GL_CLAMP_TO_BORDER
- };
- Q_ENUM(WrapMode)
-
- explicit QTextureWrapMode(WrapMode wrapMode = ClampToEdge, QObject *parent = Q_NULLPTR);
- explicit QTextureWrapMode(WrapMode x, WrapMode y, WrapMode z, QObject *parent = Q_NULLPTR);
-
- WrapMode x() const;
- WrapMode y() const;
- WrapMode z() const;
-
-public Q_SLOTS:
- void setX(WrapMode x);
- void setY(WrapMode y);
- void setZ(WrapMode z);
-
-Q_SIGNALS:
- void xChanged(WrapMode x);
- void yChanged(WrapMode y);
- void zChanged(WrapMode z);
-
-private:
- Q_DECLARE_PRIVATE(QTextureWrapMode)
-};
-
-} // namespace Qt3DRender
-
-QT_END_NAMESPACE
-
-#endif // QT3DRENDER_QWRAPMODE_H
diff --git a/src/render/texture/texture.cpp b/src/render/texture/texture.cpp
index 790a8620f..7d01e8080 100644
--- a/src/render/texture/texture.cpp
+++ b/src/render/texture/texture.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,10 +45,13 @@
#include <QOpenGLTexture>
#include <QOpenGLPixelTransferOptions>
#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qtexturedata.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/qtextureimagedata.h>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/texturedatamanager_p.h>
+#include <Qt3DRender/private/qabstracttexture_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -55,31 +61,31 @@ namespace Qt3DRender {
namespace Render {
Texture::Texture()
- : QBackendNode()
- , m_gl(Q_NULLPTR)
+ : BackendNode()
+ , m_gl(nullptr)
, m_width(1)
, m_height(1)
, m_depth(1)
, m_layers(1)
+ , m_mipLevels(1)
, m_generateMipMaps(false)
- , m_target(QAbstractTextureProvider::Target2D)
- , m_format(QAbstractTextureProvider::RGBA8_UNorm)
- , m_magnificationFilter(QAbstractTextureProvider::Nearest)
- , m_minificationFilter(QAbstractTextureProvider::Nearest)
+ , m_target(QAbstractTexture::Target2D)
+ , m_format(QAbstractTexture::RGBA8_UNorm)
+ , m_magnificationFilter(QAbstractTexture::Nearest)
+ , m_minificationFilter(QAbstractTexture::Nearest)
, m_wrapModeX(QTextureWrapMode::ClampToEdge)
, m_wrapModeY(QTextureWrapMode::ClampToEdge)
, m_wrapModeZ(QTextureWrapMode::ClampToEdge)
, m_maximumAnisotropy(1.0f)
- , m_comparisonFunction(QAbstractTextureProvider::CompareLessEqual)
- , m_comparisonMode(QAbstractTextureProvider::CompareNone)
+ , m_comparisonFunction(QAbstractTexture::CompareLessEqual)
+ , m_comparisonMode(QAbstractTexture::CompareNone)
, m_isDirty(false)
, m_filtersAndWrapUpdated(false)
, m_dataUploadRequired(false)
- , m_unique(false)
, m_textureDNA(0)
- , m_textureManager(Q_NULLPTR)
- , m_textureImageManager(Q_NULLPTR)
- , m_textureDataManager(Q_NULLPTR)
+ , m_textureManager(nullptr)
+ , m_textureImageManager(nullptr)
+ , m_textureDataManager(nullptr)
{
// We need backend -> frontend notifications to update the status of the texture
}
@@ -90,58 +96,68 @@ Texture::~Texture()
void Texture::cleanup()
{
- m_gl = Q_NULLPTR;
+ QBackendNode::setEnabled(false);
+ m_gl = nullptr;
m_width = 1;
m_height = 1;
m_depth = 1;
m_layers = 1;
+ m_mipLevels = 1;
m_generateMipMaps = false;
- m_target = QAbstractTextureProvider::Target2D;
- m_format = QAbstractTextureProvider::RGBA8_UNorm;
- m_magnificationFilter = QAbstractTextureProvider::Nearest;
- m_minificationFilter = QAbstractTextureProvider::Nearest;
+ m_target = QAbstractTexture::Target2D;
+ m_format = QAbstractTexture::RGBA8_UNorm;
+ m_magnificationFilter = QAbstractTexture::Nearest;
+ m_minificationFilter = QAbstractTexture::Nearest;
m_wrapModeX = QTextureWrapMode::ClampToEdge;
m_wrapModeY = QTextureWrapMode::ClampToEdge;
m_wrapModeZ = QTextureWrapMode::ClampToEdge;
m_maximumAnisotropy = 1.0f;
- m_comparisonFunction = QAbstractTextureProvider::CompareLessEqual;
- m_comparisonMode = QAbstractTextureProvider::CompareNone;
+ m_comparisonFunction = QAbstractTexture::CompareLessEqual;
+ m_comparisonMode = QAbstractTexture::CompareNone;
m_isDirty = false;
m_filtersAndWrapUpdated = false;
m_dataUploadRequired = false;
- m_unique = false;
m_textureDNA = 0;
m_textureImages.clear();
- m_textureManager = Q_NULLPTR;
- m_textureImageManager = Q_NULLPTR;
- m_textureDataManager = Q_NULLPTR;
+ m_textureManager = nullptr;
+ m_textureImageManager = nullptr;
+ m_textureDataManager = nullptr;
+ m_dataFunctor.clear();
+ m_textureDataHandle = HTextureData();
}
// AspectThread
-void Texture::updateFromPeer(Qt3DCore::QNode *peer)
+void Texture::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QAbstractTextureProvider *texture = static_cast<QAbstractTextureProvider *>(peer);
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAbstractTextureData>>(change);
+ const auto &data = typedChange->data;
QMutexLocker lock(&m_lock);
- if (texture != Q_NULLPTR) {
- m_isDirty = true;
- m_width = texture->width();
- m_height = texture->height();
- m_depth = texture->depth();
- m_generateMipMaps = texture->generateMipMaps();
- m_target = texture->target();
- m_format = texture->format();
- m_magnificationFilter = texture->magnificationFilter();
- m_minificationFilter = texture->minificationFilter();
- m_wrapModeX = texture->wrapMode()->x();
- m_wrapModeY = texture->wrapMode()->y();
- m_wrapModeZ = texture->wrapMode()->z();
- m_maximumAnisotropy = texture->maximumAnisotropy();
- m_comparisonFunction = texture->comparisonFunction();
- m_comparisonMode = texture->comparisonMode();
- m_layers = texture->maximumLayers();
- m_unique = texture->isUnique();
- }
+ m_target = data.target;
+ m_format = data.format;
+ m_width = data.width;
+ m_height = data.height;
+ m_depth = data.depth;
+ m_generateMipMaps = data.autoMipMap;
+ m_minificationFilter = data.minFilter;
+ m_magnificationFilter = data.magFilter;
+ m_wrapModeX = data.wrapModeX;
+ m_wrapModeY = data.wrapModeY;
+ m_wrapModeZ = data.wrapModeZ;
+ m_maximumAnisotropy = data.maximumAnisotropy;
+ m_comparisonFunction = data.comparisonFunction;
+ m_comparisonMode = data.comparisonMode;
+ m_layers = data.layers;
+ m_dataFunctor = data.dataFunctor;
+ if (m_dataFunctor)
+ addToPendingTextureJobs();
+
+ // TODO: Handle texture image ids better. At the moment we rely upon the assumption
+ // in the TextureImage that its parent is a Texture. Better to set the ids from here
+ // I think, and do it consistently with other types that refer to other nodes.
+ //data.textureImageIds
+
+ m_isDirty = true;
}
// RenderTread
@@ -164,12 +180,12 @@ QOpenGLTexture *Texture::getOrCreateGLTexture()
QMutexLocker lock(&m_lock);
if (m_isDirty) {
delete m_gl;
- m_gl = Q_NULLPTR;
+ m_gl = nullptr;
m_isDirty = false;
}
// If the texture exists, we just update it and return
- if (m_gl != Q_NULLPTR) {
+ if (m_gl != nullptr) {
bool refreshDNA = m_filtersAndWrapUpdated || m_dataUploadRequired;
@@ -193,7 +209,7 @@ QOpenGLTexture *Texture::getOrCreateGLTexture()
m_gl->allocateStorage();
if (!m_gl->isStorageAllocated()) {
qWarning() << Q_FUNC_INFO << "texture storage allocation failed";
- return Q_NULLPTR;
+ return nullptr;
}
// Filters and WrapMode are set
@@ -208,11 +224,13 @@ QOpenGLTexture *Texture::getOrCreateGLTexture()
// Ideally we might want to abstract that and use the GraphicsContext as a wrapper
// around that.
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) {
int err = ctx->functions()->glGetError();
if (err)
qWarning() << Q_FUNC_INFO << "GL error after generating mip-maps" << QString::number(err, 16);
}
+#endif
return m_gl;
}
@@ -223,28 +241,33 @@ QOpenGLTexture *Texture::buildGLTexture()
QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (!ctx) {
qWarning() << Q_FUNC_INFO << "requires an OpenGL context";
- return Q_NULLPTR;
+ return nullptr;
+ }
+
+ if (m_target == QAbstractTexture::TargetAutomatic) {
+ qWarning() << Q_FUNC_INFO << "something went wrong, target shouldn't be automatic at this point";
+ return nullptr;
}
QOpenGLTexture* glTex = new QOpenGLTexture(static_cast<QOpenGLTexture::Target>(m_target));
- if (m_format == QAbstractTextureProvider::Automatic)
+ if (m_format == QAbstractTexture::Automatic)
qWarning() << Q_FUNC_INFO << "something went wrong, format shouldn't be automatic at this point";
// m_format may not be ES2 compatible. Now it's time to convert it, if necessary.
- QAbstractTextureProvider::TextureFormat format = m_format;
+ QAbstractTexture::TextureFormat format = m_format;
if (ctx->isOpenGLES() && ctx->format().majorVersion() < 3) {
switch (m_format) {
case QOpenGLTexture::RGBA8_UNorm:
case QOpenGLTexture::RGBAFormat:
- format = QAbstractTextureProvider::RGBAFormat;
+ format = QAbstractTexture::RGBAFormat;
break;
case QOpenGLTexture::RGB8_UNorm:
case QOpenGLTexture::RGBFormat:
- format = QAbstractTextureProvider::RGBFormat;
+ format = QAbstractTexture::RGBFormat;
break;
case QOpenGLTexture::DepthFormat:
- format = QAbstractTextureProvider::DepthFormat;
+ format = QAbstractTexture::DepthFormat;
break;
default:
qWarning() << Q_FUNC_INFO << "could not find a matching OpenGL ES 2.0 unsized texture format";
@@ -255,51 +278,108 @@ QOpenGLTexture *Texture::buildGLTexture()
// Map ETC1 to ETC2 when supported. This allows using features like
// immutable storage as ETC2 is standard in GLES 3.0, while the ETC1 extension
// is written against GLES 1.0.
- if (m_format == QAbstractTextureProvider::RGB8_ETC1) {
+ if (m_format == QAbstractTexture::RGB8_ETC1) {
if ((ctx->isOpenGLES() && ctx->format().majorVersion() >= 3)
|| ctx->hasExtension(QByteArrayLiteral("GL_OES_compressed_ETC2_RGB8_texture"))
|| ctx->hasExtension(QByteArrayLiteral("GL_ARB_ES3_compatibility")))
- format = m_format = QAbstractTextureProvider::RGB8_ETC2;
+ format = m_format = QAbstractTexture::RGB8_ETC2;
}
- glTex->setFormat(format == QAbstractTextureProvider::Automatic ?
+ glTex->setFormat(format == QAbstractTexture::Automatic ?
QOpenGLTexture::NoFormat :
static_cast<QOpenGLTexture::TextureFormat>(format));
glTex->setSize(m_width, m_height, m_depth);
// Set layers count if texture array
- if (m_target == QAbstractTextureProvider::Target1DArray ||
- m_target == QAbstractTextureProvider::Target2DArray ||
- m_target == QAbstractTextureProvider::Target3D ||
- m_target == QAbstractTextureProvider::Target2DMultisampleArray ||
- m_target == QAbstractTextureProvider::TargetCubeMapArray)
+ if (m_target == QAbstractTexture::Target1DArray ||
+ m_target == QAbstractTexture::Target2DArray ||
+ m_target == QAbstractTexture::Target3D ||
+ m_target == QAbstractTexture::Target2DMultisampleArray ||
+ m_target == QAbstractTexture::TargetCubeMapArray) {
glTex->setLayers(m_layers);
+ }
- if (m_generateMipMaps)
+ if (m_generateMipMaps) {
glTex->setMipLevels(glTex->maximumMipLevels());
+ } else {
+ glTex->setAutoMipMapGenerationEnabled(false);
+ glTex->setMipBaseLevel(0);
+ glTex->setMipMaxLevel(m_mipLevels - 1);
+ glTex->setMipLevels(m_mipLevels);
+ }
if (!glTex->create()) {
qWarning() << Q_FUNC_INFO << "creating QOpenGLTexture failed";
- return Q_NULLPTR;
+ return nullptr;
}
// FIXME : make this conditional on Qt version
// work-around issue in QOpenGLTexture DSA emulaation which rasies
// an Invalid Enum error
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
int err = ctx->functions()->glGetError();
if (err)
qWarning() << Q_FUNC_INFO << err;
+#endif
return glTex;
}
// RenderThread
-void Texture::setToGLTexture(TextureImage *rImg, QTexImageData *imgData)
+void Texture::setToGLTexture(QTextureImageData *imgData)
+{
+ Q_ASSERT(m_gl && m_gl->isCreated() && m_gl->isStorageAllocated());
+
+ const int layers = imgData->layers();
+ const int faces = imgData->faces();
+ const int mipLevels = m_generateMipMaps ? 1 : imgData->mipLevels();
+
+ for (int layer = 0; layer < layers; layer++) {
+ for (int face = 0; face < faces; face++) {
+ for (int level = 0; level < mipLevels; level++) {
+ // ensure we don't accidently cause a detach / copy of the raw bytes
+ const QByteArray &bytes(imgData->data(layer, face, level));
+
+ if (imgData->isCompressed()) {
+ m_gl->setCompressedData(level,
+ layer,
+ static_cast<QOpenGLTexture::CubeMapFace>(QOpenGLTexture::CubeMapPositiveX + face),
+ bytes.size(),
+ bytes.constData());
+ } else {
+ QOpenGLPixelTransferOptions uploadOptions;
+ uploadOptions.setAlignment(1);
+ m_gl->setData(level,
+ layer,
+ static_cast<QOpenGLTexture::CubeMapFace>(QOpenGLTexture::CubeMapPositiveX + face),
+ imgData->pixelFormat(),
+ imgData->pixelType(),
+ bytes.constData(),
+ &uploadOptions);
+ }
+ }
+ }
+ }
+
+ // FIXME : make this conditional on Qt version
+ // work-around issue in QOpenGLTexture DSA emulation which rasies
+ // an Invalid Enum error
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
+ if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) {
+ int err = ctx->functions()->glGetError();
+ if (err)
+ qWarning() << Q_FUNC_INFO << err;
+ }
+#endif
+}
+
+// RenderThread
+void Texture::setToGLTexture(TextureImage *rImg, QTextureImageData *imgData)
{
Q_ASSERT(m_gl && m_gl->isCreated() && m_gl->isStorageAllocated());
// ensure we don't accidently cause a detach / copy of the raw bytes
const QByteArray &bytes(imgData->data());
if (imgData->isCompressed()) {
- m_gl->setCompressedData(rImg->mipmapLevel(),
+ m_gl->setCompressedData(rImg->mipLevel(),
rImg->layer(),
static_cast<QOpenGLTexture::CubeMapFace>(rImg->face()),
bytes.size(),
@@ -307,7 +387,7 @@ void Texture::setToGLTexture(TextureImage *rImg, QTexImageData *imgData)
} else {
QOpenGLPixelTransferOptions uploadOptions;
uploadOptions.setAlignment(1);
- m_gl->setData(rImg->mipmapLevel(),
+ m_gl->setData(rImg->mipLevel(),
rImg->layer(),
static_cast<QOpenGLTexture::CubeMapFace>(rImg->face()),
imgData->pixelFormat(),
@@ -319,22 +399,24 @@ void Texture::setToGLTexture(TextureImage *rImg, QTexImageData *imgData)
// FIXME : make this conditional on Qt version
// work-around issue in QOpenGLTexture DSA emulaation which rasies
// an Invalid Enum error
+#if defined(QT3D_RENDER_ASPECT_OPENGL_DEBUG)
if (QOpenGLContext *ctx = QOpenGLContext::currentContext()) {
int err = ctx->functions()->glGetError();
if (err)
qWarning() << Q_FUNC_INFO << err;
}
+#endif
}
// RenderThread
void Texture::updateWrapAndFilters()
{
m_gl->setWrapMode(QOpenGLTexture::DirectionS, static_cast<QOpenGLTexture::WrapMode>(m_wrapModeX));
- if (m_target != QAbstractTextureProvider::Target1D &&
- m_target != QAbstractTextureProvider::Target1DArray &&
- m_target != QAbstractTextureProvider::TargetBuffer)
+ if (m_target != QAbstractTexture::Target1D &&
+ m_target != QAbstractTexture::Target1DArray &&
+ m_target != QAbstractTexture::TargetBuffer)
m_gl->setWrapMode(QOpenGLTexture::DirectionT, static_cast<QOpenGLTexture::WrapMode>(m_wrapModeY));
- if (m_target == QAbstractTextureProvider::Target3D)
+ if (m_target == QAbstractTexture::Target3D)
m_gl->setWrapMode(QOpenGLTexture::DirectionR, static_cast<QOpenGLTexture::WrapMode>(m_wrapModeZ));
m_gl->setMinMagFilters(static_cast<QOpenGLTexture::Filter>(m_minificationFilter),
static_cast<QOpenGLTexture::Filter>(m_magnificationFilter));
@@ -348,7 +430,7 @@ void Texture::updateWrapAndFilters()
void Texture::updateDNA()
{
- int key = m_width + m_height + m_depth + m_layers +
+ int key = m_width + m_height + m_depth + m_layers + m_mipLevels +
(m_generateMipMaps ? 1 : 0) +
static_cast<int>(m_target) +
static_cast<int>(m_format) +
@@ -360,13 +442,19 @@ void Texture::updateDNA()
static_cast<int>(m_comparisonFunction) +
static_cast<int>(m_comparisonMode);
m_textureDNA = ::qHash(key) + ::qHash(m_maximumAnisotropy);
- Q_FOREACH (HTextureImage imgHandle, m_textureImages) {
+
+ // apply non-unique hashes from texture images or texture data
+ for (HTextureImage imgHandle : qAsConst(m_textureImages)) {
TextureImage *img = m_textureImageManager->data(imgHandle);
if (img)
m_textureDNA += img->dna();
}
- if (m_unique) // Ensures uniqueness by adding unique QNode id to the dna
- m_textureDNA += qHash(peerUuid());
+ if (!m_textureDataHandle.isNull())
+ m_textureDNA += ::qHash(m_textureDataHandle.index());
+
+ // if texture contains no potentially shared image data: texture is unique
+ if (m_textureImages.empty() && m_textureDataHandle.isNull()) // Ensures uniqueness by adding unique QNode id to the dna
+ m_textureDNA += qHash(peerId());
}
// RenderThread
@@ -382,6 +470,14 @@ bool Texture::isTextureReset() const
return m_isDirty;
}
+void Texture::setTarget(QAbstractTexture::Target target)
+{
+ if (target != m_target) {
+ m_target = target;
+ m_isDirty = true;
+ }
+}
+
void Texture::setSize(int width, int height, int depth)
{
if (width != m_width) {
@@ -398,7 +494,7 @@ void Texture::setSize(int width, int height, int depth)
}
}
-void Texture::setFormat(QAbstractTextureProvider::TextureFormat format)
+void Texture::setFormat(QAbstractTexture::TextureFormat format)
{
if (format != m_format) {
m_format = format;
@@ -406,6 +502,22 @@ void Texture::setFormat(QAbstractTextureProvider::TextureFormat format)
}
}
+void Texture::setMipLevels(int mipLevels)
+{
+ if (mipLevels != m_mipLevels) {
+ m_mipLevels = mipLevels;
+ m_isDirty = true;
+ }
+}
+
+void Texture::setLayers(int layers)
+{
+ if (layers != m_layers) {
+ m_layers = layers;
+ m_isDirty = true;
+ }
+}
+
// ChangeArbiter/Aspect Thread
void Texture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
@@ -413,9 +525,9 @@ void Texture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
QMutexLocker lock(&m_lock);
// We lock here so that we're sure the texture cannot be rebuilt while we are
// modifying one of its properties
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
switch (e->type()) {
- case NodeUpdated: {
+ case PropertyUpdated: {
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("width")) {
setSize(propertyChange->value().toInt(), m_height, m_depth);
} else if (propertyChange->propertyName() == QByteArrayLiteral("height")) {
@@ -427,12 +539,12 @@ void Texture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_generateMipMaps = propertyChange->value().toBool();
m_isDirty |= (oldMipMaps != m_generateMipMaps);
} else if (propertyChange->propertyName() == QByteArrayLiteral("minificationFilter")) {
- QAbstractTextureProvider::Filter oldMinFilter = m_minificationFilter;
- m_minificationFilter = static_cast<QAbstractTextureProvider::Filter>(propertyChange->value().toInt());
+ QAbstractTexture::Filter oldMinFilter = m_minificationFilter;
+ m_minificationFilter = static_cast<QAbstractTexture::Filter>(propertyChange->value().toInt());
m_filtersAndWrapUpdated |= (oldMinFilter != m_minificationFilter);
} else if (propertyChange->propertyName() == QByteArrayLiteral("magnificationFilter")) {
- QAbstractTextureProvider::Filter oldMagFilter = m_magnificationFilter;
- m_magnificationFilter = static_cast<QAbstractTextureProvider::Filter>(propertyChange->value().toInt());
+ QAbstractTexture::Filter oldMagFilter = m_magnificationFilter;
+ m_magnificationFilter = static_cast<QAbstractTexture::Filter>(propertyChange->value().toInt());
m_filtersAndWrapUpdated |= (oldMagFilter != m_magnificationFilter);
} else if (propertyChange->propertyName() == QByteArrayLiteral("wrapModeX")) {
QTextureWrapMode::WrapMode oldWrapModeX = m_wrapModeX;
@@ -447,46 +559,43 @@ void Texture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_wrapModeZ =static_cast<QTextureWrapMode::WrapMode>(propertyChange->value().toInt());
m_filtersAndWrapUpdated |= (oldWrapModeZ != m_wrapModeZ);
} else if (propertyChange->propertyName() == QByteArrayLiteral("format")) {
- setFormat(static_cast<QAbstractTextureProvider::TextureFormat>(propertyChange->value().toInt()));
+ setFormat(static_cast<QAbstractTexture::TextureFormat>(propertyChange->value().toInt()));
} else if (propertyChange->propertyName() == QByteArrayLiteral("target")) {
- QAbstractTextureProvider::Target oldTarget = m_target;
- m_target = static_cast<QAbstractTextureProvider::Target>(propertyChange->value().toInt());
+ QAbstractTexture::Target oldTarget = m_target;
+ m_target = static_cast<QAbstractTexture::Target>(propertyChange->value().toInt());
m_isDirty |= (oldTarget != m_target);
} else if (propertyChange->propertyName() == QByteArrayLiteral("maximumAnisotropy")) {
float oldMaximumAnisotropy = m_maximumAnisotropy;
m_maximumAnisotropy = propertyChange->value().toFloat();
m_filtersAndWrapUpdated |= !qFuzzyCompare(oldMaximumAnisotropy, m_maximumAnisotropy);
} else if (propertyChange->propertyName() == QByteArrayLiteral("comparisonFunction")) {
- QAbstractTextureProvider::ComparisonFunction oldComparisonFunction = m_comparisonFunction;
- m_comparisonFunction = propertyChange->value().value<QAbstractTextureProvider::ComparisonFunction>();
+ QAbstractTexture::ComparisonFunction oldComparisonFunction = m_comparisonFunction;
+ m_comparisonFunction = propertyChange->value().value<QAbstractTexture::ComparisonFunction>();
m_filtersAndWrapUpdated |= (oldComparisonFunction != m_comparisonFunction);
} else if (propertyChange->propertyName() == QByteArrayLiteral("comparisonMode")) {
- QAbstractTextureProvider::ComparisonMode oldComparisonMode = m_comparisonMode;
- m_comparisonMode = propertyChange->value().value<QAbstractTextureProvider::ComparisonMode>();
+ QAbstractTexture::ComparisonMode oldComparisonMode = m_comparisonMode;
+ m_comparisonMode = propertyChange->value().value<QAbstractTexture::ComparisonMode>();
m_filtersAndWrapUpdated |= (oldComparisonMode != m_comparisonMode);
} else if (propertyChange->propertyName() == QByteArrayLiteral("maximumLayers")) {
const int oldLayers = m_layers;
m_layers = propertyChange->value().toInt();
m_isDirty |= (oldLayers != m_layers);
- } else if (propertyChange->propertyName() == QByteArrayLiteral("unique")) {
- const bool oldUnique = m_unique;
- m_unique = propertyChange->value().toBool();
- // Will force a DNA update
- m_filtersAndWrapUpdated |= (oldUnique != m_unique);
}
}
break;
- case NodeAdded: {
- if (propertyChange->propertyName() == QByteArrayLiteral("textureImage")) {
- m_textureImages.append(m_textureImageManager->lookupHandle(propertyChange->value().value<QNodeId>()));
+ case PropertyValueAdded: {
+ const auto change = qSharedPointerCast<QPropertyNodeAddedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("textureImage")) {
+ m_textureImages.append(m_textureImageManager->lookupHandle(change->addedNodeId()));
}
}
break;
- case NodeRemoved: {
- if (propertyChange->propertyName() == QByteArrayLiteral("textureImage")) {
- m_textureImages.removeOne(m_textureImageManager->lookupHandle(propertyChange->value().value<QNodeId>()));
+ case PropertyValueRemoved: {
+ const auto change = qSharedPointerCast<QPropertyNodeRemovedChange>(e);
+ if (change->propertyName() == QByteArrayLiteral("textureImage")) {
+ m_textureImages.removeOne(m_textureImageManager->lookupHandle(change->removedNodeId()));
// If a TextureImage is removed from a Texture, the texture image data remains on GPU
}
}
@@ -496,6 +605,8 @@ void Texture::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
break;
}
+ markDirty(AbstractRenderer::AllDirty);
+ BackendNode::sceneChangeEvent(e);
}
TextureDNA Texture::dna() const
@@ -523,22 +634,29 @@ void Texture::setTextureDataManager(TextureDataManager *manager)
// RenderThread
void Texture::updateAndLoadTextureImage()
{
+ if (!m_textureDataHandle.isNull()) {
+ QTextureImageData *data = m_textureDataManager->data(m_textureDataHandle);
+ if (data != nullptr)
+ setToGLTexture(data);
+ }
+
QVector<TextureImageDNA> dnas;
- Q_FOREACH (HTextureImage t, m_textureImages) {
+ for (HTextureImage t : qAsConst(m_textureImages)) {
TextureImage *img = m_textureImageManager->data(t);
- if (img != Q_NULLPTR && img->isDirty()) {
+ if (img != nullptr && img->isDirty()) {
if (dnas.contains(img->dna())) {
img->unsetDirty();
continue;
}
- QTexImageData *data = m_textureDataManager->data(img->textureDataHandle());
- if (data != Q_NULLPTR) {
+ QTextureImageData *data = m_textureDataManager->data(img->textureDataHandle());
+ if (data != nullptr) {
setToGLTexture(img, data);
dnas.append(img->dna());
img->unsetDirty();
}
}
}
+
m_dataUploadRequired = false;
}
@@ -562,35 +680,36 @@ void Texture::requestTextureDataUpdate()
// Called by RenderTextureImages
void Texture::addToPendingTextureJobs()
{
- m_textureDataManager->addToPendingTextures(peerUuid());
+ m_textureDataManager->addToPendingTextures(peerId());
}
-TextureFunctor::TextureFunctor(TextureManager *textureManager,
- TextureImageManager *textureImageManager,
- TextureDataManager *textureDataManager)
- : m_textureManager(textureManager)
+TextureFunctor::TextureFunctor(AbstractRenderer *renderer,
+ TextureManager *textureManager,
+ TextureImageManager *textureImageManager,
+ TextureDataManager *textureDataManager)
+ : m_renderer(renderer)
+ , m_textureManager(textureManager)
, m_textureImageManager(textureImageManager)
, m_textureDataManager(textureDataManager)
{
}
-Qt3DCore::QBackendNode *TextureFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *TextureFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- Texture *backend = m_textureManager->getOrCreateResource(frontend->id());
- backend->setFactory(factory);
+ Texture *backend = m_textureManager->getOrCreateResource(change->subjectId());
backend->setTextureManager(m_textureManager);
backend->setTextureImageManager(m_textureImageManager);
backend->setTextureDataManager(m_textureDataManager);
- backend->setPeer(frontend);
+ backend->setRenderer(m_renderer);
return backend;
}
-Qt3DCore::QBackendNode *TextureFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *TextureFunctor::get(Qt3DCore::QNodeId id) const
{
return m_textureManager->lookupResource(id);
}
-void TextureFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void TextureFunctor::destroy(Qt3DCore::QNodeId id) const
{
m_textureManager->releaseResource(id);
}
diff --git a/src/render/texture/texture.pri b/src/render/texture/texture.pri
index 36a4e1952..92545ddd3 100644
--- a/src/render/texture/texture.pri
+++ b/src/render/texture/texture.pri
@@ -3,25 +3,24 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qabstracttextureimage.h \
$$PWD/qabstracttextureimage_p.h \
- $$PWD/qabstracttextureprovider.h \
- $$PWD/qabstracttextureprovider_p.h \
$$PWD/qtexture.h \
$$PWD/qtextureimage.h \
- $$PWD/qtextureproviders.h \
- $$PWD/qwrapmode.h \
+ $$PWD/qtexturewrapmode.h \
$$PWD/texture_p.h \
$$PWD/texturedatamanager_p.h \
$$PWD/textureimage_p.h \
- $$PWD/qtexturedata_p.h \
- $$PWD/qtexturedata.h
+ $$PWD/qabstracttexture.h \
+ $$PWD/qabstracttexture_p.h \
+ $$PWD/qtextureimagedata_p.h \
+ $$PWD/qtextureimagedata.h
SOURCES += \
$$PWD/qabstracttextureimage.cpp \
- $$PWD/qabstracttextureprovider.cpp \
$$PWD/qtextureimage.cpp \
- $$PWD/qtextureproviders.cpp \
- $$PWD/qwrapmode.cpp \
+ $$PWD/qtexturewrapmode.cpp \
$$PWD/texture.cpp \
$$PWD/texturedatamanager.cpp \
$$PWD/textureimage.cpp \
- $$PWD/qtexturedata.cpp
+ $$PWD/qabstracttexture.cpp \
+ $$PWD/qtexture.cpp \
+ $$PWD/qtextureimagedata.cpp
diff --git a/src/render/texture/texture_p.h b/src/render/texture/texture_p.h
index 54738c9cc..4b14304f0 100644
--- a/src/render/texture/texture_p.h
+++ b/src/render/texture/texture_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,12 +51,12 @@
// We mean it.
//
+#include <Qt3DRender/private/backendnode_p.h>
+#include <Qt3DRender/private/handle_types_p.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qtextureimagedata.h>
#include <QOpenGLContext>
#include <QMutex>
-#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qtexturedata.h>
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DRender/private/handle_types_p.h>
QT_BEGIN_NAMESPACE
@@ -61,7 +64,7 @@ class QOpenGLTexture;
namespace Qt3DRender {
-class QAbstractTextureProvider;
+class QAbstractTexture;
namespace Render {
@@ -71,15 +74,13 @@ class TextureDataManager;
typedef uint TextureDNA;
-class Texture : public Qt3DCore::QBackendNode
+class Texture : public BackendNode
{
public:
Texture();
~Texture();
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
-
QOpenGLTexture* getOrCreateGLTexture() ;
GLint textureId();
@@ -99,42 +100,57 @@ public:
void requestTextureDataUpdate();
void addToPendingTextureJobs();
+ void setTarget(QAbstractTexture::Target target);
void setSize(int width, int height, int depth);
- void setFormat(QAbstractTextureProvider::TextureFormat format);
+ void setFormat(QAbstractTexture::TextureFormat format);
+ void setMipLevels(int mipmapLevels);
+ void setLayers(int layers);
inline QVector<HTextureImage> textureImages() const { return m_textureImages; }
- inline QAbstractTextureProvider::TextureFormat format() const { return m_format; }
+ inline QAbstractTexture::TextureFormat format() const { return m_format; }
+ inline QAbstractTexture::Target target() const { return m_target; }
+ inline bool isAutoMipMapGenerationEnabled() const { return m_generateMipMaps; }
+
+ inline QTextureImageDataGeneratorPtr dataGenerator() const { return m_dataFunctor; }
+ void setTextureDataHandle(HTextureData handle) { m_textureDataHandle = handle; }
+
+ inline bool dataUploadRequired() const { return m_dataUploadRequired; }
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QOpenGLTexture *m_gl;
QOpenGLTexture *buildGLTexture();
- void setToGLTexture(TextureImage *rImg, QTexImageData *imgData);
+ void setToGLTexture(QTextureImageData *imgData);
+ void setToGLTexture(TextureImage *rImg, QTextureImageData *imgData);
void updateWrapAndFilters();
int m_width;
int m_height;
int m_depth;
int m_layers;
+ int m_mipLevels;
bool m_generateMipMaps;
- QAbstractTextureProvider::Target m_target;
- QAbstractTextureProvider::TextureFormat m_format;
- QAbstractTextureProvider::Filter m_magnificationFilter;
- QAbstractTextureProvider::Filter m_minificationFilter;
+ QAbstractTexture::Target m_target;
+ QAbstractTexture::TextureFormat m_format;
+ QAbstractTexture::Filter m_magnificationFilter;
+ QAbstractTexture::Filter m_minificationFilter;
QTextureWrapMode::WrapMode m_wrapModeX;
QTextureWrapMode::WrapMode m_wrapModeY;
QTextureWrapMode::WrapMode m_wrapModeZ;
float m_maximumAnisotropy;
- QAbstractTextureProvider::ComparisonFunction m_comparisonFunction;
- QAbstractTextureProvider::ComparisonMode m_comparisonMode;
+ QAbstractTexture::ComparisonFunction m_comparisonFunction;
+ QAbstractTexture::ComparisonMode m_comparisonMode;
+
+ QTextureImageDataGeneratorPtr m_dataFunctor;
+ HTextureData m_textureDataHandle;
QVector<HTextureImage> m_textureImages;
bool m_isDirty;
bool m_filtersAndWrapUpdated;
bool m_dataUploadRequired;
- bool m_formatWasSpecified;
- bool m_unique;
mutable QMutex m_lock;
TextureDNA m_textureDNA;
@@ -145,18 +161,19 @@ private:
void updateDNA();
};
-class TextureFunctor : public Qt3DCore::QBackendNodeFunctor
+class TextureFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit TextureFunctor(TextureManager *textureManager,
- TextureImageManager *textureImageManager,
- TextureDataManager *textureDataManager);
-
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+ explicit TextureFunctor(AbstractRenderer *renderer,
+ TextureManager *textureManager,
+ TextureImageManager *textureImageManager,
+ TextureDataManager *textureDataManager);
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
private:
+ AbstractRenderer *m_renderer;
TextureManager *m_textureManager;
TextureImageManager *m_textureImageManager;
TextureDataManager *m_textureDataManager;
diff --git a/src/render/texture/texturedatamanager.cpp b/src/render/texture/texturedatamanager.cpp
index 313a2fe0a..dd9ca38d1 100644
--- a/src/render/texture/texturedatamanager.cpp
+++ b/src/render/texture/texturedatamanager.cpp
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,7 +51,7 @@ TextureDataManager::TextureDataManager()
{}
// Called from AspectThread sync
-void TextureDataManager::addToPendingTextures(const Qt3DCore::QNodeId &textureId)
+void TextureDataManager::addToPendingTextures(Qt3DCore::QNodeId textureId)
{
// This simple check ensures that we won't be having n jobs
// for one mesh, in case n Materials are referencing the said
@@ -66,7 +69,7 @@ QVector<Qt3DCore::QNodeId> TextureDataManager::texturesPending()
}
// Called from LoadMeshDataJob threads
-HTextureData TextureDataManager::textureDataFromFunctor(const QTextureDataFunctorPtr &functor) const
+HTextureData TextureDataManager::textureDataFromFunctor(const QTextureImageDataGeneratorPtr &functor) const
{
QMutexLocker lock(&m_mutex);
for (int i = 0, m = m_textureDataFunctors.size(); i < m; ++i) {
@@ -77,14 +80,14 @@ HTextureData TextureDataManager::textureDataFromFunctor(const QTextureDataFuncto
}
// Called from LoadMeshDataJob threads
-void TextureDataManager::addTextureDataForFunctor(HTextureData textureDataHandle, const QTextureDataFunctorPtr &functor)
+void TextureDataManager::addTextureDataForFunctor(HTextureData textureDataHandle, const QTextureImageDataGeneratorPtr &functor)
{
QMutexLocker lock(&m_mutex);
m_textureDataFunctors.push_back(qMakePair(functor, textureDataHandle));
}
// Called from LoadMeshDataJob threads
-void TextureDataManager::removeTextureDataFunctor(const QTextureDataFunctorPtr &functor)
+void TextureDataManager::removeTextureDataFunctor(const QTextureImageDataGeneratorPtr &functor)
{
QMutexLocker lock(&m_mutex);
for (int i = 0, m = m_textureDataFunctors.size(); i < m; ++i) {
@@ -96,16 +99,16 @@ void TextureDataManager::removeTextureDataFunctor(const QTextureDataFunctorPtr &
}
// Called from LoadMeshDataJob threads
-void TextureDataManager::assignFunctorToTextureImage(const QTextureDataFunctorPtr &newFunctor, HTextureImage imageHandle)
+void TextureDataManager::assignFunctorToTextureImage(const QTextureImageDataGeneratorPtr &newFunctor, HTextureImage imageHandle)
{
QMutexLocker lock(&m_mutex);
- QVector<QPair<QTextureDataFunctorPtr, QVector<HTextureImage> > >::iterator it = m_texturesImagesPerFunctor.begin();
+ QVector<QPair<QTextureImageDataGeneratorPtr, QVector<HTextureImage> > >::iterator it = m_texturesImagesPerFunctor.begin();
bool newFunctorAlreadyExists = false;
bool oldFunctorWasRemoved = false;
while (it != m_texturesImagesPerFunctor.end()) {
- QPair<QTextureDataFunctorPtr, QVector<HTextureImage> > &entry = *it;
- QTextureDataFunctorPtr functor = entry.first;
+ QPair<QTextureImageDataGeneratorPtr, QVector<HTextureImage> > &entry = *it;
+ QTextureImageDataGeneratorPtr functor = entry.first;
QVector<HTextureImage> &imageHandles = entry.second;
const bool functorMatchesNewFunctor = (*functor == *newFunctor);
bool removed = false;
diff --git a/src/render/texture/texturedatamanager_p.h b/src/render/texture/texturedatamanager_p.h
index 9248ce8a2..ebff9dc3a 100644
--- a/src/render/texture/texturedatamanager_p.h
+++ b/src/render/texture/texturedatamanager_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +53,7 @@
#include <Qt3DCore/private/qresourcemanager_p.h>
#include <Qt3DRender/qtexture.h>
-#include <Qt3DRender/qtexturedata.h>
+#include <Qt3DRender/qtextureimagedata.h>
#include <Qt3DRender/private/handle_types_p.h>
#include <QPair>
@@ -62,10 +65,10 @@ namespace Qt3DRender {
namespace Render {
-typedef QPair<QTextureDataFunctorPtr, QVector<HTextureImage> > FunctorImageHandlesPair;
-typedef QPair<QTextureDataFunctorPtr, HTextureData> FunctorTextureDataPair;
+typedef QPair<QTextureImageDataGeneratorPtr, QVector<HTextureImage> > FunctorImageHandlesPair;
+typedef QPair<QTextureImageDataGeneratorPtr, HTextureData> FunctorTextureDataPair;
-class TextureDataManager : public Qt3DCore::QResourceManager<QTexImageData,
+class TextureDataManager : public Qt3DCore::QResourceManager<QTextureImageData,
Qt3DCore::QNodeId,
16,
Qt3DCore::ArrayAllocatingPolicy,
@@ -73,15 +76,15 @@ class TextureDataManager : public Qt3DCore::QResourceManager<QTexImageData,
{
public:
TextureDataManager();
- void addToPendingTextures(const Qt3DCore::QNodeId &textureId);
+ void addToPendingTextures(Qt3DCore::QNodeId textureId);
QVector<Qt3DCore::QNodeId> texturesPending();
- HTextureData textureDataFromFunctor(const QTextureDataFunctorPtr &functor) const;
- void addTextureDataForFunctor(HTextureData textureDataHandle, const QTextureDataFunctorPtr &functor);
- void removeTextureDataFunctor(const QTextureDataFunctorPtr &functor);
+ HTextureData textureDataFromFunctor(const QTextureImageDataGeneratorPtr &functor) const;
+ void addTextureDataForFunctor(HTextureData textureDataHandle, const QTextureImageDataGeneratorPtr &functor);
+ void removeTextureDataFunctor(const QTextureImageDataGeneratorPtr &functor);
- void assignFunctorToTextureImage(const QTextureDataFunctorPtr &functor, HTextureImage imageHandle);
+ void assignFunctorToTextureImage(const QTextureImageDataGeneratorPtr &functor, HTextureImage imageHandle);
QMutex *mutex() const;
void cleanup();
@@ -97,7 +100,7 @@ private:
} // namespace Render
} // namespace Qt3DRender
-Q_DECLARE_RESOURCE_INFO(Qt3DRender::QTexImageData, Q_REQUIRES_CLEANUP)
+Q_DECLARE_RESOURCE_INFO(Qt3DRender::QTextureImageData, Q_REQUIRES_CLEANUP)
QT_END_NAMESPACE
diff --git a/src/render/texture/textureimage.cpp b/src/render/texture/textureimage.cpp
index 09eacd075..c1ff77ff3 100644
--- a/src/render/texture/textureimage.cpp
+++ b/src/render/texture/textureimage.cpp
@@ -1,43 +1,47 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "textureimage_p.h"
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/texturedatamanager_p.h>
+#include <Qt3DRender/private/qabstracttextureimage_p.h>
QT_BEGIN_NAMESPACE
@@ -47,77 +51,81 @@ namespace Qt3DRender {
namespace Render {
TextureImage::TextureImage()
- : QBackendNode()
+ : BackendNode(ReadWrite)
, m_layer(0)
- , m_mipmapLevel(0)
- , m_face(QAbstractTextureProvider::CubeMapPositiveX)
+ , m_mipLevel(0)
+ , m_face(QAbstractTexture::CubeMapPositiveX)
, m_dirty(true)
- , m_textureManager(Q_NULLPTR)
- , m_textureImageManager(Q_NULLPTR)
- , m_textureDataManager(Q_NULLPTR)
+ , m_textureManager(nullptr)
+ , m_textureImageManager(nullptr)
+ , m_textureDataManager(nullptr)
, m_dna(0)
{
}
void TextureImage::cleanup()
{
+ QBackendNode::setEnabled(false);
m_layer = 0;
- m_mipmapLevel = 0;
+ m_mipLevel = 0;
m_dirty = true;
- m_face = QAbstractTextureProvider::CubeMapPositiveX;
- m_functor.reset();
- m_textureManager = Q_NULLPTR;
- m_textureImageManager = Q_NULLPTR;
- m_textureDataManager = Q_NULLPTR;
+ m_face = QAbstractTexture::CubeMapPositiveX;
+ m_generator.reset();
+ m_textureManager = nullptr;
+ m_textureImageManager = nullptr;
+ m_textureDataManager = nullptr;
m_referencedTextures.clear();
m_dna = 0;
}
-void TextureImage::updateFromPeer(Qt3DCore::QNode *peer)
+void TextureImage::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
{
- QAbstractTextureImage *textureImage = static_cast<QAbstractTextureImage *>(peer);
- m_layer = textureImage->layer();
- m_mipmapLevel = textureImage->mipmapLevel();
- m_face = textureImage->cubeMapFace();
- m_functor = textureImage->dataFunctor();
- // Notify the Texture that we are one of its TextureImage
- if (!peer->parentNode()) {
- qWarning() << "Not QAbstractTextureProvider parent found";
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QAbstractTextureImageData>>(change);
+ const auto &data = typedChange->data;
+ m_mipLevel = data.mipLevel;
+ m_layer = data.layer;
+ m_face = data.face;
+ m_generator = data.generator;
+
+ if (!change->parentId()) {
+ qWarning() << "No QAbstractTextureProvider parent found";
} else {
- m_textureProviderId = peer->parentNode()->id();
+ m_textureProviderId = change->parentId();
m_textureProvider = m_textureManager->lookupHandle(m_textureProviderId);
- Texture *txt = m_textureManager->data(m_textureProvider);
+ Texture *texture = m_textureManager->data(m_textureProvider);
+ Q_ASSERT(texture);
// Notify the Texture that it has a new TextureImage and needs an update
- txt->addTextureImageData(m_textureImageManager->lookupHandle(peerUuid()));
- if (txt != Q_NULLPTR)
- txt->addToPendingTextureJobs();
+ texture->addTextureImageData(m_textureImageManager->lookupHandle(peerId()));
+ texture->addToPendingTextureJobs();
}
}
void TextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- QScenePropertyChangePtr propertyChange = qSharedPointerCast<QScenePropertyChange>(e);
+ QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
- if (e->type() == NodeUpdated) {
+ if (e->type() == PropertyUpdated) {
if (propertyChange->propertyName() == QByteArrayLiteral("layer")) {
m_layer = propertyChange->value().toInt();
m_dirty = true;
- } else if (propertyChange->propertyName() == QByteArrayLiteral("mipmapLevel")) {
- m_mipmapLevel = propertyChange->value().toInt();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("mipLevel")) {
+ m_mipLevel = propertyChange->value().toInt();
m_dirty = true;
- } else if (propertyChange->propertyName() == QByteArrayLiteral("cubeMapFace")) {
- m_face = static_cast<QAbstractTextureProvider::CubeMapFace>(propertyChange->value().toInt());
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("face")) {
+ m_face = static_cast<QAbstractTexture::CubeMapFace>(propertyChange->value().toInt());
m_dirty = true;
- } else if (propertyChange->propertyName() == QByteArrayLiteral("dataFunctor")) {
- m_functor = propertyChange->value().value<QTextureDataFunctorPtr>();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("dataGenerator")) {
+ m_generator = propertyChange->value().value<QTextureImageDataGeneratorPtr>();
m_dirty = true;
}
}
if (m_dirty) {// Notify the Texture that we were updated and request it to schedule an update job
Texture *txt = m_textureManager->data(m_textureProvider);
- if (txt != Q_NULLPTR)
+ if (txt != nullptr)
txt->addToPendingTextureJobs();
}
+ markDirty(AbstractRenderer::AllDirty);
+ BackendNode::sceneChangeEvent(e);
}
void TextureImage::setTextureManager(TextureManager *manager)
@@ -147,40 +155,50 @@ void TextureImage::setTextureDataHandle(HTextureData handle)
updateDNA();
}
+void TextureImage::setStatus(QTextureImage::Status status)
+{
+ // Notify the frontend
+ auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
+ e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ e->setPropertyName("status");
+ e->setValue(status);
+ notifyObservers(e);
+}
+
void TextureImage::updateDNA()
{
m_dna = ::qHash(m_layer
- + (m_mipmapLevel << 4)
+ + (m_mipLevel << 4)
+ (static_cast<int>(m_face) << 8)
+ (m_textureDataHandle.handle() << 12));
}
-TextureImageFunctor::TextureImageFunctor(TextureManager *textureManager,
- TextureImageManager *textureImageManager,
- TextureDataManager *textureDataManager)
+TextureImageFunctor::TextureImageFunctor(AbstractRenderer *renderer, TextureManager *textureManager,
+ TextureImageManager *textureImageManager,
+ TextureDataManager *textureDataManager)
: m_textureManager(textureManager)
, m_textureImageManager(textureImageManager)
, m_textureDataManager(textureDataManager)
+ , m_renderer(renderer)
{
}
-Qt3DCore::QBackendNode *TextureImageFunctor::create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const
+Qt3DCore::QBackendNode *TextureImageFunctor::create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const
{
- TextureImage *backend = m_textureImageManager->getOrCreateResource(frontend->id());
- backend->setFactory(factory);
+ TextureImage *backend = m_textureImageManager->getOrCreateResource(change->subjectId());
backend->setTextureManager(m_textureManager);
backend->setTextureImageManager(m_textureImageManager);
backend->setTextureDataManager(m_textureDataManager);
- backend->setPeer(frontend);
+ backend->setRenderer(m_renderer);
return backend;
}
-Qt3DCore::QBackendNode *TextureImageFunctor::get(const Qt3DCore::QNodeId &id) const
+Qt3DCore::QBackendNode *TextureImageFunctor::get(Qt3DCore::QNodeId id) const
{
return m_textureImageManager->lookupResource(id);
}
-void TextureImageFunctor::destroy(const Qt3DCore::QNodeId &id) const
+void TextureImageFunctor::destroy(Qt3DCore::QNodeId id) const
{
m_textureImageManager->releaseResource(id);
}
diff --git a/src/render/texture/textureimage_p.h b/src/render/texture/textureimage_p.h
index 28aa275ec..9ddfbe288 100644
--- a/src/render/texture/textureimage_p.h
+++ b/src/render/texture/textureimage_p.h
@@ -1,34 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -48,11 +51,12 @@
// We mean it.
//
-#include <qglobal.h>
-#include <Qt3DCore/qbackendnode.h>
-#include <Qt3DRender/qabstracttextureprovider.h>
-#include <Qt3DRender/qabstracttextureimage.h>
+#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/private/handle_types_p.h>
+#include <Qt3DRender/qabstracttexture.h>
+#include <Qt3DRender/qtextureimage.h>
+#include <Qt3DRender/qabstracttextureimage.h>
+#include <qglobal.h>
QT_BEGIN_NAMESPACE
@@ -66,66 +70,70 @@ class TextureDataManager;
typedef uint TextureImageDNA;
-class TextureImage : public Qt3DCore::QBackendNode
+class TextureImage : public BackendNode
{
public:
TextureImage();
void cleanup();
- void updateFromPeer(Qt3DCore::QNode *peer) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
int m_layer;
- int m_mipmapLevel;
- QAbstractTextureProvider::CubeMapFace m_face;
+ int m_mipLevel;
+ QAbstractTexture::CubeMapFace m_face;
bool m_dirty;
inline TextureImageDNA dna() const { return m_dna; }
inline int layer() const { return m_layer; }
- inline int mipmapLevel() const { return m_mipmapLevel; }
- inline QAbstractTextureProvider::CubeMapFace face() const { return m_face; }
+ inline int mipLevel() const { return m_mipLevel; }
+ inline QAbstractTexture::CubeMapFace face() const { return m_face; }
void setTextureManager(TextureManager *manager);
void setTextureImageManager(TextureImageManager *manager);
void setTextureDataManager(TextureDataManager *manager);
+ void setStatus(QTextureImage::Status status);
void unsetDirty();
inline bool isDirty() const { return m_dirty; }
- inline QTextureDataFunctorPtr textureDataFunctor() const { return m_functor; }
+ inline QTextureImageDataGeneratorPtr textureDataGenerator() const { return m_generator; }
void setTextureDataHandle(HTextureData handle);
inline HTextureData textureDataHandle() const { return m_textureDataHandle; }
- inline QTextureDataFunctorPtr dataFunctor() const { return m_functor; }
+ inline QTextureImageDataGeneratorPtr dataGenerator() const { return m_generator; }
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
void updateDNA();
- QTextureDataFunctorPtr m_functor;
+ QTextureImageDataGeneratorPtr m_generator;
HTextureData m_textureDataHandle;
TextureManager *m_textureManager;
TextureImageManager *m_textureImageManager;
TextureDataManager *m_textureDataManager;
- QList<Qt3DCore::QNodeId> m_referencedTextures;
+ QVector<Qt3DCore::QNodeId> m_referencedTextures;
HTexture m_textureProvider;
Qt3DCore::QNodeId m_textureProviderId;
TextureImageDNA m_dna;
};
-class TextureImageFunctor : public Qt3DCore::QBackendNodeFunctor
+class TextureImageFunctor : public Qt3DCore::QBackendNodeMapper
{
public:
- explicit TextureImageFunctor(TextureManager *textureManager,
- TextureImageManager *textureImageManager,
- TextureDataManager *textureDataManager);
+ explicit TextureImageFunctor(AbstractRenderer *renderer,
+ TextureManager *textureManager,
+ TextureImageManager *textureImageManager,
+ TextureDataManager *textureDataManager);
- Qt3DCore::QBackendNode *create(Qt3DCore::QNode *frontend, const Qt3DCore::QBackendNodeFactory *factory) const Q_DECL_FINAL;
- Qt3DCore::QBackendNode *get(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
- void destroy(const Qt3DCore::QNodeId &id) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *create(const Qt3DCore::QNodeCreatedChangeBasePtr &change) const Q_DECL_FINAL;
+ Qt3DCore::QBackendNode *get(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
+ void destroy(Qt3DCore::QNodeId id) const Q_DECL_FINAL;
private:
TextureManager *m_textureManager;
TextureImageManager *m_textureImageManager;
TextureDataManager *m_textureDataManager;
+ AbstractRenderer *m_renderer;
};
diff --git a/src/src.pro b/src/src.pro
index 097d2df25..9d51e6b14 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -7,13 +7,17 @@ src_render.subdir = $$PWD/render
src_render.target = sub-render
src_render.depends = src_core
+src_logic.subdir = $$PWD/logic
+src_logic.target = sub-logic
+src_logic.depends = src_core
+
src_input.subdir = $$PWD/input
src_input.target = sub-input
src_input.depends = src_render
-src_logic.subdir = $$PWD/logic
-src_logic.target = sub-logic
-src_logic.depends = src_core
+src_extras.subdir = $$PWD/extras
+src_extras.target = src_extras
+src_extras.depends = src_render src_input src_logic
# Quick3D libs
src_quick3d_core.subdir = $$PWD/quick3d/quick3d
@@ -28,6 +32,10 @@ src_quick3d_input.subdir = $$PWD/quick3d/quick3dinput
src_quick3d_input.target = sub-quick3d-input
src_quick3d_input.depends = src_input src_quick3d_core
+src_quick3d_extras.subdir = $$PWD/quick3d/quick3dextras
+src_quick3d_extras.target = sub-quick3d-extras
+src_quick3d_extras.depends = src_render src_logic src_input src_quick3d_core
+
# Quick3D imports
src_quick3d_core_imports.file = $$PWD/quick3d/imports/core/importscore.pro
src_quick3d_core_imports.target = sub-quick3d-imports-core
@@ -49,24 +57,31 @@ src_quick3d_imports_logic.file = $$PWD/quick3d/imports/logic/importslogic.pro
src_quick3d_imports_logic.target = sub-quick3d-imports-logic
src_quick3d_imports_logic.depends = src_logic
+src_quick3d_imports_extras.file = $$PWD/quick3d/imports/extras/importsextras.pro
+src_quick3d_imports_extras.target = sub-quick3d-imports-extras
+src_quick3d_imports_extras.depends = src_extras
+
# Qt3D Scene Parser plugins
src_plugins_sceneparsers.file = $$PWD/plugins/sceneparsers/sceneparsers.pro
src_plugins_sceneparsers.target = sub-plugins-sceneparsers
-src_plugins_sceneparsers.depends = src_render
+src_plugins_sceneparsers.depends = src_render src_extras
SUBDIRS += \
src_core \
src_render \
- src_input \
src_logic \
+ src_input \
+ src_extras \
src_quick3d_core \
src_quick3d_core_imports \
src_quick3d_render \
src_quick3d_input \
+ src_quick3d_extras \
src_quick3d_imports_render \
src_quick3d_imports_scene3d \
src_quick3d_imports_input \
src_quick3d_imports_logic \
+ src_quick3d_imports_extras \
src_plugins_sceneparsers \
doc
diff --git a/sync.profile b/sync.profile
index f30e4f81a..3c23a8b8d 100644
--- a/sync.profile
+++ b/sync.profile
@@ -6,6 +6,8 @@
"Qt3DInput" => "$basedir/src/input",
"Qt3DQuickInput" => "$basedir/src/quick3d/quick3dinput",
"Qt3DLogic" => "$basedir/src/logic",
+ "Qt3DExtras" => "$basedir/src/extras",
+ "Qt3DQuickExtras" => "$basedir/src/quick3d/quick3dextras",
);
%moduleheaders = ( # restrict the module headers to those found in relative path
);
diff --git a/tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp b/tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp
index 9c91cc579..f5b17ebd3 100644
--- a/tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp
+++ b/tests/auto/core/arrayresourcesmanager/dynamicarraypolicy/tst_dynamicarraypolicy.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -85,9 +77,9 @@ void tst_DynamicArrayPolicy::createResourcesManager()
Qt3DCore::QResourceManager<tst_ArrayResource, int, 16> manager16;
Qt3DCore::QResourceManager<tst_ArrayResource, int, 4> manager4;
Qt3DCore::QResourceManager<tst_ArrayResource, int, 8> manager8;
- QVERIFY(manager16.maxResourcesEntries() == 65535);
- QVERIFY(manager8.maxResourcesEntries() == 255);
- QVERIFY(manager4.maxResourcesEntries() == 15);
+ QVERIFY(manager16.maximumSize() == 65535);
+ QVERIFY(manager8.maximumSize() == 255);
+ QVERIFY(manager4.maximumSize() == 15);
}
/*!
@@ -128,7 +120,7 @@ void tst_DynamicArrayPolicy::getResources()
QVERIFY(handles.at(i).index() == i);
QVERIFY(handles.at(i).counter() == 1);
resources << manager.data(handles.at(i));
- QVERIFY(resources.at(i) != Q_NULLPTR);
+ QVERIFY(resources.at(i) != nullptr);
resources.at(i)->m_value = i;
}
@@ -137,7 +129,7 @@ void tst_DynamicArrayPolicy::getResources()
// Check that an invalid resource returns NULL
tHandle8 iHandle;
- QVERIFY(manager.data(iHandle) == Q_NULLPTR);
+ QVERIFY(manager.data(iHandle) == nullptr);
}
@@ -186,12 +178,12 @@ void tst_DynamicArrayPolicy::removeResource()
}
manager.release(handles.at(2));
- QVERIFY(manager.data(handles.at(2)) == Q_NULLPTR);
+ QVERIFY(manager.data(handles.at(2)) == nullptr);
// Triggers QASSERT so commented
// manager.release(handles.at(2));
tHandle nHandle = manager.acquire();
- QVERIFY(manager.data(nHandle) != Q_NULLPTR);
+ QVERIFY(manager.data(nHandle) != nullptr);
}
/*!
@@ -211,7 +203,7 @@ void tst_DynamicArrayPolicy::resetResource()
}
manager.reset();
for (uint i = 0; i < 5; i++) {
- QVERIFY(manager.data(handles.at(i)) == Q_NULLPTR);
+ QVERIFY(manager.data(handles.at(i)) == nullptr);
}
handles.clear();
for (uint i = 0; i < 5; i++)
@@ -239,9 +231,9 @@ void tst_DynamicArrayPolicy::lookupResource()
tHandle16 t = manager.lookupHandle(2);
QVERIFY(t.handle() == 0);
- QVERIFY(manager.data(t) == Q_NULLPTR);
+ QVERIFY(manager.data(t) == nullptr);
tst_ArrayResource *resource = manager.getOrCreateResource(2);
- QVERIFY(resource != Q_NULLPTR);
+ QVERIFY(resource != nullptr);
t = manager.lookupHandle(2);
QVERIFY(manager.data(t) == manager.lookupResource(2));
QVERIFY(t == manager.getOrAcquireHandle(2));
@@ -264,7 +256,7 @@ void tst_DynamicArrayPolicy::releaseResource()
for (int i = 0; i < 5; i++) {
manager.releaseResource(i);
- QVERIFY(manager.lookupResource(i) == Q_NULLPTR);
+ QVERIFY(manager.lookupResource(i) == nullptr);
}
}
@@ -298,7 +290,7 @@ protected:
while (i < max) {
tst_ArrayResource *r = m_manager->getOrCreateResource(i);
i++;
- QVERIFY(r != Q_NULLPTR);
+ QVERIFY(r != nullptr);
r->m_value.fetchAndAddOrdered(+1);
}
qDebug() << QThread::currentThread() << "Done";
@@ -331,7 +323,7 @@ void tst_DynamicArrayPolicy::heavyDutyMultiThreadedAccess()
}
for (int i = 0; i < max; i++) {
- QVERIFY(manager->lookupResource(i) != Q_NULLPTR);
+ QVERIFY(manager->lookupResource(i) != nullptr);
QVERIFY(manager->lookupResource(i)->m_value = iterations);
}
@@ -369,7 +361,7 @@ protected:
int max = tHandle::maxIndex();
while (i < max) {
tst_ArrayResource *r = m_manager->getOrCreateResource(i);
- QVERIFY(r != Q_NULLPTR);
+ QVERIFY(r != nullptr);
int oldValue = r->m_value.fetchAndAddOrdered(+1);
if (oldValue == m_releaseAbove)
m_manager->releaseResource(i);
@@ -408,7 +400,7 @@ void tst_DynamicArrayPolicy::heavyDutyMultiThreadedAccessRelease()
}
for (int i = 0; i < max; i++) {
- QVERIFY(manager->lookupResource(i) == Q_NULLPTR);
+ QVERIFY(manager->lookupResource(i) == nullptr);
}
qDeleteAll(threads);
@@ -425,9 +417,9 @@ void tst_DynamicArrayPolicy::maximumNumberOfResources()
QList<tst_ArrayResource *> resources;
QList<tHandle16> handles;
- QCOMPARE(tHandle16::maxIndex(), (uint)manager.maxResourcesEntries());
+ QCOMPARE(tHandle16::maxIndex(), (uint)manager.maximumSize());
- for (int i = 0; i < manager.maxResourcesEntries(); i++) {
+ for (int i = 0; i < manager.maximumSize(); i++) {
handles << manager.acquire();
resources << manager.data(handles.at(i));
resources.at(i)->m_value = 4;
diff --git a/tests/auto/core/arrayresourcesmanager/preallocatedarraypolicy/tst_preallocatedarraypolicy.cpp b/tests/auto/core/arrayresourcesmanager/preallocatedarraypolicy/tst_preallocatedarraypolicy.cpp
index 83e9a5215..dbed2abfb 100644
--- a/tests/auto/core/arrayresourcesmanager/preallocatedarraypolicy/tst_preallocatedarraypolicy.cpp
+++ b/tests/auto/core/arrayresourcesmanager/preallocatedarraypolicy/tst_preallocatedarraypolicy.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -79,9 +71,9 @@ void tst_PreallocatedArrayPolicy::createResourcesManager()
Qt3DCore::QResourceManager<tst_ArrayResource, int, 16, Qt3DCore::ArrayPreallocationPolicy> manager16;
Qt3DCore::QResourceManager<tst_ArrayResource, int, 4, Qt3DCore::ArrayPreallocationPolicy> manager4;
Qt3DCore::QResourceManager<tst_ArrayResource, int, 8, Qt3DCore::ArrayPreallocationPolicy> manager8;
- QVERIFY(manager16.maxResourcesEntries() == 65535);
- QVERIFY(manager8.maxResourcesEntries() == 255);
- QVERIFY(manager4.maxResourcesEntries() == 15);
+ QVERIFY(manager16.maximumSize() == 65535);
+ QVERIFY(manager8.maximumSize() == 255);
+ QVERIFY(manager4.maximumSize() == 15);
}
/*!
@@ -122,7 +114,7 @@ void tst_PreallocatedArrayPolicy::getResources()
QVERIFY(handles.at(i).index() == i);
QVERIFY(handles.at(i).counter() == 1);
resources << manager.data(handles.at(i));
- QVERIFY(resources.at(i) != Q_NULLPTR);
+ QVERIFY(resources.at(i) != nullptr);
resources.at(i)->m_value = i;
}
@@ -131,7 +123,7 @@ void tst_PreallocatedArrayPolicy::getResources()
// Check that an invalid resource returns NULL
tHandle8 iHandle;
- QVERIFY(manager.data(iHandle) == Q_NULLPTR);
+ QVERIFY(manager.data(iHandle) == nullptr);
}
@@ -180,12 +172,12 @@ void tst_PreallocatedArrayPolicy::removeResource()
}
manager.release(handles.at(2));
- QVERIFY(manager.data(handles.at(2)) == Q_NULLPTR);
+ QVERIFY(manager.data(handles.at(2)) == nullptr);
// Triggers QASSERT so commented
// manager.release(handles.at(2));
tHandle nHandle = manager.acquire();
- QVERIFY(manager.data(nHandle) != Q_NULLPTR);
+ QVERIFY(manager.data(nHandle) != nullptr);
}
/*!
@@ -205,7 +197,7 @@ void tst_PreallocatedArrayPolicy::resetResource()
}
manager.reset();
for (uint i = 0; i < 5; i++) {
- QVERIFY(manager.data(handles.at(i)) == Q_NULLPTR);
+ QVERIFY(manager.data(handles.at(i)) == nullptr);
}
handles.clear();
for (uint i = 0; i < 5; i++)
@@ -233,9 +225,9 @@ void tst_PreallocatedArrayPolicy::lookupResource()
tHandle16 t = manager.lookupHandle(2);
QVERIFY(t.handle() == 0);
- QVERIFY(manager.data(t) == Q_NULLPTR);
+ QVERIFY(manager.data(t) == nullptr);
tst_ArrayResource *resource = manager.getOrCreateResource(2);
- QVERIFY(resource != Q_NULLPTR);
+ QVERIFY(resource != nullptr);
t = manager.lookupHandle(2);
QVERIFY(manager.data(t) == manager.lookupResource(2));
QVERIFY(t == manager.getOrAcquireHandle(2));
@@ -258,7 +250,7 @@ void tst_PreallocatedArrayPolicy::releaseResource()
for (int i = 0; i < 5; i++) {
manager.releaseResource(i);
- QVERIFY(manager.lookupResource(i) == Q_NULLPTR);
+ QVERIFY(manager.lookupResource(i) == nullptr);
}
}
@@ -292,7 +284,7 @@ protected:
while (i < max) {
tst_ArrayResource *r = m_manager->getOrCreateResource(i);
i++;
- QVERIFY(r != Q_NULLPTR);
+ QVERIFY(r != nullptr);
Manager::Locker lock(m_manager);
r->m_value++;
}
@@ -326,7 +318,7 @@ void tst_PreallocatedArrayPolicy::heavyDutyMultiThreadedAccess()
}
for (int i = 0; i < max; i++) {
- QVERIFY(manager->lookupResource(i) != Q_NULLPTR);
+ QVERIFY(manager->lookupResource(i) != nullptr);
QVERIFY(manager->lookupResource(i)->m_value = iterations);
}
@@ -364,7 +356,7 @@ protected:
int max = tHandle::maxIndex();
while (i < max) {
tst_ArrayResource *r = m_manager->getOrCreateResource(i);
- QVERIFY(r != Q_NULLPTR);
+ QVERIFY(r != nullptr);
int oldValue = r->m_value.fetchAndAddOrdered(+1);
if (oldValue == m_releaseAbove)
m_manager->releaseResource(i);
@@ -403,7 +395,7 @@ void tst_PreallocatedArrayPolicy::heavyDutyMultiThreadedAccessRelease()
}
for (int i = 0; i < max; i++) {
- QVERIFY(manager->lookupResource(i) == Q_NULLPTR);
+ QVERIFY(manager->lookupResource(i) == nullptr);
}
qDeleteAll(threads);
@@ -420,9 +412,9 @@ void tst_PreallocatedArrayPolicy::maximumNumberOfResources()
QList<tst_ArrayResource *> resources;
QList<tHandle16> handles;
- QCOMPARE(tHandle16::maxIndex(), (uint)manager.maxResourcesEntries());
+ QCOMPARE(tHandle16::maxIndex(), (uint)manager.maximumSize());
- for (int i = 0; i < manager.maxResourcesEntries(); i++) {
+ for (int i = 0; i < manager.maximumSize(); i++) {
handles << manager.acquire();
resources << manager.data(handles.at(i));
resources.at(i)->m_value = 4;
diff --git a/tests/auto/core/cloning/cloning.pro b/tests/auto/core/cloning/cloning.pro
deleted file mode 100644
index d6ecaf489..000000000
--- a/tests/auto/core/cloning/cloning.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TARGET = tst_cloning
-CONFIG += testcase
-TEMPLATE = app
-
-SOURCES += \
- tst_cloning.cpp
-
-QT += testlib core-private 3dcore 3dcore-private
diff --git a/tests/auto/core/cloning/tst_cloning.cpp b/tests/auto/core/cloning/tst_cloning.cpp
deleted file mode 100644
index 1ddada245..000000000
--- a/tests/auto/core/cloning/tst_cloning.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qcomponent.h>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-
-class tst_Cloning : public QObject
-{
- Q_OBJECT
-public:
- tst_Cloning() : QObject() {}
- ~tst_Cloning() {}
-
-private slots:
- void checkEntityCloning();
-};
-
-class MyQNode : public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- explicit MyQNode(Qt3DCore::QNode *parent = 0) : QNode(parent)
- {}
-
- ~MyQNode()
- {
- QNode::cleanup();
- }
-
- void setCustomProperty(const QString &s) { m_customProperty = s; }
- QString customProperty() const { return m_customProperty; }
-
- QT3D_CLONEABLE(MyQNode)
-
- QString m_customProperty;
-
- static QNode *clone(QNode *node) {
- return QNode::clone(node);
- }
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE
- {
- Qt3DCore::QNode::copy(ref);
- const MyQNode *refNode = qobject_cast<const MyQNode *>(ref);
- setCustomProperty(refNode->customProperty());
- }
-};
-
-class MyQComponent : public Qt3DCore::QComponent
-{
- Q_OBJECT
-public:
- explicit MyQComponent(Qt3DCore::QNode *parent = 0) : QComponent(parent)
- {}
-
- ~MyQComponent()
- {
- QNode::cleanup();
- }
-
- QT3D_CLONEABLE(MyQComponent)
-};
-
-void tst_Cloning::checkEntityCloning()
-{
- // GIVEN
- Qt3DCore::QScene *scene = new Qt3DCore::QScene();
- MyQNode *root = new MyQNode();
- Qt3DCore::QNodePrivate::get(root)->setScene(scene);
-
- Qt3DCore::QEntity *entity = new Qt3DCore::QEntity(root);
-
- // WHEN
- MyQComponent *comp1 = new MyQComponent();
- MyQComponent *comp2 = new MyQComponent();
- MyQComponent *comp3 = new MyQComponent();
-
- MyQNode *childNode = new MyQNode(entity);
- entity->addComponent(comp1);
- entity->addComponent(comp2);
- entity->addComponent(comp3);
-
- root->setCustomProperty(QStringLiteral("Corvette"));
-
- // THEN
- QVERIFY(root->customProperty() == QStringLiteral("Corvette"));
- QCOMPARE(root->children().count(), 1);
- QCOMPARE(entity->children().count(), 4);
- QCOMPARE(entity->components().count(), 3);
-
- //WHEN
- MyQNode *cloneRoot = qobject_cast<MyQNode *>(MyQNode::clone(root));
-
- // THEN
- QCOMPARE(cloneRoot->children().count(), 1);
- QCOMPARE(cloneRoot->id(), root->id());
- QVERIFY(cloneRoot->customProperty() == root->customProperty());
-
- Qt3DCore::QEntity *cloneEntity = qobject_cast<Qt3DCore::QEntity *>(cloneRoot->children().first());
- QVERIFY(cloneEntity != Q_NULLPTR);
- QCOMPARE(cloneEntity->id(), entity->id());
- QCOMPARE(cloneEntity->children().count(), 4);
- QCOMPARE(cloneEntity->components().count(), 3);
-
- QList<Qt3DCore::QNodeId> ids = QList<Qt3DCore::QNodeId>() << comp1->id() << comp2->id() << comp3->id() << childNode->id();
-
- Q_FOREACH (QObject *c, cloneEntity->children()) {
- Qt3DCore::QNode *n = qobject_cast<Qt3DCore::QNode *>(c);
- QVERIFY(ids.contains(n->id()));
- ids.removeAll(n->id());
- }
-
- delete cloneRoot;
-}
-
-QTEST_APPLESS_MAIN(tst_Cloning)
-
-#include "tst_cloning.moc"
-
diff --git a/tests/auto/core/common/common.pri b/tests/auto/core/common/common.pri
new file mode 100644
index 000000000..cdfcae337
--- /dev/null
+++ b/tests/auto/core/common/common.pri
@@ -0,0 +1,9 @@
+SOURCES += \
+ $$PWD/qbackendnodetester.cpp
+
+HEADERS += \
+ $$PWD/qbackendnodetester.h
+
+INCLUDEPATH += $$PWD
+
+QT += core-private 3dcore 3dcore-private
diff --git a/tests/auto/core/common/qbackendnodetester.cpp b/tests/auto/core/common/qbackendnodetester.cpp
new file mode 100644
index 000000000..6e2dd6414
--- /dev/null
+++ b/tests/auto/core/common/qbackendnodetester.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qbackendnodetester.h"
+#include <Qt3DCore/qbackendnode.h>
+#include <Qt3DCore/qnode.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+QBackendNodeTester::QBackendNodeTester(QObject *parent)
+ : QObject(parent)
+{
+}
+
+void QBackendNodeTester::simulateInitialization(QNode *frontend, QBackendNode *backend)
+{
+ Q_ASSERT(frontend);
+ Q_ASSERT(backend);
+ const auto change = frontend->createNodeCreationChange();
+ backend->setPeerId(change->subjectId());
+ backend->setEnabled(change->isNodeEnabled());
+ backend->initializeFromPeer(change);
+}
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
diff --git a/tests/auto/core/common/qbackendnodetester.h b/tests/auto/core/common/qbackendnodetester.h
new file mode 100644
index 000000000..88ee37515
--- /dev/null
+++ b/tests/auto/core/common/qbackendnodetester.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT3DCORE_QBACKENDNODETESTER_H
+#define QT3DCORE_QBACKENDNODETESTER_H
+
+#include <QObject>
+#include <Qt3DCore/qnodeid.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+
+class QBackendNode;
+class QNode;
+
+class QBackendNodeTester : public QObject
+{
+ Q_OBJECT
+public:
+ explicit QBackendNodeTester(QObject *parent = 0);
+
+ // Proxies to allow test classes to call private methods on QBackendNode
+ void simulateInitialization(QNode *frontend, QBackendNode *backend);
+};
+
+} // namespace Qt3DCore
+
+QT_END_NAMESPACE
+
+#endif // QT3DCORE_QBACKENDNODETESTER_H
diff --git a/tests/auto/core/core.pro b/tests/auto/core/core.pro
index e76a7d856..317bef16e 100644
--- a/tests/auto/core/core.pro
+++ b/tests/auto/core/core.pro
@@ -7,19 +7,17 @@ SUBDIRS = \
qcircularbuffer \
qboundedcircularbuffer \
nodes \
- qentity \
qaspectengine \
qaspectfactory \
qaspectjob \
qchangearbiter \
qscene \
- qservicelocator \
- qray3d \
- qtransform
+ qservicelocator
contains(QT_CONFIG, private_tests) {
SUBDIRS += \
+ qentity \
qframeallocator \
- cloning \
+ qtransform \
threadpooler
}
diff --git a/tests/auto/core/handle/tst_handle.cpp b/tests/auto/core/handle/tst_handle.cpp
index 5eb92e53b..2717cb635 100644
--- a/tests/auto/core/handle/tst_handle.cpp
+++ b/tests/auto/core/handle/tst_handle.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/core/handlemanager/tst_handlemanager.cpp b/tests/auto/core/handlemanager/tst_handlemanager.cpp
index 13afabfe8..a60d3cc57 100644
--- a/tests/auto/core/handlemanager/tst_handlemanager.cpp
+++ b/tests/auto/core/handlemanager/tst_handlemanager.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -129,7 +121,7 @@ void tst_HandleManager::nullForRemovedEntry()
bool ok = false;
SimpleResource *p2 = manager.data(h, &ok);
QVERIFY(ok == false);
- QVERIFY(p2 == Q_NULLPTR);
+ QVERIFY(p2 == nullptr);
}
void tst_HandleManager::validHandleForReplacementEntry()
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp
index 629c03365..a75236386 100644
--- a/tests/auto/core/nodes/tst_nodes.cpp
+++ b/tests/auto/core/nodes/tst_nodes.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,7 +31,12 @@
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/qcomponent.h>
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qcomponentaddedchange.h>
+#include <Qt3DCore/qcomponentremovedchange.h>
+#include <Qt3DCore/qnodedestroyedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <private/qpostman_p.h>
#include <Qt3DCore/private/qlockableobserverinterface_p.h>
@@ -49,7 +46,10 @@ class tst_Nodes : public QObject
{
Q_OBJECT
public:
- tst_Nodes() : QObject() {}
+ tst_Nodes() : QObject()
+ {
+ qRegisterMetaType<Qt3DCore::QNode*>();
+ }
~tst_Nodes() {}
private slots:
@@ -80,7 +80,6 @@ private slots:
void changeCustomProperty();
void checkDestruction();
- void verifyCopy();
};
class ObserverSpy;
@@ -124,7 +123,7 @@ public:
~ObserverSpy()
{
- Qt3DCore::QNodePrivate::get(m_node)->setArbiter(Q_NULLPTR);
+ Qt3DCore::QNodePrivate::get(m_node)->setArbiter(nullptr);
}
void sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE
@@ -166,12 +165,11 @@ class MyQNode : public Qt3DCore::QNode
public:
explicit MyQNode(Qt3DCore::QNode *parent = 0)
: QNode(parent)
- , m_scene(Q_NULLPTR)
+ , m_scene(nullptr)
{}
~MyQNode()
{
- QNode::cleanup();
delete m_scene;
}
@@ -189,24 +187,20 @@ public:
return m_customProperty;
}
- void assignScene()
+ void assignScene(Qt3DCore::QAbstractArbiter *arbiter)
{
- if (!m_scene)
+ if (!m_scene) {
m_scene = new Qt3DCore::QScene();
+ if (arbiter)
+ m_scene->setArbiter(arbiter);
+ }
Qt3DCore::QNodePrivate::get(this)->setScene(m_scene);
}
- void makeCopyOf(QNode *other)
- {
- QNode::copy(other);
- }
-
signals:
void customPropertyChanged();
protected:
- QT3D_CLONEABLE(MyQNode)
-
QString m_customProperty;
Qt3DCore::QScene *m_scene;
};
@@ -217,15 +211,6 @@ class MyQComponent : public Qt3DCore::QComponent
public:
explicit MyQComponent(Qt3DCore::QNode *parent = 0) : QComponent(parent)
{}
-
- ~MyQComponent()
- {
- QNode::cleanup();
- }
-
- // QNode interface
-protected:
- QT3D_CLONEABLE(MyQComponent)
};
@@ -235,11 +220,12 @@ void tst_Nodes::defaultNodeConstruction()
QScopedPointer<MyQNode> node(new MyQNode());
// THEN
- QVERIFY(node != Q_NULLPTR);
+ QVERIFY(node != nullptr);
QVERIFY(node->children().isEmpty());
// GIVEN
MyQNode *node2 = new MyQNode(node.data());
+ QCoreApplication::processEvents();
// THEN
QVERIFY(node2->parent() == node.data());
@@ -252,9 +238,10 @@ void tst_Nodes::defaultComponentConstruction()
// GIVEN
QScopedPointer<MyQComponent> comp(new MyQComponent());
MyQComponent *comp2 = new MyQComponent(comp.data());
+ QCoreApplication::processEvents();
// THEN
- QVERIFY(comp != Q_NULLPTR);
+ QVERIFY(comp != nullptr);
QCOMPARE(comp2->parent(), comp.data());
}
@@ -263,6 +250,7 @@ void tst_Nodes::defaultEntityConstrution()
// GIVEN
QScopedPointer<Qt3DCore::QEntity> entity(new Qt3DCore::QEntity());
Qt3DCore::QEntity *entity2 = new Qt3DCore::QEntity(entity.data());
+ QCoreApplication::processEvents();
// THEN
QVERIFY(entity->components().isEmpty());
@@ -278,12 +266,12 @@ void tst_Nodes::appendSingleChildNodeToNodeNoSceneExplicitParenting()
ObserverSpy spy(node.data());
// THEN
- QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == nullptr);
// WHEN
QScopedPointer<MyQNode> child(new MyQNode());
// THEN
- QVERIFY(child->parent() == Q_NULLPTR);
+ QVERIFY(child->parent() == nullptr);
// WHEN
child->setParent(node.data());
@@ -305,9 +293,10 @@ void tst_Nodes::appendSingleChildNodeToNodeNoSceneImplicitParenting()
ObserverSpy spy(node.data());
// THEN
- QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == nullptr);
// WHEN
QScopedPointer<MyQNode> child(new MyQNode(node.data()));
+ QCoreApplication::processEvents();
// THEN
QVERIFY(child->parent() == node.data());
@@ -326,13 +315,14 @@ void tst_Nodes::appendMultipleChildNodesToNodeNoScene()
ObserverSpy spy(node.data());
// THEN
- QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() == nullptr);
// WHEN
for (int i = 0; i < 10; i++) {
// WHEN
- Qt3DCore::QNode *child = Q_NULLPTR;
+ Qt3DCore::QNode *child = nullptr;
if (i % 2 == 0) {
child = new MyQNode(node.data());
+ QCoreApplication::processEvents();
} else {
child = new MyQNode();
child->setParent(node.data());
@@ -355,33 +345,43 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneExplicitParenting()
QScopedPointer<MyQNode> node(new MyQNode());
ObserverSpy spy(node.data());
// WHEN
- node->assignScene();
+ node->assignScene(&spy);
// THEN
- QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() != Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() != nullptr);
// WHEN
QScopedPointer<MyQNode> child(new MyQNode());
// THEN
- QVERIFY(child->parent() == Q_NULLPTR);
+ QVERIFY(child->parent() == nullptr);
+ QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() == nullptr);
// WHEN
child->setParent(node.data());
- QCoreApplication::processEvents();
// THEN
QVERIFY(child->parent() == node.data());
QVERIFY(child->parentNode() == node.data());
- QCOMPARE(spy.events.size(), 1);
- QVERIFY(spy.events.first().wasLocked());
+ QCOMPARE(spy.events.size(), 2);
QCOMPARE(node->children().count(), 1);
+ QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() != nullptr);
- Qt3DCore::QScenePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeCreated);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QCOMPARE(clone->parentNode()->id(), node->id());
+ // Creation event
+ QVERIFY(spy.events.first().wasLocked());
+ Qt3DCore::QNodeCreatedChangeBasePtr creationEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeCreatedChangeBase>();
+ QVERIFY(creationEvent);
+ QCOMPARE(creationEvent->subjectId(), child->id());
+ QCOMPARE(creationEvent->metaObject(), child->metaObject());
+ QCOMPARE(creationEvent->isNodeEnabled(), child->isEnabled());
+ QCOMPARE(creationEvent->parentId(), child->parentNode()->id());
+
+ // Node Added event
+ QVERIFY(spy.events.first().wasLocked());
+ Qt3DCore::QPropertyNodeAddedChangePtr additionEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QVERIFY(additionEvent);
+ QCOMPARE(additionEvent->subjectId(), node->id());
+ QCOMPARE(additionEvent->addedNodeId(), child->id());
+ QCOMPARE(additionEvent->metaObject(), child->metaObject());
}
void tst_Nodes::appendSingleChildNodeToNodeSceneImplicitParenting()
@@ -390,10 +390,11 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneImplicitParenting()
// GIVEN
QScopedPointer<MyQNode> node(new MyQNode());
ObserverSpy spy(node.data());
+
// WHEN
- node->assignScene();
+ node->assignScene(&spy);
// THEN
- QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() != Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() != nullptr);
// WHEN
QScopedPointer<MyQNode> child(new MyQNode(node.data()));
@@ -402,18 +403,28 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneImplicitParenting()
// THEN
QVERIFY(child->parent() == node.data());
QVERIFY(child->parentNode() == node.data());
- QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() != Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() != nullptr);
- QCOMPARE(spy.events.size(), 1);
+ QCOMPARE(spy.events.size(), 2);
QVERIFY(spy.events.first().wasLocked());
QCOMPARE(node->children().count(), 1);
- Qt3DCore::QScenePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeCreated);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QCOMPARE(clone->parentNode()->id(), node->id());
+ // Creation event
+ QVERIFY(spy.events.first().wasLocked());
+ Qt3DCore::QNodeCreatedChangeBasePtr creationEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeCreatedChangeBase>();
+ QVERIFY(creationEvent);
+ QCOMPARE(creationEvent->subjectId(), child->id());
+ QCOMPARE(creationEvent->metaObject(), child->metaObject());
+ QCOMPARE(creationEvent->isNodeEnabled(), child->isEnabled());
+ QCOMPARE(creationEvent->parentId(), child->parentNode()->id());
+
+ // Node Added event
+ QVERIFY(spy.events.first().wasLocked());
+ Qt3DCore::QPropertyNodeAddedChangePtr additionEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QVERIFY(additionEvent);
+ QCOMPARE(additionEvent->subjectId(), node->id());
+ QCOMPARE(additionEvent->addedNodeId(), child->id());
+ QCOMPARE(additionEvent->metaObject(), child->metaObject());
}
void tst_Nodes::appendMultipleChildNodesToNodeScene()
@@ -422,50 +433,83 @@ void tst_Nodes::appendMultipleChildNodesToNodeScene()
// GIVEN
QScopedPointer<MyQNode> node(new MyQNode());
+
// WHEN
- node->assignScene();
ObserverSpy spy(node.data());
+ node->assignScene(&spy);
// THEN
- QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() != Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(node.data())->scene() != nullptr);
// WHEN
- for (int i = 0; i < 10; i++) {
+ const auto childCount = 10;
+ for (int i = 0; i < childCount; i++) {
// WHEN
- Qt3DCore::QNode *child = Q_NULLPTR;
+ Qt3DCore::QNode *child = nullptr;
if (i % 2 == 0) {
child = new MyQNode(node.data());
- QCoreApplication::processEvents();
- QCOMPARE(spy.events.size(), i + 1);
} else {
child = new MyQNode();
child->setParent(node.data());
}
- // THEN
+
+ // THEN parent and scene should be set synchronously
QVERIFY(child->parent() == node.data());
- QVERIFY(Qt3DCore::QNodePrivate::get(child)->scene() != Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(child)->scene() == Qt3DCore::QNodePrivate::get(node.data())->m_scene);
}
// THEN
QCOMPARE(node->children().count(), 10);
- // THEN
- QCOMPARE(spy.events.size(), 10);
- Q_FOREACH (const ObserverSpy::ChangeRecord &r, spy.events) {
+ // WHEN
+ QCoreApplication::processEvents();
- QVERIFY(r.wasLocked());
- Qt3DCore::QScenePropertyChangePtr event = r.change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeCreated);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
-
- bool found = false;
- Q_FOREACH (QObject *c, node->children()) {
- if (clone->id() == qobject_cast<Qt3DCore::QNode *>(c)->id()) {
- found = true;
- QCOMPARE(clone->parentNode()->id(), node->id());
- break;
- }
- }
- QVERIFY(found);
+ // THEN backend is notified after the event loop spins. The recorded events are a little
+ // tricky to understand and differs for children with the parent being set at construction
+ // time (even children and ids) and the children being created without a parent and then
+ // explicitly calling setParent() after (odd children and ids).
+ //
+ // Even children:
+ // child constructed
+ // notifications to backend scheduled via the event loop as object is not yet fully constructed
+ //
+ // Odd children:
+ // child constructed
+ // parent set
+ // notifications to backend sent immediately as object is fully constructed
+ //
+ // With this in mind, the recorded events should show:
+ //
+ // for each odd child:
+ // odd child creation
+ // child addition to parent of odd child
+ //
+ // followed by:
+ //
+ // for each even child:
+ // even child construction
+ // child addition to parent of even child
+ //
+ const auto expectedEventCount = 2 * childCount;
+ QCOMPARE(spy.events.size(), 10 * 2);
+
+ for (auto i = 0; i < expectedEventCount; i += 2) {
+ const auto creationRecord = spy.events.at(i);
+ QVERIFY(creationRecord.wasLocked());
+ const auto childIndex = i < 10
+ ? (i / 2) * 2 + 1
+ : (i - 10) / 2 * 2;
+ Qt3DCore::QNode *child = node->childNodes().at(childIndex);
+
+ const Qt3DCore::QNodeCreatedChangeBasePtr event = creationRecord.change().dynamicCast<Qt3DCore::QNodeCreatedChangeBase>();
+ QVERIFY(event != nullptr);
+ QCOMPARE(event->subjectId(), child->id());
+ QCOMPARE(event->metaObject(), child->metaObject());
+ QCOMPARE(event->isNodeEnabled(), child->isEnabled());
+
+ const auto additionRecord = spy.events.at(i + 1);
+ Qt3DCore::QPropertyNodeAddedChangePtr additionEvent = additionRecord.change().dynamicCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(additionEvent->subjectId(), node->id());
+ QCOMPARE(additionEvent->addedNodeId(), child->id());
+ QCOMPARE(additionEvent->metaObject(), child->metaObject());
}
}
@@ -476,13 +520,13 @@ void tst_Nodes::checkParentChangeToNull()
ObserverSpy spy(root.data());
// WHEN
- root->assignScene();
+ root->assignScene(&spy);
QScopedPointer<Qt3DCore::QNode> child(new MyQNode(root.data()));
QCoreApplication::processEvents();
// THEN
QVERIFY(child->parent() == root.data());
- QCOMPARE(spy.events.size(), 1);
+ QCOMPARE(spy.events.size(), 2);
QCOMPARE(root->children().size(), 1);
// WHEN
@@ -490,35 +534,46 @@ void tst_Nodes::checkParentChangeToNull()
child->setParent(Q_NODE_NULLPTR);
// THEN
- QVERIFY(child->parent() == Q_NULLPTR);
+ QVERIFY(child->parent() == nullptr);
QCOMPARE(root->children().size(), 0);
- QCOMPARE(spy.events.size(), 1);
+ QCOMPARE(spy.events.size(), 2);
QVERIFY(spy.events.first().wasLocked());
- Qt3DCore::QScenePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeAboutToBeDeleted);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QVERIFY(!clone->parentNode());
+ const Qt3DCore::QPropertyNodeRemovedChangePtr removalEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QVERIFY(removalEvent);
+ QCOMPARE(removalEvent->subjectId(), root->id());
+ QCOMPARE(removalEvent->removedNodeId(), child->id());
+ QCOMPARE(removalEvent->metaObject(), child->metaObject());
+
+ QVERIFY(spy.events.first().wasLocked());
+ const Qt3DCore::QNodeDestroyedChangePtr destructionEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeDestroyedChange>();
+ QVERIFY(destructionEvent);
+ QCOMPARE(destructionEvent->type(), Qt3DCore::NodeDeleted);
+ QCOMPARE(destructionEvent->subjectId(), child->id());
+ QCOMPARE(destructionEvent->subtreeIdsAndTypes().size(), 1);
+ QCOMPARE(destructionEvent->subtreeIdsAndTypes().first().id, child->id());
+ QCOMPARE(destructionEvent->subtreeIdsAndTypes().first().type, child->metaObject());
}
void tst_Nodes::checkParentChangeToOtherParent()
{
// GIVEN
QScopedPointer<MyQNode> root(new MyQNode());
- root->assignScene();
ObserverSpy spy(root.data());
+ root->assignScene(&spy);
QScopedPointer<MyQNode> parent1(new MyQNode(root.data()));
QScopedPointer<MyQNode> parent2(new MyQNode(root.data()));
QCoreApplication::processEvents();
// THEN
- QCOMPARE(spy.events.size(), 2);
+ QCOMPARE(spy.events.size(), 4);
// WHEN
ObserverSpy spyParent1(parent1.data());
ObserverSpy spyParent2(parent2.data());
+ parent1->assignScene(&spyParent1);
+ parent2->assignScene(&spyParent2);
+
QScopedPointer<Qt3DCore::QNode> child(new MyQNode(parent1.data()));
QCoreApplication::processEvents();
@@ -526,8 +581,8 @@ void tst_Nodes::checkParentChangeToOtherParent()
QVERIFY(child->parent() == parent1.data());
QCOMPARE(parent1->children().size(), 1);
QCOMPARE(parent2->children().size(), 0);
- QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() != Q_NULLPTR);
- QCOMPARE(spyParent1.events.size(), 1);
+ QVERIFY(Qt3DCore::QNodePrivate::get(child.data())->scene() != nullptr);
+ QCOMPARE(spyParent1.events.size(), 2);
// WHEN
spyParent1.events.clear();
@@ -540,55 +595,63 @@ void tst_Nodes::checkParentChangeToOtherParent()
QCOMPARE(spyParent1.events.size(), 1);
QCOMPARE(spyParent2.events.size(), 1);
- // CHECK event 1 is a Node Deleted event
+ // CHECK event 1 is a Node Removed event
QVERIFY(spyParent1.events.first().wasLocked());
- Qt3DCore::QScenePropertyChangePtr event = spyParent1.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeAboutToBeDeleted);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QVERIFY(!clone->parentNode());
+ const Qt3DCore::QPropertyNodeRemovedChangePtr event = spyParent1.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(event->type(), Qt3DCore::PropertyValueRemoved);
+ QCOMPARE(event->subjectId(), parent1->id());
+ QCOMPARE(event->removedNodeId(), child->id());
+ QCOMPARE(event->metaObject(), child->metaObject());
// CHECK event 2 is a Node Added event
QVERIFY(spyParent2.events.last().wasLocked());
- event = spyParent2.events.last().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeCreated);
- QCOMPARE(event->propertyName(), "node");
- clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QVERIFY(clone->parentNode());
+ const Qt3DCore::QPropertyNodeAddedChangePtr event2 = spyParent2.events.last().change().dynamicCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(event2->type(), Qt3DCore::PropertyValueAdded);
+ QCOMPARE(event2->subjectId(), parent2->id());
+ QCOMPARE(event2->addedNodeId(), child->id());
+ QCOMPARE(event2->metaObject(), child->metaObject());
}
-
void tst_Nodes::removingSingleChildNodeFromNode()
{
// GIVEN
QScopedPointer<MyQNode> root(new MyQNode());
QScopedPointer<Qt3DCore::QNode> child(new MyQNode());
+ ObserverSpy spy(root.data());
// WHEN
+ root->assignScene(&spy);
child->setParent(root.data());
+ // Clear any creation event
+ spy.events.clear();
+
// THEN
QVERIFY(root->children().count() == 1);
QVERIFY(child->parentNode() == root.data());
// WHEN
- ObserverSpy spy(root.data());
child->setParent(Q_NODE_NULLPTR);
// THEN
- QVERIFY(child->parent() == Q_NULLPTR);
+ QVERIFY(child->parent() == nullptr);
QVERIFY(root->children().count() == 0);
- QCOMPARE(spy.events.size(), 1);
+ QCOMPARE(spy.events.size(), 2);
+
QVERIFY(spy.events.first().wasLocked());
- Qt3DCore::QScenePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeAboutToBeDeleted);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QVERIFY(!clone->parentNode());
+ const Qt3DCore::QPropertyNodeRemovedChangePtr removalEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(removalEvent->subjectId(), root->id());
+ QCOMPARE(removalEvent->removedNodeId(), child->id());
+ QCOMPARE(removalEvent->metaObject(), child->metaObject());
+
+ QVERIFY(spy.events.first().wasLocked());
+ const Qt3DCore::QNodeDestroyedChangePtr destructionEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeDestroyedChange>();
+ QCOMPARE(destructionEvent->type(), Qt3DCore::NodeDeleted);
+ QCOMPARE(destructionEvent->subjectId(), child->id());
+ QCOMPARE(destructionEvent->subtreeIdsAndTypes().size(), 1);
+ QCOMPARE(destructionEvent->subtreeIdsAndTypes().first().id, child->id());
+ QCOMPARE(destructionEvent->subtreeIdsAndTypes().first().type, child->metaObject());
}
void tst_Nodes::removingMultipleChildNodesFromNode()
@@ -597,21 +660,24 @@ void tst_Nodes::removingMultipleChildNodesFromNode()
QScopedPointer<MyQNode> root(new MyQNode());
// WHEN
- root->assignScene();
ObserverSpy spy(root.data());
+ root->assignScene(&spy);
// THEN
- QVERIFY(Qt3DCore::QNodePrivate::get(root.data())->scene() != Q_NULLPTR);
+ QVERIFY(Qt3DCore::QNodePrivate::get(root.data())->scene() != nullptr);
// WHEN
- for (int i = 0; i < 10; i++)
- (void) new MyQNode(root.data());
+ Qt3DCore::QNodeIdVector childIds(10);
+ for (int i = 0; i < 10; i++) {
+ auto child = new MyQNode(root.data());
+ childIds[i] = child->id();
+ }
QCoreApplication::processEvents();
// THEN
QCOMPARE(root->children().count(), 10);
- QCOMPARE(spy.events.size(), 10);
+ QCOMPARE(spy.events.size(), 20);
// WHEN
spy.events.clear();
@@ -620,14 +686,25 @@ void tst_Nodes::removingMultipleChildNodesFromNode()
// THEN
QVERIFY(root->children().count() == 0);
- QCOMPARE(spy.events.size(), 10);
+ QCOMPARE(spy.events.size(), 20);
+ int i = 0;
Q_FOREACH (const ObserverSpy::ChangeRecord &r, spy.events) {
QVERIFY(r.wasLocked());
- Qt3DCore::QScenePropertyChangePtr event = r.change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeAboutToBeDeleted);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QVERIFY(!clone->parentNode());
+ const Qt3DCore::QNodeId childId = childIds.at(i / 2);
+ if (i % 2 == 0) {
+ Qt3DCore::QPropertyNodeRemovedChangePtr additionEvent = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(additionEvent->subjectId(), root->id());
+ QCOMPARE(additionEvent->removedNodeId(), childId);
+ QCOMPARE(additionEvent->metaObject(), &MyQNode::staticMetaObject);
+ } else {
+ const Qt3DCore::QNodeDestroyedChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeDestroyedChange>();
+ QCOMPARE(event->subjectId(), childId);
+ QCOMPARE(event->subtreeIdsAndTypes().count(), 1);
+ QCOMPARE(event->subtreeIdsAndTypes().first().id, childId);
+ QCOMPARE(event->subtreeIdsAndTypes().first().type, &MyQNode::staticMetaObject);
+ QCOMPARE(event->type(), Qt3DCore::NodeDeleted);
+ }
+ ++i;
}
}
@@ -638,10 +715,11 @@ void tst_Nodes::appendingChildEntitiesToNode()
// WHEN
Qt3DCore::QEntity *childEntity = new Qt3DCore::QEntity(root.data());
+ QCoreApplication::processEvents();
// THEN
QVERIFY(root->children().first() == childEntity);
- QVERIFY(childEntity->parentEntity() == Q_NULLPTR);
+ QVERIFY(childEntity->parentEntity() == nullptr);
QVERIFY(childEntity->parentNode() == root.data());
}
@@ -652,10 +730,11 @@ void tst_Nodes::removingChildEntitiesFromNode()
// WHEN
Qt3DCore::QEntity *childEntity = new Qt3DCore::QEntity(root.data());
+ QCoreApplication::processEvents();
// THEN
QVERIFY(root->children().first() == childEntity);
- QVERIFY(childEntity->parentEntity() == Q_NULLPTR);
+ QVERIFY(childEntity->parentEntity() == nullptr);
QVERIFY(childEntity->parentNode() == root.data());
// WHEN
@@ -663,8 +742,8 @@ void tst_Nodes::removingChildEntitiesFromNode()
// THEN
QVERIFY(root->children().isEmpty());
- QVERIFY(childEntity->parentNode() == Q_NULLPTR);
- QVERIFY(childEntity->parent() == Q_NULLPTR);
+ QVERIFY(childEntity->parentNode() == nullptr);
+ QVERIFY(childEntity->parent() == nullptr);
}
void tst_Nodes::appendingParentlessComponentToEntity()
@@ -674,10 +753,10 @@ void tst_Nodes::appendingParentlessComponentToEntity()
MyQComponent *comp = new MyQComponent();
// THEN
- QVERIFY(entity->parentNode() == Q_NULLPTR);
+ QVERIFY(entity->parentNode() == nullptr);
QVERIFY(entity->children().count() == 0);
QVERIFY(entity->components().empty());
- QVERIFY(comp->parentNode() == Q_NULLPTR);
+ QVERIFY(comp->parentNode() == nullptr);
// WHEN
ObserverSpy spy(entity.data());
@@ -697,12 +776,12 @@ void tst_Nodes::appendingParentlessComponentToEntity()
// return early in such a case.
// Check that we received ComponentAdded
- Qt3DCore::QScenePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
+ const auto event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>();
QCOMPARE(event->type(), Qt3DCore::ComponentAdded);
- QCOMPARE(event->propertyName(), "component");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), comp->id());
- QVERIFY(!clone->parentNode());
+ QCOMPARE(event->subjectId(), entity->id());
+ QCOMPARE(event->entityId(), entity->id());
+ QCOMPARE(event->componentId(), comp->id());
+ QCOMPARE(event->componentMetaObject(), comp->metaObject());
}
void tst_Nodes::appendingComponentToEntity()
@@ -713,7 +792,7 @@ void tst_Nodes::appendingComponentToEntity()
QCoreApplication::processEvents();
// THEN
- QVERIFY(entity->parentNode() == Q_NULLPTR);
+ QVERIFY(entity->parentNode() == nullptr);
QVERIFY(entity->children().count() == 1);
QVERIFY(entity->components().empty());
QVERIFY(comp->parentNode() == entity.data());
@@ -728,12 +807,12 @@ void tst_Nodes::appendingComponentToEntity()
QVERIFY(comp->parentNode() == entity.data());
QCOMPARE(spy.events.size(), 1);
QVERIFY(spy.events.first().wasLocked());
- Qt3DCore::QScenePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
+ const auto event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentAddedChange>();
QCOMPARE(event->type(), Qt3DCore::ComponentAdded);
- QCOMPARE(event->propertyName(), "component");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), comp->id());
- QVERIFY(!clone->parentNode());
+ QCOMPARE(event->subjectId(), entity->id());
+ QCOMPARE(event->entityId(), entity->id());
+ QCOMPARE(event->componentId(), comp->id());
+ QCOMPARE(event->componentMetaObject(), comp->metaObject());
}
void tst_Nodes::removingComponentFromEntity()
@@ -760,11 +839,12 @@ void tst_Nodes::removingComponentFromEntity()
QVERIFY(entity->children().count() == 1);
QCOMPARE(spy.events.size(), 1);
QVERIFY(spy.events.first().wasLocked());
- Qt3DCore::QScenePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
+ const auto event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QComponentRemovedChange>();
QCOMPARE(event->type(), Qt3DCore::ComponentRemoved);
- QCOMPARE(event->propertyName(), "componentId");
- Qt3DCore::QNodeId nodeId = event->value().value<Qt3DCore::QNodeId>();
- QCOMPARE(nodeId, comp->id());
+ QCOMPARE(event->subjectId(), entity->id());
+ QCOMPARE(event->entityId(), entity->id());
+ QCOMPARE(event->componentId(), comp->id());
+ QCOMPARE(event->componentMetaObject(), comp->metaObject());
}
void tst_Nodes::changeCustomProperty()
@@ -777,8 +857,8 @@ void tst_Nodes::changeCustomProperty()
// THEN
QCOMPARE(spy.events.size(), 1);
QVERIFY(spy.events.first().wasLocked());
- Qt3DCore::QScenePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeUpdated);
+ Qt3DCore::QPropertyUpdatedChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(event->type(), Qt3DCore::PropertyUpdated);
QCOMPARE(event->propertyName(), "customProperty");
QCOMPARE(event->value().toString(), QString("foo"));
}
@@ -789,6 +869,8 @@ void tst_Nodes::checkDestruction()
QScopedPointer<MyQNode> root(new MyQNode());
Qt3DCore::QEntity *entity = new Qt3DCore::QEntity(root.data());
+ QCoreApplication::processEvents();
+
MyQComponent *comp1 = new MyQComponent();
MyQComponent *comp2 = new MyQComponent();
MyQComponent *comp3 = new MyQComponent();
@@ -807,32 +889,6 @@ void tst_Nodes::checkDestruction()
QVERIFY(root->children().isEmpty());
}
-void tst_Nodes::verifyCopy()
-{
- // GIVEN
- QScopedPointer<MyQNode> root(new MyQNode());
- MyQNode *other1 = new MyQNode();
- MyQNode *other2 = new MyQNode();
-
- // THEN
- QVERIFY(root->id() != other1->id());
- QVERIFY(root->id() != other2->id());
- QVERIFY(other1->id() != other2->id());
-
- // WHEN
- other1->makeCopyOf(root.data());
-
- // THEN
- QVERIFY(root->id() == other1->id());
- QVERIFY(root->id() != other2->id());
-
- // WHEN
- other2->makeCopyOf(other1);
-
- // THEN
- QVERIFY(root->id() == other1->id() && root->id() == other2->id());
-}
-
QTEST_MAIN(tst_Nodes)
#include "tst_nodes.moc"
diff --git a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
index 299c08f70..ba76d2100 100644
--- a/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
+++ b/tests/auto/core/qaspectengine/tst_qaspectengine.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -42,6 +34,44 @@
using namespace Qt3DCore;
+class PrintRootAspect : public QAbstractAspect
+{
+ Q_OBJECT
+public:
+ explicit PrintRootAspect(QObject *parent = 0)
+ : QAbstractAspect(parent)
+ , m_rootEntityId()
+ {
+ qDebug() << Q_FUNC_INFO;
+ }
+
+private:
+ void onRegistered() Q_DECL_OVERRIDE
+ {
+ qDebug() << Q_FUNC_INFO;
+ }
+
+ void onEngineStartup() Q_DECL_OVERRIDE
+ {
+ qDebug() << Q_FUNC_INFO;
+ m_rootEntityId = rootEntityId();
+ }
+
+ void onEngineShutdown() Q_DECL_OVERRIDE
+ {
+ qDebug() << Q_FUNC_INFO;
+ }
+
+ QVector<QAspectJobPtr> jobsToExecute(qint64) Q_DECL_OVERRIDE \
+ {
+ if (m_rootEntityId)
+ qDebug() << Q_FUNC_INFO << m_rootEntityId;
+ return QVector<QAspectJobPtr>();
+ }
+
+ QNodeId m_rootEntityId;
+};
+
#define FAKE_ASPECT(ClassName) \
class ClassName : public QAbstractAspect \
{ \
@@ -49,14 +79,12 @@ class ClassName : public QAbstractAspect \
public: \
explicit ClassName(QObject *parent = 0) \
: QAbstractAspect(parent) {} \
-\
+ \
private: \
- void onRootEntityChanged(QEntity *) Q_DECL_OVERRIDE {} \
- void onInitialize(const QVariantMap &) Q_DECL_OVERRIDE {} \
- void onStartup() Q_DECL_OVERRIDE {} \
- void onShutdown() Q_DECL_OVERRIDE {} \
- void onCleanup() Q_DECL_OVERRIDE {} \
-\
+ void onRegistered() Q_DECL_OVERRIDE {} \
+ void onEngineStartup() Q_DECL_OVERRIDE {} \
+ void onEngineShutdown() Q_DECL_OVERRIDE {} \
+ \
QVector<QAspectJobPtr> jobsToExecute(qint64) Q_DECL_OVERRIDE \
{ \
return QVector<QAspectJobPtr>(); \
@@ -71,7 +99,7 @@ private: \
} \
\
return QVariant(); \
- }\
+ } \
};
FAKE_ASPECT(FakeAspect)
@@ -95,7 +123,7 @@ private Q_SLOTS:
void constructionDestruction()
{
QAspectEngine *engine = new QAspectEngine;
- QVERIFY(engine->rootEntity() == Q_NULLPTR);
+ QVERIFY(engine->rootEntity() == nullptr);
delete engine;
}
@@ -105,7 +133,7 @@ private Q_SLOTS:
QEntity *e = new QEntity;
e->setObjectName("root");
- engine->setRootEntity(e);
+ engine->setRootEntity(QEntityPtr(e));
QSharedPointer<QEntity> root = engine->rootEntity();
QVERIFY(root == e);
@@ -116,6 +144,55 @@ private Q_SLOTS:
delete engine;
}
+ void shouldNotCrashInNormalStartupShutdownSequence()
+ {
+ // GIVEN
+ // An initialized aspect engine...
+ QAspectEngine engine;
+ // ...and a simple aspect
+ PrintRootAspect *aspect = new PrintRootAspect;
+
+ // WHEN
+ // We register the aspect
+ engine.registerAspect(aspect);
+
+ // THEN
+ const auto registeredAspects = engine.aspects();
+ QCOMPARE(registeredAspects.size(), 1);
+ QCOMPARE(registeredAspects.first(), aspect);
+
+ // WHEN
+ QEntityPtr entity(new QEntity);
+ entity->setObjectName("RootEntity");
+ // we set a scene root entity
+ engine.setRootEntity(entity);
+
+ QEventLoop eventLoop;
+ QTimer::singleShot(100, &eventLoop, SLOT(quit()));
+ eventLoop.exec();
+
+ // THEN
+ // we don't crash and...
+ const auto rootEntity = engine.rootEntity();
+ QCOMPARE(rootEntity, entity);
+
+ // WHEN
+ // we set an empty/null scene root...
+ engine.setRootEntity(QEntityPtr());
+ QTimer::singleShot(1000, &eventLoop, SLOT(quit()));
+
+ // ...and allow events to process...
+ eventLoop.exec();
+
+ // THEN
+ // ... we don't crash.
+
+ // TODO: Add more tests to check for
+ // * re-setting a scene
+ // * deregistering aspects
+ // * destroying the aspect engine
+ }
+
void shouldNotCrashOnShutdownWhenComponentIsCreatedWithParentBeforeItsEntity()
{
// GIVEN
@@ -130,11 +207,11 @@ private Q_SLOTS:
QAspectEngine engine;
// WHEN
- engine.setRootEntity(root);
+ engine.setRootEntity(QEntityPtr(root));
// THEN
// Nothing particular happen on exit, especially no crash
- };
+ }
void shouldRegisterAspectsByName()
{
diff --git a/tests/auto/core/qaspectfactory/tst_qaspectfactory.cpp b/tests/auto/core/qaspectfactory/tst_qaspectfactory.cpp
index c287bf0e8..d79123ef2 100644
--- a/tests/auto/core/qaspectfactory/tst_qaspectfactory.cpp
+++ b/tests/auto/core/qaspectfactory/tst_qaspectfactory.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -49,11 +41,9 @@ public: \
: QAbstractAspect(parent) {} \
\
private: \
- void onRootEntityChanged(QEntity *) Q_DECL_OVERRIDE {} \
- void onInitialize(const QVariantMap &) Q_DECL_OVERRIDE {} \
- void onStartup() Q_DECL_OVERRIDE {} \
- void onShutdown() Q_DECL_OVERRIDE {} \
- void onCleanup() Q_DECL_OVERRIDE {} \
+ void onRegistered() Q_DECL_OVERRIDE {} \
+ void onEngineStartup() Q_DECL_OVERRIDE {} \
+ void onEngineShutdown() Q_DECL_OVERRIDE {} \
\
QVector<QAspectJobPtr> jobsToExecute(qint64) Q_DECL_OVERRIDE \
{ \
@@ -83,8 +73,8 @@ private Q_SLOTS:
QAbstractAspect *aspect = factory.createAspect(QStringLiteral("default"));
// THEN
- QVERIFY(qobject_cast<DefaultFakeAspect*>(aspect) != Q_NULLPTR);
- QVERIFY(aspect->parent() == Q_NULLPTR);
+ QVERIFY(qobject_cast<DefaultFakeAspect*>(aspect) != nullptr);
+ QVERIFY(aspect->parent() == nullptr);
}
void shouldKnowAspectNames()
@@ -110,7 +100,7 @@ private Q_SLOTS:
QAbstractAspect *aspect = factory.createAspect(QStringLiteral("missing"), this);
// THEN
- QVERIFY(qobject_cast<AnotherFakeAspect*>(aspect) == Q_NULLPTR);
+ QVERIFY(qobject_cast<AnotherFakeAspect*>(aspect) == nullptr);
}
};
diff --git a/tests/auto/core/qaspectjob/tst_qaspectjob.cpp b/tests/auto/core/qaspectjob/tst_qaspectjob.cpp
index 6864cf0f8..b9f7934ab 100644
--- a/tests/auto/core/qaspectjob/tst_qaspectjob.cpp
+++ b/tests/auto/core/qaspectjob/tst_qaspectjob.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/core/qboundedcircularbuffer/tst_qboundedcircularbuffer.cpp b/tests/auto/core/qboundedcircularbuffer/tst_qboundedcircularbuffer.cpp
index ce4489f4b..d2ef6d97d 100644
--- a/tests/auto/core/qboundedcircularbuffer/tst_qboundedcircularbuffer.cpp
+++ b/tests/auto/core/qboundedcircularbuffer/tst_qboundedcircularbuffer.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp b/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
index 551290c69..42566123d 100644
--- a/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
+++ b/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -39,11 +31,17 @@
#include <Qt3DCore/private/qobservableinterface_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
#include <Qt3DCore/private/qpostman_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
#include <Qt3DCore/qscenechange.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
+#include <Qt3DCore/qcomponentaddedchange.h>
+#include <Qt3DCore/qcomponentremovedchange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/qscenechange.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qnode.h>
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qcomponent.h>
#include <Qt3DCore/qbackendnode.h>
#include <Qt3DCore/private/qsceneobserverinterface_p.h>
#include <Qt3DCore/private/qnode_p.h>
@@ -64,51 +62,57 @@ private slots:
void distributeBackendChanges();
};
-class tst_Node : public Qt3DCore::QNode
+class AllChangesChange : public Qt3DCore::QSceneChange
+{
+public:
+ AllChangesChange(Qt3DCore::QNodeId subjectId)
+ : Qt3DCore::QSceneChange(Qt3DCore::AllChanges, subjectId)
+ {
+ }
+};
+
+class tst_Node : public Qt3DCore::QEntity
{
public:
- explicit tst_Node(Qt3DCore::QNode *parent = 0) : Qt3DCore::QNode(parent)
+ explicit tst_Node(Qt3DCore::QNode *parent = 0) : Qt3DCore::QEntity(parent)
{}
- void sendNodeAddedNotification()
+ void sendNodeAddedNotification(QNode *node)
{
- Qt3DCore::QScenePropertyChangePtr e(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, id()));
- e->setPropertyName("NodeAdded");
+ Qt3DCore::QPropertyNodeAddedChangePtr e(new Qt3DCore::QPropertyNodeAddedChange(id(), node));
+ e->setPropertyName("PropertyValueAdded");
Qt3DCore::QNodePrivate::get(this)->notifyObservers(e);
}
- void sendNodeRemovedNotification()
+ void sendNodeRemovedNotification(QNode *node)
{
- Qt3DCore::QScenePropertyChangePtr e(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, id()));
- e->setPropertyName("NodeRemoved");
+ Qt3DCore::QPropertyNodeRemovedChangePtr e(new Qt3DCore::QPropertyNodeRemovedChange(id(), node));
+ e->setPropertyName("PropertyValueRemoved");
Qt3DCore::QNodePrivate::get(this)->notifyObservers(e);
}
void sendNodeUpdatedNotification()
{
- Qt3DCore::QScenePropertyChangePtr e(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, id()));
- e->setPropertyName("NodeUpdated");
+ Qt3DCore::QPropertyUpdatedChangePtr e(new Qt3DCore::QPropertyUpdatedChange(id()));
+ e->setPropertyName("PropertyUpdated");
Qt3DCore::QNodePrivate::get(this)->notifyObservers(e);
}
- void sendComponentAddedNotification()
+ void sendComponentAddedNotification(Qt3DCore::QComponent *component)
{
- Qt3DCore::QScenePropertyChangePtr e(new Qt3DCore::QScenePropertyChange(Qt3DCore::ComponentAdded, Qt3DCore::QSceneChange::Node, id()));
- e->setPropertyName("ComponentAdded");
+ Qt3DCore::QComponentAddedChangePtr e(new Qt3DCore::QComponentAddedChange(this, component));
Qt3DCore::QNodePrivate::get(this)->notifyObservers(e);
}
- void sendComponentRemovedNotification()
+ void sendComponentRemovedNotification(Qt3DCore::QComponent *component)
{
- Qt3DCore::QScenePropertyChangePtr e(new Qt3DCore::QScenePropertyChange(Qt3DCore::ComponentRemoved, Qt3DCore::QSceneChange::Node, id()));
- e->setPropertyName("ComponentRemoved");
+ Qt3DCore::QComponentRemovedChangePtr e(new Qt3DCore::QComponentRemovedChange(this, component));
Qt3DCore::QNodePrivate::get(this)->notifyObservers(e);
}
void sendAllChangesNotification()
{
- Qt3DCore::QScenePropertyChangePtr e(new Qt3DCore::QScenePropertyChange(Qt3DCore::AllChanges, Qt3DCore::QSceneChange::Node, id()));
- e->setPropertyName("AllChanges");
+ Qt3DCore::QSceneChangePtr e(new AllChangesChange(id()));
Qt3DCore::QNodePrivate::get(this)->notifyObservers(e);
}
@@ -130,15 +134,6 @@ public:
return m_lastChanges;
}
- // QNode interface
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- tst_Node *clone = new tst_Node();
- clone->copy(this);
- return clone;
- }
-
private:
QList<Qt3DCore::QSceneChangePtr> m_lastChanges;
};
@@ -178,17 +173,14 @@ public:
: Qt3DCore::QBackendNode(ReadWrite)
{}
- void updateFromPeer(Qt3DCore::QNode *) Q_DECL_OVERRIDE
- {}
-
// QObserverInterface interface
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE
{
QVERIFY(!e.isNull());
m_lastChanges << e;
// Save reply to be sent to the frontend
- m_reply.reset(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, e->subjectId()));
- m_reply->setTargetNode(e->subjectId());
+ m_reply.reset(new Qt3DCore::QPropertyUpdatedChange(e->subjectId()));
+ m_reply->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
m_reply->setPropertyName("Reply");
}
@@ -214,7 +206,7 @@ public:
private:
QList<Qt3DCore::QSceneChangePtr> m_lastChanges;
- Qt3DCore::QBackendScenePropertyChangePtr m_reply;
+ Qt3DCore::QPropertyUpdatedChangePtr m_reply;
};
@@ -252,7 +244,7 @@ class tst_PostManObserver : public Qt3DCore::QAbstractPostman
{
public:
- tst_PostManObserver() : m_sceneInterface(Q_NULLPTR)
+ tst_PostManObserver() : m_sceneInterface(nullptr)
{}
void setScene(Qt3DCore::QScene *scene) Q_DECL_FINAL
@@ -264,10 +256,10 @@ public:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
QVERIFY(!e.isNull());
- Qt3DCore::QBackendScenePropertyChangePtr change = qSharedPointerDynamicCast<Qt3DCore::QBackendScenePropertyChange>(e);
+ Qt3DCore::QPropertyUpdatedChangePtr change = qSharedPointerDynamicCast<Qt3DCore::QPropertyUpdatedChange>(e);
QVERIFY(!change.isNull());
- Qt3DCore::QNode *targetNode = m_sceneInterface->lookupNode(change->targetNode());
- QVERIFY(targetNode != Q_NULLPTR);
+ Qt3DCore::QNode *targetNode = m_sceneInterface->lookupNode(change->subjectId());
+ QVERIFY(targetNode != nullptr);
m_lastChanges << e;
}
@@ -307,7 +299,7 @@ public:
void sceneNodeRemoved(Qt3DCore::QSceneChangePtr &e)
{
QVERIFY(!e.isNull());
- QVERIFY((e->type() == Qt3DCore::NodeDeleted || e->type() == Qt3DCore::NodeAboutToBeDeleted));
+ QVERIFY((e->type() == Qt3DCore::NodeDeleted));
m_lastChange = e;
}
@@ -360,8 +352,8 @@ void tst_QChangeArbiter::registerObservers()
child->setParent(root);
arbiter->syncChanges();
Q_FOREACH (tst_SimpleObserver *o, observers) {
- QVERIFY(!o->lastChange().isNull());
- QVERIFY(o->lastChange()->type() == Qt3DCore::NodeCreated);
+ QCOMPARE(o->lastChanges().size(), 1);
+ QVERIFY(o->lastChanges().last()->type() == Qt3DCore::PropertyValueAdded);
}
Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data());
@@ -370,6 +362,7 @@ void tst_QChangeArbiter::registerObservers()
void tst_QChangeArbiter::registerSceneObserver()
{
// GIVEN
+ Qt3DCore::QComponent dummyComponent;
QScopedPointer<Qt3DCore::QChangeArbiter> arbiter(new Qt3DCore::QChangeArbiter());
QScopedPointer<Qt3DCore::QScene> scene(new Qt3DCore::QScene());
QScopedPointer<Qt3DCore::QAbstractPostman> postman(new tst_PostManObserver);
@@ -415,7 +408,7 @@ void tst_QChangeArbiter::registerSceneObserver()
// THEN
Q_FOREACH (tst_SimpleObserver *o, observers) {
QVERIFY(!o->lastChange().isNull());
- QVERIFY(o->lastChange()->type() == Qt3DCore::NodeCreated);
+ QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded);
}
Q_FOREACH (tst_SceneObserver *s, sceneObservers) {
QVERIFY(!s->lastChange().isNull());
@@ -423,7 +416,7 @@ void tst_QChangeArbiter::registerSceneObserver()
}
// WHEN
- root->sendComponentAddedNotification();
+ root->sendComponentAddedNotification(&dummyComponent);
arbiter->syncChanges();
// THEN
@@ -478,7 +471,7 @@ void tst_QChangeArbiter::unregisterObservers()
// THEN
Q_FOREACH (tst_SimpleObserver *o, observers) {
QVERIFY(!o->lastChange().isNull());
- QVERIFY(o->lastChange()->type() == Qt3DCore::NodeCreated);
+ QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded);
}
// WHEN
@@ -491,7 +484,7 @@ void tst_QChangeArbiter::unregisterObservers()
// THEN
Q_FOREACH (tst_SimpleObserver *o, observers) {
QVERIFY(!o->lastChange().isNull());
- QVERIFY(o->lastChange()->type() == Qt3DCore::NodeCreated);
+ QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded);
}
Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data());
@@ -500,6 +493,7 @@ void tst_QChangeArbiter::unregisterObservers()
void tst_QChangeArbiter::unregisterSceneObservers()
{
// GIVEN
+ Qt3DCore::QComponent dummyComponent;
QScopedPointer<Qt3DCore::QChangeArbiter> arbiter(new Qt3DCore::QChangeArbiter());
QScopedPointer<Qt3DCore::QScene> scene(new Qt3DCore::QScene());
QScopedPointer<Qt3DCore::QAbstractPostman> postman(new tst_PostManObserver);
@@ -545,7 +539,7 @@ void tst_QChangeArbiter::unregisterSceneObservers()
// THEN
Q_FOREACH (tst_SimpleObserver *o, observers) {
QVERIFY(!o->lastChange().isNull());
- QVERIFY(o->lastChange()->type() == Qt3DCore::NodeCreated);
+ QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded);
}
Q_FOREACH (tst_SceneObserver *s, sceneObservers) {
QVERIFY(!s->lastChange().isNull());
@@ -553,7 +547,7 @@ void tst_QChangeArbiter::unregisterSceneObservers()
}
// WHEN
- root->sendComponentAddedNotification();
+ root->sendComponentAddedNotification(&dummyComponent);
arbiter->syncChanges();
// THEN
@@ -573,11 +567,11 @@ void tst_QChangeArbiter::unregisterSceneObservers()
// THEN
Q_FOREACH (tst_SimpleObserver *o, observers) {
QVERIFY(!o->lastChange().isNull());
- QVERIFY(o->lastChange()->type() == Qt3DCore::NodeAboutToBeDeleted);
+ QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueRemoved);
}
Q_FOREACH (tst_SceneObserver *s, sceneObservers) {
QVERIFY(!s->lastChange().isNull());
- QVERIFY(s->lastChange()->type() == Qt3DCore::NodeAboutToBeDeleted);
+ QVERIFY(s->lastChange()->type() == Qt3DCore::NodeDeleted);
}
Q_FOREACH (tst_SceneObserver *s, sceneObservers)
@@ -590,11 +584,11 @@ void tst_QChangeArbiter::unregisterSceneObservers()
// THEN
Q_FOREACH (tst_SimpleObserver *o, observers) {
QVERIFY(!o->lastChange().isNull());
- QVERIFY(o->lastChange()->type() == Qt3DCore::NodeCreated);
+ QVERIFY(o->lastChange()->type() == Qt3DCore::PropertyValueAdded);
}
Q_FOREACH (tst_SceneObserver *s, sceneObservers) {
QVERIFY(!s->lastChange().isNull());
- QVERIFY(s->lastChange()->type() == Qt3DCore::NodeAboutToBeDeleted);
+ QVERIFY(s->lastChange()->type() == Qt3DCore::NodeDeleted);
}
Qt3DCore::QChangeArbiter::destroyThreadLocalChangeQueue(arbiter.data());
@@ -603,6 +597,8 @@ void tst_QChangeArbiter::unregisterSceneObservers()
void tst_QChangeArbiter::distributeFrontendChanges()
{
// GIVEN
+ Qt3DCore::QComponent dummyComponent;
+ Qt3DCore::QNode dummyNode;
QScopedPointer<Qt3DCore::QChangeArbiter> arbiter(new Qt3DCore::QChangeArbiter());
QScopedPointer<Qt3DCore::QScene> scene(new Qt3DCore::QScene());
QScopedPointer<Qt3DCore::QAbstractPostman> postman(new tst_PostManObserver);
@@ -626,9 +622,9 @@ void tst_QChangeArbiter::distributeFrontendChanges()
tst_SimpleObserver *backendComponentRemovedObserver = new tst_SimpleObserver();
arbiter->registerObserver(backendAllChangedObserver, root->id());
- arbiter->registerObserver(backendNodeAddedObserver, root->id(), Qt3DCore::NodeAdded);
- arbiter->registerObserver(backendNodeUpdatedObserver, root->id(), Qt3DCore::NodeUpdated);
- arbiter->registerObserver(backendNodeRemovedObserver, root->id(), Qt3DCore::NodeRemoved);
+ arbiter->registerObserver(backendNodeAddedObserver, root->id(), Qt3DCore::PropertyValueAdded);
+ arbiter->registerObserver(backendNodeUpdatedObserver, root->id(), Qt3DCore::PropertyUpdated);
+ arbiter->registerObserver(backendNodeRemovedObserver, root->id(), Qt3DCore::PropertyValueRemoved);
arbiter->registerObserver(backendComponentAddedObserver, root->id(), Qt3DCore::ComponentAdded);
arbiter->registerObserver(backendComponentRemovedObserver, root->id(), Qt3DCore::ComponentRemoved);
@@ -643,7 +639,7 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QVERIFY(backendComponentRemovedObserver->lastChange().isNull());
// WHEN
- root->sendNodeAddedNotification();
+ root->sendNodeAddedNotification(&dummyNode);
arbiter->syncChanges();
// THEN
@@ -667,7 +663,7 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0);
// WHEN
- root->sendNodeRemovedNotification();
+ root->sendNodeRemovedNotification(&dummyNode);
arbiter->syncChanges();
// THEN
@@ -679,7 +675,7 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0);
// WHEN
- root->sendComponentAddedNotification();
+ root->sendComponentAddedNotification(&dummyComponent);
arbiter->syncChanges();
// THEN
@@ -691,7 +687,7 @@ void tst_QChangeArbiter::distributeFrontendChanges()
QCOMPARE(backendComponentRemovedObserver->lastChanges().count(), 0);
// WHEN
- root->sendComponentRemovedNotification();
+ root->sendComponentRemovedNotification(&dummyComponent);
arbiter->syncChanges();
// THEN
@@ -786,12 +782,12 @@ void tst_QChangeArbiter::distributeBackendChanges()
QCOMPARE(postman->lastChanges().count(), 1);
// verify correctness of the reply
- Qt3DCore::QBackendScenePropertyChangePtr c = qSharedPointerDynamicCast<Qt3DCore::QBackendScenePropertyChange>(postman->lastChange());
+ Qt3DCore::QPropertyUpdatedChangePtr c = qSharedPointerDynamicCast<Qt3DCore::QPropertyUpdatedChange>(postman->lastChange());
QVERIFY(!c.isNull());
- QVERIFY(c->targetNode() == root->id());
+ QVERIFY(c->subjectId() == root->id());
qDebug() << c->propertyName();
QVERIFY(strcmp(c->propertyName(), "Reply") == 0);
- QVERIFY(c->type() == Qt3DCore::NodeUpdated);
+ QVERIFY(c->type() == Qt3DCore::PropertyUpdated);
answer->exit();
answer->wait();
diff --git a/tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp b/tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp
index cc923d052..4bc04fafa 100644
--- a/tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp
+++ b/tests/auto/core/qcircularbuffer/tst_qcircularbuffer.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/core/qentity/tst_qentity.cpp b/tests/auto/core/qentity/tst_qentity.cpp
index ef03af176..ae8323858 100644
--- a/tests/auto/core/qentity/tst_qentity.cpp
+++ b/tests/auto/core/qentity/tst_qentity.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,6 +29,7 @@
#include <QtTest/QtTest>
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/private/qentity_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DCore/qcomponent.h>
#include <QtCore/qscopedpointer.h>
@@ -46,7 +39,10 @@ class tst_Entity : public QObject
{
Q_OBJECT
public:
- tst_Entity() : QObject() {}
+ tst_Entity() : QObject()
+ {
+ qRegisterMetaType<Qt3DCore::QNode*>();
+ }
~tst_Entity() {}
private slots:
@@ -64,7 +60,9 @@ private slots:
void addSeveralTimesSameComponent();
void removeSeveralTimesSameComponent();
- void verifyCopy();
+
+ void checkCloning_data();
+ void checkCloning();
};
class MyQComponent : public Qt3DCore::QComponent
@@ -74,14 +72,6 @@ public:
explicit MyQComponent(Qt3DCore::QNode *parent = 0)
: QComponent(parent)
{}
-
- ~MyQComponent()
- {
- QNode::cleanup();
- }
-
-protected:
- QT3D_CLONEABLE(MyQComponent)
};
@@ -91,28 +81,23 @@ public:
explicit MyEntity(Qt3DCore::QNode *parent = 0)
: QEntity(parent)
{}
-
- void makeCopyOf(Qt3DCore::QEntity *other)
- {
- QEntity::copy(other);
- }
};
void tst_Entity::constructionDestruction()
{
// GIVEN
- QEntity *entity = Q_NULLPTR;
+ QEntity *entity = nullptr;
// WHEN
entity = new QEntity;
// THEN
- QVERIFY(entity != Q_NULLPTR);
+ QVERIFY(entity != nullptr);
delete entity;
// GIVEN
QScopedPointer<QEntity> entity2(new QEntity);
// WHEN
- entity2.reset(Q_NULLPTR);
+ entity2.reset(nullptr);
// THEN
// this should not crash
}
@@ -566,45 +551,58 @@ void tst_Entity::removeSeveralTimesSameComponent()
QCOMPARE(comp->entities().size(), 0);
}
-Qt3DCore::QNodeId parentEntityId(Qt3DCore::QEntity *entity)
+void tst_Entity::checkCloning_data()
{
- Qt3DCore::QEntityPrivate *d = static_cast<Qt3DCore::QEntityPrivate*>(Qt3DCore::QNodePrivate::get(entity));
- return d->parentEntityId();
+ QTest::addColumn<Qt3DCore::QEntity *>("entity");
+
+ QTest::newRow("defaultConstructed") << new MyEntity();
+
+ Qt3DCore::QEntity *entityWithComponents = new MyEntity();
+ Qt3DCore::QComponent *component1 = new MyQComponent();
+ Qt3DCore::QComponent *component2 = new MyQComponent();
+ Qt3DCore::QComponent *component3 = new MyQComponent();
+ entityWithComponents->addComponent(component1);
+ entityWithComponents->addComponent(component2);
+ entityWithComponents->addComponent(component3);
+ QTest::newRow("entityWithComponents") << entityWithComponents;
}
-void tst_Entity::verifyCopy()
+void tst_Entity::checkCloning()
{
// GIVEN
- QScopedPointer<Qt3DCore::QEntity> root(new Qt3DCore::QEntity());
- MyEntity *parentLessEntity = new MyEntity();
- MyEntity *parentedEntity = new MyEntity(root.data());
-
- QCoreApplication::processEvents();
-
- // THEN
- QVERIFY(root->id() != parentLessEntity->id());
- QVERIFY(root->id() != parentedEntity->id());
- QVERIFY(parentEntityId(root.data()).isNull());
- QVERIFY(!parentEntityId(parentedEntity).isNull());
- QVERIFY(parentEntityId(parentLessEntity).isNull());
+ QFETCH(Qt3DCore::QEntity *, entity);
// WHEN
- MyEntity *parentedEntityCopy = new MyEntity();
- parentedEntityCopy->makeCopyOf(parentedEntity);
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(entity);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(parentedEntityCopy->id() == parentedEntity->id());
- QVERIFY(parentEntityId(parentedEntityCopy) == parentEntityId(parentedEntity));
+ QCOMPARE(creationChanges.size(), 1 + entity->components().size());
- // WHEN
- MyEntity *parentLessEntityCopy = new MyEntity();
- parentLessEntityCopy->makeCopyOf(parentLessEntity);
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DCore::QEntityData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DCore::QEntityData>>(creationChanges.first());
+ const Qt3DCore::QEntityData &cloneData = creationChangeData->data;
// THEN
- QVERIFY(parentLessEntityCopy->id() == parentLessEntity->id());
- QVERIFY(parentEntityId(parentLessEntityCopy) == parentEntityId(parentLessEntity));
+ QCOMPARE(creationChangeData->subjectId(), entity->id());
+ QCOMPARE(creationChangeData->isNodeEnabled(), entity->isEnabled());
+ QCOMPARE(creationChangeData->metaObject(), entity->metaObject());
+ QCOMPARE(creationChangeData->parentId(), entity->parentNode() ? entity->parentNode()->id() : Qt3DCore::QNodeId());
+ QCOMPARE(cloneData.parentEntityId, entity->parentEntity() ? entity->parentEntity()->id() : Qt3DCore::QNodeId());
+ QCOMPARE(cloneData.componentIdsAndTypes.size(), entity->components().size());
+
+ const QVector<Qt3DCore::QComponent *> &components = entity->components();
+ for (int i = 0, m = components.size(); i < m; ++i) {
+ QCOMPARE(cloneData.componentIdsAndTypes.at(i).id, components.at(i)->id());
+ QCOMPARE(cloneData.componentIdsAndTypes.at(i).type, components.at(i)->metaObject());
+ }
}
+Qt3DCore::QNodeId parentEntityId(Qt3DCore::QEntity *entity)
+{
+ Qt3DCore::QEntityPrivate *d = static_cast<Qt3DCore::QEntityPrivate*>(Qt3DCore::QNodePrivate::get(entity));
+ return d->parentEntityId();
+}
QTEST_MAIN(tst_Entity)
diff --git a/tests/auto/core/qframeallocator/tst_qframeallocator.cpp b/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
index 8525b3e78..76d4d15ce 100644
--- a/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
+++ b/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -117,7 +109,7 @@ void tst_QFrameAllocator::initQFrameChunk()
QVERIFY(c.m_blocksAvailable == c.m_maxBlocksAvailable);
QCOMPARE(c.m_blocksAvailable, (uchar)12);
QCOMPARE(c.m_firstAvailableBlock, (uchar)0);
- QVERIFY(c.m_data != Q_NULLPTR);
+ QVERIFY(c.m_data != nullptr);
QVERIFY(c.isEmpty());
for (int i = 0; i < 12; i++) {
@@ -136,7 +128,7 @@ void tst_QFrameAllocator::singleAllocationQFrameChunk()
QVERIFY(c.contains(ptr, 16));
QVERIFY(!c.isEmpty());
QCOMPARE(c.m_blocksAvailable, (uchar)(c.m_maxBlocksAvailable - 1));
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
QCOMPARE(c.m_firstAvailableBlock, (uchar)1);
QCOMPARE(*((uchar*)ptr), (uchar)1);
}
@@ -147,11 +139,11 @@ void tst_QFrameAllocator::qvectorAllocationQFrameChunk()
c.init(16, 12);
- QVector<int> *v = Q_NULLPTR;
+ QVector<int> *v = nullptr;
QVERIFY(sizeof(v) < 16);
v = static_cast<QVector<int> *>(c.allocate(16));
- QVERIFY(v != Q_NULLPTR);
+ QVERIFY(v != nullptr);
new (v) QVector<int>();
for (int i = 0; i < 1024; i++)
v->append(i);
@@ -173,7 +165,7 @@ void tst_QFrameAllocator::multipleAllocationQFrameChunk()
QCOMPARE(c.m_firstAvailableBlock, (uchar)6);
QVERIFY(!c.isEmpty());
for (int i = 0; i < 6; i++) {
- QVERIFY(ptrs.at(i) != Q_NULLPTR);
+ QVERIFY(ptrs.at(i) != nullptr);
QCOMPARE(*((uchar*)ptrs.at(i)), (uchar)(i + 1));
}
}
@@ -195,11 +187,11 @@ void tst_QFrameAllocator::overflowAllocationQFrameChunk()
QVERIFY(!c.isEmpty());
for (int i = 0; i < 15; i++) {
if (i < 12) {
- QVERIFY(ptrs.at(i) != Q_NULLPTR);
+ QVERIFY(ptrs.at(i) != nullptr);
QCOMPARE(*((uchar*)ptrs.at(i)), (uchar)(i + 1));
}
else {
- QVERIFY(ptrs.at(i) == Q_NULLPTR);
+ QVERIFY(ptrs.at(i) == nullptr);
}
}
}
@@ -217,7 +209,7 @@ void tst_QFrameAllocator::singleDeallocationQFrameChunk()
QVERIFY(c.m_blocksAvailable == c.m_maxBlocksAvailable);
QCOMPARE(c.m_blocksAvailable, (uchar)12);
QCOMPARE(c.m_firstAvailableBlock, (uchar)0);
- QVERIFY(c.m_data != Q_NULLPTR);
+ QVERIFY(c.m_data != nullptr);
QVERIFY(c.isEmpty());
for (int i = 0; i < 12; i++) {
@@ -245,7 +237,7 @@ void tst_QFrameAllocator::multipleDeallocationQFrameChunk()
QVERIFY(c.m_blocksAvailable == c.m_maxBlocksAvailable);
QCOMPARE(c.m_blocksAvailable, (uchar)12);
- QVERIFY(c.m_data != Q_NULLPTR);
+ QVERIFY(c.m_data != nullptr);
QVERIFY(c.isEmpty());
// Refill all
@@ -253,7 +245,7 @@ void tst_QFrameAllocator::multipleDeallocationQFrameChunk()
for (int i = 0; i < 12; i++) {
void *ptr = c.allocate(16);
ptrs << ptr;
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
}
QVERIFY(!c.isEmpty());
@@ -269,7 +261,7 @@ void tst_QFrameAllocator::multipleDeallocationQFrameChunk()
for (int i = 0; i < 12; i++) {
void *ptr = c.allocate(16);
ptrs << ptr;
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
}
// Free all in non linear behavior
@@ -284,7 +276,7 @@ void tst_QFrameAllocator::multipleDeallocationQFrameChunk()
for (int i = 0; i < 12; i++) {
void *ptr = c.allocate(16);
ptrs << ptr;
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
}
QVERIFY(!c.isEmpty());
}
@@ -361,14 +353,14 @@ void tst_QFrameAllocator::allocateQFixedFrameAllocator()
// Fill 1 chunck
for (int i = 0; i < 128; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
QCOMPARE(f.chunkCount(), 1);
// Fill half of chunk 2
for (int i = 0; i < 64; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
// Free chunk 2
@@ -382,7 +374,7 @@ void tst_QFrameAllocator::allocateQFixedFrameAllocator()
for (int i = 0; i < 256; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
QCOMPARE(f.chunkCount(), 3);
@@ -398,13 +390,13 @@ void tst_QFrameAllocator::deallocateQFixedFrameAllocator()
for (int i = 0; i < 128; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
QCOMPARE(f.chunkCount(), 1);
for (int i = 0; i < 64; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
QCOMPARE(f.chunkCount(), 2);
@@ -421,7 +413,7 @@ void tst_QFrameAllocator::deallocateQFixedFrameAllocator()
QCOMPARE(f.chunkCount(), 1);
for (int i = 0; i < 36; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
QCOMPARE(f.chunkCount(), 1);
@@ -437,7 +429,7 @@ void tst_QFrameAllocator::checkFragmentationQFixedFrameAllocator()
for (int i = 0; i < 256; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
@@ -451,7 +443,7 @@ void tst_QFrameAllocator::checkFragmentationQFixedFrameAllocator()
for (int i = 0; i < 64; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
QCOMPARE(f.chunkCount(), 2);
@@ -467,7 +459,7 @@ void tst_QFrameAllocator::clearQFixedFrameAllocator()
for (int i = 0; i < 256; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
QCOMPARE(f.chunkCount(), 2);
@@ -477,7 +469,7 @@ void tst_QFrameAllocator::clearQFixedFrameAllocator()
for (int i = 0; i < 256; i++) {
void *ptr = f.allocate();
- QVERIFY(ptr != Q_NULLPTR);
+ QVERIFY(ptr != nullptr);
ptrs << ptr;
}
QCOMPARE(f.chunkCount(), 2);
diff --git a/tests/auto/core/qray3d/qray3d.pro b/tests/auto/core/qray3d/qray3d.pro
deleted file mode 100644
index f86496142..000000000
--- a/tests/auto/core/qray3d/qray3d.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TARGET = tst_qray3d
-CONFIG += testcase
-TEMPLATE = app
-
-SOURCES += \
- tst_qray3d.cpp
-
-QT += testlib core-private 3dcore 3dcore-private
diff --git a/tests/auto/core/qray3d/tst_qray3d.cpp b/tests/auto/core/qray3d/tst_qray3d.cpp
deleted file mode 100644
index a032ddd78..000000000
--- a/tests/auto/core/qray3d/tst_qray3d.cpp
+++ /dev/null
@@ -1,546 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <Qt3DCore/qray3d.h>
-
-class tst_QRay3D : public QObject
-{
- Q_OBJECT
-public:
- tst_QRay3D() {}
- ~tst_QRay3D() {}
-
-private Q_SLOTS:
- void create_data();
- void create();
- void projection_data();
- void projection();
- void point_data();
- void point();
- void contains_point_data();
- void contains_point();
- void contains_ray_data();
- void contains_ray();
- void distance_data();
- void distance();
- void compare();
- void dataStream();
- void transform_data();
- void transform();
- void properties();
- void metaTypes();
- void shouldNotAllowNullDirection();
-};
-
-// Fix the problem where a compared value happens to be zero (and
-// you cannot always predict this, and should not predict it
-// since then you produce self-fulling prophecies instead of tests).
-// In that case qFuzzyCompare has a completely strict criterion since
-// it finds the "fudge factor" by multiplying by zero...
-static inline bool fuzzyCompare(float p1, float p2)
-{
- float fac = qMin(qAbs(p1), qAbs(p2));
- return (qAbs(p1 - p2) <= (qIsNull(fac) ? 0.00001f : 0.00001f * fac));
-}
-
-static inline bool fuzzyCompare(const QVector3D &lhs, const QVector3D &rhs)
-{
- if (fuzzyCompare(lhs.x(), rhs.x()) &&
- fuzzyCompare(lhs.y(), rhs.y()) &&
- fuzzyCompare(lhs.z(), rhs.z()))
- return true;
-#ifndef QT_NO_DEBUG_STREAM
- qWarning() << "actual:" << lhs;
- qWarning() << "expected:" << rhs;
-#endif
- return false;
-}
-
-void tst_QRay3D::create_data()
-{
- QTest::addColumn<QVector3D>("point");
- QTest::addColumn<QVector3D>("direction");
-
- // normalized direction vectors
- QTest::newRow("line on x-axis from origin")
- << QVector3D()
- << QVector3D(1.0f, 0.0f, 0.0f);
-
- QTest::newRow("line parallel -z-axis from 3,3,3")
- << QVector3D(3.0f, 3.0f, 3.0f)
- << QVector3D(0.0f, 0.0f, -1.0f);
-
- QTest::newRow("vertical line (parallel to y-axis)")
- << QVector3D(0.5f, 0.0f, 0.5f)
- << QVector3D(0.0f, 1.0f, 0.0f);
-
- QTest::newRow("equidistant from all 3 axes")
- << QVector3D(0.5f, 0.0f, 0.5f)
- << QVector3D(0.57735026919f, 0.57735026919f, 0.57735026919f);
-
- // non-normalized direction vectors
- QTest::newRow("line on x-axis from origin - B")
- << QVector3D()
- << QVector3D(2.0f, 0.0f, 0.0f);
-
- QTest::newRow("line parallel -z-axis from 3,3,3 - B")
- << QVector3D(3.0f, 3.0f, 3.0f)
- << QVector3D(0.0f, 0.0f, -0.7f);
-
- QTest::newRow("vertical line (parallel to y-axis) - B")
- << QVector3D(0.5f, 0.0f, 0.5f)
- << QVector3D(0.0f, 5.3f, 0.0f);
-
- QTest::newRow("equidistant from all 3 axes - B")
- << QVector3D(0.5f, 0.0f, 0.5f)
- << QVector3D(1.0f, 1.0f, 1.0f);
-
- QTest::newRow("negative direction")
- << QVector3D(-3.0f, -3.0f, -3.0f)
- << QVector3D(-1.2f, -1.8f, -2.4f);
-}
-
-void tst_QRay3D::create()
-{
- QFETCH(QVector3D, point);
- QFETCH(QVector3D, direction);
- Qt3DCore::QRay3D ray(point, direction);
- QVERIFY(fuzzyCompare(ray.direction(), direction));
- QVERIFY(fuzzyCompare(ray.origin(), point));
-
- Qt3DCore::QRay3D ray2;
- QCOMPARE(ray2.origin(), QVector3D(0, 0, 0));
- QCOMPARE(ray2.direction(), QVector3D(0, 0, 1));
- ray2.setOrigin(point);
- ray2.setDirection(direction);
- QVERIFY(fuzzyCompare(ray.direction(), direction));
- QVERIFY(fuzzyCompare(ray.origin(), point));
-}
-
-void tst_QRay3D::projection_data()
-{
- QTest::addColumn<QVector3D>("point");
- QTest::addColumn<QVector3D>("direction");
- QTest::addColumn<QVector3D>("vector");
- QTest::addColumn<QVector3D>("expected");
-
- QTest::newRow("line on x-axis from origin")
- << QVector3D()
- << QVector3D(2.0f, 0.0f, 0.0f)
- << QVector3D(0.6f, 0.0f, 0.0f)
- << QVector3D(0.6f, 0.0f, 0.0f);
-
- QTest::newRow("line parallel -z-axis from 3,3,3")
- << QVector3D(3.0f, 3.0f, 3.0f)
- << QVector3D(0.0f, 0.0f, -0.7f)
- << QVector3D(3.0f, 3.0f, 2.4f)
- << QVector3D(0.0f, 0.0f, 2.4f);
-
- QTest::newRow("vertical line (parallel to y-axis)")
- << QVector3D(0.5f, 0.0f, 0.5f)
- << QVector3D(0.0f, 5.3f, 0.0f)
- << QVector3D(0.5f, 0.6f, 0.5f)
- << QVector3D(0.0f, 0.6f, 0.0f);
-
- QTest::newRow("equidistant from all 3 axes, project y-axis (with some z & x)")
- << QVector3D(0.5f, 0.0f, 0.5f)
- << QVector3D(1.0f, 1.0f, 1.0f)
- << QVector3D(0.5f, 5.0f, 0.5f)
- << QVector3D(2.0f, 2.0f, 2.0f);
-
- QTest::newRow("negative direction line, project +ve y-axis (with some z & x)")
- << QVector3D(-3.0f, -3.0f, -3.0f)
- << QVector3D(-1.2f, -1.8f, -2.4f)
- << QVector3D(0.5f, 5.0f, 0.5f)
- << QVector3D(1.241379261016846f, 1.862068772315979f, 2.48275852203369f);
-}
-
-void tst_QRay3D::projection()
-{
- QFETCH(QVector3D, point);
- QFETCH(QVector3D, direction);
- QFETCH(QVector3D, vector);
- QFETCH(QVector3D, expected);
- Qt3DCore::QRay3D line(point, direction);
- QVector3D result = line.project(vector);
- QVERIFY(fuzzyCompare(result, expected));
-}
-
-void tst_QRay3D::point_data()
-{
- QTest::addColumn<QVector3D>("point");
- QTest::addColumn<QVector3D>("direction");
- QTest::addColumn<QVector3D>("point_on_line_pos_0_6");
- QTest::addColumn<QVector3D>("point_on_line_neg_7_2");
-
- QTest::newRow("line on x-axis from origin")
- << QVector3D()
- << QVector3D(2.0f, 0.0f, 0.0f)
- << QVector3D(1.2f, 0.0f, 0.0f)
- << QVector3D(-14.4f, 0.0f, 0.0f);
-
- QTest::newRow("line parallel -z-axis from 3,3,3")
- << QVector3D(3.0f, 3.0f, 3.0f)
- << QVector3D(0.0f, 0.0f, -0.7f)
- << QVector3D(3.0f, 3.0f, 2.58f)
- << QVector3D(3.0f, 3.0f, 8.04f);
-
- QTest::newRow("vertical line (parallel to y-axis)")
- << QVector3D(0.5f, 0.0f, 0.5f)
- << QVector3D(0.0f, 5.3f, 0.0f)
- << QVector3D(0.5f, 3.18f, 0.5f)
- << QVector3D(0.5f, -38.16f, 0.5f);
-
- QTest::newRow("equidistant from all 3 axes")
- << QVector3D(0.5f, 0.0f, 0.5f)
- << QVector3D(1.0f, 1.0f, 1.0f)
- << QVector3D(1.1f, 0.6f, 1.1f)
- << QVector3D(-6.7f, -7.2f, -6.7f);
-
- QTest::newRow("negative direction")
- << QVector3D(-3.0f, -3.0f, -3.0f)
- << QVector3D(-1.2f, -1.8f, -2.4f)
- << QVector3D(-3.72f, -4.08f, -4.44f)
- << QVector3D(5.64f, 9.96f, 14.28f);
-}
-
-void tst_QRay3D::point()
-{
- QFETCH(QVector3D, point);
- QFETCH(QVector3D, direction);
- QFETCH(QVector3D, point_on_line_pos_0_6);
- QFETCH(QVector3D, point_on_line_neg_7_2);
- Qt3DCore::QRay3D line(point, direction);
- QVERIFY(fuzzyCompare(line.point(0.6), point_on_line_pos_0_6));
- QVERIFY(fuzzyCompare(line.point(-7.2), point_on_line_neg_7_2));
- QVERIFY(fuzzyCompare(line.projectedDistance(point_on_line_pos_0_6), 0.6));
- QVERIFY(fuzzyCompare(line.projectedDistance(point_on_line_neg_7_2), -7.2));
-}
-
-void tst_QRay3D::contains_point_data()
-{
- QTest::addColumn<QVector3D>("origin");
- QTest::addColumn<QVector3D>("direction");
- QTest::addColumn<QVector3D>("point");
- QTest::addColumn<bool>("contains");
-
- QTest::newRow("bogus this line with null direction")
- << QVector3D(1.0, 3.0, 3.0)
- << QVector3D(0.0, 0.0, 0.0)
- << QVector3D(1.0, 2.0, 4.0)
- << false;
-
- QTest::newRow("point at the origin")
- << QVector3D(0.0, 0.0, 0.0)
- << QVector3D(1.0, 3.0, 3.0)
- << QVector3D(0.0, 0.0, 0.0)
- << true;
-
- QTest::newRow("close to the origin")
- << QVector3D(1.0, 1.0, 1.0)
- << QVector3D(1.0, 3.0, 3.0)
- << QVector3D(1.0005f, 1.0005f, 1.0)
- << false;
-
- QTest::newRow("45 line line in plane x=1")
- << QVector3D(1.0, 3.0, 3.0)
- << QVector3D(0.0, -1.0, -1.0)
- << QVector3D(1.0, 4.0, 4.0)
- << true;
- {
- // This is to prove that the constructed approach give the
- // same results
- QVector3D p(1.0, 3.0, 3.0);
- QVector3D v(0.0, -1.0, -1.0);
-
- QTest::newRow("constructed 45 line line in plane x=1")
- << p
- << v
- << p + v
- << true;
- }
-
- QTest::newRow("intersection with negative s in plane z=-1")
- << QVector3D(1.0f, 2.0f, -1.0f)
- << QVector3D(1.0f, 1.0f, 0.0f)
- << QVector3D(2.0f, 1.0f, 0.0f)
- << false;
-
- QTest::newRow("45 angled line")
- << QVector3D(3.0f, 0.0f, -1.0f)
- << QVector3D(1.0f, -1.0f, 1.0f)
- << QVector3D(6.0f, -3.0f, 2.0f)
- << true;
-
- {
- QVector3D p(-10.0, 3.0, 3.0);
- QVector3D v(0.0, 20.0, -1.0);
- QTest::newRow("constructed vector close to axis")
- << p
- << v
- << p + v * 3.0
- << true;
- }
-
- {
- QVector3D p(1.0, 3.0, 3.0);
- QVector3D v(40.0, 500.0, -1.0);
- QTest::newRow("constructed larger values close to axis")
- << p
- << v
- << p + v
- << true;
- }
-}
-
-void tst_QRay3D::contains_point()
-{
- QFETCH(QVector3D, origin);
- QFETCH(QVector3D, direction);
- QFETCH(QVector3D, point);
- QFETCH(bool, contains);
-
- Qt3DCore::QRay3D line(origin, direction);
- QCOMPARE(line.contains(point), contains);
-}
-
-void tst_QRay3D::contains_ray_data()
-{
- contains_point_data();
-}
-
-void tst_QRay3D::contains_ray()
-{
- QFETCH(QVector3D, origin);
- QFETCH(QVector3D, direction);
- QFETCH(QVector3D, point);
- QFETCH(bool, contains);
-
- Qt3DCore::QRay3D line(origin, direction);
- if (contains) {
- Qt3DCore::QRay3D line2(point, direction);
- QVERIFY(line.contains(line2));
- QVERIFY(line2.contains(line));
-
- // Reversed direction is also contained.
- Qt3DCore::QRay3D line3(point, -direction);
- QVERIFY(line.contains(line2));
- QVERIFY(line2.contains(line));
-
- // Different direction.
- Qt3DCore::QRay3D line4(point, QVector3D(direction.y(), direction.x(), direction.z()));
- QVERIFY(!line.contains(line4));
- QVERIFY(!line4.contains(line));
- } else {
- Qt3DCore::QRay3D line2(point, direction);
- QVERIFY(!line.contains(line2));
- QVERIFY(!line2.contains(line));
- }
-}
-
-void tst_QRay3D::distance_data()
-{
- QTest::addColumn<QVector3D>("origin");
- QTest::addColumn<QVector3D>("direction");
- QTest::addColumn<QVector3D>("point");
- QTest::addColumn<float>("distance");
-
- QTest::newRow("axis-x")
- << QVector3D(6.0f, 0.0f, 0.0f)
- << QVector3D(1.0f, 0.0f, 0.0f)
- << QVector3D(0.0f, 0.0f, 0.0f)
- << 0.0f;
-
- QTest::newRow("axis-x to 1")
- << QVector3D(6.0f, 0.0f, 0.0f)
- << QVector3D(1.0f, 0.0f, 0.0f)
- << QVector3D(0.0f, 1.0f, 0.0f)
- << 1.0f;
-
- QTest::newRow("neg-axis-y")
- << QVector3D(0.0f, 6.0f, 0.0f)
- << QVector3D(0.0f, -1.5f, 0.0f)
- << QVector3D(0.0f, 100.0f, 0.0f)
- << 0.0f;
-
- QTest::newRow("neg-axis-y to 2")
- << QVector3D(0.0f, 6.0f, 0.0f)
- << QVector3D(0.0f, -1.5f, 0.0f)
- << QVector3D(2.0f, 0.0f, 0.0f)
- << 2.0f;
-}
-
-void tst_QRay3D::distance()
-{
- QFETCH(QVector3D, origin);
- QFETCH(QVector3D, direction);
- QFETCH(QVector3D, point);
- QFETCH(float, distance);
-
- Qt3DCore::QRay3D line(origin, direction);
- QCOMPARE(line.distance(point), distance);
-}
-
-void tst_QRay3D::compare()
-{
- Qt3DCore::QRay3D ray1(QVector3D(10, 20, 30), QVector3D(-3, -4, -5));
- Qt3DCore::QRay3D ray2(QVector3D(10, 20, 30), QVector3D(1.5f, 2.0f, 2.5f));
- Qt3DCore::QRay3D ray3(QVector3D(0, 20, 30), QVector3D(-3, -4, -5));
- QVERIFY(ray1 == ray1);
- QVERIFY(!(ray1 != ray1));
- QVERIFY(qFuzzyCompare(ray1, ray1));
- QVERIFY(ray1 != ray2);
- QVERIFY(!(ray1 == ray2));
- QVERIFY(!qFuzzyCompare(ray1, ray2));
- QVERIFY(ray1 != ray3);
- QVERIFY(!(ray1 == ray3));
- QVERIFY(!qFuzzyCompare(ray1, ray3));
-}
-
-void tst_QRay3D::dataStream()
-{
-#ifndef QT_NO_DATASTREAM
- Qt3DCore::QRay3D ray(QVector3D(1.0f, 2.0f, 3.0f), QVector3D(4.0f, 5.0f, 6.0f));
-
- QByteArray data;
- {
- QDataStream stream(&data, QIODevice::WriteOnly);
- stream << ray;
- }
-
- Qt3DCore::QRay3D ray2;
- {
- QDataStream stream2(data);
- stream2 >> ray2;
- }
-
- QVERIFY(ray == ray2);
-#endif
-}
-
-void tst_QRay3D::transform_data()
-{
- create_data();
-}
-
-void tst_QRay3D::transform()
-{
- QFETCH(QVector3D, point);
- QFETCH(QVector3D, direction);
-
- QMatrix4x4 m;
- m.translate(-1.0f, 2.5f, 5.0f);
- m.rotate(45.0f, 1.0f, 1.0f, 1.0f);
- m.scale(23.5f);
-
- Qt3DCore::QRay3D ray1(point, direction);
- Qt3DCore::QRay3D ray2(ray1);
- Qt3DCore::QRay3D ray3;
-
- ray1.transform(m);
- ray3 = ray2.transformed(m);
-
- QVERIFY(fuzzyCompare(ray1.origin(), ray3.origin()));
- QVERIFY(fuzzyCompare(ray1.direction(), ray3.direction()));
-
- QVERIFY(fuzzyCompare(ray1.origin(), m * point));
- QVERIFY(fuzzyCompare(ray1.direction(), m.mapVector(direction)));
-}
-
-class tst_QRay3DProperties : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(Qt3DCore::QRay3D ray READ ray WRITE setRay)
-public:
- tst_QRay3DProperties(QObject *parent = 0) : QObject(parent) {}
-
- Qt3DCore::QRay3D ray() const { return r; }
- void setRay(const Qt3DCore::QRay3D& value) { r = value; }
-
-private:
- Qt3DCore::QRay3D r;
-};
-
-// Test getting and setting properties via the metaobject system.
-void tst_QRay3D::properties()
-{
- tst_QRay3DProperties obj;
-
- qRegisterMetaType<Qt3DCore::QRay3D>();
-
- obj.setRay(Qt3DCore::QRay3D(QVector3D(1, 2, 3), QVector3D(4, 5, 6)));
-
- Qt3DCore::QRay3D r = qvariant_cast<Qt3DCore::QRay3D>(obj.property("ray"));
- QCOMPARE(r.origin(), QVector3D(1, 2, 3));
- QCOMPARE(r.direction(), QVector3D(4, 5, 6));
-
- obj.setProperty("ray",
- qVariantFromValue
- (Qt3DCore::QRay3D(QVector3D(-1, -2, -3), QVector3D(-4, -5, -6))));
-
- r = qvariant_cast<Qt3DCore::QRay3D>(obj.property("ray"));
- QCOMPARE(r.origin(), QVector3D(-1, -2, -3));
- QCOMPARE(r.direction(), QVector3D(-4, -5, -6));
-}
-
-void tst_QRay3D::metaTypes()
-{
- int id = qMetaTypeId<Qt3DCore::QRay3D>();
- QVERIFY(QMetaType::type("Qt3DCore::QRay3D") == id);
- QCOMPARE(QByteArray(QMetaType::typeName(id)), QByteArray("Qt3DCore::QRay3D"));
- QVERIFY(QMetaType::isRegistered(id));
-}
-
-void tst_QRay3D::shouldNotAllowNullDirection()
-{
- // GIVEN
- Qt3DCore::QRay3D ray;
-
- QCOMPARE(ray.origin(), QVector3D(0, 0, 0));
- QCOMPARE(ray.direction(), QVector3D(0, 0, 1));
-
- // WHEN
- ray.setDirection(QVector3D(0, 0, 0));
-
- // THEN
- QCOMPARE(ray.direction(), QVector3D(0, 0, 1));
-}
-
-QTEST_APPLESS_MAIN(tst_QRay3D)
-
-#include "tst_qray3d.moc"
diff --git a/tests/auto/core/qscene/tst_qscene.cpp b/tests/auto/core/qscene/tst_qscene.cpp
index a907a62ba..eabcc96fb 100644
--- a/tests/auto/core/qscene/tst_qscene.cpp
+++ b/tests/auto/core/qscene/tst_qscene.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -91,14 +83,6 @@ class tst_Node : public Qt3DCore::QNode
public:
tst_Node() : Qt3DCore::QNode()
{}
-
- ~tst_Node()
- {
- QNode::cleanup();
- }
-
-protected:
- QT3D_CLONEABLE(tst_Node)
};
class tst_Component : public Qt3DCore::QComponent
@@ -107,14 +91,6 @@ class tst_Component : public Qt3DCore::QComponent
public:
tst_Component() : Qt3DCore::QComponent()
{}
-
- ~tst_Component()
- {
- QNode::cleanup();
- }
-
-protected:
- QT3D_CLONEABLE(tst_Component)
};
void tst_QScene::addObservable()
@@ -147,11 +123,11 @@ void tst_QScene::addObservable()
Q_FOREACH (Qt3DCore::QObservableInterface *o, obs1) {
QVERIFY(scene->nodeIdFromObservable(o) == node1->id());
- QVERIFY(scene->lookupNode(node1->id()) == Q_NULLPTR);
+ QVERIFY(scene->lookupNode(node1->id()) == nullptr);
}
Q_FOREACH (Qt3DCore::QObservableInterface *o, obs2) {
QVERIFY(scene->nodeIdFromObservable(o) == node2->id());
- QVERIFY(scene->lookupNode(node2->id()) == Q_NULLPTR);
+ QVERIFY(scene->lookupNode(node2->id()) == nullptr);
}
}
@@ -263,7 +239,7 @@ void tst_QScene::removeNodeObservable()
scene->removeObservable(node1);
// THEN
- QVERIFY(scene->lookupNode(node1->id()) == Q_NULLPTR);
+ QVERIFY(scene->lookupNode(node1->id()) == nullptr);
QVERIFY(scene->lookupObservables(node1->id()).empty());
QVERIFY(scene->nodeIdFromObservable(observables.at(0)) == Qt3DCore::QNodeId());
@@ -329,10 +305,10 @@ void tst_QScene::removeChildNode()
while (!nodes.isEmpty()) {
Qt3DCore::QNode *lst = nodes.takeLast();
QVERIFY(scene->lookupNode(lst->id()) == lst);
- if (lst->parentNode() != Q_NULLPTR) {
+ if (lst->parentNode() != nullptr) {
lst->setParent(Q_NODE_NULLPTR);
QCoreApplication::processEvents();
- QVERIFY(scene->lookupNode(lst->id()) == Q_NULLPTR);
+ QVERIFY(scene->lookupNode(lst->id()) == nullptr);
}
}
}
@@ -365,7 +341,7 @@ void tst_QScene::addEntityForComponent()
// THEN
for (int i = 0; i < 10; i++) {
- QList<Qt3DCore::QNodeId> ids = scene->entitiesForComponent(components.at(i)->id());
+ QVector<Qt3DCore::QNodeId> ids = scene->entitiesForComponent(components.at(i)->id());
QCOMPARE(ids.count(), 10);
}
}
diff --git a/tests/auto/core/qservicelocator/tst_qservicelocator.cpp b/tests/auto/core/qservicelocator/tst_qservicelocator.cpp
index d1f4dd8ec..24d9cce68 100644
--- a/tests/auto/core/qservicelocator/tst_qservicelocator.cpp
+++ b/tests/auto/core/qservicelocator/tst_qservicelocator.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -93,11 +85,11 @@ void tst_QServiceLocator::defaultServices()
{
QServiceLocator locator;
QOpenGLInformationService *glInfo = locator.openGLInformation();
- QVERIFY(glInfo != Q_NULLPTR);
+ QVERIFY(glInfo != nullptr);
QVERIFY(glInfo->description() == QStringLiteral("Null OpenGL Information Service"));
QSystemInformationService *sysInfo = locator.systemInformation();
- QVERIFY(sysInfo != Q_NULLPTR);
+ QVERIFY(sysInfo != nullptr);
QVERIFY(sysInfo->description() == QStringLiteral("Null System Information Service"));
QVERIFY(sysInfo->threadPoolThreadCount() == 0);
}
@@ -117,7 +109,7 @@ void tst_QServiceLocator::addRemoveDefaultService()
// Ensure the other default services work
QOpenGLInformationService *glInfo = locator.openGLInformation();
- QVERIFY(glInfo != Q_NULLPTR);
+ QVERIFY(glInfo != nullptr);
QVERIFY(glInfo->description() == QStringLiteral("Null OpenGL Information Service"));
QVERIFY(glInfo->format() == QSurfaceFormat());
@@ -145,7 +137,7 @@ void tst_QServiceLocator::addRemoveUserService()
// Ensure the default services work
QSystemInformationService *sysInfo = locator.systemInformation();
- QVERIFY(sysInfo != Q_NULLPTR);
+ QVERIFY(sysInfo != nullptr);
QVERIFY(sysInfo->description() == QStringLiteral("Null System Information Service"));
QVERIFY(sysInfo->threadPoolThreadCount() == 0);
diff --git a/tests/auto/core/qtransform/tst_qtransform.cpp b/tests/auto/core/qtransform/tst_qtransform.cpp
index d3986b5a1..2b92ffacd 100644
--- a/tests/auto/core/qtransform/tst_qtransform.cpp
+++ b/tests/auto/core/qtransform/tst_qtransform.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,19 +29,16 @@
#include <QtTest/QtTest>
#include <Qt3DCore/qtransform.h>
#include <Qt3DCore/qcomponent.h>
+#include <Qt3DCore/private/qtransform_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <QtCore/qscopedpointer.h>
#include "testpostmanarbiter.h"
using namespace Qt3DCore;
-class tst_QTransform : public QNode
+class tst_QTransform : public QObject
{
Q_OBJECT
-public:
- ~tst_QTransform()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
void checkCloning_data()
@@ -88,17 +77,24 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QTransform *, transform);
// WHEN
- Qt3DCore::QTransform *clone = static_cast<Qt3DCore::QTransform *>(QNode::clone(transform));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(transform);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(transform->id(), clone->id());
- QCOMPARE(transform->matrix(), clone->matrix());
- QCOMPARE(transform->translation(), clone->translation());
- QCOMPARE(transform->scale3D(), clone->scale3D());
- QCOMPARE(transform->scale(), clone->scale());
- QCOMPARE(transform->rotation(), clone->rotation());
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DCore::QTransformData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DCore::QTransformData>>(creationChanges.first());
+ const Qt3DCore::QTransformData &cloneData = creationChangeData->data;
+
+ // THEN
+ QCOMPARE(creationChangeData->subjectId(), transform->id());
+ QCOMPARE(creationChangeData->isNodeEnabled(), transform->isEnabled());
+ QCOMPARE(creationChangeData->metaObject(), transform->metaObject());
+ QCOMPARE(creationChangeData->parentId(), transform->parentNode() ? transform->parentNode()->id() : Qt3DCore::QNodeId());
+ QCOMPARE(transform->translation(), cloneData.translation);
+ QCOMPARE(transform->scale3D(), cloneData.scale);
+ QCOMPARE(transform->rotation(), cloneData.rotation);
}
void checkPropertyUpdates()
@@ -112,9 +108,9 @@ private Q_SLOTS:
QCoreApplication::processEvents();
// THEN
- Qt3DCore::QScenePropertyChangePtr change;
+ Qt3DCore::QPropertyUpdatedChangePtr change;
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "translation");
QCOMPARE(change->value().value<QVector3D>(), QVector3D(454.0f, 427.0f, 383.0f));
@@ -127,7 +123,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "rotation");
QCOMPARE(change->value().value<QQuaternion>(), q);
@@ -139,7 +135,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "scale3D");
QCOMPARE(change->value().value<QVector3D>(), QVector3D(883.0f, 1200.0f, 1340.0f));
@@ -154,13 +150,13 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 3);
- change = arbiter.events.takeFirst().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.takeFirst().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "scale3D");
QCOMPARE(change->value().value<QVector3D>(), QVector3D(1.0f, 1.0f, 1.0f));
- change = arbiter.events.takeFirst().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.takeFirst().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "rotation");
QCOMPARE(change->value().value<QQuaternion>(), QQuaternion());
- change = arbiter.events.takeFirst().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.takeFirst().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "translation");
QCOMPARE(change->value().value<QVector3D>(), QVector3D());
@@ -172,7 +168,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "rotation");
QCOMPARE(change->value().value<QQuaternion>().toEulerAngles().x(), 20.0f);
@@ -200,12 +196,6 @@ private Q_SLOTS:
// Note: t.matrix() != t2.matrix() since different matrices
// can result in the same scale, rotation, translation
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
};
QTEST_MAIN(tst_QTransform)
diff --git a/tests/auto/core/threadpooler/tst_threadpooler.cpp b/tests/auto/core/threadpooler/tst_threadpooler.cpp
index 177d7ff16..6dc7925b2 100644
--- a/tests/auto/core/threadpooler/tst_threadpooler.cpp
+++ b/tests/auto/core/threadpooler/tst_threadpooler.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/input/abstractaxisinput/abstractaxisinput.pro b/tests/auto/input/abstractaxisinput/abstractaxisinput.pro
new file mode 100644
index 000000000..3f9c521de
--- /dev/null
+++ b/tests/auto/input/abstractaxisinput/abstractaxisinput.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_abstractaxisinput
+
+QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_abstractaxisinput.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp b/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp
new file mode 100644
index 000000000..26f255d74
--- /dev/null
+++ b/tests/auto/input/abstractaxisinput/tst_abstractaxisinput.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <qbackendnodetester.h>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DInput/private/abstractaxisinput_p.h>
+#include <Qt3DInput/QAbstractAxisInput>
+#include <Qt3DInput/private/qabstractaxisinput_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include "testdevice.h"
+
+class DummyAxisInput : public Qt3DInput::QAbstractAxisInput
+{
+ Q_OBJECT
+public:
+ explicit DummyAxisInput(QNode *parent = nullptr)
+ : Qt3DInput::QAbstractAxisInput(*new Qt3DInput::QAbstractAxisInputPrivate, parent)
+ {
+ }
+
+private:
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE
+ {
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QAbstractAxisInputData>::create(this);
+ auto &data = creationChange->data;
+ data.sourceDeviceId = qIdForNode(sourceDevice());
+ return creationChange;
+ }
+};
+
+class DummyAxisInputBackend : public Qt3DInput::Input::AbstractAxisInput
+{
+public:
+ explicit DummyAxisInputBackend()
+ : AbstractAxisInput()
+ {
+ }
+};
+
+
+class tst_AbstractAxisInput : public Qt3DCore::QBackendNodeTester
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkPeerPropertyMirroring()
+ {
+ // GIVEN
+ DummyAxisInputBackend backendAxisInput;
+ DummyAxisInput axisInput;
+ TestDevice sourceDevice;
+
+ axisInput.setSourceDevice(&sourceDevice);
+
+ // WHEN
+ simulateInitialization(&axisInput, &backendAxisInput);
+
+ // THEN
+ QCOMPARE(backendAxisInput.peerId(), axisInput.id());
+ QCOMPARE(backendAxisInput.isEnabled(), axisInput.isEnabled());
+ QCOMPARE(backendAxisInput.sourceDevice(), sourceDevice.id());
+ }
+
+ void checkInitialAndCleanedUpState()
+ {
+ // GIVEN
+ DummyAxisInputBackend backendAxisInput;
+
+ // THEN
+ QVERIFY(backendAxisInput.peerId().isNull());
+ QCOMPARE(backendAxisInput.isEnabled(), false);
+ QCOMPARE(backendAxisInput.sourceDevice(), Qt3DCore::QNodeId());
+
+ // GIVEN
+ DummyAxisInput axisInput;
+ TestDevice sourceDevice;
+
+ axisInput.setSourceDevice(&sourceDevice);
+
+ // WHEN
+ simulateInitialization(&axisInput, &backendAxisInput);
+ backendAxisInput.cleanup();
+
+ // THEN
+ QCOMPARE(backendAxisInput.isEnabled(), false);
+ QCOMPARE(backendAxisInput.sourceDevice(), Qt3DCore::QNodeId());
+ }
+
+ void checkPropertyChanges()
+ {
+ // GIVEN
+ DummyAxisInputBackend backendAxisInput;
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("enabled");
+ updateChange->setValue(true);
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.isEnabled(), true);
+
+ // WHEN
+ TestDevice device;
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("sourceDevice");
+ updateChange->setValue(QVariant::fromValue(device.id()));
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.sourceDevice(), device.id());
+ }
+};
+
+QTEST_APPLESS_MAIN(tst_AbstractAxisInput)
+
+#include "tst_abstractaxisinput.moc"
diff --git a/tests/auto/input/action/action.pro b/tests/auto/input/action/action.pro
index 81bf7ad75..826ec5fea 100644
--- a/tests/auto/input/action/action.pro
+++ b/tests/auto/input/action/action.pro
@@ -7,3 +7,6 @@ QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
CONFIG += testcase
SOURCES += tst_action.cpp
+
+include(../../core/common/common.pri)
+include(../../render/commons/commons.pri)
diff --git a/tests/auto/input/action/tst_action.cpp b/tests/auto/input/action/tst_action.cpp
index 5a05002b8..cb2192d1e 100644
--- a/tests/auto/input/action/tst_action.cpp
+++ b/tests/auto/input/action/tst_action.cpp
@@ -1,48 +1,54 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <Qt3DInput/private/action_p.h>
#include <Qt3DInput/QActionInput>
#include <Qt3DInput/QAction>
+#include <Qt3DCore/private/qbackendnode_p.h>
+#include "testpostmanarbiter.h"
+
+class DummyActionInput : public Qt3DInput::QActionInput
+{
+ Q_OBJECT
+public:
+ DummyActionInput(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DInput::QActionInput(parent)
+ {}
+};
-class tst_Action: public QObject
+class tst_Action : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
@@ -56,15 +62,13 @@ private Q_SLOTS:
Qt3DInput::QActionInput actionInput;
action.addInput(&actionInput);
- action.setName(QStringLiteral("L88"));
// WHEN
- backendAction.setPeer(&action);
+ simulateInitialization(&action, &backendAction);
// THEN
- QCOMPARE(backendAction.peerUuid(), action.id());
+ QCOMPARE(backendAction.peerId(), action.id());
QCOMPARE(backendAction.isEnabled(), action.isEnabled());
- QCOMPARE(backendAction.name(), action.name());
QCOMPARE(backendAction.inputs().size(), action.inputs().size());
const int inputsCount = backendAction.inputs().size();
@@ -80,27 +84,23 @@ private Q_SLOTS:
Qt3DInput::Input::Action backendAction;
// THEN
- QVERIFY(backendAction.peerUuid().isNull());
- QVERIFY(backendAction.name().isEmpty());
+ QVERIFY(backendAction.peerId().isNull());
QCOMPARE(backendAction.actionTriggered(), false);
QCOMPARE(backendAction.isEnabled(), false);
QCOMPARE(backendAction.inputs().size(), 0);
// GIVEN
- Qt3DInput::QAction axis;
+ Qt3DInput::QAction action;
Qt3DInput::QActionInput axisInput;
- axis.addInput(&axisInput);
- axis.setName(QStringLiteral("L88"));
+ action.addInput(&axisInput);
// WHEN
- backendAction.updateFromPeer(&axis);
+ simulateInitialization(&action, &backendAction);
backendAction.setActionTriggered(true);
backendAction.cleanup();
// THEN
- QVERIFY(backendAction.peerUuid().isNull());
- QVERIFY(backendAction.name().isEmpty());
QCOMPARE(backendAction.actionTriggered(), false);
QCOMPARE(backendAction.isEnabled(), false);
QCOMPARE(backendAction.inputs().size(), 0);
@@ -110,18 +110,10 @@ private Q_SLOTS:
{
// GIVEN
Qt3DInput::Input::Action backendAction;
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange;
// WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(QStringLiteral("LT1"));
- updateChange->setPropertyName("name");
- backendAction.sceneChangeEvent(updateChange);
-
- // THEN
- QCOMPARE(backendAction.name(), QStringLiteral("LT1"));
-
- // WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setPropertyName("enabled");
updateChange->setValue(true);
backendAction.sceneChangeEvent(updateChange);
@@ -130,25 +122,54 @@ private Q_SLOTS:
QCOMPARE(backendAction.isEnabled(), true);
// WHEN
- Qt3DCore::QNodeId inputId = Qt3DCore::QNodeId::createId();
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("input");
- updateChange->setValue(QVariant::fromValue(inputId));
- backendAction.sceneChangeEvent(updateChange);
+ DummyActionInput input;
+ const Qt3DCore::QNodeId inputId = input.id();
+ const auto nodeAddedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &input);
+ nodeAddedChange->setPropertyName("input");
+ backendAction.sceneChangeEvent(nodeAddedChange);
// THEN
QCOMPARE(backendAction.inputs().size(), 1);
QCOMPARE(backendAction.inputs().first(), inputId);
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("input");
- updateChange->setValue(QVariant::fromValue(inputId));
- backendAction.sceneChangeEvent(updateChange);
+ const auto nodeRemovedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &input);
+ nodeRemovedChange->setPropertyName("input");
+ backendAction.sceneChangeEvent(nodeRemovedChange);
// THEN
QCOMPARE(backendAction.inputs().size(), 0);
}
+
+ void checkActivePropertyBackendNotification()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DInput::Input::Action backendAction;
+ Qt3DCore::QBackendNodePrivate::get(&backendAction)->setArbiter(&arbiter);
+ const bool currentActionTriggeredValue = backendAction.actionTriggered();
+
+ // WHEN
+ backendAction.setActionTriggered(true);
+
+ // THEN
+ QVERIFY(currentActionTriggeredValue != backendAction.actionTriggered());
+ QCOMPARE(arbiter.events.count(), 1);
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "active");
+ QCOMPARE(change->value().toBool(), backendAction.actionTriggered());
+
+ arbiter.events.clear();
+
+ // WHEN
+ backendAction.setActionTriggered(true);
+
+ // THEN
+ QVERIFY(currentActionTriggeredValue != backendAction.actionTriggered());
+ QCOMPARE(arbiter.events.count(), 0);
+
+ arbiter.events.clear();
+ }
};
QTEST_APPLESS_MAIN(tst_Action)
diff --git a/tests/auto/input/analogaxisinput/analogaxisinput.pro b/tests/auto/input/analogaxisinput/analogaxisinput.pro
new file mode 100644
index 000000000..7bd0a9865
--- /dev/null
+++ b/tests/auto/input/analogaxisinput/analogaxisinput.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_analogaxisinput
+
+QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_analogaxisinput.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/input/analogaxisinput/tst_analogaxisinput.cpp b/tests/auto/input/analogaxisinput/tst_analogaxisinput.cpp
new file mode 100644
index 000000000..7e8a25de4
--- /dev/null
+++ b/tests/auto/input/analogaxisinput/tst_analogaxisinput.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <qbackendnodetester.h>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DInput/private/analogaxisinput_p.h>
+#include <Qt3DInput/QAnalogAxisInput>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include "testdevice.h"
+
+class tst_AnalogAxisInput: public Qt3DCore::QBackendNodeTester
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkPeerPropertyMirroring()
+ {
+ // GIVEN
+ Qt3DInput::Input::AnalogAxisInput backendAxisInput;
+ Qt3DInput::QAnalogAxisInput axisInput;
+ TestDevice sourceDevice;
+
+ axisInput.setAxis(327);
+ axisInput.setSourceDevice(&sourceDevice);
+
+ // WHEN
+ simulateInitialization(&axisInput, &backendAxisInput);
+
+ // THEN
+ QCOMPARE(backendAxisInput.peerId(), axisInput.id());
+ QCOMPARE(backendAxisInput.isEnabled(), axisInput.isEnabled());
+ QCOMPARE(backendAxisInput.axis(), axisInput.axis());
+ QCOMPARE(backendAxisInput.sourceDevice(), sourceDevice.id());
+ }
+
+ void checkInitialAndCleanedUpState()
+ {
+ // GIVEN
+ Qt3DInput::Input::AnalogAxisInput backendAxisInput;
+
+ // THEN
+ QVERIFY(backendAxisInput.peerId().isNull());
+ QCOMPARE(backendAxisInput.axis(), 0);
+ QCOMPARE(backendAxisInput.isEnabled(), false);
+ QCOMPARE(backendAxisInput.sourceDevice(), Qt3DCore::QNodeId());
+
+ // GIVEN
+ Qt3DInput::QAnalogAxisInput axisInput;
+ TestDevice sourceDevice;
+
+ axisInput.setAxis(327);
+ axisInput.setSourceDevice(&sourceDevice);
+
+ // WHEN
+ simulateInitialization(&axisInput, &backendAxisInput);
+ backendAxisInput.cleanup();
+
+ // THEN
+ QCOMPARE(backendAxisInput.axis(), 0);
+ QCOMPARE(backendAxisInput.isEnabled(), false);
+ QCOMPARE(backendAxisInput.sourceDevice(), Qt3DCore::QNodeId());
+ }
+
+ void checkPropertyChanges()
+ {
+ // GIVEN
+ Qt3DInput::Input::AnalogAxisInput backendAxisInput;
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(32);
+ updateChange->setPropertyName("axis");
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.axis(), 32);
+
+ // WHEN
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("enabled");
+ updateChange->setValue(true);
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.isEnabled(), true);
+
+ // WHEN
+ TestDevice device;
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("sourceDevice");
+ updateChange->setValue(QVariant::fromValue(device.id()));
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.sourceDevice(), device.id());
+ }
+};
+
+QTEST_APPLESS_MAIN(tst_AnalogAxisInput)
+
+#include "tst_analogaxisinput.moc"
diff --git a/tests/auto/input/axis/axis.pro b/tests/auto/input/axis/axis.pro
index 3ecb170b3..6f1345eae 100644
--- a/tests/auto/input/axis/axis.pro
+++ b/tests/auto/input/axis/axis.pro
@@ -7,3 +7,6 @@ QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
CONFIG += testcase
SOURCES += tst_axis.cpp
+
+include(../../core/common/common.pri)
+include(../../render/commons/commons.pri)
diff --git a/tests/auto/input/axis/tst_axis.cpp b/tests/auto/input/axis/tst_axis.cpp
index d72738075..a074996e6 100644
--- a/tests/auto/input/axis/tst_axis.cpp
+++ b/tests/auto/input/axis/tst_axis.cpp
@@ -1,48 +1,55 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <Qt3DInput/private/axis_p.h>
-#include <Qt3DInput/QAxisInput>
+#include <Qt3DInput/private/qabstractaxisinput_p.h>
+#include <Qt3DInput/QAnalogAxisInput>
#include <Qt3DInput/QAxis>
+#include <Qt3DCore/private/qbackendnode_p.h>
+#include "testpostmanarbiter.h"
+
+class DummyAxisInput : public Qt3DInput::QAbstractAxisInput
+{
+ Q_OBJECT
+public:
+ DummyAxisInput(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DInput::QAbstractAxisInput(*new Qt3DInput::QAbstractAxisInputPrivate, parent)
+ {}
+};
-class tst_Axis: public QObject
+class tst_Axis: public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
@@ -53,18 +60,16 @@ private Q_SLOTS:
// GIVEN
Qt3DInput::Input::Axis backendAxis;
Qt3DInput::QAxis axis;
- Qt3DInput::QAxisInput axisInput;
+ Qt3DInput::QAnalogAxisInput axisInput;
axis.addInput(&axisInput);
- axis.setName(QStringLiteral("L88"));
// WHEN
- backendAxis.setPeer(&axis);
+ simulateInitialization(&axis, &backendAxis);
// THEN
- QCOMPARE(backendAxis.peerUuid(), axis.id());
+ QCOMPARE(backendAxis.peerId(), axis.id());
QCOMPARE(backendAxis.isEnabled(), axis.isEnabled());
- QCOMPARE(backendAxis.name(), axis.name());
QCOMPARE(backendAxis.inputs().size(), axis.inputs().size());
const int inputsCount = backendAxis.inputs().size();
@@ -80,27 +85,23 @@ private Q_SLOTS:
Qt3DInput::Input::Axis backendAxis;
// THEN
- QVERIFY(backendAxis.peerUuid().isNull());
- QVERIFY(backendAxis.name().isEmpty());
+ QVERIFY(backendAxis.peerId().isNull());
QCOMPARE(backendAxis.axisValue(), 0.0f);
QCOMPARE(backendAxis.isEnabled(), false);
QCOMPARE(backendAxis.inputs().size(), 0);
// GIVEN
Qt3DInput::QAxis axis;
- Qt3DInput::QAxisInput axisInput;
+ Qt3DInput::QAnalogAxisInput axisInput;
axis.addInput(&axisInput);
- axis.setName(QStringLiteral("L88"));
// WHEN
- backendAxis.updateFromPeer(&axis);
+ simulateInitialization(&axis, &backendAxis);
backendAxis.setAxisValue(883.0f);
backendAxis.cleanup();
// THEN
- QVERIFY(backendAxis.peerUuid().isNull());
- QVERIFY(backendAxis.name().isEmpty());
QCOMPARE(backendAxis.axisValue(), 0.0f);
QCOMPARE(backendAxis.isEnabled(), false);
QCOMPARE(backendAxis.inputs().size(), 0);
@@ -110,18 +111,10 @@ private Q_SLOTS:
{
// GIVEN
Qt3DInput::Input::Axis backendAxis;
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange;
// WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(QStringLiteral("LT1"));
- updateChange->setPropertyName("name");
- backendAxis.sceneChangeEvent(updateChange);
-
- // THEN
- QCOMPARE(backendAxis.name(), QStringLiteral("LT1"));
-
- // WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setPropertyName("enabled");
updateChange->setValue(true);
backendAxis.sceneChangeEvent(updateChange);
@@ -130,25 +123,54 @@ private Q_SLOTS:
QCOMPARE(backendAxis.isEnabled(), true);
// WHEN
- Qt3DCore::QNodeId inputId = Qt3DCore::QNodeId::createId();
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("input");
- updateChange->setValue(QVariant::fromValue(inputId));
- backendAxis.sceneChangeEvent(updateChange);
+ DummyAxisInput input;
+ const Qt3DCore::QNodeId inputId = input.id();
+ const auto nodeAddedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &input);
+ nodeAddedChange->setPropertyName("input");
+ backendAxis.sceneChangeEvent(nodeAddedChange);
// THEN
QCOMPARE(backendAxis.inputs().size(), 1);
QCOMPARE(backendAxis.inputs().first(), inputId);
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("input");
- updateChange->setValue(QVariant::fromValue(inputId));
- backendAxis.sceneChangeEvent(updateChange);
+ const auto nodeRemovedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &input);
+ nodeRemovedChange->setPropertyName("input");
+ backendAxis.sceneChangeEvent(nodeRemovedChange);
// THEN
QCOMPARE(backendAxis.inputs().size(), 0);
}
+
+ void checkValuePropertyBackendNotification()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DInput::Input::Axis backendAxis;
+ Qt3DCore::QBackendNodePrivate::get(&backendAxis)->setArbiter(&arbiter);
+
+ // WHEN
+ backendAxis.setAxisValue(454.0f);
+
+ // THEN
+ QCOMPARE(backendAxis.axisValue(), 454.0f);
+ QCOMPARE(arbiter.events.count(), 1);
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "value");
+ QCOMPARE(change->value().toFloat(), backendAxis.axisValue());
+
+ arbiter.events.clear();
+
+ // WHEN
+ backendAxis.setAxisValue(454.0f);
+
+ // THEN
+ QCOMPARE(backendAxis.axisValue(), 454.0f);
+ QCOMPARE(arbiter.events.count(), 0);
+
+ arbiter.events.clear();
+
+ }
};
QTEST_APPLESS_MAIN(tst_Axis)
diff --git a/tests/auto/input/axisinput/axisinput.pro b/tests/auto/input/axisinput/axisinput.pro
deleted file mode 100644
index 8378c1608..000000000
--- a/tests/auto/input/axisinput/axisinput.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_axisinput
-
-QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_axisinput.cpp
-
-include(../commons/commons.pri)
diff --git a/tests/auto/input/axisinput/tst_axisinput.cpp b/tests/auto/input/axisinput/tst_axisinput.cpp
deleted file mode 100644
index 1b1879443..000000000
--- a/tests/auto/input/axisinput/tst_axisinput.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DInput/private/axisinput_p.h>
-#include <Qt3DInput/QAxisInput>
-#include <Qt3DCore/qscenepropertychange.h>
-#include "testdevice.h"
-
-namespace {
-
-void compareKeys(const QVector<int> &backendKeys, const QVariantList &frontendKeys)
-{
- QCOMPARE(backendKeys.size(), frontendKeys.size());
- for (int i = 0, m = backendKeys.size(); i < m; ++i) {
- QCOMPARE(backendKeys.at(i), frontendKeys.at(i).toInt());
- }
-}
-
-}
-
-class tst_AxisInput: public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void checkPeerPropertyMirroring()
- {
- // GIVEN
- Qt3DInput::Input::AxisInput backendAxisInput;
- Qt3DInput::QAxisInput axisInput;
- TestDevice sourceDevice;
-
- axisInput.setKeys(QVariantList() << QVariant(1 << 8));
- axisInput.setAxis(327);
- axisInput.setScale(0.5f);
- axisInput.setSourceDevice(&sourceDevice);
-
- // WHEN
- backendAxisInput.setPeer(&axisInput);
-
- // THEN
- QCOMPARE(backendAxisInput.peerUuid(), axisInput.id());
- QCOMPARE(backendAxisInput.isEnabled(), axisInput.isEnabled());
- compareKeys(backendAxisInput.keys(), axisInput.keys());
- QCOMPARE(backendAxisInput.axis(), axisInput.axis());
- QCOMPARE(backendAxisInput.scale(), axisInput.scale());
- QCOMPARE(backendAxisInput.sourceDevice(), sourceDevice.id());
- }
-
- void checkInitialAndCleanedUpState()
- {
- // GIVEN
- Qt3DInput::Input::AxisInput backendAxisInput;
-
- // THEN
- QVERIFY(backendAxisInput.peerUuid().isNull());
- QCOMPARE(backendAxisInput.scale(), 0.0f);
- QVERIFY(backendAxisInput.keys().isEmpty());
- QCOMPARE(backendAxisInput.axis(), 0);
- QCOMPARE(backendAxisInput.isEnabled(), false);
- QCOMPARE(backendAxisInput.sourceDevice(), Qt3DCore::QNodeId());
-
- // GIVEN
- Qt3DInput::QAxisInput axisInput;
- TestDevice sourceDevice;
-
- axisInput.setKeys(QVariantList() << QVariant(1 << 8));
- axisInput.setAxis(327);
- axisInput.setScale(0.5f);
- axisInput.setSourceDevice(&sourceDevice);
-
- // WHEN
- backendAxisInput.updateFromPeer(&axisInput);
- backendAxisInput.cleanup();
-
- // THEN
- QVERIFY(backendAxisInput.peerUuid().isNull());
- QCOMPARE(backendAxisInput.scale(), 0.0f);
- QVERIFY(backendAxisInput.keys().isEmpty());
- QCOMPARE(backendAxisInput.axis(), 0);
- QCOMPARE(backendAxisInput.isEnabled(), false);
- QCOMPARE(backendAxisInput.sourceDevice(), Qt3DCore::QNodeId());
- }
-
- void checkPropertyChanges()
- {
- // GIVEN
- Qt3DInput::Input::AxisInput backendAxisInput;
-
- // WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(32);
- updateChange->setPropertyName("axis");
- backendAxisInput.sceneChangeEvent(updateChange);
-
- // THEN
- QCOMPARE(backendAxisInput.axis(), 32);
-
- // WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(QVariantList() << QVariant(64));
- updateChange->setPropertyName("keys");
- backendAxisInput.sceneChangeEvent(updateChange);
-
- // THEN
- compareKeys(backendAxisInput.keys(), QVariantList() << QVariant(64));
-
- // WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(0.5f);
- updateChange->setPropertyName("scale");
- backendAxisInput.sceneChangeEvent(updateChange);
-
- // THEN
- QCOMPARE(backendAxisInput.scale(), 0.5f);
-
- // WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("enabled");
- updateChange->setValue(true);
- backendAxisInput.sceneChangeEvent(updateChange);
-
- // THEN
- QCOMPARE(backendAxisInput.isEnabled(), true);
-
- // WHEN
- TestDevice device;
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("sourceDevice");
- updateChange->setValue(QVariant::fromValue(device.id()));
- backendAxisInput.sceneChangeEvent(updateChange);
-
- // THEN
- QCOMPARE(backendAxisInput.sourceDevice(), device.id());
- }
-};
-
-QTEST_APPLESS_MAIN(tst_AxisInput)
-
-#include "tst_axisinput.moc"
diff --git a/tests/auto/input/buttonaxisinput/buttonaxisinput.pro b/tests/auto/input/buttonaxisinput/buttonaxisinput.pro
new file mode 100644
index 000000000..f012ca1d3
--- /dev/null
+++ b/tests/auto/input/buttonaxisinput/buttonaxisinput.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_buttonaxisinput
+
+QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_buttonaxisinput.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/input/buttonaxisinput/tst_buttonaxisinput.cpp b/tests/auto/input/buttonaxisinput/tst_buttonaxisinput.cpp
new file mode 100644
index 000000000..d4f3702e6
--- /dev/null
+++ b/tests/auto/input/buttonaxisinput/tst_buttonaxisinput.cpp
@@ -0,0 +1,279 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <qbackendnodetester.h>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DInput/private/buttonaxisinput_p.h>
+#include <Qt3DInput/QButtonAxisInput>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include "testdevice.h"
+
+class tst_ButtonAxisInput: public Qt3DCore::QBackendNodeTester
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkPeerPropertyMirroring()
+ {
+ // GIVEN
+ Qt3DInput::Input::ButtonAxisInput backendAxisInput;
+ Qt3DInput::QButtonAxisInput axisInput;
+ TestDevice sourceDevice;
+
+ axisInput.setButtons(QVector<int>() << (1 << 8));
+ axisInput.setScale(0.5f);
+ axisInput.setAcceleration(0.42f);
+ axisInput.setDeceleration(0.43f);
+ axisInput.setSourceDevice(&sourceDevice);
+
+ // WHEN
+ simulateInitialization(&axisInput, &backendAxisInput);
+
+ // THEN
+ QCOMPARE(backendAxisInput.peerId(), axisInput.id());
+ QCOMPARE(backendAxisInput.isEnabled(), axisInput.isEnabled());
+ QCOMPARE(backendAxisInput.buttons(), axisInput.buttons());
+ QCOMPARE(backendAxisInput.scale(), axisInput.scale());
+ QCOMPARE(backendAxisInput.acceleration(), axisInput.acceleration());
+ QCOMPARE(backendAxisInput.deceleration(), axisInput.deceleration());
+ QCOMPARE(backendAxisInput.sourceDevice(), sourceDevice.id());
+
+ QCOMPARE(backendAxisInput.speedRatio(), 0.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 0);
+ }
+
+ void checkInitialAndCleanedUpState()
+ {
+ // GIVEN
+ Qt3DInput::Input::ButtonAxisInput backendAxisInput;
+
+ // THEN
+ QVERIFY(backendAxisInput.peerId().isNull());
+ QCOMPARE(backendAxisInput.scale(), 0.0f);
+ QVERIFY(qIsInf(backendAxisInput.acceleration()));
+ QVERIFY(qIsInf(backendAxisInput.deceleration()));
+ QCOMPARE(backendAxisInput.speedRatio(), 0.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 0);
+ QVERIFY(backendAxisInput.buttons().isEmpty());
+ QCOMPARE(backendAxisInput.isEnabled(), false);
+ QCOMPARE(backendAxisInput.sourceDevice(), Qt3DCore::QNodeId());
+
+ // GIVEN
+ Qt3DInput::QButtonAxisInput axisInput;
+ TestDevice sourceDevice;
+
+ axisInput.setButtons(QVector<int>() << (1 << 8));
+ axisInput.setScale(0.5f);
+ axisInput.setSourceDevice(&sourceDevice);
+
+ // WHEN
+ simulateInitialization(&axisInput, &backendAxisInput);
+ backendAxisInput.cleanup();
+
+ // THEN
+ QCOMPARE(backendAxisInput.scale(), 0.0f);
+ QVERIFY(qIsInf(backendAxisInput.acceleration()));
+ QVERIFY(qIsInf(backendAxisInput.deceleration()));
+ QCOMPARE(backendAxisInput.speedRatio(), 0.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 0);
+ QVERIFY(backendAxisInput.buttons().isEmpty());
+ QCOMPARE(backendAxisInput.isEnabled(), false);
+ QCOMPARE(backendAxisInput.sourceDevice(), Qt3DCore::QNodeId());
+ }
+
+ void checkPropertyChanges()
+ {
+ // GIVEN
+ Qt3DInput::Input::ButtonAxisInput backendAxisInput;
+
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(QVariant::fromValue(QVector<int>() << 64));
+ updateChange->setPropertyName("buttons");
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.buttons(), QVector<int>() << 64);
+
+ // WHEN
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(0.5f);
+ updateChange->setPropertyName("scale");
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.scale(), 0.5f);
+
+ // WHEN
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("enabled");
+ updateChange->setValue(true);
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.isEnabled(), true);
+
+ // WHEN
+ TestDevice device;
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("sourceDevice");
+ updateChange->setValue(QVariant::fromValue(device.id()));
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.sourceDevice(), device.id());
+
+ // WHEN
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(0.42f);
+ updateChange->setPropertyName("acceleration");
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.acceleration(), 0.42f);
+
+ // WHEN
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(-0.42f);
+ updateChange->setPropertyName("acceleration");
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QVERIFY(qIsInf(backendAxisInput.acceleration()));
+
+ // WHEN
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(0.43f);
+ updateChange->setPropertyName("deceleration");
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QCOMPARE(backendAxisInput.deceleration(), 0.43f);
+
+ // WHEN
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(-0.43f);
+ updateChange->setPropertyName("deceleration");
+ backendAxisInput.sceneChangeEvent(updateChange);
+
+ // THEN
+ QVERIFY(qIsInf(backendAxisInput.deceleration()));
+ }
+
+ void shouldUpdateSpeedRatioOverTime()
+ {
+ const qint64 s = 1000000000;
+
+ // GIVEN
+ Qt3DInput::Input::ButtonAxisInput backendAxisInput;
+ Qt3DInput::QButtonAxisInput axisInput;
+ axisInput.setAcceleration(0.15f);
+ axisInput.setDeceleration(0.3f);
+ simulateInitialization(&axisInput, &backendAxisInput);
+ QCOMPARE(backendAxisInput.speedRatio(), 0.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 0);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(30 * s, Qt3DInput::Input::ButtonAxisInput::Accelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 0.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 30 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(31 * s, Qt3DInput::Input::ButtonAxisInput::Accelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 0.15f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 31 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(32 * s, Qt3DInput::Input::ButtonAxisInput::Accelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 0.3f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 32 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(35 * s, Qt3DInput::Input::ButtonAxisInput::Accelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 0.75f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 35 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(37 * s, Qt3DInput::Input::ButtonAxisInput::Accelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 1.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 37 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(38 * s, Qt3DInput::Input::ButtonAxisInput::Accelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 1.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 38 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(42 * s, Qt3DInput::Input::ButtonAxisInput::Accelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 1.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 42 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(43 * s, Qt3DInput::Input::ButtonAxisInput::Decelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 0.7f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 43 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(45 * s, Qt3DInput::Input::ButtonAxisInput::Decelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 0.1f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 45 * s);
+
+ // WHEN
+ backendAxisInput.updateSpeedRatio(46 * s, Qt3DInput::Input::ButtonAxisInput::Decelerate);
+
+ // THEN
+ QCOMPARE(backendAxisInput.speedRatio(), 0.0f);
+ QCOMPARE(backendAxisInput.lastUpdateTime(), 0);
+ }
+};
+
+QTEST_APPLESS_MAIN(tst_ButtonAxisInput)
+
+#include "tst_buttonaxisinput.moc"
diff --git a/tests/auto/input/commons/testdevice.h b/tests/auto/input/commons/testdevice.h
index b8e048a86..c58835a38 100644
--- a/tests/auto/input/commons/testdevice.h
+++ b/tests/auto/input/commons/testdevice.h
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -41,28 +33,14 @@ class TestDevice : public Qt3DInput::QAbstractPhysicalDevice
{
Q_OBJECT
public:
- explicit TestDevice(Qt3DCore::QNode *parent = Q_NULLPTR)
+ explicit TestDevice(Qt3DCore::QNode *parent = nullptr)
: Qt3DInput::QAbstractPhysicalDevice(parent)
{}
- ~TestDevice()
- {
- QNode::cleanup();
- }
-
int axisCount() const Q_DECL_FINAL { return 0; }
int buttonCount() const Q_DECL_FINAL { return 0; }
QStringList axisNames() const Q_DECL_FINAL { return QStringList(); }
QStringList buttonNames() const Q_DECL_FINAL { return QStringList(); }
int axisIdentifier(const QString &name) const Q_DECL_FINAL { Q_UNUSED(name) return 0; }
int buttonIdentifier(const QString &name) const Q_DECL_FINAL { Q_UNUSED(name) return 0; }
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL
- {
- QAbstractPhysicalDevice::copy(ref);
- }
-
-private:
- QT3D_CLONEABLE(TestDevice)
};
diff --git a/tests/auto/input/input.pro b/tests/auto/input/input.pro
index 7c53d98c7..836e57d37 100644
--- a/tests/auto/input/input.pro
+++ b/tests/auto/input/input.pro
@@ -4,10 +4,14 @@ contains(QT_CONFIG, private_tests) {
SUBDIRS += \
qaxis \
qaction \
- qaxisinput \
qactioninput \
+ qabstractaxisinput \
+ qanalogaxisinput \
+ qbuttonaxisinput \
qlogicaldevice \
axis \
action \
- axisinput
+ abstractaxisinput \
+ analogaxisinput \
+ buttonaxisinput
}
diff --git a/tests/auto/input/qabstractaxisinput/qabstractaxisinput.pro b/tests/auto/input/qabstractaxisinput/qabstractaxisinput.pro
new file mode 100644
index 000000000..7d34cfc2a
--- /dev/null
+++ b/tests/auto/input/qabstractaxisinput/qabstractaxisinput.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_qabstractaxisinput
+
+QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qabstractaxisinput.cpp
+
+include(../../render/commons/commons.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/input/qabstractaxisinput/tst_qabstractaxisinput.cpp b/tests/auto/input/qabstractaxisinput/tst_qabstractaxisinput.cpp
new file mode 100644
index 000000000..f0d8aeddd
--- /dev/null
+++ b/tests/auto/input/qabstractaxisinput/tst_qabstractaxisinput.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+
+#include <Qt3DInput/QAbstractAxisInput>
+#include <Qt3DInput/QAbstractPhysicalDevice>
+#include <Qt3DInput/private/qabstractaxisinput_p.h>
+
+#include "testpostmanarbiter.h"
+#include "testdevice.h"
+
+class DummyAxisInput : public Qt3DInput::QAbstractAxisInput
+{
+ Q_OBJECT
+public:
+ explicit DummyAxisInput(QNode *parent = nullptr)
+ : Qt3DInput::QAbstractAxisInput(*new Qt3DInput::QAbstractAxisInputPrivate, parent)
+ {
+ }
+};
+
+class tst_QAbstractAxisInput: public QObject
+{
+ Q_OBJECT
+public:
+ tst_QAbstractAxisInput()
+ {
+ qRegisterMetaType<Qt3DInput::QAbstractPhysicalDevice*>("Qt3DInput::QAbstractPhysicalDevice*");
+ qRegisterMetaType<Qt3DCore::QNode*>("Qt3DCore::QNode*");
+ }
+
+private Q_SLOTS:
+ void checkPropertyUpdates()
+ {
+ // GIVEN
+ QScopedPointer<Qt3DInput::QAbstractAxisInput> axisInput(new DummyAxisInput());
+ TestArbiter arbiter(axisInput.data());
+
+ // WHEN
+ TestDevice *device = new TestDevice(axisInput.data());
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+
+ axisInput->setSourceDevice(device);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "sourceDevice");
+ QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), device->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+};
+
+QTEST_MAIN(tst_QAbstractAxisInput)
+
+#include "tst_qabstractaxisinput.moc"
diff --git a/tests/auto/input/qaction/tst_qaction.cpp b/tests/auto/input/qaction/tst_qaction.cpp
index 379749476..cbfc7d756 100644
--- a/tests/auto/input/qaction/tst_qaction.cpp
+++ b/tests/auto/input/qaction/tst_qaction.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,15 +29,23 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DInput/QAction>
#include <Qt3DInput/QActionInput>
+#include <Qt3DInput/private/qaction_p.h>
+#include <Qt3DInput/private/qactioninput_p.h>
+
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
#include "testpostmanarbiter.h"
// We need to call QNode::clone which is protected
+// We need to call QAction::sceneChangeEvent which is protected
// So we sublcass QNode instead of QObject
-class tst_QAction: public Qt3DCore::QNode
+class tst_QAction: public Qt3DInput::QAction
{
Q_OBJECT
public:
@@ -53,11 +53,6 @@ public:
{
}
- ~tst_QAction()
- {
- QNode::cleanup();
- }
-
private Q_SLOTS:
void checkCloning_data()
@@ -68,14 +63,12 @@ private Q_SLOTS:
QTest::newRow("defaultConstructed") << defaultConstructed;
Qt3DInput::QAction *namedaction = new Qt3DInput::QAction();
- namedaction->setName(QStringLiteral("fire"));
QTest::newRow("namedAction") << namedaction;
Qt3DInput::QAction *namedactionWithInputs = new Qt3DInput::QAction();
Qt3DInput::QActionInput *actionInput1 = new Qt3DInput::QActionInput();
Qt3DInput::QActionInput *actionInput2 = new Qt3DInput::QActionInput();
Qt3DInput::QActionInput *actionInput3 = new Qt3DInput::QActionInput();
- namedactionWithInputs->setName("accelerate");
namedactionWithInputs->addInput(actionInput1);
namedactionWithInputs->addInput(actionInput2);
namedactionWithInputs->addInput(actionInput3);
@@ -88,19 +81,26 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QAction *, action);
// WHEN
- Qt3DInput::QAction *clone = static_cast<Qt3DInput::QAction *>(QNode::clone(action));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(action);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(action->id(), clone->id());
- QCOMPARE(action->name(), clone->name());
- QCOMPARE(action->inputs().count(), clone->inputs().count());
+ QCOMPARE(creationChanges.size(), 1 + action->inputs().size());
- for (int i = 0, m = action->inputs().count(); i < m; ++i) {
- QCOMPARE(action->inputs().at(i)->id(), clone->inputs().at(i)->id());
- }
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QActionData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QActionData>>(creationChanges.first());
+ const Qt3DInput::QActionData &cloneActionData = creationChangeData->data;
+ // THEN
+ QCOMPARE(creationChangeData->subjectId(), action->id());
+ QCOMPARE(creationChangeData->isNodeEnabled(), action->isEnabled());
+ QCOMPARE(creationChangeData->metaObject(), action->metaObject());
+ QCOMPARE(creationChangeData->parentId(), action->parentNode() ? action->parentNode()->id() : Qt3DCore::QNodeId());
+ QCOMPARE(cloneActionData.inputIds.size(), action->inputs().size());
+
+ const QVector<Qt3DInput::QAbstractActionInput *> &inputs = action->inputs();
+ for (int i = 0, m = inputs.size(); i < m; ++i)
+ QCOMPARE(cloneActionData.inputIds.at(i), inputs.at(i)->id());
}
void checkPropertyUpdates()
@@ -110,29 +110,16 @@ private Q_SLOTS:
TestArbiter arbiter(action.data());
// WHEN
- action->setName(QStringLiteral("454"));
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "name");
- QCOMPARE(change->value().toString(), QStringLiteral("454"));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
Qt3DInput::QActionInput *input = new Qt3DInput::QActionInput();
action->addInput(input);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyNodeAddedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
QCOMPARE(change->propertyName(), "input");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), input->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ QCOMPARE(change->addedNodeId(), input->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -142,20 +129,29 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "input");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), input->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "input");
+ QCOMPARE(nodeRemovedChange->removedNodeId(), input->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
}
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
+ void checkActivePropertyChanged()
{
- return Q_NULLPTR;
- }
+ // GIVEN
+ QCOMPARE(isActive(), false);
+
+ // Note: simulate backend change to frontend
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("active");
+ valueChange->setValue(true);
+ sceneChangeEvent(valueChange);
+ // THEN
+ QCOMPARE(isActive(), true);
+ }
};
QTEST_MAIN(tst_QAction)
diff --git a/tests/auto/input/qactioninput/tst_qactioninput.cpp b/tests/auto/input/qactioninput/tst_qactioninput.cpp
index 77275c2cb..b6920af4d 100644
--- a/tests/auto/input/qactioninput/tst_qactioninput.cpp
+++ b/tests/auto/input/qactioninput/tst_qactioninput.cpp
@@ -1,52 +1,45 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <Qt3DCore/qnodeid.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+#include <Qt3DInput/private/qactioninput_p.h>
#include <Qt3DInput/QActionInput>
#include <Qt3DInput/QAbstractPhysicalDevice>
#include "testpostmanarbiter.h"
#include "testdevice.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QActionInput: public Qt3DCore::QNode
+class tst_QActionInput: public QObject
{
Q_OBJECT
public:
@@ -55,11 +48,6 @@ public:
qRegisterMetaType<Qt3DInput::QAbstractPhysicalDevice*>("Qt3DInput::QAbstractPhysicalDevice*");
}
- ~tst_QActionInput()
- {
- QNode::cleanup();
- }
-
private Q_SLOTS:
void checkCloning_data()
{
@@ -69,12 +57,12 @@ private Q_SLOTS:
QTest::newRow("defaultConstructed") << defaultConstructed;
Qt3DInput::QActionInput *actionInputWithKeys = new Qt3DInput::QActionInput();
- actionInputWithKeys->setKeys(QVariantList() << QVariant((1 << 1) | (1 << 5)));
+ actionInputWithKeys->setButtons(QVector<int>() << ((1 << 1) | (1 << 5)));
QTest::newRow("actionInputWithKeys") << actionInputWithKeys;
Qt3DInput::QActionInput *actionInputWithKeysAndSourceDevice = new Qt3DInput::QActionInput();
TestDevice *device = new TestDevice();
- actionInputWithKeysAndSourceDevice->setKeys(QVariantList() << QVariant((1 << 1) | (1 << 5)));
+ actionInputWithKeysAndSourceDevice->setButtons(QVector<int>() << ((1 << 1) | (1 << 5)));
actionInputWithKeysAndSourceDevice->setSourceDevice(device);
QTest::newRow("actionInputWithKeysAndSourceDevice") << actionInputWithKeysAndSourceDevice;
}
@@ -85,18 +73,22 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QActionInput *, actionInput);
// WHEN
- Qt3DInput::QActionInput *clone = static_cast<Qt3DInput::QActionInput *>(QNode::clone(actionInput));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(actionInput);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(actionInput->id(), clone->id());
- QCOMPARE(actionInput->keys(), clone->keys());
-
- if (actionInput->sourceDevice() != Q_NULLPTR) {
- QVERIFY(clone->sourceDevice() != Q_NULLPTR);
- QCOMPARE(clone->sourceDevice()->id(), actionInput->sourceDevice()->id());
- }
+ QCOMPARE(creationChanges.size(), 1 + (actionInput->sourceDevice() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QActionInputData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QActionInputData>>(creationChanges.first());
+ const Qt3DInput::QActionInputData &cloneData = creationChangeData->data;
+
+ // THEN
+ QCOMPARE(actionInput->id(), creationChangeData->subjectId());
+ QCOMPARE(actionInput->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(actionInput->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(actionInput->buttons(), cloneData.buttons);
+ QCOMPARE(actionInput->sourceDevice() ? actionInput->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.sourceDeviceId);
}
void checkPropertyUpdates()
@@ -106,40 +98,36 @@ private Q_SLOTS:
TestArbiter arbiter(actionInput.data());
// WHEN
- QVariantList keys = QVariantList() << QVariant(555);
- actionInput->setKeys(keys);
+ QVector<int> buttons = QVector<int>() << 555;
+ actionInput->setButtons(buttons);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "keys");
- QCOMPARE(change->value().toList(), keys);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "buttons");
+ QCOMPARE(change->value().value<QVector<int>>(), buttons);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
TestDevice *device = new TestDevice(actionInput.data());
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+
actionInput->setSourceDevice(device);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "sourceDevice");
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), device->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QActionInput)
diff --git a/tests/auto/input/qanalogaxisinput/qanalogaxisinput.pro b/tests/auto/input/qanalogaxisinput/qanalogaxisinput.pro
new file mode 100644
index 000000000..e693c160b
--- /dev/null
+++ b/tests/auto/input/qanalogaxisinput/qanalogaxisinput.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_qanalogaxisinput
+
+QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qanalogaxisinput.cpp
+
+include(../../render/commons/commons.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/input/qanalogaxisinput/tst_qanalogaxisinput.cpp b/tests/auto/input/qanalogaxisinput/tst_qanalogaxisinput.cpp
new file mode 100644
index 000000000..0c98b5d55
--- /dev/null
+++ b/tests/auto/input/qanalogaxisinput/tst_qanalogaxisinput.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+
+#include <Qt3DInput/QAnalogAxisInput>
+#include <Qt3DInput/QAbstractPhysicalDevice>
+#include <Qt3DInput/private/qanalogaxisinput_p.h>
+
+#include "testpostmanarbiter.h"
+#include "testdevice.h"
+
+class tst_QAnalogAxisInput: public QObject
+{
+ Q_OBJECT
+public:
+ tst_QAnalogAxisInput()
+ {
+ qRegisterMetaType<Qt3DInput::QAbstractPhysicalDevice*>("Qt3DInput::QAbstractPhysicalDevice*");
+ }
+
+private Q_SLOTS:
+ void checkCloning_data()
+ {
+ QTest::addColumn<Qt3DInput::QAnalogAxisInput *>("axisInput");
+
+ Qt3DInput::QAnalogAxisInput *defaultConstructed = new Qt3DInput::QAnalogAxisInput();
+ QTest::newRow("defaultConstructed") << defaultConstructed;
+
+ Qt3DInput::QAnalogAxisInput *axisInputWithAxis = new Qt3DInput::QAnalogAxisInput();
+ axisInputWithAxis->setAxis(383);
+ QTest::newRow("axisInputWithAxis") << axisInputWithAxis;
+
+ Qt3DInput::QAnalogAxisInput *axisInputWithAxisAndSourceDevice = new Qt3DInput::QAnalogAxisInput();
+ TestDevice *device = new TestDevice();
+ axisInputWithAxisAndSourceDevice->setSourceDevice(device);
+ axisInputWithAxisAndSourceDevice->setAxis(427);
+ QTest::newRow("axisInputWithAxisAndSourceDevice") << axisInputWithAxisAndSourceDevice;
+ }
+
+ void checkCloning()
+ {
+ // GIVEN
+ QFETCH(Qt3DInput::QAnalogAxisInput *, axisInput);
+
+ // WHEN
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(axisInput);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1 + (axisInput->sourceDevice() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QAnalogAxisInputData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QAnalogAxisInputData>>(creationChanges.first());
+ const Qt3DInput::QAnalogAxisInputData &cloneData = creationChangeData->data;
+ QCOMPARE(axisInput->id(), creationChangeData->subjectId());
+ QCOMPARE(axisInput->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(axisInput->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(axisInput->axis(), cloneData.axis);
+ QCOMPARE(axisInput->sourceDevice() ? axisInput->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.sourceDeviceId);
+ }
+
+ void checkPropertyUpdates()
+ {
+ // GIVEN
+ QScopedPointer<Qt3DInput::QAnalogAxisInput> axisInput(new Qt3DInput::QAnalogAxisInput());
+ TestArbiter arbiter(axisInput.data());
+
+ // WHEN
+ axisInput->setAxis(350);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "axis");
+ QCOMPARE(change->value().toInt(), 350);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+
+ // WHEN
+ TestDevice *device = new TestDevice(axisInput.data());
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+
+ axisInput->setSourceDevice(device);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "sourceDevice");
+ QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), device->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+};
+
+QTEST_MAIN(tst_QAnalogAxisInput)
+
+#include "tst_qanalogaxisinput.moc"
diff --git a/tests/auto/input/qaxis/tst_qaxis.cpp b/tests/auto/input/qaxis/tst_qaxis.cpp
index 8eb3e3b6d..70c9a9a48 100644
--- a/tests/auto/input/qaxis/tst_qaxis.cpp
+++ b/tests/auto/input/qaxis/tst_qaxis.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,15 +29,22 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DInput/QAxis>
-#include <Qt3DInput/QAxisInput>
+#include <Qt3DInput/QAnalogAxisInput>
+#include <Qt3DInput/private/qaxis_p.h>
+
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
#include "testpostmanarbiter.h"
// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QAxis: public Qt3DCore::QNode
+// We need to call QAxis::sceneChangeEvent which is protected
+// So we sublcass QAxis instead of QObject
+class tst_QAxis: public Qt3DInput::QAxis
{
Q_OBJECT
public:
@@ -53,11 +52,6 @@ public:
{
}
- ~tst_QAxis()
- {
- QNode::cleanup();
- }
-
private Q_SLOTS:
void checkCloning_data()
@@ -68,14 +62,12 @@ private Q_SLOTS:
QTest::newRow("defaultConstructed") << defaultConstructed;
Qt3DInput::QAxis *namedAxis = new Qt3DInput::QAxis();
- namedAxis->setName(QStringLiteral("moveForward"));
QTest::newRow("namedAxis") << namedAxis;
Qt3DInput::QAxis *namedAxisWithInputs = new Qt3DInput::QAxis();
- Qt3DInput::QAxisInput *axisInput1 = new Qt3DInput::QAxisInput();
- Qt3DInput::QAxisInput *axisInput2 = new Qt3DInput::QAxisInput();
- Qt3DInput::QAxisInput *axisInput3 = new Qt3DInput::QAxisInput();
- namedAxisWithInputs->setName("moveBackward");
+ Qt3DInput::QAbstractAxisInput *axisInput1 = new Qt3DInput::QAnalogAxisInput();
+ Qt3DInput::QAbstractAxisInput *axisInput2 = new Qt3DInput::QAnalogAxisInput();
+ Qt3DInput::QAbstractAxisInput *axisInput3 = new Qt3DInput::QAnalogAxisInput();
namedAxisWithInputs->addInput(axisInput1);
namedAxisWithInputs->addInput(axisInput2);
namedAxisWithInputs->addInput(axisInput3);
@@ -88,19 +80,24 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QAxis *, axis);
// WHEN
- Qt3DInput::QAxis *clone = static_cast<Qt3DInput::QAxis *>(QNode::clone(axis));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(axis);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(axis->id(), clone->id());
- QCOMPARE(axis->name(), clone->name());
- QCOMPARE(axis->inputs().count(), clone->inputs().count());
+ QCOMPARE(creationChanges.size(), 1 + axis->inputs().size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QAxisData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QAxisData>>(creationChanges.first());
+ const Qt3DInput::QAxisData &cloneData = creationChangeData->data;
- for (int i = 0, m = axis->inputs().count(); i < m; ++i) {
- QCOMPARE(axis->inputs().at(i)->id(), clone->inputs().at(i)->id());
- }
+ // THEN
+ QCOMPARE(axis->id(), creationChangeData->subjectId());
+ QCOMPARE(axis->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(axis->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(axis->inputs().count(), cloneData.inputIds.count());
+ for (int i = 0, m = axis->inputs().count(); i < m; ++i)
+ QCOMPARE(axis->inputs().at(i)->id(), cloneData.inputIds.at(i));
}
void checkPropertyUpdates()
@@ -110,29 +107,16 @@ private Q_SLOTS:
TestArbiter arbiter(axis.data());
// WHEN
- axis->setName(QStringLiteral("454"));
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "name");
- QCOMPARE(change->value().toString(), QStringLiteral("454"));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- Qt3DInput::QAxisInput *input = new Qt3DInput::QAxisInput();
+ Qt3DInput::QAbstractAxisInput *input = new Qt3DInput::QAnalogAxisInput();
axis->addInput(input);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyNodeAddedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
QCOMPARE(change->propertyName(), "input");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), input->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ QCOMPARE(change->addedNodeId(), input->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -142,20 +126,29 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "input");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), input->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "input");
+ QCOMPARE(nodeRemovedChange->removedNodeId(), input->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
}
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
+ void checkValuePropertyChanged()
{
- return Q_NULLPTR;
- }
+ // GIVEN
+ QCOMPARE(value(), 0.0f);
+
+ // Note: simulate backend change to frontend
+ // WHEN
+ Qt3DCore::QPropertyUpdatedChangePtr valueChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ valueChange->setPropertyName("value");
+ valueChange->setValue(383.0f);
+ sceneChangeEvent(valueChange);
+ // THEN
+ QCOMPARE(value(), 383.0f);
+ }
};
QTEST_MAIN(tst_QAxis)
diff --git a/tests/auto/input/qaxisinput/qaxisinput.pro b/tests/auto/input/qaxisinput/qaxisinput.pro
deleted file mode 100644
index ed2598c24..000000000
--- a/tests/auto/input/qaxisinput/qaxisinput.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_qaxisinput
-
-QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_qaxisinput.cpp
-
-include(../../render/commons/commons.pri)
-include(../commons/commons.pri)
diff --git a/tests/auto/input/qaxisinput/tst_qaxisinput.cpp b/tests/auto/input/qaxisinput/tst_qaxisinput.cpp
deleted file mode 100644
index 2dc7e3308..000000000
--- a/tests/auto/input/qaxisinput/tst_qaxisinput.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-
-#include <Qt3DInput/QAxisInput>
-#include <Qt3DInput/QAbstractPhysicalDevice>
-
-#include "testpostmanarbiter.h"
-#include "testdevice.h"
-
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QAxisInput: public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- tst_QAxisInput()
- {
- qRegisterMetaType<Qt3DInput::QAbstractPhysicalDevice*>("Qt3DInput::QAbstractPhysicalDevice*");
- }
-
- ~tst_QAxisInput()
- {
- QNode::cleanup();
- }
-
-private Q_SLOTS:
- void checkCloning_data()
- {
- QTest::addColumn<Qt3DInput::QAxisInput *>("axisInput");
-
- Qt3DInput::QAxisInput *defaultConstructed = new Qt3DInput::QAxisInput();
- QTest::newRow("defaultConstructed") << defaultConstructed;
-
- Qt3DInput::QAxisInput *axisInputWithKeysAndAxis = new Qt3DInput::QAxisInput();
- axisInputWithKeysAndAxis->setKeys(QVariantList() << QVariant((1 << 1) | (1 << 5)));
- axisInputWithKeysAndAxis->setAxis(383);
- axisInputWithKeysAndAxis->setScale(327.0f);
- QTest::newRow("axisInputWithKeys") << axisInputWithKeysAndAxis;
-
- Qt3DInput::QAxisInput *axisInputWithKeysAndSourceDevice = new Qt3DInput::QAxisInput();
- TestDevice *device = new TestDevice();
- axisInputWithKeysAndSourceDevice->setKeys(QVariantList() << QVariant((1 << 1) | (1 << 5)));
- axisInputWithKeysAndSourceDevice->setSourceDevice(device);
- axisInputWithKeysAndSourceDevice->setAxis(427);
- axisInputWithKeysAndAxis->setScale(355.0f);
- QTest::newRow("axisInputWithKeysAndSourceDevice") << axisInputWithKeysAndSourceDevice;
- }
-
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DInput::QAxisInput *, axisInput);
-
- // WHEN
- Qt3DInput::QAxisInput *clone = static_cast<Qt3DInput::QAxisInput *>(QNode::clone(axisInput));
- QCoreApplication::processEvents();
-
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(axisInput->id(), clone->id());
- QCOMPARE(axisInput->keys(), clone->keys());
- QCOMPARE(axisInput->axis(), clone->axis());
- QCOMPARE(axisInput->scale(), clone->scale());
-
- if (axisInput->sourceDevice() != Q_NULLPTR) {
- QVERIFY(clone->sourceDevice() != Q_NULLPTR);
- QCOMPARE(clone->sourceDevice()->id(), axisInput->sourceDevice()->id());
- }
- }
-
- void checkPropertyUpdates()
- {
- // GIVEN
- QScopedPointer<Qt3DInput::QAxisInput> axisInput(new Qt3DInput::QAxisInput());
- TestArbiter arbiter(axisInput.data());
-
- // WHEN
- QVariantList keys = QVariantList() << QVariant(555);
- axisInput->setKeys(keys);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "keys");
- QCOMPARE(change->value().toList(), keys);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- axisInput->setScale(1340.0f);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "scale");
- QCOMPARE(change->value().toFloat(), 1340.0f);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- axisInput->setAxis(350);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "axis");
- QCOMPARE(change->value().toInt(), 350);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- TestDevice *device = new TestDevice(axisInput.data());
- axisInput->setSourceDevice(device);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "sourceDevice");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), device->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
- }
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
-};
-
-QTEST_MAIN(tst_QAxisInput)
-
-#include "tst_qaxisinput.moc"
diff --git a/tests/auto/input/qbuttonaxisinput/qbuttonaxisinput.pro b/tests/auto/input/qbuttonaxisinput/qbuttonaxisinput.pro
new file mode 100644
index 000000000..b149843ea
--- /dev/null
+++ b/tests/auto/input/qbuttonaxisinput/qbuttonaxisinput.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_qbuttonaxisinput
+
+QT += core-private 3dcore 3dcore-private 3dinput 3dinput-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qbuttonaxisinput.cpp
+
+include(../../render/commons/commons.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp b/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp
new file mode 100644
index 000000000..2eb66196b
--- /dev/null
+++ b/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+
+#include <Qt3DInput/QAbstractPhysicalDevice>
+#include <Qt3DInput/QButtonAxisInput>
+#include <Qt3DInput/private/qbuttonaxisinput_p.h>
+
+#include "testpostmanarbiter.h"
+#include "testdevice.h"
+
+class tst_QButtonAxisInput: public QObject
+{
+ Q_OBJECT
+public:
+ tst_QButtonAxisInput()
+ {
+ qRegisterMetaType<Qt3DInput::QAbstractPhysicalDevice*>("Qt3DInput::QAbstractPhysicalDevice*");
+ }
+
+private Q_SLOTS:
+ void checkCloning_data()
+ {
+ QTest::addColumn<Qt3DInput::QButtonAxisInput *>("axisInput");
+
+ Qt3DInput::QButtonAxisInput *defaultConstructed = new Qt3DInput::QButtonAxisInput();
+ QTest::newRow("defaultConstructed") << defaultConstructed;
+
+ Qt3DInput::QButtonAxisInput *axisInputWithKeys = new Qt3DInput::QButtonAxisInput();
+ axisInputWithKeys->setButtons(QVector<int>() << ((1 << 1) | (1 << 5)));
+ axisInputWithKeys->setScale(327.0f);
+ QTest::newRow("axisInputWithKeys") << axisInputWithKeys;
+
+ Qt3DInput::QButtonAxisInput *axisInputWithKeysAndSourceDevice = new Qt3DInput::QButtonAxisInput();
+ TestDevice *device = new TestDevice();
+ axisInputWithKeysAndSourceDevice->setButtons(QVector<int>() << ((1 << 1) | (1 << 5)));
+ axisInputWithKeysAndSourceDevice->setSourceDevice(device);
+ axisInputWithKeysAndSourceDevice->setScale(355.0f);
+ QTest::newRow("axisInputWithKeysAndSourceDevice") << axisInputWithKeysAndSourceDevice;
+
+ Qt3DInput::QButtonAxisInput *axisInputWithAcceleration = new Qt3DInput::QButtonAxisInput();
+ axisInputWithAcceleration->setAcceleration(41.0f);
+ axisInputWithAcceleration->setDeceleration(42.0f);
+ QTest::newRow("axisInputWithAcceleration") << axisInputWithAcceleration;
+ }
+
+ void checkCloning()
+ {
+ // GIVEN
+ QFETCH(Qt3DInput::QButtonAxisInput *, axisInput);
+
+ // WHEN
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(axisInput);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1 + (axisInput->sourceDevice() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QButtonAxisInputData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QButtonAxisInputData>>(creationChanges.first());
+ const Qt3DInput::QButtonAxisInputData &cloneData = creationChangeData->data;
+ QCOMPARE(axisInput->id(), creationChangeData->subjectId());
+ QCOMPARE(axisInput->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(axisInput->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(axisInput->buttons(), cloneData.buttons);
+ QCOMPARE(axisInput->scale(), cloneData.scale);
+ QCOMPARE(axisInput->acceleration(), cloneData.acceleration);
+ QCOMPARE(axisInput->deceleration(), cloneData.deceleration);
+ QCOMPARE(axisInput->sourceDevice() ? axisInput->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.sourceDeviceId);
+ }
+
+ void checkPropertyUpdates()
+ {
+ // GIVEN
+ QScopedPointer<Qt3DInput::QButtonAxisInput> axisInput(new Qt3DInput::QButtonAxisInput());
+ TestArbiter arbiter(axisInput.data());
+
+ // WHEN
+ QVector<int> buttons = QVector<int>() << 555;
+ axisInput->setButtons(buttons);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "buttons");
+ QCOMPARE(change->value().value<QVector<int>>(), buttons);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+
+ // WHEN
+ axisInput->setScale(1340.0f);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "scale");
+ QCOMPARE(change->value().toFloat(), 1340.0f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+
+ // WHEN
+ TestDevice *device = new TestDevice(axisInput.data());
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+
+ axisInput->setSourceDevice(device);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "sourceDevice");
+ QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), device->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+
+ // WHEN
+ axisInput->setAcceleration(42.0f);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "acceleration");
+ QCOMPARE(change->value().toFloat(), 42.0f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+
+ // WHEN
+ axisInput->setDeceleration(43.0f);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "deceleration");
+ QCOMPARE(change->value().toFloat(), 43.0f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+};
+
+QTEST_MAIN(tst_QButtonAxisInput)
+
+#include "tst_qbuttonaxisinput.moc"
diff --git a/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp b/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp
index 6c7a606d4..083fa70ce 100644
--- a/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp
+++ b/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,26 +29,26 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DInput/QLogicalDevice>
+#include <Qt3DInput/private/qlogicaldevice_p.h>
#include <Qt3DInput/QAxis>
#include <Qt3DInput/QAction>
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
+
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QLogicalDevice: public Qt3DCore::QNode
+class tst_QLogicalDevice: public QObject
{
Q_OBJECT
public:
tst_QLogicalDevice()
{
- }
-
- ~tst_QLogicalDevice()
- {
- QNode::cleanup();
+ qRegisterMetaType<Qt3DCore::QNode *>();
}
private Q_SLOTS:
@@ -87,26 +79,31 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QLogicalDevice *, logicalDevice);
// WHEN
- Qt3DInput::QLogicalDevice *clone = static_cast<Qt3DInput::QLogicalDevice *>(QNode::clone(logicalDevice));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(logicalDevice);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(logicalDevice->id(), clone->id());
const int axesCount = logicalDevice->axes().count();
const int actionsCount = logicalDevice->actions().count();
- QCOMPARE(axesCount, clone->axes().count());
- QCOMPARE(actionsCount, clone->actions().count());
-
- if (axesCount > 0) {
- for (int i = 0; i < axesCount; ++i)
- QCOMPARE(logicalDevice->axes().at(i)->id(), clone->axes().at(i)->id());
- }
-
- if (actionsCount > 0) {
- for (int i = 0; i < actionsCount; ++i)
- QCOMPARE(logicalDevice->actions().at(i)->id(), clone->actions().at(i)->id());
- }
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1 + axesCount + actionsCount);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QLogicalDeviceData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QLogicalDeviceData>>(creationChanges.first());
+ const Qt3DInput::QLogicalDeviceData &cloneData = creationChangeData->data;
+
+ // THEN
+ QCOMPARE(logicalDevice->id(), creationChangeData->subjectId());
+ QCOMPARE(logicalDevice->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(logicalDevice->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(axesCount, cloneData.axisIds.count());
+ QCOMPARE(actionsCount, cloneData.actionIds.count());
+
+ for (int i = 0; i < axesCount; ++i)
+ QCOMPARE(logicalDevice->axes().at(i)->id(), cloneData.axisIds.at(i));
+
+ for (int i = 0; i < actionsCount; ++i)
+ QCOMPARE(logicalDevice->actions().at(i)->id(), cloneData.actionIds.at(i));
}
void checkPropertyUpdates()
@@ -117,15 +114,18 @@ private Q_SLOTS:
// WHEN
Qt3DInput::QAction *action = new Qt3DInput::QAction(logicalDevice.data());
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+
logicalDevice->addAction(action);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "action");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), action->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ Qt3DCore::QPropertyNodeAddedChangePtr nodeAddedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(nodeAddedChange->propertyName(), "action");
+ QCOMPARE(nodeAddedChange->addedNodeId(), action->id());
+ QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -135,24 +135,27 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "action");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), action->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "action");
+ QCOMPARE(nodeRemovedChange->removedNodeId(), action->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
// WHEN
Qt3DInput::QAxis *axis = new Qt3DInput::QAxis(logicalDevice.data());
+ QCoreApplication::processEvents();
+ arbiter.events.clear();
+
logicalDevice->addAxis(axis);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "axis");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), axis->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ nodeAddedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(nodeAddedChange->propertyName(), "axis");
+ QCOMPARE(nodeAddedChange->addedNodeId(), axis->id());
+ QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -162,20 +165,13 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "axis");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), axis->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "axis");
+ QCOMPARE(nodeRemovedChange->removedNodeId(), axis->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QLogicalDevice)
diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h b/tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h
index b429866ff..ab0240419 100644
--- a/tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h
+++ b/tests/auto/quick3d/quick3dnodeinstantiator/stringmodel.h
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2013 Dmitrii Kosarev aka Kakadu <kakadu.hafanana@gmail.com>
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -69,7 +61,7 @@ public:
endInsertRows();
}
- int rowCount(const QModelIndex &) const
+ int rowCount(const QModelIndex &) const Q_DECL_OVERRIDE
{
return items.count();
}
@@ -79,7 +71,7 @@ public:
return roles;
}
- virtual int columnCount(const QModelIndex &) const
+ virtual int columnCount(const QModelIndex &) const Q_DECL_OVERRIDE
{
return 1;
}
@@ -89,7 +81,7 @@ public:
return rowCount(QModelIndex()) > 0;
}
- virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE
{
Q_UNUSED(column);
if (row>=0 && row<rowCount(parent))
@@ -98,12 +90,12 @@ public:
return QModelIndex();
}
- virtual QModelIndex parent(const QModelIndex &) const
+ virtual QModelIndex parent(const QModelIndex &) const Q_DECL_OVERRIDE
{
return QModelIndex();
}
- QVariant data (const QModelIndex & index, int role) const
+ QVariant data (const QModelIndex & index, int role) const Q_DECL_OVERRIDE
{
int row = index.row();
if ((row<0) || (row>=items.count()))
diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp b/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp
index eca8be83c..fd7f0eb0c 100644
--- a/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp
+++ b/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp
@@ -2,34 +2,26 @@
**
** Copyright (C) 2013 Research In Motion.
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/render/attribute/attribute.pro b/tests/auto/render/attribute/attribute.pro
index 259053efa..f92871bbc 100644
--- a/tests/auto/render/attribute/attribute.pro
+++ b/tests/auto/render/attribute/attribute.pro
@@ -9,4 +9,5 @@ CONFIG += testcase
SOURCES += \
tst_attribute.cpp
+include(../../core/common/common.pri)
include(../commons/commons.pri)
diff --git a/tests/auto/render/attribute/tst_attribute.cpp b/tests/auto/render/attribute/tst_attribute.cpp
index a22a142ff..b712bd26a 100644
--- a/tests/auto/render/attribute/tst_attribute.cpp
+++ b/tests/auto/render/attribute/tst_attribute.cpp
@@ -1,45 +1,39 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DRender/private/attribute_p.h>
#include <Qt3DRender/qbuffer.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include "testrenderer.h"
-class tst_Attribute : public QObject
+class tst_Attribute : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
private Q_SLOTS:
@@ -56,7 +50,7 @@ private Q_SLOTS:
attribute.setCount(427);
attribute.setDivisor(305);
attribute.setName(QStringLiteral("C3"));
- attribute.setDataType(Qt3DRender::QAbstractAttribute::UnsignedShort);
+ attribute.setDataType(Qt3DRender::QAttribute::UnsignedShort);
attribute.setDataSize(3);
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
@@ -65,13 +59,13 @@ private Q_SLOTS:
attribute.setBuffer(&buffer);
// WHEN
- renderAttribute.setPeer(&attribute);
+ simulateInitialization(&attribute, &renderAttribute);
// THEN
- QCOMPARE(renderAttribute.peerUuid(), attribute.id());
+ QCOMPARE(renderAttribute.peerId(), attribute.id());
QCOMPARE(renderAttribute.isDirty(), true);
- QCOMPARE(renderAttribute.dataType(), attribute.dataType());
- QCOMPARE(renderAttribute.dataSize(), attribute.dataSize());
+ QCOMPARE(renderAttribute.vertexBaseType(), attribute.vertexBaseType());
+ QCOMPARE(renderAttribute.vertexSize(), attribute.vertexSize());
QCOMPARE(renderAttribute.attributeType(), attribute.attributeType());
QCOMPARE(renderAttribute.byteOffset(), attribute.byteOffset());
QCOMPARE(renderAttribute.byteStride(), attribute.byteStride());
@@ -84,15 +78,17 @@ private Q_SLOTS:
void checkInitialAndCleanedUpState()
{
// GIVEN
+ TestRenderer renderer;
Qt3DRender::Render::Attribute renderAttribute;
+ renderAttribute.setRenderer(&renderer);
// THEN
- QVERIFY(renderAttribute.peerUuid().isNull());
+ QVERIFY(renderAttribute.peerId().isNull());
QVERIFY(renderAttribute.bufferId().isNull());
QVERIFY(renderAttribute.name().isEmpty());
QCOMPARE(renderAttribute.isDirty(), false);
- QCOMPARE(renderAttribute.dataType(), Qt3DRender::QAbstractAttribute::Float);
- QCOMPARE(renderAttribute.dataSize(), 1U);
+ QCOMPARE(renderAttribute.vertexBaseType(), Qt3DRender::QAttribute::Float);
+ QCOMPARE(renderAttribute.vertexSize(), 1U);
QCOMPARE(renderAttribute.attributeType(), Qt3DRender::QAttribute::VertexAttribute);
QCOMPARE(renderAttribute.byteOffset(), 0U);
QCOMPARE(renderAttribute.byteStride(), 0U);
@@ -107,7 +103,7 @@ private Q_SLOTS:
attribute.setCount(427);
attribute.setDivisor(305);
attribute.setName(QStringLiteral("C3"));
- attribute.setDataType(Qt3DRender::QAbstractAttribute::Double);
+ attribute.setDataType(Qt3DRender::QAttribute::Double);
attribute.setDataSize(4);
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
buffer.setUsage(Qt3DRender::QBuffer::DynamicCopy);
@@ -115,16 +111,15 @@ private Q_SLOTS:
attribute.setBuffer(&buffer);
// WHEN
- renderAttribute.updateFromPeer(&attribute);
+ simulateInitialization(&attribute, &renderAttribute);
renderAttribute.cleanup();
// THEN
- QVERIFY(renderAttribute.peerUuid().isNull());
QVERIFY(renderAttribute.bufferId().isNull());
QVERIFY(renderAttribute.name().isEmpty());
QCOMPARE(renderAttribute.isDirty(), false);
- QCOMPARE(renderAttribute.dataType(), Qt3DRender::QAbstractAttribute::Float);
- QCOMPARE(renderAttribute.dataSize(), 1U);
+ QCOMPARE(renderAttribute.vertexBaseType(), Qt3DRender::QAttribute::Float);
+ QCOMPARE(renderAttribute.vertexSize(), 1U);
QCOMPARE(renderAttribute.attributeType(), Qt3DRender::QAttribute::VertexAttribute);
QCOMPARE(renderAttribute.byteOffset(), 0U);
QCOMPARE(renderAttribute.byteStride(), 0U);
@@ -135,38 +130,45 @@ private Q_SLOTS:
void checkPropertyChanges()
{
// GIVEN
+ TestRenderer renderer;
Qt3DRender::Render::Attribute renderAttribute;
+ renderAttribute.setRenderer(&renderer);
QVERIFY(!renderAttribute.isDirty());
// WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(static_cast<int>(Qt3DRender::QAbstractAttribute::Int));
- updateChange->setPropertyName("dataType");
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(static_cast<int>(Qt3DRender::QAttribute::Int));
+ updateChange->setPropertyName("vertexBaseType");
renderAttribute.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderAttribute.dataType(), Qt3DRender::QAbstractAttribute::Int);
+ QCOMPARE(renderAttribute.vertexBaseType(), Qt3DRender::QAttribute::Int);
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
+ QVERIFY(!renderer.dirtyBits());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(3);
- updateChange->setPropertyName("dataSize");
+ updateChange->setPropertyName("vertexSize");
renderAttribute.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderAttribute.dataSize(), 3U);
+ QCOMPARE(renderAttribute.vertexSize(), 3U);
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(static_cast<int>(Qt3DRender::QAttribute::IndexAttribute));
updateChange->setPropertyName("attributeType");
renderAttribute.sceneChangeEvent(updateChange);
@@ -174,12 +176,14 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderAttribute.attributeType(), Qt3DRender::QAttribute::IndexAttribute);
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(1340);
updateChange->setPropertyName("count");
renderAttribute.sceneChangeEvent(updateChange);
@@ -187,12 +191,14 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderAttribute.count(), 1340U);
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(QStringLiteral("L88"));
updateChange->setPropertyName("name");
renderAttribute.sceneChangeEvent(updateChange);
@@ -200,12 +206,14 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderAttribute.name(), QStringLiteral("L88"));
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(555);
updateChange->setPropertyName("byteOffset");
renderAttribute.sceneChangeEvent(updateChange);
@@ -213,12 +221,14 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderAttribute.byteOffset(), 555U);
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(454);
updateChange->setPropertyName("byteStride");
renderAttribute.sceneChangeEvent(updateChange);
@@ -226,12 +236,14 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderAttribute.byteStride(), 454U);
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(1450);
updateChange->setPropertyName("divisor");
renderAttribute.sceneChangeEvent(updateChange);
@@ -239,12 +251,14 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderAttribute.divisor(), 1450U);
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
Qt3DCore::QNodeId bufferId = Qt3DCore::QNodeId::createId();
updateChange->setValue(QVariant::fromValue(bufferId));
updateChange->setPropertyName("buffer");
@@ -253,8 +267,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderAttribute.bufferId(), bufferId);
QVERIFY(renderAttribute.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderAttribute.unsetDirty();
+ renderer.resetDirty();
QVERIFY(!renderAttribute.isDirty());
}
};
diff --git a/tests/auto/render/boundingvolumedebug/tst_boundingvolumedebug.cpp b/tests/auto/render/boundingvolumedebug/tst_boundingvolumedebug.cpp
index a2df110e2..3b67420f3 100644
--- a/tests/auto/render/boundingvolumedebug/tst_boundingvolumedebug.cpp
+++ b/tests/auto/render/boundingvolumedebug/tst_boundingvolumedebug.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,10 +28,11 @@
#include <QtTest/QTest>
#include <Qt3DRender/private/boundingvolumedebug_p.h>
-#include <Qt3DRender/qboundingvolumedebug.h>
+#include <Qt3DRender/private/qboundingvolumedebug_p.h>
#include <Qt3DCore/private/qbackendnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qnodepropertychange.h>
#include "testpostmanarbiter.h"
+#include "testrenderer.h"
class tst_BoundingVolumeDebug : public QObject
{
@@ -57,7 +50,7 @@ private Q_SLOTS:
boundingVolumeDebug.setPeer(&fbvH);
// THEN
- QVERIFY(!boundingVolumeDebug.peerUuid().isNull());
+ QVERIFY(!boundingVolumeDebug.peerId().isNull());
QCOMPARE(boundingVolumeDebug.isRecursive(), true);
}
@@ -67,7 +60,7 @@ private Q_SLOTS:
Qt3DRender::Render::BoundingVolumeDebug boundingVolumeDebug;
// THEN
- QVERIFY(boundingVolumeDebug.peerUuid().isNull());
+ QVERIFY(boundingVolumeDebug.peerId().isNull());
QCOMPARE(boundingVolumeDebug.isRecursive(), false);
QCOMPARE(boundingVolumeDebug.radius(), 0.0f);
QCOMPARE(boundingVolumeDebug.center(), QVector3D());
@@ -83,7 +76,7 @@ private Q_SLOTS:
boundingVolumeDebug.cleanup();
// THEN
- QVERIFY(boundingVolumeDebug.peerUuid().isNull());
+ QVERIFY(boundingVolumeDebug.peerId().isNull());
QCOMPARE(boundingVolumeDebug.isRecursive(), false);
QCOMPARE(boundingVolumeDebug.radius(), 0.0f);
QCOMPARE(boundingVolumeDebug.center(), QVector3D());
@@ -92,17 +85,20 @@ private Q_SLOTS:
void checkPropertyChanges()
{
// GIVEN
+ TestRenderer renderer;
Qt3DRender::Render::BoundingVolumeDebug boundingVolumeDebug;
+ boundingVolumeDebug.setRenderer(&renderer);
QVERIFY(!boundingVolumeDebug.isRecursive());
// WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ Qt3DCore::QNodePropertyChangePtr updateChange(new Qt3DCore::QNodePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
updateChange->setValue(true);
updateChange->setPropertyName("recursive");
boundingVolumeDebug.sceneChangeEvent(updateChange);
// THEN
QCOMPARE(boundingVolumeDebug.isRecursive(), true);
+ QVERIFY(renderer.dirtyBits() != 0);
}
void checkBackendPropertyNotifications()
@@ -117,7 +113,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.count(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QNodePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QNodePropertyChange>();
QCOMPARE(change->propertyName(), "radius");
QCOMPARE(change->value().toFloat(), 1340.0f);
@@ -135,7 +131,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.count(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QNodePropertyChange>();
QCOMPARE(change->propertyName(), "center");
QCOMPARE(change->value().value<QVector3D>(), QVector3D(1.0f, 2.0f, 3.0f));
diff --git a/tests/auto/render/buffer/buffer.pro b/tests/auto/render/buffer/buffer.pro
index 73c13dd42..509c29c8c 100644
--- a/tests/auto/render/buffer/buffer.pro
+++ b/tests/auto/render/buffer/buffer.pro
@@ -8,4 +8,5 @@ CONFIG += testcase
SOURCES += tst_buffer.cpp
+include(../../core/common/common.pri)
include(../commons/commons.pri)
diff --git a/tests/auto/render/buffer/tst_buffer.cpp b/tests/auto/render/buffer/tst_buffer.cpp
index a367d0929..0fbd7b0cf 100644
--- a/tests/auto/render/buffer/tst_buffer.cpp
+++ b/tests/auto/render/buffer/tst_buffer.cpp
@@ -1,46 +1,41 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DRender/private/buffer_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/private/buffermanager_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DCore/private/qbackendnode_p.h>
#include "testpostmanarbiter.h"
+#include "testrenderer.h"
-class TestFunctor : public Qt3DRender::QBufferFunctor
+class TestFunctor : public Qt3DRender::QBufferDataGenerator
{
public:
explicit TestFunctor(int size)
@@ -52,10 +47,10 @@ public:
return QByteArrayLiteral("454");
}
- bool operator ==(const Qt3DRender::QBufferFunctor &other) const
+ bool operator ==(const Qt3DRender::QBufferDataGenerator &other) const Q_DECL_FINAL
{
const TestFunctor *otherFunctor = functor_cast<TestFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
+ if (otherFunctor != nullptr)
return otherFunctor->m_size == m_size;
return false;
}
@@ -66,7 +61,7 @@ private:
int m_size;
};
-class tst_RenderBuffer : public QObject
+class tst_RenderBuffer : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
private Q_SLOTS:
@@ -76,44 +71,48 @@ private Q_SLOTS:
// GIVEN
Qt3DRender::Render::Buffer renderBuffer;
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
+ Qt3DRender::Render::BufferManager bufferManager;
buffer.setUsage(Qt3DRender::QBuffer::DynamicCopy);
buffer.setData(QByteArrayLiteral("Corvette"));
- buffer.setBufferFunctor(Qt3DRender::QBufferFunctorPtr(new TestFunctor(883)));
+ buffer.setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(883)));
// WHEN
- renderBuffer.setPeer(&buffer);
+ renderBuffer.setManager(&bufferManager);
+ simulateInitialization(&buffer, &renderBuffer);
// THEN
- QCOMPARE(renderBuffer.peerUuid(), buffer.id());
+ QCOMPARE(renderBuffer.peerId(), buffer.id());
QCOMPARE(renderBuffer.isDirty(), true);
QCOMPARE(renderBuffer.type(), buffer.type());
QCOMPARE(renderBuffer.usage(), buffer.usage());
QCOMPARE(renderBuffer.data(), buffer.data());
- QCOMPARE(renderBuffer.bufferFunctor(), buffer.bufferFunctor());
- QVERIFY(*renderBuffer.bufferFunctor() == *buffer.bufferFunctor());
+ QCOMPARE(renderBuffer.dataGenerator(), buffer.dataGenerator());
+ QVERIFY(*renderBuffer.dataGenerator() == *buffer.dataGenerator());
}
void checkInitialAndCleanedUpState()
{
// GIVEN
Qt3DRender::Render::Buffer renderBuffer;
+ Qt3DRender::Render::BufferManager bufferManager;
// THEN
QCOMPARE(renderBuffer.isDirty(), false);
QCOMPARE(renderBuffer.type(), Qt3DRender::QBuffer::VertexBuffer);
QCOMPARE(renderBuffer.usage(), Qt3DRender::QBuffer::StaticDraw);
QVERIFY(renderBuffer.data().isEmpty());
- QVERIFY(renderBuffer.peerUuid().isNull());
- QVERIFY(renderBuffer.bufferFunctor().isNull());
+ QVERIFY(renderBuffer.peerId().isNull());
+ QVERIFY(renderBuffer.dataGenerator().isNull());
// GIVEN
Qt3DRender::QBuffer buffer(Qt3DRender::QBuffer::IndexBuffer);
buffer.setUsage(Qt3DRender::QBuffer::DynamicCopy);
buffer.setData(QByteArrayLiteral("C7"));
- buffer.setBufferFunctor(Qt3DRender::QBufferFunctorPtr(new TestFunctor(73)));
+ buffer.setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(73)));
// WHEN
- renderBuffer.updateFromPeer(&buffer);
+ renderBuffer.setManager(&bufferManager);
+ simulateInitialization(&buffer, &renderBuffer);
renderBuffer.cleanup();
// THEN
@@ -121,13 +120,15 @@ private Q_SLOTS:
QCOMPARE(renderBuffer.type(), Qt3DRender::QBuffer::VertexBuffer);
QCOMPARE(renderBuffer.usage(), Qt3DRender::QBuffer::StaticDraw);
QVERIFY(renderBuffer.data().isEmpty());
- QVERIFY(renderBuffer.bufferFunctor().isNull());
+ QVERIFY(renderBuffer.dataGenerator().isNull());
}
void checkPropertyChanges()
{
// GIVEN
+ TestRenderer renderer;
Qt3DRender::Render::Buffer renderBuffer;
+ renderBuffer.setRenderer(&renderer);
// THEN
QVERIFY(renderBuffer.type() != Qt3DRender::QBuffer::IndexBuffer);
@@ -136,20 +137,21 @@ private Q_SLOTS:
QVERIFY(!renderBuffer.isDirty());
// WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(static_cast<int>(Qt3DRender::QBuffer::IndexBuffer));
updateChange->setPropertyName("type");
renderBuffer.sceneChangeEvent(updateChange);
// THEN
QCOMPARE(renderBuffer.type(), Qt3DRender::QBuffer::IndexBuffer);
+ QVERIFY(renderer.dirtyBits() != 0);
QVERIFY(renderBuffer.isDirty());
renderBuffer.unsetDirty();
QVERIFY(!renderBuffer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(static_cast<int>(Qt3DRender::QBuffer::DynamicRead));
updateChange->setPropertyName("usage");
renderBuffer.sceneChangeEvent(updateChange);
@@ -162,7 +164,7 @@ private Q_SLOTS:
QVERIFY(!renderBuffer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(QByteArrayLiteral("LS9"));
updateChange->setPropertyName("data");
renderBuffer.sceneChangeEvent(updateChange);
@@ -177,27 +179,27 @@ private Q_SLOTS:
// WHEN
- Qt3DRender::QBufferFunctorPtr functor(new TestFunctor(355));
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ Qt3DRender::QBufferDataGeneratorPtr functor(new TestFunctor(355));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(QVariant::fromValue(functor));
- updateChange->setPropertyName("bufferFunctor");
+ updateChange->setPropertyName("dataGenerator");
renderBuffer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderBuffer.bufferFunctor(), functor);
+ QCOMPARE(renderBuffer.dataGenerator(), functor);
QVERIFY(renderBuffer.isDirty());
renderBuffer.unsetDirty();
QVERIFY(!renderBuffer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(true);
- updateChange->setPropertyName("sync");
+ updateChange->setPropertyName("syncData");
renderBuffer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderBuffer.isSync(), true);
+ QCOMPARE(renderBuffer.isSyncData(), true);
QVERIFY(!renderBuffer.isDirty());
// WHEN
@@ -207,7 +209,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.count(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "data");
QCOMPARE(change->value().toByteArray(), QByteArrayLiteral("454"));
diff --git a/tests/auto/render/commons/commons.pri b/tests/auto/render/commons/commons.pri
index 20274ca25..54bc0b949 100644
--- a/tests/auto/render/commons/commons.pri
+++ b/tests/auto/render/commons/commons.pri
@@ -1,9 +1,11 @@
SOURCES += \
- $$PWD/testpostmanarbiter.cpp
+ $$PWD/testpostmanarbiter.cpp \
+ $$PWD/testrenderer.cpp
HEADERS += \
- $$PWD/testpostmanarbiter.h
+ $$PWD/testpostmanarbiter.h \
+ $$PWD/testrenderer.h
INCLUDEPATH += $$PWD
-QT += core-private 3dcore 3dcore-private
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private
diff --git a/tests/auto/render/commons/testpostmanarbiter.cpp b/tests/auto/render/commons/testpostmanarbiter.cpp
index 10b5cfaeb..6371471c9 100644
--- a/tests/auto/render/commons/testpostmanarbiter.cpp
+++ b/tests/auto/render/commons/testpostmanarbiter.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -65,7 +57,7 @@ TestArbiter::TestArbiter(Qt3DCore::QNode *node)
TestArbiter::~TestArbiter()
{
if (m_node)
- Qt3DCore::QNodePrivate::get(m_node)->setArbiter(Q_NULLPTR);
+ Qt3DCore::QNodePrivate::get(m_node)->setArbiter(nullptr);
}
void TestArbiter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
@@ -91,7 +83,7 @@ Qt3DCore::QAbstractPostman *TestArbiter::postman() const
void TestArbiter::assignArbiter(Qt3DCore::QNode *node)
{
Qt3DCore::QNodePrivate::get(node)->setArbiter(this);
- Q_FOREACH (Qt3DCore::QNode *n, node->childrenNodes())
+ Q_FOREACH (Qt3DCore::QNode *n, node->childNodes())
assignArbiter(n);
}
diff --git a/tests/auto/render/commons/testpostmanarbiter.h b/tests/auto/render/commons/testpostmanarbiter.h
index b3c82af8e..2861801e5 100644
--- a/tests/auto/render/commons/testpostmanarbiter.h
+++ b/tests/auto/render/commons/testpostmanarbiter.h
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -36,7 +28,7 @@
#include <Qt3DCore/private/qpostman_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
@@ -61,7 +53,7 @@ private:
class TestArbiter : public Qt3DCore::QAbstractArbiter
{
public:
- TestArbiter(Qt3DCore::QNode *node = Q_NULLPTR);
+ TestArbiter(Qt3DCore::QNode *node = nullptr);
~TestArbiter();
diff --git a/tests/auto/render/commons/testrenderer.cpp b/tests/auto/render/commons/testrenderer.cpp
new file mode 100644
index 000000000..db038dbc4
--- /dev/null
+++ b/tests/auto/render/commons/testrenderer.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testrenderer.h"
+
+QT_BEGIN_NAMESPACE
+
+TestRenderer::TestRenderer()
+ : m_changes(0)
+{
+}
+
+TestRenderer::~TestRenderer()
+{
+}
+
+void TestRenderer::markDirty(Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet changes, Qt3DRender::Render::BackendNode *node)
+{
+ Q_UNUSED(node);
+ m_changes |= changes;
+}
+
+Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet TestRenderer::dirtyBits()
+{
+ return m_changes;
+}
+
+void TestRenderer::clearDirtyBits(Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet changes)
+{
+ m_changes &= changes;
+}
+
+void TestRenderer::resetDirty()
+{
+ m_changes = 0;
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/render/commons/testrenderer.h b/tests/auto/render/commons/testrenderer.h
new file mode 100644
index 000000000..6eac734df
--- /dev/null
+++ b/tests/auto/render/commons/testrenderer.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTRENDERER_H
+#define TESTRENDERER_H
+
+#include <Qt3DRender/private/abstractrenderer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class TestRenderer : public Qt3DRender::Render::AbstractRenderer
+{
+public:
+ TestRenderer();
+ ~TestRenderer();
+
+ void dumpInfo() const Q_DECL_OVERRIDE {}
+ API api() const Q_DECL_OVERRIDE { return AbstractRenderer::OpenGL; }
+ qint64 time() const Q_DECL_OVERRIDE { return 0; }
+ void setTime(qint64 time) Q_DECL_OVERRIDE { Q_UNUSED(time); }
+ void setNodeManagers(Qt3DRender::Render::NodeManagers *managers) Q_DECL_OVERRIDE { Q_UNUSED(managers); }
+ void setServices(Qt3DCore::QServiceLocator *services) Q_DECL_OVERRIDE { Q_UNUSED(services); }
+ void setSurfaceExposed(bool exposed) Q_DECL_OVERRIDE { Q_UNUSED(exposed); }
+ Qt3DRender::Render::NodeManagers *nodeManagers() const Q_DECL_OVERRIDE { return nullptr; }
+ Qt3DCore::QServiceLocator *services() const Q_DECL_OVERRIDE { return nullptr; }
+ void initialize() Q_DECL_OVERRIDE {}
+ void shutdown() Q_DECL_OVERRIDE {}
+ void releaseGraphicsResources() Q_DECL_OVERRIDE {}
+ void createAllocators(Qt3DCore::QAbstractAspectJobManager *jobManager) Q_DECL_OVERRIDE { Q_UNUSED(jobManager); }
+ void destroyAllocators(Qt3DCore::QAbstractAspectJobManager *jobManager) Q_DECL_OVERRIDE { Q_UNUSED(jobManager); }
+ void render() Q_DECL_OVERRIDE {}
+ void doRender() Q_DECL_OVERRIDE {}
+ bool isRunning() const Q_DECL_OVERRIDE { return true; }
+ bool shouldRender() Q_DECL_OVERRIDE { return true; }
+ void skipNextFrame() Q_DECL_OVERRIDE {}
+ QVector<Qt3DCore::QAspectJobPtr> renderBinJobs() Q_DECL_OVERRIDE { return QVector<Qt3DCore::QAspectJobPtr>(); }
+ Qt3DCore::QAspectJobPtr pickBoundingVolumeJob() Q_DECL_OVERRIDE { return Qt3DCore::QAspectJobPtr(); }
+ void setSceneRoot(Qt3DCore::QBackendNodeFactory *factory, Qt3DRender::Render::Entity *root) Q_DECL_OVERRIDE { Q_UNUSED(factory); Q_UNUSED(root); }
+ Qt3DRender::Render::Entity *sceneRoot() const Q_DECL_OVERRIDE { return nullptr; }
+ Qt3DRender::Render::FrameGraphNode *frameGraphRoot() const Q_DECL_OVERRIDE { return nullptr; }
+ Qt3DCore::QAbstractFrameAdvanceService *frameAdvanceService() const Q_DECL_OVERRIDE { return nullptr; }
+ void registerEventFilter(Qt3DCore::QEventFilterService *service) Q_DECL_OVERRIDE { Q_UNUSED(service); }
+ void setSettings(Qt3DRender::Render::RenderSettings *settings) Q_DECL_OVERRIDE { Q_UNUSED(settings); }
+ Qt3DRender::Render::RenderSettings *settings() const Q_DECL_OVERRIDE { return nullptr; }
+
+ void markDirty(Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet changes, Qt3DRender::Render::BackendNode *node) Q_DECL_OVERRIDE;
+ Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet dirtyBits() Q_DECL_OVERRIDE;
+ void clearDirtyBits(Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet changes) Q_DECL_OVERRIDE;
+
+ void resetDirty();
+
+protected:
+ Qt3DRender::Render::AbstractRenderer::BackendNodeDirtySet m_changes;
+};
+
+QT_END_NAMESPACE
+
+#endif // TESTRENDERER_H
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc1-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-dx10.dds
new file mode 100644
index 000000000..feacae8d1
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips-dx10.dds
new file mode 100644
index 000000000..40da98cde
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips.dds
new file mode 100644
index 000000000..1dd3e1e91
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc1.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc1.dds
new file mode 100644
index 000000000..e31f410d2
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc1.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc3-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-dx10.dds
new file mode 100644
index 000000000..76c820f31
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips-dx10.dds
new file mode 100644
index 000000000..0a2964f12
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips.dds
new file mode 100644
index 000000000..c8c94d85f
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc3.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc3.dds
new file mode 100644
index 000000000..4a08d324a
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc3.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-lumi-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-1-lumi-nomips.dds
new file mode 100644
index 000000000..8fdd5e3e1
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-lumi-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-lumi.dds b/tests/auto/render/ddstextures/data/16x16x1-1-lumi.dds
new file mode 100644
index 000000000..82ab57958
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-lumi.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-rgb-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-1-rgb-nomips.dds
new file mode 100644
index 000000000..94d06c2c4
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-rgb-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-rgb.dds b/tests/auto/render/ddstextures/data/16x16x1-1-rgb.dds
new file mode 100644
index 000000000..45635dd97
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-rgb.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc1-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-dx10.dds
new file mode 100644
index 000000000..209b796f0
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips-dx10.dds
new file mode 100644
index 000000000..e79e29ab5
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips.dds
new file mode 100644
index 000000000..de6796d9f
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc1.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc1.dds
new file mode 100644
index 000000000..92b95ae73
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc1.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc3-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-dx10.dds
new file mode 100644
index 000000000..f56fa09fd
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips-dx10.dds
new file mode 100644
index 000000000..31e137553
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips.dds
new file mode 100644
index 000000000..644274601
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc3.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc3.dds
new file mode 100644
index 000000000..144515bb0
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc3.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-lumi-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-6-lumi-nomips.dds
new file mode 100644
index 000000000..baa884a36
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-lumi-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-lumi.dds b/tests/auto/render/ddstextures/data/16x16x1-6-lumi.dds
new file mode 100644
index 000000000..1a4e6f46f
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-lumi.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-rgb-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-6-rgb-nomips.dds
new file mode 100644
index 000000000..318a0bd35
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-rgb-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-rgb.dds b/tests/auto/render/ddstextures/data/16x16x1-6-rgb.dds
new file mode 100644
index 000000000..1f3c8f9cf
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-rgb.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/ddstextures.pro b/tests/auto/render/ddstextures/ddstextures.pro
new file mode 100644
index 000000000..e81fd80d8
--- /dev/null
+++ b/tests/auto/render/ddstextures/ddstextures.pro
@@ -0,0 +1,37 @@
+TEMPLATE = app
+
+TARGET = tst_ddstextures
+
+CONFIG += testcase
+
+SOURCES += tst_ddstextures.cpp
+
+OTHER_FILES = \
+ data/16x16x1-1-bc1.dds \
+ data/16x16x1-1-bc1-dx10.dds \
+ data/16x16x1-1-bc1-nomips.dds \
+ data/16x16x1-1-bc1-nomips-dx10.dds \
+ data/16x16x1-1-bc3.dds \
+ data/16x16x1-1-bc3-dx10.dds \
+ data/16x16x1-1-bc3-nomips.dds \
+ data/16x16x1-1-bc3-nomips-dx10.dds \
+ data/16x16x1-1-lumi.dds \
+ data/16x16x1-1-lumi-nomips.dds \
+ data/16x16x1-1-rgb.dds \
+ data/16x16x1-1-rgb-nomips.dds \
+ data/16x16x1-6-bc1.dds \
+ data/16x16x1-6-bc1-dx10.dds \
+ data/16x16x1-6-bc1-nomips.dds \
+ data/16x16x1-6-bc1-nomips-dx10.dds \
+ data/16x16x1-6-bc3.dds \
+ data/16x16x1-6-bc3-dx10.dds \
+ data/16x16x1-6-bc3-nomips.dds \
+ data/16x16x1-6-bc3-nomips-dx10.dds \
+ data/16x16x1-6-lumi.dds \
+ data/16x16x1-6-lumi-nomips.dds \
+ data/16x16x1-6-rgb.dds \
+ data/16x16x1-6-rgb-nomips.dds
+
+TESTDATA = data/*
+
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
diff --git a/tests/auto/render/ddstextures/tst_ddstextures.cpp b/tests/auto/render/ddstextures/tst_ddstextures.cpp
new file mode 100644
index 000000000..568c5e5d8
--- /dev/null
+++ b/tests/auto/render/ddstextures/tst_ddstextures.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DRender/qtextureimagedata.h>
+
+class tst_DdsTextures : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void ddsImageData();
+};
+
+void tst_DdsTextures::ddsImageData()
+{
+ const struct TextureInfo {
+ const char *source;
+ int width;
+ int height;
+ int depth;
+ int faces;
+ int mipmapLevels;
+ QOpenGLTexture::TextureFormat format;
+ } textures[] = {
+ { "data/16x16x1-1-lumi-nomips.dds", 16, 16, 1, 1, 1, QOpenGLTexture::R8_UNorm },
+ { "data/16x16x1-1-lumi.dds", 16, 16, 1, 1, 5, QOpenGLTexture::R8_UNorm },
+ { "data/16x16x1-1-rgb-nomips.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA8_UNorm },
+ { "data/16x16x1-1-rgb.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA8_UNorm },
+ { "data/16x16x1-1-bc1-nomips.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-1-bc1.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-1-bc3-nomips.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-1-bc3.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-1-bc1-nomips-dx10.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-1-bc1-dx10.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-1-bc3-nomips-dx10.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-1-bc3-dx10.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-6-lumi-nomips.dds", 16, 16, 1, 6, 1, QOpenGLTexture::R8_UNorm },
+ { "data/16x16x1-6-lumi.dds", 16, 16, 1, 6, 5, QOpenGLTexture::R8_UNorm },
+ { "data/16x16x1-6-rgb-nomips.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA8_UNorm },
+ { "data/16x16x1-6-rgb.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA8_UNorm },
+ { "data/16x16x1-6-bc1-nomips.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-6-bc1.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-6-bc3-nomips.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-6-bc3.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-6-bc1-nomips-dx10.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-6-bc1-dx10.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-6-bc3-nomips-dx10.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-6-bc3-dx10.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA_DXT5 },
+ };
+
+ for (unsigned i = 0; i < sizeof(textures)/sizeof(*textures); i++) {
+ const TextureInfo *texture = &textures[i];
+
+ Qt3DRender::QTextureImageData data;
+
+ QVERIFY(data.setCompressedFile(QFINDTESTDATA(texture->source)));
+ QCOMPARE(data.width(), texture->width);
+ QCOMPARE(data.height(), texture->height);
+ QCOMPARE(data.faces(), texture->faces);
+ QCOMPARE(data.mipLevels(), texture->mipmapLevels);
+ QCOMPARE(data.format(), texture->format);
+ }
+}
+
+QTEST_APPLESS_MAIN(tst_DdsTextures)
+
+#include "tst_ddstextures.moc"
diff --git a/tests/auto/render/entity/entity.pro b/tests/auto/render/entity/entity.pro
index be8998802..193bd745c 100644
--- a/tests/auto/render/entity/entity.pro
+++ b/tests/auto/render/entity/entity.pro
@@ -7,3 +7,5 @@ QT += 3dcore 3dcore-private 3drender 3drender-private testlib
CONFIG += testcase
SOURCES += tst_entity.cpp
+
+include(../commons/commons.pri)
diff --git a/tests/auto/render/entity/tst_entity.cpp b/tests/auto/render/entity/tst_entity.cpp
index 0d828c5e2..fad49fd99 100644
--- a/tests/auto/render/entity/tst_entity.cpp
+++ b/tests/auto/render/entity/tst_entity.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,8 +29,10 @@
#include <QtTest/QtTest>
#include <Qt3DRender/private/entity_p.h>
-#include <Qt3DCore/QCameraLens>
-#include <Qt3DCore/QScenePropertyChange>
+#include <Qt3DRender/QCameraLens>
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QComponentAddedChange>
+#include <Qt3DCore/QComponentRemovedChange>
#include <Qt3DCore/QTransform>
#include <Qt3DRender/QMesh>
@@ -47,27 +41,26 @@
#include <Qt3DRender/QShaderData>
#include <Qt3DRender/QGeometryRenderer>
#include <Qt3DRender/QObjectPicker>
-#include <Qt3DRender/QBoundingVolumeDebug>
+#include <Qt3DRender/QComputeCommand>
+
+#include "testrenderer.h"
typedef Qt3DCore::QNodeId (*UuidMethod)(Qt3DRender::Render::Entity *);
-typedef QList<Qt3DCore::QNodeId> (*UuidListMethod)(Qt3DRender::Render::Entity *);
+typedef QVector<Qt3DCore::QNodeId> (*UuidListMethod)(Qt3DRender::Render::Entity *);
using namespace Qt3DCore;
using namespace Qt3DRender;
using namespace Qt3DRender::Render;
-void noopDeleter(QNode *) {}
-
-
QNodeId transformUuid(Entity *entity) { return entity->componentUuid<Transform>(); }
QNodeId cameraLensUuid(Entity *entity) { return entity->componentUuid<CameraLens>(); }
QNodeId materialUuid(Entity *entity) { return entity->componentUuid<Material>(); }
QNodeId geometryRendererUuid(Entity *entity) { return entity->componentUuid<GeometryRenderer>(); }
QNodeId objectPickerUuid(Entity *entity) { return entity->componentUuid<ObjectPicker>(); }
-QNodeId boundingVolumeDebugUuid(Entity *entity) { return entity->componentUuid<BoundingVolumeDebug>(); }
+QNodeId computeJobUuid(Entity *entity) { return entity->componentUuid<ComputeCommand>(); }
-QList<QNodeId> layersUuid(Entity *entity) { return entity->componentsUuid<Layer>(); }
-QList<QNodeId> shadersUuid(Entity *entity) { return entity->componentsUuid<ShaderData>(); }
+QVector<QNodeId> layersUuid(Entity *entity) { return entity->componentsUuid<Layer>(); }
+QVector<QNodeId> shadersUuid(Entity *entity) { return entity->componentsUuid<ShaderData>(); }
class tst_RenderEntity : public QObject
{
@@ -90,7 +83,7 @@ private slots:
<< new QObjectPicker
<< new QLayer
<< new QShaderData
- << new QBoundingVolumeDebug;
+ << new QComputeCommand;
QTest::newRow("all components") << components;
}
@@ -99,7 +92,11 @@ private slots:
{
// GIVEN
QFETCH(QList<QComponent*>, components);
+
+ TestRenderer renderer;
Qt3DRender::Render::Entity entity;
+ Qt3DCore::QEntity dummyFrontendEntity;
+ entity.setRenderer(&renderer);
// THEN
QVERIFY(entity.componentUuid<Transform>().isNull());
@@ -107,16 +104,14 @@ private slots:
QVERIFY(entity.componentUuid<Material>().isNull());
QVERIFY(entity.componentUuid<GeometryRenderer>().isNull());
QVERIFY(entity.componentUuid<ObjectPicker>().isNull());
- QVERIFY(entity.componentUuid<BoundingVolumeDebug>().isNull());
+ QVERIFY(entity.componentUuid<ComputeCommand>().isNull());
QVERIFY(entity.componentsUuid<Layer>().isEmpty());
QVERIFY(entity.componentsUuid<ShaderData>().isEmpty());
QVERIFY(!entity.isBoundingVolumeDirty());
// WHEN
Q_FOREACH (QComponent *component, components) {
- QScenePropertyChangePtr addChange(new QScenePropertyChange(ComponentAdded, QSceneChange::Node, component->id()));
- addChange->setPropertyName("component");
- addChange->setValue(QVariant::fromValue(QNodePtr(component, noopDeleter)));
+ const auto addChange = QComponentAddedChangePtr::create(&dummyFrontendEntity, component);
entity.sceneChangeEvent(addChange);
}
@@ -126,10 +121,11 @@ private slots:
QVERIFY(!entity.componentUuid<Material>().isNull());
QVERIFY(!entity.componentUuid<GeometryRenderer>().isNull());
QVERIFY(!entity.componentUuid<ObjectPicker>().isNull());
- QVERIFY(!entity.componentUuid<BoundingVolumeDebug>().isNull());
+ QVERIFY(!entity.componentsUuid<Layer>().isEmpty());
QVERIFY(!entity.componentsUuid<Layer>().isEmpty());
QVERIFY(!entity.componentsUuid<ShaderData>().isEmpty());
QVERIFY(entity.isBoundingVolumeDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
entity.cleanup();
@@ -140,7 +136,7 @@ private slots:
QVERIFY(entity.componentUuid<Material>().isNull());
QVERIFY(entity.componentUuid<GeometryRenderer>().isNull());
QVERIFY(entity.componentUuid<ObjectPicker>().isNull());
- QVERIFY(entity.componentUuid<BoundingVolumeDebug>().isNull());
+ QVERIFY(entity.componentsUuid<Layer>().isEmpty());
QVERIFY(entity.componentsUuid<Layer>().isEmpty());
QVERIFY(entity.componentsUuid<ShaderData>().isEmpty());
QVERIFY(!entity.isBoundingVolumeDirty());
@@ -166,8 +162,8 @@ private slots:
component = new QObjectPicker;
QTest::newRow("objectPicker") << component << reinterpret_cast<void*>(objectPickerUuid);
- component = new QBoundingVolumeDebug;
- QTest::newRow("boundingVolumeDebug") << component << reinterpret_cast<void*>(boundingVolumeDebugUuid);
+ component = new QComputeCommand;
+ QTest::newRow("computeJob") << component << reinterpret_cast<void*>(computeJobUuid);
}
void shouldHandleSingleComponentEvents()
@@ -177,28 +173,30 @@ private slots:
QFETCH(void*, functionPtr);
UuidMethod method = reinterpret_cast<UuidMethod>(functionPtr);
- Entity entity;
+ TestRenderer renderer;
+ Qt3DRender::Render::Entity entity;
+ Qt3DCore::QEntity dummyFrontendEntity;
+ entity.setRenderer(&renderer);
// THEN
QVERIFY(method(&entity).isNull());
// WHEN
- QScenePropertyChangePtr addChange(new QScenePropertyChange(ComponentAdded, QSceneChange::Node, component->id()));
- addChange->setPropertyName("component");
- addChange->setValue(QVariant::fromValue(QNodePtr(component, noopDeleter)));
+ const auto addChange = QComponentAddedChangePtr::create(&dummyFrontendEntity, component);
entity.sceneChangeEvent(addChange);
// THEN
QCOMPARE(method(&entity), component->id());
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
- QScenePropertyChangePtr removeChange(new QScenePropertyChange(ComponentRemoved, QSceneChange::Node, component->id()));
- removeChange->setPropertyName("componentId");
- removeChange->setValue(QVariant::fromValue(component->id()));
+ renderer.resetDirty();
+ const auto removeChange = QComponentRemovedChangePtr::create(&dummyFrontendEntity, component);
entity.sceneChangeEvent(removeChange);
// THEN
QVERIFY(method(&entity).isNull());
+ QVERIFY(renderer.dirtyBits() != 0);
delete component;
}
@@ -226,16 +224,17 @@ private slots:
QFETCH(void*, functionPtr);
UuidListMethod method = reinterpret_cast<UuidListMethod>(functionPtr);
- Entity entity;
+ TestRenderer renderer;
+ Qt3DRender::Render::Entity entity;
+ Qt3DCore::QEntity dummyFrontendEntity;
+ entity.setRenderer(&renderer);
// THEN
QVERIFY(method(&entity).isEmpty());
// WHEN
Q_FOREACH (QComponent *component, components) {
- QScenePropertyChangePtr addChange(new QScenePropertyChange(ComponentAdded, QSceneChange::Node, component->id()));
- addChange->setPropertyName("component");
- addChange->setValue(QVariant::fromValue(QNodePtr(component, noopDeleter)));
+ const auto addChange = QComponentAddedChangePtr::create(&dummyFrontendEntity, component);
entity.sceneChangeEvent(addChange);
}
@@ -244,16 +243,17 @@ private slots:
Q_FOREACH (QComponent *component, components) {
QVERIFY(method(&entity).contains(component->id()));
}
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
- QScenePropertyChangePtr removeChange(new QScenePropertyChange(ComponentRemoved, QSceneChange::Node, components.first()->id()));
- removeChange->setPropertyName("componentId");
- removeChange->setValue(QVariant::fromValue(components.first()->id()));
+ renderer.resetDirty();
+ const auto removeChange = QComponentRemovedChangePtr::create(&dummyFrontendEntity, components.first());
entity.sceneChangeEvent(removeChange);
// THEN
QCOMPARE(method(&entity).size(), components.size() - 1);
QVERIFY(!method(&entity).contains(components.first()->id()));
+ QVERIFY(renderer.dirtyBits() != 0);
qDeleteAll(components);
}
diff --git a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
index 0e606dff9..d3a1a2e98 100644
--- a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
+++ b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
@@ -1,47 +1,42 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <QtTest/QTest>
#include <Qt3DRender/private/framegraphnode_p.h>
+#include <QtTest/QTest>
#include <Qt3DRender/private/managers_p.h>
class MyFrameGraphNode : public Qt3DRender::Render::FrameGraphNode
{
public:
- void updateFromPeer(Qt3DCore::QNode *) Q_DECL_FINAL {}
+ void setEnabled(bool enabled)
+ {
+ FrameGraphNode::setEnabled(enabled);
+ }
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) Q_DECL_FINAL {}
@@ -51,13 +46,18 @@ class tst_FrameGraphNode : public QObject
{
Q_OBJECT
public:
- tst_FrameGraphNode(QObject *parent = Q_NULLPTR)
+ tst_FrameGraphNode(QObject *parent = nullptr)
: QObject(parent)
{}
~tst_FrameGraphNode()
{}
+ void setIdInternal(Qt3DRender::Render::FrameGraphNode *node, Qt3DCore::QNodeId id)
+ {
+ Qt3DCore::QBackendNodePrivate::get(node)->m_peerId = id;
+ }
+
private Q_SLOTS:
void checkInitialState()
@@ -67,22 +67,22 @@ private Q_SLOTS:
// THEN
QCOMPARE(n.nodeType(), Qt3DRender::Render::FrameGraphNode::InvalidNodeType);
- QVERIFY(n.isEnabled());
- QVERIFY(n.handle().isNull());
- QVERIFY(n.manager() == Q_NULLPTR);
- QVERIFY(n.parentHandle().isNull());
- QVERIFY(n.childrenHandles().empty());
+ QVERIFY(!n.isEnabled());
+ QVERIFY(n.peerId().isNull());
+ QVERIFY(n.manager() == nullptr);
+ QVERIFY(n.parentId().isNull());
+ QVERIFY(n.childrenIds().empty());
}
void checkPropertyChanges()
{
// GIVEN
- QScopedPointer<Qt3DRender::Render::FrameGraphNode> n(new MyFrameGraphNode());
+ QScopedPointer<MyFrameGraphNode> n(new MyFrameGraphNode());
// WHEN
- n->setEnabled(false);
+ n->setEnabled(true);
// THEN
- QCOMPARE(n->isEnabled(), false);
+ QCOMPARE(n->isEnabled(), true);
// WHEN
QScopedPointer<Qt3DRender::Render::FrameGraphManager> manager(new Qt3DRender::Render::FrameGraphManager());
@@ -91,29 +91,28 @@ private Q_SLOTS:
QCOMPARE(n->manager(), manager.data());
// WHEN
- Qt3DRender::Render::HFrameGraphNode parentHandle = manager->getOrAcquireHandle(Qt3DCore::QNodeId::createId());
+ const Qt3DCore::QNodeId parentId = Qt3DCore::QNodeId::createId();
// THEN
- QVERIFY(!parentHandle.isNull());
+ QVERIFY(!parentId.isNull());
// WHEN
- n->setParentHandle(parentHandle);
+ n->setParentId(parentId);
// THEN
- QCOMPARE(n->parentHandle(), parentHandle);
+ QCOMPARE(n->parentId(), parentId);
// WHEN
const Qt3DCore::QNodeId childId = Qt3DCore::QNodeId::createId();
QScopedPointer<Qt3DRender::Render::FrameGraphNode> c(new MyFrameGraphNode());
- Qt3DRender::Render::FrameGraphNode **childNode = manager->getOrCreateResource(childId);
- *childNode = c.data();
- Qt3DRender::Render::HFrameGraphNode childHandle = manager->lookupHandle(childId);
- n->appendChildHandle(childHandle);
+ setIdInternal(c.data(), childId);
+ manager->appendNode(childId, c.data());
+ n->appendChildId(childId);
// THEN
- QCOMPARE(n->childrenHandles().count(), 1);
+ QCOMPARE(n->childrenIds().count(), 1);
// WHEN
- n->appendChildHandle(childHandle);
+ n->appendChildId(childId);
// THEN
- QCOMPARE(n->childrenHandles().count(), 1);
+ QCOMPARE(n->childrenIds().count(), 1);
}
void checkParentChange()
@@ -124,46 +123,47 @@ private Q_SLOTS:
const Qt3DCore::QNodeId childId = Qt3DCore::QNodeId::createId();
Qt3DRender::Render::FrameGraphNode *parent1 = new MyFrameGraphNode();
Qt3DRender::Render::FrameGraphNode *child = new MyFrameGraphNode();
- const Qt3DRender::Render::HFrameGraphNode parentHandle = manager->getOrAcquireHandle(parentId);
- const Qt3DRender::Render::HFrameGraphNode childHandle = manager->getOrAcquireHandle(childId);
- *manager->data(parentHandle) = parent1;
- *manager->data(childHandle) = child;
- parent1->setHandle(parentHandle);
- child->setHandle(childHandle);
+
+ setIdInternal(parent1, parentId);
+ setIdInternal(child, childId);
+
+ manager->appendNode(parentId, parent1);
+ manager->appendNode(childId, child);
+
parent1->setFrameGraphManager(manager.data());
child->setFrameGraphManager(manager.data());
// THEN
- QVERIFY(parent1->childrenHandles().isEmpty());
- QVERIFY(child->parentHandle().isNull());
+ QVERIFY(parent1->childrenIds().isEmpty());
+ QVERIFY(child->parentId().isNull());
// WHEN
- parent1->appendChildHandle(childHandle);
+ parent1->appendChildId(childId);
// THEN
- QCOMPARE(child->parentHandle(), parentHandle);
+ QCOMPARE(child->parentId(), parentId);
QCOMPARE(child->parent(), parent1);
- QCOMPARE(parent1->childrenHandles().count(), 1);
- QCOMPARE(parent1->childrenHandles().first(), childHandle);
- QCOMPARE(parent1->children().count(), parent1->childrenHandles().count());
+ QCOMPARE(parent1->childrenIds().count(), 1);
+ QCOMPARE(parent1->childrenIds().first(), childId);
+ QCOMPARE(parent1->children().count(), parent1->childrenIds().count());
QCOMPARE(parent1->children().first(), child);
// WHEN
- parent1->appendChildHandle(childHandle);
+ parent1->appendChildId(childId);
// THEN
- QCOMPARE(child->parentHandle(), parentHandle);
+ QCOMPARE(child->parentId(), parentId);
QCOMPARE(child->parent(), parent1);
- QCOMPARE(parent1->childrenHandles().count(), 1);
- QCOMPARE(parent1->childrenHandles().first(), childHandle);
- QCOMPARE(parent1->children().count(), parent1->childrenHandles().count());
+ QCOMPARE(parent1->childrenIds().count(), 1);
+ QCOMPARE(parent1->childrenIds().first(), childId);
+ QCOMPARE(parent1->children().count(), parent1->childrenIds().count());
QCOMPARE(parent1->children().first(), child);
// WHEN
- parent1->removeChildHandle(childHandle);
+ parent1->removeChildId(childId);
// THEN
- QVERIFY(child->parentHandle().isNull());
- QVERIFY(child->parent() == Q_NULLPTR);
- QCOMPARE(parent1->childrenHandles().count(), 0);
- QCOMPARE(parent1->children().count(), parent1->childrenHandles().count());
+ QVERIFY(child->parentId().isNull());
+ QVERIFY(child->parent() == nullptr);
+ QCOMPARE(parent1->childrenIds().count(), 0);
+ QCOMPARE(parent1->children().count(), parent1->childrenIds().count());
}
};
diff --git a/tests/auto/render/geometry/geometry.pro b/tests/auto/render/geometry/geometry.pro
index fc916fc7a..575a41e66 100644
--- a/tests/auto/render/geometry/geometry.pro
+++ b/tests/auto/render/geometry/geometry.pro
@@ -7,3 +7,6 @@ QT += 3dcore 3dcore-private 3drender 3drender-private testlib
CONFIG += testcase
SOURCES += tst_geometry.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/geometry/tst_geometry.cpp b/tests/auto/render/geometry/tst_geometry.cpp
index d36a27749..6a8746f47 100644
--- a/tests/auto/render/geometry/tst_geometry.cpp
+++ b/tests/auto/render/geometry/tst_geometry.cpp
@@ -1,47 +1,51 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DRender/private/geometry_p.h>
#include <Qt3DRender/qgeometry.h>
#include <Qt3DRender/qattribute.h>
-#include <Qt3DCore/qscenepropertychange.h>
-#include <Qt3DRender/qboundingvolumespecifier.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include "testrenderer.h"
+
+class DummyAttribute : public Qt3DRender::QAttribute
+{
+ Q_OBJECT
+public:
+ DummyAttribute(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DRender::QAttribute(parent)
+ {}
+};
-class tst_RenderGeometry : public QObject
+class tst_RenderGeometry : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
private Q_SLOTS:
@@ -61,17 +65,15 @@ private Q_SLOTS:
geometry.addAttribute(&attr2);
geometry.addAttribute(&attr3);
geometry.addAttribute(&attr4);
- geometry.setVerticesPerPatch(4);
- geometry.boundingVolumeSpecifier()->setPositionAttribute(&attr1);
+ geometry.setBoundingVolumePositionAttribute(&attr1);
// WHEN
- renderGeometry.setPeer(&geometry);
+ simulateInitialization(&geometry, &renderGeometry);
// THEN
- QCOMPARE(renderGeometry.peerUuid(), geometry.id());
+ QCOMPARE(renderGeometry.peerId(), geometry.id());
QCOMPARE(renderGeometry.isDirty(), true);
QCOMPARE(renderGeometry.attributes().count(), 4);
- QCOMPARE(renderGeometry.verticesPerPatch(), 4);
QCOMPARE(renderGeometry.boundingPositionAttribute(), attr1.id());
for (int i = 0; i < 4; ++i)
@@ -86,8 +88,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderGeometry.isDirty(), false);
QVERIFY(renderGeometry.attributes().isEmpty());
- QVERIFY(renderGeometry.peerUuid().isNull());
- QCOMPARE(renderGeometry.verticesPerPatch(), 0);
+ QVERIFY(renderGeometry.peerId().isNull());
QCOMPARE(renderGeometry.boundingPositionAttribute(), Qt3DCore::QNodeId());
// GIVEN
@@ -96,36 +97,36 @@ private Q_SLOTS:
Qt3DRender::QAttribute attr2;
Qt3DRender::QAttribute attr4;
Qt3DRender::QAttribute attr3;
- geometry.boundingVolumeSpecifier()->setPositionAttribute(&attr1);
+ geometry.setBoundingVolumePositionAttribute(&attr1);
geometry.addAttribute(&attr1);
geometry.addAttribute(&attr2);
geometry.addAttribute(&attr3);
geometry.addAttribute(&attr4);
- geometry.setVerticesPerPatch(4);
// WHEN
- renderGeometry.updateFromPeer(&geometry);
+ simulateInitialization(&geometry, &renderGeometry);
renderGeometry.cleanup();
// THEN
QCOMPARE(renderGeometry.isDirty(), false);
QVERIFY(renderGeometry.attributes().isEmpty());
- QCOMPARE(renderGeometry.verticesPerPatch(), 0);
QCOMPARE(renderGeometry.boundingPositionAttribute(), Qt3DCore::QNodeId());
}
void checkPropertyChanges()
{
// GIVEN
+ TestRenderer renderer;
Qt3DRender::Render::Geometry renderGeometry;
- Qt3DCore::QNodeId geometryId = Qt3DCore::QNodeId::createId();
+ renderGeometry.setRenderer(&renderer);
+
+ DummyAttribute attribute;
// WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(QVariant::fromValue(geometryId));
- updateChange->setPropertyName("attribute");
- renderGeometry.sceneChangeEvent(updateChange);
+ const auto nodeAddedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &attribute);
+ nodeAddedChange->setPropertyName("attribute");
+ renderGeometry.sceneChangeEvent(nodeAddedChange);
// THEN
QCOMPARE(renderGeometry.attributes().count(), 1);
@@ -135,10 +136,9 @@ private Q_SLOTS:
QVERIFY(!renderGeometry.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(QVariant::fromValue(geometryId));
- updateChange->setPropertyName("attribute");
- renderGeometry.sceneChangeEvent(updateChange);
+ const auto nodeRemovedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &attribute);
+ nodeRemovedChange->setPropertyName("attribute");
+ renderGeometry.sceneChangeEvent(nodeRemovedChange);
// THEN
QCOMPARE(renderGeometry.attributes().count(), 0);
@@ -148,20 +148,10 @@ private Q_SLOTS:
QVERIFY(!renderGeometry.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(QVariant::fromValue(3));
- updateChange->setPropertyName("verticesPerPatch");
- renderGeometry.sceneChangeEvent(updateChange);
-
- // THEN
- QCOMPARE(renderGeometry.verticesPerPatch(), 3);
- QVERIFY(!renderGeometry.isDirty());
-
- // WHEN
const Qt3DCore::QNodeId boundingAttrId = Qt3DCore::QNodeId::createId();
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(QVariant::fromValue(boundingAttrId));
- updateChange->setPropertyName("boundingVolumeSpecifierPositionAttribute");
+ updateChange->setPropertyName("boundingVolumePositionAttribute");
renderGeometry.sceneChangeEvent(updateChange);
// THEN
diff --git a/tests/auto/render/geometryrenderer/geometryrenderer.pro b/tests/auto/render/geometryrenderer/geometryrenderer.pro
index 7499730f9..c75501f4e 100644
--- a/tests/auto/render/geometryrenderer/geometryrenderer.pro
+++ b/tests/auto/render/geometryrenderer/geometryrenderer.pro
@@ -7,3 +7,7 @@ QT += 3dcore 3dcore-private 3drender 3drender-private testlib
CONFIG += testcase
SOURCES += tst_geometryrenderer.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
+
diff --git a/tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp b/tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp
index c9bdebb34..4df822557 100644
--- a/tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp
+++ b/tests/auto/render/geometryrenderer/tst_geometryrenderer.cpp
@@ -1,72 +1,78 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DRender/private/geometryrenderer_p.h>
+#include <Qt3DRender/private/geometryrenderermanager_p.h>
#include <Qt3DRender/qgeometry.h>
-#include <Qt3DRender/qgeometryfunctor.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DRender/qgeometryfactory.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include "testrenderer.h"
-class TestFunctor : public Qt3DRender::QGeometryFunctor
+class TestFactory : public Qt3DRender::QGeometryFactory
{
public:
- explicit TestFunctor(int size)
+ explicit TestFactory(int size)
: m_size(size)
{}
Qt3DRender::QGeometry *operator ()() Q_DECL_FINAL
{
- return Q_NULLPTR;
+ return nullptr;
}
- bool operator ==(const Qt3DRender::QGeometryFunctor &other) const
+ bool operator ==(const Qt3DRender::QGeometryFactory &other) const Q_DECL_FINAL
{
- const TestFunctor *otherFunctor = functor_cast<TestFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return otherFunctor->m_size == m_size;
+ const TestFactory *otherFactory = functor_cast<TestFactory>(&other);
+ if (otherFactory != nullptr)
+ return otherFactory->m_size == m_size;
return false;
}
- QT3D_FUNCTOR(TestFunctor)
+ QT3D_FUNCTOR(TestFactory)
-private:
- int m_size;
+ private:
+ int m_size;
};
-class tst_RenderGeometryRenderer : public QObject
+class DummyGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+public:
+ DummyGeometry(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DRender::QGeometry(parent)
+ {}
+};
+
+class tst_RenderGeometryRenderer : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
private Q_SLOTS:
@@ -77,102 +83,107 @@ private Q_SLOTS:
Qt3DRender::Render::GeometryRenderer renderGeometryRenderer;
Qt3DRender::QGeometryRenderer geometryRenderer;
Qt3DRender::QGeometry geometry;
- Qt3DRender::QGeometryFunctorPtr functor(new TestFunctor(1200));
+ Qt3DRender::QGeometryFactoryPtr factory(new TestFactory(1200));
+ Qt3DRender::Render::GeometryRendererManager geometryRendererManager;
geometryRenderer.setInstanceCount(1584);
- geometryRenderer.setPrimitiveCount(1609);
- geometryRenderer.setBaseVertex(750);
- geometryRenderer.setBaseInstance(883);
- geometryRenderer.setRestartIndex(65536);
- geometryRenderer.setPrimitiveRestart(true);
+ geometryRenderer.setVertexCount(1609);
+ geometryRenderer.setIndexOffset(750);
+ geometryRenderer.setFirstInstance(883);
+ geometryRenderer.setRestartIndexValue(65536);
+ geometryRenderer.setPrimitiveRestartEnabled(true);
geometryRenderer.setPrimitiveType(Qt3DRender::QGeometryRenderer::Patches);
geometryRenderer.setGeometry(&geometry);
- geometryRenderer.setGeometryFunctor(functor);
+ geometryRenderer.setGeometryFactory(factory);
geometryRenderer.setEnabled(false);
// WHEN
- renderGeometryRenderer.setPeer(&geometryRenderer);
+ renderGeometryRenderer.setManager(&geometryRendererManager);
+ simulateInitialization(&geometryRenderer, &renderGeometryRenderer);
// THEN
- QCOMPARE(renderGeometryRenderer.peerUuid(), geometryRenderer.id());
+ QCOMPARE(renderGeometryRenderer.peerId(), geometryRenderer.id());
QCOMPARE(renderGeometryRenderer.isDirty(), true);
QCOMPARE(renderGeometryRenderer.instanceCount(), geometryRenderer.instanceCount());
- QCOMPARE(renderGeometryRenderer.primitiveCount(), geometryRenderer.primitiveCount());
- QCOMPARE(renderGeometryRenderer.baseVertex(), geometryRenderer.baseVertex());
- QCOMPARE(renderGeometryRenderer.baseInstance(), geometryRenderer.baseInstance());
- QCOMPARE(renderGeometryRenderer.restartIndex(), geometryRenderer.restartIndex());
- QCOMPARE(renderGeometryRenderer.primitiveRestart(), geometryRenderer.primitiveRestart());
+ QCOMPARE(renderGeometryRenderer.vertexCount(), geometryRenderer.vertexCount());
+ QCOMPARE(renderGeometryRenderer.indexOffset(), geometryRenderer.indexOffset());
+ QCOMPARE(renderGeometryRenderer.firstInstance(), geometryRenderer.firstInstance());
+ QCOMPARE(renderGeometryRenderer.restartIndexValue(), geometryRenderer.restartIndexValue());
+ QCOMPARE(renderGeometryRenderer.primitiveRestartEnabled(), geometryRenderer.primitiveRestartEnabled());
QCOMPARE(renderGeometryRenderer.primitiveType(), geometryRenderer.primitiveType());
QCOMPARE(renderGeometryRenderer.geometryId(), geometry.id());
- QCOMPARE(renderGeometryRenderer.geometryFunctor(), functor);
+ QCOMPARE(renderGeometryRenderer.geometryFactory(), factory);
QCOMPARE(renderGeometryRenderer.isEnabled(), false);
- QVERIFY(*renderGeometryRenderer.geometryFunctor() == *functor);
+ QVERIFY(*renderGeometryRenderer.geometryFactory() == *factory);
}
void checkInitialAndCleanedUpState()
{
// GIVEN
Qt3DRender::Render::GeometryRenderer renderGeometryRenderer;
+ Qt3DRender::Render::GeometryRendererManager geometryRendererManager;
// THEN
- QVERIFY(renderGeometryRenderer.peerUuid().isNull());
+ QVERIFY(renderGeometryRenderer.peerId().isNull());
QVERIFY(renderGeometryRenderer.geometryId().isNull());
QCOMPARE(renderGeometryRenderer.isDirty(), false);
QCOMPARE(renderGeometryRenderer.instanceCount(), 0);
- QCOMPARE(renderGeometryRenderer.primitiveCount(), 0);
- QCOMPARE(renderGeometryRenderer.baseVertex(), 0);
- QCOMPARE(renderGeometryRenderer.baseInstance(), 0);
- QCOMPARE(renderGeometryRenderer.restartIndex(), -1);
- QCOMPARE(renderGeometryRenderer.primitiveRestart(), false);
+ QCOMPARE(renderGeometryRenderer.vertexCount(), 0);
+ QCOMPARE(renderGeometryRenderer.indexOffset(), 0);
+ QCOMPARE(renderGeometryRenderer.firstInstance(), 0);
+ QCOMPARE(renderGeometryRenderer.restartIndexValue(), -1);
+ QCOMPARE(renderGeometryRenderer.primitiveRestartEnabled(), false);
QCOMPARE(renderGeometryRenderer.primitiveType(), Qt3DRender::QGeometryRenderer::Triangles);
- QVERIFY(renderGeometryRenderer.geometryFunctor().isNull());
- QVERIFY(renderGeometryRenderer.isEnabled());
+ QVERIFY(renderGeometryRenderer.geometryFactory().isNull());
+ QVERIFY(!renderGeometryRenderer.isEnabled());
// GIVEN
Qt3DRender::QGeometryRenderer geometryRenderer;
Qt3DRender::QGeometry geometry;
- Qt3DRender::QGeometryFunctorPtr functor(new TestFunctor(1200));
+ Qt3DRender::QGeometryFactoryPtr factory(new TestFactory(1200));
geometryRenderer.setInstanceCount(454);
- geometryRenderer.setPrimitiveCount(350);
- geometryRenderer.setBaseVertex(427);
- geometryRenderer.setBaseInstance(383);
- geometryRenderer.setRestartIndex(555);
- geometryRenderer.setPrimitiveRestart(true);
+ geometryRenderer.setVertexCount(350);
+ geometryRenderer.setIndexOffset(427);
+ geometryRenderer.setFirstInstance(383);
+ geometryRenderer.setRestartIndexValue(555);
+ geometryRenderer.setPrimitiveRestartEnabled(true);
geometryRenderer.setPrimitiveType(Qt3DRender::QGeometryRenderer::Patches);
geometryRenderer.setGeometry(&geometry);
- geometryRenderer.setGeometryFunctor(functor);
- geometryRenderer.setEnabled(false);
+ geometryRenderer.setGeometryFactory(factory);
+ geometryRenderer.setEnabled(true);
// WHEN
- renderGeometryRenderer.updateFromPeer(&geometryRenderer);
+ renderGeometryRenderer.setManager(&geometryRendererManager);
+ simulateInitialization(&geometryRenderer, &renderGeometryRenderer);
renderGeometryRenderer.cleanup();
// THEN
- QVERIFY(renderGeometryRenderer.peerUuid().isNull());
QVERIFY(renderGeometryRenderer.geometryId().isNull());
QCOMPARE(renderGeometryRenderer.isDirty(), false);
QCOMPARE(renderGeometryRenderer.instanceCount(), 0);
- QCOMPARE(renderGeometryRenderer.primitiveCount(), 0);
- QCOMPARE(renderGeometryRenderer.baseVertex(), 0);
- QCOMPARE(renderGeometryRenderer.baseInstance(), 0);
- QCOMPARE(renderGeometryRenderer.restartIndex(), -1);
- QCOMPARE(renderGeometryRenderer.primitiveRestart(), false);
+ QCOMPARE(renderGeometryRenderer.vertexCount(), 0);
+ QCOMPARE(renderGeometryRenderer.indexOffset(), 0);
+ QCOMPARE(renderGeometryRenderer.firstInstance(), 0);
+ QCOMPARE(renderGeometryRenderer.restartIndexValue(), -1);
+ QCOMPARE(renderGeometryRenderer.primitiveRestartEnabled(), false);
QCOMPARE(renderGeometryRenderer.primitiveType(), Qt3DRender::QGeometryRenderer::Triangles);
- QVERIFY(renderGeometryRenderer.geometryFunctor().isNull());
- QVERIFY(renderGeometryRenderer.isEnabled());
+ QVERIFY(renderGeometryRenderer.geometryFactory().isNull());
+ QVERIFY(!renderGeometryRenderer.isEnabled());
}
void checkPropertyChanges()
{
// GIVEN
Qt3DRender::Render::GeometryRenderer renderGeometryRenderer;
+ TestRenderer renderer;
+ renderGeometryRenderer.setRenderer(&renderer);
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setPropertyName("instanceCount");
updateChange->setValue(2);
renderGeometryRenderer.sceneChangeEvent(updateChange);
@@ -180,77 +191,78 @@ private Q_SLOTS:
// THEN
QCOMPARE(renderGeometryRenderer.instanceCount(), 2);
QVERIFY(renderGeometryRenderer.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
renderGeometryRenderer.unsetDirty();
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("primitiveCount");
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("vertexCount");
updateChange->setValue(56);
renderGeometryRenderer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderGeometryRenderer.primitiveCount(), 56);
+ QCOMPARE(renderGeometryRenderer.vertexCount(), 56);
QVERIFY(renderGeometryRenderer.isDirty());
renderGeometryRenderer.unsetDirty();
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("baseVertex");
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("indexOffset");
updateChange->setValue(65);
renderGeometryRenderer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderGeometryRenderer.baseVertex(), 65);
+ QCOMPARE(renderGeometryRenderer.indexOffset(), 65);
QVERIFY(renderGeometryRenderer.isDirty());
renderGeometryRenderer.unsetDirty();
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("baseInstance");
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("firstInstance");
updateChange->setValue(82);
renderGeometryRenderer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderGeometryRenderer.baseInstance(), 82);
+ QCOMPARE(renderGeometryRenderer.firstInstance(), 82);
QVERIFY(renderGeometryRenderer.isDirty());
renderGeometryRenderer.unsetDirty();
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("restartIndex");
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("restartIndexValue");
updateChange->setValue(46);
renderGeometryRenderer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderGeometryRenderer.restartIndex(), 46);
+ QCOMPARE(renderGeometryRenderer.restartIndexValue(), 46);
QVERIFY(renderGeometryRenderer.isDirty());
renderGeometryRenderer.unsetDirty();
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("primitiveRestart");
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("primitiveRestartEnabled");
updateChange->setValue(true);
renderGeometryRenderer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderGeometryRenderer.primitiveRestart(), true);
+ QCOMPARE(renderGeometryRenderer.primitiveRestartEnabled(), true);
QVERIFY(renderGeometryRenderer.isDirty());
renderGeometryRenderer.unsetDirty();
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setPropertyName("primitiveType");
updateChange->setValue(static_cast<int>(Qt3DRender::QGeometryRenderer::LineLoop));
renderGeometryRenderer.sceneChangeEvent(updateChange);
@@ -263,25 +275,25 @@ private Q_SLOTS:
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setPropertyName("geometryFunctor");
- Qt3DRender::QGeometryFunctorPtr functor(new TestFunctor(1450));
- updateChange->setValue(QVariant::fromValue(functor));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setPropertyName("geometryFactory");
+ Qt3DRender::QGeometryFactoryPtr factory(new TestFactory(1450));
+ updateChange->setValue(QVariant::fromValue(factory));
renderGeometryRenderer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderGeometryRenderer.geometryFunctor(), functor);
+ QCOMPARE(renderGeometryRenderer.geometryFactory(), factory);
QVERIFY(renderGeometryRenderer.isDirty());
renderGeometryRenderer.unsetDirty();
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeAdded, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- Qt3DCore::QNodeId geometryId = Qt3DCore::QNodeId::createId();
- updateChange->setValue(QVariant::fromValue(geometryId));
- updateChange->setPropertyName("geometry");
- renderGeometryRenderer.sceneChangeEvent(updateChange);
+ DummyGeometry geometry;
+ const Qt3DCore::QNodeId geometryId = geometry.id();
+ const auto nodeAddedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &geometry);
+ nodeAddedChange->setPropertyName("geometry");
+ renderGeometryRenderer.sceneChangeEvent(nodeAddedChange);
// THEN
QCOMPARE(renderGeometryRenderer.geometryId(), geometryId);
@@ -291,10 +303,9 @@ private Q_SLOTS:
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeRemoved, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(QVariant::fromValue(geometryId));
- updateChange->setPropertyName("geometry");
- renderGeometryRenderer.sceneChangeEvent(updateChange);
+ const auto nodeRemovedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &geometry);
+ nodeRemovedChange->setPropertyName("geometry");
+ renderGeometryRenderer.sceneChangeEvent(nodeRemovedChange);
// THEN
QCOMPARE(renderGeometryRenderer.geometryId(), Qt3DCore::QNodeId());
@@ -304,13 +315,13 @@ private Q_SLOTS:
QVERIFY(!renderGeometryRenderer.isDirty());
// WHEN
- updateChange.reset(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
- updateChange->setValue(QVariant::fromValue(false));
+ updateChange.reset(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
+ updateChange->setValue(QVariant::fromValue(true));
updateChange->setPropertyName("enabled");
renderGeometryRenderer.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(renderGeometryRenderer.isEnabled(), false);
+ QCOMPARE(renderGeometryRenderer.isEnabled(), true);
QVERIFY(!renderGeometryRenderer.isDirty());
}
};
diff --git a/tests/auto/render/material/material.pro b/tests/auto/render/material/material.pro
index b848ec0ec..9efe88ace 100644
--- a/tests/auto/render/material/material.pro
+++ b/tests/auto/render/material/material.pro
@@ -7,3 +7,7 @@ QT += 3dcore 3dcore-private 3drender 3drender-private testlib
CONFIG += testcase
SOURCES += tst_material.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
+
diff --git a/tests/auto/render/material/tst_material.cpp b/tests/auto/render/material/tst_material.cpp
index 7f104347d..7e288b02a 100644
--- a/tests/auto/render/material/tst_material.cpp
+++ b/tests/auto/render/material/tst_material.cpp
@@ -1,53 +1,48 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DRender/private/material_p.h>
#include <Qt3DRender/QMaterial>
#include <Qt3DRender/QParameter>
#include <Qt3DRender/QEffect>
-#include <Qt3DCore/QScenePropertyChange>
-
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
+#include "testrenderer.h"
using namespace Qt3DCore;
using namespace Qt3DRender;
using namespace Qt3DRender::Render;
-class tst_RenderMaterial : public QObject
+class tst_RenderMaterial : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
public:
@@ -71,7 +66,7 @@ void tst_RenderMaterial::shouldHaveInitialState()
// THEN
QVERIFY(backend.parameters().isEmpty());
QVERIFY(backend.effect().isNull());
- QVERIFY(backend.isEnabled());
+ QVERIFY(!backend.isEnabled());
}
void tst_RenderMaterial::shouldHavePropertiesMirroringFromItsPeer_data()
@@ -120,7 +115,7 @@ void tst_RenderMaterial::shouldHavePropertiesMirroringFromItsPeer()
Material backend;
// GIVEN
- backend.setPeer(frontendMaterial);
+ simulateInitialization(frontendMaterial, &backend);
// THEN
QVERIFY(backend.isEnabled() == frontendMaterial->isEnabled());
@@ -139,20 +134,21 @@ void tst_RenderMaterial::shouldHandleParametersPropertyChange()
// GIVEN
QScopedPointer<QParameter> parameter(new QParameter());
Material backend;
+ TestRenderer renderer;
+ backend.setRenderer(&renderer);
// WHEN
- QScenePropertyChangePtr addChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, parameter->id()));
- addChange->setValue(QVariant::fromValue(parameter->id()));
+ const auto addChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), parameter.data());
addChange->setPropertyName("parameter");
backend.sceneChangeEvent(addChange);
// THEN
QCOMPARE(backend.parameters().count(), 1);
QCOMPARE(backend.parameters().first(), parameter->id());
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
- QScenePropertyChangePtr removeChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, parameter->id()));
- removeChange->setValue(QVariant::fromValue(parameter->id()));
+ const auto removeChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), parameter.data());
removeChange->setPropertyName("parameter");
backend.sceneChangeEvent(removeChange);
@@ -164,24 +160,27 @@ void tst_RenderMaterial::shouldHandleEnablePropertyChange()
{
// GIVEN
Material backend;
+ TestRenderer renderer;
+ backend.setRenderer(&renderer);
// WHEN
- QScenePropertyChangePtr updateChange(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, QNodeId()));
- updateChange->setValue(false);
+ auto updateChange = QPropertyUpdatedChangePtr::create(QNodeId());
+ updateChange->setValue(true);
updateChange->setPropertyName("enabled");
backend.sceneChangeEvent(updateChange);
// THEN
- QVERIFY(!backend.isEnabled());
+ QVERIFY(backend.isEnabled());
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
- QScenePropertyChangePtr secondUpdateChange(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, QNodeId()));
- secondUpdateChange->setValue(true);
+ auto secondUpdateChange = QPropertyUpdatedChangePtr::create(QNodeId());
+ secondUpdateChange->setValue(false);
secondUpdateChange->setPropertyName("enabled");
backend.sceneChangeEvent(secondUpdateChange);
// THEN
- QVERIFY(backend.isEnabled());
+ QVERIFY(!backend.isEnabled());
}
@@ -189,9 +188,11 @@ void tst_RenderMaterial::shouldHandleEffectPropertyChange()
{
// GIVEN
Material backend;
+ TestRenderer renderer;
+ backend.setRenderer(&renderer);
// WHEN
- QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
Qt3DCore::QNodeId effectId = Qt3DCore::QNodeId::createId();
updateChange->setValue(QVariant::fromValue(effectId));
updateChange->setPropertyName("effect");
@@ -199,6 +200,7 @@ void tst_RenderMaterial::shouldHandleEffectPropertyChange()
// THEN
QCOMPARE(backend.effect(), effectId);
+ QVERIFY(renderer.dirtyBits() != 0);
}
QTEST_APPLESS_MAIN(tst_RenderMaterial)
diff --git a/tests/auto/render/meshfunctors/tst_meshfunctors.cpp b/tests/auto/render/meshfunctors/tst_meshfunctors.cpp
index 3b4f587a5..6aef510ea 100644
--- a/tests/auto/render/meshfunctors/tst_meshfunctors.cpp
+++ b/tests/auto/render/meshfunctors/tst_meshfunctors.cpp
@@ -1,44 +1,36 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
-#include <Qt3DRender/qgeometryfunctor.h>
+#include <Qt3DRender/qgeometryfactory.h>
#include <Qt3DRender/qgeometry.h>
-class MeshFunctorA : public Qt3DRender::QGeometryFunctor
+class MeshFunctorA : public Qt3DRender::QGeometryFactory
{
public:
MeshFunctorA()
@@ -49,10 +41,10 @@ public:
Qt3DRender::QGeometry *operator ()() Q_DECL_OVERRIDE
{
- return Q_NULLPTR;
+ return nullptr;
}
- bool operator ==(const Qt3DRender::QGeometryFunctor &other) const Q_DECL_OVERRIDE
+ bool operator ==(const Qt3DRender::QGeometryFactory &other) const Q_DECL_OVERRIDE
{
return functor_cast<MeshFunctorA>(&other);
}
@@ -60,7 +52,7 @@ public:
QT3D_FUNCTOR(MeshFunctorA)
};
-class MeshFunctorB : public Qt3DRender::QGeometryFunctor
+class MeshFunctorB : public Qt3DRender::QGeometryFactory
{
public:
MeshFunctorB()
@@ -71,10 +63,10 @@ public:
Qt3DRender::QGeometry *operator ()() Q_DECL_OVERRIDE
{
- return Q_NULLPTR;
+ return nullptr;
}
- bool operator ==(const Qt3DRender::QGeometryFunctor &other) const Q_DECL_OVERRIDE
+ bool operator ==(const Qt3DRender::QGeometryFactory &other) const Q_DECL_OVERRIDE
{
return functor_cast<MeshFunctorB>(&other);
}
@@ -91,7 +83,7 @@ public:
~MeshFunctorASub()
{}
- bool operator ==(const Qt3DRender::QGeometryFunctor &other) const Q_DECL_OVERRIDE
+ bool operator ==(const Qt3DRender::QGeometryFactory &other) const Q_DECL_OVERRIDE
{
return functor_cast<MeshFunctorASub>(&other);
}
diff --git a/tests/auto/render/objectpicker/objectpicker.pro b/tests/auto/render/objectpicker/objectpicker.pro
index 237a89baa..e32ff09be 100644
--- a/tests/auto/render/objectpicker/objectpicker.pro
+++ b/tests/auto/render/objectpicker/objectpicker.pro
@@ -8,4 +8,5 @@ CONFIG += testcase
SOURCES += tst_objectpicker.cpp
+include(../../core/common/common.pri)
include(../commons/commons.pri)
diff --git a/tests/auto/render/objectpicker/tst_objectpicker.cpp b/tests/auto/render/objectpicker/tst_objectpicker.cpp
index ce0314ef8..c42ec60c9 100644
--- a/tests/auto/render/objectpicker/tst_objectpicker.cpp
+++ b/tests/auto/render/objectpicker/tst_objectpicker.cpp
@@ -1,47 +1,42 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire paul.lemire350@gmail.com
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DRender/private/objectpicker_p.h>
+#include <Qt3DRender/qpickevent.h>
#include <Qt3DRender/qobjectpicker.h>
#include <Qt3DCore/private/qbackendnode_p.h>
-#include <Qt3DCore/qscenepropertychange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
#include "testpostmanarbiter.h"
+#include "testrenderer.h"
-class tst_ObjectPicker : public QObject
+class tst_ObjectPicker : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
private Q_SLOTS:
@@ -54,11 +49,11 @@ private Q_SLOTS:
picker.setHoverEnabled(true);
// WHEN
- objectPicker.setPeer(&picker);
+ simulateInitialization(&picker, &objectPicker);
// THEN
- QVERIFY(!objectPicker.peerUuid().isNull());
- QCOMPARE(objectPicker.hoverEnabled(), true);
+ QVERIFY(!objectPicker.peerId().isNull());
+ QCOMPARE(objectPicker.isHoverEnabled(), true);
QCOMPARE(objectPicker.isDirty(), true);
}
@@ -68,8 +63,8 @@ private Q_SLOTS:
Qt3DRender::Render::ObjectPicker objectPicker;
// THEN
- QVERIFY(objectPicker.peerUuid().isNull());
- QCOMPARE(objectPicker.hoverEnabled(), false);
+ QVERIFY(objectPicker.peerId().isNull());
+ QCOMPARE(objectPicker.isHoverEnabled(), false);
QCOMPARE(objectPicker.isDirty(), false);
// GIVEN
@@ -77,12 +72,11 @@ private Q_SLOTS:
picker.setHoverEnabled(true);
// WHEN
- objectPicker.updateFromPeer(&picker);
+ simulateInitialization(&picker, &objectPicker);
objectPicker.cleanup();
// THEN
- QVERIFY(objectPicker.peerUuid().isNull());
- QCOMPARE(objectPicker.hoverEnabled(), false);
+ QCOMPARE(objectPicker.isHoverEnabled(), false);
QCOMPARE(objectPicker.isDirty(), false);
}
@@ -90,18 +84,21 @@ private Q_SLOTS:
{
// GIVEN
Qt3DRender::Render::ObjectPicker objectPicker;
+ TestRenderer renderer;
+ objectPicker.setRenderer(&renderer);
QVERIFY(!objectPicker.isDirty());
// WHEN
- Qt3DCore::QScenePropertyChangePtr updateChange(new Qt3DCore::QScenePropertyChange(Qt3DCore::NodeUpdated, Qt3DCore::QSceneChange::Node, Qt3DCore::QNodeId()));
+ Qt3DCore::QPropertyUpdatedChangePtr updateChange(new Qt3DCore::QPropertyUpdatedChange(Qt3DCore::QNodeId()));
updateChange->setValue(true);
updateChange->setPropertyName("hoverEnabled");
objectPicker.sceneChangeEvent(updateChange);
// THEN
- QCOMPARE(objectPicker.hoverEnabled(), true);
+ QCOMPARE(objectPicker.isHoverEnabled(), true);
QVERIFY(objectPicker.isDirty());
+ QVERIFY(renderer.dirtyBits() != 0);
objectPicker.unsetDirty();
QVERIFY(!objectPicker.isDirty());
@@ -113,34 +110,35 @@ private Q_SLOTS:
TestArbiter arbiter;
Qt3DRender::Render::ObjectPicker objectPicker;
Qt3DCore::QBackendNodePrivate::get(&objectPicker)->setArbiter(&arbiter);
+ Qt3DRender::QPickEventPtr event(new Qt3DRender::QPickEvent);
QVERIFY(!objectPicker.isDirty());
// WHEN
- objectPicker.onPressed();
+ objectPicker.onPressed(event);
// THEN
QCOMPARE(arbiter.events.count(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "pressed");
arbiter.events.clear();
// WHEN
- objectPicker.onReleased();
+ objectPicker.onReleased(event);
// THEN
QCOMPARE(arbiter.events.count(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "released");
arbiter.events.clear();
// WHEN
- objectPicker.onClicked();
+ objectPicker.onClicked(event);
// THEN
QCOMPARE(arbiter.events.count(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "clicked");
arbiter.events.clear();
@@ -150,7 +148,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.count(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "entered");
arbiter.events.clear();
@@ -160,7 +158,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.count(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "exited");
arbiter.events.clear();
diff --git a/tests/auto/render/picking/picking.pro b/tests/auto/render/picking/picking.pro
index 4745033d3..3d7ad7875 100644
--- a/tests/auto/render/picking/picking.pro
+++ b/tests/auto/render/picking/picking.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = tst_picking
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib 3dextras
CONFIG += testcase
diff --git a/tests/auto/render/picking/tst_picking.cpp b/tests/auto/render/picking/tst_picking.cpp
index 93ff2b506..b4aa39545 100644
--- a/tests/auto/render/picking/tst_picking.cpp
+++ b/tests/auto/render/picking/tst_picking.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,28 +29,28 @@
#include <QtTest/QtTest>
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/qtransform.h>
-#include <Qt3DCore/QScenePropertyChange>
+#include <Qt3DCore/QPropertyUpdatedChange>
#include <Qt3DRender/private/qboundingvolumeprovider_p.h>
#include <Qt3DRender/private/pickboundingvolumejob_p.h>
#include <Qt3DRender/private/objectpicker_p.h>
#include <Qt3DRender/qobjectpicker.h>
-#include <Qt3DRender/qspheremesh.h>
+#include <Qt3DExtras/qspheremesh.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
-#include <Qt3DRender/qspheregeometry.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DExtras/qspheregeometry.h>
#include <Qt3DRender/qpickevent.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
using namespace Qt3DCore;
using namespace Qt3DRender;
+using namespace Qt3DExtras;
using namespace Qt3DRender::Render;
class MyObjectPicker : public Qt3DRender::QObjectPicker
{
Q_OBJECT
public:
- MyObjectPicker(Qt3DCore::QNode *parent = Q_NULLPTR)
+ MyObjectPicker(Qt3DCore::QNode *parent = nullptr)
: Qt3DRender::QObjectPicker(parent)
{}
@@ -72,7 +64,7 @@ class PickableEntity : public QEntity
{
Q_OBJECT
public:
- explicit PickableEntity(const QVector3D &position, float radius, QEntity *parent = Q_NULLPTR)
+ explicit PickableEntity(const QVector3D &position, float radius, QEntity *parent = nullptr)
: QEntity(parent)
, picker(new MyObjectPicker(this))
, mesh(new QSphereMesh(this))
@@ -88,7 +80,7 @@ public:
Qt3DRender::QBuffer *vertexBuffer = static_cast<Qt3DRender::QBuffer *>(positionAttr->buffer());
// Load the geometry
- const QByteArray data = (*vertexBuffer->bufferFunctor())();
+ const QByteArray data = (*vertexBuffer->dataGenerator())();
vertexBuffer->setData(data);
transform->setTranslation(position);
@@ -136,7 +128,11 @@ class tst_Picking : public QObject
{
Q_OBJECT
public:
- tst_Picking() {}
+ tst_Picking()
+ {
+ qRegisterMetaType<Qt3DCore::QNode*>();
+ }
+
~tst_Picking() {}
private Q_SLOTS:
@@ -148,9 +144,15 @@ private Q_SLOTS:
PickableEntity child2(QVector3D(), 5.0f, &root);
PickableEntity child11(QVector3D(), 5.0f, &child1);
+ QCoreApplication::processEvents();
+
// WHEN
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, child11.id()));
+ Qt3DRender::QPickEventPtr event(new Qt3DRender::QPickEvent());
+ QVariant v;
+ v.setValue<Qt3DRender::QPickEventPtr>(event);
+ Qt3DCore::QPropertyUpdatedChangePtr e(new Qt3DCore::QPropertyUpdatedChange(child11.id()));
e->setPropertyName("pressed");
+ e->setValue(v);
child11.picker->sceneChangeEvent(e);
// THEN
@@ -192,9 +194,15 @@ private Q_SLOTS:
PickableEntity child2(QVector3D(), 5.0f, &root);
PickableEntity child11(QVector3D(), 5.0f, &child1);
+ QCoreApplication::processEvents();
+
// WHEN
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, child11.id()));
+ Qt3DRender::QPickEventPtr event(new Qt3DRender::QPickEvent());
+ QVariant v;
+ v.setValue<Qt3DRender::QPickEventPtr>(event);
+ Qt3DCore::QPropertyUpdatedChangePtr e(new Qt3DCore::QPropertyUpdatedChange(child11.id()));
e->setPropertyName("pressed");
+ e->setValue(v);
child11.picker->sceneChangeEvent(e);
e->setPropertyName("released");
child11.picker->sceneChangeEvent(e);
@@ -232,9 +240,15 @@ private Q_SLOTS:
PickableEntity child2(QVector3D(), 5.0f, &root);
PickableEntity child11(QVector3D(), 5.0f, &child1);
+ QCoreApplication::processEvents();
+
// WHEN
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, child11.id()));
+ Qt3DRender::QPickEventPtr event(new Qt3DRender::QPickEvent());
+ QVariant v;
+ v.setValue<Qt3DRender::QPickEventPtr>(event);
+ Qt3DCore::QPropertyUpdatedChangePtr e(new Qt3DCore::QPropertyUpdatedChange(child11.id()));
e->setPropertyName("clicked");
+ e->setValue(v);
child11.picker->sceneChangeEvent(e);
// THEN
@@ -269,6 +283,6 @@ private Q_SLOTS:
}
};
-QTEST_APPLESS_MAIN(tst_Picking)
+QTEST_MAIN(tst_Picking)
#include "tst_picking.moc"
diff --git a/tests/auto/render/qabstractlight/qabstractlight.pro b/tests/auto/render/qabstractlight/qabstractlight.pro
new file mode 100644
index 000000000..764681f1d
--- /dev/null
+++ b/tests/auto/render/qabstractlight/qabstractlight.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+
+TARGET = tst_qabstractlight
+
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qabstractlight.cpp
+
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qabstractlight/tst_qabstractlight.cpp b/tests/auto/render/qabstractlight/tst_qabstractlight.cpp
new file mode 100644
index 000000000..c85fcde6b
--- /dev/null
+++ b/tests/auto/render/qabstractlight/tst_qabstractlight.cpp
@@ -0,0 +1,289 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+
+#include <Qt3DRender/qabstractlight.h>
+#include <Qt3DRender/private/qabstractlight_p.h>
+#include <Qt3DRender/qpointlight.h>
+#include <Qt3DRender/qdirectionallight.h>
+#include <Qt3DRender/qspotlight.h>
+#include <Qt3DRender/private/qpointlight_p.h>
+#include <Qt3DRender/private/qdirectionallight_p.h>
+#include <Qt3DRender/private/qspotlight_p.h>
+
+#include "testpostmanarbiter.h"
+
+class DummyLight : public Qt3DRender::QAbstractLight
+{
+ Q_OBJECT
+
+public:
+ explicit DummyLight(Qt3DCore::QNode *parent = nullptr)
+ : QAbstractLight(*new Qt3DRender::QAbstractLightPrivate(QAbstractLight::PointLight), parent)
+ {}
+};
+
+
+// We need to call QNode::clone which is protected
+// So we sublcass QNode instead of QObject
+class tst_QAbstractLight: public Qt3DCore::QNode
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ // TO DO: Test should be rewritten to query the properties from the attached QShaderData
+
+// void checkLightCloning()
+// {
+// // GIVEN
+// DummyLight light;
+// light.setColor(Qt::red);
+// light.setIntensity(0.5f);
+
+// // WHEN
+// Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(material);
+// QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+// // THEN
+// QVERIFY(creationChanges.size() >= 1);
+
+// const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QA> creationChangeData =
+// qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QMaterialData>>(creationChanges.first());
+// const Qt3DRender::QMaterialData &cloneData = creationChangeData->data;
+
+
+// QScopedPointer<Qt3DRender::QAbstractLight> lightClone(static_cast<Qt3DRender::QAbstractLight *>(QNode::clone(&light)));
+// QVERIFY(lightClone.data());
+// QCOMPARE(light.color(), lightClone->color());
+// QCOMPARE(light.intensity(), lightClone->intensity());
+// }
+
+// void checkPointLightCloning()
+// {
+// Qt3DRender::QPointLight pointLight;
+// QCOMPARE(pointLight.type(), Qt3DRender::QAbstractLight::PointLight);
+// pointLight.setColor(Qt::green);
+// pointLight.setIntensity(0.5f);
+// pointLight.setConstantAttenuation(0.5f);
+// pointLight.setLinearAttenuation(0.0f); // No actual event triggered as 0.0f is default
+// pointLight.setQuadraticAttenuation(1.0f);
+
+// QScopedPointer<Qt3DRender::QPointLight> pointLightClone(static_cast<Qt3DRender::QPointLight *>(QNode::clone(&pointLight)));
+// QVERIFY(pointLightClone.data());
+// QCOMPARE(pointLightClone->type(), Qt3DRender::QAbstractLight::PointLight);
+// QCOMPARE(pointLight.color(), pointLightClone->color());
+// QCOMPARE(pointLight.intensity(), pointLightClone->intensity());
+// QCOMPARE(pointLight.constantAttenuation(), pointLightClone->constantAttenuation());
+// QCOMPARE(pointLight.linearAttenuation(), pointLightClone->linearAttenuation());
+// QCOMPARE(pointLight.quadraticAttenuation(), pointLightClone->quadraticAttenuation());
+// }
+
+// void checkDirectionalLightCloning()
+// {
+// Qt3DRender::QDirectionalLight dirLight;
+// QCOMPARE(dirLight.type(), Qt3DRender::QAbstractLight::DirectionalLight);
+// dirLight.setColor(Qt::blue);
+// dirLight.setIntensity(0.5f);
+// dirLight.setWorldDirection(QVector3D(0, 0, -1));
+
+// QScopedPointer<Qt3DRender::QDirectionalLight> dirLightClone(static_cast<Qt3DRender::QDirectionalLight *>(QNode::clone(&dirLight)));
+// QVERIFY(dirLightClone.data());
+// QCOMPARE(dirLightClone->type(), Qt3DRender::QAbstractLight::DirectionalLight);
+// QCOMPARE(dirLight.color(), dirLightClone->color());
+// QCOMPARE(dirLight.intensity(), dirLightClone->intensity());
+// QCOMPARE(dirLight.worldDirection(), dirLightClone->worldDirection());
+// }
+
+// void checkSpotLightCloning()
+// {
+// Qt3DRender::QSpotLight spotLight;
+// QCOMPARE(spotLight.type(), Qt3DRender::QAbstractLight::SpotLight);
+// spotLight.setColor(Qt::lightGray);
+// spotLight.setIntensity(0.5f);
+// spotLight.setLocalDirection(QVector3D(0, 0, -1));
+// spotLight.setCutOffAngle(0.75f);
+
+// QScopedPointer<Qt3DRender::QSpotLight> spotLightClone(static_cast<Qt3DRender::QSpotLight *>(QNode::clone(&spotLight)));
+// QVERIFY(spotLightClone.data());
+// QCOMPARE(spotLightClone->type(), Qt3DRender::QAbstractLight::SpotLight);
+// QCOMPARE(spotLight.color(), spotLightClone->color());
+// QCOMPARE(spotLight.intensity(), spotLightClone->intensity());
+// QCOMPARE(spotLight.localDirection(), spotLightClone->localDirection());
+// QCOMPARE(spotLight.cutOffAngle(), spotLightClone->cutOffAngle());
+// }
+
+ void checkLightPropertyUpdates()
+ {
+ QScopedPointer<Qt3DRender::QAbstractLight> light(new DummyLight);
+ TestArbiter lightArbiter(light.data());
+
+ light->setColor(Qt::red);
+ light->setIntensity(0.5f);
+ QCoreApplication::processEvents();
+
+ QCOMPARE(lightArbiter.events.size(), 2 * 2); // Due to contained shader data
+ for (int i = 0; i < 2; i++)
+ lightArbiter.events.removeAt(i);
+ Qt3DCore::QPropertyUpdatedChangePtr change = lightArbiter.events[0].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "color");
+ QCOMPARE(change->subjectId(), light->id());
+ QCOMPARE(change->value().value<QColor>(), QColor(Qt::red));
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = lightArbiter.events[1].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "intensity");
+ QCOMPARE(change->subjectId(), light->id());
+ QCOMPARE(change->value().value<float>(), 0.5f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ lightArbiter.events.clear();
+
+ light->setColor(Qt::red);
+ QCoreApplication::processEvents();
+
+ QCOMPARE(lightArbiter.events.size(), 0);
+
+ lightArbiter.events.clear();
+ }
+
+ void checkPointLightPropertyUpdates()
+ {
+ QScopedPointer<Qt3DRender::QPointLight> pointLight(new Qt3DRender::QPointLight);
+ TestArbiter pointLightArbiter(pointLight.data());
+
+ pointLight->setColor(Qt::green);
+ pointLight->setIntensity(0.5f);
+ pointLight->setConstantAttenuation(0.5f);
+ pointLight->setLinearAttenuation(0.0f); // No actual event triggered as 0.0f is default
+ pointLight->setQuadraticAttenuation(1.0f);
+ QCoreApplication::processEvents();
+
+ QCOMPARE(pointLightArbiter.events.size(), 4 * 2); // Due to contained shader data
+ for (int i = 0; i < 4; i++)
+ pointLightArbiter.events.removeAt(i);
+ Qt3DCore::QPropertyUpdatedChangePtr change = pointLightArbiter.events[0].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "color");
+ QCOMPARE(change->subjectId(), pointLight->id());
+ QCOMPARE(change->value().value<QColor>(), QColor(Qt::green));
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = pointLightArbiter.events[1].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "intensity");
+ QCOMPARE(change->subjectId(), pointLight->id());
+ QCOMPARE(change->value().value<float>(), 0.5f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = pointLightArbiter.events[2].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "constantAttenuation");
+ QCOMPARE(change->subjectId(), pointLight->id());
+ QCOMPARE(change->value().value<float>(), 0.5f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = pointLightArbiter.events[3].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "quadraticAttenuation");
+ QCOMPARE(change->subjectId(), pointLight->id());
+ QCOMPARE(change->value().value<float>(), 1.0f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ pointLightArbiter.events.clear();
+ }
+
+ void checkDirectionalLightPropertyUpdates()
+ {
+ QScopedPointer<Qt3DRender::QDirectionalLight> dirLight(new Qt3DRender::QDirectionalLight);
+ TestArbiter dirLightArbiter(dirLight.data());
+
+ dirLight->setColor(Qt::blue);
+ dirLight->setIntensity(0.5f);
+ dirLight->setWorldDirection(QVector3D(0.5f, 0.0f, -1.0f));
+ QCoreApplication::processEvents();
+
+ QCOMPARE(dirLightArbiter.events.size(), 3 * 2); // Due to contained shader data
+ for (int i = 0; i < 3; i++)
+ dirLightArbiter.events.removeAt(i);
+ Qt3DCore::QPropertyUpdatedChangePtr change = dirLightArbiter.events[0].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "color");
+ QCOMPARE(change->subjectId(), dirLight->id());
+ QCOMPARE(change->value().value<QColor>(), QColor(Qt::blue));
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = dirLightArbiter.events[1].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "intensity");
+ QCOMPARE(change->subjectId(), dirLight->id());
+ QCOMPARE(change->value().value<float>(), 0.5f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = dirLightArbiter.events[2].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "worldDirection");
+ QCOMPARE(change->subjectId(), dirLight->id());
+ QCOMPARE(change->value().value<QVector3D>(), QVector3D(0.5f, 0.0f, -1.0f));
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ dirLightArbiter.events.clear();
+ }
+
+ void checkSpotLightPropertyUpdates()
+ {
+ QScopedPointer<Qt3DRender::QSpotLight> spotLight(new Qt3DRender::QSpotLight);
+ TestArbiter spotLightArbiter(spotLight.data());
+
+ spotLight->setColor(Qt::lightGray);
+ spotLight->setIntensity(0.5f);
+ spotLight->setLocalDirection(QVector3D(0.5f, 0.0f, -1.0f));
+ spotLight->setCutOffAngle(0.75f);
+ QCoreApplication::processEvents();
+
+ QCOMPARE(spotLightArbiter.events.size(), 4 * 2); // Due to contained shader data
+ for (int i = 0; i < 4; i++)
+ spotLightArbiter.events.removeAt(i);
+ Qt3DCore::QPropertyUpdatedChangePtr change = spotLightArbiter.events[0].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "color");
+ QCOMPARE(change->subjectId(), spotLight->id());
+ QCOMPARE(change->value().value<QColor>(), QColor(Qt::lightGray));
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = spotLightArbiter.events[1].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "intensity");
+ QCOMPARE(change->subjectId(), spotLight->id());
+ QCOMPARE(change->value().value<float>(), 0.5f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = spotLightArbiter.events[2].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "localDirection");
+ QCOMPARE(change->subjectId(), spotLight->id());
+ QCOMPARE(change->value().value<QVector3D>(), QVector3D(0.5f, 0.0f, -1.0f));
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ change = spotLightArbiter.events[3].staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "cutOffAngle");
+ QCOMPARE(change->subjectId(), spotLight->id());
+ QCOMPARE(change->value().value<float>(), 0.75f);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ spotLightArbiter.events.clear();
+ }
+};
+
+QTEST_MAIN(tst_QAbstractLight)
+
+#include "tst_qabstractlight.moc"
diff --git a/tests/auto/render/qattribute/tst_qattribute.cpp b/tests/auto/render/qattribute/tst_qattribute.cpp
index acc3f8cbb..9632f4fcb 100644
--- a/tests/auto/render/qattribute/tst_qattribute.cpp
+++ b/tests/auto/render/qattribute/tst_qattribute.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,26 +29,21 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/QAttribute>
+#include <Qt3DRender/private/qattribute_p.h>
#include <Qt3DRender/QBuffer>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QAttribute: public Qt3DCore::QNode
+class tst_QAttribute: public QObject
{
Q_OBJECT
public:
tst_QAttribute()
{
- qRegisterMetaType<Qt3DRender::QAbstractBuffer*>("Qt3DCore::QAbstractBuffer*");
- }
-
- ~tst_QAttribute()
- {
- QNode::cleanup();
+ qRegisterMetaType<Qt3DRender::QBuffer*>("Qt3DCore::QBuffer*");
}
private Q_SLOTS:
@@ -71,7 +58,7 @@ private Q_SLOTS:
Qt3DRender::QAttribute *customVertex = new Qt3DRender::QAttribute();
Qt3DRender::QBuffer *buffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer);
customVertex->setBuffer(buffer);
- customVertex->setAttributeType(Qt3DRender::QAbstractAttribute::VertexAttribute);
+ customVertex->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
customVertex->setCount(454);
customVertex->setByteStride(427);
customVertex->setByteOffset(305);
@@ -84,7 +71,7 @@ private Q_SLOTS:
Qt3DRender::QAttribute *customIndex = new Qt3DRender::QAttribute();
Qt3DRender::QBuffer *indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer);
customIndex->setBuffer(indexBuffer);
- customIndex->setAttributeType(Qt3DRender::QAbstractAttribute::IndexAttribute);
+ customIndex->setAttributeType(Qt3DRender::QAttribute::IndexAttribute);
customIndex->setCount(383);
customIndex->setByteStride(350);
customIndex->setByteOffset(327);
@@ -101,27 +88,28 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QAttribute *, attribute);
// WHEN
- Qt3DRender::QAttribute *clone = static_cast<Qt3DRender::QAttribute *>(QNode::clone(attribute));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(attribute);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(attribute->id(), clone->id());
- QCOMPARE(attribute->name(), clone->name());
- QCOMPARE(attribute->count(), clone->count());
- QCOMPARE(attribute->byteStride(), clone->byteStride());
- QCOMPARE(attribute->byteOffset(), clone->byteOffset());
- QCOMPARE(attribute->divisor(), clone->divisor());
- QCOMPARE(attribute->dataType(), clone->dataType());
- QCOMPARE(attribute->dataSize(), clone->dataSize());
- QVERIFY(attribute->attributeType() == clone->attributeType());
-
- if (attribute->buffer() != Q_NULLPTR) {
- QVERIFY(clone->buffer() != Q_NULLPTR);
- QVERIFY(attribute->buffer()->id() == clone->buffer()->id());
- QVERIFY(attribute->buffer()->type() == clone->buffer()->type());
- }
+ QCOMPARE(creationChanges.size(), 1 + (attribute->buffer() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QAttributeData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QAttributeData>>(creationChanges.first());
+ const Qt3DRender::QAttributeData &cloneData = creationChangeData->data;
+
+ QCOMPARE(attribute->id(), creationChangeData->subjectId());
+ QCOMPARE(attribute->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(attribute->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(attribute->name(), cloneData.name);
+ QCOMPARE(attribute->count(), cloneData.count);
+ QCOMPARE(attribute->byteStride(), cloneData.byteStride);
+ QCOMPARE(attribute->byteOffset(), cloneData.byteOffset);
+ QCOMPARE(attribute->divisor(), cloneData.divisor);
+ QCOMPARE(attribute->vertexBaseType(), cloneData.dataType);
+ QCOMPARE(attribute->vertexSize(), cloneData.dataSize);
+ QVERIFY(attribute->attributeType() == cloneData.attributeType);
+ QCOMPARE(attribute->buffer() ? attribute->buffer()->id() : Qt3DCore::QNodeId(), cloneData.bufferId);
}
void checkPropertyUpdates()
@@ -136,10 +124,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "dataType");
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "vertexBaseType");
QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QAttribute::Double));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -149,10 +137,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "dataSize");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "vertexSize");
QCOMPARE(change->value().value<uint>(), 4U);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -162,10 +150,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "name");
QCOMPARE(change->value().value<QString>(), QStringLiteral("Duntov"));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -175,10 +163,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "count");
QCOMPARE(change->value().value<uint>(), 883U);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -188,10 +176,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "byteStride");
QCOMPARE(change->value().value<uint>(), 1340U);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -201,10 +189,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "byteOffset");
QCOMPARE(change->value().value<uint>(), 1584U);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -214,23 +202,23 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "divisor");
QCOMPARE(change->value().value<uint>(), 1450U);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- attribute->setAttributeType(Qt3DRender::QAbstractAttribute::IndexAttribute);
+ attribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "attributeType");
- QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QAbstractAttribute::IndexAttribute));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QAttribute::IndexAttribute));
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -241,10 +229,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "buffer");
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), buf.id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -255,19 +243,12 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "buffer");
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), buf2.id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QAttribute)
diff --git a/tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp b/tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp
index 14bfe09c8..5a37d98a1 100644
--- a/tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp
+++ b/tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,11 +30,13 @@
#include <Qt3DCore/QEntity>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
-#include <Qt3DRender/QBoundingVolumeDebug>
+#include <Qt3DCore/qbackendnodepropertychange.h>
+#include <Qt3DRender/private/qboundingvolumedebug_p.h>
#include "testpostmanarbiter.h"
+#if 0
+
class MyBoundingVolumeDebug : public Qt3DRender::QBoundingVolumeDebug
{
Q_OBJECT
@@ -89,20 +83,21 @@ private Q_SLOTS:
QTest::newRow("recursive_bvd") << bvD;
}
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QBoundingVolumeDebug *, bvD);
+ // TODO: Avoid cloning here
+// void checkCloning()
+// {
+// // GIVEN
+// QFETCH(Qt3DRender::QBoundingVolumeDebug *, bvD);
- // WHEN
- Qt3DRender::QBoundingVolumeDebug *clone = static_cast<Qt3DRender::QBoundingVolumeDebug *>(QNode::clone(bvD));
- QCoreApplication::processEvents();
+// // WHEN
+// Qt3DRender::QBoundingVolumeDebug *clone = static_cast<Qt3DRender::QBoundingVolumeDebug *>(QNode::clone(bvD));
+// QCoreApplication::processEvents();
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(bvD->id(), clone->id());
- QCOMPARE(bvD->recursive(), clone->recursive());
- }
+// // THEN
+// QVERIFY(clone != Q_NULLPTR);
+// QCOMPARE(bvD->id(), clone->id());
+// QCOMPARE(bvD->recursive(), clone->recursive());
+// }
void checkPropertyUpdates()
{
@@ -116,7 +111,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.last().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QNodePropertyChangePtr change = arbiter.events.last().staticCast<Qt3DCore::QNodePropertyChange>();
QCOMPARE(change->propertyName(), "recursive");
QCOMPARE(change->value().toBool(), true);
QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
@@ -136,7 +131,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.last().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.last().staticCast<Qt3DCore::QNodePropertyChange>();
QCOMPARE(change->propertyName(), "recursive");
QCOMPARE(change->value().toBool(), false);
QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
@@ -158,7 +153,7 @@ private Q_SLOTS:
// WHEN
// Create Backend Change and distribute it to frontend node
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, bvD->id()));
+ Qt3DCore::QBackendNodePropertyChangePtr e(new Qt3DCore::QBackendNodePropertyChange(bvD->id()));
e->setPropertyName("center");
bvD->sceneChangeEvent(e);
QCoreApplication::processEvents();
@@ -167,14 +162,6 @@ private Q_SLOTS:
QCOMPARE(entity->children().count(), 2);
QCOMPARE(bvD->children().count(), 0);
}
-
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QBoundingVolumeDebug)
diff --git a/tests/auto/render/qbuffer/tst_qbuffer.cpp b/tests/auto/render/qbuffer/tst_qbuffer.cpp
index 6d9649a42..566f16f13 100644
--- a/tests/auto/render/qbuffer/tst_qbuffer.cpp
+++ b/tests/auto/render/qbuffer/tst_qbuffer.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,13 +29,15 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
+#include <Qt3DRender/private/qbuffer_p.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
#include "testpostmanarbiter.h"
-class TestFunctor : public Qt3DRender::QBufferFunctor
+class TestFunctor : public Qt3DRender::QBufferDataGenerator
{
public:
explicit TestFunctor(int size)
@@ -55,10 +49,10 @@ public:
return QByteArray();
}
- bool operator ==(const Qt3DRender::QBufferFunctor &other) const
+ bool operator ==(const Qt3DRender::QBufferDataGenerator &other) const Q_DECL_FINAL
{
const TestFunctor *otherFunctor = functor_cast<TestFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
+ if (otherFunctor != nullptr)
return otherFunctor->m_size == m_size;
return false;
}
@@ -69,16 +63,9 @@ private:
int m_size;
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QBuffer: public Qt3DCore::QNode
+class tst_QBuffer: public QObject
{
Q_OBJECT
-public:
- ~tst_QBuffer()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -92,14 +79,14 @@ private Q_SLOTS:
Qt3DRender::QBuffer *buffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer);
buffer->setUsage(Qt3DRender::QBuffer::DynamicRead);
buffer->setData(QByteArrayLiteral("There's no replacement"));
- buffer->setBufferFunctor(Qt3DRender::QBufferFunctorPtr(new TestFunctor(883)));
+ buffer->setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(883)));
QTest::newRow("vertex") << buffer;
Qt3DRender::QBuffer *indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer);
indexBuffer->setUsage(Qt3DRender::QBuffer::StaticCopy);
indexBuffer->setData(QByteArrayLiteral("For displacement"));
- indexBuffer->setBufferFunctor(Qt3DRender::QBufferFunctorPtr(new TestFunctor(1340)));
- indexBuffer->setSync(true);
+ indexBuffer->setDataGenerator(Qt3DRender::QBufferDataGeneratorPtr(new TestFunctor(1340)));
+ indexBuffer->setSyncData(true);
QTest::newRow("index") << indexBuffer;
}
@@ -109,20 +96,29 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QBuffer *, buffer);
// WHEN
- Qt3DRender::QBuffer *clone = static_cast<Qt3DRender::QBuffer *>(QNode::clone(buffer));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(buffer);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(buffer->id(), clone->id());
- QCOMPARE(buffer->data(), clone->data());
- QCOMPARE(buffer->usage(), clone->usage());
- QCOMPARE(buffer->type(), clone->type());
- QCOMPARE(buffer->bufferFunctor(), clone->bufferFunctor());
- QCOMPARE(buffer->isSync(), clone->isSync());
- if (buffer->bufferFunctor()) {
- QVERIFY(clone->bufferFunctor());
- QVERIFY(*clone->bufferFunctor() == *buffer->bufferFunctor());
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QBufferData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QBufferData>>(creationChanges.first());
+ const Qt3DRender::QBufferData &cloneData = creationChangeData->data;
+
+
+ QCOMPARE(buffer->id(), creationChangeData->subjectId());
+ QCOMPARE(buffer->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(buffer->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(buffer->data(), cloneData.data);
+ QCOMPARE(buffer->usage(), cloneData.usage);
+ QCOMPARE(buffer->type(), cloneData.type);
+ QCOMPARE(buffer->dataGenerator(), cloneData.functor);
+ QCOMPARE(buffer->isSyncData(), cloneData.syncData);
+ if (buffer->dataGenerator()) {
+ QVERIFY(cloneData.functor);
+ QVERIFY(*cloneData.functor == *buffer->dataGenerator());
+ QCOMPARE((*cloneData.functor)(), (*buffer->dataGenerator())());
}
}
@@ -138,7 +134,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "type");
QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QBuffer::IndexBuffer));
@@ -150,7 +146,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "usage");
QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QBuffer::DynamicCopy));
@@ -162,44 +158,37 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "data");
QCOMPARE(change->value().value<QByteArray>(), QByteArrayLiteral("Z28"));
arbiter.events.clear();
// WHEN
- Qt3DRender::QBufferFunctorPtr functor(new TestFunctor(355));
- buffer->setBufferFunctor(functor);
+ Qt3DRender::QBufferDataGeneratorPtr functor(new TestFunctor(355));
+ buffer->setDataGenerator(functor);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "bufferFunctor");
- QCOMPARE(change->value().value<Qt3DRender::QBufferFunctorPtr>(), functor);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "dataGenerator");
+ QCOMPARE(change->value().value<Qt3DRender::QBufferDataGeneratorPtr>(), functor);
arbiter.events.clear();
// WHEN
- buffer->setSync(true);
+ buffer->setSyncData(true);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "sync");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "syncData");
QCOMPARE(change->value().toBool(), true);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QBuffer)
diff --git a/tests/auto/render/qcameraselector/tst_qcameraselector.cpp b/tests/auto/render/qcameraselector/tst_qcameraselector.cpp
index 96faf4e18..ca6895f90 100644
--- a/tests/auto/render/qcameraselector/tst_qcameraselector.cpp
+++ b/tests/auto/render/qcameraselector/tst_qcameraselector.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,22 +29,17 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qcameraselector.h>
+#include <Qt3DRender/private/qcameraselector_p.h>
#include <Qt3DCore/qentity.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QCameraSelector: public Qt3DCore::QNode
+class tst_QCameraSelector: public QObject
{
Q_OBJECT
-public:
- ~tst_QCameraSelector()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -62,7 +49,7 @@ private Q_SLOTS:
QTest::addColumn<Qt3DCore::QEntity *>("camera");
Qt3DRender::QCameraSelector *defaultConstructed = new Qt3DRender::QCameraSelector();
- QTest::newRow("defaultConstructed") << defaultConstructed << static_cast<Qt3DCore::QEntity *>(Q_NULLPTR);
+ QTest::newRow("defaultConstructed") << defaultConstructed << static_cast<Qt3DCore::QEntity *>(nullptr);
Qt3DRender::QCameraSelector *selector1 = new Qt3DRender::QCameraSelector();
Qt3DCore::QEntity *camera1 = new Qt3DCore::QEntity();
@@ -77,21 +64,22 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QEntity *, camera);
// WHEN
- Qt3DRender::QCameraSelector *clone = static_cast<Qt3DRender::QCameraSelector *>(QNode::clone(cameraSelector));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(cameraSelector);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
+ QCOMPARE(creationChanges.size(), 1 + (camera ? 1 : 0));
- QCOMPARE(cameraSelector->id(), clone->id());
- if (cameraSelector->camera()) {
- QVERIFY(clone->camera());
- QCOMPARE(clone->camera()->id(), camera->id());
- } else {
- QVERIFY(clone->camera() == Q_NULLPTR);
- }
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QCameraSelectorData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QCameraSelectorData>>(creationChanges.first());
+ const Qt3DRender::QCameraSelectorData &cloneData = creationChangeData->data;
+
+ QCOMPARE(cameraSelector->id(), creationChangeData->subjectId());
+ QCOMPARE(cameraSelector->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(cameraSelector->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(cameraSelector->camera() ? cameraSelector->camera()->id() : Qt3DCore::QNodeId(), cloneData.cameraId);
delete cameraSelector;
- delete clone;
}
void checkPropertyUpdates()
@@ -107,10 +95,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "camera");
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), camera->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -128,32 +116,25 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "camera");
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), camera2->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- cameraSelector->setCamera(Q_NULLPTR);
+ cameraSelector->setCamera(nullptr);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "camera");
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), Qt3DCore::QNodeId());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QCameraSelector)
diff --git a/tests/auto/render/qclearbuffer/qclearbuffer.pro b/tests/auto/render/qclearbuffer/qclearbuffer.pro
deleted file mode 100644
index e85e481f3..000000000
--- a/tests/auto/render/qclearbuffer/qclearbuffer.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_qclearbuffer
-
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_qclearbuffer.cpp
-
-include(../commons/commons.pri)
diff --git a/tests/auto/render/qclearbuffer/tst_qclearbuffer.cpp b/tests/auto/render/qclearbuffer/tst_qclearbuffer.cpp
deleted file mode 100644
index 23fec8cff..000000000
--- a/tests/auto/render/qclearbuffer/tst_qclearbuffer.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-
-#include <Qt3DRender/qclearbuffer.h>
-
-#include "testpostmanarbiter.h"
-
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QClearBuffer: public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- ~tst_QClearBuffer()
- {
- QNode::cleanup();
- }
-
-private Q_SLOTS:
-
- void checkCloning_data()
- {
- QTest::addColumn<Qt3DRender::QClearBuffer *>("clearBuffer");
- QTest::addColumn<Qt3DRender::QClearBuffer::BufferType>("bufferType");
-
- Qt3DRender::QClearBuffer *defaultConstructed = new Qt3DRender::QClearBuffer();
- QTest::newRow("defaultConstructed") << defaultConstructed << Qt3DRender::QClearBuffer::None;
-
- Qt3DRender::QClearBuffer *allBuffers = new Qt3DRender::QClearBuffer();
- allBuffers->setBuffers(Qt3DRender::QClearBuffer::AllBuffers);
- QTest::newRow("allBuffers") << allBuffers << Qt3DRender::QClearBuffer::AllBuffers;
-
- Qt3DRender::QClearBuffer *depthBuffer = new Qt3DRender::QClearBuffer();
- depthBuffer->setBuffers(Qt3DRender::QClearBuffer::DepthBuffer);
- QTest::newRow("depthBuffer") << depthBuffer << Qt3DRender::QClearBuffer::DepthBuffer;
-
- Qt3DRender::QClearBuffer *colorDepthBuffer = new Qt3DRender::QClearBuffer();
- colorDepthBuffer->setBuffers(Qt3DRender::QClearBuffer::ColorDepthBuffer);
- QTest::newRow("colorDepthBuffer") << colorDepthBuffer << Qt3DRender::QClearBuffer::ColorDepthBuffer;
- }
-
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QClearBuffer *, clearBuffer);
- QFETCH(Qt3DRender::QClearBuffer::BufferType, bufferType);
-
- // THEN
- QCOMPARE(clearBuffer->buffers(), bufferType);
-
- // WHEN
- Qt3DRender::QClearBuffer *clone = static_cast<Qt3DRender::QClearBuffer *>(QNode::clone(clearBuffer));
-
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(clearBuffer->id(), clone->id());
- QCOMPARE(clearBuffer->buffers(), clone->buffers());
-
- delete clearBuffer;
- delete clone;
- }
-
- void checkPropertyUpdates()
- {
- // GIVEN
- QScopedPointer<Qt3DRender::QClearBuffer> clearBuffer(new Qt3DRender::QClearBuffer());
- TestArbiter arbiter(clearBuffer.data());
-
- // WHEN
- clearBuffer->setBuffers(Qt3DRender::QClearBuffer::AllBuffers);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "buffers");
- QCOMPARE(change->subjectId(), clearBuffer->id());
- QCOMPARE(change->value().value<Qt3DRender::QClearBuffer::BufferType>(), Qt3DRender::QClearBuffer::AllBuffers);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- clearBuffer->setBuffers(Qt3DRender::QClearBuffer::AllBuffers);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 0);
-
- // WHEN
- clearBuffer->setBuffers(Qt3DRender::QClearBuffer::ColorDepthBuffer);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "buffers");
- QCOMPARE(change->subjectId(), clearBuffer->id());
- QCOMPARE(change->value().value<Qt3DRender::QClearBuffer::BufferType>(), Qt3DRender::QClearBuffer::ColorDepthBuffer);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
- }
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
-};
-
-QTEST_MAIN(tst_QClearBuffer)
-
-#include "tst_qclearbuffer.moc"
diff --git a/tests/auto/render/qclearbuffers/qclearbuffers.pro b/tests/auto/render/qclearbuffers/qclearbuffers.pro
new file mode 100644
index 000000000..fdd10d392
--- /dev/null
+++ b/tests/auto/render/qclearbuffers/qclearbuffers.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+
+TARGET = tst_qclearbuffer
+
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qclearbuffers.cpp
+
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp b/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp
new file mode 100644
index 000000000..e190d3c96
--- /dev/null
+++ b/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+
+#include <Qt3DRender/qclearbuffers.h>
+#include <Qt3DRender/private/qclearbuffers_p.h>
+
+#include "testpostmanarbiter.h"
+
+class tst_QClearBuffers: public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkCloning_data()
+ {
+ QTest::addColumn<Qt3DRender::QClearBuffers *>("clearBuffers");
+ QTest::addColumn<Qt3DRender::QClearBuffers::BufferType>("bufferType");
+
+ Qt3DRender::QClearBuffers *defaultConstructed = new Qt3DRender::QClearBuffers();
+ QTest::newRow("defaultConstructed") << defaultConstructed << Qt3DRender::QClearBuffers::None;
+
+ Qt3DRender::QClearBuffers *allBuffers = new Qt3DRender::QClearBuffers();
+ allBuffers->setBuffers(Qt3DRender::QClearBuffers::AllBuffers);
+ QTest::newRow("allBuffers") << allBuffers << Qt3DRender::QClearBuffers::AllBuffers;
+
+ Qt3DRender::QClearBuffers *depthBuffer = new Qt3DRender::QClearBuffers();
+ depthBuffer->setBuffers(Qt3DRender::QClearBuffers::DepthBuffer);
+ QTest::newRow("depthBuffer") << depthBuffer << Qt3DRender::QClearBuffers::DepthBuffer;
+
+ Qt3DRender::QClearBuffers *colorDepthBuffer = new Qt3DRender::QClearBuffers();
+ colorDepthBuffer->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer);
+ QTest::newRow("colorDepthBuffer") << colorDepthBuffer << Qt3DRender::QClearBuffers::ColorDepthBuffer;
+ }
+
+ void checkCloning()
+ {
+ // GIVEN
+ QFETCH(Qt3DRender::QClearBuffers *, clearBuffers);
+ QFETCH(Qt3DRender::QClearBuffers::BufferType, bufferType);
+
+ // THEN
+ QCOMPARE(clearBuffers->buffers(), bufferType);
+
+ // WHEN
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(clearBuffers);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QClearBuffersData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QClearBuffersData>>(creationChanges.first());
+ const Qt3DRender::QClearBuffersData &cloneData = creationChangeData->data;
+
+ // THEN
+ QCOMPARE(clearBuffers->id(), creationChangeData->subjectId());
+ QCOMPARE(clearBuffers->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(clearBuffers->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(clearBuffers->buffers(), cloneData.buffersType);
+ QCOMPARE(clearBuffers->clearColor(), cloneData.clearColor);
+ QCOMPARE(clearBuffers->clearDepthValue(), cloneData.clearDepthValue);
+ QCOMPARE(clearBuffers->clearStencilValue(), cloneData.clearStencilValue);
+
+ delete clearBuffers;
+ }
+
+ void checkPropertyUpdates()
+ {
+ // GIVEN
+ QScopedPointer<Qt3DRender::QClearBuffers> clearBuffer(new Qt3DRender::QClearBuffers());
+ TestArbiter arbiter(clearBuffer.data());
+
+ // WHEN
+ clearBuffer->setBuffers(Qt3DRender::QClearBuffers::AllBuffers);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "buffers");
+ QCOMPARE(change->subjectId(), clearBuffer->id());
+ QCOMPARE(change->value().value<Qt3DRender::QClearBuffers::BufferType>(), Qt3DRender::QClearBuffers::AllBuffers);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+
+ // WHEN
+ clearBuffer->setBuffers(Qt3DRender::QClearBuffers::AllBuffers);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+
+ // WHEN
+ clearBuffer->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "buffers");
+ QCOMPARE(change->subjectId(), clearBuffer->id());
+ QCOMPARE(change->value().value<Qt3DRender::QClearBuffers::BufferType>(), Qt3DRender::QClearBuffers::ColorDepthBuffer);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+ }
+};
+
+QTEST_MAIN(tst_QClearBuffers)
+
+#include "tst_qclearbuffers.moc"
diff --git a/tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro b/tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro
index fdd8bd6b2..aaf49b892 100644
--- a/tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro
+++ b/tests/auto/render/qdefaultmeshes/qdefaultmeshes.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = tst_qdefaultmeshes
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib 3dextras
CONFIG += testcase
diff --git a/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp b/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp
index b70b13095..bbecdd187 100644
--- a/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp
+++ b/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,27 +29,32 @@
#include <QtTest/QTest>
#include <Qt3DRender/qgeometryrenderer.h>
-#include <Qt3DRender/qgeometryfunctor.h>
+#include <Qt3DRender/qgeometryfactory.h>
#include <Qt3DRender/qgeometry.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qbufferfunctor.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/private/qgeometryrenderer_p.h>
+#include <Qt3DRender/private/qgeometry_p.h>
+#include <Qt3DRender/private/qattribute_p.h>
+#include <Qt3DRender/private/qbuffer_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
-#include <Qt3DRender/qspheremesh.h>
-#include <Qt3DRender/qcylindermesh.h>
-#include <Qt3DRender/qtorusmesh.h>
-#include <Qt3DRender/qcuboidmesh.h>
-#include <Qt3DRender/qplanemesh.h>
+#include <Qt3DExtras/qspheremesh.h>
+#include <Qt3DExtras/qcylindermesh.h>
+#include <Qt3DExtras/qtorusmesh.h>
+#include <Qt3DExtras/qcuboidmesh.h>
+#include <Qt3DExtras/qplanemesh.h>
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QDefaultMeshes: public Qt3DCore::QNode
+
+class tst_QDefaultMeshes: public QObject
{
Q_OBJECT
+
public:
- ~tst_QDefaultMeshes()
+ tst_QDefaultMeshes()
{
- QNode::cleanup();
+ qRegisterMetaType<Qt3DCore::QNode*>();
}
private Q_SLOTS:
@@ -65,11 +62,11 @@ private Q_SLOTS:
void checkCloning_data()
{
QTest::addColumn<Qt3DRender::QGeometryRenderer *>("geomRenderer");
- QTest::newRow("QSphereMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DRender::QSphereMesh);
- QTest::newRow("QCylinderMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DRender::QCylinderMesh);
- QTest::newRow("QTorusMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DRender::QTorusMesh);
- QTest::newRow("QCuboidMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DRender::QCuboidMesh);
- QTest::newRow("QPlaneMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DRender::QPlaneMesh);
+ QTest::newRow("QSphereMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DExtras::QSphereMesh);
+ QTest::newRow("QCylinderMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DExtras::QCylinderMesh);
+ QTest::newRow("QTorusMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DExtras::QTorusMesh);
+ QTest::newRow("QCuboidMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DExtras::QCuboidMesh);
+ QTest::newRow("QPlaneMesh") << static_cast<Qt3DRender::QGeometryRenderer *>(new Qt3DExtras::QPlaneMesh);
}
void checkCloning()
@@ -78,70 +75,31 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QGeometryRenderer *, geomRenderer);
// WHEN
- QScopedPointer<Qt3DRender::QGeometryRenderer> clone(static_cast<Qt3DRender::QGeometryRenderer *>(QNode::clone(geomRenderer)));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geomRenderer);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(clone->id(), geomRenderer->id());
- QCOMPARE(clone->instanceCount(), geomRenderer->instanceCount());
- QCOMPARE(clone->primitiveCount(), geomRenderer->primitiveCount());
- QCOMPARE(clone->baseVertex(), geomRenderer->baseVertex());
- QCOMPARE(clone->baseInstance(), geomRenderer->baseInstance());
- QCOMPARE(clone->restartIndex(), geomRenderer->restartIndex());
- QCOMPARE(clone->primitiveRestart(), geomRenderer->primitiveRestart());
- QCOMPARE(clone->primitiveType(), geomRenderer->primitiveType());
-
- QCOMPARE(clone->geometryFunctor(), geomRenderer->geometryFunctor());
- if (geomRenderer->geometryFunctor()) {
- QVERIFY(clone->geometryFunctor());
- QVERIFY(*clone->geometryFunctor() == *geomRenderer->geometryFunctor());
- }
-
- if (geomRenderer->geometry() != Q_NULLPTR) {
- QVERIFY(clone->geometry() != Q_NULLPTR);
- QCOMPARE(clone->geometry()->id(), geomRenderer->geometry()->id());
-
- const Qt3DRender::QGeometry *geometry = geomRenderer->geometry();
- const Qt3DRender::QGeometry *clonedGeometry = clone->geometry();
-
- QCOMPARE(clonedGeometry->attributes().count(), geometry->attributes().count());
- QCOMPARE(geometry->verticesPerPatch(), clonedGeometry->verticesPerPatch());
-
- for (int i = 0; i < geometry->attributes().count(); ++i) {
- const Qt3DRender::QAttribute *originalAttribute = static_cast<Qt3DRender::QAttribute *>(geometry->attributes().at(i));
- const Qt3DRender::QAttribute *cloneAttribute = static_cast<Qt3DRender::QAttribute *>(clonedGeometry->attributes().at(i));
-
- QCOMPARE(originalAttribute->id(), cloneAttribute->id());
- QCOMPARE(originalAttribute->name(), cloneAttribute->name());
- QCOMPARE(originalAttribute->count(), cloneAttribute->count());
- QCOMPARE(originalAttribute->byteStride(), cloneAttribute->byteStride());
- QCOMPARE(originalAttribute->byteOffset(), cloneAttribute->byteOffset());
- QCOMPARE(originalAttribute->divisor(), cloneAttribute->divisor());
- QCOMPARE(originalAttribute->attributeType(), cloneAttribute->attributeType());
-
- const Qt3DRender::QBuffer *buffer = originalAttribute->buffer();
- const Qt3DRender::QBuffer *clonedBuffer = cloneAttribute->buffer();
- QCOMPARE(buffer->id(), clonedBuffer->id());
- QCOMPARE(buffer->data(), clonedBuffer->data());
- QCOMPARE(buffer->usage(), clonedBuffer->usage());
- QCOMPARE(buffer->type(), clonedBuffer->type());
- QCOMPARE(buffer->bufferFunctor(), clonedBuffer->bufferFunctor());
- QCOMPARE(buffer->isSync(), clonedBuffer->isSync());
- if (buffer->bufferFunctor()) {
- QVERIFY(clonedBuffer->bufferFunctor());
- QVERIFY(*clonedBuffer->bufferFunctor() == *buffer->bufferFunctor());
- }
- }
+ QVERIFY(creationChanges.size() >= 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QGeometryRendererData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QGeometryRendererData>>(creationChanges.first());
+ const Qt3DRender::QGeometryRendererData &cloneData = creationChangeData->data;
+
+ QCOMPARE(creationChangeData->subjectId(), geomRenderer->id());
+ QCOMPARE(cloneData.instanceCount, geomRenderer->instanceCount());
+ QCOMPARE(cloneData.vertexCount, geomRenderer->vertexCount());
+ QCOMPARE(cloneData.indexOffset, geomRenderer->indexOffset());
+ QCOMPARE(cloneData.firstInstance, geomRenderer->firstInstance());
+ QCOMPARE(cloneData.restartIndexValue, geomRenderer->restartIndexValue());
+ QCOMPARE(cloneData.primitiveRestart, geomRenderer->primitiveRestartEnabled());
+ QCOMPARE(cloneData.primitiveType, geomRenderer->primitiveType());
+ QCOMPARE(cloneData.geometryFactory, geomRenderer->geometryFactory());
+
+ if (geomRenderer->geometryFactory()) {
+ QVERIFY(cloneData.geometryFactory);
+ QVERIFY(*cloneData.geometryFactory == *geomRenderer->geometryFactory());
}
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QDefaultMeshes)
diff --git a/tests/auto/render/qframegraph/qframegraph.pro b/tests/auto/render/qframegraph/qframegraph.pro
deleted file mode 100644
index 4f782fcd1..000000000
--- a/tests/auto/render/qframegraph/qframegraph.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_qframegraph
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_qframegraph.cpp
-
-include(../commons/commons.pri)
diff --git a/tests/auto/render/qframegraph/tst_qframegraph.cpp b/tests/auto/render/qframegraph/tst_qframegraph.cpp
deleted file mode 100644
index f3dfe7ca9..000000000
--- a/tests/auto/render/qframegraph/tst_qframegraph.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qentity.h>
-
-#include <Qt3DRender/qframegraphnode.h>
-#include <Qt3DRender/qframegraph.h>
-
-#include "testpostmanarbiter.h"
-
-class MyFrameGraphNode : public Qt3DRender::QFrameGraphNode
-{
- Q_OBJECT
-public:
- explicit MyFrameGraphNode(Qt3DCore::QNode *parent = Q_NULLPTR)
- : QFrameGraphNode(parent)
- {
- }
-
- ~MyFrameGraphNode()
- {
- QNode::cleanup();
- }
-
-private:
- QT3D_CLONEABLE(MyFrameGraphNode)
-};
-
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QFrameGraph: public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- ~tst_QFrameGraph()
- {
- QNode::cleanup();
- }
-
-private Q_SLOTS:
-
- void checkSaneDefaults()
- {
- QScopedPointer<Qt3DRender::QFrameGraph> defaultFrameGraph(new Qt3DRender::QFrameGraph);
-
- QVERIFY(defaultFrameGraph->activeFrameGraph() == Q_NULLPTR);
- }
-
- void checkCloning_data()
- {
- QTest::addColumn<Qt3DRender::QFrameGraph *>("frameGraph");
- QTest::addColumn<Qt3DRender::QFrameGraphNode *>("frameGraphTree");
-
- Qt3DRender::QFrameGraph *defaultConstructed = new Qt3DRender::QFrameGraph();
- QTest::newRow("defaultConstructed") << defaultConstructed << static_cast<Qt3DRender::QFrameGraphNode *>(Q_NULLPTR);
-
- Qt3DRender::QFrameGraph *frameGraphWithActiveNode = new Qt3DRender::QFrameGraph();
- Qt3DRender::QFrameGraphNode *frameGraphTree = new MyFrameGraphNode();
- frameGraphWithActiveNode->setActiveFrameGraph(frameGraphTree);
- QTest::newRow("frameGraphWithActiveTree") << frameGraphWithActiveNode << frameGraphTree;
- }
-
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QFrameGraph*, frameGraph);
- QFETCH(Qt3DRender::QFrameGraphNode *, frameGraphTree);
-
- // THEN
- QVERIFY(frameGraph->activeFrameGraph() == frameGraphTree);
-
- // WHEN
- Qt3DRender::QFrameGraph *clone = static_cast<Qt3DRender::QFrameGraph *>(QNode::clone(frameGraph));
-
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(frameGraph->id(), clone->id());
-
- if (frameGraph->activeFrameGraph() != Q_NULLPTR) {
- QVERIFY(frameGraph->activeFrameGraph()->parent() == frameGraph);
- QVERIFY(clone->activeFrameGraph() != Q_NULLPTR);
- QCOMPARE(clone->activeFrameGraph()->id(), frameGraph->activeFrameGraph()->id());
- QVERIFY(clone->activeFrameGraph()->parent() == clone);
- }
-
- delete frameGraph;
- delete clone;
- }
-
- void checkPropertyUpdates()
- {
- // GIVEN
- QScopedPointer<Qt3DRender::QFrameGraph> frameGraph(new Qt3DRender::QFrameGraph());
- TestArbiter arbiter(frameGraph.data());
-
- // WHEN
- MyFrameGraphNode *activeFrameGraph1 = new MyFrameGraphNode();
- frameGraph->setActiveFrameGraph(activeFrameGraph1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "activeFrameGraph");
- QCOMPARE(change->subjectId(), frameGraph->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), activeFrameGraph1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- frameGraph->setActiveFrameGraph(activeFrameGraph1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 0);
-
- // WHEN
- MyFrameGraphNode *activeFrameGraph2 = new MyFrameGraphNode();
- frameGraph->setActiveFrameGraph(activeFrameGraph2);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "activeFrameGraph");
- QCOMPARE(change->subjectId(), frameGraph->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), activeFrameGraph2->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- frameGraph->setActiveFrameGraph(Q_NULLPTR);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "activeFrameGraph");
- QCOMPARE(change->subjectId(), frameGraph->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), Qt3DCore::QNodeId());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- }
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
-};
-
-QTEST_MAIN(tst_QFrameGraph)
-
-#include "tst_qframegraph.moc"
diff --git a/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp b/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
index 93805eab4..17f7e8546 100644
--- a/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
+++ b/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,8 +30,10 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qframegraphnode.h>
+#include <Qt3DRender/private/qframegraphnode_p.h>
#include "testpostmanarbiter.h"
@@ -47,30 +41,15 @@ class MyFrameGraphNode : public Qt3DRender::QFrameGraphNode
{
Q_OBJECT
public:
- explicit MyFrameGraphNode(Qt3DCore::QNode *parent = Q_NULLPTR)
+ explicit MyFrameGraphNode(Qt3DCore::QNode *parent = nullptr)
: QFrameGraphNode(parent)
{
}
-
- ~MyFrameGraphNode()
- {
- QNode::cleanup();
- }
-
-private:
- QT3D_CLONEABLE(MyFrameGraphNode)
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QFrameGraphNode: public Qt3DCore::QNode
+class tst_QFrameGraphNode: public QObject
{
Q_OBJECT
-public:
- ~tst_QFrameGraphNode()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -79,7 +58,7 @@ private Q_SLOTS:
QScopedPointer<Qt3DRender::QFrameGraphNode> defaultFrameGraphNode(new MyFrameGraphNode);
QVERIFY(defaultFrameGraphNode->isEnabled());
- QVERIFY(defaultFrameGraphNode->parentFrameGraphNode() == Q_NULLPTR);
+ QVERIFY(defaultFrameGraphNode->parentFrameGraphNode() == nullptr);
}
void checkCloning_data()
@@ -105,15 +84,19 @@ private Q_SLOTS:
QCOMPARE(frameGraphNode->isEnabled(), enabled);
// WHEN
- Qt3DRender::QFrameGraphNode *clone = static_cast<Qt3DRender::QFrameGraphNode *>(QNode::clone(frameGraphNode));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(frameGraphNode);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(frameGraphNode->id(), clone->id());
- QCOMPARE(frameGraphNode->isEnabled(), enabled);
+ QCOMPARE(creationChanges.size(), 1);
+ const Qt3DCore::QNodeCreatedChangeBasePtr creationChangeData = creationChanges.first();
+
+ // THEN
+ QCOMPARE(frameGraphNode->id(), creationChangeData->subjectId());
+ QCOMPARE(frameGraphNode->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(frameGraphNode->metaObject(), creationChangeData->metaObject());
delete frameGraphNode;
- delete clone;
}
void checkPropertyUpdates()
@@ -128,11 +111,11 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "enabled");
QCOMPARE(change->subjectId(), frameGraphNode->id());
QCOMPARE(change->value().toBool(), false);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -149,11 +132,11 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "enabled");
QCOMPARE(change->subjectId(), frameGraphNode->id());
QCOMPARE(change->value().toBool(), true);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
}
@@ -198,13 +181,6 @@ private Q_SLOTS:
QVERIFY(child211->parent() == child21);
QVERIFY(child211->parentFrameGraphNode() == child2);
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QFrameGraphNode)
diff --git a/tests/auto/render/qgeometry/tst_qgeometry.cpp b/tests/auto/render/qgeometry/tst_qgeometry.cpp
index a417a82a4..8e0974657 100644
--- a/tests/auto/render/qgeometry/tst_qgeometry.cpp
+++ b/tests/auto/render/qgeometry/tst_qgeometry.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,24 +29,22 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qgeometry.h>
+#include <Qt3DRender/private/qgeometry_p.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
-#include <Qt3DRender/qboundingvolumespecifier.h>
+
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QGeometry: public Qt3DCore::QNode
+class tst_QGeometry: public QObject
{
Q_OBJECT
-public:
- ~tst_QGeometry()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -67,21 +57,19 @@ private Q_SLOTS:
QTest::newRow("defaultConstructed") << defaultConstructed << 0;
Qt3DRender::QGeometry *geometry1 = new Qt3DRender::QGeometry();
- geometry1->setVerticesPerPatch(2);
- Qt3DRender::QAttribute *attribute = new Qt3DRender::QAttribute(Q_NULLPTR, QStringLiteral("Attr1"), Qt3DRender::QAttribute::Float, 4, 454);
+ Qt3DRender::QAttribute *attribute = new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr1"), Qt3DRender::QAttribute::Float, 4, 454);
geometry1->addAttribute(attribute);
- geometry1->addAttribute(new Qt3DRender::QAttribute(Q_NULLPTR, QStringLiteral("Attr2"), Qt3DRender::QAttribute::Float, 4, 555));
- geometry1->boundingVolumeSpecifier()->setPositionAttribute(attribute);
+ geometry1->addAttribute(new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr2"), Qt3DRender::QAttribute::Float, 4, 555));
+ geometry1->setBoundingVolumePositionAttribute(attribute);
QTest::newRow("2 attributes") << geometry1 << 2;
Qt3DRender::QGeometry *geometry2 = new Qt3DRender::QGeometry();
- attribute = new Qt3DRender::QAttribute(Q_NULLPTR, QStringLiteral("Attr2"), Qt3DRender::QAttribute::Float, 4, 383);
- geometry2->addAttribute(new Qt3DRender::QAttribute(Q_NULLPTR, QStringLiteral("Attr1"), Qt3DRender::QAttribute::Float, 3, 427));
+ attribute = new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr2"), Qt3DRender::QAttribute::Float, 4, 383);
+ geometry2->addAttribute(new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr1"), Qt3DRender::QAttribute::Float, 3, 427));
geometry2->addAttribute(attribute);
- geometry2->addAttribute(new Qt3DRender::QAttribute(Q_NULLPTR, QStringLiteral("Attr3"), Qt3DRender::QAttribute::Float, 2, 327));
+ geometry2->addAttribute(new Qt3DRender::QAttribute(nullptr, QStringLiteral("Attr3"), Qt3DRender::QAttribute::Float, 2, 327));
geometry2->removeAttribute(attribute);
- geometry2->setVerticesPerPatch(3);
QTest::newRow("3 - 1 attributes") << geometry2 << 2;
}
@@ -92,30 +80,28 @@ private Q_SLOTS:
QFETCH(int, attributeCount);
// WHEN
- Qt3DRender::QGeometry *clone = static_cast<Qt3DRender::QGeometry *>(QNode::clone(geometry));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geometry);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
+ QCOMPARE(creationChanges.size(), 1 + geometry->childNodes().size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QGeometryData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QGeometryData>>(creationChanges.first());
+ const Qt3DRender::QGeometryData &cloneData = creationChangeData->data;
+
+ QCOMPARE(geometry->id(), creationChangeData->subjectId());
+ QCOMPARE(geometry->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(geometry->metaObject(), creationChangeData->metaObject());
- QCOMPARE(geometry->id(), clone->id());
QCOMPARE(attributeCount, geometry->attributes().count());
- QCOMPARE(attributeCount, clone->attributes().count());
- QCOMPARE(geometry->verticesPerPatch(), clone->verticesPerPatch());
- if (geometry->boundingVolumeSpecifier()->positionAttribute())
- QCOMPARE(geometry->boundingVolumeSpecifier()->positionAttribute()->id(), clone->boundingVolumeSpecifier()->positionAttribute()->id());
+ QCOMPARE(attributeCount, cloneData.attributeIds.count());
+ if (geometry->boundingVolumePositionAttribute())
+ QCOMPARE(geometry->boundingVolumePositionAttribute()->id(), cloneData.boundingVolumePositionAttributeId);
for (int i = 0; i < attributeCount; ++i) {
Qt3DRender::QAttribute *originalAttribute = static_cast<Qt3DRender::QAttribute *>(geometry->attributes()[i]);
- Qt3DRender::QAttribute *cloneAttribute = static_cast<Qt3DRender::QAttribute *>(clone->attributes()[i]);
-
- QCOMPARE(originalAttribute->id(), cloneAttribute->id());
- QCOMPARE(originalAttribute->name(), cloneAttribute->name());
- QCOMPARE(originalAttribute->buffer(), cloneAttribute->buffer());
- QCOMPARE(originalAttribute->count(), cloneAttribute->count());
- QCOMPARE(originalAttribute->byteStride(), cloneAttribute->byteStride());
- QCOMPARE(originalAttribute->byteOffset(), cloneAttribute->byteOffset());
- QCOMPARE(originalAttribute->divisor(), cloneAttribute->divisor());
- QCOMPARE(originalAttribute->attributeType(), cloneAttribute->attributeType());
+ QCOMPARE(originalAttribute->id(), cloneData.attributeIds.at(i));
}
}
@@ -132,10 +118,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "attribute");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), attr.id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ Qt3DCore::QPropertyNodeAddedChangePtr nodeAddedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(nodeAddedChange->propertyName(), "attribute");
+ QCOMPARE(nodeAddedChange->addedNodeId(), attr.id());
+ QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -152,46 +138,13 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "attribute");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), attr.id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
-
- arbiter.events.clear();
-
- // WHEN
- geometry->setVerticesPerPatch(2);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "verticesPerPatch");
- QCOMPARE(change->value().toInt(), 2);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- geometry->boundingVolumeSpecifier()->setPositionAttribute(&attr);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "boundingVolumeSpecifierPositionAttribute");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), attr.id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "attribute");
+ QCOMPARE(nodeRemovedChange->removedNodeId(), attr.id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QGeometry)
diff --git a/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp b/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp
index 093491a43..11835be2d 100644
--- a/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp
+++ b/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,51 +29,50 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qgeometryrenderer.h>
-#include <Qt3DRender/qgeometryfunctor.h>
+#include <Qt3DRender/qgeometryfactory.h>
#include <Qt3DRender/qgeometry.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/private/qgeometryrenderer_p.h>
+
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
#include "testpostmanarbiter.h"
-class TestFunctor : public Qt3DRender::QGeometryFunctor
+class TestFactory : public Qt3DRender::QGeometryFactory
{
public:
- explicit TestFunctor(int size)
+ explicit TestFactory(int size)
: m_size(size)
{}
Qt3DRender::QGeometry *operator ()() Q_DECL_FINAL
{
- return Q_NULLPTR;
+ return nullptr;
}
- bool operator ==(const Qt3DRender::QGeometryFunctor &other) const
+ bool operator ==(const Qt3DRender::QGeometryFactory &other) const Q_DECL_FINAL
{
- const TestFunctor *otherFunctor = functor_cast<TestFunctor>(&other);
- if (otherFunctor != Q_NULLPTR)
- return otherFunctor->m_size == m_size;
+ const TestFactory *otherFactory = functor_cast<TestFactory>(&other);
+ if (otherFactory != nullptr)
+ return otherFactory->m_size == m_size;
return false;
}
- QT3D_FUNCTOR(TestFunctor)
+ QT3D_FUNCTOR(TestFactory)
private:
int m_size;
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QGeometryRenderer: public Qt3DCore::QNode
+class tst_QGeometryRenderer: public QObject
{
Q_OBJECT
-public:
- ~tst_QGeometryRenderer()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -95,25 +86,27 @@ private Q_SLOTS:
Qt3DRender::QGeometryRenderer *geometry1 = new Qt3DRender::QGeometryRenderer();
geometry1->setGeometry(new Qt3DRender::QGeometry());
geometry1->setInstanceCount(1);
- geometry1->setBaseVertex(0);
- geometry1->setBaseInstance(55);
- geometry1->setRestartIndex(-1);
- geometry1->setPrimitiveRestart(false);
+ geometry1->setIndexOffset(0);
+ geometry1->setFirstInstance(55);
+ geometry1->setRestartIndexValue(-1);
+ geometry1->setPrimitiveRestartEnabled(false);
geometry1->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
- geometry1->setPrimitiveCount(15);
- geometry1->setGeometryFunctor(Qt3DRender::QGeometryFunctorPtr(new TestFunctor(383)));
+ geometry1->setVertexCount(15);
+ geometry1->setVerticesPerPatch(2);
+ geometry1->setGeometryFactory(Qt3DRender::QGeometryFactoryPtr(new TestFactory(383)));
QTest::newRow("triangle") << geometry1;
Qt3DRender::QGeometryRenderer *geometry2 = new Qt3DRender::QGeometryRenderer();
geometry2->setGeometry(new Qt3DRender::QGeometry());
geometry2->setInstanceCount(200);
- geometry2->setBaseVertex(58);
- geometry2->setBaseInstance(10);
- geometry2->setRestartIndex(65535);
- geometry1->setPrimitiveCount(2056);
- geometry2->setPrimitiveRestart(true);
+ geometry2->setIndexOffset(58);
+ geometry2->setFirstInstance(10);
+ geometry2->setRestartIndexValue(65535);
+ geometry2->setVertexCount(2056);
+ geometry2->setPrimitiveRestartEnabled(true);
+ geometry2->setVerticesPerPatch(3);
geometry2->setPrimitiveType(Qt3DRender::QGeometryRenderer::Lines);
- geometry2->setGeometryFunctor(Qt3DRender::QGeometryFunctorPtr(new TestFunctor(305)));
+ geometry2->setGeometryFactory(Qt3DRender::QGeometryFactoryPtr(new TestFactory(305)));
QTest::newRow("lines with restart") << geometry2;
}
@@ -123,30 +116,35 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QGeometryRenderer *, geometryRenderer);
// WHEN
- Qt3DRender::QGeometryRenderer *clone = static_cast<Qt3DRender::QGeometryRenderer *>(QNode::clone(geometryRenderer));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geometryRenderer);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(clone->id(), geometryRenderer->id());
- QCOMPARE(clone->instanceCount(), geometryRenderer->instanceCount());
- QCOMPARE(clone->primitiveCount(), geometryRenderer->primitiveCount());
- QCOMPARE(clone->baseVertex(), geometryRenderer->baseVertex());
- QCOMPARE(clone->baseInstance(), geometryRenderer->baseInstance());
- QCOMPARE(clone->restartIndex(), geometryRenderer->restartIndex());
- QCOMPARE(clone->primitiveRestart(), geometryRenderer->primitiveRestart());
- QCOMPARE(clone->primitiveType(), geometryRenderer->primitiveType());
-
- if (geometryRenderer->geometry() != Q_NULLPTR) {
- QVERIFY(clone->geometry() != Q_NULLPTR);
- QCOMPARE(clone->geometry()->id(), geometryRenderer->geometry()->id());
- }
-
- QCOMPARE(clone->geometryFunctor(), geometryRenderer->geometryFunctor());
- if (geometryRenderer->geometryFunctor()) {
- QVERIFY(clone->geometryFunctor());
- QVERIFY(*clone->geometryFunctor() == *geometryRenderer->geometryFunctor());
- }
+ QCOMPARE(creationChanges.size(), 1 + (geometryRenderer->geometry() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QGeometryRendererData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QGeometryRendererData>>(creationChanges.first());
+ const Qt3DRender::QGeometryRendererData &cloneData = creationChangeData->data;
+
+ QCOMPARE(geometryRenderer->id(), creationChangeData->subjectId());
+ QCOMPARE(geometryRenderer->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(geometryRenderer->metaObject(), creationChangeData->metaObject());
+
+ QCOMPARE(cloneData.instanceCount, geometryRenderer->instanceCount());
+ QCOMPARE(cloneData.vertexCount, geometryRenderer->vertexCount());
+ QCOMPARE(cloneData.indexOffset, geometryRenderer->indexOffset());
+ QCOMPARE(cloneData.firstInstance, geometryRenderer->firstInstance());
+ QCOMPARE(cloneData.restartIndexValue, geometryRenderer->restartIndexValue());
+ QCOMPARE(cloneData.primitiveRestart, geometryRenderer->primitiveRestartEnabled());
+ QCOMPARE(cloneData.primitiveType, geometryRenderer->primitiveType());
+ QCOMPARE(cloneData.verticesPerPatch, geometryRenderer->verticesPerPatch());
+
+ if (geometryRenderer->geometry() != nullptr)
+ QCOMPARE(cloneData.geometryId, geometryRenderer->geometry()->id());
+
+ QCOMPARE(cloneData.geometryFactory, geometryRenderer->geometryFactory());
+ if (geometryRenderer->geometryFactory())
+ QVERIFY(*cloneData.geometryFactory == *geometryRenderer->geometryFactory());
}
void checkPropertyUpdates()
@@ -161,75 +159,88 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "instanceCount");
QCOMPARE(change->value().value<int>(), 256);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- geometryRenderer->setPrimitiveCount(1340);
+ geometryRenderer->setVertexCount(1340);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "primitiveCount");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "vertexCount");
QCOMPARE(change->value().value<int>(), 1340);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- geometryRenderer->setBaseVertex(883);
+ geometryRenderer->setIndexOffset(883);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "baseVertex");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "indexOffset");
QCOMPARE(change->value().value<int>(), 883);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- geometryRenderer->setBaseInstance(1200);
+ geometryRenderer->setFirstInstance(1200);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "baseInstance");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "firstInstance");
QCOMPARE(change->value().value<int>(), 1200);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- geometryRenderer->setRestartIndex(65535);
+ geometryRenderer->setRestartIndexValue(65535);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "restartIndex");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "restartIndexValue");
QCOMPARE(change->value().value<int>(), 65535);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- geometryRenderer->setPrimitiveRestart(true);
+ geometryRenderer->setVerticesPerPatch(2);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "primitiveRestart");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "verticesPerPatch");
+ QCOMPARE(change->value().toInt(), 2);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+
+ arbiter.events.clear();
+
+ // WHEN
+ geometryRenderer->setPrimitiveRestartEnabled(true);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "primitiveRestartEnabled");
QCOMPARE(change->value().value<bool>(), true);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -239,24 +250,24 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "primitiveType");
QCOMPARE(change->value().value<int>(), static_cast<int>(Qt3DRender::QGeometryRenderer::Patches));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- Qt3DRender::QGeometryFunctorPtr functor(new TestFunctor(555));
- geometryRenderer->setGeometryFunctor(functor);
+ Qt3DRender::QGeometryFactoryPtr factory(new TestFactory(555));
+ geometryRenderer->setGeometryFactory(factory);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "geometryFunctor");
- QCOMPARE(change->value().value<Qt3DRender::QGeometryFunctorPtr>(), functor);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "geometryFactory");
+ QCOMPARE(change->value().value<Qt3DRender::QGeometryFactoryPtr>(), factory);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -267,10 +278,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "geometry");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), geom.id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ Qt3DCore::QPropertyNodeAddedChangePtr nodeAddedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(nodeAddedChange->propertyName(), "geometry");
+ QCOMPARE(nodeAddedChange->addedNodeId(), geom.id());
+ QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -281,25 +292,18 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 2);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "geometry");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), geom.id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "geometry");
+ QCOMPARE(nodeRemovedChange->removedNodeId(), geom.id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
- change = arbiter.events.last().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "geometry");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), geom2.id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ nodeAddedChange = arbiter.events.last().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(nodeAddedChange->propertyName(), "geometry");
+ QCOMPARE(nodeAddedChange->addedNodeId(), geom2.id());
+ QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QGeometryRenderer)
diff --git a/tests/auto/render/qgraphicsutils/tst_qgraphicsutils.cpp b/tests/auto/render/qgraphicsutils/tst_qgraphicsutils.cpp
index c1cff2511..e3676ad3b 100644
--- a/tests/auto/render/qgraphicsutils/tst_qgraphicsutils.cpp
+++ b/tests/auto/render/qgraphicsutils/tst_qgraphicsutils.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp b/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp
index 97581c875..60ea33f71 100644
--- a/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp
+++ b/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,40 +29,54 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DRender/qlayer.h>
#include <Qt3DRender/qlayerfilter.h>
+#include <Qt3DRender/private/qlayerfilter_p.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QLayerFilter: public Qt3DCore::QNode
+class tst_QLayerFilter: public QObject
{
Q_OBJECT
public:
- ~tst_QLayerFilter()
+ tst_QLayerFilter()
+ : QObject()
+ , layersNode(new Qt3DCore::QNode)
{
- QNode::cleanup();
+ qRegisterMetaType<Qt3DCore::QNode*>();
}
+private:
+ QScopedPointer<Qt3DCore::QNode> layersNode;
+
private Q_SLOTS:
void checkCloning_data()
{
QTest::addColumn<Qt3DRender::QLayerFilter *>("layerFilter");
- QTest::addColumn<QStringList>("layerNames");
+ QTest::addColumn<QVector<Qt3DRender::QLayer*>>("layers");
+
Qt3DRender::QLayerFilter *defaultConstructed = new Qt3DRender::QLayerFilter();
- QTest::newRow("defaultConstructed") << defaultConstructed << QStringList();
+ QTest::newRow("defaultConstructed") << defaultConstructed << QVector<Qt3DRender::QLayer*>();
Qt3DRender::QLayerFilter *singleLayer = new Qt3DRender::QLayerFilter();
- QStringList layer = QStringList() << QStringLiteral("myLayer");
- singleLayer->setLayers(layer);
+ auto layer = QVector<Qt3DRender::QLayer*>() << new Qt3DRender::QLayer(layersNode.data());
+ QCoreApplication::processEvents();
+ singleLayer->addLayer(layer.first());
QTest::newRow("single layer") << singleLayer << layer;
Qt3DRender::QLayerFilter *multiLayers = new Qt3DRender::QLayerFilter();
- QStringList layers = QStringList() << QStringLiteral("883") << QStringLiteral("350") << QStringLiteral("454");
- multiLayers->setLayers(layers);
+ auto layers = QVector<Qt3DRender::QLayer*>() << new Qt3DRender::QLayer(layersNode.data())
+ << new Qt3DRender::QLayer(layersNode.data())
+ << new Qt3DRender::QLayer(layersNode.data());
+ QCoreApplication::processEvents();
+ for (Qt3DRender::QLayer *layer : qAsConst(layers))
+ multiLayers->addLayer(layer);
QTest::newRow("multi layers") << multiLayers << layers;
}
@@ -78,21 +84,29 @@ private Q_SLOTS:
{
// GIVEN
QFETCH(Qt3DRender::QLayerFilter *, layerFilter);
- QFETCH(QStringList, layerNames);
+ QFETCH(QVector<Qt3DRender::QLayer*>, layers);
// THEN
- QCOMPARE(layerFilter->layers(), layerNames);
+ QCOMPARE(layerFilter->layers(), layers);
// WHEN
- Qt3DRender::QLayerFilter *clone = static_cast<Qt3DRender::QLayerFilter *>(QNode::clone(layerFilter));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(layerFilter);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QLayerFilterData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QLayerFilterData>>(creationChanges.first());
+ const Qt3DRender::QLayerFilterData &cloneData = creationChangeData->data;
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(layerFilter->id(), clone->id());
- QCOMPARE(layerFilter->layers(), clone->layers());
+ QCOMPARE(layerFilter->id(), creationChangeData->subjectId());
+ QCOMPARE(layerFilter->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(layerFilter->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(Qt3DCore::qIdsForNodes(layerFilter->layers()), cloneData.layerIds);
delete layerFilter;
- delete clone;
}
void checkPropertyUpdates()
@@ -102,64 +116,52 @@ private Q_SLOTS:
TestArbiter arbiter(layerFilter.data());
// WHEN
- QStringList layerNames1 = QStringList() << QStringLiteral("883") << QStringLiteral("350");
- layerFilter->setLayers(layerNames1);
+ auto layer = new Qt3DRender::QLayer(layersNode.data());
+ QCoreApplication::processEvents();
+ layerFilter->addLayer(layer);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "layers");
- QCOMPARE(change->subjectId(), layerFilter->id());
- QCOMPARE(change->value().value<QStringList>(), layerNames1);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ auto addChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(addChange->propertyName(), "layer");
+ QCOMPARE(addChange->subjectId(), layerFilter->id());
+ QCOMPARE(addChange->addedNodeId(), layerFilter->layers().at(0)->id());
+ QCOMPARE(addChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
// WHEN
- layerFilter->setLayers(layerNames1);
+ layer = new Qt3DRender::QLayer(layersNode.data());
QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 0);
-
- // WHEN
- QStringList layerNames2 = QStringList() << QStringLiteral("454");
- layerFilter->setLayers(layerNames2);
+ layerFilter->addLayer(layer);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "layers");
- QCOMPARE(change->subjectId(), layerFilter->id());
- QCOMPARE(change->value().value<QStringList>(), layerNames2);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ addChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(addChange->propertyName(), "layer");
+ QCOMPARE(addChange->subjectId(), layerFilter->id());
+ QCOMPARE(addChange->addedNodeId(), layerFilter->layers().at(1)->id());
+ QCOMPARE(addChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
// WHEN
- layerFilter->setLayers(QStringList());
+ layer = layerFilter->layers().at(0);
+ layerFilter->removeLayer(layer);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "layers");
- QCOMPARE(change->subjectId(), layerFilter->id());
- QCOMPARE(change->value().value<QStringList>(), QStringList());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
+ auto removeChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(removeChange->propertyName(), "layer");
+ QCOMPARE(removeChange->subjectId(), layerFilter->id());
+ QCOMPARE(removeChange->removedNodeId(), layer->id());
+ QCOMPARE(removeChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QLayerFilter)
diff --git a/tests/auto/render/qlight/qlight.pro b/tests/auto/render/qlight/qlight.pro
deleted file mode 100644
index 5f2bd10b4..000000000
--- a/tests/auto/render/qlight/qlight.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_qlight
-
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_qlight.cpp
-
-include(../commons/commons.pri)
diff --git a/tests/auto/render/qlight/tst_qlight.cpp b/tests/auto/render/qlight/tst_qlight.cpp
deleted file mode 100644
index 62508beb2..000000000
--- a/tests/auto/render/qlight/tst_qlight.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-
-#include <Qt3DRender/qlight.h>
-#include <Qt3DRender/qpointlight.h>
-#include <Qt3DRender/qdirectionallight.h>
-#include <Qt3DRender/qspotlight.h>
-
-#include "testpostmanarbiter.h"
-
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QLight: public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- ~tst_QLight()
- {
- QNode::cleanup();
- }
-
-private Q_SLOTS:
-
- void checkLightCloning()
- {
- Qt3DRender::QLight light;
- light.setColor(Qt::red);
- light.setIntensity(0.5f);
-
- QScopedPointer<Qt3DRender::QLight> lightClone(static_cast<Qt3DRender::QLight *>(QNode::clone(&light)));
- QVERIFY(lightClone.data());
- QCOMPARE(light.color(), lightClone->color());
- QCOMPARE(light.intensity(), lightClone->intensity());
- }
-
- void checkPointLightCloning()
- {
- Qt3DRender::QPointLight pointLight;
- QCOMPARE(pointLight.type(), Qt3DRender::QLight::PointLight);
- pointLight.setColor(Qt::green);
- pointLight.setIntensity(0.5f);
- pointLight.setAttenuation(QVector3D(0.5f, 0.0f, 1.0f));
-
- QScopedPointer<Qt3DRender::QPointLight> pointLightClone(static_cast<Qt3DRender::QPointLight *>(QNode::clone(&pointLight)));
- QVERIFY(pointLightClone.data());
- QCOMPARE(pointLightClone->type(), Qt3DRender::QLight::PointLight);
- QCOMPARE(pointLight.color(), pointLightClone->color());
- QCOMPARE(pointLight.intensity(), pointLightClone->intensity());
- QCOMPARE(pointLight.attenuation(), pointLightClone->attenuation());
- }
-
- void checkDirectionalLightCloning()
- {
- Qt3DRender::QDirectionalLight dirLight;
- QCOMPARE(dirLight.type(), Qt3DRender::QLight::DirectionalLight);
- dirLight.setColor(Qt::blue);
- dirLight.setIntensity(0.5f);
- dirLight.setDirection(QVector3D(0, 0, -1));
-
- QScopedPointer<Qt3DRender::QDirectionalLight> dirLightClone(static_cast<Qt3DRender::QDirectionalLight *>(QNode::clone(&dirLight)));
- QVERIFY(dirLightClone.data());
- QCOMPARE(dirLightClone->type(), Qt3DRender::QLight::DirectionalLight);
- QCOMPARE(dirLight.color(), dirLightClone->color());
- QCOMPARE(dirLight.intensity(), dirLightClone->intensity());
- QCOMPARE(dirLight.direction(), dirLightClone->direction());
- }
-
- void checkSpotLightCloning()
- {
- Qt3DRender::QSpotLight spotLight;
- QCOMPARE(spotLight.type(), Qt3DRender::QLight::SpotLight);
- spotLight.setColor(Qt::lightGray);
- spotLight.setIntensity(0.5f);
- spotLight.setDirection(QVector3D(0, 0, -1));
- spotLight.setCutOffAngle(0.75f);
-
- QScopedPointer<Qt3DRender::QSpotLight> spotLightClone(static_cast<Qt3DRender::QSpotLight *>(QNode::clone(&spotLight)));
- QVERIFY(spotLightClone.data());
- QCOMPARE(spotLightClone->type(), Qt3DRender::QLight::SpotLight);
- QCOMPARE(spotLight.color(), spotLightClone->color());
- QCOMPARE(spotLight.intensity(), spotLightClone->intensity());
- QCOMPARE(spotLight.direction(), spotLightClone->direction());
- QCOMPARE(spotLight.cutOffAngle(), spotLightClone->cutOffAngle());
- }
-
- void checkLightPropertyUpdates()
- {
- QScopedPointer<Qt3DRender::QLight> light(new Qt3DRender::QLight);
- TestArbiter lightArbiter(light.data());
-
- light->setColor(Qt::red);
- light->setIntensity(0.5f);
- QCoreApplication::processEvents();
-
- QCOMPARE(lightArbiter.events.size(), 2);
- Qt3DCore::QScenePropertyChangePtr change = lightArbiter.events[0].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "color");
- QCOMPARE(change->subjectId(), light->id());
- QCOMPARE(change->value().value<QColor>(), QColor(Qt::red));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- change = lightArbiter.events[1].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "intensity");
- QCOMPARE(change->subjectId(), light->id());
- QCOMPARE(change->value().value<float>(), 0.5f);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- lightArbiter.events.clear();
-
- light->setColor(Qt::red);
- QCoreApplication::processEvents();
-
- QCOMPARE(lightArbiter.events.size(), 0);
-
- lightArbiter.events.clear();
- }
-
- void checkPointLightPropertyUpdates()
- {
- QScopedPointer<Qt3DRender::QPointLight> pointLight(new Qt3DRender::QPointLight);
- TestArbiter pointLightArbiter(pointLight.data());
-
- pointLight->setColor(Qt::green);
- pointLight->setIntensity(0.5f);
- pointLight->setAttenuation(QVector3D(0.5f, 0.0f, 1.0f));
- QCoreApplication::processEvents();
-
- QCOMPARE(pointLightArbiter.events.size(), 3);
- Qt3DCore::QScenePropertyChangePtr change = pointLightArbiter.events[0].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "color");
- QCOMPARE(change->subjectId(), pointLight->id());
- QCOMPARE(change->value().value<QColor>(), QColor(Qt::green));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- change = pointLightArbiter.events[1].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "intensity");
- QCOMPARE(change->subjectId(), pointLight->id());
- QCOMPARE(change->value().value<float>(), 0.5f);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- change = pointLightArbiter.events[2].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "attenuation");
- QCOMPARE(change->subjectId(), pointLight->id());
- QCOMPARE(change->value().value<QVector3D>(), QVector3D(0.5f, 0.0f, 1.0f));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- pointLightArbiter.events.clear();
- }
-
- void checkDirectionalLightPropertyUpdates()
- {
- QScopedPointer<Qt3DRender::QDirectionalLight> dirLight(new Qt3DRender::QDirectionalLight);
- TestArbiter dirLightArbiter(dirLight.data());
-
- dirLight->setColor(Qt::blue);
- dirLight->setIntensity(0.5f);
- dirLight->setDirection(QVector3D(0.5f, 0.0f, -1.0f));
- QCoreApplication::processEvents();
-
- QCOMPARE(dirLightArbiter.events.size(), 3);
- Qt3DCore::QScenePropertyChangePtr change = dirLightArbiter.events[0].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "color");
- QCOMPARE(change->subjectId(), dirLight->id());
- QCOMPARE(change->value().value<QColor>(), QColor(Qt::blue));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- change = dirLightArbiter.events[1].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "intensity");
- QCOMPARE(change->subjectId(), dirLight->id());
- QCOMPARE(change->value().value<float>(), 0.5f);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- change = dirLightArbiter.events[2].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "direction");
- QCOMPARE(change->subjectId(), dirLight->id());
- QCOMPARE(change->value().value<QVector3D>(), QVector3D(0.5f, 0.0f, -1.0f));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- dirLightArbiter.events.clear();
- }
-
- void checkSpotLightPropertyUpdates()
- {
- QScopedPointer<Qt3DRender::QSpotLight> spotLight(new Qt3DRender::QSpotLight);
- TestArbiter spotLightArbiter(spotLight.data());
-
- spotLight->setColor(Qt::lightGray);
- spotLight->setIntensity(0.5f);
- spotLight->setDirection(QVector3D(0.5f, 0.0f, -1.0f));
- spotLight->setCutOffAngle(0.75f);
- QCoreApplication::processEvents();
-
- QCOMPARE(spotLightArbiter.events.size(), 4);
- Qt3DCore::QScenePropertyChangePtr change = spotLightArbiter.events[0].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "color");
- QCOMPARE(change->subjectId(), spotLight->id());
- QCOMPARE(change->value().value<QColor>(), QColor(Qt::lightGray));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- change = spotLightArbiter.events[1].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "intensity");
- QCOMPARE(change->subjectId(), spotLight->id());
- QCOMPARE(change->value().value<float>(), 0.5f);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- change = spotLightArbiter.events[2].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "direction");
- QCOMPARE(change->subjectId(), spotLight->id());
- QCOMPARE(change->value().value<QVector3D>(), QVector3D(0.5f, 0.0f, -1.0f));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
- change = spotLightArbiter.events[3].staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "cutOffAngle");
- QCOMPARE(change->subjectId(), spotLight->id());
- QCOMPARE(change->value().value<float>(), 0.75f);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- spotLightArbiter.events.clear();
- }
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
-};
-
-QTEST_MAIN(tst_QLight)
-
-#include "tst_qlight.moc"
diff --git a/tests/auto/render/qmaterial/qmaterial.pro b/tests/auto/render/qmaterial/qmaterial.pro
index a9a27b4bf..5aa07f577 100644
--- a/tests/auto/render/qmaterial/qmaterial.pro
+++ b/tests/auto/render/qmaterial/qmaterial.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = tst_qmaterial
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib 3dextras
CONFIG += testcase
diff --git a/tests/auto/render/qmaterial/tst_qmaterial.cpp b/tests/auto/render/qmaterial/tst_qmaterial.cpp
index fc3396d03..437cfa5ad 100644
--- a/tests/auto/render/qmaterial/tst_qmaterial.cpp
+++ b/tests/auto/render/qmaterial/tst_qmaterial.cpp
@@ -1,56 +1,54 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/QEffect>
#include <Qt3DRender/QMaterial>
#include <Qt3DRender/QParameter>
#include <Qt3DRender/QTechnique>
#include <Qt3DRender/QRenderPass>
-#include <Qt3DRender/QPhongMaterial>
-#include <Qt3DRender/QParameterMapping>
-#include <Qt3DRender/QDiffuseMapMaterial>
-#include <Qt3DRender/QPerVertexColorMaterial>
-#include <Qt3DRender/QNormalDiffuseMapMaterial>
-#include <Qt3DRender/QDiffuseSpecularMapMaterial>
-#include <Qt3DRender/QNormalDiffuseMapAlphaMaterial>
-#include <Qt3DRender/QNormalDiffuseSpecularMapMaterial>
+#include <Qt3DExtras/QPhongMaterial>
+#include <Qt3DExtras/QDiffuseMapMaterial>
+#include <Qt3DExtras/QPerVertexColorMaterial>
+#include <Qt3DExtras/QNormalDiffuseMapMaterial>
+#include <Qt3DExtras/QDiffuseSpecularMapMaterial>
+#include <Qt3DExtras/QNormalDiffuseMapAlphaMaterial>
+#include <Qt3DExtras/QNormalDiffuseSpecularMapMaterial>
+
+#include <Qt3DRender/private/qmaterial_p.h>
#include "testpostmanarbiter.h"
@@ -65,44 +63,33 @@ public:
, m_shaderProgram(new Qt3DRender::QShaderProgram(this))
{
m_renderPass->setShaderProgram(m_shaderProgram);
- m_technique->addPass(m_renderPass);
+ m_technique->addRenderPass(m_renderPass);
m_effect->addTechnique(m_technique);
setEffect(m_effect);
}
- ~TestMaterial()
- {
- QNode::cleanup();
- }
-
Qt3DRender::QEffect *m_effect;
Qt3DRender::QTechnique *m_technique;
Qt3DRender::QRenderPass *m_renderPass;
Qt3DRender::QShaderProgram *m_shaderProgram;
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QMaterial : public Qt3DCore::QNode
+class tst_QMaterial : public QObject
{
Q_OBJECT
public:
tst_QMaterial()
- : Qt3DCore::QNode()
+ : QObject()
{
+ qRegisterMetaType<Qt3DCore::QNode*>();
qRegisterMetaType<Qt3DRender::QEffect*>("Qt3DRender::QEffect*");
}
- ~tst_QMaterial()
- {
- QNode::cleanup();
- }
-
private:
void compareEffects(const Qt3DRender::QEffect *original, const Qt3DRender::QEffect *clone)
{
- bool isEffectNull = (original == Q_NULLPTR);
+ bool isEffectNull = (original == nullptr);
if (isEffectNull) {
QVERIFY(!clone);
} else {
@@ -138,8 +125,7 @@ private:
compareParameters(original->parameters(), clone->parameters());
compareRenderStates(original->renderStates(), clone->renderStates());
- compareAnnotations(original->annotations(), clone->annotations());
- compareBindings(original->bindings(), clone->bindings());
+ compareFilterKeys(original->filterKeys(), clone->filterKeys());
compareShaderPrograms(original->shaderProgram(), clone->shaderProgram());
}
@@ -156,52 +142,36 @@ private:
}
}
- void compareAnnotations(const QList<Qt3DRender::QAnnotation *> &original, const QList<Qt3DRender::QAnnotation *> &clone)
+ void compareFilterKeys(const QVector<Qt3DRender::QFilterKey *> &original, const QVector<Qt3DRender::QFilterKey *> &clone)
{
const int annotationsCount = original.size();
QCOMPARE(annotationsCount, clone.size());
for (int i = 0; i < annotationsCount; ++i) {
- const Qt3DRender::QAnnotation *origAnnotation = original.at(i);
- const Qt3DRender::QAnnotation *cloneAnnotation = clone.at(i);
+ const Qt3DRender::QFilterKey *origAnnotation = original.at(i);
+ const Qt3DRender::QFilterKey *cloneAnnotation = clone.at(i);
QCOMPARE(origAnnotation->id(), cloneAnnotation->id());
QCOMPARE(origAnnotation->name(), cloneAnnotation->name());
QCOMPARE(origAnnotation->value(), cloneAnnotation->value());
}
}
- void compareBindings(const QList<Qt3DRender::QParameterMapping *> &original, const QList<Qt3DRender::QParameterMapping *> &clone)
- {
- const int bindingsCount = original.size();
- QCOMPARE(bindingsCount, clone.size());
-
- for (int i = 0; i < bindingsCount; ++i) {
- const Qt3DRender::QParameterMapping *origMapping = original.at(i);
- const Qt3DRender::QParameterMapping *cloneMapping = clone.at(i);
-
- QCOMPARE(origMapping->id(), cloneMapping->id());
- QCOMPARE(origMapping->bindingType(), cloneMapping->bindingType());
- QCOMPARE(origMapping->parameterName(), cloneMapping->parameterName());
- QCOMPARE(origMapping->shaderVariableName(), cloneMapping->shaderVariableName());
- }
- }
-
- void compareRenderStates(const QList<Qt3DRender::QRenderState *> &original, const QList<Qt3DRender::QRenderState *> &clone)
+ void compareRenderStates(const QVector<Qt3DRender::QRenderState *> &original, const QVector<Qt3DRender::QRenderState *> &clone)
{
const int renderStatesCount = original.size();
QCOMPARE(renderStatesCount, clone.size());
for (int i = 0; i < renderStatesCount; ++i) {
- const Qt3DRender::QRenderState *originState = original.at(i);
- const Qt3DRender::QRenderState *cloneState = clone.at(i);
+ Qt3DRender::QRenderState *originState = original.at(i);
+ Qt3DRender::QRenderState *cloneState = clone.at(i);
QCOMPARE(originState->id(), originState->id());
- QVERIFY(originState->type() == cloneState->type());
+ QVERIFY(Qt3DRender::QRenderStatePrivate::get(originState)->m_type == Qt3DRender::QRenderStatePrivate::get(cloneState)->m_type);
}
}
void compareShaderPrograms(const Qt3DRender::QShaderProgram *original, const Qt3DRender::QShaderProgram *clone)
{
- bool isOriginalNull = (original == Q_NULLPTR);
+ bool isOriginalNull = (original == nullptr);
if (isOriginalNull) {
QVERIFY(!clone);
} else {
@@ -226,19 +196,19 @@ private Q_SLOTS:
QTest::newRow("empty material") << material;
material = new TestMaterial();
QTest::newRow("test material") << material;
- material = new Qt3DRender::QPhongMaterial();
+ material = new Qt3DExtras::QPhongMaterial();
QTest::newRow("QPhongMaterial") << material;
- material = new Qt3DRender::QDiffuseMapMaterial();
+ material = new Qt3DExtras::QDiffuseMapMaterial();
QTest::newRow("QDiffuseMapMaterial") << material;
- material = new Qt3DRender::QDiffuseSpecularMapMaterial();
+ material = new Qt3DExtras::QDiffuseSpecularMapMaterial();
QTest::newRow("QDiffuseMapSpecularMaterial") << material;
- material = new Qt3DRender::QPerVertexColorMaterial();
+ material = new Qt3DExtras::QPerVertexColorMaterial();
QTest::newRow("QPerVertexColorMaterial") << material;
- material = new Qt3DRender::QNormalDiffuseMapMaterial();
+ material = new Qt3DExtras::QNormalDiffuseMapMaterial();
QTest::newRow("QNormalDiffuseMapMaterial") << material;
- material = new Qt3DRender::QNormalDiffuseMapAlphaMaterial();
+ material = new Qt3DExtras::QNormalDiffuseMapAlphaMaterial();
QTest::newRow("QNormalDiffuseMapAlphaMaterial") << material;
- material = new Qt3DRender::QNormalDiffuseSpecularMapMaterial();
+ material = new Qt3DExtras::QNormalDiffuseSpecularMapMaterial();
QTest::newRow("QNormalDiffuseSpecularMapMaterial") << material;
}
@@ -248,13 +218,29 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QMaterial *, material);
// WHEN
- Qt3DRender::QMaterial *clone = static_cast<Qt3DRender::QMaterial *>(QNode::clone(material));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(material);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- compareParameters(material->parameters(), clone->parameters());
- compareEffects(material->effect(), clone->effect());
+ QVERIFY(creationChanges.size() >= 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QMaterialData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QMaterialData>>(creationChanges.first());
+ const Qt3DRender::QMaterialData &cloneData = creationChangeData->data;
+
+ // THEN
+ QCOMPARE(material->id(), creationChangeData->subjectId());
+ QCOMPARE(material->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(material->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(material->effect() ? material->effect()->id() : Qt3DCore::QNodeId(), cloneData.effectId);
+ QCOMPARE(material->parameters().size(), cloneData.parameterIds.size());
+
+ for (int i = 0, m = material->parameters().size(); i < m; ++i)
+ QCOMPARE(material->parameters().at(i)->id(), cloneData.parameterIds.at(i));
+
+ // TO DO: Add unit tests for parameter and effect that do check this
+ // compareParameters(material->parameters(), clone->parameters());
+ // compareEffects(material->effect(), clone->effect());
}
void checkEffectUpdate()
@@ -270,10 +256,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "effect");
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), effect.id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -281,16 +267,21 @@ private Q_SLOTS:
QScopedPointer<TestMaterial> material2(new TestMaterial());
TestArbiter arbiter2(material2.data());
+ QCoreApplication::processEvents();
+ // Clear events trigger by child generation of TestMnterial
+ arbiter2.events.clear();
+
// WHEN
material2->setEffect(&effect);
QCoreApplication::processEvents();
// THEN
+ qDebug() << Q_FUNC_INFO << arbiter2.events.size();
QCOMPARE(arbiter2.events.size(), 1);
- change = arbiter2.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter2.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "effect");
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), effect.id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
}
void checkDynamicParametersAddedUpdates()
@@ -299,17 +290,24 @@ private Q_SLOTS:
TestMaterial *material = new TestMaterial();
TestArbiter arbiter(material);
+ QCoreApplication::processEvents();
+ // Clear events trigger by child generation of TestMnterial
+ arbiter.events.clear();
+
// WHEN (add parameter to material)
Qt3DRender::QParameter *param = new Qt3DRender::QParameter("testParamMaterial", QVariant::fromValue(383.0f));
material->addParameter(param);
QCoreApplication::processEvents();
// THEN
+ QCOMPARE(param->parent(), material);
+
+ // THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyNodeAddedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
QCOMPARE(change->propertyName(), "parameter");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), param->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ QCOMPARE(change->addedNodeId(), param->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -320,10 +318,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
QCOMPARE(change->propertyName(), "parameter");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), param->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ QCOMPARE(change->addedNodeId(), param->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -334,10 +332,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
QCOMPARE(change->propertyName(), "parameter");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), param->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ QCOMPARE(change->addedNodeId(), param->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -348,10 +346,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
QCOMPARE(change->propertyName(), "parameter");
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), param->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ QCOMPARE(change->addedNodeId(), param->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
}
@@ -362,6 +360,10 @@ private Q_SLOTS:
TestMaterial *material = new TestMaterial();
TestArbiter arbiter(material);
+ QCoreApplication::processEvents();
+ // Clear events trigger by child generation of TestMnterial
+ arbiter.events.clear();
+
// WHEN
const QByteArray vertexCode = QByteArrayLiteral("new vertex shader code");
material->m_shaderProgram->setVertexShaderCode(vertexCode);
@@ -369,10 +371,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "vertexShaderCode");
QCOMPARE(change->value().value<QByteArray>(), vertexCode);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -383,10 +385,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "fragmentShaderCode");
QCOMPARE(change->value().value<QByteArray>(), fragmentCode);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -397,10 +399,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "geometryShaderCode");
QCOMPARE(change->value().value<QByteArray>(), geometryCode);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -411,10 +413,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "computeShaderCode");
QCOMPARE(change->value().value<QByteArray>(), computeCode);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -425,10 +427,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "tessellationControlShaderCode");
QCOMPARE(change->value().value<QByteArray>(), tesselControlCode);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -439,20 +441,13 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "tessellationEvaluationShaderCode");
QCOMPARE(change->value().value<QByteArray>(), tesselEvalCode);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QMaterial)
diff --git a/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp b/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
index a5d98d1f9..ff56d3590 100644
--- a/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
+++ b/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,7 +30,6 @@
#include <QtTest/QSignalSpy>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qbackendscenepropertychange.h>
#include <Qt3DRender/QObjectPicker>
#include <Qt3DRender/QPickEvent>
@@ -48,7 +39,7 @@ class MyObjectPicker : public Qt3DRender::QObjectPicker
{
Q_OBJECT
public:
- MyObjectPicker(Qt3DCore::QNode *parent = Q_NULLPTR)
+ MyObjectPicker(Qt3DCore::QNode *parent = nullptr)
: Qt3DRender::QObjectPicker(parent)
{}
@@ -75,7 +66,7 @@ public:
~tst_QObjectPicker()
{
- QNode::cleanup();
+ QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
}
private Q_SLOTS:
@@ -91,22 +82,23 @@ private Q_SLOTS:
QTest::newRow("objectPicker_all_true") << objectPicker;
}
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QObjectPicker *, objectPicker);
+ // TODO: Avoid cloning here
+// void checkCloning()
+// {
+// // GIVEN
+// QFETCH(Qt3DRender::QObjectPicker *, objectPicker);
- // WHEN
- Qt3DRender::QObjectPicker *clone = static_cast<Qt3DRender::QObjectPicker *>(QNode::clone(objectPicker));
- QCoreApplication::processEvents();
+// // WHEN
+// Qt3DRender::QObjectPicker *clone = static_cast<Qt3DRender::QObjectPicker *>(QNode::clone(objectPicker));
+// QCoreApplication::processEvents();
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(objectPicker->id(), clone->id());
- QCOMPARE(objectPicker->hoverEnabled(), clone->hoverEnabled());
- QCOMPARE(objectPicker->isPressed(), clone->isPressed());
- QCOMPARE(objectPicker->containsMouse(), clone->containsMouse());
- }
+// // THEN
+// QVERIFY(clone != nullptr);
+// QCOMPARE(objectPicker->id(), clone->id());
+// QCOMPARE(objectPicker->isHoverEnabled(), clone->isHoverEnabled());
+// QCOMPARE(objectPicker->isPressed(), clone->isPressed());
+// QCOMPARE(objectPicker->containsMouse(), clone->containsMouse());
+// }
void checkPropertyUpdates()
{
@@ -120,10 +112,10 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.last().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.last().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "hoverEnabled");
QCOMPARE(change->value().toBool(), true);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
}
@@ -132,26 +124,32 @@ private Q_SLOTS:
{
QTest::addColumn<QByteArray>("signalPrototype");
QTest::addColumn<QByteArray>("propertyName");
+ QTest::addColumn<bool>("requiresEvent");
QTest::newRow("clicked")
<< QByteArray(SIGNAL(clicked(Qt3DRender::QPickEvent *)))
- << QByteArrayLiteral("clicked");
+ << QByteArrayLiteral("clicked")
+ << true;
QTest::newRow("pressed")
<< QByteArray(SIGNAL(pressed(Qt3DRender::QPickEvent *)))
- << QByteArrayLiteral("pressed");
+ << QByteArrayLiteral("pressed")
+ << true;
QTest::newRow("released")
<< QByteArray(SIGNAL(released(Qt3DRender::QPickEvent *)))
- << QByteArrayLiteral("released");
+ << QByteArrayLiteral("released")
+ << true;
QTest::newRow("entered")
<< QByteArray(SIGNAL(entered()))
- << QByteArrayLiteral("entered");
+ << QByteArrayLiteral("entered")
+ << false;
QTest::newRow("exited")
<< QByteArray(SIGNAL(exited()))
- << QByteArrayLiteral("exited");
+ << QByteArrayLiteral("exited")
+ << false;
}
void checkBackendUpdates()
@@ -159,27 +157,27 @@ private Q_SLOTS:
// GIVEN
QFETCH(QByteArray, signalPrototype);
QFETCH(QByteArray, propertyName);
+ QFETCH(bool, requiresEvent);
QScopedPointer<MyObjectPicker> objectPicker(new MyObjectPicker());
QSignalSpy spy(objectPicker.data(), signalPrototype.constData());
+ Qt3DRender::QPickEventPtr event(new Qt3DRender::QPickEvent());
// WHEN
// Create Backend Change and distribute it to frontend node
- Qt3DCore::QBackendScenePropertyChangePtr e(new Qt3DCore::QBackendScenePropertyChange(Qt3DCore::NodeUpdated, objectPicker->id()));
+ Qt3DCore::QPropertyUpdatedChangePtr e(new Qt3DCore::QPropertyUpdatedChange(objectPicker->id()));
e->setPropertyName(propertyName.constData());
+ if (requiresEvent)
+ {
+ QVariant v;
+ v.setValue<Qt3DRender::QPickEventPtr>(event);
+ e->setValue(v);
+ }
objectPicker->sceneChangeEvent(e);
// THEN
// Check that the QObjectPicker triggers the expected signal
QCOMPARE(spy.count(), 1);
}
-
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QObjectPicker)
diff --git a/tests/auto/render/qray3d/qray3d.pro b/tests/auto/render/qray3d/qray3d.pro
new file mode 100644
index 000000000..6714b066e
--- /dev/null
+++ b/tests/auto/render/qray3d/qray3d.pro
@@ -0,0 +1,8 @@
+TARGET = tst_qray3d
+CONFIG += testcase
+TEMPLATE = app
+
+SOURCES += \
+ tst_qray3d.cpp
+
+QT += testlib core-private 3dcore 3dcore-private 3drender 3drender-private
diff --git a/tests/auto/render/qray3d/tst_qray3d.cpp b/tests/auto/render/qray3d/tst_qray3d.cpp
new file mode 100644
index 000000000..6297f1c73
--- /dev/null
+++ b/tests/auto/render/qray3d/tst_qray3d.cpp
@@ -0,0 +1,538 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <Qt3DRender/private/qray3d_p.h>
+
+class tst_QRay3D : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QRay3D() {}
+ ~tst_QRay3D() {}
+
+private Q_SLOTS:
+ void create_data();
+ void create();
+ void projection_data();
+ void projection();
+ void point_data();
+ void point();
+ void contains_point_data();
+ void contains_point();
+ void contains_ray_data();
+ void contains_ray();
+ void distance_data();
+ void distance();
+ void compare();
+ void dataStream();
+ void transform_data();
+ void transform();
+ void properties();
+ void metaTypes();
+ void shouldNotAllowNullDirection();
+};
+
+// Fix the problem where a compared value happens to be zero (and
+// you cannot always predict this, and should not predict it
+// since then you produce self-fulling prophecies instead of tests).
+// In that case qFuzzyCompare has a completely strict criterion since
+// it finds the "fudge factor" by multiplying by zero...
+static inline bool fuzzyCompare(float p1, float p2)
+{
+ float fac = qMin(qAbs(p1), qAbs(p2));
+ return (qAbs(p1 - p2) <= (qIsNull(fac) ? 0.00001f : 0.00001f * fac));
+}
+
+static inline bool fuzzyCompare(const QVector3D &lhs, const QVector3D &rhs)
+{
+ if (fuzzyCompare(lhs.x(), rhs.x()) &&
+ fuzzyCompare(lhs.y(), rhs.y()) &&
+ fuzzyCompare(lhs.z(), rhs.z()))
+ return true;
+#ifndef QT_NO_DEBUG_STREAM
+ qWarning() << "actual:" << lhs;
+ qWarning() << "expected:" << rhs;
+#endif
+ return false;
+}
+
+void tst_QRay3D::create_data()
+{
+ QTest::addColumn<QVector3D>("point");
+ QTest::addColumn<QVector3D>("direction");
+
+ // normalized direction vectors
+ QTest::newRow("line on x-axis from origin")
+ << QVector3D()
+ << QVector3D(1.0f, 0.0f, 0.0f);
+
+ QTest::newRow("line parallel -z-axis from 3,3,3")
+ << QVector3D(3.0f, 3.0f, 3.0f)
+ << QVector3D(0.0f, 0.0f, -1.0f);
+
+ QTest::newRow("vertical line (parallel to y-axis)")
+ << QVector3D(0.5f, 0.0f, 0.5f)
+ << QVector3D(0.0f, 1.0f, 0.0f);
+
+ QTest::newRow("equidistant from all 3 axes")
+ << QVector3D(0.5f, 0.0f, 0.5f)
+ << QVector3D(0.57735026919f, 0.57735026919f, 0.57735026919f);
+
+ // non-normalized direction vectors
+ QTest::newRow("line on x-axis from origin - B")
+ << QVector3D()
+ << QVector3D(2.0f, 0.0f, 0.0f);
+
+ QTest::newRow("line parallel -z-axis from 3,3,3 - B")
+ << QVector3D(3.0f, 3.0f, 3.0f)
+ << QVector3D(0.0f, 0.0f, -0.7f);
+
+ QTest::newRow("vertical line (parallel to y-axis) - B")
+ << QVector3D(0.5f, 0.0f, 0.5f)
+ << QVector3D(0.0f, 5.3f, 0.0f);
+
+ QTest::newRow("equidistant from all 3 axes - B")
+ << QVector3D(0.5f, 0.0f, 0.5f)
+ << QVector3D(1.0f, 1.0f, 1.0f);
+
+ QTest::newRow("negative direction")
+ << QVector3D(-3.0f, -3.0f, -3.0f)
+ << QVector3D(-1.2f, -1.8f, -2.4f);
+}
+
+void tst_QRay3D::create()
+{
+ QFETCH(QVector3D, point);
+ QFETCH(QVector3D, direction);
+ Qt3DRender::QRay3D ray(point, direction);
+ QVERIFY(fuzzyCompare(ray.direction(), direction));
+ QVERIFY(fuzzyCompare(ray.origin(), point));
+
+ Qt3DRender::QRay3D ray2;
+ QCOMPARE(ray2.origin(), QVector3D(0, 0, 0));
+ QCOMPARE(ray2.direction(), QVector3D(0, 0, 1));
+ ray2.setOrigin(point);
+ ray2.setDirection(direction);
+ QVERIFY(fuzzyCompare(ray.direction(), direction));
+ QVERIFY(fuzzyCompare(ray.origin(), point));
+}
+
+void tst_QRay3D::projection_data()
+{
+ QTest::addColumn<QVector3D>("point");
+ QTest::addColumn<QVector3D>("direction");
+ QTest::addColumn<QVector3D>("vector");
+ QTest::addColumn<QVector3D>("expected");
+
+ QTest::newRow("line on x-axis from origin")
+ << QVector3D()
+ << QVector3D(2.0f, 0.0f, 0.0f)
+ << QVector3D(0.6f, 0.0f, 0.0f)
+ << QVector3D(0.6f, 0.0f, 0.0f);
+
+ QTest::newRow("line parallel -z-axis from 3,3,3")
+ << QVector3D(3.0f, 3.0f, 3.0f)
+ << QVector3D(0.0f, 0.0f, -0.7f)
+ << QVector3D(3.0f, 3.0f, 2.4f)
+ << QVector3D(0.0f, 0.0f, 2.4f);
+
+ QTest::newRow("vertical line (parallel to y-axis)")
+ << QVector3D(0.5f, 0.0f, 0.5f)
+ << QVector3D(0.0f, 5.3f, 0.0f)
+ << QVector3D(0.5f, 0.6f, 0.5f)
+ << QVector3D(0.0f, 0.6f, 0.0f);
+
+ QTest::newRow("equidistant from all 3 axes, project y-axis (with some z & x)")
+ << QVector3D(0.5f, 0.0f, 0.5f)
+ << QVector3D(1.0f, 1.0f, 1.0f)
+ << QVector3D(0.5f, 5.0f, 0.5f)
+ << QVector3D(2.0f, 2.0f, 2.0f);
+
+ QTest::newRow("negative direction line, project +ve y-axis (with some z & x)")
+ << QVector3D(-3.0f, -3.0f, -3.0f)
+ << QVector3D(-1.2f, -1.8f, -2.4f)
+ << QVector3D(0.5f, 5.0f, 0.5f)
+ << QVector3D(1.241379261016846f, 1.862068772315979f, 2.48275852203369f);
+}
+
+void tst_QRay3D::projection()
+{
+ QFETCH(QVector3D, point);
+ QFETCH(QVector3D, direction);
+ QFETCH(QVector3D, vector);
+ QFETCH(QVector3D, expected);
+ Qt3DRender::QRay3D line(point, direction);
+ QVector3D result = line.project(vector);
+ QVERIFY(fuzzyCompare(result, expected));
+}
+
+void tst_QRay3D::point_data()
+{
+ QTest::addColumn<QVector3D>("point");
+ QTest::addColumn<QVector3D>("direction");
+ QTest::addColumn<QVector3D>("point_on_line_pos_0_6");
+ QTest::addColumn<QVector3D>("point_on_line_neg_7_2");
+
+ QTest::newRow("line on x-axis from origin")
+ << QVector3D()
+ << QVector3D(2.0f, 0.0f, 0.0f)
+ << QVector3D(1.2f, 0.0f, 0.0f)
+ << QVector3D(-14.4f, 0.0f, 0.0f);
+
+ QTest::newRow("line parallel -z-axis from 3,3,3")
+ << QVector3D(3.0f, 3.0f, 3.0f)
+ << QVector3D(0.0f, 0.0f, -0.7f)
+ << QVector3D(3.0f, 3.0f, 2.58f)
+ << QVector3D(3.0f, 3.0f, 8.04f);
+
+ QTest::newRow("vertical line (parallel to y-axis)")
+ << QVector3D(0.5f, 0.0f, 0.5f)
+ << QVector3D(0.0f, 5.3f, 0.0f)
+ << QVector3D(0.5f, 3.18f, 0.5f)
+ << QVector3D(0.5f, -38.16f, 0.5f);
+
+ QTest::newRow("equidistant from all 3 axes")
+ << QVector3D(0.5f, 0.0f, 0.5f)
+ << QVector3D(1.0f, 1.0f, 1.0f)
+ << QVector3D(1.1f, 0.6f, 1.1f)
+ << QVector3D(-6.7f, -7.2f, -6.7f);
+
+ QTest::newRow("negative direction")
+ << QVector3D(-3.0f, -3.0f, -3.0f)
+ << QVector3D(-1.2f, -1.8f, -2.4f)
+ << QVector3D(-3.72f, -4.08f, -4.44f)
+ << QVector3D(5.64f, 9.96f, 14.28f);
+}
+
+void tst_QRay3D::point()
+{
+ QFETCH(QVector3D, point);
+ QFETCH(QVector3D, direction);
+ QFETCH(QVector3D, point_on_line_pos_0_6);
+ QFETCH(QVector3D, point_on_line_neg_7_2);
+ Qt3DRender::QRay3D line(point, direction);
+ QVERIFY(fuzzyCompare(line.point(0.6), point_on_line_pos_0_6));
+ QVERIFY(fuzzyCompare(line.point(-7.2), point_on_line_neg_7_2));
+ QVERIFY(fuzzyCompare(line.projectedDistance(point_on_line_pos_0_6), 0.6));
+ QVERIFY(fuzzyCompare(line.projectedDistance(point_on_line_neg_7_2), -7.2));
+}
+
+void tst_QRay3D::contains_point_data()
+{
+ QTest::addColumn<QVector3D>("origin");
+ QTest::addColumn<QVector3D>("direction");
+ QTest::addColumn<QVector3D>("point");
+ QTest::addColumn<bool>("contains");
+
+ QTest::newRow("bogus this line with null direction")
+ << QVector3D(1.0, 3.0, 3.0)
+ << QVector3D(0.0, 0.0, 0.0)
+ << QVector3D(1.0, 2.0, 4.0)
+ << false;
+
+ QTest::newRow("point at the origin")
+ << QVector3D(0.0, 0.0, 0.0)
+ << QVector3D(1.0, 3.0, 3.0)
+ << QVector3D(0.0, 0.0, 0.0)
+ << true;
+
+ QTest::newRow("close to the origin")
+ << QVector3D(1.0, 1.0, 1.0)
+ << QVector3D(1.0, 3.0, 3.0)
+ << QVector3D(1.0005f, 1.0005f, 1.0)
+ << false;
+
+ QTest::newRow("45 line line in plane x=1")
+ << QVector3D(1.0, 3.0, 3.0)
+ << QVector3D(0.0, -1.0, -1.0)
+ << QVector3D(1.0, 4.0, 4.0)
+ << true;
+ {
+ // This is to prove that the constructed approach give the
+ // same results
+ QVector3D p(1.0, 3.0, 3.0);
+ QVector3D v(0.0, -1.0, -1.0);
+
+ QTest::newRow("constructed 45 line line in plane x=1")
+ << p
+ << v
+ << p + v
+ << true;
+ }
+
+ QTest::newRow("intersection with negative s in plane z=-1")
+ << QVector3D(1.0f, 2.0f, -1.0f)
+ << QVector3D(1.0f, 1.0f, 0.0f)
+ << QVector3D(2.0f, 1.0f, 0.0f)
+ << false;
+
+ QTest::newRow("45 angled line")
+ << QVector3D(3.0f, 0.0f, -1.0f)
+ << QVector3D(1.0f, -1.0f, 1.0f)
+ << QVector3D(6.0f, -3.0f, 2.0f)
+ << true;
+
+ {
+ QVector3D p(-10.0, 3.0, 3.0);
+ QVector3D v(0.0, 20.0, -1.0);
+ QTest::newRow("constructed vector close to axis")
+ << p
+ << v
+ << p + v * 3.0
+ << true;
+ }
+
+ {
+ QVector3D p(1.0, 3.0, 3.0);
+ QVector3D v(40.0, 500.0, -1.0);
+ QTest::newRow("constructed larger values close to axis")
+ << p
+ << v
+ << p + v
+ << true;
+ }
+}
+
+void tst_QRay3D::contains_point()
+{
+ QFETCH(QVector3D, origin);
+ QFETCH(QVector3D, direction);
+ QFETCH(QVector3D, point);
+ QFETCH(bool, contains);
+
+ Qt3DRender::QRay3D line(origin, direction);
+ QCOMPARE(line.contains(point), contains);
+}
+
+void tst_QRay3D::contains_ray_data()
+{
+ contains_point_data();
+}
+
+void tst_QRay3D::contains_ray()
+{
+ QFETCH(QVector3D, origin);
+ QFETCH(QVector3D, direction);
+ QFETCH(QVector3D, point);
+ QFETCH(bool, contains);
+
+ Qt3DRender::QRay3D line(origin, direction);
+ if (contains) {
+ Qt3DRender::QRay3D line2(point, direction);
+ QVERIFY(line.contains(line2));
+ QVERIFY(line2.contains(line));
+
+ // Reversed direction is also contained.
+ Qt3DRender::QRay3D line3(point, -direction);
+ QVERIFY(line.contains(line2));
+ QVERIFY(line2.contains(line));
+
+ // Different direction.
+ Qt3DRender::QRay3D line4(point, QVector3D(direction.y(), direction.x(), direction.z()));
+ QVERIFY(!line.contains(line4));
+ QVERIFY(!line4.contains(line));
+ } else {
+ Qt3DRender::QRay3D line2(point, direction);
+ QVERIFY(!line.contains(line2));
+ QVERIFY(!line2.contains(line));
+ }
+}
+
+void tst_QRay3D::distance_data()
+{
+ QTest::addColumn<QVector3D>("origin");
+ QTest::addColumn<QVector3D>("direction");
+ QTest::addColumn<QVector3D>("point");
+ QTest::addColumn<float>("distance");
+
+ QTest::newRow("axis-x")
+ << QVector3D(6.0f, 0.0f, 0.0f)
+ << QVector3D(1.0f, 0.0f, 0.0f)
+ << QVector3D(0.0f, 0.0f, 0.0f)
+ << 0.0f;
+
+ QTest::newRow("axis-x to 1")
+ << QVector3D(6.0f, 0.0f, 0.0f)
+ << QVector3D(1.0f, 0.0f, 0.0f)
+ << QVector3D(0.0f, 1.0f, 0.0f)
+ << 1.0f;
+
+ QTest::newRow("neg-axis-y")
+ << QVector3D(0.0f, 6.0f, 0.0f)
+ << QVector3D(0.0f, -1.5f, 0.0f)
+ << QVector3D(0.0f, 100.0f, 0.0f)
+ << 0.0f;
+
+ QTest::newRow("neg-axis-y to 2")
+ << QVector3D(0.0f, 6.0f, 0.0f)
+ << QVector3D(0.0f, -1.5f, 0.0f)
+ << QVector3D(2.0f, 0.0f, 0.0f)
+ << 2.0f;
+}
+
+void tst_QRay3D::distance()
+{
+ QFETCH(QVector3D, origin);
+ QFETCH(QVector3D, direction);
+ QFETCH(QVector3D, point);
+ QFETCH(float, distance);
+
+ Qt3DRender::QRay3D line(origin, direction);
+ QCOMPARE(line.distance(point), distance);
+}
+
+void tst_QRay3D::compare()
+{
+ Qt3DRender::QRay3D ray1(QVector3D(10, 20, 30), QVector3D(-3, -4, -5));
+ Qt3DRender::QRay3D ray2(QVector3D(10, 20, 30), QVector3D(1.5f, 2.0f, 2.5f));
+ Qt3DRender::QRay3D ray3(QVector3D(0, 20, 30), QVector3D(-3, -4, -5));
+ QVERIFY(ray1 == ray1);
+ QVERIFY(!(ray1 != ray1));
+ QVERIFY(qFuzzyCompare(ray1, ray1));
+ QVERIFY(ray1 != ray2);
+ QVERIFY(!(ray1 == ray2));
+ QVERIFY(!qFuzzyCompare(ray1, ray2));
+ QVERIFY(ray1 != ray3);
+ QVERIFY(!(ray1 == ray3));
+ QVERIFY(!qFuzzyCompare(ray1, ray3));
+}
+
+void tst_QRay3D::dataStream()
+{
+#ifndef QT_NO_DATASTREAM
+ Qt3DRender::QRay3D ray(QVector3D(1.0f, 2.0f, 3.0f), QVector3D(4.0f, 5.0f, 6.0f));
+
+ QByteArray data;
+ {
+ QDataStream stream(&data, QIODevice::WriteOnly);
+ stream << ray;
+ }
+
+ Qt3DRender::QRay3D ray2;
+ {
+ QDataStream stream2(data);
+ stream2 >> ray2;
+ }
+
+ QVERIFY(ray == ray2);
+#endif
+}
+
+void tst_QRay3D::transform_data()
+{
+ create_data();
+}
+
+void tst_QRay3D::transform()
+{
+ QFETCH(QVector3D, point);
+ QFETCH(QVector3D, direction);
+
+ QMatrix4x4 m;
+ m.translate(-1.0f, 2.5f, 5.0f);
+ m.rotate(45.0f, 1.0f, 1.0f, 1.0f);
+ m.scale(23.5f);
+
+ Qt3DRender::QRay3D ray1(point, direction);
+ Qt3DRender::QRay3D ray2(ray1);
+ Qt3DRender::QRay3D ray3;
+
+ ray1.transform(m);
+ ray3 = ray2.transformed(m);
+
+ QVERIFY(fuzzyCompare(ray1.origin(), ray3.origin()));
+ QVERIFY(fuzzyCompare(ray1.direction(), ray3.direction()));
+
+ QVERIFY(fuzzyCompare(ray1.origin(), m * point));
+ QVERIFY(fuzzyCompare(ray1.direction(), m.mapVector(direction)));
+}
+
+class tst_QRay3DProperties : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt3DRender::QRay3D ray READ ray WRITE setRay)
+public:
+ tst_QRay3DProperties(QObject *parent = 0) : QObject(parent) {}
+
+ Qt3DRender::QRay3D ray() const { return r; }
+ void setRay(const Qt3DRender::QRay3D& value) { r = value; }
+
+private:
+ Qt3DRender::QRay3D r;
+};
+
+// Test getting and setting properties via the metaobject system.
+void tst_QRay3D::properties()
+{
+ tst_QRay3DProperties obj;
+
+ qRegisterMetaType<Qt3DRender::QRay3D>();
+
+ obj.setRay(Qt3DRender::QRay3D(QVector3D(1, 2, 3), QVector3D(4, 5, 6)));
+
+ Qt3DRender::QRay3D r = qvariant_cast<Qt3DRender::QRay3D>(obj.property("ray"));
+ QCOMPARE(r.origin(), QVector3D(1, 2, 3));
+ QCOMPARE(r.direction(), QVector3D(4, 5, 6));
+
+ obj.setProperty("ray",
+ qVariantFromValue
+ (Qt3DRender::QRay3D(QVector3D(-1, -2, -3), QVector3D(-4, -5, -6))));
+
+ r = qvariant_cast<Qt3DRender::QRay3D>(obj.property("ray"));
+ QCOMPARE(r.origin(), QVector3D(-1, -2, -3));
+ QCOMPARE(r.direction(), QVector3D(-4, -5, -6));
+}
+
+void tst_QRay3D::metaTypes()
+{
+ int id = qMetaTypeId<Qt3DRender::QRay3D>();
+ QVERIFY(QMetaType::type("Qt3DRender::QRay3D") == id);
+ QCOMPARE(QByteArray(QMetaType::typeName(id)), QByteArray("Qt3DRender::QRay3D"));
+ QVERIFY(QMetaType::isRegistered(id));
+}
+
+void tst_QRay3D::shouldNotAllowNullDirection()
+{
+ // GIVEN
+ Qt3DRender::QRay3D ray;
+
+ QCOMPARE(ray.origin(), QVector3D(0, 0, 0));
+ QCOMPARE(ray.direction(), QVector3D(0, 0, 1));
+
+ // WHEN
+ ray.setDirection(QVector3D(0, 0, 0));
+
+ // THEN
+ QCOMPARE(ray.direction(), QVector3D(0, 0, 1));
+}
+
+QTEST_APPLESS_MAIN(tst_QRay3D)
+
+#include "tst_qray3d.moc"
diff --git a/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp b/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp
index 43bdb2e0a..9e6e4fcc1 100644
--- a/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp
+++ b/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,23 +30,22 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qrenderpassfilter.h>
+#include <Qt3DRender/private/qrenderpassfilter_p.h>
#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qannotation.h>
+#include <Qt3DRender/qfilterkey.h>
+
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QRenderPassFilter: public Qt3DCore::QNode
+class tst_QRenderPassFilter: public QObject
{
Q_OBJECT
-public:
- ~tst_QRenderPassFilter()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -62,100 +53,92 @@ private Q_SLOTS:
{
QScopedPointer<Qt3DRender::QRenderPassFilter> defaultRenderPassFilter(new Qt3DRender::QRenderPassFilter);
- QCOMPARE(defaultRenderPassFilter->includes().count(), 0);
+ QCOMPARE(defaultRenderPassFilter->matchAny().count(), 0);
QCOMPARE(defaultRenderPassFilter->parameters().count(), 0);
}
void checkCloning_data()
{
QTest::addColumn<Qt3DRender::QRenderPassFilter *>("renderPassFilter");
- QTest::addColumn<QList<Qt3DRender::QParameter *> >("parameters");
- QTest::addColumn<QList<Qt3DRender::QAnnotation *> >("annotations");
+ QTest::addColumn<QVector<Qt3DRender::QParameter *> >("parameters");
+ QTest::addColumn<QVector<Qt3DRender::QFilterKey *> >("filterKeys");
Qt3DRender::QRenderPassFilter *defaultConstructed = new Qt3DRender::QRenderPassFilter();
- QTest::newRow("defaultConstructed") << defaultConstructed << QList<Qt3DRender::QParameter *>() << QList<Qt3DRender::QAnnotation *>();
+ QTest::newRow("defaultConstructed") << defaultConstructed << QVector<Qt3DRender::QParameter *>() << QVector<Qt3DRender::QFilterKey *>();
Qt3DRender::QRenderPassFilter *renderPassFilterWithParams = new Qt3DRender::QRenderPassFilter();
Qt3DRender::QParameter *parameter1 = new Qt3DRender::QParameter(QStringLiteral("displacement"), 454.0f);
Qt3DRender::QParameter *parameter2 = new Qt3DRender::QParameter(QStringLiteral("torque"), 650);
- QList<Qt3DRender::QParameter *> params1 = QList<Qt3DRender::QParameter *>() << parameter1 << parameter2;
+ QVector<Qt3DRender::QParameter *> params1 = QVector<Qt3DRender::QParameter *>() << parameter1 << parameter2;
renderPassFilterWithParams->addParameter(parameter1);
renderPassFilterWithParams->addParameter(parameter2);
- QTest::newRow("renderPassFilterWithParams") << renderPassFilterWithParams << params1 << QList<Qt3DRender::QAnnotation *>();
+ QTest::newRow("renderPassFilterWithParams") << renderPassFilterWithParams << params1 << QVector<Qt3DRender::QFilterKey *>();
Qt3DRender::QRenderPassFilter *renderPassFilterWithAnnotations = new Qt3DRender::QRenderPassFilter();
- Qt3DRender::QAnnotation *annotation1 = new Qt3DRender::QAnnotation();
- Qt3DRender::QAnnotation *annotation2 = new Qt3DRender::QAnnotation();
- annotation1->setName(QStringLiteral("hasSuperCharger"));
- annotation1->setValue(true);
- annotation1->setName(QStringLiteral("hasNitroKit"));
- annotation1->setValue(false);
- QList<Qt3DRender::QAnnotation *> annotations1 = QList<Qt3DRender::QAnnotation *>() << annotation1 << annotation2;
- renderPassFilterWithAnnotations->addInclude(annotation1);
- renderPassFilterWithAnnotations->addInclude(annotation2);
- QTest::newRow("renderPassFilterWithAnnotations") << renderPassFilterWithAnnotations << QList<Qt3DRender::QParameter *>() << annotations1;
+ Qt3DRender::QFilterKey *filterKey1 = new Qt3DRender::QFilterKey();
+ Qt3DRender::QFilterKey *filterKey2 = new Qt3DRender::QFilterKey();
+ filterKey1->setName(QStringLiteral("hasSuperCharger"));
+ filterKey1->setValue(true);
+ filterKey1->setName(QStringLiteral("hasNitroKit"));
+ filterKey1->setValue(false);
+ QVector<Qt3DRender::QFilterKey *> filterKeys1 = QVector<Qt3DRender::QFilterKey *>() << filterKey1 << filterKey2;
+ renderPassFilterWithAnnotations->addMatch(filterKey1);
+ renderPassFilterWithAnnotations->addMatch(filterKey2);
+ QTest::newRow("renderPassFilterWithAnnotations") << renderPassFilterWithAnnotations << QVector<Qt3DRender::QParameter *>() << filterKeys1;
Qt3DRender::QRenderPassFilter *renderPassFilterWithParamsAndAnnotations = new Qt3DRender::QRenderPassFilter();
Qt3DRender::QParameter *parameter3 = new Qt3DRender::QParameter(QStringLiteral("displacement"), 383.0f);
Qt3DRender::QParameter *parameter4 = new Qt3DRender::QParameter(QStringLiteral("torque"), 555);
- Qt3DRender::QAnnotation *annotation3 = new Qt3DRender::QAnnotation();
- Qt3DRender::QAnnotation *annotation4 = new Qt3DRender::QAnnotation();
- annotation3->setName(QStringLiteral("hasSuperCharger"));
- annotation3->setValue(false);
- annotation4->setName(QStringLiteral("hasNitroKit"));
- annotation4->setValue(true);
- QList<Qt3DRender::QParameter *> params2 = QList<Qt3DRender::QParameter *>() << parameter3 << parameter4;
- QList<Qt3DRender::QAnnotation *> annotations2 = QList<Qt3DRender::QAnnotation *>() << annotation3 << annotation4;
+ Qt3DRender::QFilterKey *filterKey3 = new Qt3DRender::QFilterKey();
+ Qt3DRender::QFilterKey *filterKey4 = new Qt3DRender::QFilterKey();
+ filterKey3->setName(QStringLiteral("hasSuperCharger"));
+ filterKey3->setValue(false);
+ filterKey4->setName(QStringLiteral("hasNitroKit"));
+ filterKey4->setValue(true);
+ QVector<Qt3DRender::QParameter *> params2 = QVector<Qt3DRender::QParameter *>() << parameter3 << parameter4;
+ QVector<Qt3DRender::QFilterKey *> filterKeys2 = QVector<Qt3DRender::QFilterKey *>() << filterKey3 << filterKey4;
renderPassFilterWithParamsAndAnnotations->addParameter(parameter3);
renderPassFilterWithParamsAndAnnotations->addParameter(parameter4);
- renderPassFilterWithParamsAndAnnotations->addInclude(annotation3);
- renderPassFilterWithParamsAndAnnotations->addInclude(annotation4);
- QTest::newRow("renderPassFilterWithParamsAndAnnotations") << renderPassFilterWithParamsAndAnnotations << params2 << annotations2;
+ renderPassFilterWithParamsAndAnnotations->addMatch(filterKey3);
+ renderPassFilterWithParamsAndAnnotations->addMatch(filterKey4);
+ QTest::newRow("renderPassFilterWithParamsAndAnnotations") << renderPassFilterWithParamsAndAnnotations << params2 << filterKeys2 ;
}
+ // TODO: Avoid cloning here
void checkCloning()
{
// GIVEN
QFETCH(Qt3DRender::QRenderPassFilter*, renderPassFilter);
- QFETCH(QList<Qt3DRender::QParameter *>, parameters);
- QFETCH(QList<Qt3DRender::QAnnotation *>, annotations);
+ QFETCH(QVector<Qt3DRender::QParameter *>, parameters);
+ QFETCH(QVector<Qt3DRender::QFilterKey *>, filterKeys);
// THEN
QCOMPARE(renderPassFilter->parameters(), parameters);
- QCOMPARE(renderPassFilter->includes(), annotations);
+ QCOMPARE(renderPassFilter->matchAny(), filterKeys);
// WHEN
- Qt3DRender::QRenderPassFilter *clone = static_cast<Qt3DRender::QRenderPassFilter *>(QNode::clone(renderPassFilter));
+ // WHEN
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(renderPassFilter);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(renderPassFilter->id(), clone->id());
-
- QCOMPARE(renderPassFilter->includes().count(), clone->includes().count());
- QCOMPARE(renderPassFilter->parameters().count(), clone->parameters().count());
-
- for (int i = 0, m = parameters.count(); i < m; ++i) {
- Qt3DRender::QParameter *pClone = clone->parameters().at(i);
- Qt3DRender::QParameter *pOrig = parameters.at(i);
- QCOMPARE(pOrig->id(),pClone->id());
- QCOMPARE(pOrig->name(), pClone->name());
- QCOMPARE(pOrig->value(), pClone->value());
- QVERIFY(pClone->parent() == clone);
- QVERIFY(pOrig->parent() == renderPassFilter);
- }
-
- for (int i = 0, m = annotations.count(); i < m; ++i) {
- Qt3DRender::QAnnotation *aClone = clone->includes().at(i);
- Qt3DRender::QAnnotation *aOrig = annotations.at(i);
- QCOMPARE(aOrig->id(),aClone->id());
- QCOMPARE(aOrig->name(), aClone->name());
- QCOMPARE(aOrig->value(), aClone->value());
- QVERIFY(aClone->parent() == clone);
- QVERIFY(aOrig->parent() == renderPassFilter);
- }
+ QCOMPARE(creationChanges.size(), 1 + renderPassFilter->parameters().size() + renderPassFilter->matchAny().size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QRenderPassFilterData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QRenderPassFilterData>>(creationChanges.first());
+ const Qt3DRender::QRenderPassFilterData &cloneData = creationChangeData->data;
+
+ // THEN
+ QCOMPARE(renderPassFilter->id(), creationChangeData->subjectId());
+ QCOMPARE(renderPassFilter->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(renderPassFilter->metaObject(), creationChangeData->metaObject());
+
+ QCOMPARE(renderPassFilter->matchAny().count(), cloneData.matchIds.count());
+ QCOMPARE(renderPassFilter->parameters().count(), cloneData.parameterIds.count());
+
+ // TO DO: Add unit tests for QParameter / QFilterKey
delete renderPassFilter;
- delete clone;
}
void checkPropertyUpdates()
@@ -171,11 +154,11 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyNodeAddedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
QCOMPARE(change->propertyName(), "parameter");
QCOMPARE(change->subjectId(),renderPassFilter->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), param1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ QCOMPARE(change->addedNodeId(), param1->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -192,57 +175,50 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "parameter");
- QCOMPARE(change->subjectId(), renderPassFilter->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), param1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "parameter");
+ QCOMPARE(nodeRemovedChange->subjectId(), renderPassFilter->id());
+ QCOMPARE(nodeRemovedChange->removedNodeId(), param1->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
// WHEN
- Qt3DRender::QAnnotation *annotation1 = new Qt3DRender::QAnnotation();
- renderPassFilter->addInclude(annotation1);
+ Qt3DRender::QFilterKey *filterKey1 = new Qt3DRender::QFilterKey();
+ renderPassFilter->addMatch(filterKey1);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "include");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(change->propertyName(), "match");
QCOMPARE(change->subjectId(),renderPassFilter->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), annotation1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ QCOMPARE(change->addedNodeId(), filterKey1->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
// WHEN
- renderPassFilter->addInclude(annotation1);
+ renderPassFilter->addMatch(filterKey1);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 0);
// WHEN
- renderPassFilter->removeInclude(annotation1);
+ renderPassFilter->removeMatch(filterKey1);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "include");
- QCOMPARE(change->subjectId(), renderPassFilter->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), annotation1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "match");
+ QCOMPARE(nodeRemovedChange->subjectId(), renderPassFilter->id());
+ QCOMPARE(nodeRemovedChange->removedNodeId(), filterKey1->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QRenderPassFilter)
diff --git a/tests/auto/render/qrenderstateset/qrenderstateset.pro b/tests/auto/render/qrenderstateset/qrenderstateset.pro
new file mode 100644
index 000000000..836e84171
--- /dev/null
+++ b/tests/auto/render/qrenderstateset/qrenderstateset.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+TARGET = tst_qrenderstateset
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qrenderstateset.cpp
+
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp b/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp
new file mode 100644
index 000000000..073306237
--- /dev/null
+++ b/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+
+#include <Qt3DRender/qrenderstateset.h>
+#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DRender/qrenderstate.h>
+#include <Qt3DRender/private/qrenderstateset_p.h>
+
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+
+#include "testpostmanarbiter.h"
+
+class MyStateSet;
+class MyStateSetPrivate : public Qt3DRender::QRenderStatePrivate
+{
+public :
+ MyStateSetPrivate()
+ : QRenderStatePrivate(Qt3DRender::QRenderStatePrivate::DepthTest)
+ {}
+};
+
+
+class MyStateSet : public Qt3DRender::QRenderState
+{
+ Q_OBJECT
+public:
+ explicit MyStateSet(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DRender::QRenderState(*new MyStateSetPrivate(), parent)
+ {}
+
+private:
+ Q_DECLARE_PRIVATE(MyStateSet)
+};
+
+class tst_QRenderStateSet: public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkSaneDefaults()
+ {
+ QScopedPointer<Qt3DRender::QRenderStateSet> defaultstateSet(new Qt3DRender::QRenderStateSet);
+ QVERIFY(defaultstateSet->renderStates().isEmpty());
+ }
+
+ void checkCloning_data()
+ {
+ QTest::addColumn<Qt3DRender::QRenderStateSet *>("stateSet");
+ QTest::addColumn<QVector<Qt3DRender::QRenderState *> >("states");
+
+ Qt3DRender::QRenderStateSet *defaultConstructed = new Qt3DRender::QRenderStateSet();
+ QTest::newRow("defaultConstructed") << defaultConstructed << QVector<Qt3DRender::QRenderState *>();
+
+ Qt3DRender::QRenderStateSet *stateSetWithStates = new Qt3DRender::QRenderStateSet();
+ Qt3DRender::QRenderState *state1 = new MyStateSet();
+ Qt3DRender::QRenderState *state2 = new MyStateSet();
+ QVector<Qt3DRender::QRenderState *> states = QVector<Qt3DRender::QRenderState *>() << state1 << state2;
+ stateSetWithStates->addRenderState(state1);
+ stateSetWithStates->addRenderState(state2);
+ QTest::newRow("stateSetWithStates") << stateSetWithStates << states;
+ }
+
+ void checkCloning()
+ {
+ // GIVEN
+ QFETCH(Qt3DRender::QRenderStateSet*, stateSet);
+ QFETCH(QVector<Qt3DRender::QRenderState *>, states);
+
+ // THEN
+ QCOMPARE(stateSet->renderStates(), states);
+
+ // WHEN
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(stateSet);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1 + states.size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QRenderStateSetData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QRenderStateSetData>>(creationChanges.first());
+ const Qt3DRender::QRenderStateSetData &cloneData = creationChangeData->data;
+
+ QCOMPARE(stateSet->id(), creationChangeData->subjectId());
+ QCOMPARE(stateSet->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(stateSet->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(stateSet->renderStates().count(), cloneData.renderStateIds.count());
+
+ for (int i = 0, m = states.count(); i < m; ++i) {
+ Qt3DRender::QRenderState *sOrig = states.at(i);
+ QCOMPARE(sOrig->id(), cloneData.renderStateIds.at(i));
+ }
+
+ delete stateSet;
+ }
+
+ void checkPropertyUpdates()
+ {
+ // GIVEN
+ QScopedPointer<Qt3DRender::QRenderStateSet> stateSet(new Qt3DRender::QRenderStateSet());
+ TestArbiter arbiter(stateSet.data());
+
+ // WHEN
+ Qt3DRender::QRenderState *state1 = new MyStateSet();
+ stateSet->addRenderState(state1);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyNodeAddedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(change->propertyName(), "renderState");
+ QCOMPARE(change->subjectId(), stateSet->id());
+ QCOMPARE(change->addedNodeId(), state1->id());
+ QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
+
+ arbiter.events.clear();
+
+ // WHEN
+ stateSet->addRenderState(state1);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+
+ // WHEN
+ stateSet->removeRenderState(state1);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "renderState");
+ QCOMPARE(nodeRemovedChange->subjectId(), stateSet->id());
+ QCOMPARE(nodeRemovedChange->removedNodeId(), state1->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
+
+ arbiter.events.clear();
+ }
+};
+
+QTEST_MAIN(tst_QRenderStateSet)
+
+#include "tst_qrenderstateset.moc"
diff --git a/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp b/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp
index 2b3088562..b4cb479ba 100644
--- a/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp
+++ b/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,21 +30,16 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qrendertargetselector.h>
+#include <Qt3DRender/private/qrendertargetselector_p.h>
#include <Qt3DRender/qrendertarget.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QRenderTargetSelector: public Qt3DCore::QNode
+class tst_QRenderTargetSelector: public QObject
{
Q_OBJECT
-public:
- ~tst_QRenderTargetSelector()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -60,59 +47,61 @@ private Q_SLOTS:
{
QScopedPointer<Qt3DRender::QRenderTargetSelector> defaultTargetSelector(new Qt3DRender::QRenderTargetSelector);
- QVERIFY(defaultTargetSelector->target() == Q_NULLPTR);
- QCOMPARE(defaultTargetSelector->drawBuffers().count(), 0);
+ QVERIFY(defaultTargetSelector->target() == nullptr);
+ QCOMPARE(defaultTargetSelector->outputs().count(), 0);
}
void checkCloning_data()
{
QTest::addColumn<Qt3DRender::QRenderTargetSelector *>("renderTargetSelector");
- QTest::addColumn<QList<Qt3DRender::QRenderAttachment::RenderAttachmentType> >("drawBuffers");
+ QTest::addColumn<QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint> >("outputs");
QTest::addColumn<Qt3DRender::QRenderTarget * >("target");
Qt3DRender::QRenderTargetSelector *defaultConstructed = new Qt3DRender::QRenderTargetSelector();
- QTest::newRow("defaultConstructed") << defaultConstructed << QList<Qt3DRender::QRenderAttachment::RenderAttachmentType>() << static_cast<Qt3DRender::QRenderTarget *>(Q_NULLPTR);
+ QTest::newRow("defaultConstructed") << defaultConstructed << QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint>() << static_cast<Qt3DRender::QRenderTarget *>(nullptr);
Qt3DRender::QRenderTargetSelector *renderTargetSelectorWithTarget = new Qt3DRender::QRenderTargetSelector();
Qt3DRender::QRenderTarget *target1 = new Qt3DRender::QRenderTarget();
renderTargetSelectorWithTarget->setTarget(target1);
- QTest::newRow("renderTargetSelectorWithTarget") << renderTargetSelectorWithTarget << QList<Qt3DRender::QRenderAttachment::RenderAttachmentType>() << target1;
+ QTest::newRow("renderTargetSelectorWithTarget") << renderTargetSelectorWithTarget << QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint>() << target1;
Qt3DRender::QRenderTargetSelector *renderTargetSelectorWithTargetAndBuffers = new Qt3DRender::QRenderTargetSelector();
Qt3DRender::QRenderTarget *target2 = new Qt3DRender::QRenderTarget();
renderTargetSelectorWithTargetAndBuffers->setTarget(target2);
- QList<Qt3DRender::QRenderAttachment::RenderAttachmentType> attachmentTypes = QList<Qt3DRender::QRenderAttachment::RenderAttachmentType>() << Qt3DRender::QRenderAttachment::ColorAttachment0 << Qt3DRender::QRenderAttachment::DepthAttachment;
- renderTargetSelectorWithTargetAndBuffers->setDrawBuffers(attachmentTypes);
- QTest::newRow("renderTargetSelectorWithTargetAndDrawBuffers") << renderTargetSelectorWithTargetAndBuffers << attachmentTypes << target2;
+ QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint> attachmentPoints = QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint>() << Qt3DRender::QRenderTargetOutput::Color0 << Qt3DRender::QRenderTargetOutput::Depth;
+ renderTargetSelectorWithTargetAndBuffers->setOutputs(attachmentPoints);
+ QTest::newRow("renderTargetSelectorWithTargetAndDrawBuffers") << renderTargetSelectorWithTargetAndBuffers << attachmentPoints << target2;
}
void checkCloning()
{
// GIVEN
QFETCH(Qt3DRender::QRenderTargetSelector*, renderTargetSelector);
- QFETCH(QList<Qt3DRender::QRenderAttachment::RenderAttachmentType>, drawBuffers);
+ QFETCH(QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint>, outputs);
QFETCH(Qt3DRender::QRenderTarget *, target);
// THEN
- QCOMPARE(renderTargetSelector->drawBuffers(), drawBuffers);
+ QCOMPARE(renderTargetSelector->outputs(), outputs);
QCOMPARE(renderTargetSelector->target(), target);
// WHEN
- Qt3DRender::QRenderTargetSelector *clone = static_cast<Qt3DRender::QRenderTargetSelector *>(QNode::clone(renderTargetSelector));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(renderTargetSelector);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(renderTargetSelector->id(), clone->id());
+ QCOMPARE(creationChanges.size(), 1 + (renderTargetSelector->target() ? 1 : 0));
- QCOMPARE(renderTargetSelector->drawBuffers(), clone->drawBuffers());
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QRenderTargetSelectorData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QRenderTargetSelectorData>>(creationChanges.first());
+ const Qt3DRender::QRenderTargetSelectorData &cloneData = creationChangeData->data;
- if (renderTargetSelector->target() != Q_NULLPTR) {
- QVERIFY(clone->target() != Q_NULLPTR);
- QCOMPARE(clone->target()->id(), renderTargetSelector->target()->id());
- }
+ // THEN
+ QCOMPARE(renderTargetSelector->id(), creationChangeData->subjectId());
+ QCOMPARE(renderTargetSelector->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(renderTargetSelector->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(renderTargetSelector->target() ? renderTargetSelector->target()->id() : Qt3DCore::QNodeId(), cloneData.targetId);
delete renderTargetSelector;
- delete clone;
}
void checkPropertyUpdates()
@@ -128,11 +117,11 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "target");
QCOMPARE(change->subjectId(), renderTargetSelector->id());
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), target->id());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
@@ -144,64 +133,57 @@ private Q_SLOTS:
QCOMPARE(arbiter.events.size(), 0);
// WHEN
- renderTargetSelector->setTarget(Q_NULLPTR);
+ renderTargetSelector->setTarget(nullptr);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "target");
QCOMPARE(change->subjectId(), renderTargetSelector->id());
QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), Qt3DCore::QNodeId());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- QList<Qt3DRender::QRenderAttachment::RenderAttachmentType> drawBuffers;
- drawBuffers << Qt3DRender::QRenderAttachment::ColorAttachment0 << Qt3DRender::QRenderAttachment::DepthAttachment;
- renderTargetSelector->setDrawBuffers(drawBuffers);
+ QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint> outputs;
+ outputs << Qt3DRender::QRenderTargetOutput::Color0 << Qt3DRender::QRenderTargetOutput::Depth;
+ renderTargetSelector->setOutputs(outputs);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "drawBuffers");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "outputs");
QCOMPARE(change->subjectId(), renderTargetSelector->id());
- QCOMPARE(change->value().value<QList<Qt3DRender::QRenderAttachment::RenderAttachmentType> >(), drawBuffers);
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->value().value<QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint> >(), outputs);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- renderTargetSelector->setDrawBuffers(drawBuffers);
+ renderTargetSelector->setOutputs(outputs);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 0);
// WHEN
- renderTargetSelector->setDrawBuffers(QList<Qt3DRender::QRenderAttachment::RenderAttachmentType>());
+ renderTargetSelector->setOutputs(QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint>());
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "drawBuffers");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "outputs");
QCOMPARE(change->subjectId(), renderTargetSelector->id());
- QCOMPARE(change->value().value<QList<Qt3DRender::QRenderAttachment::RenderAttachmentType> >(), QList<Qt3DRender::QRenderAttachment::RenderAttachmentType>());
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->value().value<QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint> >(), QVector<Qt3DRender::QRenderTargetOutput::AttachmentPoint>());
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QRenderTargetSelector)
diff --git a/tests/auto/render/qsortcriterion/qsortcriterion.pro b/tests/auto/render/qsortcriterion/qsortcriterion.pro
deleted file mode 100644
index f612fcd5a..000000000
--- a/tests/auto/render/qsortcriterion/qsortcriterion.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_qsortcriterion
-
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_qsortcriterion.cpp
-
-include(../commons/commons.pri)
diff --git a/tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp b/tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp
index fe835b97e..bac9fb3e8 100644
--- a/tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp
+++ b/tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the S module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,21 +29,16 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qsortcriterion.h>
+#include <Qt3DRender/private/qsortcriterion_p.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QSortCriterion: public Qt3DCore::QNode
+class tst_QSortCriterion: public QObject
{
Q_OBJECT
-public:
- ~tst_QSortCriterion()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -81,16 +68,26 @@ private Q_SLOTS:
// THEN
QCOMPARE(sortCriterion->sort(), sortType);
- // WHEN
- Qt3DRender::QSortCriterion *clone = static_cast<Qt3DRender::QSortCriterion *>(QNode::clone(sortCriterion));
+// TO DO: Add creation change
+// // WHEN
+// Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(sortCriterion);
+// QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(sortCriterion->id(), clone->id());
- QCOMPARE(sortCriterion->sort(), clone->sort());
+// // THEN
+// QCOMPARE(creationChanges.size(), 1);
+
+// const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QCameraSelectorData> creationChangeData =
+// qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QSortCriterion>>(creationChanges.first());
+// const Qt3DRender::QCameraSelectorData &cloneData = creationChangeData->data;
+
+
+// // THEN
+// QCOMPARE(sortCriterion->id(), creationChangeData->subjectId());
+// QCOMPARE(sortCriterion->isEnabled(), creationChangeData->isNodeEnabled());
+// QCOMPARE(sortCriterion->metaObject(), creationChangeData->metaObject());
+// QCOMPARE(sortCriterion->sort(), cloneData.sort);
delete sortCriterion;
- delete clone;
}
void checkPropertyUpdates()
@@ -105,7 +102,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ Qt3DCore::QNodePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QNodePropertyChange>();
QCOMPARE(change->propertyName(), "sort");
QCOMPARE(change->subjectId(), sortCriterion->id());
QCOMPARE(change->value().value<Qt3DRender::QSortCriterion::SortType>(), Qt3DRender::QSortCriterion::BackToFront);
@@ -126,7 +123,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
+ change = arbiter.events.first().staticCast<Qt3DCore::QNodePropertyChange>();
QCOMPARE(change->propertyName(), "sort");
QCOMPARE(change->subjectId(), sortCriterion->id());
QCOMPARE(change->value().value<Qt3DRender::QSortCriterion::SortType>(), Qt3DRender::QSortCriterion::Material);
@@ -134,13 +131,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QSortCriterion)
diff --git a/tests/auto/render/qsortmethod/qsortmethod.pro b/tests/auto/render/qsortmethod/qsortmethod.pro
deleted file mode 100644
index ca9537aa6..000000000
--- a/tests/auto/render/qsortmethod/qsortmethod.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_qsortmethod
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_qsortmethod.cpp
-
-include(../commons/commons.pri)
diff --git a/tests/auto/render/qsortmethod/tst_qsortmethod.cpp b/tests/auto/render/qsortmethod/tst_qsortmethod.cpp
deleted file mode 100644
index 035291375..000000000
--- a/tests/auto/render/qsortmethod/tst_qsortmethod.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qentity.h>
-
-#include <Qt3DRender/qsortmethod.h>
-#include <Qt3DRender/qsortcriterion.h>
-
-#include "testpostmanarbiter.h"
-
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QSortMethod: public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- ~tst_QSortMethod()
- {
- QNode::cleanup();
- }
-
-private Q_SLOTS:
-
- void checkSaneDefaults()
- {
- QScopedPointer<Qt3DRender::QSortMethod> defaultsortMethod(new Qt3DRender::QSortMethod);
-
- QVERIFY(defaultsortMethod->criteria().isEmpty());
- }
-
- void checkCloning_data()
- {
- QTest::addColumn<Qt3DRender::QSortMethod *>("sortMethod");
- QTest::addColumn<QList<Qt3DRender::QSortCriterion *> >("criteria");
-
- Qt3DRender::QSortMethod *defaultConstructed = new Qt3DRender::QSortMethod();
- QTest::newRow("defaultConstructed") << defaultConstructed << QList<Qt3DRender::QSortCriterion *>();
-
- Qt3DRender::QSortMethod *sortMethodWithCriteria = new Qt3DRender::QSortMethod();
- Qt3DRender::QSortCriterion *criterion1 = new Qt3DRender::QSortCriterion();
- Qt3DRender::QSortCriterion *criterion2 = new Qt3DRender::QSortCriterion();
- criterion1->setSort(Qt3DRender::QSortCriterion::BackToFront);
- criterion2->setSort(Qt3DRender::QSortCriterion::Material);
- QList<Qt3DRender::QSortCriterion *> criteria = QList<Qt3DRender::QSortCriterion *>() << criterion1 << criterion2;
- sortMethodWithCriteria->addCriterion(criterion1);
- sortMethodWithCriteria->addCriterion(criterion2);
- QTest::newRow("sortMethodWithCriteria") << sortMethodWithCriteria << criteria;
- }
-
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QSortMethod*, sortMethod);
- QFETCH(QList<Qt3DRender::QSortCriterion *>, criteria);
-
- // THEN
- QCOMPARE(sortMethod->criteria(), criteria);
-
- // WHEN
- Qt3DRender::QSortMethod *clone = static_cast<Qt3DRender::QSortMethod *>(QNode::clone(sortMethod));
-
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(sortMethod->id(), clone->id());
-
- QCOMPARE(sortMethod->criteria().count(), clone->criteria().count());
-
- for (int i = 0, m = criteria.count(); i < m; ++i) {
- Qt3DRender::QSortCriterion *cClone = clone->criteria().at(i);
- Qt3DRender::QSortCriterion *cOrig = criteria.at(i);
- QCOMPARE(cOrig->id(),cClone->id());
- QCOMPARE(cOrig->sort(), cClone->sort());
- QVERIFY(cClone->parent() == clone);
- QVERIFY(cOrig->parent() == sortMethod);
- }
-
- delete sortMethod;
- delete clone;
- }
-
- void checkPropertyUpdates()
- {
- // GIVEN
- QScopedPointer<Qt3DRender::QSortMethod> sortMethod(new Qt3DRender::QSortMethod());
- TestArbiter arbiter(sortMethod.data());
-
- // WHEN
- Qt3DRender::QSortCriterion *criterion1 = new Qt3DRender::QSortCriterion();
- sortMethod->addCriterion(criterion1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "sortCriterion");
- QCOMPARE(change->subjectId(),sortMethod->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), criterion1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
-
- arbiter.events.clear();
-
- // WHEN
- sortMethod->addCriterion(criterion1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 0);
-
- // WHEN
- sortMethod->removeCriterion(criterion1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "sortCriterion");
- QCOMPARE(change->subjectId(), sortMethod->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), criterion1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
-
- arbiter.events.clear();
- }
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
-};
-
-QTEST_MAIN(tst_QSortMethod)
-
-#include "tst_qsortmethod.moc"
diff --git a/tests/auto/render/qsortpolicy/qsortpolicy.pro b/tests/auto/render/qsortpolicy/qsortpolicy.pro
new file mode 100644
index 000000000..1f955d2f0
--- /dev/null
+++ b/tests/auto/render/qsortpolicy/qsortpolicy.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+TARGET = tst_qsortmethod
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qsortpolicy.cpp
+
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp b/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp
new file mode 100644
index 000000000..cd88785f5
--- /dev/null
+++ b/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DCore/private/qnode_p.h>
+#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qpropertyvalueaddedchange.h>
+#include <Qt3DCore/qpropertyvalueremovedchange.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+
+#include <Qt3DRender/qsortpolicy.h>
+#include <Qt3DRender/private/qsortpolicy_p.h>
+
+#include "testpostmanarbiter.h"
+
+// We need to call QNode::clone which is protected
+// So we sublcass QNode instead of QObject
+class tst_QSortPolicy: public Qt3DCore::QNode
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkSaneDefaults()
+ {
+ QScopedPointer<Qt3DRender::QSortPolicy> defaultsortPolicy(new Qt3DRender::QSortPolicy);
+
+ QVERIFY(defaultsortPolicy->sortTypes().isEmpty());
+ }
+
+ void checkCloning_data()
+ {
+ QTest::addColumn<Qt3DRender::QSortPolicy *>("sortPolicy");
+ QTest::addColumn<QVector<Qt3DRender::QSortPolicy::SortType> >("sortTypes");
+
+ Qt3DRender::QSortPolicy *defaultConstructed = new Qt3DRender::QSortPolicy();
+ QTest::newRow("defaultConstructed") << defaultConstructed << QVector<Qt3DRender::QSortPolicy::SortType>();
+
+ Qt3DRender::QSortPolicy *sortPolicyWithSortTypes = new Qt3DRender::QSortPolicy();
+ Qt3DRender::QSortPolicy::SortType sortType1 = Qt3DRender::QSortPolicy::BackToFront;
+ Qt3DRender::QSortPolicy::SortType sortType2 = Qt3DRender::QSortPolicy::Material;
+ QVector<Qt3DRender::QSortPolicy::SortType> sortTypes; sortTypes << sortType1 << sortType2;
+ sortPolicyWithSortTypes->addSortType(sortType1);
+ sortPolicyWithSortTypes->addSortType(sortType2);
+ QTest::newRow("sortPolicyWithSortTypes") << sortPolicyWithSortTypes << sortTypes ;
+ }
+
+ void checkCloning()
+ {
+ // GIVEN
+ QFETCH(Qt3DRender::QSortPolicy*, sortPolicy);
+ QFETCH(QVector<Qt3DRender::QSortPolicy::SortType>, sortTypes);
+
+ // THEN
+ QCOMPARE(sortPolicy->sortTypes(), sortTypes);
+
+ // WHEN
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(sortPolicy);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QSortPolicyData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QSortPolicyData>>(creationChanges.first());
+ const Qt3DRender::QSortPolicyData &cloneData = creationChangeData->data;
+
+ QCOMPARE(sortPolicy->id(), creationChangeData->subjectId());
+ QCOMPARE(sortPolicy->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(sortPolicy->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(sortPolicy->sortTypes().count(), cloneData.sortTypes.count());
+ QCOMPARE(sortPolicy->sortTypes(), cloneData.sortTypes);
+
+ delete sortPolicy;
+ }
+
+ void checkPropertyUpdates()
+ {
+ // GIVEN
+ QScopedPointer<Qt3DRender::QSortPolicy> sortPolicy(new Qt3DRender::QSortPolicy());
+ TestArbiter arbiter(sortPolicy.data());
+
+ // WHEN
+ Qt3DRender::QSortPolicy::SortType sortType1 = Qt3DRender::QSortPolicy::BackToFront;
+ sortPolicy->addSortType(sortType1);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyValueAddedChangePtr addChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyValueAddedChange>();
+ QCOMPARE(addChange->propertyName(), "sortType");
+ QCOMPARE(addChange->subjectId(),sortPolicy->id());
+ QCOMPARE(addChange->addedValue().value<Qt3DRender::QSortPolicy::SortType>(), sortType1);
+ QCOMPARE(addChange->type(), Qt3DCore::PropertyValueAdded);
+
+ arbiter.events.clear();
+
+ // WHEN
+ sortPolicy->addSortType(sortType1);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 0);
+
+ // WHEN
+ sortPolicy->removeSortType(sortType1);
+ QCoreApplication::processEvents();
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ Qt3DCore::QPropertyValueRemovedChangePtr removeChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyValueRemovedChange>();
+ QCOMPARE(removeChange->propertyName(), "sortType");
+ QCOMPARE(removeChange->subjectId(), sortPolicy->id());
+ QCOMPARE(removeChange->removedValue().value<Qt3DRender::QSortPolicy::SortType>(), sortType1);
+ QCOMPARE(removeChange->type(), Qt3DCore::PropertyValueRemoved);
+
+ arbiter.events.clear();
+ }
+};
+
+QTEST_MAIN(tst_QSortPolicy)
+
+#include "tst_qsortpolicy.moc"
diff --git a/tests/auto/render/qstateset/qstateset.pro b/tests/auto/render/qstateset/qstateset.pro
deleted file mode 100644
index ab96eb8f7..000000000
--- a/tests/auto/render/qstateset/qstateset.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = app
-
-TARGET = tst_qstateset
-QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
-
-CONFIG += testcase
-
-SOURCES += tst_qstateset.cpp
-
-include(../commons/commons.pri)
diff --git a/tests/auto/render/qstateset/tst_qstateset.cpp b/tests/auto/render/qstateset/tst_qstateset.cpp
deleted file mode 100644
index f28b772d0..000000000
--- a/tests/auto/render/qstateset/tst_qstateset.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QTest>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-#include <Qt3DCore/qentity.h>
-
-#include <Qt3DRender/qstateset.h>
-#include <Qt3DRender/private/qrenderstate_p.h>
-#include <Qt3DRender/qrenderstate.h>
-
-#include "testpostmanarbiter.h"
-
-class MyStateSet;
-class MyStateSetPrivate : public Qt3DRender::QRenderStatePrivate
-{
-public :
- MyStateSetPrivate()
- : QRenderStatePrivate(Qt3DRender::QRenderState::DepthTest)
- {}
-};
-
-
-class MyStateSet : public Qt3DRender::QRenderState
-{
- Q_OBJECT
-public:
- explicit MyStateSet(Qt3DCore::QNode *parent = Q_NULLPTR)
- : Qt3DRender::QRenderState(*new MyStateSetPrivate(), parent)
- {}
-
- ~MyStateSet()
- {
- QNode::cleanup();
- }
-
-private:
- QT3D_CLONEABLE(MyStateSet)
- Q_DECLARE_PRIVATE(MyStateSet)
-};
-
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QStateSet: public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- ~tst_QStateSet()
- {
- QNode::cleanup();
- }
-
-private Q_SLOTS:
-
- void checkSaneDefaults()
- {
- QScopedPointer<Qt3DRender::QStateSet> defaultstateSet(new Qt3DRender::QStateSet);
-
- QVERIFY(defaultstateSet->renderStates().isEmpty());
- }
-
- void checkCloning_data()
- {
- QTest::addColumn<Qt3DRender::QStateSet *>("stateSet");
- QTest::addColumn<QList<Qt3DRender::QRenderState *> >("states");
-
- Qt3DRender::QStateSet *defaultConstructed = new Qt3DRender::QStateSet();
- QTest::newRow("defaultConstructed") << defaultConstructed << QList<Qt3DRender::QRenderState *>();
-
- Qt3DRender::QStateSet *stateSetWithStates = new Qt3DRender::QStateSet();
- Qt3DRender::QRenderState *state1 = new MyStateSet();
- Qt3DRender::QRenderState *state2 = new MyStateSet();
- QList<Qt3DRender::QRenderState *> states = QList<Qt3DRender::QRenderState *>() << state1 << state2;
- stateSetWithStates->addRenderState(state1);
- stateSetWithStates->addRenderState(state2);
- QTest::newRow("stateSetWithStates") << stateSetWithStates << states;
- }
-
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QStateSet*, stateSet);
- QFETCH(QList<Qt3DRender::QRenderState *>, states);
-
- // THEN
- QCOMPARE(stateSet->renderStates(), states);
-
- // WHEN
- Qt3DRender::QStateSet *clone = static_cast<Qt3DRender::QStateSet *>(QNode::clone(stateSet));
-
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(stateSet->id(), clone->id());
-
- QCOMPARE(stateSet->renderStates().count(), clone->renderStates().count());
-
- for (int i = 0, m = states.count(); i < m; ++i) {
- Qt3DRender::QRenderState *sClone = clone->renderStates().at(i);
- Qt3DRender::QRenderState *sOrig = states.at(i);
- QCOMPARE(sOrig->id(),sClone->id());
- QVERIFY(sClone->parent() == clone);
- QVERIFY(sOrig->parent() == stateSet);
- }
-
- delete stateSet;
- delete clone;
- }
-
- void checkPropertyUpdates()
- {
- // GIVEN
- QScopedPointer<Qt3DRender::QStateSet> stateSet(new Qt3DRender::QStateSet());
- TestArbiter arbiter(stateSet.data());
-
- // WHEN
- Qt3DRender::QRenderState *state1 = new MyStateSet();
- stateSet->addRenderState(state1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "renderState");
- QCOMPARE(change->subjectId(), stateSet->id());
- Qt3DCore::QNodePtr clonedState = change->value().value<Qt3DCore::QNodePtr>();
- QVERIFY(!clonedState.isNull());
- QCOMPARE(clonedState->id(), state1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
-
- arbiter.events.clear();
-
- // WHEN
- stateSet->addRenderState(state1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 0);
-
- // WHEN
- stateSet->removeRenderState(state1);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "renderState");
- QCOMPARE(change->subjectId(), stateSet->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), state1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
-
- arbiter.events.clear();
- }
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
-};
-
-QTEST_MAIN(tst_QStateSet)
-
-#include "tst_qstateset.moc"
diff --git a/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp b/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp
index dfe101009..8438cf033 100644
--- a/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp
+++ b/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,23 +30,22 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qtechniquefilter.h>
+#include <Qt3DRender/private/qtechniquefilter_p.h>
#include <Qt3DRender/qparameter.h>
-#include <Qt3DRender/qannotation.h>
+#include <Qt3DRender/qfilterkey.h>
+
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QTechniqueFilter: public Qt3DCore::QNode
+class tst_QTechniqueFilter: public QObject
{
Q_OBJECT
-public:
- ~tst_QTechniqueFilter()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
@@ -62,100 +53,97 @@ private Q_SLOTS:
{
QScopedPointer<Qt3DRender::QTechniqueFilter> defaulttechniqueFilter(new Qt3DRender::QTechniqueFilter);
- QCOMPARE(defaulttechniqueFilter->criteria().count(), 0);
+ QCOMPARE(defaulttechniqueFilter->matchAll().count(), 0);
QCOMPARE(defaulttechniqueFilter->parameters().count(), 0);
}
void checkCloning_data()
{
QTest::addColumn<Qt3DRender::QTechniqueFilter *>("techniqueFilter");
- QTest::addColumn<QList<Qt3DRender::QParameter *> >("parameters");
- QTest::addColumn<QList<Qt3DRender::QAnnotation *> >("annotations");
+ QTest::addColumn<QVector<Qt3DRender::QParameter *> >("parameters");
+ QTest::addColumn<QVector<Qt3DRender::QFilterKey *> >("filterKeys");
Qt3DRender::QTechniqueFilter *defaultConstructed = new Qt3DRender::QTechniqueFilter();
- QTest::newRow("defaultConstructed") << defaultConstructed << QList<Qt3DRender::QParameter *>() << QList<Qt3DRender::QAnnotation *>();
+ QTest::newRow("defaultConstructed") << defaultConstructed << QVector<Qt3DRender::QParameter *>() << QVector<Qt3DRender::QFilterKey *>();
Qt3DRender::QTechniqueFilter *techniqueFilterWithParams = new Qt3DRender::QTechniqueFilter();
Qt3DRender::QParameter *parameter1 = new Qt3DRender::QParameter(QStringLiteral("displacement"), 454.0f);
Qt3DRender::QParameter *parameter2 = new Qt3DRender::QParameter(QStringLiteral("torque"), 650);
- QList<Qt3DRender::QParameter *> params1 = QList<Qt3DRender::QParameter *>() << parameter1 << parameter2;
+ QVector<Qt3DRender::QParameter *> params1 = QVector<Qt3DRender::QParameter *>() << parameter1 << parameter2;
techniqueFilterWithParams->addParameter(parameter1);
techniqueFilterWithParams->addParameter(parameter2);
- QTest::newRow("techniqueFilterWithParams") << techniqueFilterWithParams << params1 << QList<Qt3DRender::QAnnotation *>();
+ QTest::newRow("techniqueFilterWithParams") << techniqueFilterWithParams << params1 << QVector<Qt3DRender::QFilterKey *>();
Qt3DRender::QTechniqueFilter *techniqueFilterWithAnnotations = new Qt3DRender::QTechniqueFilter();
- Qt3DRender::QAnnotation *annotation1 = new Qt3DRender::QAnnotation();
- Qt3DRender::QAnnotation *annotation2 = new Qt3DRender::QAnnotation();
- annotation1->setName(QStringLiteral("hasSuperCharger"));
- annotation1->setValue(true);
- annotation1->setName(QStringLiteral("hasNitroKit"));
- annotation1->setValue(false);
- QList<Qt3DRender::QAnnotation *> annotations1 = QList<Qt3DRender::QAnnotation *>() << annotation1 << annotation2;
- techniqueFilterWithAnnotations->addRequirement(annotation1);
- techniqueFilterWithAnnotations->addRequirement(annotation2);
- QTest::newRow("techniqueFilterWithAnnotations") << techniqueFilterWithAnnotations << QList<Qt3DRender::QParameter *>() << annotations1;
+ Qt3DRender::QFilterKey *filterKey1 = new Qt3DRender::QFilterKey();
+ Qt3DRender::QFilterKey *filterKey2 = new Qt3DRender::QFilterKey();
+ filterKey1->setName(QStringLiteral("hasSuperCharger"));
+ filterKey1->setValue(true);
+ filterKey1->setName(QStringLiteral("hasNitroKit"));
+ filterKey1->setValue(false);
+ QVector<Qt3DRender::QFilterKey *> filterKeys1 = QVector<Qt3DRender::QFilterKey *>() << filterKey1 << filterKey2;
+ techniqueFilterWithAnnotations->addMatch(filterKey1);
+ techniqueFilterWithAnnotations->addMatch(filterKey2);
+ QTest::newRow("techniqueFilterWithAnnotations") << techniqueFilterWithAnnotations << QVector<Qt3DRender::QParameter *>() << filterKeys1;
Qt3DRender::QTechniqueFilter *techniqueFilterWithParamsAndAnnotations = new Qt3DRender::QTechniqueFilter();
Qt3DRender::QParameter *parameter3 = new Qt3DRender::QParameter(QStringLiteral("displacement"), 383.0f);
Qt3DRender::QParameter *parameter4 = new Qt3DRender::QParameter(QStringLiteral("torque"), 555);
- Qt3DRender::QAnnotation *annotation3 = new Qt3DRender::QAnnotation();
- Qt3DRender::QAnnotation *annotation4 = new Qt3DRender::QAnnotation();
- annotation3->setName(QStringLiteral("hasSuperCharger"));
- annotation3->setValue(false);
- annotation4->setName(QStringLiteral("hasNitroKit"));
- annotation4->setValue(true);
- QList<Qt3DRender::QParameter *> params2 = QList<Qt3DRender::QParameter *>() << parameter3 << parameter4;
- QList<Qt3DRender::QAnnotation *> annotations2 = QList<Qt3DRender::QAnnotation *>() << annotation3 << annotation4;
+ Qt3DRender::QFilterKey *filterKey3 = new Qt3DRender::QFilterKey();
+ Qt3DRender::QFilterKey *filterKey4 = new Qt3DRender::QFilterKey();
+ filterKey3->setName(QStringLiteral("hasSuperCharger"));
+ filterKey3->setValue(false);
+ filterKey4->setName(QStringLiteral("hasNitroKit"));
+ filterKey4->setValue(true);
+ QVector<Qt3DRender::QParameter *> params2 = QVector<Qt3DRender::QParameter *>() << parameter3 << parameter4;
+ QVector<Qt3DRender::QFilterKey *> filterKeys2 = QVector<Qt3DRender::QFilterKey *>() << filterKey3 << filterKey4;
techniqueFilterWithParamsAndAnnotations->addParameter(parameter3);
techniqueFilterWithParamsAndAnnotations->addParameter(parameter4);
- techniqueFilterWithParamsAndAnnotations->addRequirement(annotation3);
- techniqueFilterWithParamsAndAnnotations->addRequirement(annotation4);
- QTest::newRow("techniqueFilterWithParamsAndAnnotations") << techniqueFilterWithParamsAndAnnotations << params2 << annotations2;
+ techniqueFilterWithParamsAndAnnotations->addMatch(filterKey3);
+ techniqueFilterWithParamsAndAnnotations->addMatch(filterKey4);
+ QTest::newRow("techniqueFilterWithParamsAndAnnotations") << techniqueFilterWithParamsAndAnnotations << params2 << filterKeys2;
}
void checkCloning()
{
// GIVEN
QFETCH(Qt3DRender::QTechniqueFilter*, techniqueFilter);
- QFETCH(QList<Qt3DRender::QParameter *>, parameters);
- QFETCH(QList<Qt3DRender::QAnnotation *>, annotations);
+ QFETCH(QVector<Qt3DRender::QParameter *>, parameters);
+ QFETCH(QVector<Qt3DRender::QFilterKey *>, filterKeys);
// THEN
QCOMPARE(techniqueFilter->parameters(), parameters);
- QCOMPARE(techniqueFilter->criteria(), annotations);
+ QCOMPARE(techniqueFilter->matchAll(), filterKeys);
// WHEN
- Qt3DRender::QTechniqueFilter *clone = static_cast<Qt3DRender::QTechniqueFilter *>(QNode::clone(techniqueFilter));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(techniqueFilter);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(techniqueFilter->id(), clone->id());
+ QCOMPARE(creationChanges.size(), 1 + parameters.size() + filterKeys.size());
- QCOMPARE(techniqueFilter->criteria().count(), clone->criteria().count());
- QCOMPARE(techniqueFilter->parameters().count(), clone->parameters().count());
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QTechniqueFilterData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QTechniqueFilterData>>(creationChanges.first());
+ const Qt3DRender::QTechniqueFilterData &cloneData = creationChangeData->data;
+
+ QCOMPARE(techniqueFilter->id(), creationChangeData->subjectId());
+ QCOMPARE(techniqueFilter->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(techniqueFilter->metaObject(), creationChangeData->metaObject());
+
+ QCOMPARE(techniqueFilter->matchAll().count(), cloneData.matchIds.count());
+ QCOMPARE(techniqueFilter->parameters().count(), cloneData.parameterIds.count());
for (int i = 0, m = parameters.count(); i < m; ++i) {
- Qt3DRender::QParameter *pClone = clone->parameters().at(i);
Qt3DRender::QParameter *pOrig = parameters.at(i);
- QCOMPARE(pOrig->id(),pClone->id());
- QCOMPARE(pOrig->name(), pClone->name());
- QCOMPARE(pOrig->value(), pClone->value());
- QVERIFY(pClone->parent() == clone);
- QVERIFY(pOrig->parent() == techniqueFilter);
+ QCOMPARE(pOrig->id(), cloneData.parameterIds.at(i));
}
- for (int i = 0, m = annotations.count(); i < m; ++i) {
- Qt3DRender::QAnnotation *aClone = clone->criteria().at(i);
- Qt3DRender::QAnnotation *aOrig = annotations.at(i);
- QCOMPARE(aOrig->id(),aClone->id());
- QCOMPARE(aOrig->name(), aClone->name());
- QCOMPARE(aOrig->value(), aClone->value());
- QVERIFY(aClone->parent() == clone);
- QVERIFY(aOrig->parent() == techniqueFilter);
+ for (int i = 0, m = filterKeys.count(); i < m; ++i) {
+ Qt3DRender::QFilterKey *aOrig = filterKeys.at(i);
+ QCOMPARE(aOrig->id(), cloneData.matchIds.at(i));
}
delete techniqueFilter;
- delete clone;
}
void checkPropertyUpdates()
@@ -171,11 +159,11 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "parameter");
- QCOMPARE(change->subjectId(),techniqueFilter->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), param1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ Qt3DCore::QPropertyNodeAddedChangePtr nodeAddedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(nodeAddedChange->propertyName(), "parameter");
+ QCOMPARE(nodeAddedChange->subjectId(),techniqueFilter->id());
+ QCOMPARE(nodeAddedChange->addedNodeId(), param1->id());
+ QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
@@ -192,57 +180,50 @@ private Q_SLOTS:
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "parameter");
- QCOMPARE(change->subjectId(), techniqueFilter->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), param1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "parameter");
+ QCOMPARE(nodeRemovedChange->subjectId(), techniqueFilter->id());
+ QCOMPARE(nodeRemovedChange->removedNodeId(), param1->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
// WHEN
- Qt3DRender::QAnnotation *annotation1 = new Qt3DRender::QAnnotation();
- techniqueFilter->addRequirement(annotation1);
+ Qt3DRender::QFilterKey *filterKey1 = new Qt3DRender::QFilterKey();
+ techniqueFilter->addMatch(filterKey1);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "require");
- QCOMPARE(change->subjectId(),techniqueFilter->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), annotation1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeAdded);
+ nodeAddedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
+ QCOMPARE(nodeAddedChange->propertyName(), "matchAll");
+ QCOMPARE(nodeAddedChange->subjectId(),techniqueFilter->id());
+ QCOMPARE(nodeAddedChange->addedNodeId(), filterKey1->id());
+ QCOMPARE(nodeAddedChange->type(), Qt3DCore::PropertyValueAdded);
arbiter.events.clear();
// WHEN
- techniqueFilter->addRequirement(annotation1);
+ techniqueFilter->addMatch(filterKey1);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 0);
// WHEN
- techniqueFilter->removeRequirement(annotation1);
+ techniqueFilter->removeMatch(filterKey1);
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "require");
- QCOMPARE(change->subjectId(), techniqueFilter->id());
- QCOMPARE(change->value().value<Qt3DCore::QNodeId>(), annotation1->id());
- QCOMPARE(change->type(), Qt3DCore::NodeRemoved);
+ nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
+ QCOMPARE(nodeRemovedChange->propertyName(), "matchAll");
+ QCOMPARE(nodeRemovedChange->subjectId(), techniqueFilter->id());
+ QCOMPARE(nodeRemovedChange->removedNodeId(), filterKey1->id());
+ QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QTechniqueFilter)
diff --git a/tests/auto/render/qtextureimagedata/qtextureimagedata.pro b/tests/auto/render/qtextureimagedata/qtextureimagedata.pro
new file mode 100644
index 000000000..cfa1bdb51
--- /dev/null
+++ b/tests/auto/render/qtextureimagedata/qtextureimagedata.pro
@@ -0,0 +1,10 @@
+TEMPLATE = app
+
+TARGET = tst_qtextureimagedata
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qtextureimagedata.cpp
+
+include(../commons/commons.pri)
diff --git a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
new file mode 100644
index 000000000..dd931dabf
--- /dev/null
+++ b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+
+#include <Qt3DRender/private/qtextureimagedata_p.h>
+#include <Qt3DRender/qtextureimagedata.h>
+
+#include "testpostmanarbiter.h"
+
+// We need to call QNode::clone which is protected
+// So we sublcass QNode instead of QObject
+class tst_QTextureImageData : public QObject
+{
+ Q_OBJECT
+public:
+ ~tst_QTextureImageData()
+ {
+ }
+
+private Q_SLOTS:
+
+ void checkSaneDefaults()
+ {
+ Qt3DRender::QTextureImageData *tid = new Qt3DRender::QTextureImageData();
+
+ QCOMPARE(tid->width(), -1);
+ QCOMPARE(tid->height(), -1);
+ QCOMPARE(tid->depth(), -1);
+ QCOMPARE(tid->layers(), -1);
+ QCOMPARE(tid->mipLevels(), -1);
+ QCOMPARE(tid->target(), QOpenGLTexture::Target2D);
+ QCOMPARE(tid->format(), QOpenGLTexture::RGBA8_UNorm);
+ QCOMPARE(tid->pixelFormat(), QOpenGLTexture::RGBA);
+ QCOMPARE(tid->pixelType(), QOpenGLTexture::UInt8);
+ QCOMPARE(tid->isCompressed(), false);
+ }
+
+ void checkCloning_data()
+ {
+
+ }
+
+ void checkCloning()
+ {
+ }
+
+ void checkPropertyUpdates()
+ {
+ }
+/*
+protected:
+
+ Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
+ {
+ return Q_NULLPTR;
+ }
+ */
+
+};
+
+QTEST_MAIN(tst_QTextureImageData)
+
+#include "tst_qtextureimagedata.moc"
diff --git a/tests/auto/render/qviewport/tst_qviewport.cpp b/tests/auto/render/qviewport/tst_qviewport.cpp
index 019e43a9b..9ea758fcf 100644
--- a/tests/auto/render/qviewport/tst_qviewport.cpp
+++ b/tests/auto/render/qviewport/tst_qviewport.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,37 +29,30 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qviewport.h>
+#include <Qt3DRender/private/qviewport_p.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QViewport: public Qt3DCore::QNode
+class tst_QViewport: public QObject
{
Q_OBJECT
-public:
- ~tst_QViewport()
- {
- QNode::cleanup();
- }
private Q_SLOTS:
void checkCloning_data()
{
QTest::addColumn<Qt3DRender::QViewport *>("viewport");
- QTest::addColumn<QRectF>("rect");
- QTest::addColumn<QColor>("color");
+ QTest::addColumn<QRectF>("normalizedRect");
Qt3DRender::QViewport *defaultConstructed = new Qt3DRender::QViewport();
- QTest::newRow("defaultConstructed") << defaultConstructed << QRectF(0.0f, 0.0f, 1.0f, 1.0f) << QColor();
+ QTest::newRow("defaultConstructed") << defaultConstructed << QRectF(0.0f, 0.0f, 1.0f, 1.0f);
Qt3DRender::QViewport *smallGreenViewport = new Qt3DRender::QViewport();
- smallGreenViewport->setRect(QRectF(0.2f, 0.2f, 0.6f, 0.6f));
- smallGreenViewport->setClearColor(QColor(Qt::green));
- QTest::newRow("smallGreenViewport") << smallGreenViewport << QRectF(0.2f, 0.2f, 0.6f, 0.6f) << QColor(Qt::green);
+ smallGreenViewport->setNormalizedRect(QRectF(0.2f, 0.2f, 0.6f, 0.6f));
+ QTest::newRow("smallGreenViewport") << smallGreenViewport << QRectF(0.2f, 0.2f, 0.6f, 0.6f);
}
@@ -75,24 +60,28 @@ private Q_SLOTS:
{
// GIVEN
QFETCH(Qt3DRender::QViewport *, viewport);
- QFETCH(QRectF, rect);
- QFETCH(QColor, color);
+ QFETCH(QRectF, normalizedRect);
// THEN
- QCOMPARE(viewport->rect(), rect);
- QCOMPARE(viewport->clearColor(), color);
+ QCOMPARE(viewport->normalizedRect(), normalizedRect);
// WHEN
- Qt3DRender::QViewport *clone = static_cast<Qt3DRender::QViewport *>(QNode::clone(viewport));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(viewport);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(viewport->id(), clone->id());
- QCOMPARE(viewport->rect(), clone->rect());
- QCOMPARE(viewport->clearColor(), clone->clearColor());
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QViewportData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QViewportData>>(creationChanges.first());
+ const Qt3DRender::QViewportData &cloneData = creationChangeData->data;
+
+ QCOMPARE(viewport->id(), creationChangeData->subjectId());
+ QCOMPARE(viewport->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(viewport->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(viewport->normalizedRect(), cloneData.normalizedRect);
delete viewport;
- delete clone;
}
void checkPropertyUpdates()
@@ -102,81 +91,39 @@ private Q_SLOTS:
TestArbiter arbiter(viewport.data());
// WHEN
- viewport->setClearColor(Qt::red);
+ viewport->setNormalizedRect(QRectF(0.5f, 0.5f, 1.0f, 1.0f));
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QScenePropertyChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "clearColor");
- QCOMPARE(change->subjectId(), viewport->id());
- QCOMPARE(change->value().value<QColor>(), QColor(Qt::red));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- viewport->setClearColor(Qt::red);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 0);
-
- // WHEN
- viewport->setClearColor(Qt::blue);
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "clearColor");
- QCOMPARE(change->subjectId(), viewport->id());
- QCOMPARE(change->value().value<QColor>(), QColor(Qt::blue));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
-
- arbiter.events.clear();
-
- // WHEN
- viewport->setRect(QRectF(0.5f, 0.5f, 1.0f, 1.0f));
- QCoreApplication::processEvents();
-
- // THEN
- QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "rect");
+ Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "normalizedRect");
QCOMPARE(change->subjectId(), viewport->id());
QCOMPARE(change->value().value<QRectF>(), QRectF(0.5f, 0.5f, 1.0f, 1.0f));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
arbiter.events.clear();
// WHEN
- viewport->setRect(QRectF(0.5f, 0.5f, 1.0f, 1.0f));
+ viewport->setNormalizedRect(QRectF(0.5f, 0.5f, 1.0f, 1.0f));
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 0);
// WHEN
- viewport->setRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f));
+ viewport->setNormalizedRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f));
QCoreApplication::processEvents();
// THEN
QCOMPARE(arbiter.events.size(), 1);
- change = arbiter.events.first().staticCast<Qt3DCore::QScenePropertyChange>();
- QCOMPARE(change->propertyName(), "rect");
+ change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
+ QCOMPARE(change->propertyName(), "normalizedRect");
QCOMPARE(change->subjectId(), viewport->id());
QCOMPARE(change->value().value<QRectF>(), QRectF(0.0f, 0.0f, 1.0f, 1.0f));
- QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QViewport)
diff --git a/tests/auto/render/raycasting/tst_raycasting.cpp b/tests/auto/render/raycasting/tst_raycasting.cpp
index ad26d8011..04274f67a 100644
--- a/tests/auto/render/raycasting/tst_raycasting.cpp
+++ b/tests/auto/render/raycasting/tst_raycasting.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -41,8 +33,8 @@
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/pickboundingvolumejob_p.h>
#include <Qt3DRender/private/qboundingvolumeprovider_p.h>
-#include <Qt3DCore/qray3d.h>
-#include <Qt3DCore/qcamera.h>
+#include <Qt3DRender/private/qray3d_p.h>
+#include <Qt3DRender/qcamera.h>
using namespace Qt3DCore;
using namespace Qt3DRender;
@@ -318,7 +310,7 @@ Sphere *tst_RayCasting::volumeAt(int index)
void tst_RayCasting::mousePicking()
{
// GIVEN
- Qt3DCore::QCamera camera;
+ Qt3DRender::QCamera camera;
camera.setProjectionType(QCameraLens::PerspectiveProjection);
camera.setFieldOfView(45.0f);
camera.setAspectRatio(800.0/600.0f);
@@ -331,14 +323,14 @@ void tst_RayCasting::mousePicking()
const QRectF viewport(0.0f, 0.0f, 800.0f, 600.0f);
// Window center on near plane
- Qt3DCore::QRay3D ray = Qt3DRender::Render::PickBoundingVolumeJob::intersectionRay(viewport.center().toPoint(),
- camera.viewMatrix(),
- camera.projectionMatrix(),
- viewport.toRect());
+ QRay3D ray = Qt3DRender::Render::PickBoundingVolumeJob::intersectionRay(viewport.center().toPoint(),
+ camera.viewMatrix(),
+ camera.projectionMatrix(),
+ viewport.toRect());
Qt3DRender::Render::Sphere s(QVector3D(0.0f, 0.5f, 0.0f), 1.0f);
// WHEN
- bool intersects = s.intersects(ray, Q_NULLPTR);
+ bool intersects = s.intersects(ray, nullptr);
// THEN
QVERIFY(intersects);
@@ -348,7 +340,7 @@ void tst_RayCasting::mousePicking()
camera.viewMatrix(),
camera.projectionMatrix(),
viewport.toRect());
- intersects = s.intersects(ray, Q_NULLPTR);
+ intersects = s.intersects(ray, nullptr);
// THEN
QVERIFY(!intersects);
@@ -358,7 +350,7 @@ void tst_RayCasting::mousePicking()
camera.viewMatrix(),
camera.projectionMatrix(),
viewport.toRect());
- intersects = s.intersects(ray, Q_NULLPTR);
+ intersects = s.intersects(ray, nullptr);
// THEN
QVERIFY(!intersects);
@@ -368,7 +360,7 @@ void tst_RayCasting::mousePicking()
camera.viewMatrix(),
camera.projectionMatrix(),
viewport.toRect());
- intersects = s.intersects(ray, Q_NULLPTR);
+ intersects = s.intersects(ray, nullptr);
// THEN
QVERIFY(!intersects);
@@ -378,7 +370,7 @@ void tst_RayCasting::mousePicking()
camera.viewMatrix(),
camera.projectionMatrix(),
viewport.toRect());
- intersects = s.intersects(ray, Q_NULLPTR);
+ intersects = s.intersects(ray, nullptr);
// THEN
QVERIFY(!intersects);
diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro
index 4b43a291d..8eca6452e 100644
--- a/tests/auto/render/render.pro
+++ b/tests/auto/render/render.pro
@@ -23,25 +23,26 @@ contains(QT_CONFIG, private_tests) {
geometryrenderer \
raycasting \
qcameraselector \
- qclearbuffer \
+ qclearbuffers \
qframegraphnode \
- qframegraph \
qlayerfilter \
- qlight \
+ qabstractlight \
+ qray3d \
qrenderpassfilter \
qrendertargetselector \
- qsortcriterion \
- qsortmethod \
- qstateset \
+ qsortpolicy \
+ qrenderstateset \
qtechniquefilter \
+ qtextureimagedata \
qviewport \
framegraphnode \
qobjectpicker \
objectpicker \
picking \
- qboundingvolumedebug \
- boundingvolumedebug \
+# qboundingvolumedebug \
+# boundingvolumedebug \
qdefaultmeshes \
trianglesextractor \
- triangleboundingvolume
+ triangleboundingvolume \
+ ddstextures
}
diff --git a/tests/auto/render/renderpass/renderpass.pro b/tests/auto/render/renderpass/renderpass.pro
index 2b7806af1..00d9b6bd5 100644
--- a/tests/auto/render/renderpass/renderpass.pro
+++ b/tests/auto/render/renderpass/renderpass.pro
@@ -7,3 +7,6 @@ QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
CONFIG += testcase
SOURCES += tst_renderpass.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/renderpass/tst_renderpass.cpp b/tests/auto/render/renderpass/tst_renderpass.cpp
index 56123ad25..42233f574 100644
--- a/tests/auto/render/renderpass/tst_renderpass.cpp
+++ b/tests/auto/render/renderpass/tst_renderpass.cpp
@@ -1,46 +1,40 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QtTest>
+#include <qbackendnodetester.h>
#include <Qt3DRender/private/renderpass_p.h>
-#include <Qt3DCore/QScenePropertyChange>
+#include <Qt3DCore/QPropertyUpdatedChange>
+#include <Qt3DCore/QPropertyNodeAddedChange>
+#include <Qt3DCore/QPropertyNodeRemovedChange>
-#include <Qt3DRender/QAnnotation>
-#include <Qt3DRender/QParameterMapping>
+#include <Qt3DRender/QFilterKey>
#include <Qt3DRender/QRenderPass>
#include <Qt3DRender/QShaderProgram>
#include <Qt3DRender/QParameter>
@@ -48,35 +42,40 @@
#include <Qt3DRender/QAlphaCoverage>
#include <Qt3DRender/QAlphaTest>
#include <Qt3DRender/QBlendEquation>
-#include <Qt3DRender/QBlendState>
+#include <Qt3DRender/QBlendEquationArguments>
#include <Qt3DRender/QColorMask>
#include <Qt3DRender/QCullFace>
-#include <Qt3DRender/QDepthMask>
+#include <Qt3DRender/QNoDepthMask>
#include <Qt3DRender/QDepthTest>
#include <Qt3DRender/QDithering>
#include <Qt3DRender/QFrontFace>
#include <Qt3DRender/QPolygonOffset>
#include <Qt3DRender/QScissorTest>
#include <Qt3DRender/QStencilTest>
-#include <Qt3DRender/QStencilTestSeparate>
+#include <Qt3DRender/QStencilTestArguments>
#include <Qt3DRender/QStencilMask>
-#include <Qt3DRender/QStencilOp>
-#include <Qt3DRender/QStencilOpSeparate>
+#include <Qt3DRender/QStencilOperation>
+#include <Qt3DRender/QStencilOperationArguments>
#include <Qt3DRender/QClipPlane>
#include <Qt3DRender/private/renderstates_p.h>
+#include <Qt3DRender/private/managers_p.h>
+
+#include "testrenderer.h"
using namespace Qt3DCore;
using namespace Qt3DRender;
using namespace Qt3DRender::Render;
-Q_DECLARE_METATYPE(RenderState*)
-
-class tst_RenderRenderPass : public QObject
+class tst_RenderRenderPass : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
public:
- tst_RenderRenderPass() {}
+ tst_RenderRenderPass()
+ : m_renderStateManager(new RenderStateManager())
+ {
+ qRegisterMetaType<Qt3DCore::QNode *>();
+ }
~tst_RenderRenderPass() {}
private slots:
@@ -87,158 +86,44 @@ private slots:
// THEN
QVERIFY(backend.shaderProgram().isNull());
- QVERIFY(backend.annotations().isEmpty());
- QVERIFY(backend.bindings().isEmpty());
- QVERIFY(backend.renderStates().isEmpty());
+ QVERIFY(backend.filterKeys().isEmpty());
+ QVERIFY(backend.renderStates(m_renderStateManager).isEmpty());
QVERIFY(backend.parameters().isEmpty());
}
- void shouldHavePropertiesMirroringItsPeer_data()
- {
- QTest::addColumn<QRenderState*>("frontendState");
- QTest::addColumn<RenderState*>("backendState");
-
- QRenderState *frontendState = Q_NULLPTR;
- RenderState *backendState = Q_NULLPTR;
-
- QAlphaCoverage *alphaCoverage = new QAlphaCoverage;
- frontendState = alphaCoverage;
- backendState = AlphaCoverage::getOrCreate();
- QTest::newRow("alphacoverage") << frontendState << backendState;
-
- QAlphaTest *alphaTest = new QAlphaTest;
- frontendState = alphaTest;
- backendState = AlphaFunc::getOrCreate(alphaTest->func(), alphaTest->clamp());
- QTest::newRow("alphatest") << frontendState << backendState;
-
- QBlendEquation *blendEquation = new QBlendEquation;
- frontendState = blendEquation;
- backendState = BlendEquation::getOrCreate(blendEquation->mode());
- QTest::newRow("blendequation") << frontendState << backendState;
-
- QBlendState *blendState = new QBlendState;
- frontendState = blendState;
- backendState = BlendState::getOrCreate(blendState->srcRGB(), blendState->dstRGB());
- QTest::newRow("blendstate") << frontendState << backendState;
-
- QColorMask *colorMask = new QColorMask;
- frontendState = colorMask;
- backendState = ColorMask::getOrCreate(colorMask->isRed(),
- colorMask->isGreen(),
- colorMask->isBlue(),
- colorMask->isAlpha());
- QTest::newRow("colormask") << frontendState << backendState;
-
- QCullFace *cullFace = new QCullFace;
- frontendState = cullFace;
- backendState = CullFace::getOrCreate(cullFace->mode());
- QTest::newRow("cullface") << frontendState << backendState;
-
- QDepthMask *depthMask = new QDepthMask;
- frontendState = depthMask;
- backendState = DepthMask::getOrCreate(depthMask->mask());
- QTest::newRow("depthmask") << frontendState << backendState;
-
- QDepthTest *depthTest = new QDepthTest;
- frontendState = depthTest;
- backendState = DepthTest::getOrCreate(depthTest->func());
- QTest::newRow("depthtest") << frontendState << backendState;
-
- QDithering *dithering = new QDithering;
- frontendState = dithering;
- backendState = Dithering::getOrCreate();
- QTest::newRow("dithering") << frontendState << backendState;
-
- QFrontFace *frontFace = new QFrontFace;
- frontendState = frontFace;
- backendState = FrontFace::getOrCreate(frontFace->direction());
- QTest::newRow("frontface") << frontendState << backendState;
-
- QPolygonOffset *polygonOffset = new QPolygonOffset;
- frontendState = polygonOffset;
- backendState = PolygonOffset::getOrCreate(polygonOffset->factor(),
- polygonOffset->units());
- QTest::newRow("polygonoffset") << frontendState << backendState;
-
- QScissorTest *scissorTest = new QScissorTest;
- frontendState = scissorTest;
- backendState = ScissorTest::getOrCreate(scissorTest->left(),
- scissorTest->bottom(),
- scissorTest->width(),
- scissorTest->height());
- QTest::newRow("scissortest") << frontendState << backendState;
-
- QStencilTest *stencilTest = new QStencilTest;
- frontendState = stencilTest;
- backendState = StencilTest::getOrCreate(stencilTest->front()->func(),
- stencilTest->front()->ref(),
- stencilTest->front()->mask(),
- stencilTest->back()->func(),
- stencilTest->back()->ref(),
- stencilTest->back()->mask());
- QTest::newRow("stenciltest") << frontendState << backendState;
-
- QStencilMask *stencilMask = new QStencilMask;
- frontendState = stencilMask;
- backendState = StencilMask::getOrCreate(stencilMask->frontMask(), stencilMask->backMask());
-
- QTest::newRow("stencilmask") << frontendState << backendState;
-
- QStencilOp *stencilOp = new QStencilOp;
- frontendState = stencilOp;
- backendState = StencilOp::getOrCreate(stencilOp->front()->stencilFail(),
- stencilOp->front()->depthFail(),
- stencilOp->front()->stencilDepthPass(),
- stencilOp->back()->stencilFail(),
- stencilOp->back()->depthFail(),
- stencilOp->back()->stencilDepthPass());
- QTest::newRow("stencilop") << frontendState << backendState;
-
- QClipPlane *clipPlane = new QClipPlane;
- frontendState = clipPlane;
- backendState = ClipPlane::getOrCreate(clipPlane->plane());
- }
-
void shouldHavePropertiesMirroringItsPeer()
{
// GIVEN
QRenderPass frontend;
frontend.setShaderProgram(new QShaderProgram(&frontend));
- frontend.addAnnotation(new QAnnotation(&frontend));
-
- frontend.addBinding(new QParameterMapping(&frontend));
+ frontend.addFilterKey(new QFilterKey(&frontend));
frontend.addParameter(new QParameter(&frontend));
- QFETCH(QRenderState*, frontendState);
+ QRenderState *frontendState = new QBlendEquationArguments();
frontendState->setParent(&frontend);
frontend.addRenderState(frontendState);
RenderPass backend;
- QFETCH(RenderState*, backendState);
+ RenderStateNode *backendState = m_renderStateManager->getOrCreateResource(frontendState->id());
+ simulateInitialization(frontendState, backendState);
// WHEN
- backend.setPeer(&frontend);
+ simulateInitialization(&frontend, &backend);
// THEN
QCOMPARE(backend.shaderProgram(), frontend.shaderProgram()->id());
- QCOMPARE(backend.annotations().size(), 1);
- QCOMPARE(backend.annotations().first(), frontend.annotations().first()->id());
-
- QCOMPARE(backend.bindings().size(), 1);
- QCOMPARE(backend.bindings().first().id(), frontend.bindings().first()->id());
- QCOMPARE(backend.bindings().first().bindingType(), frontend.bindings().first()->bindingType());
- QCOMPARE(backend.bindings().first().parameterName(), frontend.bindings().first()->parameterName());
- QCOMPARE(backend.bindings().first().shaderVariableName(), frontend.bindings().first()->shaderVariableName());
+ QCOMPARE(backend.filterKeys().size(), 1);
+ QCOMPARE(backend.filterKeys().first(), frontend.filterKeys().first()->id());
QCOMPARE(backend.parameters().size(), 1);
QCOMPARE(backend.parameters().first(), frontend.parameters().first()->id());
- QCOMPARE(backend.renderStates().size(), 1);
- QCOMPARE(backend.renderStates().first(), backendState);
+ QCOMPARE(backend.renderStates(m_renderStateManager).size(), 1);
+ QCOMPARE(backend.renderStates(m_renderStateManager).first(), backendState);
}
void shouldHandleShaderPropertyChangeEvents()
@@ -247,19 +132,20 @@ private slots:
QScopedPointer<QShaderProgram> shader(new QShaderProgram);
RenderPass backend;
+ TestRenderer renderer;
+ backend.setRenderer(&renderer);
// WHEN
- QScenePropertyChangePtr addChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, shader->id()));
- addChange->setValue(QVariant::fromValue(shader->id()));
+ const auto addChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), shader.data());
addChange->setPropertyName("shaderProgram");
backend.sceneChangeEvent(addChange);
// THEN
QCOMPARE(backend.shaderProgram(), shader->id());
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
- QScenePropertyChangePtr removeChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, shader->id()));
- removeChange->setValue(QVariant::fromValue(shader->id()));
+ const auto removeChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), shader.data());
removeChange->setPropertyName("shaderProgram");
backend.sceneChangeEvent(removeChange);
@@ -270,58 +156,29 @@ private slots:
void shouldHandleAnnotationsPropertyChangeEvents()
{
// GIVEN
- QScopedPointer<QAnnotation> annotation(new QAnnotation);
+ QScopedPointer<QFilterKey> annotation(new QFilterKey);
RenderPass backend;
+ TestRenderer renderer;
+ backend.setRenderer(&renderer);
// WHEN
- QScenePropertyChangePtr addChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, annotation->id()));
- addChange->setValue(QVariant::fromValue(annotation->id()));
- addChange->setPropertyName("annotation");
+ const auto addChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), annotation.data());
+ addChange->setPropertyName("filterKeys");
backend.sceneChangeEvent(addChange);
// THEN
- QCOMPARE(backend.annotations().size(), 1);
- QCOMPARE(backend.annotations().first(), annotation->id());
+ QCOMPARE(backend.filterKeys().size(), 1);
+ QCOMPARE(backend.filterKeys().first(), annotation->id());
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
- QScenePropertyChangePtr removeChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, annotation->id()));
- removeChange->setValue(QVariant::fromValue(annotation->id()));
- removeChange->setPropertyName("annotation");
+ const auto removeChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), annotation.data());
+ removeChange->setPropertyName("filterKeys");
backend.sceneChangeEvent(removeChange);
// THEN
- QVERIFY(backend.annotations().isEmpty());
- }
-
- void shouldHandleBindingsPropertyChangeEvents()
- {
- // GIVEN
- QScopedPointer<QParameterMapping> binding(new QParameterMapping);
-
- RenderPass backend;
-
- // WHEN
- QScenePropertyChangePtr addChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, binding->id()));
- addChange->setValue(QVariant::fromValue(binding.data()));
- addChange->setPropertyName("binding");
- backend.sceneChangeEvent(addChange);
-
- // THEN
- QCOMPARE(backend.bindings().size(), 1);
- QCOMPARE(backend.bindings().first().id(), binding->id());
- QCOMPARE(backend.bindings().first().bindingType(), binding->bindingType());
- QCOMPARE(backend.bindings().first().parameterName(), binding->parameterName());
- QCOMPARE(backend.bindings().first().shaderVariableName(), binding->shaderVariableName());
-
- // WHEN
- QScenePropertyChangePtr removeChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, binding->id()));
- removeChange->setValue(QVariant::fromValue(binding->id()));
- removeChange->setPropertyName("binding");
- backend.sceneChangeEvent(removeChange);
-
- // THEN
- QVERIFY(backend.bindings().isEmpty());
+ QVERIFY(backend.filterKeys().isEmpty());
}
void shouldHandleParametersPropertyChangeEvents()
@@ -330,20 +187,21 @@ private slots:
QScopedPointer<QParameter> parameter(new QParameter);
RenderPass backend;
+ TestRenderer renderer;
+ backend.setRenderer(&renderer);
// WHEN
- QScenePropertyChangePtr addChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, parameter->id()));
- addChange->setValue(QVariant::fromValue(parameter->id()));
+ const auto addChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), parameter.data());
addChange->setPropertyName("parameter");
backend.sceneChangeEvent(addChange);
// THEN
QCOMPARE(backend.parameters().size(), 1);
QCOMPARE(backend.parameters().first(), parameter->id());
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
- QScenePropertyChangePtr removeChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, parameter->id()));
- removeChange->setValue(QVariant::fromValue(parameter->id()));
+ const auto removeChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), parameter.data());
removeChange->setPropertyName("parameter");
backend.sceneChangeEvent(removeChange);
@@ -351,40 +209,39 @@ private slots:
QVERIFY(backend.parameters().isEmpty());
}
- void shouldHandlePropertyChangeEvents_data()
- {
- shouldHavePropertiesMirroringItsPeer_data();
- }
-
void shouldHandlePropertyChangeEvents()
{
- // GIVEN
- QFETCH(QRenderState*, frontendState);
+ QRenderState *frontendState = new QBlendEquationArguments();
QNodePtr frontendStatePtr(frontendState);
RenderPass backend;
+ TestRenderer renderer;
+ backend.setRenderer(&renderer);
- QFETCH(RenderState*, backendState);
+ RenderStateNode *backendState = m_renderStateManager->getOrCreateResource(frontendState->id());
+ simulateInitialization(frontendState, backendState);
// WHEN
- QScenePropertyChangePtr addChange(new QScenePropertyChange(NodeAdded, QSceneChange::Node, frontendState->id()));
- addChange->setValue(QVariant::fromValue(frontendStatePtr));
+ const auto addChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), frontendState);
addChange->setPropertyName("renderState");
backend.sceneChangeEvent(addChange);
// THEN
- QCOMPARE(backend.renderStates().size(), 1);
- QCOMPARE(backend.renderStates().first(), backendState);
+ QCOMPARE(backend.renderStates(m_renderStateManager).size(), 1);
+ QCOMPARE(backend.renderStates(m_renderStateManager).first(), backendState);
+ QVERIFY(renderer.dirtyBits() != 0);
// WHEN
- QScenePropertyChangePtr removeChange(new QScenePropertyChange(NodeRemoved, QSceneChange::Node, frontendState->id()));
- removeChange->setValue(QVariant::fromValue(frontendState->id()));
+ const auto removeChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), frontendState);
removeChange->setPropertyName("renderState");
backend.sceneChangeEvent(removeChange);
// THEN
- QVERIFY(backend.renderStates().isEmpty());
+ QVERIFY(backend.renderStates(m_renderStateManager).isEmpty());
}
+
+private:
+ RenderStateManager *m_renderStateManager;
};
QTEST_APPLESS_MAIN(tst_RenderRenderPass)
diff --git a/tests/auto/render/renderqueue/tst_renderqueue.cpp b/tests/auto/render/renderqueue/tst_renderqueue.cpp
index c571de2c0..46df32b5f 100644
--- a/tests/auto/render/renderqueue/tst_renderqueue.cpp
+++ b/tests/auto/render/renderqueue/tst_renderqueue.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -82,6 +74,7 @@ void tst_RenderQueue::circleQueues()
// WHEN
renderQueue.reset();
+ renderQueue.setTargetRenderViewCount(7);
// THEN
QVERIFY(!renderQueue.isFrameQueueComplete());
@@ -214,6 +207,7 @@ void tst_RenderQueue::concurrentQueueAccess()
// reset queue for next frame
renderQueue->reset();
+ renderQueue->setTargetRenderViewCount(7);
jobsThread->m_waitToFillQueue.wakeAll();
}
jobsThread->wait();
diff --git a/tests/auto/render/renderviews/tst_renderviews.cpp b/tests/auto/render/renderviews/tst_renderviews.cpp
index e9c66d8f1..6d8cb413b 100644
--- a/tests/auto/render/renderviews/tst_renderviews.cpp
+++ b/tests/auto/render/renderviews/tst_renderviews.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -46,8 +38,8 @@ private Q_SLOTS:
void checkRenderViewSizeFitsWithAllocator()
{
- QVERIFY(sizeof(Qt3DRender::Render::RenderView) <= 128);
- QVERIFY(sizeof(Qt3DRender::Render::RenderView::InnerData) <= 128);
+ QVERIFY(sizeof(Qt3DRender::Render::RenderView) <= 192);
+ QVERIFY(sizeof(Qt3DRender::Render::RenderView::InnerData) <= 192);
}
void testSort()
@@ -58,7 +50,7 @@ private Q_SLOTS:
void checkRenderViewDoesNotLeak()
{
// GIVEN
- Qt3DCore::QFrameAllocator allocator(128, 16, 128);
+ Qt3DCore::QFrameAllocator allocator(192, 16, 128);
Qt3DRender::Render::RenderView *rv = allocator.allocate<Qt3DRender::Render::RenderView>();
rv->setAllocator(&allocator);
diff --git a/tests/auto/render/renderviewutils/renderviewutils.pro b/tests/auto/render/renderviewutils/renderviewutils.pro
index c45313023..90d8a2562 100644
--- a/tests/auto/render/renderviewutils/renderviewutils.pro
+++ b/tests/auto/render/renderviewutils/renderviewutils.pro
@@ -7,3 +7,6 @@ QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
CONFIG += testcase
SOURCES += tst_renderviewutils.cpp
+
+include(../../core/common/common.pri)
+include(../commons/commons.pri)
diff --git a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
index 1cab4da2e..0278b52c7 100644
--- a/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
+++ b/tests/auto/render/renderviewutils/tst_renderviewutils.cpp
@@ -1,48 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
-
+#include <qbackendnodetester.h>
+#include <Qt3DCore/qdynamicpropertyupdatedchange.h>
#include <Qt3DRender/private/renderviewjobutils_p.h>
#include <Qt3DRender/private/shaderdata_p.h>
#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/stringtoint_p.h>
#include <Qt3DRender/qshaderdata.h>
+#include "testpostmanarbiter.h"
-class tst_RenderViewUtils : public QObject
+class tst_RenderViewUtils : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
private Q_SLOTS:
@@ -51,6 +46,25 @@ private Q_SLOTS:
void topLevelArrayValue();
void topLevelStructValue_data();
void topLevelStructValue();
+ void topLevelDynamicProperties();
+ void shouldNotifyDynamicPropertyChanges();
+
+private:
+ void initBackendShaderData(Qt3DRender::QShaderData *frontend,
+ Qt3DRender::Render::ShaderDataManager *manager)
+ {
+ // Create children first
+ Q_FOREACH (QObject *c, frontend->children()) {
+ Qt3DRender::QShaderData *cShaderData = qobject_cast<Qt3DRender::QShaderData *>(c);
+ if (cShaderData)
+ initBackendShaderData(cShaderData, manager);
+ }
+
+ // Create backend element for frontend one
+ Qt3DRender::Render::ShaderData *backend = manager->getOrCreateResource(frontend->id());
+ // Init the backend element
+ simulateInitialization(frontend, backend);
+ }
};
class ScalarShaderData : public Qt3DRender::QShaderData
@@ -211,7 +225,7 @@ class MultiLevelStructShaderData : public StructShaderData
public:
MultiLevelStructShaderData()
: StructShaderData()
- , m_inner(Q_NULLPTR)
+ , m_inner(nullptr)
{
}
@@ -232,8 +246,8 @@ public:
{
QHash<QString, Qt3DRender::Render::ShaderUniform> innerUniforms;
- StructShaderData *innerData = Q_NULLPTR;
- if ((innerData = qobject_cast<StructShaderData *>(m_inner)) != Q_NULLPTR)
+ StructShaderData *innerData = nullptr;
+ if ((innerData = qobject_cast<StructShaderData *>(m_inner)) != nullptr)
innerUniforms = innerData->buildUniformMap(QStringLiteral(".inner"));
QHash<QString, Qt3DRender::Render::ShaderUniform> uniforms = StructShaderData::buildUniformMap(blockName);
@@ -251,8 +265,8 @@ public:
{
QHash<QString, QVariant> innerUniformsValues;
- StructShaderData *innerData = Q_NULLPTR;
- if ((innerData = qobject_cast<StructShaderData *>(m_inner)) != Q_NULLPTR)
+ StructShaderData *innerData = nullptr;
+ if ((innerData = qobject_cast<StructShaderData *>(m_inner)) != nullptr)
innerUniformsValues = innerData->buildUniformMapValues(QStringLiteral(".inner"));
QHash<QString, QVariant> uniformsValues = StructShaderData::buildUniformMapValues(blockName);
@@ -274,27 +288,6 @@ private:
Qt3DRender::QShaderData *m_inner;
};
-namespace {
-
-void initBackendShaderData(Qt3DRender::QShaderData *frontend,
- Qt3DRender::Render::ShaderDataManager *manager)
-{
- // Create children first
- Q_FOREACH (QObject *c, frontend->children()) {
- Qt3DRender::QShaderData *cShaderData = qobject_cast<Qt3DRender::QShaderData *>(c);
- if (cShaderData)
- initBackendShaderData(cShaderData, manager);
- }
-
- // Create backend element for frontend one
- Qt3DRender::Render::ShaderData *backend = manager->getOrCreateResource(frontend->id());
- // Init the backend element
- backend->updateFromPeer(frontend);
-}
-
-} // anonymous
-
-
void tst_RenderViewUtils::topLevelScalarValueNoUniforms()
{
QScopedPointer<ScalarShaderData> shaderData(new ScalarShaderData());
@@ -304,7 +297,7 @@ void tst_RenderViewUtils::topLevelScalarValueNoUniforms()
initBackendShaderData(shaderData.data(), manager.data());
Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id());
- QVERIFY(backendShaderData != Q_NULLPTR);
+ QVERIFY(backendShaderData != nullptr);
Qt3DRender::Render::UniformBlockValueBuilder blockBuilder;
blockBuilder.shaderDataManager = manager.data();
@@ -324,7 +317,7 @@ void tst_RenderViewUtils::topLevelScalarValue()
initBackendShaderData(shaderData.data(), manager.data());
Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id());
- QVERIFY(backendShaderData != Q_NULLPTR);
+ QVERIFY(backendShaderData != nullptr);
Qt3DRender::Render::UniformBlockValueBuilder blockBuilder;
blockBuilder.shaderDataManager = manager.data();
@@ -336,11 +329,11 @@ void tst_RenderViewUtils::topLevelScalarValue()
QVERIFY(blockBuilder.uniforms.count() == 1);
QCOMPARE(blockBuilder.activeUniformNamesToValue.count(), 1);
- QHash<QString, QVariant>::const_iterator it = blockBuilder.activeUniformNamesToValue.begin();
- const QHash<QString, QVariant>::const_iterator end = blockBuilder.activeUniformNamesToValue.end();
+ Qt3DRender::Render::UniformBlockValueBuilderHash::const_iterator it = blockBuilder.activeUniformNamesToValue.begin();
+ const Qt3DRender::Render::UniformBlockValueBuilderHash::const_iterator end = blockBuilder.activeUniformNamesToValue.end();
while (it != end) {
- QVERIFY(blockBuilder.uniforms.contains(it.key()));
+ QVERIFY(blockBuilder.uniforms.contains(Qt3DRender::Render::StringToInt::lookupString(it.key())));
QCOMPARE(it.value(), QVariant(shaderData->scalar()));
++it;
}
@@ -356,7 +349,7 @@ void tst_RenderViewUtils::topLevelArrayValue()
initBackendShaderData(shaderData.data(), manager.data());
Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id());
- QVERIFY(backendShaderData != Q_NULLPTR);
+ QVERIFY(backendShaderData != nullptr);
Qt3DRender::Render::UniformBlockValueBuilder blockBuilder;
blockBuilder.shaderDataManager = manager.data();
@@ -368,11 +361,11 @@ void tst_RenderViewUtils::topLevelArrayValue()
QVERIFY(blockBuilder.uniforms.count() == 1);
QCOMPARE(blockBuilder.activeUniformNamesToValue.count(), 1);
- QHash<QString, QVariant>::const_iterator it = blockBuilder.activeUniformNamesToValue.begin();
- const QHash<QString, QVariant>::const_iterator end = blockBuilder.activeUniformNamesToValue.end();
+ Qt3DRender::Render::UniformBlockValueBuilderHash::const_iterator it = blockBuilder.activeUniformNamesToValue.begin();
+ const Qt3DRender::Render::UniformBlockValueBuilderHash::const_iterator end = blockBuilder.activeUniformNamesToValue.end();
while (it != end) {
- QVERIFY(blockBuilder.uniforms.contains(it.key()));
+ QVERIFY(blockBuilder.uniforms.contains(Qt3DRender::Render::StringToInt::lookupString(it.key())));
QCOMPARE(it.value(), QVariant(arrayValues));
++it;
}
@@ -419,7 +412,7 @@ void tst_RenderViewUtils::topLevelStructValue()
initBackendShaderData(shaderData, manager.data());
Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id());
- QVERIFY(backendShaderData != Q_NULLPTR);
+ QVERIFY(backendShaderData != nullptr);
Qt3DRender::Render::UniformBlockValueBuilder blockBuilder;
blockBuilder.shaderDataManager = manager.data();
@@ -431,17 +424,63 @@ void tst_RenderViewUtils::topLevelStructValue()
QCOMPARE(blockBuilder.activeUniformNamesToValue.count(), blockBuilder.uniforms.count());
- QHash<QString, QVariant>::const_iterator it = blockBuilder.activeUniformNamesToValue.begin();
- const QHash<QString, QVariant>::const_iterator end = blockBuilder.activeUniformNamesToValue.end();
+ Qt3DRender::Render::UniformBlockValueBuilderHash::const_iterator it = blockBuilder.activeUniformNamesToValue.begin();
+ const Qt3DRender::Render::UniformBlockValueBuilderHash::const_iterator end = blockBuilder.activeUniformNamesToValue.end();
while (it != end) {
- QVERIFY(blockBuilder.uniforms.contains(it.key()));
- QVERIFY(expectedValues.contains(it.key()));
- QCOMPARE(it.value(), expectedValues.value(it.key()));
+ QVERIFY(blockBuilder.uniforms.contains(Qt3DRender::Render::StringToInt::lookupString(it.key())));
+ QVERIFY(expectedValues.contains(Qt3DRender::Render::StringToInt::lookupString(it.key())));
+ QCOMPARE(it.value(), expectedValues.value(Qt3DRender::Render::StringToInt::lookupString(it.key())));
++it;
}
}
-QTEST_APPLESS_MAIN(tst_RenderViewUtils)
+void tst_RenderViewUtils::topLevelDynamicProperties()
+{
+ QScopedPointer<Qt3DRender::QShaderData> shaderData(new Qt3DRender::QShaderData());
+ QScopedPointer<Qt3DRender::Render::ShaderDataManager> manager(new Qt3DRender::Render::ShaderDataManager());
+
+ shaderData->setProperty("scalar", 883.0f);
+ shaderData->setProperty("array", QVariantList() << 454 << 350 << 383 << 427 << 552);
+ initBackendShaderData(shaderData.data(), manager.data());
+
+ Qt3DRender::Render::ShaderData *backendShaderData = manager->lookupResource(shaderData->id());
+ QVERIFY(backendShaderData != nullptr);
+
+ Qt3DRender::Render::UniformBlockValueBuilder blockBuilder;
+ blockBuilder.shaderDataManager = manager.data();
+ blockBuilder.updatedPropertiesOnly = false;
+ blockBuilder.uniforms.insert(QStringLiteral("MyBlock.scalar"), Qt3DRender::Render::ShaderUniform());
+ blockBuilder.uniforms.insert(QStringLiteral("MyBlock.array[0]"), Qt3DRender::Render::ShaderUniform());
+ // build name-value map
+ blockBuilder.buildActiveUniformNameValueMapStructHelper(backendShaderData, QStringLiteral("MyBlock"));
+
+ QVERIFY(blockBuilder.uniforms.count() == 2);
+ QCOMPARE(blockBuilder.activeUniformNamesToValue.count(), 2);
+
+ QCOMPARE(blockBuilder.activeUniformNamesToValue.value(Qt3DRender::Render::StringToInt::lookupId("MyBlock.scalar")),
+ shaderData->property("scalar"));
+ QCOMPARE(blockBuilder.activeUniformNamesToValue.value(Qt3DRender::Render::StringToInt::lookupId("MyBlock.array[0]")),
+ shaderData->property("array"));
+}
+
+void tst_RenderViewUtils::shouldNotifyDynamicPropertyChanges()
+{
+ // GIVEN
+ QScopedPointer<Qt3DRender::QShaderData> shaderData(new Qt3DRender::QShaderData());
+ TestArbiter arbiter(shaderData.data());
+
+ // WHEN
+ shaderData->setProperty("scalar", 883.0f);
+
+ // THEN
+ QCOMPARE(arbiter.events.size(), 1);
+ auto change = arbiter.events.first().dynamicCast<Qt3DCore::QDynamicPropertyUpdatedChange>();
+ QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
+ QCOMPARE(change->propertyName(), QByteArrayLiteral("scalar"));
+ QCOMPARE(change->value().toFloat(), 883.0f);
+}
+
+QTEST_MAIN(tst_RenderViewUtils)
#include "tst_renderviewutils.moc"
diff --git a/tests/auto/render/shader/shader.pro b/tests/auto/render/shader/shader.pro
index 8d0dd99a5..7c908e0f6 100644
--- a/tests/auto/render/shader/shader.pro
+++ b/tests/auto/render/shader/shader.pro
@@ -7,3 +7,5 @@ QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
CONFIG += testcase
SOURCES += tst_shader.cpp
+
+include(../../core/common/common.pri)
diff --git a/tests/auto/render/shader/tst_shader.cpp b/tests/auto/render/shader/tst_shader.cpp
index ae850ddc3..95576afe0 100644
--- a/tests/auto/render/shader/tst_shader.cpp
+++ b/tests/auto/render/shader/tst_shader.cpp
@@ -1,44 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtTest/QTest>
+#include <qbackendnodetester.h>
#include <Qt3DRender/private/shader_p.h>
#include <Qt3DRender/qshaderprogram.h>
-class tst_RenderShader : public QObject
+class tst_RenderShader : public Qt3DCore::QBackendNodeTester
{
Q_OBJECT
private slots:
@@ -95,7 +88,7 @@ void tst_RenderShader::matchesFrontendPeer()
Qt3DRender::QShaderProgram *frontend = createFrontendShader();
Qt3DRender::Render::Shader *backend = new Qt3DRender::Render::Shader();
- backend->updateFromPeer(frontend);
+ simulateInitialization(frontend, backend);
QCOMPARE(backend->isLoaded(), false);
QVERIFY(backend->dna() != 0U);
@@ -109,7 +102,7 @@ void tst_RenderShader::cleanupLeavesACoherentState()
Qt3DRender::QShaderProgram *frontend = createFrontendShader();
Qt3DRender::Render::Shader *shader = new Qt3DRender::Render::Shader();
- shader->updateFromPeer(frontend);
+ simulateInitialization(frontend, shader);
shader->cleanup();
diff --git a/tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp b/tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp
index 5d6cd7711..ea9ccc2f5 100644
--- a/tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp
+++ b/tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -38,9 +30,9 @@
#include <Qt3DRender/private/entity_p.h>
#include <Qt3DRender/private/triangleboundingvolume_p.h>
#include <Qt3DRender/private/qraycastingservice_p.h>
-#include <Qt3DCore/qray3d.h>
-#include <Qt3DCore/qcameralens.h>
-#include <Qt3DCore/qcamera.h>
+#include <Qt3DRender/private/qray3d_p.h>
+#include <Qt3DRender/qcameralens.h>
+#include <Qt3DRender/qcamera.h>
#include <Qt3DRender/private/qboundingvolume_p.h>
class tst_TriangleBoundingVolume : public QObject
@@ -109,8 +101,8 @@ private Q_SLOTS:
a,
b,
c);
- Qt3DCore::QCamera camera;
- camera.setProjectionType(Qt3DCore::QCameraLens::PerspectiveProjection);
+ Qt3DRender::QCamera camera;
+ camera.setProjectionType(Qt3DRender::QCameraLens::PerspectiveProjection);
camera.setFieldOfView(45.0f);
camera.setAspectRatio(800.0/600.0f);
camera.setNearPlane(0.1f);
@@ -132,7 +124,7 @@ private Q_SLOTS:
void intersects_data()
{
- QTest::addColumn<Qt3DCore::QRay3D>("ray");
+ QTest::addColumn<Qt3DRender::QRay3D>("ray");
QTest::addColumn<QVector3D>("a");
QTest::addColumn<QVector3D>("b");
QTest::addColumn<QVector3D>("c");
@@ -143,7 +135,7 @@ private Q_SLOTS:
const float farPlaneDistance = 40.0;
QTest::newRow("halfway_center")
- << Qt3DCore::QRay3D(QVector3D(), QVector3D(0.0, 0.0, 1.0), farPlaneDistance)
+ << Qt3DRender::QRay3D(QVector3D(), QVector3D(0.0, 0.0, 1.0), farPlaneDistance)
<< QVector3D(3.0, 1.5, 20.0)
<< QVector3D(0.0, -1.5, 20.0)
<< QVector3D(-3, 1.5, 20.0)
@@ -151,7 +143,7 @@ private Q_SLOTS:
<< 0.5f
<< true;
QTest::newRow("miss_halfway_center_too_short")
- << Qt3DCore::QRay3D(QVector3D(), QVector3D(0.0, 0.0, 1.0), farPlaneDistance * 0.25f)
+ << Qt3DRender::QRay3D(QVector3D(), QVector3D(0.0, 0.0, 1.0), farPlaneDistance * 0.25f)
<< QVector3D(3.0, 1.5, 20.0)
<< QVector3D(0.0, -1.5, 20.0)
<< QVector3D(-3, 1.5, 20.0)
@@ -159,7 +151,7 @@ private Q_SLOTS:
<< 0.0f
<< false;
QTest::newRow("far_center")
- << Qt3DCore::QRay3D(QVector3D(), QVector3D(0.0, 0.0, 1.0), farPlaneDistance)
+ << Qt3DRender::QRay3D(QVector3D(), QVector3D(0.0, 0.0, 1.0), farPlaneDistance)
<< QVector3D(3.0, 1.5, 40.0)
<< QVector3D(0.0, -1.5, 40.0)
<< QVector3D(-3, 1.5, 40.0)
@@ -167,7 +159,7 @@ private Q_SLOTS:
<< 1.0f
<< true;
QTest::newRow("near_center")
- << Qt3DCore::QRay3D(QVector3D(), QVector3D(0.0, 0.0, 1.0), 1.0f)
+ << Qt3DRender::QRay3D(QVector3D(), QVector3D(0.0, 0.0, 1.0), 1.0f)
<< QVector3D(3.0, 1.5, 0.0)
<< QVector3D(0.0, -1.5, 0.0)
<< QVector3D(-3, 1.5, 0.0)
@@ -175,7 +167,7 @@ private Q_SLOTS:
<< 0.0f
<< true;
QTest::newRow("above_miss_center")
- << Qt3DCore::QRay3D(QVector3D(0.0, 2.0, 0.0), QVector3D(0.0, 2.0, 1.0), 1.0f)
+ << Qt3DRender::QRay3D(QVector3D(0.0, 2.0, 0.0), QVector3D(0.0, 2.0, 1.0), 1.0f)
<< QVector3D(3.0, 1.5, 0.0)
<< QVector3D(0.0, -1.5, 0.0)
<< QVector3D(-3, 1.5, 0.0)
@@ -183,7 +175,7 @@ private Q_SLOTS:
<< 0.0f
<< false;
QTest::newRow("below_miss_center")
- << Qt3DCore::QRay3D(QVector3D(0.0, -2.0, 0.0), QVector3D(0.0, -2.0, 1.0), 1.0f)
+ << Qt3DRender::QRay3D(QVector3D(0.0, -2.0, 0.0), QVector3D(0.0, -2.0, 1.0), 1.0f)
<< QVector3D(3.0, 1.5, 0.0)
<< QVector3D(0.0, -1.5, 0.0)
<< QVector3D(-3, 1.5, 0.0)
@@ -195,7 +187,7 @@ private Q_SLOTS:
void intersects()
{
// GIVEN
- QFETCH(Qt3DCore::QRay3D, ray);
+ QFETCH(Qt3DRender::QRay3D, ray);
QFETCH(QVector3D, a);
QFETCH(QVector3D, b);
QFETCH(QVector3D, c);
diff --git a/tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp b/tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp
index ede8fdd6c..8904ccd25 100644
--- a/tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp
+++ b/tests/auto/render/trianglesextractor/tst_trianglesextractor.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -54,6 +46,7 @@
#include <Qt3DRender/qgeometry.h>
#include <Qt3DRender/qgeometryrenderer.h>
#include <Qt3DCore/private/qnodevisitor_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
Qt3DRender::QGeometryRenderer *customIndexedGeometryRenderer()
{
@@ -188,12 +181,12 @@ Qt3DRender::QGeometryRenderer *customIndexedGeometryRenderer()
customGeometry->addAttribute(indexAttribute);
customMeshRenderer->setInstanceCount(1);
- customMeshRenderer->setBaseVertex(0);
- customMeshRenderer->setBaseInstance(0);
+ customMeshRenderer->setIndexOffset(0);
+ customMeshRenderer->setFirstInstance(0);
customMeshRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
customMeshRenderer->setGeometry(customGeometry);
// 4 faces of 3 points
- customMeshRenderer->setPrimitiveCount(12);
+ customMeshRenderer->setVertexCount(12);
return customMeshRenderer;
}
@@ -309,12 +302,12 @@ Qt3DRender::QGeometryRenderer *customNonIndexedGeometryRenderer()
customGeometry->addAttribute(colorAttribute);
customMeshRenderer->setInstanceCount(1);
- customMeshRenderer->setBaseVertex(0);
- customMeshRenderer->setBaseInstance(0);
+ customMeshRenderer->setIndexOffset(0);
+ customMeshRenderer->setFirstInstance(0);
customMeshRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
customMeshRenderer->setGeometry(customGeometry);
// 4 faces of 3 points
- customMeshRenderer->setPrimitiveCount(12);
+ customMeshRenderer->setVertexCount(12);
return customMeshRenderer;
}
@@ -325,24 +318,28 @@ public:
TestAspect(Qt3DCore::QNode *root)
: Qt3DRender::QRenderAspect()
{
- Qt3DCore::QNodeVisitor visitor;
- visitor.traverse(root, this, &TestAspect::visitNode);
+ const Qt3DCore::QNodeCreatedChangeGenerator generator(root);
+ const QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = generator.creationChanges();
+
+ for (const Qt3DCore::QNodeCreatedChangeBasePtr change : creationChanges)
+ d_func()->createBackendNode(change);
}
Qt3DRender::Render::NodeManagers *nodeManagers() const
{
return d_func()->m_renderer->nodeManagers();
}
-
- void visitNode(Qt3DCore::QNode *node)
- {
- d_func()->createBackendNode(node);
- }
};
class tst_TrianglesExtractor : public QObject
{
Q_OBJECT
+public:
+ tst_TrianglesExtractor()
+ {
+ qRegisterMetaType<Qt3DCore::QNode*>();
+ }
+
private Q_SLOTS:
void triangles_data()
@@ -363,11 +360,12 @@ private Q_SLOTS:
void triangles()
{
+ QSKIP("Deadlocks in QRenderAspect, should be fixed");
// GIVEN
QFETCH(Qt3DRender::QGeometryRenderer *, geomRenderer);
QFETCH(QVector<Qt3DRender::Render::TriangleBoundingVolume *>, expectedVolumes);
- TestAspect aspect(geomRenderer);
- Qt3DRender::Render::NodeManagers *manager = aspect.nodeManagers();
+ TestAspect *aspect = new TestAspect(geomRenderer);
+ Qt3DRender::Render::NodeManagers *manager = aspect->nodeManagers();
// WHEN
Qt3DRender::Render::GeometryRenderer *bGeomRenderer =
diff --git a/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp b/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp
index bfa394a25..3d873258f 100644
--- a/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp
+++ b/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2015 Paul Lemire
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp
index cd3e604c6..55041eeb4 100644
--- a/tests/auto/shared/util.cpp
+++ b/tests/auto/shared/util.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/auto/shared/util.h b/tests/auto/shared/util.h
index 80d301bc7..47a4aae23 100644
--- a/tests/auto/shared/util.h
+++ b/tests/auto/shared/util.h
@@ -1,34 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/Qt3DBench/GroundPlane.qml b/tests/benchmarks/Qt3DBench/GroundPlane.qml
index 2fb8c07ee..646ecc082 100644
--- a/tests/benchmarks/Qt3DBench/GroundPlane.qml
+++ b/tests/benchmarks/Qt3DBench/GroundPlane.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/Qt3DBench/Light.qml b/tests/benchmarks/Qt3DBench/Light.qml
index eba533713..486b6abaa 100644
--- a/tests/benchmarks/Qt3DBench/Light.qml
+++ b/tests/benchmarks/Qt3DBench/Light.qml
@@ -1,35 +1,27 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml b/tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml
index 0ef2cf57f..9f5b1e3ca 100644
--- a/tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml
+++ b/tests/benchmarks/Qt3DBench/Qt3DBenchFrameGraph.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -50,7 +42,7 @@ FrameGraph {
clearColor: Qt.rgba(0.0, 0.0, 0.0, 1.0)
RenderPassFilter {
- includes: [ Annotation { name: "pass"; value: "shadowmap" } ]
+ includes: [ FilterKey { name: "pass"; value: "shadowmap" } ]
RenderTargetSelector {
target: RenderTarget {
@@ -77,8 +69,8 @@ FrameGraph {
]
}
- ClearBuffer {
- buffers: ClearBuffer.DepthBuffer
+ ClearBuffers {
+ buffers: ClearBuffers.DepthBuffer
CameraSelector {
id: lightCameraSelector
@@ -88,10 +80,10 @@ FrameGraph {
}
RenderPassFilter {
- includes: [ Annotation { name: "pass"; value: "forward" } ]
+ includes: [ FilterKey { name: "pass"; value: "forward" } ]
- ClearBuffer {
- buffers : ClearBuffer.ColorDepthBuffer
+ ClearBuffers {
+ buffers : ClearBuffers.ColorDepthBuffer
CameraSelector {
id: viewCameraSelector
diff --git a/tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml b/tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml
index ed253be38..6a89a833c 100644
--- a/tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml
+++ b/tests/benchmarks/Qt3DBench/Qt3DBenchMain.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/Qt3DBench/ShadowEffect.qml b/tests/benchmarks/Qt3DBench/ShadowEffect.qml
index 4a8f0bb11..f1f39cfb4 100644
--- a/tests/benchmarks/Qt3DBench/ShadowEffect.qml
+++ b/tests/benchmarks/Qt3DBench/ShadowEffect.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -55,7 +47,7 @@ Effect {
Technique {
renderPasses: [
RenderPass {
- annotations: [ Annotation { name: "pass"; value: "shadowmap" } ]
+ filterKeys: [ FilterKey { name: "pass"; value: "shadowmap" } ]
shaderProgram: ShaderProgram {
vertexShaderCode: loadSource("qrc:/shaders/shadowmap.vert")
@@ -63,13 +55,13 @@ Effect {
}
renderStates: [
- PolygonOffset { factor: 4; units: 4 },
+ PolygonOffset { scaleFactor: 4; units: 4 },
DepthTest { func: DepthTest.Less }
]
},
RenderPass {
- annotations: [ Annotation { name: "pass"; value: "forward" } ]
+ filterKeys: [ FilterKey { name: "pass"; value: "forward" } ]
bindings: [
ParameterMapping { parameterName: "ambient"; shaderVariableName: "ka"; bindingType: ParameterMapping.Uniform },
diff --git a/tests/benchmarks/Qt3DBench/ShadowMaterial.qml b/tests/benchmarks/Qt3DBench/ShadowMaterial.qml
index 4e02e23e6..c848e1412 100644
--- a/tests/benchmarks/Qt3DBench/ShadowMaterial.qml
+++ b/tests/benchmarks/Qt3DBench/ShadowMaterial.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/Qt3DBench/SphereElement.qml b/tests/benchmarks/Qt3DBench/SphereElement.qml
index df1049af8..8414f667c 100644
--- a/tests/benchmarks/Qt3DBench/SphereElement.qml
+++ b/tests/benchmarks/Qt3DBench/SphereElement.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/Qt3DBench/SphereView.qml b/tests/benchmarks/Qt3DBench/SphereView.qml
index ad5b8fbc5..b2de7705a 100644
--- a/tests/benchmarks/Qt3DBench/SphereView.qml
+++ b/tests/benchmarks/Qt3DBench/SphereView.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/Qt3DBench/main.cpp b/tests/benchmarks/Qt3DBench/main.cpp
index fca6ea0ef..1b72215ae 100644
--- a/tests/benchmarks/Qt3DBench/main.cpp
+++ b/tests/benchmarks/Qt3DBench/main.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/Qt3DBench/shaders/ads.frag b/tests/benchmarks/Qt3DBench/shaders/ads.frag
index b2b056a3a..0dbcc57b6 100644
--- a/tests/benchmarks/Qt3DBench/shaders/ads.frag
+++ b/tests/benchmarks/Qt3DBench/shaders/ads.frag
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
diff --git a/tests/benchmarks/Qt3DBench/shaders/ads.vert b/tests/benchmarks/Qt3DBench/shaders/ads.vert
index e77a8f287..70a32be6d 100644
--- a/tests/benchmarks/Qt3DBench/shaders/ads.vert
+++ b/tests/benchmarks/Qt3DBench/shaders/ads.vert
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
diff --git a/tests/benchmarks/Qt3DBench/shaders/shadowmap.frag b/tests/benchmarks/Qt3DBench/shaders/shadowmap.frag
index becac915e..894b90b98 100644
--- a/tests/benchmarks/Qt3DBench/shaders/shadowmap.frag
+++ b/tests/benchmarks/Qt3DBench/shaders/shadowmap.frag
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
diff --git a/tests/benchmarks/Qt3DBench/shaders/shadowmap.vert b/tests/benchmarks/Qt3DBench/shaders/shadowmap.vert
index a0b81a846..ea2cd5cc4 100644
--- a/tests/benchmarks/Qt3DBench/shaders/shadowmap.vert
+++ b/tests/benchmarks/Qt3DBench/shaders/shadowmap.vert
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
diff --git a/tests/benchmarks/core/qcircularbuffer/tst_bench_qcircularbuffer.cpp b/tests/benchmarks/core/qcircularbuffer/tst_bench_qcircularbuffer.cpp
index 2e1d990c3..cac6e6d77 100644
--- a/tests/benchmarks/core/qcircularbuffer/tst_bench_qcircularbuffer.cpp
+++ b/tests/benchmarks/core/qcircularbuffer/tst_bench_qcircularbuffer.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/core/qframeallocator/tst_bench_qframeallocator.cpp b/tests/benchmarks/core/qframeallocator/tst_bench_qframeallocator.cpp
index 03a692939..91b8f887d 100644
--- a/tests/benchmarks/core/qframeallocator/tst_bench_qframeallocator.cpp
+++ b/tests/benchmarks/core/qframeallocator/tst_bench_qframeallocator.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp b/tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp
index 29667724a..0d89bd8c4 100644
--- a/tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp
+++ b/tests/benchmarks/core/qresourcesmanager/arraypolicy/tst_bench_arraypolicy.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp b/tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp
index 281442be7..48b12b5f2 100644
--- a/tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp
+++ b/tests/benchmarks/core/qresourcesmanager/qresourcesmanager/tst_bench_qresourcesmanager.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/tests/benchmarks/render/jobs/jobs.pro b/tests/benchmarks/render/jobs/jobs.pro
index 0eb6017e2..bfd0f1317 100644
--- a/tests/benchmarks/render/jobs/jobs.pro
+++ b/tests/benchmarks/render/jobs/jobs.pro
@@ -2,7 +2,7 @@ TARGET = tst_bench_jobs
TEMPLATE = app
-QT += testlib core core-private 3dcore 3dcore-private 3drender 3drender-private 3dquick qml
+QT += testlib core core-private 3dcore 3dcore-private 3drender 3drender-private 3dquick qml 3dextras
SOURCES += tst_bench_jobs.cpp
diff --git a/tests/benchmarks/render/jobs/tst_bench_jobs.cpp b/tests/benchmarks/render/jobs/tst_bench_jobs.cpp
index 73b864687..7593d2992 100644
--- a/tests/benchmarks/render/jobs/tst_bench_jobs.cpp
+++ b/tests/benchmarks/render/jobs/tst_bench_jobs.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -37,16 +29,16 @@
#include <QtTest/QtTest>
#include <QMatrix4x4>
#include <Qt3DCore/QEntity>
-#include <Qt3DCore/QCamera>
#include <Qt3DCore/QTransform>
#include <Qt3DRender/QMaterial>
-#include <Qt3DRender/QFrameGraph>
-#include <Qt3DRender/QForwardRenderer>
-#include <Qt3DRender/QPhongMaterial>
-#include <Qt3DRender/QCylinderMesh>
+#include <Qt3DExtras/QForwardRenderer>
+#include <Qt3DExtras/QPhongMaterial>
+#include <Qt3DExtras/QCylinderMesh>
+#include <Qt3DRender/QRenderSettings>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DCore/private/qresourcemanager_p.h>
+#include <Qt3DRender/qcamera.h>
#include <Qt3DRender/qrenderaspect.h>
#include <Qt3DRender/private/qrenderaspect_p.h>
#include <Qt3DRender/private/renderer_p.h>
@@ -58,6 +50,7 @@
#include <Qt3DCore/private/qaspectmanager_p.h>
#include <Qt3DCore/private/qaspectthread_p.h>
#include <Qt3DCore/private/qnodevisitor_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <QQmlComponent>
#include <QScopedPointer>
@@ -87,10 +80,7 @@ public:
m_window->setFormat(format);
m_window->create();
- QVariantMap data;
- data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(m_window.data())));
- data.insert(QStringLiteral("eventSource"), QVariant::fromValue(m_window.data()));
- QRenderAspect::onInitialize(data);
+ QRenderAspect::onRegistered();
}
}
@@ -132,19 +122,18 @@ public:
void onRootEntityChanged(Qt3DCore::QEntity *root)
{
if (!m_window) {
- Qt3DCore::QNodeVisitor visitor;
- visitor.traverse(root, this, &TestAspect::visitNode);
+ const Qt3DCore::QNodeCreatedChangeGenerator generator(root);
+ const QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = generator.creationChanges();
+
+ for (const Qt3DCore::QNodeCreatedChangeBasePtr change : creationChanges)
+ d_func()->createBackendNode(change);
+
static_cast<Qt3DRender::Render::Renderer *>(d_func()->m_renderer)->m_renderSceneRoot =
d_func()->m_renderer->nodeManagers()
->lookupResource<Qt3DRender::Render::Entity, Qt3DRender::Render::EntityManager>(root->id());
}
}
- void visitNode(Qt3DCore::QNode *node)
- {
- d_func()->createBackendNode(node);
- }
-
private:
QScopedPointer<Qt3DCore::QAspectJobManager> m_jobManager;
QScopedPointer<QWindow> m_window;
@@ -167,7 +156,7 @@ Qt3DCore::QEntity *buildBigScene()
Qt3DCore::QEntity *root = new Qt3DCore::QEntity();
// Camera
- Qt3DCore::QCamera *cameraEntity = new Qt3DCore::QCamera(root);
+ Qt3DRender::QCamera *cameraEntity = new Qt3DRender::QCamera(root);
cameraEntity->setObjectName(QStringLiteral("cameraEntity"));
cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
cameraEntity->setPosition(QVector3D(0, -250.0f, -50.0f));
@@ -175,13 +164,12 @@ Qt3DCore::QEntity *buildBigScene()
cameraEntity->setViewCenter(QVector3D(0, 0, 0));
// FrameGraph
- Qt3DRender::QFrameGraph *frameGraph = new Qt3DRender::QFrameGraph();
- Qt3DRender::QForwardRenderer *forwardRenderer = new Qt3DRender::QForwardRenderer();
+ Qt3DRender::QRenderSettings* renderSettings = new Qt3DRender::QRenderSettings();
+ Qt3DExtras::QForwardRenderer *forwardRenderer = new Qt3DExtras::QForwardRenderer();
forwardRenderer->setCamera(cameraEntity);
forwardRenderer->setClearColor(Qt::black);
- frameGraph->setActiveFrameGraph(forwardRenderer);
- root->addComponent(frameGraph);
-
+ renderSettings->setActiveFrameGraph(forwardRenderer);
+ root->addComponent(renderSettings);
const float radius = 100.0f;
const int max = 1000;
@@ -190,8 +178,8 @@ Qt3DCore::QEntity *buildBigScene()
for (int i = 0; i < max; i++) {
Qt3DCore::QEntity *e = new Qt3DCore::QEntity();
Qt3DCore::QTransform *transform = new Qt3DCore::QTransform();
- Qt3DRender::QCylinderMesh *mesh = new Qt3DRender::QCylinderMesh();
- Qt3DRender::QPhongMaterial *material = new Qt3DRender::QPhongMaterial();
+ Qt3DExtras::QCylinderMesh *mesh = new Qt3DExtras::QCylinderMesh();
+ Qt3DExtras::QPhongMaterial *material = new Qt3DExtras::QPhongMaterial();
mesh->setRings(50.0f);
mesh->setSlices(30.0f);
mesh->setRadius(2.5f);
@@ -245,7 +233,8 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QEntity*, rootEntity);
TestAspect aspect;
- Qt3DCore::QAbstractAspectPrivate::get(&aspect)->registerAspect(qobject_cast<Qt3DCore::QEntity *>(rootEntity));
+ Qt3DCore::QAbstractAspectPrivate::get(&aspect)->setRootAndCreateNodes(qobject_cast<Qt3DCore::QEntity *>(rootEntity),
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr>());
// WHEN
QVector<Qt3DCore::QAspectJobPtr> jobs = aspect.worldTransformJob();
@@ -268,7 +257,8 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QEntity*, rootEntity);
TestAspect aspect;
- Qt3DCore::QAbstractAspectPrivate::get(&aspect)->registerAspect(qobject_cast<Qt3DCore::QEntity *>(rootEntity));
+ Qt3DCore::QAbstractAspectPrivate::get(&aspect)->setRootAndCreateNodes(qobject_cast<Qt3DCore::QEntity *>(rootEntity),
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr>());
// WHEN
QVector<Qt3DCore::QAspectJobPtr> jobs = aspect.updateBoundingJob();
@@ -291,7 +281,8 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QEntity*, rootEntity);
TestAspect aspect;
- Qt3DCore::QAbstractAspectPrivate::get(&aspect)->registerAspect(qobject_cast<Qt3DCore::QEntity *>(rootEntity));
+ Qt3DCore::QAbstractAspectPrivate::get(&aspect)->setRootAndCreateNodes(qobject_cast<Qt3DCore::QEntity *>(rootEntity),
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr>());
// WHEN
QVector<Qt3DCore::QAspectJobPtr> jobs = aspect.calculateBoundingVolumeJob();
@@ -314,7 +305,8 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QEntity*, rootEntity);
TestAspect aspect;
- Qt3DCore::QAbstractAspectPrivate::get(&aspect)->registerAspect(qobject_cast<Qt3DCore::QEntity *>(rootEntity));
+ Qt3DCore::QAbstractAspectPrivate::get(&aspect)->setRootAndCreateNodes(qobject_cast<Qt3DCore::QEntity *>(rootEntity),
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr>());
// WHEN
QVector<Qt3DCore::QAspectJobPtr> jobs = aspect.framePreparationJob();
@@ -337,7 +329,8 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QEntity*, rootEntity);
TestAspect aspect;
- Qt3DCore::QAbstractAspectPrivate::get(&aspect)->registerAspect(qobject_cast<Qt3DCore::QEntity *>(rootEntity));
+ Qt3DCore::QAbstractAspectPrivate::get(&aspect)->setRootAndCreateNodes(qobject_cast<Qt3DCore::QEntity *>(rootEntity),
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr>());
// WHEN
QVector<Qt3DCore::QAspectJobPtr> jobs = aspect.frameCleanupJob();
diff --git a/tests/manual/assimp-cpp/assimp-cpp.pro b/tests/manual/assimp-cpp/assimp-cpp.pro
new file mode 100644
index 000000000..b8d0b1b3b
--- /dev/null
+++ b/tests/manual/assimp-cpp/assimp-cpp.pro
@@ -0,0 +1,11 @@
+android|ios|tvos|winrt {
+ warning( "This example is not supported for android, ios, tvos, or winrt." )
+}
+
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += widgets 3dcore 3drender 3dinput 3dextras
+
+SOURCES += main.cpp
diff --git a/tests/manual/assimp-cpp/main.cpp b/tests/manual/assimp-cpp/main.cpp
new file mode 100644
index 000000000..9701cb66a
--- /dev/null
+++ b/tests/manual/assimp-cpp/main.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QFileDialog>
+#include <QApplication>
+
+#include <Qt3DRender/QCamera>
+#include <Qt3DCore/QEntity>
+#include <Qt3DCore/QAspectEngine>
+#include <Qt3DInput/QInputAspect>
+#include <Qt3DRender/QSceneLoader>
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DExtras/QForwardRenderer>
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qfirstpersoncameracontroller.h>
+
+class SceneWalker : public QObject
+{
+public:
+ SceneWalker(Qt3DRender::QSceneLoader *loader) : m_loader(loader) { }
+
+ void onStatusChanged();
+
+private:
+ void walkEntity(Qt3DCore::QEntity *e, int depth = 0);
+
+ Qt3DRender::QSceneLoader *m_loader;
+};
+
+void SceneWalker::onStatusChanged()
+{
+ qDebug() << "Status changed:" << m_loader->status();
+ if (m_loader->status() != Qt3DRender::QSceneLoader::Ready)
+ return;
+
+ // The QSceneLoader instance is a component of an entity. The loaded scene
+ // tree is added under this entity.
+ QVector<Qt3DCore::QEntity *> entities = m_loader->entities();
+
+ // Technically there could be multiple entities referencing the scene loader
+ // but sharing is discouraged, and in our case there will be one anyhow.
+ if (entities.isEmpty())
+ return;
+ Qt3DCore::QEntity *root = entities[0];
+ // Print the tree.
+ walkEntity(root);
+
+ // To access a given node (like a named mesh in the scene), use QObject::findChild().
+ // The scene structure and names always depend on the asset.
+ Qt3DCore::QEntity *e = root->findChild<Qt3DCore::QEntity *>(QStringLiteral("PlanePropeller_mesh")); // toyplane.obj
+ if (e)
+ qDebug() << "Found propeller node" << e << "with components" << e->components();
+}
+
+void SceneWalker::walkEntity(Qt3DCore::QEntity *e, int depth)
+{
+ Qt3DCore::QNodeVector nodes = e->childNodes();
+ for (int i = 0; i < nodes.count(); ++i) {
+ Qt3DCore::QNode *node = nodes[i];
+ Qt3DCore::QEntity *entity = qobject_cast<Qt3DCore::QEntity *>(node);
+ if (entity) {
+ QString indent;
+ indent.fill(' ', depth * 2);
+ qDebug().noquote() << indent << "Entity:" << entity << "Components:" << entity->components();
+ walkEntity(entity, depth + 1);
+ }
+ }
+}
+
+int main(int ac, char **av)
+{
+ QApplication app(ac, av);
+ Qt3DExtras::Qt3DWindow view;
+ view.defaultFramegraph()->setClearColor(Qt::black);
+
+ // Root entity
+ Qt3DCore::QEntity *sceneRoot = new Qt3DCore::QEntity();
+
+ // Scene Camera
+ Qt3DRender::QCamera *camera = view.camera();
+ camera->setProjectionType(Qt3DRender::QCameraLens::PerspectiveProjection);
+ camera->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f));
+ camera->setPosition(QVector3D(0.0f, 3.5f, 25.0f));
+ camera->setNearPlane(0.001f);
+ camera->setFarPlane(10000.0f);
+
+ // For camera controls
+ Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot);
+ camController->setCamera(camera);
+
+ // Scene loader
+ Qt3DCore::QEntity *sceneLoaderEntity = new Qt3DCore::QEntity(sceneRoot);
+ Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader(sceneLoaderEntity);
+ SceneWalker sceneWalker(sceneLoader);
+ QObject::connect(sceneLoader, &Qt3DRender::QSceneLoader::statusChanged, &sceneWalker, &SceneWalker::onStatusChanged);
+ sceneLoaderEntity->addComponent(sceneLoader);
+
+ QStringList args = QCoreApplication::arguments();
+ QUrl sourceFileName;
+ if (args.count() <= 1) {
+ QWidget *container = new QWidget();
+ QFileDialog dialog;
+ dialog.setFileMode(QFileDialog::AnyFile);
+ sourceFileName = dialog.getOpenFileUrl(container, QStringLiteral("Open a scene file"));
+ } else {
+ sourceFileName = QUrl::fromLocalFile(args[1]);
+ }
+
+ if (sourceFileName.isEmpty())
+ return 0;
+
+ sceneLoader->setSource(sourceFileName);
+
+ view.setRootEntity(sceneRoot);
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/assimp/assimp.pro b/tests/manual/assimp/assimp.pro
new file mode 100644
index 000000000..5e74f760a
--- /dev/null
+++ b/tests/manual/assimp/assimp.pro
@@ -0,0 +1,17 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+SOURCE += main.cpp
+
+QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras 3dquickextras
+
+OTHER_FILES += main.qml
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ assimp.qrc \
+ ../../../examples/qt3d/exampleresources/test_scene.qrc \
+ ../../../examples/qt3d/exampleresources/chest.qrc
diff --git a/examples/qt3d/assimp/assimp.qrc b/tests/manual/assimp/assimp.qrc
index 5f6483ac3..5f6483ac3 100644
--- a/examples/qt3d/assimp/assimp.qrc
+++ b/tests/manual/assimp/assimp.qrc
diff --git a/tests/manual/assimp/doc/src/assimp.qdoc b/tests/manual/assimp/doc/src/assimp.qdoc
new file mode 100644
index 000000000..31833a1b8
--- /dev/null
+++ b/tests/manual/assimp/doc/src/assimp.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example assimp
+ \title Qt 3D: assimp Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/assimp/main.cpp b/tests/manual/assimp/main.cpp
new file mode 100644
index 000000000..5df575e32
--- /dev/null
+++ b/tests/manual/assimp/main.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <Qt3DRender/QSceneLoader>
+#include <Qt3DCore/QEntity>
+
+#include <QGuiApplication>
+#include <qqml.h>
+
+class SceneHelper : public QObject
+{
+ Q_OBJECT
+
+public:
+ Q_INVOKABLE QObject *findEntity(Qt3DRender::QSceneLoader *loader, const QString &name);
+ Q_INVOKABLE QObject *findComponent(Qt3DCore::QEntity *entity, const QString &componentMetatype);
+ Q_INVOKABLE void addListEntry(const QVariant &list, QObject *entry);
+};
+
+QObject *SceneHelper::findEntity(Qt3DRender::QSceneLoader *loader, const QString &name)
+{
+ // The QSceneLoader instance is a component of an entity. The loaded scene
+ // tree is added under this entity.
+ QVector<Qt3DCore::QEntity *> entities = loader->entities();
+
+ if (entities.isEmpty())
+ return 0;
+
+ // Technically there could be multiple entities referencing the scene loader
+ // but sharing is discouraged, and in our case there will be one anyhow.
+ Qt3DCore::QEntity *root = entities[0];
+
+ // The scene structure and names always depend on the asset.
+ return root->findChild<Qt3DCore::QEntity *>(name);
+}
+
+QObject *SceneHelper::findComponent(Qt3DCore::QEntity *entity, const QString &componentMetatype)
+{
+ Q_ASSERT(entity);
+ Qt3DCore::QComponentVector components = entity->components();
+ Q_FOREACH (Qt3DCore::QComponent *component, components) {
+ qDebug() << component->metaObject()->className();
+ if (component->metaObject()->className() == componentMetatype) {
+ return component;
+ }
+ }
+ return nullptr;
+}
+
+void SceneHelper::addListEntry(const QVariant &list, QObject *entry)
+{
+ QQmlListReference ref = list.value<QQmlListReference>();
+ ref.append(entry);
+}
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ qmlRegisterType<SceneHelper>("Qt3D.Examples", 2, 0, "SceneHelper");
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/tests/manual/assimp/main.qml b/tests/manual/assimp/main.qml
new file mode 100644
index 000000000..f3ea3c7a5
--- /dev/null
+++ b/tests/manual/assimp/main.qml
@@ -0,0 +1,214 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0 as Quick
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Examples 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity
+{
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ FirstPersonCameraController {
+ camera: camera
+ }
+
+ // test_scene.dae contains three named nodes. Once the asynchronous loading of the
+ // scene completes, we look up some of them.
+ SceneHelper {
+ id: sceneHelper
+ }
+
+ Quick.Component {
+ id: animParamComp
+ Quick.SequentialAnimation {
+ id: seqAnim
+ loops: Quick.Animation.Infinite
+ property variant target: null
+ Quick.ColorAnimation {
+ target: seqAnim.target
+ property: "value"
+ from: Qt.rgba(0, 0, 0, 1)
+ to: Qt.rgba(1, 1, 1, 1)
+ duration: 2000
+ }
+ Quick.ColorAnimation {
+ target: seqAnim.target
+ property: "value"
+ from: Qt.rgba(1, 1, 1, 1)
+ to: Qt.rgba(0, 0, 0, 1)
+ duration: 1000
+ }
+ }
+ }
+
+ Quick.Component {
+ id: animRotComp
+ Quick.QtObject {
+ id: rotationData
+ property real userAngle: 0.0
+ property vector3d axis: Qt.vector3d(0, 0, 1)
+ Quick.NumberAnimation on userAngle {
+ from: 0
+ to: 360
+ duration: 5000
+ loops: Quick.Animation.Infinite
+ }
+ }
+ }
+
+ Entity {
+ components: [
+ Transform {
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.rotate(90, Qt.vector3d(0, 1, 0));
+ return m;
+ }
+ },
+ SceneLoader {
+ id: sceneLoader
+ source: "qrc:/assets/test_scene.dae"
+ onStatusChanged: {
+ console.log("SceneLoader status: " + status);
+ if (status == SceneLoader.Ready) {
+ console.log("Scene is ready");
+
+ // Now find the torus and animate one of the material effect's parameters.
+ var e = sceneHelper.findEntity(sceneLoader, "Torus");
+ console.log("Found entity: " + e + " its components are:");
+ for (var i = 0; i < e.components.length; ++i) {
+ console.log(" " + e.components[i]);
+ if (e.components[i].effect !== undefined) {
+ var p = e.components[i].effect.parameters;
+ for (var j = 0; j < p.length; ++j) {
+ if (p[j].name === "kd") {
+ var anim = animParamComp.createObject(p[j]);
+ anim.target = p[j];
+ anim.running = true;
+ break;
+ }
+ }
+
+ }
+ }
+
+ // Add an animated rotation transform to make Suzanne orbit around.
+ e = sceneHelper.findEntity(sceneLoader, "Suzanne");
+ var t = sceneHelper.findComponent(e, "Qt3DCore::QTransform");
+ if (!t)
+ return;
+
+ // Add object with animation data as a child
+ var suzanneAnim = animRotComp.createObject(t);
+
+ // Query the existing transformation. We will use parts of this in
+ // the replacement animation
+ var origTranslation = t.translation;
+ var origRotation = t.rotation;
+ var origScale = t.scale;
+ console.log("origTranslation = " + origTranslation);
+ console.log("origRotation = " + origRotation);
+ console.log("origScale = " + origScale);
+
+ // Make a deep copy of the original translation. This will not be updated when the
+ // transformation's translation property gets updated due to the animation.
+ var constantTranslation = Qt.vector3d(origTranslation.x, origTranslation.y, origTranslation.z);
+
+ t.matrix = Qt.binding(function() {
+ var m = Qt.matrix4x4();
+ m.rotate(suzanneAnim.userAngle, suzanneAnim.axis);
+ m.translate(constantTranslation);
+ m.rotate(90, Qt.vector3d(1, 0, 0));
+ m.scale(origScale);
+ return m;
+ })
+ }
+ }
+ }
+ ]
+ }
+
+ Entity {
+ components: [
+ Transform {
+ scale: 0.2
+ translation: Qt.vector3d(0.0, -15.0, 0.0)
+ },
+ SceneLoader {
+ source: "qrc:/assets/chest/Chest.obj"
+ }
+ ]
+ }
+}
diff --git a/tests/manual/bigmodel-qml/MyEntity.qml b/tests/manual/bigmodel-qml/MyEntity.qml
new file mode 100644
index 000000000..c2c7e5d7c
--- /dev/null
+++ b/tests/manual/bigmodel-qml/MyEntity.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+ property string name: "Entity"
+ property alias position: transform.translation
+ property alias diffuse: material.diffuse
+
+ components: [
+ Transform { id: transform },
+ SphereMesh { radius: 2 },
+ PhongMaterial { id: material },
+ ObjectPicker {
+ onClicked: console.log("Clicked", root.name, pick.distance, pick.triangleIndex)
+ }
+ ]
+}
diff --git a/tests/manual/bigmodel-qml/bigmodel-qml.pro b/tests/manual/bigmodel-qml/bigmodel-qml.pro
new file mode 100644
index 000000000..54d0942e5
--- /dev/null
+++ b/tests/manual/bigmodel-qml/bigmodel-qml.pro
@@ -0,0 +1,18 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dextras 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ MyEntity.qml
+
+RESOURCES += \
+ bigmodel-qml.qrc
+
+DISTFILES += \
+ MyEntity.qml
diff --git a/examples/qt3d/bigmodel-qml/bigmodel-qml.qrc b/tests/manual/bigmodel-qml/bigmodel-qml.qrc
index 6cc293f70..6cc293f70 100644
--- a/examples/qt3d/bigmodel-qml/bigmodel-qml.qrc
+++ b/tests/manual/bigmodel-qml/bigmodel-qml.qrc
diff --git a/tests/manual/bigmodel-qml/doc/src/bigmodel-qml.qdoc b/tests/manual/bigmodel-qml/doc/src/bigmodel-qml.qdoc
new file mode 100644
index 000000000..194fcfde9
--- /dev/null
+++ b/tests/manual/bigmodel-qml/doc/src/bigmodel-qml.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example bigmodel-qml
+ \title Qt 3D: Big Model QML Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/bigmodel-qml/main.cpp b/tests/manual/bigmodel-qml/main.cpp
new file mode 100644
index 000000000..c004e2a45
--- /dev/null
+++ b/tests/manual/bigmodel-qml/main.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/bigmodel-qml/main.qml b/tests/manual/bigmodel-qml/main.qml
new file mode 100644
index 000000000..61d9d39a5
--- /dev/null
+++ b/tests/manual/bigmodel-qml/main.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+import QtQuick 2.2 as QQ2
+
+Entity {
+ id: sceneRoot
+
+ FirstPersonCameraController { camera: mainCamera }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph:ForwardRenderer {
+ camera: mainCamera
+ }
+ pickingSettings {
+ pickMethod: PickingSettings.TrianglePicking
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ Camera {
+ id: mainCamera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 22.5
+ aspectRatio: 16 / 9
+ nearPlane: 0.01
+ farPlane: 1000.0
+ position: Qt.vector3d( 0.0, 25.0, 40.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ }
+
+ QQ2.ListModel {
+ id: entityModel
+ QQ2.ListElement { emptyRole: 0 }
+ }
+
+ NodeInstantiator {
+ id: collection
+ property int _count: 0
+ property real spacing: 5
+ property int cols: 8
+ property int _rows: count / cols
+
+ model: entityModel
+ delegate: MyEntity {
+ id: myEntity
+ name: "E" + index
+ property real _lightness: 0.2 + 0.7 / collection._rows * Math.floor(index / collection.cols)
+ property real _hue: (index % collection.cols) / collection.cols
+ position: Qt.vector3d(collection.spacing * (index % collection.cols - 0.5 * (collection.cols - 1)),
+ 0.0,
+ collection.spacing * (Math.floor(index / collection.cols) - 0.5 * collection._rows));
+ diffuse: Qt.hsla( _hue, 0.5, _lightness, 1.0 )
+ }
+ }
+
+ QQ2.Timer {
+ interval: 1000
+ repeat: true
+ running: true
+ onTriggered: {
+ entityModel.append({});
+ }
+ }
+}
diff --git a/tests/manual/bigscene-cpp/bigscene-cpp.pro b/tests/manual/bigscene-cpp/bigscene-cpp.pro
new file mode 100644
index 000000000..5567f4e6a
--- /dev/null
+++ b/tests/manual/bigscene-cpp/bigscene-cpp.pro
@@ -0,0 +1,13 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dextras
+
+SOURCES += \
+ main.cpp \
+ entity.cpp
+
+HEADERS += \
+ entity.h
+
diff --git a/tests/manual/bigscene-cpp/doc/src/bigscene-cpp.qdoc b/tests/manual/bigscene-cpp/doc/src/bigscene-cpp.qdoc
new file mode 100644
index 000000000..f0b4e7e28
--- /dev/null
+++ b/tests/manual/bigscene-cpp/doc/src/bigscene-cpp.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example bigscene-cpp
+ \title Qt 3D: Big Scene C++ Example
+ \ingroup qt3d-examples-cpp
+*/
diff --git a/tests/manual/bigscene-cpp/entity.cpp b/tests/manual/bigscene-cpp/entity.cpp
new file mode 100644
index 000000000..9a4ecae3b
--- /dev/null
+++ b/tests/manual/bigscene-cpp/entity.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "entity.h"
+
+#include <Qt3DExtras/QCylinderMesh>
+#include <Qt3DExtras/QPhongMaterial>
+#include <Qt3DCore/QTransform>
+#include <QMatrix4x4>
+
+Entity::Entity(Qt3DCore::QNode *parent)
+ : QEntity(parent)
+ , m_transform(new Qt3DCore::QTransform())
+ , m_mesh(new Qt3DExtras::QCylinderMesh())
+ , m_material(new Qt3DExtras::QPhongMaterial())
+{
+ m_mesh->setRings(50.0f);
+ m_mesh->setSlices(30.0f);
+ m_mesh->setRadius(2.5f);
+ m_mesh->setLength(5.0f);
+
+ addComponent(m_mesh);
+ addComponent(m_transform);
+ addComponent(m_material);
+}
+
+void Entity::updateTransform()
+{
+ QMatrix4x4 m;
+ m.translate(m_position);
+ m.rotate(m_phi, QVector3D(1.0f, 0.0f, 0.0f));
+ m.rotate(m_theta, QVector3D(0.0f, 0.0f, 1.0f));
+ m_transform->setMatrix(m);
+}
+
+float Entity::theta() const
+{
+ return m_theta;
+}
+
+float Entity::phi() const
+{
+ return m_phi;
+}
+
+QVector3D Entity::position() const
+{
+ return m_position;
+}
+
+QColor Entity::diffuseColor() const
+{
+ return m_material->diffuse();
+}
+
+void Entity::setTheta(float theta)
+{
+ if (m_theta == theta)
+ return;
+
+ m_theta = theta;
+ emit thetaChanged(theta);
+ updateTransform();
+}
+
+void Entity::setPhi(float phi)
+{
+ if (m_phi == phi)
+ return;
+
+ m_phi = phi;
+ emit phiChanged(phi);
+ updateTransform();
+}
+
+void Entity::setPosition(QVector3D position)
+{
+ if (m_position == position)
+ return;
+
+ m_position = position;
+ emit positionChanged(position);
+ updateTransform();
+}
+
+void Entity::setDiffuseColor(QColor diffuseColor)
+{
+ if (m_material->diffuse() == diffuseColor)
+ return;
+
+ m_material->setDiffuse(diffuseColor);
+ emit diffuseColorChanged(diffuseColor);
+}
diff --git a/tests/manual/bigscene-cpp/entity.h b/tests/manual/bigscene-cpp/entity.h
new file mode 100644
index 000000000..04dcbbcb3
--- /dev/null
+++ b/tests/manual/bigscene-cpp/entity.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ENTITY_H
+#define ENTITY_H
+
+#include <Qt3DCore/QEntity>
+#include <QtGui/QColor>
+#include <QtGui/QVector3D>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DCore {
+class QTransform;
+}
+
+namespace Qt3DExtras {
+class QCylinderMesh;
+class QPhongMaterial;
+}
+
+QT_END_NAMESPACE
+
+class Entity : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+ Q_PROPERTY(float theta READ theta WRITE setTheta NOTIFY thetaChanged)
+ Q_PROPERTY(float phi READ phi WRITE setPhi NOTIFY phiChanged)
+ Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged)
+ Q_PROPERTY(QColor diffuseColor READ diffuseColor WRITE setDiffuseColor NOTIFY diffuseColorChanged)
+
+public:
+ Entity(Qt3DCore::QNode *parent = 0);
+
+ float theta() const;
+ float phi() const;
+ QVector3D position() const;
+ QColor diffuseColor() const;
+
+public slots:
+ void setTheta(float theta);
+ void setPhi(float phi);
+ void setPosition(QVector3D position);
+ void setDiffuseColor(QColor diffuseColor);
+
+signals:
+ void thetaChanged(float theta);
+ void phiChanged(float phi);
+ void positionChanged(QVector3D position);
+ void diffuseColorChanged(QColor diffuseColor);
+
+private:
+ void updateTransform();
+
+private:
+ Qt3DCore::QTransform *m_transform;
+ Qt3DExtras::QCylinderMesh *m_mesh;
+ Qt3DExtras::QPhongMaterial *m_material;
+ float m_theta;
+ float m_phi;
+ QVector3D m_position;
+};
+
+#endif // ENTITY_H
diff --git a/tests/manual/bigscene-cpp/main.cpp b/tests/manual/bigscene-cpp/main.cpp
new file mode 100644
index 000000000..95b198f58
--- /dev/null
+++ b/tests/manual/bigscene-cpp/main.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "entity.h"
+
+#include <QGuiApplication>
+
+#include <QPropertyAnimation>
+#include <QUrl>
+#include <QTimer>
+#include <Qt3DCore/QEntity>
+#include <Qt3DRender/QCamera>
+#include <Qt3DCore/QTransform>
+#include <Qt3DCore/qaspectengine.h>
+#include <Qt3DInput/QInputAspect>
+#include <Qt3DRender/QParameter>
+#include <Qt3DExtras//QCylinderMesh>
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DRender/QCameraSelector>
+#include <Qt3DExtras/QPhongMaterial>
+#include <Qt3DExtras/QForwardRenderer>
+#include <qmath.h>
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qfirstpersoncameracontroller.h>
+
+using namespace Qt3DCore;
+using namespace Qt3DRender;
+
+int main(int ac, char **av)
+{
+ QGuiApplication app(ac, av);
+ Qt3DExtras::Qt3DWindow view;
+ view.defaultFramegraph()->setClearColor(Qt::black);
+
+ QEntity *root = new QEntity();
+
+ // Camera
+ QCamera *cameraEntity = view.camera();
+ cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
+ cameraEntity->setPosition(QVector3D(0, 250.0f, 50.0f));
+ cameraEntity->setUpVector(QVector3D(0, 1, 0));
+ cameraEntity->setViewCenter(QVector3D(0, 0, 0));
+
+ // For camera controls
+ Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(root);
+ camController->setCamera(cameraEntity);
+
+ const float radius = 100.0f;
+ const int max = 1000;
+ const float det = 1.0f / max;
+
+ // Scene
+ for (int i = 0; i < max; i++) {
+ Entity *e = new Entity();
+ const float angle = M_PI * 2.0f * i * det * 10.;
+
+ e->setDiffuseColor(QColor(qFabs(qCos(angle)) * 255, 204, 75));
+ e->setPosition(QVector3D(radius * qCos(angle), -200.* i * det, radius * qSin(angle)));
+ e->setTheta(30.0f * i);
+ e->setPhi(45.0f * i);
+
+ QPropertyAnimation *animX = new QPropertyAnimation(e, QByteArrayLiteral("theta"));
+ animX->setDuration(2400 * (i + 1));
+ animX->setStartValue(QVariant::fromValue(i * 30.0f));
+ animX->setEndValue(QVariant::fromValue((i + 1) * 390.0f));
+ animX->setLoopCount(-1);
+ animX->start();
+
+ QPropertyAnimation *animZ = new QPropertyAnimation(e, QByteArrayLiteral("phi"));
+ animZ->setDuration(2400 * (i + 1));
+ animZ->setStartValue(QVariant::fromValue(i * 20.0f));
+ animZ->setEndValue(QVariant::fromValue((i + 1) * 380.0f));
+ animZ->setLoopCount(-1);
+ animZ->start();
+
+ e->setParent(root);
+ }
+
+ view.setRootEntity(root);
+ view.show();
+
+ if (app.arguments().contains(("--bench")))
+ QTimer::singleShot(25 * 1000, &app, &QCoreApplication::quit);
+
+ return app.exec();
+}
diff --git a/tests/manual/bigscene-instanced-qml/bigscene-instanced-qml.pro b/tests/manual/bigscene-instanced-qml/bigscene-instanced-qml.pro
new file mode 100644
index 000000000..0c5b1763e
--- /dev/null
+++ b/tests/manual/bigscene-instanced-qml/bigscene-instanced-qml.pro
@@ -0,0 +1,12 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += qml quick 3dcore 3drender 3dinput 3dquick 3dextras 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+
+RESOURCES += \
+ bigscene-instanced-qml.qrc
diff --git a/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.qrc b/tests/manual/bigscene-instanced-qml/bigscene-instanced-qml.qrc
index 3e4910f7a..3e4910f7a 100644
--- a/examples/qt3d/bigscene-instanced-qml/bigscene-instanced-qml.qrc
+++ b/tests/manual/bigscene-instanced-qml/bigscene-instanced-qml.qrc
diff --git a/examples/qt3d/bigscene-instanced-qml/instanced.frag b/tests/manual/bigscene-instanced-qml/instanced.frag
index 0efd52b32..0efd52b32 100644
--- a/examples/qt3d/bigscene-instanced-qml/instanced.frag
+++ b/tests/manual/bigscene-instanced-qml/instanced.frag
diff --git a/examples/qt3d/bigscene-instanced-qml/instanced.vert b/tests/manual/bigscene-instanced-qml/instanced.vert
index f713957e3..f713957e3 100644
--- a/examples/qt3d/bigscene-instanced-qml/instanced.vert
+++ b/tests/manual/bigscene-instanced-qml/instanced.vert
diff --git a/tests/manual/bigscene-instanced-qml/main.cpp b/tests/manual/bigscene-instanced-qml/main.cpp
new file mode 100644
index 000000000..70a8ec467
--- /dev/null
+++ b/tests/manual/bigscene-instanced-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/bigscene-instanced-qml/main.qml b/tests/manual/bigscene-instanced-qml/main.qml
new file mode 100644
index 000000000..ea804963a
--- /dev/null
+++ b/tests/manual/bigscene-instanced-qml/main.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import QtQuick 2.2 as QQ2
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d(0.0, -300.0, 50.0)
+ upVector: Qt.vector3d(0.0, 1.0, 0.0)
+ viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
+ }
+
+ FirstPersonCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
+ // we need to explicitly set the RenderPolicy to AlwaysRender here,
+ // because a vertex shader will use time-based rendering, so the
+ // scene will change every frame without the scene-graph changing.
+ // RenderOnDemand would therefore not render every frame, as it won't
+ // detect scene-graph changes
+ renderPolicy: RenderSettings.Always
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ property real timeValue: 5
+
+ Material {
+ id: instancedPhongMaterial
+ effect: Effect {
+ techniques: Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ minorVersion: 2
+ majorVersion: 3
+ }
+ filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
+ renderPasses: RenderPass {
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/instanced.vert")
+ fragmentShaderCode: loadSource("qrc:/instanced.frag")
+ }
+ }
+ }
+ }
+ parameters: Parameter { name: "instanceCount"; value: cylinderMeshInstanced.instanceCount }
+ }
+
+ CylinderMesh {
+ id: cylinderMeshInstanced
+ instanceCount: 2000
+ rings: 50
+ slices: 30
+ radius: 2.5
+ length: 5.0
+ }
+
+ Entity {
+ id: torusEntity
+ components: [ cylinderMeshInstanced, instancedPhongMaterial ]
+ }
+}
diff --git a/tests/manual/clip-planes-qml/CappingMaterialEffect.qml b/tests/manual/clip-planes-qml/CappingMaterialEffect.qml
new file mode 100644
index 000000000..512e9f920
--- /dev/null
+++ b/tests/manual/clip-planes-qml/CappingMaterialEffect.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Effect {
+
+ property ShaderData sectionsData;
+
+ parameters: [
+ Parameter { name: "ka"; value: "black" },
+ Parameter { name: "kd"; value: "blue" },
+ Parameter { name: "ks"; value: "white" },
+ Parameter { name: "shininess"; value: 100 },
+ Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
+ Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) },
+ Parameter { name: "sectionsData"; value: sectionsData }
+ ]
+
+ techniques: [
+ Technique {
+
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 3
+ minorVersion: 2
+ }
+
+ renderPasses: [
+ // Capping pass: generate planes given clipping plane equations
+ // to be rendered with the phong material
+ RenderPass {
+ filterKeys: FilterKey { name: "pass"; value: "capping" }
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/capping.vert")
+ geometryShaderCode: loadSource("qrc:/capping.geom")
+ fragmentShaderCode: loadSource("qrc:/capping.frag")
+ }
+ }
+ ]
+ }
+ ]
+}
+
diff --git a/tests/manual/clip-planes-qml/ClipCappingFrameGraph.qml b/tests/manual/clip-planes-qml/ClipCappingFrameGraph.qml
new file mode 100644
index 000000000..d1316ab66
--- /dev/null
+++ b/tests/manual/clip-planes-qml/ClipCappingFrameGraph.qml
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Viewport {
+ id: root
+ property alias camera: cameraSelector.camera
+ property alias window: surfaceSelector.surface
+ property alias clearColor: clearBuffer.clearColor
+
+ readonly property Layer contentLayer: Layer {}
+ readonly property Layer visualizationLayer: Layer {}
+ readonly property Layer capsLayer: Layer {}
+
+ RenderSurfaceSelector {
+ id: surfaceSelector
+
+ CameraSelector {
+ id: cameraSelector
+
+ RenderStateSet {
+ // Enable 3 clipping planes
+ renderStates: [
+ ClipPlane { planeIndex: 0 },
+ ClipPlane { planeIndex: 1 },
+ ClipPlane { planeIndex: 2 },
+ DepthTest { depthFunction: DepthTest.LessOrEqual }
+ ]
+
+ // Branch 1
+ LayerFilter {
+ // Render entities with their regular material
+ // Fills depth buffer for entities that are clipped
+ layers: [root.contentLayer, root.visualizationLayer]
+ ClearBuffers {
+ id: clearBuffer
+ buffers: ClearBuffers.ColorDepthBuffer
+ RenderPassFilter {
+ matchAny: FilterKey { name: "pass"; value: "material" }
+ }
+ }
+ }
+
+ // Branch 2
+ ClearBuffers {
+ // Enable and fill Stencil to later generate caps
+ buffers: ClearBuffers.StencilBuffer
+ RenderStateSet {
+ // Disable depth culling
+ // Incr for back faces
+ // Decr for front faces
+ // No need to output color values
+ renderStates: [
+ StencilTest {
+ front {
+ stencilFunction: StencilTestArguments.Always
+ referenceValue: 0; comparisonMask: 0
+ }
+ back {
+ stencilFunction: StencilTestArguments.Always
+ referenceValue: 0; comparisonMask: 0
+ }
+ },
+ StencilOperation {
+ front.allTestsPassOperation: StencilOperationArguments.Decrement
+ back.allTestsPassOperation: StencilOperationArguments.Increment
+ },
+ ColorMask { redMasked: false; greenMasked: false; blueMasked: false; alphaMasked: false }
+ ]
+
+ LayerFilter {
+ layers: root.contentLayer
+ RenderPassFilter {
+ matchAny: FilterKey { name: "pass"; value: "stencilFill"; }
+ }
+ }
+ }
+ }
+ }
+
+ // Branch 3
+ RenderStateSet {
+ // Draw caps using stencil buffer
+ LayerFilter {
+ layers: root.capsLayer
+ RenderPassFilter {
+ matchAny: FilterKey { name: "pass"; value: "capping"; }
+ }
+ }
+
+ // Draw back faces - front faces -> caps
+ renderStates: [
+ StencilTest {
+ front {
+ stencilFunction: StencilTestArguments.NotEqual
+ referenceValue: 0; comparisonMask: ~0
+ }
+ back {
+ stencilFunction: StencilTestArguments.NotEqual
+ referenceValue: 0; comparisonMask: ~0
+ }
+ }
+ ]
+ }
+ }
+ }
+}
+
diff --git a/tests/manual/clip-planes-qml/ClipMaterialEffect.qml b/tests/manual/clip-planes-qml/ClipMaterialEffect.qml
new file mode 100644
index 000000000..7132831ed
--- /dev/null
+++ b/tests/manual/clip-planes-qml/ClipMaterialEffect.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Effect {
+
+ property ShaderData sectionsData;
+
+ parameters: [
+ Parameter { name: "ka"; value: "black" },
+ Parameter { name: "kd"; value: "blue" },
+ Parameter { name: "ks"; value: "white" },
+ Parameter { name: "shininess"; value: 100 },
+ Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
+ Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) },
+ Parameter { name: "sectionsData"; value: sectionsData }
+ ]
+
+ techniques: [
+ Technique {
+
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 3
+ minorVersion: 2
+ }
+
+ renderPasses: [
+
+ // Draw mesh with PhongMaterial and additional clipping planes
+ RenderPass {
+ filterKeys: FilterKey { name: "pass"; value: "material" }
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/phong-clip.vert")
+ fragmentShaderCode: loadSource("qrc:/phong-clip.frag")
+ }
+ },
+
+ // Basic stencil fill pass
+ RenderPass {
+ filterKeys: FilterKey { name: "pass"; value: "stencilFill" }
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/phong-clip.vert")
+ fragmentShaderCode: loadSource("qrc:/passthrough.frag")
+ }
+ }
+ ]
+ }
+ ]
+}
+
diff --git a/tests/manual/clip-planes-qml/ClipPlaneEntity.qml b/tests/manual/clip-planes-qml/ClipPlaneEntity.qml
new file mode 100644
index 000000000..4bd2028b6
--- /dev/null
+++ b/tests/manual/clip-planes-qml/ClipPlaneEntity.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+ property Layer layer
+ property Material visualMaterial;
+ property real rotateAngle: 0.0
+ property vector3d rotateAxis: Qt.vector3d(1.0, 0.0, 0.0)
+ property vector3d center;
+ property vector3d normal;
+ readonly property vector4d equation: Qt.vector4d(normal.x,
+ normal.y,
+ normal.z,
+ -(normal.x * center.x +
+ normal.y * center.y +
+ normal.z * center.z))
+
+ PlaneMesh {
+ id: mesh
+ width: 20.0
+ height: 20.0
+ meshResolution: Qt.size(2, 2)
+ }
+
+ Transform {
+ id: transform
+ translation: root.center
+ rotation: fromAxisAndAngle(root.rotateAxis, root.rotateAngle)
+ }
+
+ components: [visualMaterial, mesh, transform, layer]
+}
+
diff --git a/tests/manual/clip-planes-qml/ClippingPlanes.qml b/tests/manual/clip-planes-qml/ClippingPlanes.qml
new file mode 100644
index 000000000..62deabc73
--- /dev/null
+++ b/tests/manual/clip-planes-qml/ClippingPlanes.qml
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+ property Layer capsLayer
+ property Layer visualizationLayer
+
+ property ShaderData sectionData: ShaderData {
+ property real sectionsCount: 3
+ property ShaderDataArray sections: ShaderDataArray {
+ ShaderData {
+ property vector4d equation: clipPlane0.equation
+ property vector3d center: clipPlane0.center
+ }
+ ShaderData {
+ property vector4d equation: clipPlane1.equation
+ property vector3d center: clipPlane1.center
+ }
+ ShaderData {
+ property vector4d equation: clipPlane2.equation
+ property vector3d center: clipPlane2.center
+ }
+ }
+ }
+
+ Entity {
+ property Material cappingMaterial: Material {
+ effect: CappingMaterialEffect {
+ sectionsData: root.sectionData
+ }
+ }
+
+ property PlaneMesh mesh: PlaneMesh {
+ width: 20.0
+ height: 20.0
+ meshResolution: Qt.size(2, 2)
+ }
+
+ components: [cappingMaterial, mesh, root.capsLayer]
+ }
+
+ PlaneVisualizationMaterial {
+ id: clipPlanesMaterial
+ alpha: 0.5
+ }
+
+ // XZ
+ ClipPlaneEntity {
+ id: clipPlane0
+ layer: root.visualizationLayer
+ visualMaterial: clipPlanesMaterial
+ center: Qt.vector3d(0, -10, 0)
+ normal: Qt.vector3d(0, -1.0, 0)
+ }
+ // XY
+ ClipPlaneEntity {
+ id: clipPlane1
+ layer: root.visualizationLayer
+ visualMaterial: clipPlanesMaterial
+ center: Qt.vector3d(0, 0, 10)
+ normal: Qt.vector3d(0, 0, -1.0)
+ rotateAxis: Qt.vector3d(1.0, 0.0, 0.0)
+ rotateAngle: 90
+ }
+
+ // YZ
+ ClipPlaneEntity {
+ id: clipPlane2
+ layer: root.visualizationLayer
+ visualMaterial: clipPlanesMaterial
+ center: Qt.vector3d(-10, 0, 0)
+ normal: Qt.vector3d(1.0, 0, 0)
+ rotateAxis: Qt.vector3d(0.0, 0.0, 1.0)
+ rotateAngle: -90
+ }
+
+ QQ2.SequentialAnimation {
+ running: true
+ loops: QQ2.Animation.Infinite
+ QQ2.NumberAnimation {
+ target: clipPlane0
+ property: "center.y"
+ from: 10
+ to: 0
+ duration: 2000
+ easing.type: QQ2.Easing.InOutQuart
+ }
+
+ QQ2.NumberAnimation {
+ target: clipPlane1
+ property: "center.z"
+ from: 10
+ to: 0
+ duration: 2000
+ easing.type: QQ2.Easing.InOutQuart
+ }
+ QQ2.NumberAnimation {
+ target: clipPlane2
+ property: "center.x"
+ from: -10
+ to: 0
+ duration: 4000
+ easing.type: QQ2.Easing.InOutQuart
+ }
+ QQ2.NumberAnimation {
+ target: clipPlane1
+ property: "center.z"
+ from: 0
+ to: 10
+ duration: 4000
+ easing.type: QQ2.Easing.InOutQuint
+ }
+ QQ2.NumberAnimation {
+ target: clipPlane0
+ property: "center.y"
+ from: 0
+ to: 10
+ duration: 2000
+ easing.type: QQ2.Easing.InOutQuint
+ }
+ QQ2.NumberAnimation {
+ target: clipPlane2
+ property: "center.x"
+ from: 0
+ to: -10
+ duration: 2000
+ easing.type: QQ2.Easing.InOutQuint
+ }
+ }
+}
diff --git a/tests/manual/clip-planes-qml/PlaneVisualizationMaterial.qml b/tests/manual/clip-planes-qml/PlaneVisualizationMaterial.qml
new file mode 100644
index 000000000..72903c9d2
--- /dev/null
+++ b/tests/manual/clip-planes-qml/PlaneVisualizationMaterial.qml
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id:root
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
+ property color specular: Qt.rgba( 0.95, 0.95, 0.95, 1.0 )
+ property real shininess: 150.0
+ property real alpha: 0.5
+
+
+ ShaderProgram {
+ id: gl3PhongAlphaShader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/phong.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/phongalpha.frag")
+ }
+
+ ShaderProgram {
+ id: gl2es2PhongAlphaShader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/phong.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/phongalpha.frag")
+ }
+
+ effect: Effect {
+
+ parameters: [
+ Parameter { name: "alpha"; value: root.alpha },
+ Parameter { name: "ka"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter { name: "kd"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
+ Parameter { name: "ks"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "shininess"; value: root.shininess },
+ Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
+ Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) }
+ ]
+
+ techniques: [
+ // GL 3 Technique
+ Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3PhongAlphaShader
+ renderStates: [
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ },
+ BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+ filterKeys: FilterKey { name: "pass"; value: "material" }
+ }
+ },
+
+ // GL 2 Technique
+ Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2PhongAlphaShader
+ renderStates: [
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ },
+ BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+ filterKeys: FilterKey { name: "pass"; value: "material" }
+ }
+ }
+ ]
+ }
+}
+
diff --git a/examples/qt3d/clip-planes-qml/capping.frag b/tests/manual/clip-planes-qml/capping.frag
index 78c94b1d7..78c94b1d7 100644
--- a/examples/qt3d/clip-planes-qml/capping.frag
+++ b/tests/manual/clip-planes-qml/capping.frag
diff --git a/examples/qt3d/clip-planes-qml/capping.geom b/tests/manual/clip-planes-qml/capping.geom
index a34d5e87b..a34d5e87b 100644
--- a/examples/qt3d/clip-planes-qml/capping.geom
+++ b/tests/manual/clip-planes-qml/capping.geom
diff --git a/examples/qt3d/clip-planes-qml/capping.vert b/tests/manual/clip-planes-qml/capping.vert
index 6c270c418..6c270c418 100644
--- a/examples/qt3d/clip-planes-qml/capping.vert
+++ b/tests/manual/clip-planes-qml/capping.vert
diff --git a/tests/manual/clip-planes-qml/clip-planes-qml.pro b/tests/manual/clip-planes-qml/clip-planes-qml.pro
new file mode 100644
index 000000000..869d95a1d
--- /dev/null
+++ b/tests/manual/clip-planes-qml/clip-planes-qml.pro
@@ -0,0 +1,11 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += qml quick 3dcore 3drender 3dinput 3dquick 3dquickextras
+
+SOURCES += main.cpp
+
+RESOURCES += \
+ clip-planes-qml.qrc \
+ ../../../examples/qt3d/exampleresources/obj.qrc
diff --git a/examples/qt3d/clip-planes-qml/clip-planes-qml.qrc b/tests/manual/clip-planes-qml/clip-planes-qml.qrc
index 54a145a14..54a145a14 100644
--- a/examples/qt3d/clip-planes-qml/clip-planes-qml.qrc
+++ b/tests/manual/clip-planes-qml/clip-planes-qml.qrc
diff --git a/tests/manual/clip-planes-qml/main.cpp b/tests/manual/clip-planes-qml/main.cpp
new file mode 100644
index 000000000..aa7e240fd
--- /dev/null
+++ b/tests/manual/clip-planes-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/clip-planes-qml/main.qml b/tests/manual/clip-planes-qml/main.qml
new file mode 100644
index 000000000..4ab043285
--- /dev/null
+++ b/tests/manual/clip-planes-qml/main.qml
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Paul Lemire
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 800/600
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ FirstPersonCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ ClipCappingFrameGraph {
+ id: frameGraph
+ camera: camera;
+ clearColor: Qt.rgba(0.0, 0.5, 1, 1)
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ ClipMaterialEffect {
+ id: clipMaterialEffect
+ sectionsData: clippingPlanes.sectionData
+ }
+
+ ClippingPlanes {
+ id: clippingPlanes
+ visualizationLayer: frameGraph.visualizationLayer
+ capsLayer: frameGraph.contentLayer
+ }
+
+ // Entity being clipped
+ Entity {
+
+ property Material material: Material {
+ effect: clipMaterialEffect
+ parameters: [
+ Parameter { name: "ka"; value: "black" },
+ Parameter { name: "kd"; value: "blue" },
+ Parameter { name: "ks"; value: "white" }
+ ]
+ }
+
+ property Mesh mesh: Mesh {
+ source: "assets/obj/trefoil.obj"
+ }
+
+ property Transform transform: Transform {
+ translation: Qt.vector3d( 0.0, 0.0, 0.0 )
+ scale: 3
+ }
+
+ components: [material, transform, mesh, frameGraph.contentLayer]
+ }
+}
diff --git a/examples/qt3d/clip-planes-qml/passthrough.frag b/tests/manual/clip-planes-qml/passthrough.frag
index ab8310e07..ab8310e07 100644
--- a/examples/qt3d/clip-planes-qml/passthrough.frag
+++ b/tests/manual/clip-planes-qml/passthrough.frag
diff --git a/examples/qt3d/clip-planes-qml/phong-clip.frag b/tests/manual/clip-planes-qml/phong-clip.frag
index 96cb19a33..96cb19a33 100644
--- a/examples/qt3d/clip-planes-qml/phong-clip.frag
+++ b/tests/manual/clip-planes-qml/phong-clip.frag
diff --git a/examples/qt3d/clip-planes-qml/phong-clip.vert b/tests/manual/clip-planes-qml/phong-clip.vert
index 29955bb3d..29955bb3d 100644
--- a/examples/qt3d/clip-planes-qml/phong-clip.vert
+++ b/tests/manual/clip-planes-qml/phong-clip.vert
diff --git a/tests/manual/component-changes/component-changes.pro b/tests/manual/component-changes/component-changes.pro
new file mode 100644
index 000000000..d3db3bc76
--- /dev/null
+++ b/tests/manual/component-changes/component-changes.pro
@@ -0,0 +1,9 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dextras
+
+SOURCES += main.cpp
+
+
diff --git a/tests/manual/component-changes/doc/src/component-changes.qdoc b/tests/manual/component-changes/doc/src/component-changes.qdoc
new file mode 100644
index 000000000..e3ee77ce7
--- /dev/null
+++ b/tests/manual/component-changes/doc/src/component-changes.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example component-changes
+ \title Qt 3D: Component Changes C++ Example
+ \ingroup qt3d-examples-cpp
+*/
diff --git a/tests/manual/component-changes/main.cpp b/tests/manual/component-changes/main.cpp
new file mode 100644
index 000000000..32f95d7b5
--- /dev/null
+++ b/tests/manual/component-changes/main.cpp
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+
+#include <Qt3DRender/qcamera.h>
+#include <Qt3DExtras/qcylindermesh.h>
+#include <Qt3DExtras/qspheremesh.h>
+#include <Qt3DExtras/qphongmaterial.h>
+
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qtransform.h>
+
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qorbitcameracontroller.h>
+
+#include <QTimer>
+
+class ComponentSwapper : public QObject
+{
+ Q_OBJECT
+public:
+ ComponentSwapper(Qt3DCore::QEntity *entity,
+ Qt3DCore::QComponent *component1,
+ Qt3DCore::QComponent *component2,
+ QObject * parent = nullptr)
+ : QObject(parent)
+ , m_entity(entity)
+ , m_component1(component1)
+ , m_component2(component2)
+ , m_currentComponent(component1)
+ {
+ // Set initial state
+ m_entity->addComponent(m_component1);
+ }
+
+public slots:
+ void swapComponents()
+ {
+ if (m_currentComponent == m_component1) {
+ m_entity->removeComponent(m_component1);
+ m_entity->addComponent(m_component2);
+ m_currentComponent = m_component2;
+ } else {
+ m_entity->removeComponent(m_component2);
+ m_entity->addComponent(m_component1);
+ m_currentComponent = m_component1;
+ }
+ }
+
+private:
+ Qt3DCore::QEntity *m_entity;
+ Qt3DCore::QComponent *m_component1;
+ Qt3DCore::QComponent *m_component2;
+ Qt3DCore::QComponent *m_currentComponent;
+};
+
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Qt3DWindow view;
+
+ // Root entity
+ Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
+
+ // Camera
+ Qt3DRender::QCamera *camera = view.camera();
+ camera->setPosition(QVector3D(0, 0, 20.0f));
+ camera->setViewCenter(QVector3D(0, 0, 0));
+
+ // For camera controls
+ Qt3DExtras::QOrbitCameraController *cameraController = new Qt3DExtras::QOrbitCameraController(rootEntity);
+ cameraController->setCamera(camera);
+
+ // Cylinder mesh data
+ Qt3DExtras::QCylinderMesh *cylinderMesh = new Qt3DExtras::QCylinderMesh();
+ cylinderMesh->setRadius(1);
+ cylinderMesh->setLength(3);
+ cylinderMesh->setRings(5);
+ cylinderMesh->setSlices(40);
+
+ // Sphere mesh data
+ Qt3DExtras::QSphereMesh *sphereMesh = new Qt3DExtras::QSphereMesh();
+ sphereMesh->setRings(20);
+ sphereMesh->setSlices(40);
+
+ // Transform for cylinder
+ Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
+ transform->setScale(1.5f);
+ transform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), 45.0f));
+
+ // Material
+ Qt3DExtras::QPhongMaterial *material = new Qt3DExtras::QPhongMaterial(rootEntity);
+ material->setDiffuse(Qt::red);
+
+ // Cylinder
+ Qt3DCore::QEntity *cylinder = new Qt3DCore::QEntity(rootEntity);
+ cylinder->addComponent(transform);
+ cylinder->addComponent(material);
+
+ // Set root object of the scene
+ view.setRootEntity(rootEntity);
+ view.show();
+
+ ComponentSwapper *swapper = new ComponentSwapper(cylinder, cylinderMesh, sphereMesh);
+ QTimer *timer = new QTimer;
+ QObject::connect(timer, SIGNAL(timeout()), swapper, SLOT(swapComponents()));
+ timer->start(2000);
+
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/tests/manual/custom-mesh-cpp/custom-mesh-cpp.pro b/tests/manual/custom-mesh-cpp/custom-mesh-cpp.pro
new file mode 100644
index 000000000..04b2627cf
--- /dev/null
+++ b/tests/manual/custom-mesh-cpp/custom-mesh-cpp.pro
@@ -0,0 +1,8 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dextras
+
+SOURCES += \
+ main.cpp
diff --git a/tests/manual/custom-mesh-cpp/main.cpp b/tests/manual/custom-mesh-cpp/main.cpp
new file mode 100644
index 000000000..1544f3d01
--- /dev/null
+++ b/tests/manual/custom-mesh-cpp/main.cpp
@@ -0,0 +1,253 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+
+#include <Qt3DCore/QEntity>
+#include <Qt3DRender/QCamera>
+#include <Qt3DRender/QCameraLens>
+#include <Qt3DCore/QTransform>
+#include <Qt3DCore/QAspectEngine>
+
+#include <Qt3DInput/QInputAspect>
+
+#include <Qt3DRender/QRenderStateSet>
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DExtras/QForwardRenderer>
+#include <Qt3DExtras/QPerVertexColorMaterial>
+
+#include <Qt3DRender/QGeometryRenderer>
+#include <Qt3DRender/QGeometry>
+#include <Qt3DRender/QAttribute>
+#include <Qt3DRender/QBuffer>
+
+#include <QPropertyAnimation>
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qorbitcameracontroller.h>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Qt3DWindow view;
+ view.defaultFramegraph()->setClearColor(QColor::fromRgbF(0.0, 0.5, 1.0, 1.0));
+
+ // Root entity
+ Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
+
+ // Camera
+ Qt3DRender::QCamera *cameraEntity = view.camera();
+
+ cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
+ cameraEntity->setPosition(QVector3D(0, 0, 40.0f));
+ cameraEntity->setUpVector(QVector3D(0, 1, 0));
+ cameraEntity->setViewCenter(QVector3D(0, 0, 0));
+
+ // For camera controls
+ Qt3DExtras::QOrbitCameraController *camController = new Qt3DExtras::QOrbitCameraController(rootEntity);
+ camController->setCamera(cameraEntity);
+
+ // Material
+ Qt3DRender::QMaterial *material = new Qt3DExtras::QPerVertexColorMaterial(rootEntity);
+
+ // Torus
+ Qt3DCore::QEntity *customMeshEntity = new Qt3DCore::QEntity(rootEntity);
+
+ // Transform
+ Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
+ transform->setScale(8.0f);
+
+ // Custom Mesh (TetraHedron)
+ Qt3DRender::QGeometryRenderer *customMeshRenderer = new Qt3DRender::QGeometryRenderer;
+ Qt3DRender::QGeometry *customGeometry = new Qt3DRender::QGeometry(customMeshRenderer);
+
+ Qt3DRender::QBuffer *vertexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, customGeometry);
+ Qt3DRender::QBuffer *indexDataBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, customGeometry);
+
+ // vec3 for position
+ // vec3 for colors
+ // vec3 for normals
+
+ /* 2
+ /|\
+ / | \
+ / /3\ \
+ 0/___\ 1
+ */
+
+ // 4 distinct vertices
+ QByteArray vertexBufferData;
+ vertexBufferData.resize(4 * (3 + 3 + 3) * sizeof(float));
+
+ // Vertices
+ QVector3D v0(-1.0f, 0.0f, -1.0f);
+ QVector3D v1(1.0f, 0.0f, -1.0f);
+ QVector3D v2(0.0f, 1.0f, 0.0f);
+ QVector3D v3(0.0f, 0.0f, 1.0f);
+
+ // Faces Normals
+ QVector3D n023 = QVector3D::normal(v0, v2, v3);
+ QVector3D n012 = QVector3D::normal(v0, v1, v2);
+ QVector3D n310 = QVector3D::normal(v3, v1, v0);
+ QVector3D n132 = QVector3D::normal(v1, v3, v2);
+
+ // Vector Normals
+ QVector3D n0 = QVector3D(n023 + n012 + n310).normalized();
+ QVector3D n1 = QVector3D(n132 + n012 + n310).normalized();
+ QVector3D n2 = QVector3D(n132 + n012 + n023).normalized();
+ QVector3D n3 = QVector3D(n132 + n310 + n023).normalized();
+
+ // Colors
+ QVector3D red(1.0f, 0.0f, 0.0f);
+ QVector3D green(0.0f, 1.0f, 0.0f);
+ QVector3D blue(0.0f, 0.0f, 1.0f);
+ QVector3D white(1.0f, 1.0f, 1.0f);
+
+ QVector<QVector3D> vertices = QVector<QVector3D>()
+ << v0 << n0 << red
+ << v1 << n1 << blue
+ << v2 << n2 << green
+ << v3 << n3 << white;
+
+ float *rawVertexArray = reinterpret_cast<float *>(vertexBufferData.data());
+ int idx = 0;
+
+ Q_FOREACH (const QVector3D &v, vertices) {
+ rawVertexArray[idx++] = v.x();
+ rawVertexArray[idx++] = v.y();
+ rawVertexArray[idx++] = v.z();
+ }
+
+ // Indices (12)
+ QByteArray indexBufferData;
+ indexBufferData.resize(4 * 3 * sizeof(ushort));
+ ushort *rawIndexArray = reinterpret_cast<ushort *>(indexBufferData.data());
+
+ // Front
+ rawIndexArray[0] = 0;
+ rawIndexArray[1] = 1;
+ rawIndexArray[2] = 2;
+ // Bottom
+ rawIndexArray[3] = 3;
+ rawIndexArray[4] = 1;
+ rawIndexArray[5] = 0;
+ // Left
+ rawIndexArray[6] = 0;
+ rawIndexArray[7] = 2;
+ rawIndexArray[8] = 3;
+ // Right
+ rawIndexArray[9] = 1;
+ rawIndexArray[10] = 3;
+ rawIndexArray[11] = 2;
+
+ vertexDataBuffer->setData(vertexBufferData);
+ indexDataBuffer->setData(indexBufferData);
+
+ // Attributes
+ Qt3DRender::QAttribute *positionAttribute = new Qt3DRender::QAttribute();
+ positionAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
+ positionAttribute->setBuffer(vertexDataBuffer);
+ positionAttribute->setDataType(Qt3DRender::QAttribute::Float);
+ positionAttribute->setDataSize(3);
+ positionAttribute->setByteOffset(0);
+ positionAttribute->setByteStride(9 * sizeof(float));
+ positionAttribute->setCount(4);
+ positionAttribute->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
+
+ Qt3DRender::QAttribute *normalAttribute = new Qt3DRender::QAttribute();
+ normalAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
+ normalAttribute->setBuffer(vertexDataBuffer);
+ normalAttribute->setDataType(Qt3DRender::QAttribute::Float);
+ normalAttribute->setDataSize(3);
+ normalAttribute->setByteOffset(3 * sizeof(float));
+ normalAttribute->setByteStride(9 * sizeof(float));
+ normalAttribute->setCount(4);
+ normalAttribute->setName(Qt3DRender::QAttribute::defaultNormalAttributeName());
+
+ Qt3DRender::QAttribute *colorAttribute = new Qt3DRender::QAttribute();
+ colorAttribute->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
+ colorAttribute->setBuffer(vertexDataBuffer);
+ colorAttribute->setDataType(Qt3DRender::QAttribute::Float);
+ colorAttribute->setDataSize(3);
+ colorAttribute->setByteOffset(6 * sizeof(float));
+ colorAttribute->setByteStride(9 * sizeof(float));
+ colorAttribute->setCount(4);
+ colorAttribute->setName(Qt3DRender::QAttribute::defaultColorAttributeName());
+
+ Qt3DRender::QAttribute *indexAttribute = new Qt3DRender::QAttribute();
+ indexAttribute->setAttributeType(Qt3DRender::QAttribute::IndexAttribute);
+ indexAttribute->setBuffer(indexDataBuffer);
+ indexAttribute->setDataType(Qt3DRender::QAttribute::UnsignedShort);
+ indexAttribute->setDataSize(1);
+ indexAttribute->setByteOffset(0);
+ indexAttribute->setByteStride(0);
+ indexAttribute->setCount(12);
+
+ customGeometry->addAttribute(positionAttribute);
+ customGeometry->addAttribute(normalAttribute);
+ customGeometry->addAttribute(colorAttribute);
+ customGeometry->addAttribute(indexAttribute);
+
+ customMeshRenderer->setInstanceCount(1);
+ customMeshRenderer->setIndexOffset(0);
+ customMeshRenderer->setFirstInstance(0);
+ customMeshRenderer->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
+ customMeshRenderer->setGeometry(customGeometry);
+ // 4 faces of 3 points
+ customMeshRenderer->setVertexCount(12);
+
+ customMeshEntity->addComponent(customMeshRenderer);
+ customMeshEntity->addComponent(transform);
+ customMeshEntity->addComponent(material);
+
+ view.setRootEntity(rootEntity);
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/custom-mesh-qml/custom-mesh-qml.pro b/tests/manual/custom-mesh-qml/custom-mesh-qml.pro
new file mode 100644
index 000000000..3995fb2a1
--- /dev/null
+++ b/tests/manual/custom-mesh-qml/custom-mesh-qml.pro
@@ -0,0 +1,11 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick quick 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ custom-mesh-qml.qrc
diff --git a/examples/qt3d/custom-mesh-qml/custom-mesh-qml.qrc b/tests/manual/custom-mesh-qml/custom-mesh-qml.qrc
index 5f6483ac3..5f6483ac3 100644
--- a/examples/qt3d/custom-mesh-qml/custom-mesh-qml.qrc
+++ b/tests/manual/custom-mesh-qml/custom-mesh-qml.qrc
diff --git a/tests/manual/custom-mesh-qml/main.cpp b/tests/manual/custom-mesh-qml/main.cpp
new file mode 100644
index 000000000..41d2f08a5
--- /dev/null
+++ b/tests/manual/custom-mesh-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/custom-mesh-qml/main.qml b/tests/manual/custom-mesh-qml/main.qml
new file mode 100644
index 000000000..a68bf591f
--- /dev/null
+++ b/tests/manual/custom-mesh-qml/main.qml
@@ -0,0 +1,246 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ OrbitCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0.5, 0.5, 1, 1)
+ camera: camera
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ PerVertexColorMaterial {
+ id: material
+ }
+
+ function buildVertexBufferData()
+ {
+ // Vertices
+ var v0 = Qt.vector3d(-1.0, 0.0, -1.0)
+ var v1 = Qt.vector3d(1.0, 0.0, -1.0)
+ var v2 = Qt.vector3d(0.0, 1.0, 0.0)
+ var v3 = Qt.vector3d(0.0, 0.0, 1.0)
+
+ // Face Normals
+ function normal(v0, v1, v2) {
+ return v1.minus(v0).crossProduct(v2.minus(v0)).normalized();
+ }
+ var n023 = normal(v0, v2, v3)
+ var n012 = normal(v0, v1, v2)
+ var n310 = normal(v3, v1, v0)
+ var n132 = normal(v1, v3, v2)
+
+ // Vector normals
+ var n0 = n023.plus(n012).plus(n310).normalized()
+ var n1 = n132.plus(n012).plus(n310).normalized()
+ var n2 = n132.plus(n012).plus(n023).normalized()
+ var n3 = n132.plus(n310).plus(n023).normalized()
+
+ // Colors
+ var red = Qt.vector3d(1.0, 0.0, 0.0)
+ var green = Qt.vector3d(0.0, 1.0, 0.0)
+ var blue = Qt.vector3d(0.0, 0.0, 1.0)
+ var white = Qt.vector3d(1.0, 1.0, 1.0)
+
+ var vertices = [
+ v0, n0, red,
+ v1, n1, blue,
+ v2, n2, green,
+ v3, n3, white
+ ]
+
+ var vertexArray = new Float32Array(4 * (3 + 3 + 3));
+ var i = 0;
+
+ vertices.forEach(function(vec3) {
+ vertexArray[i++] = vec3.x;
+ vertexArray[i++] = vec3.y;
+ vertexArray[i++] = vec3.z;
+ });
+
+ return vertexArray;
+ }
+
+ function buildIndexBufferData()
+ {
+ var indexArray = new Uint16Array(12);
+
+ // Front
+ indexArray[0] = 0;
+ indexArray[1] = 1;
+ indexArray[2] = 2;
+ // Bottom
+ indexArray[3] = 3;
+ indexArray[4] = 1;
+ indexArray[5] = 0;
+ // Left
+ indexArray[6] = 0;
+ indexArray[7] = 2;
+ indexArray[8] = 3;
+ // Right
+ indexArray[9] = 1;
+ indexArray[10] = 3;
+ indexArray[11] = 2;
+
+ return indexArray;
+ }
+
+ GeometryRenderer {
+ id: customMesh
+ instanceCount: 1
+ indexOffset: 0
+ firstInstance: 0
+ primitiveType: GeometryRenderer.Triangles
+ Buffer {
+ id: vertexBuffer
+ type: Buffer.VertexBuffer
+ data: buildVertexBufferData()
+ }
+
+ Buffer {
+ id: indexBuffer
+ type: Buffer.IndexBuffer
+ data: buildIndexBufferData()
+ }
+ geometry: Geometry {
+ Attribute {
+ attributeType: Attribute.VertexAttribute
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
+ byteOffset: 0
+ byteStride: 9 * 4
+ count: 4
+ name: defaultPositionAttributeName()
+ buffer: vertexBuffer
+ }
+
+ Attribute {
+ attributeType: Attribute.VertexAttribute
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
+ byteOffset: 3 * 4
+ byteStride: 9 * 4
+ count: 4
+ name: defaultNormalAttributeName()
+ buffer: vertexBuffer
+ }
+
+ Attribute {
+ attributeType: Attribute.VertexAttribute
+ vertexBaseType: Attribute.Float
+ vertexSize: 3
+ byteOffset: 6 * 4
+ byteStride: 9 * 4
+ count: 4
+ name: defaultColorAttributeName()
+ buffer: vertexBuffer
+ }
+
+ Attribute {
+ attributeType: Attribute.IndexAttribute
+ vertexBaseType: Attribute.UnsignedShort
+ vertexSize: 1
+ byteOffset: 0
+ byteStride: 0
+ count: 12
+ buffer: indexBuffer
+ }
+ }
+ }
+
+ Transform {
+ id: meshTransform
+ property real userAngle: 0.0
+ scale: 10
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
+ }
+
+ QQ2.NumberAnimation {
+ target: meshTransform
+ property: "userAngle"
+ duration: 10000
+ from: 0
+ to: 360
+
+ loops: QQ2.Animation.Infinite
+ running: true
+ }
+
+ Entity {
+ id: sphereEntity
+ components: [ customMesh, material, meshTransform ]
+ }
+}
diff --git a/tests/manual/cylinder-cpp/cylinder-cpp.pro b/tests/manual/cylinder-cpp/cylinder-cpp.pro
new file mode 100644
index 000000000..d3db3bc76
--- /dev/null
+++ b/tests/manual/cylinder-cpp/cylinder-cpp.pro
@@ -0,0 +1,9 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dextras
+
+SOURCES += main.cpp
+
+
diff --git a/tests/manual/cylinder-cpp/doc/src/cylinder-cpp.qdoc b/tests/manual/cylinder-cpp/doc/src/cylinder-cpp.qdoc
new file mode 100644
index 000000000..ed1a53e9a
--- /dev/null
+++ b/tests/manual/cylinder-cpp/doc/src/cylinder-cpp.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example cylinder-cpp
+ \title Qt 3D: Cylinder C++ Example
+ \ingroup qt3d-examples-cpp
+*/
diff --git a/tests/manual/cylinder-cpp/main.cpp b/tests/manual/cylinder-cpp/main.cpp
new file mode 100644
index 000000000..33a85f32b
--- /dev/null
+++ b/tests/manual/cylinder-cpp/main.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+
+#include <Qt3DInput/QInputAspect>
+
+#include <Qt3DRender/qcamera.h>
+#include <Qt3DRender/qcameralens.h>
+#include <Qt3DExtras/qcylindermesh.h>
+#include <Qt3DRender/qmesh.h>
+#include <Qt3DRender/qtechnique.h>
+#include <Qt3DExtras/qphongmaterial.h>
+#include <Qt3DRender/qeffect.h>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/qrenderpass.h>
+#include <Qt3DRender/qrenderaspect.h>
+#include <Qt3DExtras/qforwardrenderer.h>
+
+#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/qtransform.h>
+#include <Qt3DCore/qaspectengine.h>
+
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qorbitcameracontroller.h>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Qt3DWindow view;
+
+ // Root entity
+ Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
+
+ // Camera
+ Qt3DRender::QCamera *camera = view.camera();
+ camera->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
+ camera->setPosition(QVector3D(0, 0, 20.0f));
+ camera->setUpVector(QVector3D(0, 1, 0));
+ camera->setViewCenter(QVector3D(0, 0, 0));
+
+ // For camera controls
+ Qt3DExtras::QOrbitCameraController *cameraController = new Qt3DExtras::QOrbitCameraController(rootEntity);
+ cameraController->setCamera(camera);
+
+ // Cylinder shape data
+ Qt3DExtras::QCylinderMesh *mesh = new Qt3DExtras::QCylinderMesh();
+ mesh->setRadius(1);
+ mesh->setLength(3);
+ mesh->setRings(100);
+ mesh->setSlices(20);
+
+ // Transform for cylinder
+ Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
+ transform->setScale(1.5f);
+ transform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1, 0, 0), 45.0f));
+
+ // Material
+ Qt3DExtras::QPhongMaterial *material = new Qt3DExtras::QPhongMaterial(rootEntity);
+ material->setDiffuse(Qt::red);
+
+ // Cylinder
+ Qt3DCore::QEntity *cylinder = new Qt3DCore::QEntity(rootEntity);
+ cylinder->addComponent(mesh);
+ cylinder->addComponent(transform);
+ cylinder->addComponent(material);
+
+ // Set root object of the scene
+ view.setRootEntity(rootEntity);
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/cylinder-qml/cylinder-qml.pro b/tests/manual/cylinder-qml/cylinder-qml.pro
new file mode 100644
index 000000000..1dbb79bb5
--- /dev/null
+++ b/tests/manual/cylinder-qml/cylinder-qml.pro
@@ -0,0 +1,14 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml
+
+RESOURCES += \
+ cylinder-qml.qrc
diff --git a/examples/qt3d/cylinder-qml/cylinder-qml.qrc b/tests/manual/cylinder-qml/cylinder-qml.qrc
index 5f6483ac3..5f6483ac3 100644
--- a/examples/qt3d/cylinder-qml/cylinder-qml.qrc
+++ b/tests/manual/cylinder-qml/cylinder-qml.qrc
diff --git a/tests/manual/cylinder-qml/doc/src/cylinder-qml.qdoc b/tests/manual/cylinder-qml/doc/src/cylinder-qml.qdoc
new file mode 100644
index 000000000..86e80705d
--- /dev/null
+++ b/tests/manual/cylinder-qml/doc/src/cylinder-qml.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example cylinder-qml
+ \title Qt 3D: Cylinder QML Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/cylinder-qml/main.cpp b/tests/manual/cylinder-qml/main.cpp
new file mode 100644
index 000000000..70a8ec467
--- /dev/null
+++ b/tests/manual/cylinder-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/cylinder-qml/main.qml b/tests/manual/cylinder-qml/main.qml
new file mode 100644
index 000000000..a5df8af44
--- /dev/null
+++ b/tests/manual/cylinder-qml/main.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 20.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ OrbitCameraController { camera: camera }
+
+ RenderSettings {
+ id : external_forward_renderer
+ activeFrameGraph : ForwardRenderer {
+ camera: camera
+ clearColor: "black"
+ }
+ }
+
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { id: inputSettings }
+
+ components: [external_forward_renderer, inputSettings]
+
+ CylinderMesh {
+ id: mesh
+ radius: 1
+ length: 3
+ rings: 100
+ slices: 20
+ }
+
+ Transform {
+ id: transform
+ scale: 1.5
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
+ }
+
+ PhongMaterial {
+ id: material
+ diffuse: "green"
+ }
+
+ Entity {
+ id: mainEntity
+ objectName: "mainEntity"
+ components: [ mesh, material, transform ]
+ }
+}
diff --git a/tests/manual/deferred-renderer-cpp/deferred-renderer-cpp.pro b/tests/manual/deferred-renderer-cpp/deferred-renderer-cpp.pro
new file mode 100644
index 000000000..579e61b68
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/deferred-renderer-cpp.pro
@@ -0,0 +1,33 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dextras
+
+HEADERS += \
+ gbuffer.h \
+ deferredrenderer.h \
+ finaleffect.h \
+ sceneeffect.h \
+ pointlightblock.h
+
+SOURCES += \
+ main.cpp \
+ gbuffer.cpp \
+ deferredrenderer.cpp \
+ finaleffect.cpp \
+ sceneeffect.cpp \
+ pointlightblock.cpp
+
+RESOURCES += \
+ deferred-renderer-cpp.qrc
+
+OTHER_FILES += \
+ geometry_gl2.vert \
+ geometry_gl2.frag \
+ geometry_gl3.frag \
+ geometry_gl3.vert \
+ final_gl2.vert \
+ final_gl2.frag \
+ final_gl3.frag \
+ final_gl3.vert
diff --git a/tests/manual/deferred-renderer-cpp/deferred-renderer-cpp.qrc b/tests/manual/deferred-renderer-cpp/deferred-renderer-cpp.qrc
new file mode 100644
index 000000000..0e38e39ca
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/deferred-renderer-cpp.qrc
@@ -0,0 +1,12 @@
+<RCC>
+ <qresource prefix="/">
+ <file>geometry_gl2.frag</file>
+ <file>geometry_gl2.vert</file>
+ <file>geometry_gl3.frag</file>
+ <file>geometry_gl3.vert</file>
+ <file>final_gl2.frag</file>
+ <file>final_gl2.vert</file>
+ <file>final_gl3.frag</file>
+ <file>final_gl3.vert</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp b/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp
new file mode 100644
index 000000000..391240108
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/deferredrenderer.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "deferredrenderer.h"
+
+
+DeferredRenderer::DeferredRenderer(Qt3DCore::QNode *parent)
+ : Qt3DRender::QViewport(parent)
+ , m_surfaceSelector(new Qt3DRender::QRenderSurfaceSelector(this))
+ , m_sceneFilter(new Qt3DRender::QLayerFilter(m_surfaceSelector))
+ , m_screenQuadFilter(new Qt3DRender::QLayerFilter(m_surfaceSelector))
+ , m_clearScreenQuad(new Qt3DRender::QClearBuffers(m_screenQuadFilter))
+ , m_gBufferTargetSelector(new Qt3DRender::QRenderTargetSelector(m_sceneFilter))
+ , m_clearGBuffer(new Qt3DRender::QClearBuffers(m_gBufferTargetSelector))
+ , m_geometryPassFilter(new Qt3DRender::QRenderPassFilter(m_clearGBuffer))
+ , m_finalPassFilter(new Qt3DRender::QRenderPassFilter(m_clearScreenQuad))
+ , m_sceneCameraSelector(new Qt3DRender::QCameraSelector(m_geometryPassFilter))
+{
+ m_clearGBuffer->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer);
+ m_clearScreenQuad->setBuffers(Qt3DRender::QClearBuffers::ColorDepthBuffer);
+}
+
+void DeferredRenderer::setSceneCamera(Qt3DCore::QEntity *camera)
+{
+ m_sceneCameraSelector->setCamera(camera);
+}
+
+void DeferredRenderer::setGBuffer(Qt3DRender::QRenderTarget *gBuffer)
+{
+ m_gBufferTargetSelector->setTarget(gBuffer);
+}
+
+void DeferredRenderer::setGeometryPassCriteria(QList<Qt3DRender::QFilterKey *> criteria)
+{
+ Q_FOREACH (Qt3DRender::QFilterKey *c, criteria)
+ m_geometryPassFilter->addMatch(c);
+}
+
+void DeferredRenderer::setFinalPassCriteria(QList<Qt3DRender::QFilterKey *> criteria)
+{
+ Q_FOREACH (Qt3DRender::QFilterKey *c, criteria)
+ c->setParent(m_finalPassFilter);
+}
+
+void DeferredRenderer::setGBufferLayer(Qt3DRender::QLayer *layer)
+{
+ m_sceneFilter->addLayer(layer);
+}
+
+void DeferredRenderer::setScreenQuadLayer(Qt3DRender::QLayer *layer)
+{
+ m_screenQuadFilter->addLayer(layer);
+}
diff --git a/tests/manual/deferred-renderer-cpp/deferredrenderer.h b/tests/manual/deferred-renderer-cpp/deferredrenderer.h
new file mode 100644
index 000000000..85044838a
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/deferredrenderer.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DEFERREDRENDERER_H
+#define DEFERREDRENDERER_H
+
+#include <Qt3DRender/QViewport>
+#include <Qt3DRender/QClearBuffers>
+#include <Qt3DRender/QLayerFilter>
+#include <Qt3DRender/QRenderPassFilter>
+#include <Qt3DRender/QRenderTargetSelector>
+#include <Qt3DRender/QRenderSurfaceSelector>
+#include <Qt3DRender/QCameraSelector>
+#include <Qt3DRender/QFilterKey>
+
+class DeferredRenderer : public Qt3DRender::QViewport
+{
+public:
+ explicit DeferredRenderer(Qt3DCore::QNode *parent = 0);
+
+ void setSceneCamera(Qt3DCore::QEntity *camera);
+ void setGBuffer(Qt3DRender::QRenderTarget *gBuffer);
+ void setGeometryPassCriteria(QList<Qt3DRender::QFilterKey *> criteria);
+ void setFinalPassCriteria(QList<Qt3DRender::QFilterKey *> criteria);
+ void setGBufferLayer(Qt3DRender::QLayer *layer);
+ void setScreenQuadLayer(Qt3DRender::QLayer *layer);
+
+private:
+ Qt3DRender::QRenderSurfaceSelector *m_surfaceSelector;
+ Qt3DRender::QLayerFilter *m_sceneFilter;
+ Qt3DRender::QLayerFilter *m_screenQuadFilter;
+ Qt3DRender::QClearBuffers *m_clearScreenQuad;
+ Qt3DRender::QRenderTargetSelector *m_gBufferTargetSelector;
+ Qt3DRender::QClearBuffers *m_clearGBuffer;
+ Qt3DRender::QRenderPassFilter *m_geometryPassFilter;
+ Qt3DRender::QRenderPassFilter *m_finalPassFilter;
+ Qt3DRender::QCameraSelector *m_sceneCameraSelector;
+};
+
+#endif // DEFERREDRENDERER_H
diff --git a/tests/manual/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc b/tests/manual/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc
new file mode 100644
index 000000000..65311e77f
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/doc/src/deferred-renderer-cpp.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example deferred-renderer-cpp
+ \title Qt 3D: Deferred Renderer C++ Example
+ \ingroup qt3d-examples-cpp
+*/
diff --git a/tests/manual/deferred-renderer-cpp/final_gl2.frag b/tests/manual/deferred-renderer-cpp/final_gl2.frag
new file mode 100644
index 000000000..f384a2df4
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/final_gl2.frag
@@ -0,0 +1,36 @@
+#version 110
+
+uniform sampler2D color;
+uniform sampler2D position;
+uniform sampler2D normal;
+uniform vec2 winSize;
+
+struct PointLight
+{
+ vec3 position;
+ vec3 direction;
+ vec4 color;
+ float intensity;
+};
+
+const int lightCount = 3;
+uniform struct
+{
+ PointLight lights[lightCount];
+} pointLights;
+
+void main()
+{
+ vec2 texCoord = gl_FragCoord.xy / winSize;
+ vec4 col = texture2D(color, texCoord);
+ vec3 pos = texture2D(position, texCoord).xyz;
+ vec3 norm = texture2D(normal, texCoord).xyz;
+
+ vec4 lightColor;
+ for (int i = 0; i < 3; i++) {
+ vec3 s = normalize(pointLights.lights[i].position - pos);
+ lightColor += pointLights.lights[i].color * (pointLights.lights[i].intensity * max(dot(s, norm), 0.0));
+ }
+ lightColor /= float(lightCount);
+ gl_FragColor = col * lightColor;
+}
diff --git a/tests/manual/deferred-renderer-cpp/final_gl2.vert b/tests/manual/deferred-renderer-cpp/final_gl2.vert
new file mode 100644
index 000000000..a907e10ca
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/final_gl2.vert
@@ -0,0 +1,9 @@
+#version 110
+
+attribute vec4 vertexPosition;
+uniform mat4 modelMatrix;
+
+void main()
+{
+ gl_Position = modelMatrix * vertexPosition;
+}
diff --git a/tests/manual/deferred-renderer-cpp/final_gl3.frag b/tests/manual/deferred-renderer-cpp/final_gl3.frag
new file mode 100644
index 000000000..88abd5cb1
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/final_gl3.frag
@@ -0,0 +1,37 @@
+#version 140
+
+uniform sampler2D color;
+uniform sampler2D position;
+uniform sampler2D normal;
+uniform vec2 winSize;
+
+out vec4 fragColor;
+
+struct PointLight
+{
+ vec3 position;
+ vec3 direction;
+ vec4 color;
+ float intensity;
+};
+
+const int lightCount = 3;
+uniform PointLightBlock {
+ PointLight lights[lightCount];
+};
+
+void main()
+{
+ vec2 texCoord = gl_FragCoord.xy / winSize;
+ vec4 col = texture(color, texCoord);
+ vec3 pos = texture(position, texCoord).xyz;
+ vec3 norm = texture(normal, texCoord).xyz;
+
+ vec4 lightColor;
+ for (int i = 0; i < 3; i++) {
+ vec3 s = normalize(lights[i].position - pos);
+ lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0));
+ }
+ lightColor /= float(lightCount);
+ fragColor = col * lightColor;
+}
diff --git a/tests/manual/deferred-renderer-cpp/final_gl3.vert b/tests/manual/deferred-renderer-cpp/final_gl3.vert
new file mode 100644
index 000000000..60410d34d
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/final_gl3.vert
@@ -0,0 +1,9 @@
+#version 140
+
+in vec4 vertexPosition;
+uniform mat4 modelMatrix;
+
+void main()
+{
+ gl_Position = modelMatrix * vertexPosition;
+}
diff --git a/tests/manual/deferred-renderer-cpp/finaleffect.cpp b/tests/manual/deferred-renderer-cpp/finaleffect.cpp
new file mode 100644
index 000000000..63c821caa
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/finaleffect.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "finaleffect.h"
+
+#include <Qt3DRender/QGraphicsApiFilter>
+#include <Qt3DRender/QShaderProgram>
+#include <QUrl>
+
+FinalEffect::FinalEffect(Qt3DCore::QNode *parent)
+ : Qt3DRender::QEffect(parent)
+ , m_gl3Technique(new Qt3DRender::QTechnique())
+ , m_gl2Technique(new Qt3DRender::QTechnique())
+ , m_gl2Pass(new Qt3DRender::QRenderPass())
+ , m_gl3Pass(new Qt3DRender::QRenderPass())
+ , m_passCriterion(new Qt3DRender::QFilterKey(this))
+{
+ m_gl3Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
+ m_gl3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_gl3Technique->graphicsApiFilter()->setMinorVersion(1);
+ m_gl3Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::CoreProfile);
+
+ m_gl2Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
+ m_gl2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_gl2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_gl2Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
+
+ m_passCriterion->setName(QStringLiteral("pass"));
+ m_passCriterion->setValue(QStringLiteral("final"));
+
+ Qt3DRender::QShaderProgram *gl3Shader = new Qt3DRender::QShaderProgram();
+ gl3Shader->setVertexShaderCode(gl3Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl3.vert"))));
+ gl3Shader->setFragmentShaderCode(gl3Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl3.frag"))));
+
+ m_gl3Pass->addFilterKey(m_passCriterion);
+ m_gl3Pass->setShaderProgram(gl3Shader);
+ m_gl3Technique->addRenderPass(m_gl3Pass);
+
+ Qt3DRender::QShaderProgram *gl2Shader = new Qt3DRender::QShaderProgram();
+ gl2Shader->setVertexShaderCode(gl2Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl2.vert"))));
+ gl2Shader->setFragmentShaderCode(gl2Shader->loadSource(QUrl(QStringLiteral("qrc:/final_gl2.frag"))));
+
+ m_gl2Pass->addFilterKey(m_passCriterion);
+ m_gl2Pass->setShaderProgram(gl2Shader);
+ m_gl2Technique->addRenderPass(m_gl2Pass);
+
+ addTechnique(m_gl3Technique);
+ addTechnique(m_gl2Technique);
+}
+
+QList<Qt3DRender::QFilterKey *> FinalEffect::passCriteria() const
+{
+ return QList<Qt3DRender::QFilterKey *>() << m_passCriterion;
+}
diff --git a/tests/manual/deferred-renderer-cpp/finaleffect.h b/tests/manual/deferred-renderer-cpp/finaleffect.h
new file mode 100644
index 000000000..69a1b126c
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/finaleffect.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FINALEFFECT_H
+#define FINALEFFECT_H
+
+#include <Qt3DRender/QEffect>
+#include <Qt3DRender/QTechnique>
+
+class FinalEffect : public Qt3DRender::QEffect
+{
+public:
+ explicit FinalEffect(Qt3DCore::QNode *parent = 0);
+
+ QList<Qt3DRender::QFilterKey *> passCriteria() const;
+ inline Qt3DRender::QTechnique *gl3Technique() const { return m_gl3Technique; }
+ inline Qt3DRender::QTechnique *gl2Technique() const { return m_gl2Technique; }
+
+private :
+ Qt3DRender::QTechnique *m_gl3Technique;
+ Qt3DRender::QTechnique *m_gl2Technique;
+ Qt3DRender::QRenderPass *m_gl2Pass;
+ Qt3DRender::QRenderPass *m_gl3Pass;
+ Qt3DRender::QFilterKey *m_passCriterion;
+};
+
+#endif // FINALEFFECT_H
diff --git a/tests/manual/deferred-renderer-cpp/gbuffer.cpp b/tests/manual/deferred-renderer-cpp/gbuffer.cpp
new file mode 100644
index 000000000..984dbb1f2
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/gbuffer.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gbuffer.h"
+
+GBuffer::GBuffer(Qt3DCore::QNode *parent)
+ : Qt3DRender::QRenderTarget(parent)
+{
+ const Qt3DRender::QAbstractTexture::TextureFormat formats[AttachmentsCount] = {
+ Qt3DRender::QAbstractTexture::RGBA32F,
+ Qt3DRender::QAbstractTexture::RGB32F,
+ Qt3DRender::QAbstractTexture::RGB16F,
+ Qt3DRender::QAbstractTexture::D32F
+ };
+
+ const Qt3DRender::QRenderTargetOutput::AttachmentPoint attachmentPoints[AttachmentsCount] = {
+ Qt3DRender::QRenderTargetOutput::Color0,
+ Qt3DRender::QRenderTargetOutput::Color1,
+ Qt3DRender::QRenderTargetOutput::Color2,
+ Qt3DRender::QRenderTargetOutput::Depth
+ };
+
+ for (int i = 0; i < AttachmentsCount; i++) {
+ Qt3DRender::QRenderTargetOutput *output = new Qt3DRender::QRenderTargetOutput(this);
+
+ m_textures[i] = new Qt3DRender::QTexture2D();
+ m_textures[i]->setFormat(formats[i]);
+ m_textures[i]->setWidth(1024);
+ m_textures[i]->setHeight(1024);
+ m_textures[i]->setGenerateMipMaps(false);
+ m_textures[i]->setWrapMode(Qt3DRender::QTextureWrapMode(Qt3DRender::QTextureWrapMode::ClampToEdge));
+ m_textures[i]->setMinificationFilter(Qt3DRender::QAbstractTexture::Linear);
+ m_textures[i]->setMagnificationFilter(Qt3DRender::QAbstractTexture::Linear);
+
+ output->setTexture(m_textures[i]);
+ output->setAttachmentPoint(attachmentPoints[i]);
+ addOutput(output);
+ }
+}
+
+Qt3DRender::QAbstractTexture *GBuffer::colorTexture() const
+{
+ return m_textures[Color];
+}
+
+Qt3DRender::QAbstractTexture *GBuffer::positionTexture() const
+{
+ return m_textures[Position];
+}
+
+Qt3DRender::QAbstractTexture *GBuffer::normalTexture() const
+{
+ return m_textures[Normal];
+}
+
+Qt3DRender::QAbstractTexture *GBuffer::depthTexture() const
+{
+ return m_textures[Depth];
+}
diff --git a/tests/manual/deferred-renderer-cpp/gbuffer.h b/tests/manual/deferred-renderer-cpp/gbuffer.h
new file mode 100644
index 000000000..dab8b6752
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/gbuffer.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GBUFFER_H
+#define GBUFFER_H
+
+#include <Qt3DRender/QRenderTarget>
+#include <Qt3DRender/qtexture.h>
+#include <Qt3DRender/QRenderTargetOutput>
+
+class GBuffer : public Qt3DRender::QRenderTarget
+{
+public:
+ explicit GBuffer(Qt3DCore::QNode *parent = 0);
+
+ enum Attachments {
+ Color = 0,
+ Position,
+ Normal,
+ Depth,
+ AttachmentsCount
+ };
+
+ Qt3DRender::QAbstractTexture *colorTexture() const;
+ Qt3DRender::QAbstractTexture *positionTexture() const;
+ Qt3DRender::QAbstractTexture *normalTexture() const;
+ Qt3DRender::QAbstractTexture *depthTexture() const;
+
+private:
+ Qt3DRender::QAbstractTexture *m_textures[AttachmentsCount];
+ Qt3DRender::QRenderTargetOutput *m_attachments[AttachmentsCount];
+};
+
+#endif // GBUFFER_H
diff --git a/tests/manual/deferred-renderer-cpp/geometry_gl2.frag b/tests/manual/deferred-renderer-cpp/geometry_gl2.frag
new file mode 100644
index 000000000..0e7776f15
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/geometry_gl2.frag
@@ -0,0 +1,12 @@
+#version 110
+
+varying vec4 color0;
+varying vec3 position0;
+varying vec3 normal0;
+
+void main()
+{
+ gl_FragData[0] = color0;
+ gl_FragData[1] = vec4(position0, 0);
+ gl_FragData[2] = vec4(normal0, 0);
+}
diff --git a/tests/manual/deferred-renderer-cpp/geometry_gl2.vert b/tests/manual/deferred-renderer-cpp/geometry_gl2.vert
new file mode 100644
index 000000000..72d5345f1
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/geometry_gl2.vert
@@ -0,0 +1,21 @@
+#version 110
+
+attribute vec4 vertexPosition;
+attribute vec3 vertexNormal;
+
+varying vec4 color0;
+varying vec3 position0;
+varying vec3 normal0;
+
+uniform mat4 mvp;
+uniform mat4 modelView;
+uniform mat3 modelViewNormal;
+uniform vec4 meshColor;
+
+void main()
+{
+ color0 = meshColor;
+ position0 = vec3(modelView * vertexPosition);
+ normal0 = normalize(modelViewNormal * vertexNormal);
+ gl_Position = mvp * vertexPosition;
+}
diff --git a/tests/manual/deferred-renderer-cpp/geometry_gl3.frag b/tests/manual/deferred-renderer-cpp/geometry_gl3.frag
new file mode 100644
index 000000000..7d9c7d64e
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/geometry_gl3.frag
@@ -0,0 +1,16 @@
+#version 140
+
+in vec4 color0;
+in vec3 position0;
+in vec3 normal0;
+
+out vec4 color;
+out vec3 position;
+out vec3 normal;
+
+void main()
+{
+ color = color0;
+ position = position0;
+ normal = normal0;
+}
diff --git a/tests/manual/deferred-renderer-cpp/geometry_gl3.vert b/tests/manual/deferred-renderer-cpp/geometry_gl3.vert
new file mode 100644
index 000000000..d3e302d16
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/geometry_gl3.vert
@@ -0,0 +1,21 @@
+#version 140
+
+in vec4 vertexPosition;
+in vec3 vertexNormal;
+
+out vec4 color0;
+out vec3 position0;
+out vec3 normal0;
+
+uniform mat4 mvp;
+uniform mat4 modelView;
+uniform mat3 modelViewNormal;
+uniform vec4 meshColor;
+
+void main()
+{
+ color0 = meshColor;
+ position0 = vec3(modelView * vertexPosition);
+ normal0 = normalize(modelViewNormal * vertexNormal);
+ gl_Position = mvp * vertexPosition;
+}
diff --git a/tests/manual/deferred-renderer-cpp/main.cpp b/tests/manual/deferred-renderer-cpp/main.cpp
new file mode 100644
index 000000000..53caaaae5
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/main.cpp
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DCore/QEntity>
+
+#include <Qt3DRender/QMaterial>
+#include <Qt3DExtras//QSphereMesh>
+#include <Qt3DExtras//QPlaneMesh>
+#include <Qt3DRender/QLayer>
+#include <Qt3DRender/QParameter>
+#include <Qt3DRender/QCamera>
+#include <Qt3DRender/QCameraLens>
+#include <Qt3DCore/QTransform>
+#include <Qt3DRender/QPointLight>
+#include <Qt3DCore/qaspectengine.h>
+
+#include <QGuiApplication>
+
+#include "gbuffer.h"
+#include "deferredrenderer.h"
+#include "finaleffect.h"
+#include "sceneeffect.h"
+#include "pointlightblock.h"
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qfirstpersoncameracontroller.h>
+
+
+int main(int ac, char **av)
+{
+ QGuiApplication app(ac, av);
+
+ Qt3DExtras::Qt3DWindow view;
+
+ // Root entity
+ Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity();
+ rootEntity->setObjectName(QStringLiteral("rootEntity"));
+
+ // Shared Components
+ GBuffer *gBuffer = new GBuffer();
+ FinalEffect *finalEffect = new FinalEffect();
+ SceneEffect *sceneEffect = new SceneEffect();
+
+ Qt3DExtras::QSphereMesh *sphereMesh = new Qt3DExtras::QSphereMesh();
+ sphereMesh->setRings(50);
+ sphereMesh->setSlices(100);
+
+ Qt3DRender::QLayer *sceneLayer = new Qt3DRender::QLayer();
+ Qt3DRender::QLayer *quadLayer = new Qt3DRender::QLayer();
+
+ Qt3DExtras::QPlaneMesh *planeMesh = new Qt3DExtras::QPlaneMesh();
+ planeMesh->setMeshResolution(QSize(2, 2));
+ planeMesh->setWidth(2.0f);
+ planeMesh->setHeight(2.0f);
+
+ Qt3DRender::QPointLight *light1 = new Qt3DRender::QPointLight();
+ light1->setColor(Qt::white);
+ light1->setIntensity(1.5f);
+
+ rootEntity->addComponent(light1);
+
+ // Scene Camera
+ Qt3DRender::QCamera *camera = view.camera();
+
+ camera->setFieldOfView(45.0f);
+ camera->setNearPlane(0.01f);
+ camera->setFarPlane(1000.0f);
+ camera->setProjectionType(Qt3DRender::QCameraLens::PerspectiveProjection);
+
+ camera->setPosition(QVector3D(10.0f, 10.0f, -25.0f));
+ camera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
+ camera->setViewCenter(QVector3D(0.0f, 0.0f, 10.0f));
+
+ // For camera controls
+ Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(rootEntity);
+ camController->setCamera(camera);
+
+ // FrameGraph
+ DeferredRenderer *deferredRenderer = new DeferredRenderer();
+ deferredRenderer->setNormalizedRect(QRectF(0.0f, 0.0f, 1.0f, 1.0f));
+ deferredRenderer->setFinalPassCriteria(finalEffect->passCriteria());
+ deferredRenderer->setGeometryPassCriteria(sceneEffect->passCriteria());
+ deferredRenderer->setGBuffer(gBuffer);
+ deferredRenderer->setSceneCamera(camera);
+ deferredRenderer->setGBufferLayer(sceneLayer);
+ deferredRenderer->setScreenQuadLayer(quadLayer);
+ view.setActiveFrameGraph(deferredRenderer);
+
+ // Scene Content
+ Qt3DCore::QEntity *sphereOne = new Qt3DCore::QEntity(rootEntity);
+ Qt3DRender::QMaterial *sphereOneMaterial = new Qt3DRender::QMaterial();
+
+ sphereOneMaterial->setEffect(sceneEffect);
+ sphereOneMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("meshColor"), QColor(Qt::blue)));
+
+ Qt3DCore::QTransform *sphereOneTransform = new Qt3DCore::QTransform;
+ sphereOneTransform->setTranslation(QVector3D(-10.0f, 0.0f, 25.0f));
+
+ Qt3DRender::QPointLight *light2 = new Qt3DRender::QPointLight();
+ light2->setColor(Qt::white);
+ light2->setIntensity(1.5f);
+
+ sphereOne->addComponent(sphereOneTransform);
+ sphereOne->addComponent(sphereOneMaterial);
+ sphereOne->addComponent(sphereMesh);
+ sphereOne->addComponent(sceneLayer);
+ sphereOne->addComponent(light2);
+
+ Qt3DCore::QEntity *sphereTwo = new Qt3DCore::QEntity(rootEntity);
+ Qt3DRender::QMaterial *sphereTwoMaterial = new Qt3DRender::QMaterial();
+ sphereTwoMaterial->setEffect(sceneEffect);
+ sphereTwoMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("meshColor"), QColor(Qt::yellow)));
+
+ Qt3DRender::QPointLight *light3 = new Qt3DRender::QPointLight();
+ light3->setColor(Qt::blue);
+ light3->setIntensity(0.5f);
+
+ sphereTwo->addComponent(sphereMesh);
+ sphereTwo->addComponent(sceneLayer);
+ sphereTwo->addComponent(sphereTwoMaterial);
+ sphereTwo->addComponent(light3);
+
+ // Screen Quad
+ Qt3DCore::QEntity *screenQuad = new Qt3DCore::QEntity(rootEntity);
+ Qt3DRender::QMaterial *screenQuadMaterial = new Qt3DRender::QMaterial();
+ screenQuadMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("position"), gBuffer->positionTexture()));
+ screenQuadMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("normal"), gBuffer->normalTexture()));
+ screenQuadMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("color"), gBuffer->colorTexture()));
+ screenQuadMaterial->addParameter(new Qt3DRender::QParameter(QStringLiteral("winSize"), QSize(1024, 1024)));
+ PointLightBlock *lightsData = new PointLightBlock(screenQuadMaterial);
+ lightsData->addLight(light1);
+ lightsData->addLight(light2);
+ lightsData->addLight(light3);
+
+ finalEffect->gl3Technique()->addParameter(new Qt3DRender::QParameter(QStringLiteral("PointLightBlock"), QVariant::fromValue(lightsData)));
+ finalEffect->gl2Technique()->addParameter(new Qt3DRender::QParameter(QStringLiteral("pointLights"), QVariant::fromValue(lightsData)));
+ screenQuadMaterial->setEffect(finalEffect);
+
+ Qt3DCore::QTransform *screenPlaneTransform = new Qt3DCore::QTransform;
+ screenPlaneTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1.0f, 0.0f, 0.0f), 90.0f));
+
+ screenQuad->addComponent(quadLayer);
+ screenQuad->addComponent(screenPlaneTransform);
+ screenQuad->addComponent(screenQuadMaterial);
+ screenQuad->addComponent(planeMesh);
+
+ // Set root object of the scene
+ view.setRootEntity(rootEntity);
+ // Show window
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/deferred-renderer-cpp/pointlightblock.cpp b/tests/manual/deferred-renderer-cpp/pointlightblock.cpp
new file mode 100644
index 000000000..36bab9966
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/pointlightblock.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "pointlightblock.h"
+
+PointLightBlock::PointLightBlock(Qt3DCore::QNode *parent)
+ : Qt3DRender::QShaderData(parent)
+{
+
+}
+
+PointLightBlock::~PointLightBlock()
+{
+}
+
+QVector<Qt3DRender::QAbstractLight *> PointLightBlock::lights() const
+{
+ return m_lights;
+}
+
+void PointLightBlock::addLight(Qt3DRender::QAbstractLight *light)
+{
+ m_lights.append(light);
+ emit lightsChanged();
+}
+
diff --git a/tests/manual/deferred-renderer-cpp/pointlightblock.h b/tests/manual/deferred-renderer-cpp/pointlightblock.h
new file mode 100644
index 000000000..9c93528c8
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/pointlightblock.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef POINTLIGHTBLOCK_H
+#define POINTLIGHTBLOCK_H
+
+#include <Qt3DRender/QAbstractLight>
+#include <Qt3DRender/QShaderData>
+
+class PointLightBlock : public Qt3DRender::QShaderData
+{
+ Q_OBJECT
+ Q_PROPERTY(QVector<Qt3DRender::QAbstractLight *> lights READ lights NOTIFY lightsChanged)
+public:
+ explicit PointLightBlock(Qt3DCore::QNode *parent = 0);
+ ~PointLightBlock();
+
+ QVector<Qt3DRender::QAbstractLight *> lights() const;
+ void addLight(Qt3DRender::QAbstractLight *light);
+
+Q_SIGNALS:
+ void lightsChanged();
+
+private:
+ QVector<Qt3DRender::QAbstractLight *> m_lights;
+};
+
+#endif // POINTLIGHTBLOCK_H
diff --git a/tests/manual/deferred-renderer-cpp/sceneeffect.cpp b/tests/manual/deferred-renderer-cpp/sceneeffect.cpp
new file mode 100644
index 000000000..bdb6ea76e
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/sceneeffect.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "sceneeffect.h"
+
+#include <Qt3DRender/QGraphicsApiFilter>
+#include <Qt3DRender/QShaderProgram>
+#include <QUrl>
+
+SceneEffect::SceneEffect(Qt3DCore::QNode *parent)
+ : Qt3DRender::QEffect(parent)
+ , m_gl3Technique(new Qt3DRender::QTechnique())
+ , m_gl2Technique(new Qt3DRender::QTechnique())
+ , m_gl2Pass(new Qt3DRender::QRenderPass())
+ , m_gl3Pass(new Qt3DRender::QRenderPass())
+ , m_passCriterion(new Qt3DRender::QFilterKey(this))
+{
+
+ m_gl3Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
+ m_gl3Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
+ m_gl3Technique->graphicsApiFilter()->setMajorVersion(3);
+ m_gl3Technique->graphicsApiFilter()->setMinorVersion(3);
+
+ m_gl2Technique->graphicsApiFilter()->setApi(Qt3DRender::QGraphicsApiFilter::OpenGL);
+ m_gl2Technique->graphicsApiFilter()->setMajorVersion(2);
+ m_gl2Technique->graphicsApiFilter()->setMinorVersion(0);
+ m_gl2Technique->graphicsApiFilter()->setProfile(Qt3DRender::QGraphicsApiFilter::NoProfile);
+
+
+ m_passCriterion->setName(QStringLiteral("pass"));
+ m_passCriterion->setValue(QStringLiteral("geometry"));
+
+ Qt3DRender::QShaderProgram *gl3Shader = new Qt3DRender::QShaderProgram();
+ gl3Shader->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl3.vert"))));
+ gl3Shader->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl3.frag"))));
+
+ m_gl3Pass->addFilterKey(m_passCriterion);
+ m_gl3Pass->setShaderProgram(gl3Shader);
+ m_gl3Technique->addRenderPass(m_gl3Pass);
+
+ Qt3DRender::QShaderProgram *gl2Shader = new Qt3DRender::QShaderProgram();
+ gl2Shader->setVertexShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl2.vert"))));
+ gl2Shader->setFragmentShaderCode(Qt3DRender::QShaderProgram::loadSource(QUrl(QStringLiteral("qrc:/geometry_gl2.frag"))));
+
+ m_gl2Pass->addFilterKey(m_passCriterion);
+ m_gl2Pass->setShaderProgram(gl2Shader);
+ m_gl2Technique->addRenderPass(m_gl2Pass);
+
+ addTechnique(m_gl3Technique);
+ addTechnique(m_gl2Technique);
+}
+
+QList<Qt3DRender::QFilterKey *> SceneEffect::passCriteria() const
+{
+ return QList<Qt3DRender::QFilterKey *>() << m_passCriterion;
+}
diff --git a/tests/manual/deferred-renderer-cpp/sceneeffect.h b/tests/manual/deferred-renderer-cpp/sceneeffect.h
new file mode 100644
index 000000000..eb361c273
--- /dev/null
+++ b/tests/manual/deferred-renderer-cpp/sceneeffect.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SCENEEFFECT_H
+#define SCENEEFFECT_H
+
+#include <Qt3DRender/QEffect>
+#include <Qt3DRender/QTechnique>
+
+class SceneEffect : public Qt3DRender::QEffect
+{
+public:
+ explicit SceneEffect(Qt3DCore::QNode *parent = 0);
+
+ QList<Qt3DRender::QFilterKey *> passCriteria() const;
+
+private:
+ Qt3DRender::QTechnique *m_gl3Technique;
+ Qt3DRender::QTechnique *m_gl2Technique;
+ Qt3DRender::QRenderPass *m_gl2Pass;
+ Qt3DRender::QRenderPass *m_gl3Pass;
+ Qt3DRender::QFilterKey *m_passCriterion;
+};
+
+#endif // SCENEEFFECT_H
diff --git a/tests/manual/deferred-renderer-qml/DeferredRenderer.qml b/tests/manual/deferred-renderer-qml/DeferredRenderer.qml
new file mode 100644
index 000000000..6f70d2d87
--- /dev/null
+++ b/tests/manual/deferred-renderer-qml/DeferredRenderer.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Viewport {
+ id: root
+ normalizedRect : Qt.rect(0.0, 0.0, 1.0, 1.0)
+
+ property alias gBuffer : gBufferTargetSelector.target
+ property alias camera : sceneCameraSelector.camera
+
+ readonly property Layer sceneLayer: Layer {}
+ readonly property Layer screenQuadLayer: Layer {}
+
+ RenderSurfaceSelector {
+ LayerFilter {
+ layers : root.sceneLayer
+
+ RenderTargetSelector {
+ id : gBufferTargetSelector
+
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
+
+ RenderPassFilter {
+ id : geometryPass
+ matchAny : FilterKey { name : "pass"; value : "geometry" }
+
+ CameraSelector {
+ id : sceneCameraSelector
+ }
+ }
+ }
+ }
+ }
+
+ LayerFilter {
+ layers : root.screenQuadLayer
+
+ ClearBuffers {
+ buffers: ClearBuffers.ColorDepthBuffer
+
+ RenderPassFilter {
+ id : finalPass
+ matchAny : FilterKey { name : "pass"; value : "final" }
+ CameraSelector {
+ camera: sceneCameraSelector.camera
+ }
+ }
+
+ }
+ }
+ }
+}
diff --git a/tests/manual/deferred-renderer-qml/FinalEffect.qml b/tests/manual/deferred-renderer-qml/FinalEffect.qml
new file mode 100644
index 000000000..482ad91cc
--- /dev/null
+++ b/tests/manual/deferred-renderer-qml/FinalEffect.qml
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Effect {
+ techniques : [
+ // OpenGL 3.1
+ Technique {
+ graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.CoreProfile; minorVersion : 1; majorVersion : 3 }
+ parameters: Parameter { name: "PointLightBlock"; value: ShaderData {
+ property ShaderDataArray lights: ShaderDataArray {
+ // hard coded lights until we have a way to filter
+ // ShaderData in a scene
+ values: [sceneEntity.light, sphere1.light, sphere2.light, light3.light, light4.light]
+ }
+ }
+ }
+ renderPasses : RenderPass {
+ filterKeys : FilterKey { name : "pass"; value : "final" }
+ shaderProgram : ShaderProgram {
+ id : finalShaderGL3
+ vertexShaderCode:
+ "#version 140
+
+ in vec4 vertexPosition;
+ uniform mat4 modelMatrix;
+
+ void main()
+ {
+ gl_Position = modelMatrix * vertexPosition;
+ }
+ "
+ fragmentShaderCode:
+ "#version 140
+
+ uniform sampler2D color;
+ uniform sampler2D position;
+ uniform sampler2D normal;
+ uniform vec2 winSize;
+
+ out vec4 fragColor;
+
+ struct PointLight
+ {
+ vec3 position;
+ vec3 direction;
+ vec4 color;
+ float intensity;
+ };
+
+ const int lightCount = 5;
+ uniform PointLightBlock {
+ PointLight lights[lightCount];
+ };
+
+ void main()
+ {
+ vec2 texCoord = gl_FragCoord.xy / winSize;
+ vec4 col = texture(color, texCoord);
+ vec3 pos = texture(position, texCoord).xyz;
+ vec3 norm = texture(normal, texCoord).xyz;
+
+ vec4 lightColor;
+ for (int i = 0; i < lightCount; i++) {
+ vec3 s = normalize(lights[i].position - pos);
+ lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0));
+ }
+ lightColor /= float(lightCount);
+ fragColor = col;
+ }
+ "
+ }
+ }
+ },
+ // OpenGL 2.0 with FBO extension
+ Technique {
+ graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.NoProfile; minorVersion : 0; majorVersion : 2 }
+ parameters: Parameter { name: "pointLights"; value: ShaderData {
+ property ShaderDataArray lights: ShaderDataArray {
+ // hard coded lights until we have a way to filter
+ // ShaderData in a scene
+ values: [sceneEntity.light, sphere1.light, sphere2.light, light3.light, light4.light]
+ }
+ }
+ }
+ renderPasses : RenderPass {
+ filterKeys : FilterKey { name : "pass"; value : "final" }
+ shaderProgram : ShaderProgram {
+ id : finalShaderGL2
+ vertexShaderCode:
+ "#version 110
+
+ attribute vec4 vertexPosition;
+ uniform mat4 modelMatrix;
+
+ void main()
+ {
+ gl_Position = modelMatrix * vertexPosition;
+ }
+ "
+ fragmentShaderCode:
+ "#version 110
+
+ uniform sampler2D color;
+ uniform sampler2D position;
+ uniform sampler2D normal;
+ uniform vec2 winSize;
+
+ struct PointLight
+ {
+ vec3 position;
+ vec3 direction;
+ vec4 color;
+ float intensity;
+ };
+
+ const int lightCount = 5;
+ uniform struct
+ {
+ PointLight lights[lightCount];
+ };
+
+ void main()
+ {
+ vec2 texCoord = gl_FragCoord.xy / winSize;
+ vec4 col = texture2D(color, texCoord);
+ vec3 pos = texture2D(position, texCoord).xyz;
+ vec3 norm = texture2D(normal, texCoord).xyz;
+
+ vec4 lightColor;
+ for (int i = 0; i < lightCount; i++) {
+ vec3 s = lights[i].position - pos);
+ lightColor += lights[i].color * (lights[i].intensity * max(dot(s, norm), 0.0));
+ }
+ lightColor /= float(lightCount);
+ gl_FragColor = col * lightColor;
+ }
+ "
+ }
+ }
+ }]
+}
diff --git a/tests/manual/deferred-renderer-qml/GBuffer.qml b/tests/manual/deferred-renderer-qml/GBuffer.qml
new file mode 100644
index 000000000..bf43c66b5
--- /dev/null
+++ b/tests/manual/deferred-renderer-qml/GBuffer.qml
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+RenderTarget {
+
+ property alias color : colorAttachment
+ property alias position : positionAttachment
+ property alias normal : normalAttachment
+ property alias depth : depthAttachment
+
+ attachments : [
+
+ RenderTargetOutput {
+ objectName : "color"
+ attachmentPoint : RenderTargetOutput.Color0
+ texture : Texture2D {
+ id : colorAttachment
+ width : 1024
+ height : 1024
+ format : Texture.RGBA32F
+ generateMipMaps : false
+ magnificationFilter : Texture.Linear
+ minificationFilter : Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ }
+ },
+ RenderTargetOutput {
+ objectName : "position"
+ attachmentPoint : RenderTargetOutput.Color1
+ texture : Texture2D {
+ id : positionAttachment
+ width : 1024
+ height : 1024
+ // This texture format may not be supported by
+ // some OpenGL vendors when used as a color attachment
+ format : Texture.RGB32F
+ generateMipMaps : false
+ magnificationFilter : Texture.Linear
+ minificationFilter : Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ }
+ },
+ RenderTargetOutput {
+ objectName : "normal"
+ attachmentPoint : RenderTargetOutput.Color2
+ texture : Texture2D {
+ id : normalAttachment
+ width : 1024
+ height : 1024
+ // This texture format may not be supported by
+ // some OpenGL vendors when used as a color attachment
+ format : Texture.RGB16F
+ generateMipMaps : false
+ magnificationFilter : Texture.Linear
+ minificationFilter : Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ }
+ },
+ RenderTargetOutput {
+ objectName : "depth"
+ attachmentPoint : RenderTargetOutput.Depth
+ texture : Texture2D {
+ id : depthAttachment
+ width : 1024
+ height : 1024
+ format : Texture.D32F
+ generateMipMaps : false
+ magnificationFilter : Texture.Linear
+ minificationFilter : Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ }
+ }
+ ] // outputs
+}
diff --git a/tests/manual/deferred-renderer-qml/SceneEffect.qml b/tests/manual/deferred-renderer-qml/SceneEffect.qml
new file mode 100644
index 000000000..5dbfdae63
--- /dev/null
+++ b/tests/manual/deferred-renderer-qml/SceneEffect.qml
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Effect {
+ id : sceneMaterialEffect
+ techniques : [
+ // OpenGL 3.1
+ Technique {
+ graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.CoreProfile; minorVersion : 1; majorVersion : 3 }
+ renderPasses : RenderPass {
+ filterKeys : FilterKey { name : "pass"; value : "geometry" }
+ shaderProgram : ShaderProgram {
+ id : sceneShaderGL3
+ vertexShaderCode:
+ "#version 140
+
+ in vec4 vertexPosition;
+ in vec3 vertexNormal;
+
+ out vec4 color0;
+ out vec3 position0;
+ out vec3 normal0;
+
+ uniform mat4 mvp;
+ uniform mat4 modelView;
+ uniform mat3 modelViewNormal;
+ uniform vec4 meshColor;
+
+ void main()
+ {
+ color0 = meshColor;
+ position0 = vec3(modelView * vertexPosition);
+ normal0 = normalize(modelViewNormal * vertexNormal);
+ gl_Position = mvp * vertexPosition;
+ }
+ "
+ fragmentShaderCode:
+ "#version 140
+
+ in vec4 color0;
+ in vec3 position0;
+ in vec3 normal0;
+
+ out vec4 color;
+ out vec3 position;
+ out vec3 normal;
+
+ void main()
+ {
+ color = color0;
+ position = position0;
+ normal = normal0;
+ }
+ "
+ }
+ }
+ },
+ // OpenGL 2.0
+ Technique {
+ graphicsApiFilter {api : GraphicsApiFilter.OpenGL; profile : GraphicsApiFilter.CoreProfile; minorVersion : 0; majorVersion : 2 }
+ renderPasses : RenderPass {
+ filterKeys : FilterKey { name : "pass"; value : "geometry" }
+ shaderProgram : ShaderProgram {
+ id : sceneShaderGL2
+ vertexShaderCode:
+ "#version 110
+
+ attribute vec4 vertexPosition;
+ attribute vec3 vertexNormal;
+
+ varying vec4 color0;
+ varying vec3 position0;
+ varying vec3 normal0;
+
+ uniform mat4 mvp;
+ uniform mat4 modelView;
+ uniform mat3 modelViewNormal;
+ uniform vec4 meshColor;
+
+ void main()
+ {
+ color0 = meshColor;
+ position0 = vec3(modelView * vertexPosition);
+ normal0 = normalize(modelViewNormal * vertexNormal);
+ gl_Position = mvp * vertexPosition;
+ }
+ "
+ fragmentShaderCode:
+ "#version 110
+
+ varying vec4 color0;
+ varying vec3 position0;
+ varying vec3 normal0;
+
+ void main()
+ {
+ gl_FragData[0] = color0;
+ gl_FragData[1] = vec4(position0, 0);
+ gl_FragData[2] = vec4(normal0, 0);
+ }
+ "
+ }
+ }
+ }
+ ]
+}
diff --git a/tests/manual/deferred-renderer-qml/deferred-renderer-qml.pro b/tests/manual/deferred-renderer-qml/deferred-renderer-qml.pro
new file mode 100644
index 000000000..8f7dc12d5
--- /dev/null
+++ b/tests/manual/deferred-renderer-qml/deferred-renderer-qml.pro
@@ -0,0 +1,21 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+HEADERS += \
+
+
+OTHER_FILES += \
+ main.qml \
+ DeferredRenderer.qml \
+ FinalEffect.qml \
+ SceneEffect.qml \
+ GBuffer.qml
+
+RESOURCES += \
+ deferred-renderer-qml.qrc
+
+SOURCES += \
+ main.cpp
diff --git a/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.qrc b/tests/manual/deferred-renderer-qml/deferred-renderer-qml.qrc
index 573b2337e..573b2337e 100644
--- a/examples/qt3d/deferred-renderer-qml/deferred-renderer-qml.qrc
+++ b/tests/manual/deferred-renderer-qml/deferred-renderer-qml.qrc
diff --git a/tests/manual/deferred-renderer-qml/doc/src/deferred-renderer-qml.qdoc b/tests/manual/deferred-renderer-qml/doc/src/deferred-renderer-qml.qdoc
new file mode 100644
index 000000000..61c7cbd13
--- /dev/null
+++ b/tests/manual/deferred-renderer-qml/doc/src/deferred-renderer-qml.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example deferred-renderer-qml
+ \title Qt 3D: Deferred Renderer QML Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/deferred-renderer-qml/main.cpp b/tests/manual/deferred-renderer-qml/main.cpp
new file mode 100644
index 000000000..55bbe91ee
--- /dev/null
+++ b/tests/manual/deferred-renderer-qml/main.cpp
@@ -0,0 +1,63 @@
+
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/deferred-renderer-qml/main.qml b/tests/manual/deferred-renderer-qml/main.qml
new file mode 100644
index 000000000..b56e0bd5d
--- /dev/null
+++ b/tests/manual/deferred-renderer-qml/main.qml
@@ -0,0 +1,253 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id : root
+
+ GBuffer {
+ id : gBuffer
+ }
+
+ components : [
+ RenderSettings {
+ activeFrameGraph: DeferredRenderer {
+ id: frameGraph
+ camera : camera
+ gBuffer: gBuffer
+ }
+
+ renderPolicy: RenderSettings.Always
+ },
+ InputSettings {}
+ ]
+
+ FirstPersonCameraController { camera: camera }
+
+ Entity {
+ id : screenQuadEntity
+ PlaneMesh {
+ id: mesh
+ width: 2.0
+ height: 2.0
+ meshResolution: Qt.size(2, 2)
+ }
+
+ Transform { // We rotate the plane so that it faces us
+ id: transform
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90)
+ }
+
+ Material {
+ id: material
+ parameters : [
+ Parameter { name: "color"; value : gBuffer.color },
+ Parameter { name: "position"; value : gBuffer.position },
+ Parameter { name: "normal"; value : gBuffer.normal },
+ Parameter { name: "winSize"; value : Qt.size(1024, 1024) }
+ ]
+ effect : FinalEffect {}
+ }
+
+ components : [ frameGraph.screenQuadLayer, mesh, transform, material ]
+ }
+
+ Entity {
+ id : sceneEntity
+
+ property PointLight light: PointLight {
+ color : "white"
+ intensity : 4.0
+ QQ2.ColorAnimation on color { from: "white"; to: "blue"; duration: 4000; loops: 2 }
+ QQ2.NumberAnimation on intensity { from: 0; to: 5.0; duration: 1000; loops: QQ2.Animation.Infinite }
+ }
+
+ components: [ sceneEntity.light ]
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.01
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, -25.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 10.0 )
+ }
+
+ SphereMesh {
+ id : sphereMesh
+ rings: 50
+ slices: 100
+ }
+
+ SceneEffect {
+ id : sceneMaterialEffect
+ }
+
+ Entity {
+ id : sphere1
+
+ property Material material : Material {
+ effect : sceneMaterialEffect
+ parameters : Parameter { name : "meshColor"; value : "dodgerblue" }
+ }
+
+ property Transform transform: Transform {
+ id: sphere1Transform
+ property real x: -10.0
+ translation: Qt.vector3d(x, 0, 5)
+ }
+
+ QQ2.SequentialAnimation {
+ loops: QQ2.Animation.Infinite
+ running: false
+ QQ2.NumberAnimation { target: sphere1Transform; property: "x"; to: 6; duration: 2000 }
+ QQ2.NumberAnimation { target: sphere1Transform; property: "x"; to: -10; duration: 2000 }
+ }
+
+ property PointLight light : PointLight {
+ color : "green"
+ intensity : 5.0
+ }
+
+ components : [
+ sphereMesh,
+ material,
+ sphere1.transform,
+ sphere1.light,
+ frameGraph.sceneLayer
+ ]
+ }
+
+ Entity {
+ id : sphere2
+
+ property Material material : Material {
+ effect : sceneMaterialEffect
+ parameters : Parameter { name : "meshColor"; value : "green" }
+ }
+
+ property PointLight light : PointLight {
+ color : "orange"
+ intensity : 2.0
+ }
+
+ property Transform transform: Transform {
+ translation: Qt.vector3d(5, 0, 5)
+ }
+
+ components : [
+ sphereMesh,
+ sphere2.transform,
+ material,
+ sphere2.light,
+ frameGraph.sceneLayer
+ ]
+ }
+
+ Entity {
+ id: light3
+ property PointLight light : PointLight {
+ color : "white"
+ intensity : 2.0
+ }
+
+ property Material material : Material {
+ effect : sceneMaterialEffect
+ parameters : Parameter { name : "meshColor"; value : "red" }
+ }
+
+ property Transform transform: Transform {
+ id: light3Transform
+ property real y: 2.0
+ translation: Qt.vector3d(2, y, 7)
+ }
+
+ QQ2.SequentialAnimation {
+ loops: QQ2.Animation.Infinite
+ running: true
+ QQ2.NumberAnimation { target: light3Transform; property: "y"; to: 6; duration: 1000; easing.type: QQ2.Easing.InOutQuad }
+ QQ2.NumberAnimation { target: light3Transform; property: "y"; to: -6; duration: 1000; easing.type: QQ2.Easing.InOutQuint }
+ }
+
+ components: [
+ sphereMesh,
+ material,
+ light,
+ transform,
+ frameGraph.sceneLayer
+ ]
+ }
+
+ Entity {
+ id: light4
+ property PointLight light : PointLight {
+ color : "white"
+ intensity : 3.0
+ }
+ property Transform transform: Transform {
+ translation: Qt.vector3d(5, 2, 7)
+ }
+
+ components: [
+ light4.light,
+ light4.transform,
+ frameGraph.sceneLayer
+ ]
+ }
+ }
+}
diff --git a/tests/manual/dynamicscene-cpp/boxentity.cpp b/tests/manual/dynamicscene-cpp/boxentity.cpp
new file mode 100644
index 000000000..a39c9a9dc
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/boxentity.cpp
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "boxentity.h"
+
+#include <qmath.h>
+
+BoxEntity::BoxEntity(QNode *parent)
+ : Qt3DCore::QEntity(parent)
+ , m_transform(new Qt3DCore::QTransform())
+ , m_mesh(new Qt3DExtras::QCuboidMesh())
+ , m_material(new Qt3DExtras::QPhongMaterial())
+ , m_angle(0.0f)
+ , m_radius(1.0f)
+{
+ connect(m_material, SIGNAL(diffuseChanged(const QColor &)),
+ this, SIGNAL(diffuseColorChanged(const QColor &)));
+ m_material->setAmbient(Qt::gray);
+ m_material->setSpecular(Qt::white);
+ m_material->setShininess(150.0f);
+
+ addComponent(m_transform);
+ addComponent(m_mesh);
+ addComponent(m_material);
+}
+
+void BoxEntity::setDiffuseColor(const QColor &diffuseColor)
+{
+ m_material->setDiffuse(diffuseColor);
+}
+
+void BoxEntity::setAngle(float arg)
+{
+ if (m_angle == arg)
+ return;
+
+ m_angle = arg;
+ emit angleChanged();
+ updateTransformation();
+}
+
+void BoxEntity::setRadius(float arg)
+{
+ if (m_radius == arg)
+ return;
+
+ m_radius = arg;
+ emit radiusChanged();
+ updateTransformation();
+}
+
+QColor BoxEntity::diffuseColor()
+{
+ return m_material->diffuse();
+}
+
+float BoxEntity::angle() const
+{
+ return m_angle;
+}
+
+float BoxEntity::radius() const
+{
+ return m_radius;
+}
+
+void BoxEntity::updateTransformation()
+{
+ m_transform->setTranslation(QVector3D(qCos(m_angle) * m_radius,
+ 1.0f,
+ qSin(m_angle) * m_radius));
+}
+
diff --git a/tests/manual/dynamicscene-cpp/boxentity.h b/tests/manual/dynamicscene-cpp/boxentity.h
new file mode 100644
index 000000000..f9fdb9580
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/boxentity.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BOXENTITY_H
+#define BOXENTITY_H
+
+#include <Qt3DCore/QEntity>
+#include <Qt3DCore/QTransform>
+#include <Qt3DExtras/QCuboidMesh>
+#include <Qt3DExtras/QPhongMaterial>
+
+class BoxEntity : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QColor diffuseColor READ diffuseColor WRITE setDiffuseColor NOTIFY diffuseColorChanged)
+ Q_PROPERTY(float angle READ angle WRITE setAngle NOTIFY angleChanged)
+ Q_PROPERTY(float radius READ radius WRITE setRadius NOTIFY radiusChanged)
+
+public:
+ BoxEntity(QNode *parent = 0);
+
+ QColor diffuseColor();
+ float angle() const;
+ float radius() const;
+
+public Q_SLOTS:
+ void setDiffuseColor(const QColor &diffuseColor);
+ void setAngle(float arg);
+ void setRadius(float arg);
+
+Q_SIGNALS:
+ void diffuseColorChanged(const QColor &);
+ void angleChanged();
+ void radiusChanged();
+
+private:
+ void updateTransformation();
+
+ Qt3DCore::QTransform *m_transform;
+ Qt3DExtras::QCuboidMesh *m_mesh;
+ Qt3DExtras::QPhongMaterial *m_material;
+ float m_angle;
+ float m_radius;
+};
+
+#endif // BOXENTITY_H
diff --git a/tests/manual/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc b/tests/manual/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc
new file mode 100644
index 000000000..4c5709837
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/doc/src/dynamicscene-cpp.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example dynamicscene-cpp
+ \title Qt 3D: Dynamic Scene C++ Example
+ \ingroup qt3d-examples-cpp
+*/
diff --git a/tests/manual/dynamicscene-cpp/dynamicscene-cpp.pro b/tests/manual/dynamicscene-cpp/dynamicscene-cpp.pro
new file mode 100644
index 000000000..21ae58fed
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/dynamicscene-cpp.pro
@@ -0,0 +1,14 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dextras
+
+SOURCES += \
+ main.cpp \
+ examplescene.cpp \
+ boxentity.cpp
+
+HEADERS += \
+ examplescene.h \
+ boxentity.h
diff --git a/tests/manual/dynamicscene-cpp/examplescene.cpp b/tests/manual/dynamicscene-cpp/examplescene.cpp
new file mode 100644
index 000000000..b11e2f54a
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/examplescene.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "examplescene.h"
+#include "boxentity.h"
+
+#include <QTimer>
+#include <qmath.h>
+
+ExampleScene::ExampleScene(Qt3DCore::QNode *parent)
+ : Qt3DCore::QEntity(parent)
+ , m_timer(new QTimer(this))
+ , m_even(true)
+{
+ buildScene();
+ QObject::connect(m_timer, SIGNAL(timeout()), SLOT(updateScene()));
+ m_timer->setInterval(1200);
+ m_timer->start();
+}
+
+ExampleScene::~ExampleScene()
+{
+ qDeleteAll(m_entities);
+}
+
+void ExampleScene::updateScene()
+{
+ for (int i = 0; i < m_entities.size(); ++i) {
+ const bool visible = (i % 2) ^ m_even;
+ m_entities[i]->setParent(visible ? this : nullptr);
+ }
+ m_even = !m_even;
+}
+
+void ExampleScene::buildScene()
+{
+ int count = 20;
+ const float radius = 5.0f;
+
+ for (int i = 0; i < count; ++i) {
+ BoxEntity *entity = new BoxEntity;
+ const float angle = M_PI * 2.0f * float(i) / count;
+ entity->setAngle(angle);
+ entity->setRadius(radius);
+ entity->setDiffuseColor(QColor(qFabs(qCos(angle)) * 255, 204, 75));
+ m_entities.append(entity);
+ }
+}
+
diff --git a/tests/manual/dynamicscene-cpp/examplescene.h b/tests/manual/dynamicscene-cpp/examplescene.h
new file mode 100644
index 000000000..cac6330f3
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/examplescene.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef EXAMPLESCENE_H
+#define EXAMPLESCENE_H
+
+#include <Qt3DCore/QEntity>
+
+class BoxEntity;
+
+QT_BEGIN_NAMESPACE
+class QTimer;
+QT_END_NAMESPACE
+
+class ExampleScene : public Qt3DCore::QEntity
+{
+ Q_OBJECT
+
+public:
+ explicit ExampleScene(Qt3DCore::QNode *parent = 0);
+ ~ExampleScene();
+
+private Q_SLOTS:
+ void updateScene();
+ void buildScene();
+
+private:
+ QVector<BoxEntity *> m_entities;
+ QTimer *m_timer;
+ bool m_even;
+};
+
+#endif // EXAMPLESCENE_H
diff --git a/tests/manual/dynamicscene-cpp/main.cpp b/tests/manual/dynamicscene-cpp/main.cpp
new file mode 100644
index 000000000..ebc36ab5f
--- /dev/null
+++ b/tests/manual/dynamicscene-cpp/main.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+
+#include <Qt3DCore/QAspectEngine>
+#include <Qt3DRender/QCamera>
+
+#include <Qt3DInput/QInputAspect>
+
+#include <Qt3DRender/QRenderAspect>
+#include <Qt3DExtras/QForwardRenderer>
+
+#include "examplescene.h"
+#include <Qt3DExtras/qt3dwindow.h>
+#include <Qt3DExtras/qfirstpersoncameracontroller.h>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Qt3DWindow view;
+
+ ExampleScene *sceneRoot = new ExampleScene();
+
+ // Scene Camera
+ Qt3DRender::QCamera *basicCamera = view.camera();
+ basicCamera->setProjectionType(Qt3DRender::QCameraLens::PerspectiveProjection);
+ basicCamera->setAspectRatio(view.width() / view.height());
+ basicCamera->setUpVector(QVector3D(0.0f, 1.0f, 0.0f));
+ basicCamera->setViewCenter(QVector3D(0.0f, 3.5f, 0.0f));
+ basicCamera->setPosition(QVector3D(0.0f, 3.5f, 25.0f));
+
+ // For camera controls
+ Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(sceneRoot);
+ camController->setCamera(basicCamera);
+
+ view.setRootEntity(sceneRoot);
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/enabled-qml/doc/src/enabled-qml.qdoc b/tests/manual/enabled-qml/doc/src/enabled-qml.qdoc
new file mode 100644
index 000000000..cb10772bd
--- /dev/null
+++ b/tests/manual/enabled-qml/doc/src/enabled-qml.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example enabled-qml
+ \title Qt 3D: Enabled QML Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/enabled-qml/enabled-qml.pro b/tests/manual/enabled-qml/enabled-qml.pro
new file mode 100644
index 000000000..c3f69289b
--- /dev/null
+++ b/tests/manual/enabled-qml/enabled-qml.pro
@@ -0,0 +1,12 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dquick qml 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ enabled-qml.qrc
+
diff --git a/examples/qt3d/enabled-qml/enabled-qml.qrc b/tests/manual/enabled-qml/enabled-qml.qrc
index 5f6483ac3..5f6483ac3 100644
--- a/examples/qt3d/enabled-qml/enabled-qml.qrc
+++ b/tests/manual/enabled-qml/enabled-qml.qrc
diff --git a/tests/manual/enabled-qml/main.cpp b/tests/manual/enabled-qml/main.cpp
new file mode 100644
index 000000000..349d7ad31
--- /dev/null
+++ b/tests/manual/enabled-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/enabled-qml/main.qml b/tests/manual/enabled-qml/main.qml
new file mode 100644
index 000000000..8ee933eb6
--- /dev/null
+++ b/tests/manual/enabled-qml/main.qml
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+import QtQuick 2.0 as QQ2
+
+Entity {
+ id: sceneRoot
+ property int counter: 0
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: Viewport {
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+ enabled: counter !== 5
+
+ RenderSurfaceSelector {
+
+ ClearBuffers {
+ buffers : ClearBuffers.ColorDepthBuffer
+ clearColor: "white"
+ enabled: counter !== 6
+ }
+
+ CameraSelector {
+ camera: camera
+ enabled: counter !== 7
+
+ LayerFilter {
+ enabled: counter === 12
+ layers: sceneLayer
+ }
+ }
+ }
+ }
+ }
+ ]
+
+ QQ2.Timer {
+ interval: 500
+ repeat: true
+ running: true
+ onTriggered: {
+ counter += 1;
+ if (counter > 15)
+ counter = 0;
+ }
+ }
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ enabled: counter !== 4
+ position: Qt.vector3d(0, 10, 10)
+ viewCenter: Qt.vector3d(0, 0, 0)
+ upVector: Qt.vector3d(0, 1, 0)
+ }
+
+ // Sphere
+ Entity {
+ SphereMesh {
+ id: sphereMesh
+ enabled: counter !== 0
+ }
+
+ PhongMaterial {
+ id: material
+ ambient: "dodgerblue"
+ diffuse: "chartreuse"
+ specular: "ghostwhite"
+ enabled: counter !== 1
+ }
+
+ Layer {
+ id: sceneLayer
+ enabled: counter !== 2
+ }
+
+ Transform {
+ id: transform
+ property real x: 0.0
+ property real y: 0.0
+ property real z: 0.0
+ translation: Qt.vector3d(x, y, z)
+ enabled: counter !== 3
+ }
+
+ QQ2.SequentialAnimation {
+ running: true
+ loops: QQ2.Animation.Infinite
+ QQ2.NumberAnimation {
+ target: transform; property: "x"
+ from: 0; to: 5;
+ duration: 550
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: transform; property: "y"
+ from: 0; to: 5;
+ duration: 650
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: transform; property: "z"
+ from: 0; to: 5;
+ duration: 350
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: transform; property: "x"
+ from: 5; to: 0;
+ duration: 550
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: transform; property: "y"
+ from: 5; to: 0;
+ duration: 350
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ QQ2.NumberAnimation {
+ target: transform; property: "z"
+ from: 5; to: 0;
+ duration: 650
+ easing.type: QQ2.Easing.InOutQuad
+ }
+ }
+
+ components: [sphereMesh, material, sceneLayer, transform]
+ }
+
+ // Floor
+ Entity {
+ PlaneMesh {
+ id: planeMesh
+ width: 25.0
+ height: 10
+ }
+
+ PhongMaterial {
+ id: floorMaterial
+ ambient: "lawngreen"
+ diffuse: "forestgreen"
+ specular: "floralwhite"
+ shininess: 0.5
+ }
+
+ Layer {
+ id: floorLayer
+ }
+
+ components: [planeMesh, floorMaterial, floorLayer]
+ }
+}
+
diff --git a/tests/manual/gltf/Wine.qml b/tests/manual/gltf/Wine.qml
new file mode 100644
index 000000000..fc25cfd62
--- /dev/null
+++ b/tests/manual/gltf/Wine.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property vector3d position: Qt.vector3d(0, 0, 0)
+ property real angleX: 0
+ property real angleY: 0
+ property real angleZ: 0
+ property real scale: 1
+
+ components: [
+ Transform {
+ translation: root.position
+ rotation: fromEulerAngles(root.angleX, root.angleY, root.angleZ)
+ scale: root.scale
+ },
+ SceneLoader {
+ source: "qrc:/assets/gltf/wine/wine.gltf"
+ }
+ ]
+}
diff --git a/tests/manual/gltf/doc/src/gltf.qdoc b/tests/manual/gltf/doc/src/gltf.qdoc
new file mode 100644
index 000000000..04c57c670
--- /dev/null
+++ b/tests/manual/gltf/doc/src/gltf.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example gltf
+ \title Qt 3D: glTF Assets Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/gltf/gltf.pro b/tests/manual/gltf/gltf.pro
new file mode 100644
index 000000000..443141685
--- /dev/null
+++ b/tests/manual/gltf/gltf.pro
@@ -0,0 +1,18 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+HEADERS += \
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ Wine.qml
+
+RESOURCES += \
+ gltf_example.qrc \
+ ../../../examples/qt3d/exampleresources/gltf.qrc
diff --git a/examples/qt3d/gltf/gltf_example.qrc b/tests/manual/gltf/gltf_example.qrc
index 0da7ea21f..0da7ea21f 100644
--- a/examples/qt3d/gltf/gltf_example.qrc
+++ b/tests/manual/gltf/gltf_example.qrc
diff --git a/tests/manual/gltf/main.cpp b/tests/manual/gltf/main.cpp
new file mode 100644
index 000000000..8fc9cd8e2
--- /dev/null
+++ b/tests/manual/gltf/main.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+#include <QOpenGLContext>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ const bool isES = QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES
+ || view.requestedFormat().renderableType() == QSurfaceFormat::OpenGLES;
+ if (!isES)
+ qDebug("Using a non-OpenGL ES context. This may result in no material on the model "
+ "as currently the standard glTF format only includes OpenGL ES 2.0 shaders. "
+ "To overcome this, run the application on OpenGL ES or use the qgltf tool "
+ "with -g to generate a slightly extended glTF asset from the original COLLADA source.");
+
+ return app.exec();
+}
diff --git a/tests/manual/gltf/main.qml b/tests/manual/gltf/main.qml
new file mode 100644
index 000000000..1afb8c48e
--- /dev/null
+++ b/tests/manual/gltf/main.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 20.0, -120.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 10.0, 0.0 )
+ }
+
+ FirstPersonCameraController { camera: camera }
+
+ RenderSettings {
+ id : renderSettings
+ activeFrameGraph : Viewport {
+ CameraSelector {
+ camera: camera
+ ClearBuffers {
+ buffers : ClearBuffers.ColorDepthBuffer
+ clearColor: "black"
+ SortPolicy {
+ sortTypes: [ SortType.BackToFront ]
+ }
+ }
+ }
+ }
+ }
+
+ components: [ renderSettings ]
+
+ Wine {
+ id: wineRack
+ position: Qt.vector3d(-60.0, 0.0, 50.0)
+ angleX: 180
+ }
+}
diff --git a/tests/manual/gooch-qml/MyEntity.qml b/tests/manual/gooch-qml/MyEntity.qml
new file mode 100644
index 000000000..0867c0f0e
--- /dev/null
+++ b/tests/manual/gooch-qml/MyEntity.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+ property alias position: transform.translation
+ property alias scale: transform.scale
+ property alias material: gooch
+ property alias source: mesh.source
+
+ components: [
+ Transform { id: transform },
+ Mesh { id: mesh },
+ GoochMaterial { id: gooch }
+ ]
+}
diff --git a/tests/manual/gooch-qml/gooch-qml.pro b/tests/manual/gooch-qml/gooch-qml.pro
new file mode 100644
index 000000000..b0f2b62d2
--- /dev/null
+++ b/tests/manual/gooch-qml/gooch-qml.pro
@@ -0,0 +1,16 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dquick 3dinput qml quick 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ MyEntity.qml
+
+RESOURCES += \
+ gooch-qml.qrc \
+ ../../../examples/qt3d/exampleresources/obj.qrc
diff --git a/examples/qt3d/gooch-qml/gooch-qml.qrc b/tests/manual/gooch-qml/gooch-qml.qrc
index 6cc293f70..6cc293f70 100644
--- a/examples/qt3d/gooch-qml/gooch-qml.qrc
+++ b/tests/manual/gooch-qml/gooch-qml.qrc
diff --git a/tests/manual/gooch-qml/main.cpp b/tests/manual/gooch-qml/main.cpp
new file mode 100644
index 000000000..95044bf67
--- /dev/null
+++ b/tests/manual/gooch-qml/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <Qt3DQuick/QQmlAspectEngine>
+#include <QGuiApplication>
+#include <QQmlEngine>
+#include <QQmlContext>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+ // Expose the window as a context property so we can set the aspect ratio
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/gooch-qml/main.qml b/tests/manual/gooch-qml/main.qml
new file mode 100644
index 000000000..571b894ee
--- /dev/null
+++ b/tests/manual/gooch-qml/main.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+import QtQuick 2.2 as QQ2
+
+Entity {
+ id: sceneRoot
+
+ FirstPersonCameraController { camera: mainCamera }
+
+ components: [
+ RenderSettings {
+ ForwardRenderer {
+ camera: mainCamera
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ Camera {
+ id: mainCamera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 22.5
+ aspectRatio: _window.width / _window.height
+ nearPlane: 0.01
+ farPlane: 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 15.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ }
+
+ MyEntity {
+ id: myEntity
+
+ source: "assets/obj/trefoil.obj"
+ scale: 1.0
+ material.diffuse: Qt.rgba( 1.0, 0.75, 1.0, 1.0 )
+ material.specular: Qt.rgba( 0.2, 0.2, 0.2, 1.0 )
+ material.alpha: 0.2
+ material.beta: 0.6
+ }
+}
diff --git a/tests/manual/keyboardinput-qml/SphereEntity.qml b/tests/manual/keyboardinput-qml/SphereEntity.qml
new file mode 100644
index 000000000..2b7b449d7
--- /dev/null
+++ b/tests/manual/keyboardinput-qml/SphereEntity.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import QtQuick 2.3 as QQ2
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+ property alias position: transform.translation
+ property alias color: material.diffuse
+ property alias input: input
+
+ PhongMaterial { id: material }
+
+ SphereMesh { id: sphereMesh }
+
+ Transform {
+ id: transform
+ scale: root.input.focus ? 2 : 1
+
+ QQ2.Behavior on scale {
+ QQ2.NumberAnimation {
+ duration: 250
+ }
+ }
+ }
+
+ KeyboardHandler { id: input }
+
+ components: [material, sphereMesh, transform, input]
+}
diff --git a/tests/manual/keyboardinput-qml/doc/src/keyboardinput-qml.qdoc b/tests/manual/keyboardinput-qml/doc/src/keyboardinput-qml.qdoc
new file mode 100644
index 000000000..c84671ec3
--- /dev/null
+++ b/tests/manual/keyboardinput-qml/doc/src/keyboardinput-qml.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example keyboardinput-qml
+ \title Qt 3D: Keyboard Input QML Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/keyboardinput-qml/keyboardinput-qml.pro b/tests/manual/keyboardinput-qml/keyboardinput-qml.pro
new file mode 100644
index 000000000..e10c58faf
--- /dev/null
+++ b/tests/manual/keyboardinput-qml/keyboardinput-qml.pro
@@ -0,0 +1,15 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dquick 3dinput quick qml 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+RESOURCES += \
+ keyboardinput-qml.qrc
+
+OTHER_FILES += \
+ main.qml \
+ SphereEntity.qml
diff --git a/examples/qt3d/keyboardinput-qml/keyboardinput-qml.qrc b/tests/manual/keyboardinput-qml/keyboardinput-qml.qrc
index 62d3c1b81..62d3c1b81 100644
--- a/examples/qt3d/keyboardinput-qml/keyboardinput-qml.qrc
+++ b/tests/manual/keyboardinput-qml/keyboardinput-qml.qrc
diff --git a/tests/manual/keyboardinput-qml/main.cpp b/tests/manual/keyboardinput-qml/main.cpp
new file mode 100644
index 000000000..70a8ec467
--- /dev/null
+++ b/tests/manual/keyboardinput-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/keyboardinput-qml/main.qml b/tests/manual/keyboardinput-qml/main.qml
new file mode 100644
index 000000000..cc65c4a83
--- /dev/null
+++ b/tests/manual/keyboardinput-qml/main.qml
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 12.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ FirstPersonCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ camera: camera
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ KeyboardDevice {
+ id: keyboardDevice
+ }
+
+ SphereEntity {
+ id: sphere1
+ position: Qt.vector3d(-5, 0, 0)
+ color: "red"
+ input.onTabPressed: sphere2.input.focus = true
+ input.focus: true
+ input.sourceDevice: keyboardDevice
+ }
+
+ SphereEntity {
+ id: sphere2
+ color: "green"
+ input.onTabPressed: sphere3.input.focus = true
+ input.sourceDevice: keyboardDevice
+ }
+
+ SphereEntity {
+ id: sphere3
+ position: Qt.vector3d(5, 0, 0)
+ color: "blue"
+ input.onTabPressed: sphere1.input.focus = true
+ input.sourceDevice: keyboardDevice
+ }
+}
diff --git a/tests/manual/loader-qml/CuboidEntity.qml b/tests/manual/loader-qml/CuboidEntity.qml
new file mode 100644
index 000000000..8555b6903
--- /dev/null
+++ b/tests/manual/loader-qml/CuboidEntity.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ components: [ mesh, phongMaterial, transform ]
+
+ CuboidMesh {
+ id: mesh
+ yzMeshResolution: Qt.size(2, 2)
+ xzMeshResolution: Qt.size(2, 2)
+ xyMeshResolution: Qt.size(2, 2)
+ }
+
+ GoochMaterial {
+ id: phongMaterial
+ }
+
+ Transform {
+ id: transform
+ property real userAngle: 0.0
+ scale: 4
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
+ }
+
+ QQ2.ColorAnimation {
+ target: phongMaterial
+ property: "warmColor"
+ from: "red"
+ to: "blue"
+ duration: 2500
+ loops: QQ2.Animation.Infinite
+ running: true
+ }
+
+ QQ2.NumberAnimation {
+ target: transform
+ property: "userAngle"
+ duration: 750
+ loops: QQ2.Animation.Infinite
+ running: true
+ easing.type: QQ2.Easing.InOutQuad
+ from: 0
+ to: 360
+ }
+}
diff --git a/tests/manual/loader-qml/SphereEntity.qml b/tests/manual/loader-qml/SphereEntity.qml
new file mode 100644
index 000000000..8e11de99e
--- /dev/null
+++ b/tests/manual/loader-qml/SphereEntity.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ components: [ mesh, material, transform ]
+
+ SphereMesh {
+ id: mesh
+ radius: 3
+ }
+
+ Transform {
+ id: transform
+ scale: 3
+ }
+
+ QQ2.ColorAnimation {
+ target: material
+ property: "diffuse"
+ from: "yellow"
+ to: "orange"
+ duration: 1500
+ loops: QQ2.Animation.Infinite
+ running: true
+ }
+
+ QQ2.NumberAnimation {
+ target: transform
+ property: "scale"
+ duration: 1500
+ loops: QQ2.Animation.Infinite
+ running: true
+ easing.type: QQ2.Easing.InOutQuad
+ from: 1
+ to: 1.5
+ }
+}
diff --git a/tests/manual/loader-qml/doc/src/loader-qml.qdoc b/tests/manual/loader-qml/doc/src/loader-qml.qdoc
new file mode 100644
index 000000000..9c25d4899
--- /dev/null
+++ b/tests/manual/loader-qml/doc/src/loader-qml.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example loader-qml
+ \title Qt 3D: Loader QML Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/loader-qml/loader-qml.pro b/tests/manual/loader-qml/loader-qml.pro
new file mode 100644
index 000000000..e40d021f4
--- /dev/null
+++ b/tests/manual/loader-qml/loader-qml.pro
@@ -0,0 +1,16 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ SphereEntity.qml \
+ CuboidEntity.qml
+
+RESOURCES += \
+ loader-qml.qrc
diff --git a/examples/qt3d/loader-qml/loader-qml.qrc b/tests/manual/loader-qml/loader-qml.qrc
index 8cf177b62..8cf177b62 100644
--- a/examples/qt3d/loader-qml/loader-qml.qrc
+++ b/tests/manual/loader-qml/loader-qml.qrc
diff --git a/tests/manual/loader-qml/main.cpp b/tests/manual/loader-qml/main.cpp
new file mode 100644
index 000000000..70a8ec467
--- /dev/null
+++ b/tests/manual/loader-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/loader-qml/main.qml b/tests/manual/loader-qml/main.qml
new file mode 100644
index 000000000..272331911
--- /dev/null
+++ b/tests/manual/loader-qml/main.qml
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ OrbitCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ camera: camera
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+
+ PhongMaterial {
+ id: material
+ diffuse: "yellow"
+ }
+
+ TorusMesh {
+ id: torusMesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ Transform {
+ id: torusTransform
+ scale3D: Qt.vector3d(1.5, 1, 0.5)
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
+ }
+
+ Entity {
+ id: torusEntity
+ components: [ torusMesh, material, torusTransform ]
+ }
+
+ QQ2.Timer {
+ interval: 1000
+ running: true
+ repeat: true
+ property bool hasSphere: true
+
+ onTriggered: {
+ loader.source = hasSphere ? "qrc:/SphereEntity.qml" : "qrc:/CuboidEntity.qml"
+ hasSphere = !hasSphere
+ }
+ }
+
+ EntityLoader {
+ id: loader
+ components: [ revolutionTransform ]
+ }
+
+ Transform {
+ id: revolutionTransform
+ property real userAngle: 0.0
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.rotate(userAngle, Qt.vector3d(0, 1, 0));
+ m.translate(Qt.vector3d(20, 0, 0));
+ return m;
+ }
+ }
+
+ QQ2.NumberAnimation {
+ target: revolutionTransform
+ property: "userAngle"
+ duration: 10000
+ from: 0
+ to: 360
+
+ loops: QQ2.Animation.Infinite
+ running: true
+ }
+}
diff --git a/tests/manual/manual.pri b/tests/manual/manual.pri
new file mode 100644
index 000000000..eb8a7f829
--- /dev/null
+++ b/tests/manual/manual.pri
@@ -0,0 +1,3 @@
+TEMPLATE = app
+
+QT += 3dextras
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
new file mode 100644
index 000000000..534f0e21f
--- /dev/null
+++ b/tests/manual/manual.pro
@@ -0,0 +1,33 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ assimp \
+ bigscene-cpp \
+ bigmodel-qml \
+ bigscene-instanced-qml \
+ clip-planes-qml \
+ component-changes \
+ custom-mesh-cpp \
+ custom-mesh-qml \
+ cylinder-cpp \
+ cylinder-qml \
+ deferred-renderer-cpp \
+ deferred-renderer-qml \
+ dynamicscene-cpp \
+ enabled-qml \
+ gltf \
+ gooch-qml \
+ keyboardinput-qml \
+ loader-qml \
+ mouseinput-qml \
+ picking-qml \
+ plasma \
+ scene3d-loader \
+ simple-shaders-qml \
+ skybox \
+ tessellation-modes \
+ transforms-qml \
+ transparency-qml \
+ transparency-qml-scene3d
+
+qtHaveModule(widgets): SUBDIRS += assimp-cpp
diff --git a/tests/manual/mouseinput-qml/main.cpp b/tests/manual/mouseinput-qml/main.cpp
new file mode 100644
index 000000000..e1a359d2a
--- /dev/null
+++ b/tests/manual/mouseinput-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/mouseinput-qml/main.qml b/tests/manual/mouseinput-qml/main.qml
new file mode 100644
index 000000000..de7d115c2
--- /dev/null
+++ b/tests/manual/mouseinput-qml/main.qml
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ OrbitCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ ForwardRenderer {
+ camera: camera
+ clearColor: "black"
+ }
+ renderPolicy: RenderSettings.Always
+ },
+ InputSettings {}
+ ]
+
+ SphereMesh {
+ id: sphereMesh
+ radius: 3
+ }
+
+ PhongMaterial {
+ id: material
+ diffuse: "green"
+ }
+
+ MouseDevice {
+ id: mouseDevice
+ }
+
+ Entity {
+ id: sphere1
+
+ property real scaleFactor: 1.0
+
+ property Transform transform: Transform {
+ scale: sphere1.scaleFactor
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
+ }
+
+ property MouseHandler mouseHandler : MouseHandler {
+ sourceDevice: mouseDevice
+
+ onClicked: {
+ //Signal not implemented yet
+ }
+
+ onReleased: {
+ switch (mouse.button) {
+ case Qt.LeftButton:
+ sphere1.scaleFactor += 0.5;
+ break;
+
+ case Qt.RightButton:
+ sphere1.scaleFactor -= 0.5;
+ break;
+ }
+ }
+ }
+
+ components: [sphereMesh, material, transform, mouseHandler]
+ }
+}
diff --git a/tests/manual/mouseinput-qml/mouseinput-qml.pro b/tests/manual/mouseinput-qml/mouseinput-qml.pro
new file mode 100644
index 000000000..e8b5f42f9
--- /dev/null
+++ b/tests/manual/mouseinput-qml/mouseinput-qml.pro
@@ -0,0 +1,13 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+SOURCES += main.cpp
+
+RESOURCES += \
+ mouseinput-qml.qrc
+
+OTHER_FILES += \
+ main.qml
diff --git a/examples/qt3d/mouseinput-qml/mouseinput-qml.qrc b/tests/manual/mouseinput-qml/mouseinput-qml.qrc
index 5f6483ac3..5f6483ac3 100644
--- a/examples/qt3d/mouseinput-qml/mouseinput-qml.qrc
+++ b/tests/manual/mouseinput-qml/mouseinput-qml.qrc
diff --git a/tests/manual/picking-qml/PickableEntity.qml b/tests/manual/picking-qml/PickableEntity.qml
new file mode 100644
index 000000000..edc0327ee
--- /dev/null
+++ b/tests/manual/picking-qml/PickableEntity.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+ signal pressed(var event)
+ signal clicked(var event)
+ signal released(var event)
+ signal entered()
+ signal exited()
+
+ property Layer layer
+ property real x: 0
+ property real y: 0
+ property real z: 0
+ property alias scale: transform.scale
+ property alias hoverEnabled: objectPicker.hoverEnabled
+ property alias diffuseColor: material.diffuse
+ property alias ambientColor: material.ambient
+ readonly property bool containsMouse: objectPicker.containsMouse
+ readonly property bool isPressed: objectPicker.pressed
+
+ property GeometryRenderer mesh;
+
+ ObjectPicker {
+ id: objectPicker
+ onClicked: root.clicked(pick)
+ onPressed: root.pressed(pick)
+ onReleased: root.released(pick)
+ onEntered: root.entered()
+ onExited: root.exited();
+ }
+
+ PhongMaterial { id: material }
+
+ Transform {
+ id: transform
+ translation: Qt.vector3d(x, y, z)
+ }
+
+ components: [mesh, material, transform, objectPicker, layer]
+}
+
diff --git a/tests/manual/picking-qml/main.cpp b/tests/manual/picking-qml/main.cpp
new file mode 100644
index 000000000..337a0766a
--- /dev/null
+++ b/tests/manual/picking-qml/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+#include <Qt3DQuick/QQmlAspectEngine>
+#include <QQmlContext>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_view", &view);
+ view.setSource(QUrl(QStringLiteral("qrc:/main.qml")));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/picking-qml/main.qml b/tests/manual/picking-qml/main.qml
new file mode 100644
index 000000000..8cd55a627
--- /dev/null
+++ b/tests/manual/picking-qml/main.qml
@@ -0,0 +1,218 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+import QtQuick 2.0 as QQ2
+import QtQuick.Window 2.2 as W
+import QtQuick.Scene3D 2.0
+
+Entity {
+ id: sceneRoot
+
+ property Layer contentLayer: Layer {}
+ property Layer debugLayer: Layer {}
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: _view.width * 0.5 / _view.height
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, -40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ Camera {
+ id: camera2
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: _view.width * 0.5 / _view.height
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 40.0, 5.0, -20.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ FirstPersonCameraController {
+ camera: camera
+ }
+
+ // Draw 2 viewports
+ // one with the content, the other with content + debug volumes
+ components: [
+ RenderSettings {
+ Viewport {
+ normalizedRect: Qt.rect(0.0, 0.0, 1.0, 1.0)
+
+ RenderSurfaceSelector {
+ ClearBuffers {
+ buffers : ClearBuffers.ColorDepthBuffer
+ NoDraw {}
+ }
+
+ Viewport {
+ normalizedRect: Qt.rect(0.0, 0.0, 0.5, 1.0)
+ CameraSelector {
+ camera: camera
+ LayerFilter { layers: sceneRoot.contentLayer }
+ }
+ }
+
+ Viewport {
+ normalizedRect: Qt.rect(0.5, 0.0, 0.5, 1.0)
+ CameraSelector {
+ camera: camera2
+ LayerFilter {
+ // To show Debug volumes
+ layers: [sceneRoot.contentLayer, sceneRoot.debugLayer]
+ }
+ }
+ }
+ }
+ }
+ },
+ InputSettings {}
+ ]
+
+ CuboidMesh { id: cubeMesh }
+
+ PickableEntity {
+ id: cube1
+ property real scaleFactor: isPressed ? 3.0 : 1.0
+ QQ2.Behavior on scaleFactor { QQ2.NumberAnimation { duration: 150; easing.type: QQ2.Easing.InQuad } }
+
+ layer: sceneRoot.contentLayer
+ mesh: cubeMesh
+ scale: cube1.scaleFactor
+ x: -8
+
+ ambientColor: "green"
+ diffuseColor: "green"
+
+ hoverEnabled: true
+ onPressed: cube1.diffuseColor = "orange"
+ onReleased: cube1.diffuseColor = "green"
+ onEntered: cube1.ambientColor = "blue"
+ onExited: cube1.ambientColor = "green"
+ onClicked: console.log("Clicked cube 1")
+ }
+
+ PickableEntity {
+ id: cube2
+ layer: sceneRoot.contentLayer
+ mesh: cubeMesh
+
+ ambientColor: cube2.containsMouse ? "blue" : "red"
+ scale: 1.5
+ hoverEnabled: true
+
+ onPressed: cube2.diffuseColor = "white"
+ onReleased: cube2.diffuseColor = "red"
+
+ property bool toggled: false
+ onClicked: {
+ console.log("Clicked cube 2")
+ toggled = !toggled
+ }
+ }
+ PickableEntity {
+ id: cube3
+ layer: sceneRoot.contentLayer
+ mesh: cubeMesh
+
+ diffuseColor: "yellow"
+
+ property bool toggled: false
+ property real scaleFactor: toggled ? 5.0 : 0.5
+ QQ2.Behavior on scaleFactor { QQ2.NumberAnimation { duration: 200; easing.type: QQ2.Easing.InQuad } }
+
+ scale: cube3.scaleFactor
+ x: 8
+
+ onPressed: cube3.toggled = !cube3.toggled
+ onEntered: cube3.ambientColor = "black"
+ onExited: cube3.ambientColor = "white"
+ onClicked: console.log("Clicked cube 3")
+ }
+
+ Entity {
+ readonly property ObjectPicker objectPicker: ObjectPicker {
+ hoverEnabled: true
+ onPressed: cube4.toggled = !cube4.toggled
+ onClicked: console.log("Clicked cube 4's parent Entity")
+ onEntered: cube4.material.diffuse = "white"
+ onExited: cube4.material.diffuse = "blue"
+ }
+
+ components: [objectPicker]
+
+ Entity {
+ id: cube4
+ property bool toggled: false
+ property real scaleFactor: toggled ? 2.0 : 1.0
+ QQ2.Behavior on scaleFactor { QQ2.NumberAnimation { duration: 200; easing.type: QQ2.Easing.InQuad } }
+
+ readonly property Transform transform: Transform {
+ scale: cube4.scaleFactor
+ translation: Qt.vector3d(3, 4, 0)
+ }
+ readonly property PhongMaterial material: PhongMaterial { diffuse: "red" }
+
+ components: [cubeMesh, transform, material, sceneRoot.contentLayer]
+ }
+ }
+}
diff --git a/tests/manual/picking-qml/picking-qml.pro b/tests/manual/picking-qml/picking-qml.pro
new file mode 100644
index 000000000..886cc91aa
--- /dev/null
+++ b/tests/manual/picking-qml/picking-qml.pro
@@ -0,0 +1,13 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3drender-private 3dinput 3dquick qml quick 3dquickextras
+
+SOURCES += main.cpp
+
+RESOURCES += \
+ picking-qml.qrc
+
+OTHER_FILES += \
+ main.qml
diff --git a/tests/manual/picking-qml/picking-qml.qrc b/tests/manual/picking-qml/picking-qml.qrc
new file mode 100644
index 000000000..15bdbb178
--- /dev/null
+++ b/tests/manual/picking-qml/picking-qml.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>PickableEntity.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/plasma/main.cpp b/tests/manual/plasma/main.cpp
new file mode 100644
index 000000000..7b2c4041b
--- /dev/null
+++ b/tests/manual/plasma/main.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <Qt3DQuick/QQmlAspectEngine>
+#include <QGuiApplication>
+#include <QQmlEngine>
+#include <QQmlContext>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ // Expose the window as a context property so we can set the aspect ratio
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/plasma/main.qml b/tests/manual/plasma/main.qml
new file mode 100644
index 000000000..0a01f699b
--- /dev/null
+++ b/tests/manual/plasma/main.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ components: RenderSettings {
+ ForwardRenderer {}
+ renderPolicy: RenderSettings.Always
+ }
+
+ Entity {
+ components: [
+ PlaneMesh {
+ width: 2.0
+ height: 2.0
+ meshResolution: Qt.size(2, 2)
+ },
+
+ Transform { // Rotate the plane so that it faces us
+ rotation: fromAxisAndAngle(Qt.vector3d(1.0, 0.0, 0.0), 90)
+ },
+
+ Material {
+ parameters: Parameter { name: "winsize"; value: Qt.vector2d(_window.width, _window.height) }
+
+ effect: Effect {
+ techniques: Technique {
+ filterKeys: [ FilterKey{ name: "renderingStyle"; value: "forward" } ]
+
+ graphicsApiFilter {
+ minorVersion: 3
+ majorVersion: 2
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ }
+
+ renderPasses: RenderPass {
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/plasma.vert")
+ fragmentShaderCode: loadSource("qrc:/plasma.frag")
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+}
diff --git a/examples/qt3d/plasma/plasma.frag b/tests/manual/plasma/plasma.frag
index 1e3c7155d..1e3c7155d 100644
--- a/examples/qt3d/plasma/plasma.frag
+++ b/tests/manual/plasma/plasma.frag
diff --git a/tests/manual/plasma/plasma.pro b/tests/manual/plasma/plasma.pro
new file mode 100644
index 000000000..5db6e0e0e
--- /dev/null
+++ b/tests/manual/plasma/plasma.pro
@@ -0,0 +1,18 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dquick qml quick 3dquickextras
+
+HEADERS += \
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ plasma.frag \
+ plasma.vert
+
+RESOURCES += \
+ plasma.qrc
diff --git a/examples/qt3d/plasma/plasma.qrc b/tests/manual/plasma/plasma.qrc
index 5874b2c5c..5874b2c5c 100644
--- a/examples/qt3d/plasma/plasma.qrc
+++ b/tests/manual/plasma/plasma.qrc
diff --git a/examples/qt3d/plasma/plasma.vert b/tests/manual/plasma/plasma.vert
index 2ed46a471..2ed46a471 100644
--- a/examples/qt3d/plasma/plasma.vert
+++ b/tests/manual/plasma/plasma.vert
diff --git a/tests/manual/scene3d-loader/AnimatedEntity.qml b/tests/manual/scene3d-loader/AnimatedEntity.qml
new file mode 100644
index 000000000..0f6b7da1a
--- /dev/null
+++ b/tests/manual/scene3d-loader/AnimatedEntity.qml
@@ -0,0 +1,137 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+import QtQuick 2.0 as QQ2
+
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ FirstPersonCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ camera: camera
+ clearColor: "transparent"
+ }
+ }
+ ]
+
+ PhongMaterial {
+ id: material
+ }
+
+ TorusMesh {
+ id: torusMesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ Transform {
+ id: torusTransform
+ scale3D: Qt.vector3d(1.5, 1, 0.5)
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
+ }
+
+ Entity {
+ id: torusEntity
+ components: [ torusMesh, material, torusTransform ]
+ }
+
+ SphereMesh {
+ id: sphereMesh
+ radius: 3
+ }
+
+ Transform {
+ id: sphereTransform
+ property real userAngle: 0.0
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.rotate(userAngle, Qt.vector3d(0, 1, 0))
+ m.translate(Qt.vector3d(20, 0, 0));
+ return m;
+ }
+ }
+
+ QQ2.NumberAnimation {
+ target: sphereTransform
+ property: "userAngle"
+ duration: 10000
+ from: 0
+ to: 360
+
+ loops: QQ2.Animation.Infinite
+ running: true
+ }
+
+ Entity {
+ id: sphereEntity
+ components: [ sphereMesh, material, sphereTransform ]
+ }
+}
diff --git a/tests/manual/scene3d-loader/Scene.qml b/tests/manual/scene3d-loader/Scene.qml
new file mode 100644
index 000000000..9a98ca7f1
--- /dev/null
+++ b/tests/manual/scene3d-loader/Scene.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Scene3D 2.0
+
+Scene3D {
+ focus: true
+ aspects: "input"
+ AnimatedEntity {}
+}
diff --git a/tests/manual/scene3d-loader/Scene2.qml b/tests/manual/scene3d-loader/Scene2.qml
new file mode 100644
index 000000000..efbb921c5
--- /dev/null
+++ b/tests/manual/scene3d-loader/Scene2.qml
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Scene3D 2.0
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Scene3D {
+ focus: true
+ aspects: "input"
+
+ Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 20.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ RenderSettings {
+ id : renderSettings
+ activeFrameGraph : ForwardRenderer {
+ camera: camera
+ clearColor: "black"
+ }
+ }
+
+ components: [renderSettings]
+
+ TorusMesh {
+ id: mesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ Transform {
+ id: transform
+ scale3D: Qt.vector3d(1.5, 1, 0.5)
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
+ }
+
+ Material {
+ id: material
+ effect : Effect {
+ }
+ }
+
+ Entity {
+ id: mainEntity
+ objectName: "mainEntity"
+ components: [ mesh, material, transform ]
+ }
+ }
+}
diff --git a/tests/manual/scene3d-loader/main.cpp b/tests/manual/scene3d-loader/main.cpp
new file mode 100644
index 000000000..8886263f4
--- /dev/null
+++ b/tests/manual/scene3d-loader/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQuickView>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+
+ QQuickView view;
+
+ view.resize(500, 500);
+ view.setResizeMode(QQuickView::SizeRootObjectToView);
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/scene3d-loader/main.qml b/tests/manual/scene3d-loader/main.qml
new file mode 100644
index 000000000..7442c7d05
--- /dev/null
+++ b/tests/manual/scene3d-loader/main.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Scene3D 2.0
+import QtQuick.Controls 1.2
+
+Item {
+
+ Loader {
+ id: loader
+ anchors.fill: parent
+ focus: true
+ source: "Scene.qml"
+ }
+
+ Row {
+ id: buttonRow
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ bottom: parent.bottom
+ bottomMargin: parent.height * 0.1
+ }
+ spacing: 10
+ Button {
+ text: "Scene 1";
+ isDefault: true
+ onClicked: loader.source = "Scene.qml"
+ }
+ Button {
+ text: "Scene 2";
+ onClicked: loader.source = "Scene2.qml"
+ }
+ }
+}
diff --git a/tests/manual/scene3d-loader/scene3d-loader.pro b/tests/manual/scene3d-loader/scene3d-loader.pro
new file mode 100644
index 000000000..51a071216
--- /dev/null
+++ b/tests/manual/scene3d-loader/scene3d-loader.pro
@@ -0,0 +1,17 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += qml quick 3dcore 3drender 3dinput
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ AnimatedEntity.qml \
+ main.qml \
+ Scene.qml \
+ Scene2.qml
+
+RESOURCES += \
+ scene3d-loader.qrc
diff --git a/examples/qt3d/scene3d-loader/scene3d-loader.qrc b/tests/manual/scene3d-loader/scene3d-loader.qrc
index fdb5e39aa..fdb5e39aa 100644
--- a/examples/qt3d/scene3d-loader/scene3d-loader.qrc
+++ b/tests/manual/scene3d-loader/scene3d-loader.qrc
diff --git a/tests/manual/simple-shaders-qml/main.cpp b/tests/manual/simple-shaders-qml/main.cpp
new file mode 100644
index 000000000..41d2f08a5
--- /dev/null
+++ b/tests/manual/simple-shaders-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/simple-shaders-qml/main.qml b/tests/manual/simple-shaders-qml/main.qml
new file mode 100644
index 000000000..ae3e948e3
--- /dev/null
+++ b/tests/manual/simple-shaders-qml/main.qml
@@ -0,0 +1,214 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.2 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 16/9
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ OrbitCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ TorusMesh {
+ id: torusMesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ Entity {
+ id: torusEntityInlineShader
+
+ property Transform transform: Transform {
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.rotate(45, Qt.vector3d(1, 0, 0));
+ m.translate(Qt.vector3d(-2.0, 0.0, 0.0));
+ return m;
+ }
+ }
+
+ // Shader defined inline
+ property Material material: Material {
+
+ parameters: Parameter { name: "finalColor"; value: "#e76140" /* Inferno Orange */ }
+
+ effect: Effect {
+ techniques: [
+ Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ majorVersion: 3
+ minorVersion: 2
+ profile: GraphicsApiFilter.CoreProfile
+ }
+
+ renderPasses: RenderPass {
+ shaderProgram: ShaderProgram {
+
+ vertexShaderCode: "
+ #version 150
+
+ in vec3 vertexPosition;
+ in vec3 vertexNormal;
+
+ out vec3 position;
+ out vec3 normal;
+
+ uniform mat4 modelView;
+ uniform mat3 modelViewNormal;
+ uniform mat4 mvp;
+
+ void main()
+ {
+ normal = normalize(modelViewNormal * vertexNormal);
+ position = vec3(modelView * vec4(vertexPosition, 1.0));
+ gl_Position = mvp * vec4(vertexPosition, 1.0);
+ }
+ "
+
+ fragmentShaderCode: "
+ #version 150
+
+ in vec3 normal;
+ in vec3 position;
+
+ uniform vec3 finalColor;
+
+ out vec4 fragColor;
+
+ void main()
+ {
+ vec3 n = normalize(normal);
+ vec3 s = normalize(vec3(1.0, 0.0, 1.0) - position);
+ vec3 v = normalize(-position);
+ float diffuse = max(dot(s, n), 0.0);
+ fragColor = vec4(diffuse * finalColor, 1.0);
+ }
+ "
+
+ } // ShaderProgram
+ } // RenderPass
+ } // Technique
+ ] // techniques
+ } // Effect
+ } // Material
+
+ components: [ torusMesh, material, transform ]
+ }
+
+ Entity {
+ id: torusEntitySeparateShader
+
+ property Transform transform: Transform {
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.rotate(15, Qt.vector3d(1, 0, 0));
+ m.translate(Qt.vector3d(2.0, 0.0, 0.0));
+ return m;
+ }
+ }
+
+ // Shader defined in a separate file
+ property Material material: Material {
+
+ parameters: Parameter { name: "finalColor"; value: "yellow" }
+
+ effect: Effect {
+ techniques: [
+ Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ majorVersion: 3
+ minorVersion: 2
+ profile: GraphicsApiFilter.CoreProfile
+ }
+
+ renderPasses: RenderPass {
+ shaderProgram: ShaderProgram {
+ vertexShaderCode: loadSource("qrc:/simple-shader.vert")
+ fragmentShaderCode: loadSource("qrc:/simple-shader.frag")
+ } // ShaderProgram
+ } // namespace RenderPass
+ } // Technique
+ ] // techniques
+ } // Effect
+ } // Material
+
+ components: [ torusMesh, material, transform ]
+ }
+}
diff --git a/examples/qt3d/simple-shaders-qml/simple-shader.frag b/tests/manual/simple-shaders-qml/simple-shader.frag
index 330899070..330899070 100644
--- a/examples/qt3d/simple-shaders-qml/simple-shader.frag
+++ b/tests/manual/simple-shaders-qml/simple-shader.frag
diff --git a/examples/qt3d/simple-shaders-qml/simple-shader.vert b/tests/manual/simple-shaders-qml/simple-shader.vert
index ab8e4a0af..ab8e4a0af 100644
--- a/examples/qt3d/simple-shaders-qml/simple-shader.vert
+++ b/tests/manual/simple-shaders-qml/simple-shader.vert
diff --git a/tests/manual/simple-shaders-qml/simple-shaders-qml.pro b/tests/manual/simple-shaders-qml/simple-shaders-qml.pro
new file mode 100644
index 000000000..76c6c5039
--- /dev/null
+++ b/tests/manual/simple-shaders-qml/simple-shaders-qml.pro
@@ -0,0 +1,16 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ simple-shader.vert \
+ simple-shader.frag
+
+RESOURCES += \
+ simple-shaders-qml.qrc
diff --git a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.qrc b/tests/manual/simple-shaders-qml/simple-shaders-qml.qrc
index d0469bcb4..d0469bcb4 100644
--- a/examples/qt3d/simple-shaders-qml/simple-shaders-qml.qrc
+++ b/tests/manual/simple-shaders-qml/simple-shaders-qml.qrc
diff --git a/tests/manual/skybox/Skybox.qml b/tests/manual/skybox/Skybox.qml
new file mode 100644
index 000000000..84d999771
--- /dev/null
+++ b/tests/manual/skybox/Skybox.qml
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+
+ property alias cameraPosition: transform.translation;
+ property string sourceDirectory: "";
+ property string extension: ".webp"
+
+ property TextureCubeMap skyboxTexture: TextureCubeMap {
+ generateMipMaps: false
+ magnificationFilter: Texture.Linear
+ minificationFilter: Texture.Linear
+ wrapMode {
+ x: WrapMode.ClampToEdge
+ y: WrapMode.ClampToEdge
+ }
+ TextureImage { face: Texture.CubeMapPositiveX; source: sourceDirectory + "_posx" + extension }
+ TextureImage { face: Texture.CubeMapPositiveY; source: sourceDirectory + "_posy" + extension }
+ TextureImage { face: Texture.CubeMapPositiveZ; source: sourceDirectory + "_posz" + extension }
+ TextureImage { face: Texture.CubeMapNegativeX; source: sourceDirectory + "_negx" + extension }
+ TextureImage { face: Texture.CubeMapNegativeY; source: sourceDirectory + "_negy" + extension }
+ TextureImage { face: Texture.CubeMapNegativeZ; source: sourceDirectory + "_negz" + extension }
+ }
+
+ ShaderProgram {
+ id: gl3SkyboxShader
+ vertexShaderCode: loadSource("qrc:/shaders/gl3/skybox.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/gl3/skybox.frag")
+ }
+
+ ShaderProgram {
+ id: gl2es2SkyboxShader
+ vertexShaderCode: loadSource("qrc:/shaders/es2/skybox.vert")
+ fragmentShaderCode: loadSource("qrc:/shaders/es2/skybox.frag")
+ }
+
+ CuboidMesh {
+ id: cuboidMesh
+ yzMeshResolution: Qt.size(2, 2)
+ xzMeshResolution: Qt.size(2, 2)
+ xyMeshResolution: Qt.size(2, 2)
+ }
+
+ Transform {
+ id: transform
+ }
+
+ Material {
+ id: skyboxMaterial
+ parameters: Parameter { name: "skyboxTexture"; value: skyboxTexture}
+
+ effect: Effect {
+ techniques: [
+ // GL3 Technique
+ Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 3
+ minorVersion: 1
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl3SkyboxShader
+ renderStates: [
+ // cull front faces
+ CullFace { mode: CullFace.Front },
+ DepthTest { depthFunction: DepthTest.LessOrEqual }
+ ]
+ }
+ },
+ Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2SkyboxShader
+ renderStates: [
+ CullFace { mode: CullFace.Front },
+ DepthTest { depthFunction: DepthTest.LessOrEqual }
+ ]
+ }
+ },
+ Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+ renderPasses: RenderPass {
+ shaderProgram: gl2es2SkyboxShader
+ renderStates: [
+ CullFace { mode: CullFace.Front },
+ DepthTest { depthFunction: DepthTest.LessOrEqual }
+ ]
+ }
+ }
+ ]
+ }
+ }
+
+ components: [cuboidMesh, skyboxMaterial, transform]
+}
+
diff --git a/tests/manual/skybox/doc/src/skybox.qdoc b/tests/manual/skybox/doc/src/skybox.qdoc
new file mode 100644
index 000000000..a51c35299
--- /dev/null
+++ b/tests/manual/skybox/doc/src/skybox.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example skybox
+ \title Qt 3D: Skybox QML Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/skybox/main.cpp b/tests/manual/skybox/main.cpp
new file mode 100644
index 000000000..066421e9d
--- /dev/null
+++ b/tests/manual/skybox/main.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+ return app.exec();
+}
diff --git a/tests/manual/skybox/main.qml b/tests/manual/skybox/main.qml
new file mode 100644
index 000000000..13468906c
--- /dev/null
+++ b/tests/manual/skybox/main.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+
+ components: [
+ RenderSettings {
+ ForwardRenderer {
+ camera: basicCamera
+ clearColor: "black"
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ Camera {
+ id: basicCamera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 60
+ aspectRatio: 16/9
+ nearPlane: 0.01
+ farPlane: 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ }
+
+ // So that the camera is rendered always at the same position as the camera
+ SkyboxEntity {
+ cameraPosition: basicCamera.position
+ baseName: "qrc:/assets/cubemaps/miramar/miramar"
+ extension: ".webp"
+ }
+
+ FirstPersonCameraController { camera: basicCamera }
+
+ Entity {
+ components: [
+ SphereMesh { radius: 5 },
+ PhongMaterial { diffuse: "dodgerblue" }
+ ]
+ }
+}
+
diff --git a/tests/manual/skybox/skybox.pro b/tests/manual/skybox/skybox.pro
new file mode 100644
index 000000000..7c40af0e5
--- /dev/null
+++ b/tests/manual/skybox/skybox.pro
@@ -0,0 +1,12 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+RESOURCES += \
+ skybox.qrc \
+ ../../../examples/qt3d/exampleresources/cubemaps.qrc
+
+SOURCES += \
+ main.cpp
diff --git a/examples/qt3d/skybox/skybox.qrc b/tests/manual/skybox/skybox.qrc
index 927dfb169..927dfb169 100644
--- a/examples/qt3d/skybox/skybox.qrc
+++ b/tests/manual/skybox/skybox.qrc
diff --git a/tests/manual/tessellation-modes/BasicCamera.qml b/tests/manual/tessellation-modes/BasicCamera.qml
new file mode 100644
index 000000000..213054ec3
--- /dev/null
+++ b/tests/manual/tessellation-modes/BasicCamera.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Camera {
+ id: mainCamera
+ objectName: "mainCamera"
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 22.5
+ aspectRatio: _window.width / _window.height
+ onAspectRatioChanged: console.log( "aspectRatio = " + aspectRatio )
+ nearPlane: 0.01
+ farPlane: 1000.0
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+}
diff --git a/tests/manual/tessellation-modes/TessellatedQuad.qml b/tests/manual/tessellation-modes/TessellatedQuad.qml
new file mode 100644
index 000000000..bc599bcd8
--- /dev/null
+++ b/tests/manual/tessellation-modes/TessellatedQuad.qml
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Examples 1.0
+
+Entity {
+ id: root
+
+ property real x: 0.0
+ property real y: 0.0
+ property real z: 0.0
+ property real scale: 1.0
+ property real theta: 0.0
+ property Material material
+
+ components: [ transform, mesh, root.material ]
+
+ Transform {
+ id: transform
+ translation: Qt.vector3d(root.x, root.y, root.z)
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), root.theta)
+ scale: root.scale
+ }
+
+ TessellatedQuadMesh {
+ id: mesh
+ }
+}
diff --git a/tests/manual/tessellation-modes/TessellatedWireframeEffect.qml b/tests/manual/tessellation-modes/TessellatedWireframeEffect.qml
new file mode 100644
index 000000000..936ad5536
--- /dev/null
+++ b/tests/manual/tessellation-modes/TessellatedWireframeEffect.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Effect {
+ id: root
+
+ // It's expected that users of this will specify the tessellation control and evaluation
+ // shaders and if necessary suitable replacements for the other stages
+ property alias vertexShaderCode: program.vertexShaderCode
+ property alias tessellationControlShaderCode: program.tessellationControlShaderCode
+ property alias tessellationEvaluationShaderCode: program.tessellationEvaluationShaderCode
+ property alias geometryShaderCode: program.geometryShaderCode
+ property alias fragmentShaderCode: program.fragmentShaderCode
+ property alias shaderProgram: program
+
+ parameters: [
+ Parameter { name: "ka"; value: Qt.vector3d( 0.1, 0.1, 0.1 ) },
+ Parameter { name: "kd"; value: Qt.vector3d( 0.7, 0.7, 0.7 ) },
+ Parameter { name: "ks"; value: Qt.vector3d( 0.95, 0.95, 0.95 ) },
+ Parameter { name: "shininess"; value: 150.0 }
+ ]
+
+ techniques: [
+ Technique {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.CoreProfile
+ majorVersion: 4
+ minorVersion: 0
+ }
+
+ filterKeys: [ FilterKey { name: "renderingStyle"; value: "forward" } ]
+
+ parameters: [
+ Parameter { name: "light.position"; value: Qt.vector4d(0.0, 0.0, 0.0, 1.0) },
+ Parameter { name: "light.intensity"; value: Qt.vector3d(1.0, 1.0, 1.0) },
+ Parameter { name: "line.width"; value: 0.8 },
+ Parameter { name: "line.color"; value: Qt.vector4d(1.0, 1.0, 1.0, 1.0) }
+ ]
+
+ renderPasses: [
+ RenderPass {
+ shaderProgram: ShaderProgram {
+ id: program
+ vertexShaderCode: loadSource("qrc:/shaders/passthru.vert")
+ geometryShaderCode: loadSource("qrc:/shaders/robustwireframe.geom")
+ fragmentShaderCode: loadSource("qrc:/shaders/phongwireframe.frag")
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/manual/tessellation-modes/TessellatedWireframeMaterial.qml b/tests/manual/tessellation-modes/TessellatedWireframeMaterial.qml
new file mode 100644
index 000000000..af992b170
--- /dev/null
+++ b/tests/manual/tessellation-modes/TessellatedWireframeMaterial.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Material {
+ id: root
+
+ property color ambient: Qt.rgba( 0.05, 0.05, 0.05, 1.0 )
+ property color diffuse: Qt.rgba( 0.7, 0.7, 0.7, 1.0 )
+ property color specular: Qt.rgba( 0.95, 0.95, 0.95, 1.0 )
+ property real shininess: 150.0
+ property real lineWidth: 1.0
+ property color lineColor: Qt.rgba( 1.0, 1.0, 1.0, 1.0 )
+ property var innerTessLevel: [1.0, 1.0 ]
+ property var outerTessLevel: [1.0, 1.0, 1.0, 1.0]
+
+ parameters: [
+ Parameter { name: "ambient"; value: Qt.vector3d(root.ambient.r, root.ambient.g, root.ambient.b) },
+ Parameter { name: "diffuse"; value: Qt.vector3d(root.diffuse.r, root.diffuse.g, root.diffuse.b) },
+ Parameter { name: "specular"; value: Qt.vector3d(root.specular.r, root.specular.g, root.specular.b) },
+ Parameter { name: "shininess"; value: root.shininess },
+ Parameter { name: "line.width"; value: root.lineWidth },
+ Parameter { name: "line.color"; value: root.lineColor },
+ Parameter { name: "inner[0]"; value: root.innerTessLevel },
+ Parameter { name: "outer[0]"; value: root.outerTessLevel }
+ ]
+}
diff --git a/tests/manual/tessellation-modes/doc/src/tessellation-modes.qdoc b/tests/manual/tessellation-modes/doc/src/tessellation-modes.qdoc
new file mode 100644
index 000000000..c485c5f0e
--- /dev/null
+++ b/tests/manual/tessellation-modes/doc/src/tessellation-modes.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example tessellation-modes
+ \title Qt 3D: Tessellation Modes QML Example
+ \ingroup qt3d-examples-qml
+*/
diff --git a/tests/manual/tessellation-modes/main.cpp b/tests/manual/tessellation-modes/main.cpp
new file mode 100644
index 000000000..a0eae5175
--- /dev/null
+++ b/tests/manual/tessellation-modes/main.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tessellatedquadmesh.h"
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <Qt3DQuick/QQmlAspectEngine>
+#include <QGuiApplication>
+#include <qqml.h>
+#include <QQmlContext>
+#include <QQmlEngine>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+ // Register our custom types
+ qmlRegisterType<TessellatedQuadMesh>("Qt3D.Examples", 1, 0, "TessellatedQuadMesh");
+
+ // Expose the window as a context property so we can set the aspect ratio
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_window", &view);
+
+ // There should be some synchronising mechanism to make sure
+ // the source is set after all aspects have been completely initialized
+ // Otherwise we might encounter cases where an Aspect's QML elements have
+ // not yet been registered
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/tessellation-modes/main.qml b/tests/manual/tessellation-modes/main.qml
new file mode 100644
index 000000000..e37150078
--- /dev/null
+++ b/tests/manual/tessellation-modes/main.qml
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1 as QQ2
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: root
+ objectName: "root"
+
+ // Use the renderer configuration specified in ForwardRenderer.qml
+ // and render from the mainCamera
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ id: renderer
+ camera: mainCamera
+ clearColor: "black"
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ BasicCamera {
+ id: mainCamera
+ position: Qt.vector3d( 0.0, 0.0, 10.0 )
+ }
+
+ OrbitCameraController { camera: mainCamera }
+
+ TessellatedWireframeMaterial {
+ id: quadMaterial
+ ambient: Qt.rgba( 0.2, 0.0, 0.0, 1.0 )
+ diffuse: Qt.rgba( 0.8, 0.0, 0.0, 1.0 )
+
+ property real innerLevel : 1.0
+ property real outerLevel : 1.0
+
+ innerTessLevel : [innerLevel, innerLevel]
+ outerTessLevel : [outerLevel, outerLevel, outerLevel, outerLevel]
+
+ effect: TessellatedWireframeEffect {
+ tessellationControlShaderCode: shaderProgram.loadSource("qrc:/shaders/quads.tcs")
+ tessellationEvaluationShaderCode: shaderProgram.loadSource("qrc:/shaders/quads.tes")
+ }
+
+ QQ2.SequentialAnimation {
+ loops: QQ2.Animation.Infinite
+ running: true
+
+ QQ2.NumberAnimation {
+ target: quadMaterial;
+ properties: "innerLevel,outerLevel";
+ duration: 1000;
+ from: 1.0
+ to: 20.0
+ }
+
+ QQ2.NumberAnimation {
+ target: quadMaterial;
+ properties: "innerLevel,outerLevel";
+ duration: 1000;
+ from: 20.0
+ to: 1.0
+ }
+ }
+ }
+
+ TessellatedQuad {
+ id: quad
+ material: quadMaterial
+ }
+
+ // TODO: Add examples for triangle and isoline tessellation modes
+}
diff --git a/examples/qt3d/tessellation-modes/shaders/flat.frag b/tests/manual/tessellation-modes/shaders/flat.frag
index 6e596d4d6..6e596d4d6 100644
--- a/examples/qt3d/tessellation-modes/shaders/flat.frag
+++ b/tests/manual/tessellation-modes/shaders/flat.frag
diff --git a/examples/qt3d/tessellation-modes/shaders/isolines.tcs b/tests/manual/tessellation-modes/shaders/isolines.tcs
index 624af51cc..624af51cc 100644
--- a/examples/qt3d/tessellation-modes/shaders/isolines.tcs
+++ b/tests/manual/tessellation-modes/shaders/isolines.tcs
diff --git a/examples/qt3d/tessellation-modes/shaders/isolines.tes b/tests/manual/tessellation-modes/shaders/isolines.tes
index f6b984bc8..f6b984bc8 100644
--- a/examples/qt3d/tessellation-modes/shaders/isolines.tes
+++ b/tests/manual/tessellation-modes/shaders/isolines.tes
diff --git a/examples/qt3d/tessellation-modes/shaders/passthru.vert b/tests/manual/tessellation-modes/shaders/passthru.vert
index 71875a55f..71875a55f 100644
--- a/examples/qt3d/tessellation-modes/shaders/passthru.vert
+++ b/tests/manual/tessellation-modes/shaders/passthru.vert
diff --git a/examples/qt3d/tessellation-modes/shaders/phongwireframe.frag b/tests/manual/tessellation-modes/shaders/phongwireframe.frag
index 4fd62007d..4fd62007d 100644
--- a/examples/qt3d/tessellation-modes/shaders/phongwireframe.frag
+++ b/tests/manual/tessellation-modes/shaders/phongwireframe.frag
diff --git a/examples/qt3d/tessellation-modes/shaders/quads.tcs b/tests/manual/tessellation-modes/shaders/quads.tcs
index 367195522..367195522 100644
--- a/examples/qt3d/tessellation-modes/shaders/quads.tcs
+++ b/tests/manual/tessellation-modes/shaders/quads.tcs
diff --git a/examples/qt3d/tessellation-modes/shaders/quads.tes b/tests/manual/tessellation-modes/shaders/quads.tes
index a3fd48441..a3fd48441 100644
--- a/examples/qt3d/tessellation-modes/shaders/quads.tes
+++ b/tests/manual/tessellation-modes/shaders/quads.tes
diff --git a/examples/qt3d/tessellation-modes/shaders/robustwireframe.geom b/tests/manual/tessellation-modes/shaders/robustwireframe.geom
index 02eaaf398..02eaaf398 100644
--- a/examples/qt3d/tessellation-modes/shaders/robustwireframe.geom
+++ b/tests/manual/tessellation-modes/shaders/robustwireframe.geom
diff --git a/examples/qt3d/tessellation-modes/shaders/triangles.tcs b/tests/manual/tessellation-modes/shaders/triangles.tcs
index c311796fd..c311796fd 100644
--- a/examples/qt3d/tessellation-modes/shaders/triangles.tcs
+++ b/tests/manual/tessellation-modes/shaders/triangles.tcs
diff --git a/examples/qt3d/tessellation-modes/shaders/triangles.tes b/tests/manual/tessellation-modes/shaders/triangles.tes
index c833e9587..c833e9587 100644
--- a/examples/qt3d/tessellation-modes/shaders/triangles.tes
+++ b/tests/manual/tessellation-modes/shaders/triangles.tes
diff --git a/tests/manual/tessellation-modes/tessellatedquadmesh.cpp b/tests/manual/tessellation-modes/tessellatedquadmesh.cpp
new file mode 100644
index 000000000..e98ee8936
--- /dev/null
+++ b/tests/manual/tessellation-modes/tessellatedquadmesh.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "tessellatedquadmesh.h"
+
+#include <Qt3DRender/qattribute.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qgeometry.h>
+
+class TessellatedGeometry : public Qt3DRender::QGeometry
+{
+ Q_OBJECT
+public:
+ TessellatedGeometry(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DRender::QGeometry(parent)
+ , m_positionAttribute(new Qt3DRender::QAttribute(this))
+ , m_vertexBuffer(new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, this))
+ {
+ const float positionData[] = {
+ -0.8f, -0.8f, 0.0f,
+ 0.8f, -0.8f, 0.0f,
+ 0.8f, 0.8f, 0.0f,
+ -0.8f, 0.8f, 0.0f
+ };
+
+ const int nVerts = 4;
+ const int size = nVerts * 3 * sizeof(float);
+ QByteArray positionBytes;
+ positionBytes.resize(size);
+ memcpy(positionBytes.data(), positionData, size);
+
+ m_vertexBuffer->setData(positionBytes);
+
+ m_positionAttribute->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
+ m_positionAttribute->setDataType(Qt3DRender::QAttribute::Float);
+ m_positionAttribute->setDataSize(3);
+ m_positionAttribute->setCount(nVerts);
+ m_positionAttribute->setByteStride(3 * sizeof(float));
+ m_positionAttribute->setBuffer(m_vertexBuffer);
+
+ addAttribute(m_positionAttribute);
+ }
+
+private:
+ Qt3DRender::QAttribute *m_positionAttribute;
+ Qt3DRender::QBuffer *m_vertexBuffer;
+};
+
+TessellatedQuadMesh::TessellatedQuadMesh(Qt3DCore::QNode *parent)
+ : Qt3DRender::QGeometryRenderer(parent)
+{
+ setPrimitiveType(Qt3DRender::QGeometryRenderer::Patches);
+ setVerticesPerPatch(4);
+ setGeometry(new TessellatedGeometry(this));
+}
+
+#include "tessellatedquadmesh.moc"
diff --git a/tests/manual/tessellation-modes/tessellatedquadmesh.h b/tests/manual/tessellation-modes/tessellatedquadmesh.h
new file mode 100644
index 000000000..e60c54e86
--- /dev/null
+++ b/tests/manual/tessellation-modes/tessellatedquadmesh.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESSELLATEDQUAD_H
+#define TESSELLATEDQUAD_H
+
+#include <Qt3DRender/qgeometryrenderer.h>
+
+class TessellatedQuadMesh : public Qt3DRender::QGeometryRenderer
+{
+ Q_OBJECT
+public:
+ explicit TessellatedQuadMesh(Qt3DCore::QNode *parent = 0);
+};
+
+#endif // TESSELLATEDQUAD_H
diff --git a/tests/manual/tessellation-modes/tessellation-modes.pro b/tests/manual/tessellation-modes/tessellation-modes.pro
new file mode 100644
index 000000000..5d3e1fae8
--- /dev/null
+++ b/tests/manual/tessellation-modes/tessellation-modes.pro
@@ -0,0 +1,23 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+HEADERS += \
+ tessellatedquadmesh.h
+
+SOURCES += \
+ main.cpp \
+ tessellatedquadmesh.cpp
+
+OTHER_FILES += \
+ main.qml \
+ BasicCamera.qml \
+ TessellatedWireframeEffect.qml \
+ TessellatedWireframeMaterial.qml \
+ TessellatedQuad.qml \
+ shaders/*
+
+RESOURCES += \
+ tessellation-modes.qrc
diff --git a/examples/qt3d/tessellation-modes/tessellation-modes.qrc b/tests/manual/tessellation-modes/tessellation-modes.qrc
index 466c9307a..466c9307a 100644
--- a/examples/qt3d/tessellation-modes/tessellation-modes.qrc
+++ b/tests/manual/tessellation-modes/tessellation-modes.qrc
diff --git a/tests/manual/transforms-qml/RenderableEntity.qml b/tests/manual/transforms-qml/RenderableEntity.qml
new file mode 100644
index 000000000..61e2294a7
--- /dev/null
+++ b/tests/manual/transforms-qml/RenderableEntity.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property Material material: null
+ property alias meshSource: mesh.source
+ property alias translation: transform.translation
+ property alias rotation: transform.rotation
+ property alias scale: transform.scale
+
+ components: [ transform, mesh, material ]
+
+ Transform {
+ id: transform
+ }
+
+ Mesh {
+ id: mesh
+ }
+}
diff --git a/tests/manual/transforms-qml/TemporaryCamera.qml b/tests/manual/transforms-qml/TemporaryCamera.qml
new file mode 100644
index 000000000..95f0ab103
--- /dev/null
+++ b/tests/manual/transforms-qml/TemporaryCamera.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property vector3d pos: Qt.vector3d(0.0, 0.0, 0.0)
+ property vector3d viewCenter: Qt.vector3d(0.0, 0.0, -10.0)
+ property vector3d up: Qt.vector3d(0.0, 1.0, 0.0)
+
+ components: [ transform, lens ]
+
+ Transform {
+ id: transform
+
+ matrix: {
+ var m = Qt.matrix4x4();
+ m.lookAt( root.pos, root.viewCenter, root.up );
+ return m;
+ }
+ }
+
+ CameraLens {
+ id: lens
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: _view.width / _view.height
+ nearPlane: 0.1
+ farPlane: 1000.0
+ }
+}
diff --git a/tests/manual/transforms-qml/TrefoilKnot.qml b/tests/manual/transforms-qml/TrefoilKnot.qml
new file mode 100644
index 000000000..413b7fe8e
--- /dev/null
+++ b/tests/manual/transforms-qml/TrefoilKnot.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+
+Entity {
+ id: root
+
+ property vector3d translation: Qt.vector3d(0.0, 0.0, 0.0)
+ property real scale: 1.0
+ property real theta: 0.0
+ property real phi: 0.0
+ property Material material
+
+ components: [ transform, mesh, root.material ]
+
+ Transform {
+ id: transform
+ translation: root.translation
+ rotation: fromEulerAngles(theta, phi, 0)
+ scale: root.scale
+ }
+
+ Mesh {
+ id: mesh
+ source: "assets/obj/trefoil.obj"
+ }
+}
diff --git a/tests/manual/transforms-qml/main.cpp b/tests/manual/transforms-qml/main.cpp
new file mode 100644
index 000000000..3487e7bb2
--- /dev/null
+++ b/tests/manual/transforms-qml/main.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <Qt3DQuick/QQmlAspectEngine>
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.engine()->qmlEngine()->rootContext()->setContextProperty("_view", &view);
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/transforms-qml/main.qml b/tests/manual/transforms-qml/main.qml
new file mode 100644
index 000000000..f49e161f2
--- /dev/null
+++ b/tests/manual/transforms-qml/main.qml
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+
+Entity {
+ id: sceneRoot
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer {
+ clearColor: Qt.rgba(0, 0.5, 1, 1)
+ camera: camera
+ }
+ }
+ ]
+
+ TemporaryCamera {
+ id: camera
+ pos: Qt.vector3d( 0.0, 0.0, 120.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ up: Qt.vector3d( 0.0, 1.0, 0.0 )
+ }
+
+ RenderableEntity {
+ id: rootEntity
+
+ meshSource: "assets/obj/toyplane.obj"
+ material: PhongMaterial {
+ diffuse: "red"
+ }
+
+ RenderableEntity {
+ id: trefoil
+
+ translation: Qt.vector3d( 0.0, 20.0, 0.0 )
+ scale: 4
+
+ meshSource: "assets/obj/trefoil.obj"
+ material: PhongMaterial {
+ diffuse: "green"
+ }
+
+ RenderableEntity {
+ id: ball
+
+ translation: Qt.vector3d( 0.0, 5.0, 0.0 )
+ scale: 0.2
+
+ meshSource: "assets/obj/ball.obj"
+ material: PhongMaterial {
+ diffuse: "purple"
+ }
+ }
+ }
+ }
+
+ TrefoilKnot {
+ translation: Qt.vector3d( 20, 0, 0 )
+ scale: 6.0
+ phi: 60.0
+ material: PhongMaterial {
+ diffuse: "grey"
+ }
+ }
+}
diff --git a/tests/manual/transforms-qml/transforms-qml.pro b/tests/manual/transforms-qml/transforms-qml.pro
new file mode 100644
index 000000000..b3067db5a
--- /dev/null
+++ b/tests/manual/transforms-qml/transforms-qml.pro
@@ -0,0 +1,18 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += 3dcore 3drender 3dinput 3dquick qml quick 3dquickextras
+
+SOURCES += \
+ main.cpp
+
+OTHER_FILES += \
+ main.qml \
+ RenderableEntity.qml \
+ TemporaryCamera.qml \
+ TrefoilKnot.qml
+
+RESOURCES += \
+ transforms-qml.qrc \
+ ../../../examples/qt3d/exampleresources/obj.qrc
diff --git a/examples/qt3d/transforms-qml/transforms-qml.qrc b/tests/manual/transforms-qml/transforms-qml.qrc
index 9035959d9..9035959d9 100644
--- a/examples/qt3d/transforms-qml/transforms-qml.qrc
+++ b/tests/manual/transforms-qml/transforms-qml.qrc
diff --git a/tests/manual/transparency-qml-scene3d/Scene.qml b/tests/manual/transparency-qml-scene3d/Scene.qml
new file mode 100644
index 000000000..868f29ec1
--- /dev/null
+++ b/tests/manual/transparency-qml-scene3d/Scene.qml
@@ -0,0 +1,206 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Extras 2.0
+import QtQuick 2.2 as QQ2
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 800/600
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ FirstPersonCameraController { camera: camera }
+
+ components: RenderSettings {
+ ForwardRenderer{
+ camera: camera
+ clearColor: Qt.rgba(0.0, 0.5, 1, 1)
+ }
+ }
+
+ TorusMesh {
+ id: torusMesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ SphereMesh {
+ id: sphereMesh
+ radius: 3
+ }
+
+ Transform {
+ id: sphereTransform
+ translation: Qt.vector3d(10, 0, 0)
+ }
+
+ Transform {
+ id: cylinderTransform
+ translation: Qt.vector3d(-10, 0, 0)
+ }
+
+ Entity {
+ id: torusEntity
+ components: [ torusMesh, phongMaterial ]
+ }
+
+ Entity {
+ id: sphereEntity
+ components: [ sphereMesh, alphaMaterial, sphereTransform ]
+ }
+
+ Entity {
+ id: cylinderEntity
+ components: [ sphereMesh, alphaMaterial, cylinderTransform ]
+ }
+
+ Material {
+ id: alphaMaterial
+
+ property real alpha: 0.5
+
+ QQ2.NumberAnimation {
+ duration: 2000
+ loops: QQ2.Animation.Infinite
+ target: alphaMaterial
+ property: "alpha"
+ from: 0.0
+ to: 1.0
+ running: true
+ }
+
+ effect: Effect {
+ parameters: [
+ Parameter { name: "alpha"; value: alphaMaterial.alpha },
+ Parameter { name: "ka"; value: "black" },
+ Parameter { name: "kd"; value: "blue" },
+ Parameter { name: "ks"; value: "white" },
+ Parameter { name: "shininess"; value: 75.0 },
+ Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
+ Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) }
+ ]
+
+ ShaderProgram {
+ id: alphaPhong
+ vertexShaderCode: loadSource("qrc:/phongalpha.vert")
+ fragmentShaderCode: loadSource("qrc:/phongalpha.frag")
+ }
+
+ techniques: [
+ Technique
+ {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+
+ renderPasses: RenderPass {
+ renderStates: [
+ CullFace { mode : CullFace.Back },
+ DepthTest { depthFunction: DepthTest.Less },
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ }
+ ,BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+
+ shaderProgram: alphaPhong
+ }
+ },
+ Technique
+ {
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+
+ renderPasses: RenderPass {
+ renderStates: [
+ CullFace { mode : CullFace.Back },
+ DepthTest { depthFunction: DepthTest.Less },
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ }
+ ,BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+
+ shaderProgram: alphaPhong
+ }
+ }
+ ]
+ }
+ }
+
+ PhongMaterial {
+ id: phongMaterial
+ }
+}
diff --git a/tests/manual/transparency-qml-scene3d/main.cpp b/tests/manual/transparency-qml-scene3d/main.cpp
new file mode 100644
index 000000000..bfb1ad468
--- /dev/null
+++ b/tests/manual/transparency-qml-scene3d/main.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/tests/manual/transparency-qml-scene3d/main.qml b/tests/manual/transparency-qml-scene3d/main.qml
new file mode 100644
index 000000000..d5bb045a9
--- /dev/null
+++ b/tests/manual/transparency-qml-scene3d/main.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.4
+import QtQuick.Window 2.2
+import QtQuick.Scene3D 2.0
+
+Window {
+ visible: true
+ width: 800
+ height: 600
+
+ Scene3D {
+ id: scene3D
+ anchors.fill: parent
+ focus: true
+ aspects: "input"
+ Scene {}
+ }
+}
diff --git a/examples/qt3d/transparency-qml-scene3d/phongalpha.frag b/tests/manual/transparency-qml-scene3d/phongalpha.frag
index 11d4ef0d9..11d4ef0d9 100644
--- a/examples/qt3d/transparency-qml-scene3d/phongalpha.frag
+++ b/tests/manual/transparency-qml-scene3d/phongalpha.frag
diff --git a/examples/qt3d/transparency-qml-scene3d/phongalpha.vert b/tests/manual/transparency-qml-scene3d/phongalpha.vert
index 03a416213..03a416213 100644
--- a/examples/qt3d/transparency-qml-scene3d/phongalpha.vert
+++ b/tests/manual/transparency-qml-scene3d/phongalpha.vert
diff --git a/tests/manual/transparency-qml-scene3d/transparency-qml-scene3d.pro b/tests/manual/transparency-qml-scene3d/transparency-qml-scene3d.pro
new file mode 100644
index 000000000..3fe14f21d
--- /dev/null
+++ b/tests/manual/transparency-qml-scene3d/transparency-qml-scene3d.pro
@@ -0,0 +1,10 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += qml quick 3dcore 3drender 3dinput 3dquick
+
+SOURCES += main.cpp
+
+RESOURCES += transparency-qml-scene3d.qrc
+
diff --git a/examples/qt3d/transparency-qml-scene3d/transparency-qml-scene3d.qrc b/tests/manual/transparency-qml-scene3d/transparency-qml-scene3d.qrc
index f590e2b96..f590e2b96 100644
--- a/examples/qt3d/transparency-qml-scene3d/transparency-qml-scene3d.qrc
+++ b/tests/manual/transparency-qml-scene3d/transparency-qml-scene3d.qrc
diff --git a/tests/manual/transparency-qml/main.cpp b/tests/manual/transparency-qml/main.cpp
new file mode 100644
index 000000000..41d2f08a5
--- /dev/null
+++ b/tests/manual/transparency-qml/main.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Qt3DQuickExtras/qt3dquickwindow.h>
+#include <QGuiApplication>
+
+int main(int argc, char* argv[])
+{
+ QGuiApplication app(argc, argv);
+ Qt3DExtras::Quick::Qt3DQuickWindow view;
+
+ view.setSource(QUrl("qrc:/main.qml"));
+ view.show();
+
+ return app.exec();
+}
diff --git a/tests/manual/transparency-qml/main.qml b/tests/manual/transparency-qml/main.qml
new file mode 100644
index 000000000..2a45b22c8
--- /dev/null
+++ b/tests/manual/transparency-qml/main.qml
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt3D.Core 2.0
+import Qt3D.Render 2.0
+import Qt3D.Input 2.0
+import Qt3D.Extras 2.0
+import QtQuick 2.4 as QQ2
+
+Entity {
+ id: sceneRoot
+
+ Camera {
+ id: camera
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: 800/600
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 0.0, 0.0, 40.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ FirstPersonCameraController { camera: camera }
+
+ components: [
+ RenderSettings {
+ activeFrameGraph: ForwardRenderer{
+ camera: camera
+ clearColor: Qt.rgba(0.0, 0.5, 1, 1)
+ }
+ },
+ // Event Source will be set by the Qt3DQuickWindow
+ InputSettings { }
+ ]
+
+ TorusMesh {
+ id: torusMesh
+ radius: 5
+ minorRadius: 1
+ rings: 100
+ slices: 20
+ }
+
+ SphereMesh {
+ id: sphereMesh
+ radius: 3
+ }
+
+ Transform {
+ id: sphereTransform
+ translation: Qt.vector3d(10, 0, 0)
+ }
+
+ Transform {
+ id: cylinderTransform
+ translation: Qt.vector3d(-10, 0, 0)
+ }
+
+ Entity {
+ id: torusEntity
+ components: [ torusMesh, phongMaterial ]
+ }
+
+ Entity {
+ id: sphereEntity
+ components: [ sphereMesh, alphaMaterial, sphereTransform ]
+ }
+
+ Entity {
+ id: cylinderEntity
+ components: [ sphereMesh, alphaMaterial, cylinderTransform ]
+ }
+
+ Material
+ {
+ id: alphaMaterial
+
+ property real alpha: 0.5
+
+ QQ2.NumberAnimation {
+ duration: 2000
+ loops: QQ2.Animation.Infinite
+ target: alphaMaterial
+ property: "alpha"
+ from: 0.0
+ to: 1.0
+ running: true
+ }
+
+ effect: Effect {
+ FilterKey {
+ id: forward
+ name: "renderingStyle"
+ value: "forward"
+ }
+
+ parameters: [
+ Parameter { name: "alpha"; value: alphaMaterial.alpha },
+ Parameter { name: "ka"; value: "black" },
+ Parameter { name: "kd"; value: "blue" },
+ Parameter { name: "ks"; value: "white" },
+ Parameter { name: "shininess"; value: 75.0 },
+ Parameter { name: "lightPosition"; value: Qt.vector4d(1.0, 1.0, 0.0, 1.0) },
+ Parameter { name: "lightIntensity"; value: Qt.vector3d(1.0, 1.0, 1.0) }
+ ]
+
+ ShaderProgram {
+ id: alphaPhong
+ vertexShaderCode: loadSource("qrc:/phongalpha.vert")
+ fragmentShaderCode: loadSource("qrc:/phongalpha.frag")
+ }
+
+ techniques: [
+ Technique
+ {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGL
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+
+ renderPasses: RenderPass {
+ renderStates: [
+ CullFace { mode : CullFace.Back },
+ DepthTest { depthFunction: DepthTest.Less },
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ }
+ ,BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+
+ shaderProgram: alphaPhong
+ }
+ },
+ Technique
+ {
+ filterKeys: [ forward ]
+ graphicsApiFilter {
+ api: GraphicsApiFilter.OpenGLES
+ profile: GraphicsApiFilter.NoProfile
+ majorVersion: 2
+ minorVersion: 0
+ }
+
+ renderPasses: RenderPass {
+ renderStates: [
+ CullFace { mode : CullFace.Back },
+ DepthTest { depthFunction: DepthTest.Less },
+ NoDepthMask { },
+ BlendEquationArguments {
+ sourceRgb: BlendEquationArguments.SourceAlpha
+ destinationRgb: BlendEquationArguments.OneMinusSourceAlpha
+ }
+ ,BlendEquation {blendFunction: BlendEquation.Add}
+ ]
+
+ shaderProgram: alphaPhong
+ }
+ }
+ ]
+ }
+ }
+
+ PhongMaterial {
+ id: phongMaterial
+ }
+}
diff --git a/examples/qt3d/transparency-qml/phongalpha.frag b/tests/manual/transparency-qml/phongalpha.frag
index 11d4ef0d9..11d4ef0d9 100644
--- a/examples/qt3d/transparency-qml/phongalpha.frag
+++ b/tests/manual/transparency-qml/phongalpha.frag
diff --git a/examples/qt3d/transparency-qml/phongalpha.vert b/tests/manual/transparency-qml/phongalpha.vert
index 03a416213..03a416213 100644
--- a/examples/qt3d/transparency-qml/phongalpha.vert
+++ b/tests/manual/transparency-qml/phongalpha.vert
diff --git a/tests/manual/transparency-qml/transparency-qml.pro b/tests/manual/transparency-qml/transparency-qml.pro
new file mode 100644
index 000000000..260120668
--- /dev/null
+++ b/tests/manual/transparency-qml/transparency-qml.pro
@@ -0,0 +1,10 @@
+!include( ../manual.pri ) {
+ error( "Couldn't find the manual.pri file!" )
+}
+
+QT += qml quick 3dcore 3drender 3dinput 3dquick 3dquickextras
+
+SOURCES += main.cpp
+
+RESOURCES += transparency-qml.qrc
+
diff --git a/examples/qt3d/transparency-qml/transparency-qml.qrc b/tests/manual/transparency-qml/transparency-qml.qrc
index bf9772dfa..bf9772dfa 100644
--- a/examples/qt3d/transparency-qml/transparency-qml.qrc
+++ b/tests/manual/transparency-qml/transparency-qml.qrc
diff --git a/tests/tests.pro b/tests/tests.pro
index 55b817602..2ab283fc2 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -1,6 +1,8 @@
TEMPLATE = subdirs
-!package: SUBDIRS += auto
+!package: SUBDIRS += \
+ auto \
+ manual
# Benchmarks make sense in release mode only.
# Disable them for code coverage.
diff --git a/tools/qgltf/qgltf.cpp b/tools/qgltf/qgltf.cpp
index 43b8af532..b57ea8df2 100644
--- a/tools/qgltf/qgltf.cpp
+++ b/tools/qgltf/qgltf.cpp
@@ -1,34 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -194,7 +186,7 @@ Assimp::IOStream *AssimpIOSystem::Open(const char *pFile, const char *pMode)
if (file->open(openMode))
return new AssimpIOStream(file.take());
- return Q_NULLPTR;
+ return nullptr;
}
void AssimpIOSystem::Close(Assimp::IOStream *pFile)
@@ -360,9 +352,20 @@ protected:
Node *m_rootNode;
QVector<AnimationInfo> m_animations;
};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(Importer::BufferInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Importer::MeshInfo::BufferView, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Importer::MeshInfo::Accessor, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Importer::MaterialInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Importer::CameraInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Importer::EmbeddedTextureInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Importer::Node, Q_COMPLEX_TYPE); // uses address as identity
+Q_DECLARE_TYPEINFO(Importer::KeyFrame, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(Importer::AnimationInfo, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
Importer::Importer()
- : m_rootNode(Q_NULLPTR)
+ : m_rootNode(nullptr)
{
}
@@ -480,7 +483,7 @@ const Importer::Node *Importer::findNode(const Node *root, const QString &origin
if (cn)
return cn;
}
- return Q_NULLPTR;
+ return nullptr;
}
class AssimpImporter : public Importer
@@ -1104,19 +1107,19 @@ void AssimpImporter::parseAnimations()
float t = float(a->mPositionKeys[kf].mTime);
aiVector3D v = a->mPositionKeys[kf].mValue;
animInfo.hasTranslation = true;
- addKeyFrame(keyFrames, t, &v, Q_NULLPTR, Q_NULLPTR);
+ addKeyFrame(keyFrames, t, &v, nullptr, nullptr);
}
for (uint kf = 0; kf < a->mNumRotationKeys; ++kf) {
float t = float(a->mRotationKeys[kf].mTime);
aiQuaternion v = a->mRotationKeys[kf].mValue;
animInfo.hasRotation = true;
- addKeyFrame(keyFrames, t, Q_NULLPTR, &v, Q_NULLPTR);
+ addKeyFrame(keyFrames, t, nullptr, &v, nullptr);
}
for (uint kf = 0; kf < a->mNumScalingKeys; ++kf) {
float t = float(a->mScalingKeys[kf].mTime);
aiVector3D v = a->mScalingKeys[kf].mValue;
animInfo.hasScale = true;
- addKeyFrame(keyFrames, t, Q_NULLPTR, Q_NULLPTR, &v);
+ addKeyFrame(keyFrames, t, nullptr, nullptr, &v);
}
// Here we should ideally get rid of non-animated properties (that
@@ -1273,6 +1276,8 @@ private:
QVector<Param> attributes;
QVector<Param> uniforms;
};
+ friend class QTypeInfo<ProgramInfo>;
+ friend class QTypeInfo<ProgramInfo::Param>;
void writeShader(const QString &src, const QString &dst, const QVector<QPair<QByteArray, QByteArray> > &substTab);
QString exportNode(const Importer::Node *n, QJsonObject &nodes);
@@ -1290,7 +1295,7 @@ private:
QVector<ProgramInfo> m_progs;
struct TechniqueInfo {
- TechniqueInfo() : opaque(true), prog(Q_NULLPTR) { }
+ TechniqueInfo() : opaque(true), prog(nullptr) { }
TechniqueInfo(const QString &name, bool opaque, ProgramInfo *prog)
: name(name)
, opaque(opaque)
@@ -1305,6 +1310,7 @@ private:
bool opaque;
ProgramInfo *prog;
};
+ friend class QTypeInfo<TechniqueInfo>;
QVector<TechniqueInfo> m_techniques;
QSet<ProgramInfo *> m_usedPrograms;
@@ -1313,6 +1319,11 @@ private:
QHash<QString, bool> m_imageHasAlpha;
};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(GltfExporter::ProgramInfo, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(GltfExporter::ProgramInfo::Param, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(GltfExporter::TechniqueInfo, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
GltfExporter::GltfExporter(Importer *importer)
: Exporter(importer)
@@ -1760,9 +1771,10 @@ static inline void promoteColorsToRGBA(QJsonObject *obj)
const QString key = it.key();
if (key == QStringLiteral("ambient")
|| key == QStringLiteral("diffuse")
- || key == QStringLiteral("specular"))
+ || key == QStringLiteral("specular")) {
arr.append(1);
*it = arr;
+ }
}
++it;
}
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h
index 050e58ce5..7d2e76326 100644
--- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file.h
@@ -1,4 +1,5 @@
%{Cpp:LicenseTemplate}\
+
#ifndef %{GUARD}
#define %{GUARD}
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h
index 420f2edef..71203930e 100644
--- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/file_p.h
@@ -1,4 +1,5 @@
%{Cpp:LicenseTemplate}\
+
#ifndef %{PRIVATEGUARD}
#define %{PRIVATEGUARD}
diff --git a/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json b/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json
index de7053d08..c9fe63685 100644
--- a/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json
+++ b/tools/utils/qtcreator/templates/wizards/classes/qt3d/wizard.json
@@ -49,7 +49,7 @@
"data":
{
"items": [ { "trKey": "<Custom>", "value": "" },
- "QQNode", "QComponent", "QEntity", "QBackendNode" ]
+ "QNode", "QComponent", "QEntity", "QBackendNode" ]
}
},
{
diff --git a/usecases/CleanQmlDream.qml b/usecases/CleanQmlDream.qml
index d57c7f269..6e848e330 100644
--- a/usecases/CleanQmlDream.qml
+++ b/usecases/CleanQmlDream.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/usecases/ExternallyReferencedFrameGraphConfiguration.qml b/usecases/ExternallyReferencedFrameGraphConfiguration.qml
index 17c2e4880..4a55eb565 100644
--- a/usecases/ExternallyReferencedFrameGraphConfiguration.qml
+++ b/usecases/ExternallyReferencedFrameGraphConfiguration.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/usecases/InlineFrameGraphConfiguration.qml b/usecases/InlineFrameGraphConfiguration.qml
index e1cec1845..b2c8ebddb 100644
--- a/usecases/InlineFrameGraphConfiguration.qml
+++ b/usecases/InlineFrameGraphConfiguration.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/usecases/OwnershipCompose.qml b/usecases/OwnershipCompose.qml
index a82210f91..22a7d4e0c 100644
--- a/usecases/OwnershipCompose.qml
+++ b/usecases/OwnershipCompose.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/usecases/ReferencedFrameGraphConfiguration.qml b/usecases/ReferencedFrameGraphConfiguration.qml
index cefcdc7bc..512375cee 100644
--- a/usecases/ReferencedFrameGraphConfiguration.qml
+++ b/usecases/ReferencedFrameGraphConfiguration.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/usecases/SampleFrameGraphConfiguration.qml b/usecases/SampleFrameGraphConfiguration.qml
index f3c572fff..4bd552c1d 100644
--- a/usecases/SampleFrameGraphConfiguration.qml
+++ b/usecases/SampleFrameGraphConfiguration.qml
@@ -1,34 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: http://www.qt-project.org/legal
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt3D module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL3$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**